|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.platform.common.cache.ConfigCache;
|
|
import com.platform.common.cache.ConfigCache;
|
|
|
|
+import com.platform.common.constant.RedisKeyConstants;
|
|
import com.platform.common.enums.DataFilterTypeEnum;
|
|
import com.platform.common.enums.DataFilterTypeEnum;
|
|
import com.platform.common.exception.BusinessException;
|
|
import com.platform.common.exception.BusinessException;
|
|
import com.platform.common.model.UserInfo;
|
|
import com.platform.common.model.UserInfo;
|
|
@@ -63,6 +64,7 @@ import java.lang.reflect.Array;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -255,7 +257,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
// 判断设备第一维修人是否存在
|
|
// 判断设备第一维修人是否存在
|
|
SbInfo sbInfo = sbInfoService.getModelById(model.getSbId());
|
|
SbInfo sbInfo = sbInfoService.getModelById(model.getSbId());
|
|
String repairUserId = sbInfo.getRepairUser();
|
|
String repairUserId = sbInfo.getRepairUser();
|
|
- model.setStatus(StringUtils.isNotEmpty(repairUserId) ? RepairApplicationFormStatusEnum.ALLOCATED.getValue() : RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
|
|
|
|
|
|
+ model.setStatus(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
|
|
model.setApplyTime(LocalDateTime.now());
|
|
model.setApplyTime(LocalDateTime.now());
|
|
model.setCreatedTime(model.getApplyTime());
|
|
model.setCreatedTime(model.getApplyTime());
|
|
model.setUpdateTime(model.getApplyTime());
|
|
model.setUpdateTime(model.getApplyTime());
|
|
@@ -287,7 +289,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
// 通过给当天值班维修人员
|
|
// 通过给当天值班维修人员
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
model.getId(),
|
|
model.getId(),
|
|
- getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
|
|
|
|
+ MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
model.getId(), userIds, mails));
|
|
model.getId(), userIds, mails));
|
|
} else {
|
|
} else {
|
|
SysUserVO user = sysUserService.selectUserVO(repairUserId);
|
|
SysUserVO user = sysUserService.selectUserVO(repairUserId);
|
|
@@ -296,89 +298,16 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
// 通过给当天值班维修人员
|
|
// 通过给当天值班维修人员
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
|
|
model.getId(),
|
|
model.getId(),
|
|
- getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
|
|
|
|
+ MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
|
|
model.getId(), userIds, mails));
|
|
model.getId(), userIds, mails));
|
|
}
|
|
}
|
|
-
|
|
|
|
- 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);
|
|
|
|
- ClassLoader loader = RepairApplicationFormServiceImpl.class.getClassLoader();
|
|
|
|
- configuration.setClassLoaderForTemplateLoading(loader,"templates");
|
|
|
|
-
|
|
|
|
- // 配置模版文件
|
|
|
|
- try {
|
|
|
|
- Template template = configuration.getTemplate("repairEmail.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()==null?"无":model.getSbCph());
|
|
|
|
- map.put("actualUser", model.getActualUser()==null?"无":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());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取维修完成审核通知
|
|
|
|
- *
|
|
|
|
- * @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());
|
|
|
|
|
|
+ String minuteStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_WARN_MINUTE.name());
|
|
|
|
+ int minute = 30;// 默认30分钟
|
|
|
|
+ if(StringUtils.isNotBlank(minuteStr)){
|
|
|
|
+ minute = Integer.valueOf(minuteStr);
|
|
}
|
|
}
|
|
|
|
+ RedisUtils.setString(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_FIRST + RedisKeyConstants.EXPIRE_BUSINESS_SEP + model.getId(),model.getId(),minute, TimeUnit.MINUTES);
|
|
|
|
+ return form;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -503,7 +432,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
String repairUrl = domain + "repair/application/form/check?no=" + applicationForm.getNo();
|
|
String repairUrl = domain + "repair/application/form/check?no=" + applicationForm.getNo();
|
|
SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
|
|
SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
|
|
SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
|
|
- applicationForm.getId(), getFreemarkerHtmlContentCheck(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), sbInfoVO),
|
|
|
|
|
|
+ applicationForm.getId(), MessageTemplateUtil.getFreemarkerHtmlContentCheck(repairUrl,BeanConverterUtil.copyObjectProperties(applicationForm, RepairApplicationFormDTO.class), sbInfoVO),
|
|
applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));}
|
|
applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));}
|
|
|
|
|
|
/**
|
|
/**
|