| | |
| | | |
| | | package org.springblade.mdm.flow.service; |
| | | |
| | | import com.itextpdf.text.Chunk; |
| | | import com.itextpdf.text.DocumentException; |
| | | import com.itextpdf.text.Font; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.springblade.core.oss.OssTemplate; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.basesetting.machine.MachineService; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.commons.service.ParamService; |
| | | import org.springblade.mdm.commons.support.TemplatedPdfWriter; |
| | | import org.springblade.mdm.flow.constants.FlowContants; |
| | | import org.springblade.mdm.basesetting.producedivision.entity.ProduceDivision; |
| | | import org.springblade.mdm.basesetting.producedivision.service.ProduceDivisionService; |
| | | import org.springblade.mdm.commons.service.UserCommonService; |
| | | import org.springblade.mdm.flow.vo.ApproveTableInfo; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.entity.NcProgramApproved; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private IUserClient useClient; |
| | | @Autowired |
| | | private NcProgramApprovedService programApprovedService; |
| | | |
| | | @Autowired |
| | | private ProduceDivisionService produceDivisionService; |
| | | @Autowired |
| | | private UserCommonService userCommonService; |
| | | /** |
| | | * 获取实际审批人姓名,和时间 |
| | | * @param props 流程属性 |
| | |
| | | seniorId = Func.toLong(task.getAssignee()); |
| | | } |
| | | } |
| | | |
| | | appInfo.setTeamLeaderName(getNameByUserid(teamLeaderId)); |
| | | appInfo.setProgrammerName(getNameByUserid(programmerId)); |
| | | appInfo.setCheckerName(getNameByUserid(checkerId)); |
| | | appInfo.setSeniorName(getNameByUserid(seniorId)); |
| | | if(teamLeaderId != 0) { |
| | | appInfo.setTeamLeaderName(userCommonService.getUserNameById(teamLeaderId)); |
| | | }else{ |
| | | //没找到组长(不是试切任务),直接查找零件号对应得数据 |
| | | try { |
| | | ProduceDivision div = produceDivisionService.getByDrawingNoWithQinzhe(props.getDrawingNo()); |
| | | appInfo.setTeamLeaderName(userCommonService.getUserNameById(div.getTeamLeaderId())); |
| | | }catch(Exception e){ |
| | | log.error("根据零件号:{}找不到人员职责表数据",props.getDrawingNo(),e); |
| | | appInfo.setTeamLeaderName(""); |
| | | } |
| | | } |
| | | appInfo.setProgrammerName(userCommonService.getUserNameById(programmerId)); |
| | | appInfo.setCheckerName(userCommonService.getUserNameById(checkerId)); |
| | | appInfo.setSeniorName(userCommonService.getUserNameById(seniorId)); |
| | | |
| | | //查询数控程序编号 |
| | | Optional<NcProgramApproved> appOpt = programApprovedService.lambdaQuery().eq(NcProgramApproved::getProcessInstanceId, props.getProcessInstanceId()).oneOpt(); |
| | |
| | | return appInfo; |
| | | } |
| | | |
| | | String getNameByUserid(Long userid){ |
| | | String name = StringUtils.EMPTY; |
| | | //审核 |
| | | R<User> userR = useClient.userInfoById(userid); |
| | | if (userR.isSuccess()) { |
| | | name = userR.getData().getName(); |
| | | } |
| | | return name; |
| | | } |
| | | } |