|
@@ -10,10 +10,12 @@ import com.platform.dao.dto.repair.RepairApplicationFormDTO;
|
|
|
import com.platform.dao.dto.upms.SysUserDTO;
|
|
|
import com.platform.dao.entity.repair.RepairApplicationForm;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
-import com.platform.dao.enums.RepairApplicationFormStatusEnum;
|
|
|
-import com.platform.dao.enums.SysConfigEnum;
|
|
|
-import com.platform.dao.enums.SysRoleCodeEnum;
|
|
|
+import com.platform.dao.entity.upms.SysUser;
|
|
|
+import com.platform.dao.enums.*;
|
|
|
+import com.platform.dao.util.MessageTemplateUtil;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
|
+import com.platform.dao.vo.sb.SbInfoVO;
|
|
|
+import com.platform.service.event.WorkplaceBacklogEvent;
|
|
|
import com.platform.service.repair.strategy.AbstractRepairBaseStrategy;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -126,4 +128,45 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
|
|
|
sendMessageToRepairCaller(superModel.getId(),superModel.getNo(),superModel.getUserId());
|
|
|
return model;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RepairApplicationForm submitRepair(RepairApplicationFormDTO model) {
|
|
|
+ RepairApplicationForm applicationForm = super.submitRepair(model);
|
|
|
+ SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
|
|
|
+ // 默认的提交审核后的审核人,就是维修主管的角色,每家不同自行实现
|
|
|
+ SysUserVO userVO;
|
|
|
+ SysUserDTO query = new SysUserDTO();
|
|
|
+ query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
|
|
|
+ List<SysUserVO> users = sysUserService.selectDeptRoleUser(query);
|
|
|
+ if (CollectionUtil.isNotEmpty(users)) {
|
|
|
+ userVO = users.get(0);
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("审核角色:REPAIR_EXAMINE未绑定用户,REPAIR_EXAMINE为维修单最终验收人,请设置用户");
|
|
|
+ }
|
|
|
+ applicationForm.setCheckUserId(userVO.getUserId());
|
|
|
+ repairApplicationFormMapper.updateByPrimaryKeySelective(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.REPAIR.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())));
|
|
|
+ return applicationForm;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RepairApplicationFormDTO verifyRefused(RepairApplicationFormDTO model) {
|
|
|
+ RepairApplicationFormDTO dto = super.verifyRefused(model);
|
|
|
+ SysUser noticeUser = sysUserService.getModelById(dto.getRepairUserId());
|
|
|
+ SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_BACK.getValue(),
|
|
|
+ dto.getId(), MessageTemplateUtil.getRepairBack(dto.getNo()),
|
|
|
+ dto.getId(), ListUtils.newArrayList(dto.getRepairUserId()), ListUtils.newArrayList(noticeUser.getEmail())));
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
}
|