|
@@ -192,7 +192,18 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
int count = mapper.selectCountByExample(weekend);
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
model.setUserId(userInfo.getUserId());
|
|
|
- //model.setCheckUserId(userInfo.getUserId());
|
|
|
+
|
|
|
+ // 设置维修审批人为验收人,进行最终验收
|
|
|
+ SysUserDTO query = new SysUserDTO();
|
|
|
+ query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
|
|
|
+ List<SysUserVO> users = userMapper.selectDeptRoleUser(query);
|
|
|
+ SysUserVO userVO = null;
|
|
|
+ if (CollectionUtil.isNotEmpty(users)) {
|
|
|
+ userVO = users.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("审核角色:REPAIR_EXAMINE未绑定用户,请设置用户");
|
|
|
+ }
|
|
|
+ model.setCheckUserId(userVO.getUserId());
|
|
|
// 查询对应的维修人,保存维修单
|
|
|
String sbId = model.getSbId();
|
|
|
SbInfoVO sb = sbInfoService.getById(sbId);
|
|
@@ -248,10 +259,10 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
}
|
|
|
String repairUrl = domain + "repair/form?no=" + model.getNo();
|
|
|
if (StringUtils.isEmpty(repairUserId)) {
|
|
|
- List<SysUser> users = sysUserService.getRepairUser(new SysUserDTO());
|
|
|
- List<SysUser> filterUsers = users.stream().filter(item -> item.getWorkFlag()).collect(Collectors.toList());
|
|
|
+ List<SysUser> userList = sysUserService.getRepairUser(new SysUserDTO());
|
|
|
+ List<SysUser> filterUsers = userList.stream().filter(item -> item.getWorkFlag()).collect(Collectors.toList());
|
|
|
if (CollectionUtil.isEmpty(filterUsers)) {
|
|
|
- filterUsers = users.stream().filter(item -> item.getIdentityType().equals(SysUserIdentityType.WXZG.getValue())).collect(Collectors.toList());
|
|
|
+ filterUsers = userList.stream().filter(item -> item.getIdentityType().equals(SysUserIdentityType.WXZG.getValue())).collect(Collectors.toList());
|
|
|
}
|
|
|
filterUsers.forEach(item -> {
|
|
|
userIds.add(item.getUserId());
|
|
@@ -276,6 +287,14 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
return form;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取维修通知
|
|
|
+ *
|
|
|
+ * @param url
|
|
|
+ * @param model
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private String getFreemarkerHtmlContent(String url, RepairApplicationFormDTO model, SbInfoVO vo){
|
|
|
// 首先配置 FreeMarker 模版位置
|
|
|
Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
|
|
@@ -307,6 +326,45 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取维修完成审核通知
|
|
|
+ *
|
|
|
+ * @param url
|
|
|
+ * @param model
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getFreemarkerHtmlContentCheck(String url, RepairApplicationFormDTO model, SbInfoVO vo){
|
|
|
+ // 首先配置 FreeMarker 模版位置
|
|
|
+ Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
|
|
|
+ ClassLoader loader = RepairApplicationFormServiceImpl.class.getClassLoader();
|
|
|
+ configuration.setClassLoaderForTemplateLoading(loader,"templates");
|
|
|
+
|
|
|
+ // 配置模版文件
|
|
|
+ try {
|
|
|
+ Template template = configuration.getTemplate("repairCheckEmail.ftl");
|
|
|
+ StringWriter mail = new StringWriter();
|
|
|
+ //构造填充数据的Map
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("no", model.getNo());
|
|
|
+ map.put("sbName", vo.getName());
|
|
|
+ map.put("sbNo", vo.getNo());
|
|
|
+ map.put("sbCph", model.getSbCph());
|
|
|
+ map.put("actualUser", model.getActualUser());
|
|
|
+ if(StringUtils.isBlank(model.getContent())){
|
|
|
+ map.put("repairDesc", "无法断定,请维修人员现场检查");
|
|
|
+ }else{
|
|
|
+ map.put("repairDesc", model.getContent());
|
|
|
+ }
|
|
|
+ map.put("url", url);
|
|
|
+ template.process(map,mail);
|
|
|
+ System.out.println(map.toString());
|
|
|
+ return mail.toString();
|
|
|
+ } catch (IOException | TemplateException e) {
|
|
|
+ throw new BusinessException("报修邮件模板解析出错。" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void modModelByDTO(RepairApplicationFormDTO model) {
|
|
|
if(StringUtils.isBlank(model.getSbId())){
|
|
@@ -381,9 +439,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
if (!RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue().equals(applicationForm.getStatus()) && !RepairApplicationFormStatusEnum.ALLOCATED.getValue().equals(applicationForm.getStatus()) && !RepairApplicationFormStatusEnum.REBACK.getValue().equals(applicationForm.getStatus())) {
|
|
|
throw new BusinessException("该状态不允许接收任务");
|
|
|
}
|
|
|
- if (!RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue().equals(applicationForm.getStatus())) {
|
|
|
- applicationForm.setRepairUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
- }
|
|
|
+ applicationForm.setRepairUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
applicationForm.setStatus(RepairApplicationFormStatusEnum.PROCESSING.getValue());
|
|
|
applicationForm.setRepairStartTime(LocalDateTime.now());
|
|
|
applicationForm.setUpdateTime(LocalDateTime.now());
|
|
@@ -397,17 +453,19 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
|
|
|
/**
|
|
|
* 发起审核给领导人,必须完成后的报修单才可以提交审核
|
|
|
+ * 给领导发邮件,领导通过邮件跳转到审核页面
|
|
|
*
|
|
|
* @param id :
|
|
|
*/
|
|
|
@Override
|
|
|
public void examine(String id) {
|
|
|
RepairApplicationForm applicationForm = mapper.selectById(id);
|
|
|
- if (!RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue().equals(applicationForm.getStatus())) {
|
|
|
+ if (!RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue().equals(applicationForm.getStatus())) {
|
|
|
throw new BusinessException("未完成的不允许提交审核");
|
|
|
}
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.EXAMINING.getValue());
|
|
|
- applicationForm.setUpdateTime(LocalDateTime.now());
|
|
|
+ applicationForm.setStatus(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
|
|
|
+ applicationForm.setCheckStartTime(LocalDateTime.now());
|
|
|
+ applicationForm.setUpdateTime(applicationForm.getCheckStartTime());
|
|
|
super.modModelByPrimaryKey(applicationForm);
|
|
|
SysUserDTO query = new SysUserDTO();
|
|
|
query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
|
|
@@ -418,8 +476,18 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
}else{
|
|
|
throw new BusinessException("审核角色为绑定用户,请设置用户");
|
|
|
}
|
|
|
+
|
|
|
+ String domain = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_DOMAIN.name());
|
|
|
+ if(StringUtils.isBlank(domain)){
|
|
|
+ throw new BusinessException("请先设置系统域名地址,系统管理-》系统参数配置-》SYSTEM_DOMAIN");
|
|
|
+ }
|
|
|
+ if(!domain.endsWith("/")){
|
|
|
+ domain = domain + "/";
|
|
|
+ }
|
|
|
+ String repairUrl = domain + "repair/application/form/check?no=" + applicationForm.getNo();
|
|
|
+ SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
|
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
|
|
|
- applicationForm.getId(), MessageTemplateUtil.getReceiveExamine(applicationForm.getNo()),
|
|
|
+ applicationForm.getId(), getFreemarkerHtmlContent(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), sbInfoVO),
|
|
|
applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));}
|
|
|
|
|
|
/**
|
|
@@ -427,7 +495,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
*
|
|
|
* @param id :
|
|
|
*/
|
|
|
- @Override
|
|
|
+ /*@Override
|
|
|
public void examined(String id, Integer result, RepairApplicationFormDTO dto) {
|
|
|
RepairApplicationForm applicationForm = mapper.selectById(id);
|
|
|
if (!RepairApplicationFormStatusEnum.EXAMINING.getValue().equals(applicationForm.getStatus())) {
|
|
@@ -441,7 +509,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
applicationForm.setUpdateTime(LocalDateTime.now());
|
|
|
applicationForm.setExamineContent(dto.getExamineContent());
|
|
|
super.modModelByPrimaryKey(applicationForm);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 派工,更新维修人的id
|
|
@@ -487,6 +555,11 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
applicationForm.getId(), ListUtils.newArrayList(model.getRepairUserId()), ListUtils.newArrayList(repairUser.getEmail())));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 完成为待验收状态,此时需要再次编辑维修内容,最终提交审核
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ */
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void finish(RepairApplicationFormDTO dto) {
|
|
@@ -495,12 +568,10 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
RepairApplicationForm applicationForm = mapper.selectById(dto.getId());
|
|
|
RepairForm repairForm = new RepairForm();
|
|
|
repairForm.setId(dto.getId());
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
-
|
|
|
+ applicationForm.setStatus(RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue());
|
|
|
applicationForm.setRepairEndTime(LocalDateTime.now());
|
|
|
applicationForm.setRepairMinutes(DateUtils.dateDiff(applicationForm.getRepairEndTime(), applicationForm.getRepairStartTime()));
|
|
|
- applicationForm.setCheckStartTime(applicationForm.getRepairEndTime());
|
|
|
- applicationForm.setCheckEndTime(applicationForm.getRepairEndTime());
|
|
|
+
|
|
|
applicationForm.setRepairContent(dto.getRepairContent());
|
|
|
applicationForm.setNeedStop(dto.getNeedStop());
|
|
|
//applicationForm.setLevel(dto.getLevel());
|
|
@@ -553,6 +624,11 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 领导最终验收,进行数据项目的验收
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ */
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void approve(RepairApplicationFormDTO dto) {
|
|
@@ -560,7 +636,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
RepairApplicationForm applicationForm = mapper.selectById(dto.getId());
|
|
|
applicationForm.setCheckEndTime(LocalDateTime.now());
|
|
|
applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
- applicationForm.setUpdateTime(LocalDateTime.now());
|
|
|
+ applicationForm.setUpdateTime(applicationForm.getCheckEndTime());
|
|
|
super.modModelByPrimaryKey(applicationForm);
|
|
|
|
|
|
// 如果选择了设备停机,则要修改设备状态
|
|
@@ -569,10 +645,10 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
info.setStatus(SbInfoStatusEnum.IN_USE.getValue());
|
|
|
sbInfoService.modModelByPrimaryKey(info);
|
|
|
|
|
|
- SysUser noticeUser = userMapper.selectByPrimaryKey(applicationForm.getRepairUserId());
|
|
|
+ /*SysUser noticeUser = userMapper.selectByPrimaryKey(applicationForm.getRepairUserId());
|
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_OK.getValue(),
|
|
|
applicationForm.getId(), MessageTemplateUtil.getRepairOk(applicationForm.getNo()),
|
|
|
- applicationForm.getId(), ListUtils.newArrayList(applicationForm.getRepairUserId()), ListUtils.newArrayList(noticeUser.getEmail())));
|
|
|
+ applicationForm.getId(), ListUtils.newArrayList(applicationForm.getRepairUserId()), ListUtils.newArrayList(noticeUser.getEmail())));*/
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|