|
@@ -206,17 +206,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
if(model.getSource() == null){
|
|
|
model.setSource(1);
|
|
|
}
|
|
|
- // 设置维修审批人为验收人,进行最终验收
|
|
|
- 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);
|
|
@@ -253,19 +243,29 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
model.setOutNo(model.getOutNo());
|
|
|
model.setNo(IdGeneratorUtils.getRepairApplicaitonFormNo(++count));
|
|
|
|
|
|
- // 判断设备第一维修人是否存在
|
|
|
+ // 循环给第一维修人和第二维修人发消息
|
|
|
+ List<String> userIds = new ArrayList<>();
|
|
|
+ List<String> mails = new ArrayList<>();
|
|
|
SbInfo sbInfo = sbInfoService.getModelById(model.getSbId());
|
|
|
- String repairUserId = sbInfo.getRepairUser();
|
|
|
+ if(StringUtils.isNotBlank(sbInfo.getRepairUser())){
|
|
|
+ SysUserVO user = sysUserService.selectUserVO(sbInfo.getRepairUser());
|
|
|
+ userIds.add(sbInfo.getRepairUser());
|
|
|
+ mails.add(user.getEmail());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(sbInfo.getRepairUserSecond())){
|
|
|
+ SysUserVO user = sysUserService.selectUserVO(sbInfo.getRepairUserSecond());
|
|
|
+ userIds.add(sbInfo.getRepairUserSecond());
|
|
|
+ mails.add(user.getEmail());
|
|
|
+ }
|
|
|
model.setStatus(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
|
|
|
model.setApplyTime(LocalDateTime.now());
|
|
|
model.setCreatedTime(model.getApplyTime());
|
|
|
model.setUpdateTime(model.getApplyTime());
|
|
|
model.setId(IdGeneratorUtils.getObjectId());
|
|
|
this.saveFile(model);
|
|
|
+
|
|
|
RepairApplicationForm form = BeanConverterUtil.copyObjectProperties(model, RepairApplicationForm.class);
|
|
|
int result = mapper.insert(form);
|
|
|
- List<String> userIds = new ArrayList<>();
|
|
|
- List<String> mails = new ArrayList<>();
|
|
|
|
|
|
String domain = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_DOMAIN.name());
|
|
|
if(StringUtils.isBlank(domain)){
|
|
@@ -275,31 +275,14 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
domain = domain + "/";
|
|
|
}
|
|
|
String repairUrl = domain + "repair/form?no=" + model.getNo();
|
|
|
- if (StringUtils.isEmpty(repairUserId)) {
|
|
|
- List<SysUser> userList = sysUserService.getRepairUser(new SysUserDTO());
|
|
|
- List<SysUser> filterUsers = userList.stream().filter(item -> item.getWorkFlag()).collect(Collectors.toList());
|
|
|
- if (CollectionUtil.isEmpty(filterUsers)) {
|
|
|
- filterUsers = userList.stream().filter(item -> item.getIdentityType().equals(SysUserIdentityType.WXZG.getValue())).collect(Collectors.toList());
|
|
|
- }
|
|
|
- filterUsers.forEach(item -> {
|
|
|
- userIds.add(item.getUserId());
|
|
|
- mails.add(item.getEmail());
|
|
|
- });
|
|
|
- // 通过给当天值班维修人员
|
|
|
- SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
|
- model.getId(),
|
|
|
- MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
|
- model.getId(), userIds, mails));
|
|
|
- } else {
|
|
|
- SysUserVO user = sysUserService.selectUserVO(repairUserId);
|
|
|
- userIds.add(repairUserId);
|
|
|
- mails.add(user.getEmail());
|
|
|
- // 通过给当天值班维修人员
|
|
|
- SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
|
- model.getId(),
|
|
|
- MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
|
- model.getId(), userIds, mails));
|
|
|
- }
|
|
|
+
|
|
|
+ // 通过给当天值班维修人员
|
|
|
+ SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
|
+ model.getId(),
|
|
|
+ MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
|
+ model.getId(), userIds, mails));
|
|
|
+
|
|
|
+ // 启动接收超时监控
|
|
|
String minuteStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_WARN_MINUTE.name());
|
|
|
int minute = 30;// 默认30分钟
|
|
|
if(StringUtils.isNotBlank(minuteStr)){
|
|
@@ -307,7 +290,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
}
|
|
|
RedisUtils.setString(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_FIRST + RedisKeyConstants.EXPIRE_BUSINESS_SEP + model.getId(),model.getId(),minute, TimeUnit.MINUTES);
|
|
|
|
|
|
- // 维修时间升级流程:超过3个小时没修好,升级给牛工,超过8个小时没修好,升级给相工,超过24 没修好,升级给田总,现在把三阶段的人员位置留好,可以先暂时升级给我,后期再改为具体的人。
|
|
|
+ // 启动维修超时监控,维修时间升级流程:超过3个小时没修好,升级给牛工,超过8个小时没修好,升级给相工,超过24 没修好,升级给田总,现在把三阶段的人员位置留好,可以先暂时升级给我,后期再改为具体的人。
|
|
|
String hourFirstStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_OVERTIME_MINUTE_FIRST.name());
|
|
|
int hourFirst = 3;// 默认3小时
|
|
|
if(StringUtils.isNotBlank(hourFirstStr)){
|
|
@@ -428,66 +411,6 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 发起审核给领导人,必须完成后的报修单才可以提交审核
|
|
|
- * 给领导发邮件,领导通过邮件跳转到审核页面
|
|
|
- *
|
|
|
- * @param id :
|
|
|
- */
|
|
|
- @Override
|
|
|
- public void examine(String id) {
|
|
|
- RepairApplicationForm applicationForm = mapper.selectById(id);
|
|
|
- /*if (!RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue().equals(applicationForm.getStatus())) {
|
|
|
- throw new BusinessException("未完成的不允许提交审核");
|
|
|
- }*/
|
|
|
- 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());
|
|
|
- List<SysUserVO> users = userMapper.selectDeptRoleUser(query);
|
|
|
- SysUserVO userVO = null;
|
|
|
- if (CollectionUtil.isNotEmpty(users)) {
|
|
|
- userVO = users.get(0);
|
|
|
- }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.getFreemarkerHtmlContentCheck(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), sbInfoVO),
|
|
|
- applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));}
|
|
|
-
|
|
|
- /**
|
|
|
- * 进行维修单审核
|
|
|
- *
|
|
|
- * @param id :
|
|
|
- */
|
|
|
- /*@Override
|
|
|
- public void examined(String id, Integer result, RepairApplicationFormDTO dto) {
|
|
|
- RepairApplicationForm applicationForm = mapper.selectById(id);
|
|
|
- if (!RepairApplicationFormStatusEnum.EXAMINING.getValue().equals(applicationForm.getStatus())) {
|
|
|
- throw new BusinessException("该状态不允许审核,请检查维修单状态");
|
|
|
- }
|
|
|
- if(result == 1){
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.EXAMINED.getValue());
|
|
|
- }else{// 打回,重新完善维修单, 再次提交审核
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
- }
|
|
|
- applicationForm.setUpdateTime(LocalDateTime.now());
|
|
|
- applicationForm.setExamineContent(dto.getExamineContent());
|
|
|
- super.modModelByPrimaryKey(applicationForm);
|
|
|
- }*/
|
|
|
-
|
|
|
/**
|
|
|
* 派工,更新维修人的id
|
|
|
*
|
|
@@ -595,34 +518,63 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
SbInfo sbInfo = sbInfoService.getModelById(applicationForm.getSbId());
|
|
|
sbInfo.setStatus(SbInfoStatusEnum.IN_USE.getValue());
|
|
|
sbInfoService.modModelByPrimaryKey(sbInfo);
|
|
|
+ }
|
|
|
|
|
|
- /*String userId = applicationForm.getUserId();
|
|
|
- applicationForm.setCheckUserId(userId);*/
|
|
|
- /*// 维修人自己发起报修自己验收
|
|
|
- if (userId.equals(applicationForm.getRepairUserId())) {
|
|
|
- // 1.修改验收单状态和验收验收时间
|
|
|
- applicationForm.setCheckEndTime(LocalDateTime.now());
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
- applicationForm.setUpdateTime(LocalDateTime.now());
|
|
|
- super.modModelByPrimaryKey(applicationForm);
|
|
|
+ /**
|
|
|
+ * 发起审核给领导人,必须完成后的报修单才可以提交审核
|
|
|
+ * 给领导发邮件,领导通过邮件跳转到审核页面
|
|
|
+ * 判断接收人是设备的第一维修人,如果是要提交给第二维修人进行审核,这个时候维修单状态不变。
|
|
|
+ * 如果是第二维修人,则直接提报给牛工进行审核即可。
|
|
|
+ * @param id :
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void examine(String id) {
|
|
|
+ RepairApplicationForm applicationForm = mapper.selectById(id);
|
|
|
+ if (!RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue().equals(applicationForm.getStatus())) {
|
|
|
+ throw new BusinessException("未完成的不允许提交审核");
|
|
|
+ }
|
|
|
+ applicationForm.setStatus(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
|
|
|
+ applicationForm.setCheckStartTime(LocalDateTime.now());
|
|
|
+ applicationForm.setUpdateTime(applicationForm.getCheckStartTime());
|
|
|
+ SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
|
|
|
+ // 第一维修人发给第二维系人验收,第二维修人发给牛工验收
|
|
|
+ SysUserVO userVO = null;
|
|
|
+ String checkUserId = null;
|
|
|
+ if(applicationForm.getRepairUserId().equals(sbInfoVO.getRepairUser())){
|
|
|
+ applicationForm.setCheckUserId(sbInfoVO.getRepairUserSecond());
|
|
|
+ userVO = BeanConverterUtil.copyObjectProperties(userMapper.selectByPrimaryKey(sbInfoVO.getRepairUserSecond()), SysUserVO.class);
|
|
|
+ }else{
|
|
|
+ SysUserDTO query = new SysUserDTO();
|
|
|
+ query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
|
|
|
+ List<SysUserVO> users = userMapper.selectDeptRoleUser(query);
|
|
|
+ if (CollectionUtil.isNotEmpty(users)) {
|
|
|
+ userVO = users.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("审核角色:REPAIR_EXAMINE未绑定用户,REPAIR_EXAMINE为维修单最终验收人,请设置用户");
|
|
|
+ }
|
|
|
+ applicationForm.setCheckUserId(userVO.getUserId());
|
|
|
+ }
|
|
|
|
|
|
- // 如果选择了设备停机,则要修改设备状态为启动
|
|
|
- SbInfo info = new SbInfo();
|
|
|
- info.setId(applicationForm.getSbId());
|
|
|
- info.setStatus(SbInfoStatusEnum.IN_USE.getValue());
|
|
|
- sbInfoService.modModelByPrimaryKey(info);
|
|
|
- } else {
|
|
|
- super.modModelByPrimaryKey(applicationForm);
|
|
|
- // 发送通知给主管,主管是验收人,他收到通知,进行调拨给使用人员
|
|
|
- *//* SysUser checkUser = userMapper.selectByPrimaryKey(applicationForm.getCheckUserId());
|
|
|
- SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_FINISH.getValue(),
|
|
|
- applicationForm.getId(), MessageTemplateUtil.getRepairCheck(applicationForm.getNo()),
|
|
|
- applicationForm.getId(), ListUtils.newArrayList(applicationForm.getCheckUserId()), ListUtils.newArrayList(checkUser.getEmail())));*//*
|
|
|
- }*/
|
|
|
+ super.modModelByPrimaryKey(applicationForm);
|
|
|
+
|
|
|
+ // 发送邮件和通知
|
|
|
+ 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();
|
|
|
+ SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
|
|
|
+ applicationForm.getId(), MessageTemplateUtil.getFreemarkerHtmlContentCheck(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), sbInfoVO),
|
|
|
+ applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 领导最终验收,进行数据项目的验收
|
|
|
+ * 领导验收,进行数据项目的验收
|
|
|
+ * 判断领导是否是牛工身份,如果是这关闭单子,
|
|
|
+ * 如果不是还要提交给牛工验收一次,且状态不改变,直接提给牛工
|
|
|
*
|
|
|
* @param dto
|
|
|
*/
|
|
@@ -631,23 +583,42 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
public void approve(RepairApplicationFormDTO dto) {
|
|
|
// 1.修改验收单状态和验收验收时间
|
|
|
RepairApplicationForm applicationForm = mapper.selectById(dto.getId());
|
|
|
- applicationForm.setCheckEndTime(LocalDateTime.now());
|
|
|
- applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
- applicationForm.setUpdateTime(applicationForm.getCheckEndTime());
|
|
|
- super.modModelByPrimaryKey(applicationForm);
|
|
|
-
|
|
|
// 如果选择了设备停机,则要修改设备状态
|
|
|
- SbInfo info = new SbInfo();
|
|
|
- info.setId(applicationForm.getSbId());
|
|
|
+ SbInfo info = sbInfoService.getModelById(applicationForm.getSbId());
|
|
|
info.setStatus(SbInfoStatusEnum.IN_USE.getValue());
|
|
|
sbInfoService.modModelByPrimaryKey(info);
|
|
|
|
|
|
- /*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())));*/
|
|
|
- }
|
|
|
+ if(applicationForm.getCheckUserId().equals(info.getRepairUserSecond())){
|
|
|
+ SysUserVO userVO = null;
|
|
|
+ SysUserDTO query = new SysUserDTO();
|
|
|
+ query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
|
|
|
+ List<SysUserVO> users = userMapper.selectDeptRoleUser(query);
|
|
|
+ if (CollectionUtil.isNotEmpty(users)) {
|
|
|
+ userVO = users.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("审核角色:REPAIR_EXAMINE未绑定用户,REPAIR_EXAMINE为维修单最终验收人,请设置用户");
|
|
|
+ }
|
|
|
+ applicationForm.setCheckUserId(userVO.getUserId());
|
|
|
|
|
|
+ // 发送邮件和通知
|
|
|
+ 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();
|
|
|
+ SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
|
|
|
+ applicationForm.getId(), MessageTemplateUtil.getFreemarkerHtmlContentCheck(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), BeanConverterUtil.copyObjectProperties(info, SbInfoVO.class)),
|
|
|
+ applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));
|
|
|
+ }else{
|
|
|
+ applicationForm.setCheckEndTime(LocalDateTime.now());
|
|
|
+ applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
|
|
|
+ }
|
|
|
+ applicationForm.setUpdateTime(applicationForm.getCheckEndTime());
|
|
|
+ super.modModelByPrimaryKey(applicationForm);
|
|
|
+ }
|
|
|
/**
|
|
|
* 验收是主管验收,驳回到待审核状态
|
|
|
*
|