| | |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.inspect.util.UserUtils; |
| | | import com.ruoyi.personnel.dto.PersonTrainingDetailedDto; |
| | | import com.ruoyi.personnel.dto.PersonTrainingDto; |
| | | import com.ruoyi.personnel.dto.PersonTrainingRecordDto; |
| | |
| | | message += "CNAS培训计划审核通知"; |
| | | message += "\n请去资源管理-人员-培训计划填写"; |
| | | message += "\n" + fileName + "的培训计划待审核"; |
| | | //发送企业微信消息通知 |
| | | //发送企业微信消息通知(接收人不存在或发送失败不影响导入流程) |
| | | if (personnel == null || StringUtils.isBlank(personnel.getAccount())) { |
| | | return; |
| | | } |
| | | try { |
| | | WxCpUtils.inform(personnel.getAccount(), message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | |
| | |
| | | // 查询人员培训明细 |
| | | PersonTrainingDetailedDto detailedDto = personTrainingDetailedMapper.selectTrainingDetail(id); |
| | | |
| | | // 生成培训老师签名 |
| | | detailedDto.setTrainingLecturerRender(StringUtils.isNotBlank(detailedDto.getTrainingLecturerSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + detailedDto.getTrainingLecturerSignatureUrl()).create() : null); |
| | | // 生成培训老师签名(未配置签名时用透明图片兜底,模板里的图片占位不能为 null) |
| | | detailedDto.setTrainingLecturerRender(UserUtils.orTransparentPicture( |
| | | StringUtils.isNotBlank(detailedDto.getTrainingLecturerSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + detailedDto.getTrainingLecturerSignatureUrl()).create() : null)); |
| | | |
| | | // 查询培训的人员 |
| | | List<PersonTrainingRecordDto> recordDtos = personTrainingRecordMapper.selectListByTrainingDetailedId(id); |
| | |
| | | for (PersonTrainingRecordDto recordDto : recordDtos) { |
| | | switch (count) { |
| | | case 0: |
| | | exportDto.setUserNameRender1(StringUtils.isNotBlank(recordDto.getSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + recordDto.getSignatureUrl()).create() : null); |
| | | exportDto.setUserNameRender1(UserUtils.orTransparentPicture(StringUtils.isNotBlank(recordDto.getSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + recordDto.getSignatureUrl()).create() : null)); |
| | | exportDto.setDepartment1(recordDto.getDepartment()); |
| | | exportDto.setExaminationResults1(recordDto.getExaminationResults()); |
| | | count ++; |
| | | break; |
| | | case 1: |
| | | exportDto.setUserNameRender2(StringUtils.isNotBlank(recordDto.getSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + recordDto.getSignatureUrl()).create() : null); |
| | | exportDto.setUserNameRender2(UserUtils.orTransparentPicture(StringUtils.isNotBlank(recordDto.getSignatureUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + recordDto.getSignatureUrl()).create() : null)); |
| | | exportDto.setDepartment2(recordDto.getDepartment()); |
| | | exportDto.setExaminationResults2(recordDto.getExaminationResults()); |
| | | exportDtoList.add(exportDto); |
| | |
| | | break; |
| | | } |
| | | } |
| | | exportDtoList.add(exportDto); |
| | | // 只有单数条记录时,最后一行才有数据;偶数条时 exportDto 是空对象,不能加进表格 |
| | | if (count != 0) { |
| | | exportDtoList.add(exportDto); |
| | | } |
| | | |
| | | // 质量负责人 |
| | | // 质量负责人(未签名时用透明图片兜底) |
| | | String assessmentUserUrl = null; |
| | | if (detailedDto.getAssessmentUserId() != null) { |
| | | assessmentUserUrl = userMapper.selectById(detailedDto.getAssessmentUserId()).getSignatureUrl(); |
| | | if (StringUtils.isBlank(assessmentUserUrl)) { |
| | | throw new ErrorException("找不到评价人的签名"); |
| | | User assessmentUser = userMapper.selectById(detailedDto.getAssessmentUserId()); |
| | | if (assessmentUser != null) { |
| | | assessmentUserUrl = assessmentUser.getSignatureUrl(); |
| | | } |
| | | } |
| | | |
| | |
| | | new HashMap<String, Object>() {{ |
| | | put("trainingDetail", detailedDto); |
| | | put("trainingRecordsList", exportDtoList); |
| | | put("assessmentUserUrl", StringUtils.isNotBlank(finalAssessmentUserUrl) ? Pictures.ofLocal(imgUrl + "/" + finalAssessmentUserUrl).create() : null); |
| | | put("assessmentUserUrl", UserUtils.orTransparentPicture(StringUtils.isNotBlank(finalAssessmentUserUrl) |
| | | ? Pictures.ofLocal(imgUrl + "/" + finalAssessmentUserUrl).create() : null)); |
| | | }}); |
| | | try { |
| | | response.setContentType("application/msword"); |