Kaynağa Gözat

报修完善

xiongchao 3 yıl önce
ebeveyn
işleme
ccfe254833

+ 8 - 0
platform-common/src/main/java/com/platform/common/config/RedisConfig.java

@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
@@ -57,4 +58,11 @@ public class RedisConfig {
     public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
         return redisTemplate.opsForZSet();
     }
+
+    @Bean
+    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
+        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+        container.setConnectionFactory(connectionFactory);
+        return container;
+    }
 }

+ 20 - 1
platform-common/src/main/java/com/platform/common/constant/RedisKeyConstants.java

@@ -21,6 +21,25 @@ public class RedisKeyConstants {
      * 微信 ticket_token
      */
     public static final String WECHAT_TICKET_TOKEN = "ticket_token";
-
+    /**
+     * 过期监控业务分隔符
+     */
+    public static final String EXPIRE_BUSINESS_SEP = "-";
+    /**
+     * 过期监控业务前缀-报修过期监听-第一阶段-推送给第二维修人
+     */
+    public static final String EXPIRE_BUSINESS_KEY_REPAIR = "business_repair";
+    /**
+     * 过期监控业务前缀-报修过期监听-第一阶段-推送给第二维修人
+     */
+    public static final String EXPIRE_BUSINESS_KEY_REPAIR_STEP_FIRST = "business_repair_step_first";
+    /**
+     * 过期监控业务前缀-报修过期监听-第二阶段-推送给吴
+     */
+    public static final String EXPIRE_BUSINESS_KEY_REPAIR_STEP_SECOND = "business_repair_step_second";
+    /**
+     * 过期监控业务前缀-报修过期监听-第三阶段-推送给牛
+     */
+    public static final String EXPIRE_BUSINESS_KEY_REPAIR_STEP_THIRD = "business_repair_step_third";
 
 }

+ 3 - 1
platform-dao/src/main/java/com/platform/dao/enums/SysConfigEnum.java

@@ -30,7 +30,9 @@ public enum SysConfigEnum {
     SYSTEM_DOMAIN("系统域名"),
     SYSTEM_DOMAIN_MOBILE("系统移动端域名"),
     SYSTEM_SB_URL("设备地址前缀"),
-    REPAIR_ONLY_ONE("1");// 是否维修中的设备不能再报修
+    REPAIR_ONLY_ONE("1"),// 是否维修中的设备不能再报修
+
+    REPAIR_WARN_MINUTE("维修单接收超时预警分钟");
     private final String typeName;
 
 }

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/enums/SysUserIdentityType.java

@@ -23,6 +23,7 @@ public enum SysUserIdentityType {
     CKGLY(3, "仓库管理员"),
     WXY(4, "维修员"),
     WXZG(5, "维修主管"),
+    WXZGMANAGER(6, "维修总管"),
     SB_ZG(11, "设备主管"),
     SB_GLY(12, "设备管理员"),
     XMB_SB_ZG(13, "项目部设备主管"),

+ 129 - 0
platform-dao/src/main/java/com/platform/dao/util/MessageTemplateUtil.java

@@ -1,8 +1,20 @@
 package com.platform.dao.util;
 
+import com.platform.common.exception.BusinessException;
+import com.platform.common.util.StringUtils;
+import com.platform.dao.dto.repair.RepairApplicationFormDTO;
+import com.platform.dao.vo.sb.SbInfoVO;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.io.StringWriter;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description 消息模板工具类
@@ -115,6 +127,123 @@ public class MessageTemplateUtil {
         return String.format("您的维修【%s】被驳回,请重新处理", id);
     }
 
+    /**
+     * 获取维修通知
+     *
+     * @param url
+     * @param model
+     * @param vo
+     * @return
+     */
+    public static String getFreemarkerHtmlContent(String url, RepairApplicationFormDTO model, SbInfoVO vo){
+        // 首先配置 FreeMarker 模版位置
+        Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
+        ClassLoader loader = MessageTemplateUtil.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
+     */
+    public static String getFreemarkerHtmlContent(String url, RepairApplicationFormDTO model, SbInfoVO vo, String templateFileName){
+        // 首先配置 FreeMarker 模版位置
+        Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
+        ClassLoader loader = MessageTemplateUtil.class.getClassLoader();
+        configuration.setClassLoaderForTemplateLoading(loader,"templates");
+
+        // 配置模版文件
+        try {
+            Template template = configuration.getTemplate(templateFileName);
+            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
+     */
+    public static String getFreemarkerHtmlContentCheck(String url, RepairApplicationFormDTO model, SbInfoVO vo){
+        // 首先配置 FreeMarker 模版位置
+        Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
+        ClassLoader loader = MessageTemplateUtil.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());
+        }
+    }
+
     public static String getRepairOk(String id) {
         return String.format("您维修【%s】已验收,该任务已完结", id);
     }

+ 32 - 0
platform-rest/src/main/resources/templates/repairEmailFirst.ftl

@@ -0,0 +1,32 @@
+<div>维修一级上报预警通知</div>
+<div>有新的报修单第一维修员超时未接单,等待您的处理:
+    <table border="1">
+        <tr>
+            <td>维修单号</td>
+            <td>${no}</td>
+        </tr>
+        <tr>
+            <td>设备名称</td>
+            <td>${sbName}</td>
+        </tr>
+        <tr>
+            <td>设备编号</td>
+            <td>${sbNo}</td>
+        </tr>
+        <tr>
+            <td>设备使用位置</td>
+            <td>${sbCph}</td>
+        </tr>
+        <tr>
+            <td>报修人</td>
+            <td>${actualUser}</td>
+        </tr>
+        <tr>
+            <td>故障描述</td>
+            <td>${repairDesc}</td>
+        </tr>
+    </table>
+</div>
+<div>
+    <a href="${url}">点击链接跳转处理报修单</a>
+</div>

+ 32 - 0
platform-rest/src/main/resources/templates/repairEmailSecond.ftl

@@ -0,0 +1,32 @@
+<div>维修二级上报预警通知</div>
+<div>有新的报修单第二维修员超时未接单,等待您的处理:
+    <table border="1">
+        <tr>
+            <td>维修单号</td>
+            <td>${no}</td>
+        </tr>
+        <tr>
+            <td>设备名称</td>
+            <td>${sbName}</td>
+        </tr>
+        <tr>
+            <td>设备编号</td>
+            <td>${sbNo}</td>
+        </tr>
+        <tr>
+            <td>设备使用位置</td>
+            <td>${sbCph}</td>
+        </tr>
+        <tr>
+            <td>报修人</td>
+            <td>${actualUser}</td>
+        </tr>
+        <tr>
+            <td>故障描述</td>
+            <td>${repairDesc}</td>
+        </tr>
+    </table>
+</div>
+<div>
+    <a href="${url}">点击链接跳转处理报修单</a>
+</div>

+ 32 - 0
platform-rest/src/main/resources/templates/repairEmailThird.ftl

@@ -0,0 +1,32 @@
+<div>维修三级上报预警通知</div>
+<div>有新的报修单第一维修主管超时未接单,等待您的处理:
+    <table border="1">
+        <tr>
+            <td>维修单号</td>
+            <td>${no}</td>
+        </tr>
+        <tr>
+            <td>设备名称</td>
+            <td>${sbName}</td>
+        </tr>
+        <tr>
+            <td>设备编号</td>
+            <td>${sbNo}</td>
+        </tr>
+        <tr>
+            <td>设备使用位置</td>
+            <td>${sbCph}</td>
+        </tr>
+        <tr>
+            <td>报修人</td>
+            <td>${actualUser}</td>
+        </tr>
+        <tr>
+            <td>故障描述</td>
+            <td>${repairDesc}</td>
+        </tr>
+    </table>
+</div>
+<div>
+    <a href="${url}">点击链接跳转处理报修单</a>
+</div>

+ 0 - 1
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -342,7 +342,6 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
         List<CheckJob> checkJobs = mapper.selectByExample(weekend);
 
         // 针对没有设置指定人方式的,要更新
-
         List<CheckStandard> updateStandardList =  new ArrayList<CheckStandard>();
         for(CheckStandard standard: standardList){
             if(!CheckPlanPeriodTypeEnum.MILES.getValue().equals(standard.getPeriodType()) && !CheckPlanPeriodTypeEnum.TAISHI.getValue().equals(standard.getPeriodType()) ){

+ 167 - 0
platform-service/src/main/java/com/platform/service/redis/impl/RedisTaskService.java

@@ -0,0 +1,167 @@
+package com.platform.service.redis.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.RandomUtil;
+import com.platform.common.cache.ConfigCache;
+import com.platform.common.constant.RedisKeyConstants;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.util.*;
+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.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.RepairApplicationFormService;
+import com.platform.service.sb.SbInfoService;
+import com.platform.service.upms.SysUserService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * description: RedisKey键监听以及业务逻辑处理
+ *
+ * @author: zhouhong
+ * @version: V1.0.0
+ * @date: 2021年3月19日 上午10:58:52
+ */
+@Service
+@Component
+public class RedisTaskService extends KeyExpirationEventMessageListener {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Resource
+    private RepairApplicationFormService repairApplicationFormService;
+
+    @Resource
+    private SbInfoService sbInfoService;
+
+    @Resource
+    private SysUserService sysUserService;
+
+    /**
+     * @param listenerContainer
+     */
+    public RedisTaskService(RedisMessageListenerContainer listenerContainer) {
+        super(listenerContainer);
+    }
+    @Override
+    public void onMessage(Message message, byte[] pattern) {
+        String expiredKey = message.toString();
+        // 将拿到的过期键使用之前拼接时的特殊符号分割成字符数组 ,拿到保函id
+        String[] expiredKeyArr = expiredKey.split(RedisKeyConstants.EXPIRE_BUSINESS_SEP);
+        if(expiredKeyArr.length == 0){
+            logger.info("redis过期,非监听业务,不处理:");
+            return;
+        }
+        // 判断是否报修业务逻辑
+        if(expiredKeyArr[0] == null || !expiredKeyArr[0].contains(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR)){
+            logger.info("redis过期,非报修业务,不处理:");
+            return;
+        }
+
+        // 获取维修id
+        String repairId = expiredKeyArr[1].toString();
+        RepairApplicationForm repairApplicationForm = repairApplicationFormService.getModelById(repairId);
+
+        SbInfoVO sbInfoVO = sbInfoService.getById(repairApplicationForm.getSbId());
+        SysUserVO userVO = null;
+        if(!repairApplicationForm.getStatus().equals(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue())){
+            return;
+        }
+        String minuteStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_WARN_MINUTE.name());
+        int minute = 30;// 默认30分钟
+        if(StringUtils.isNotBlank(minuteStr)){
+            minute = Integer.valueOf(minuteStr);
+        }
+        if(expiredKeyArr[0].equalsIgnoreCase(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_FIRST)){
+            if(StringUtils.isNotBlank(sbInfoVO.getRepairUserSecond())){
+                logger.info("处理第一阶段过期,发送消息给第二维修人");
+                userVO = sysUserService.selectUserVO(sbInfoVO.getRepairUserSecond());
+                sendMessage(repairId, repairApplicationForm,userVO,sbInfoVO,"repairEmailFirst.ftl");
+            }else{
+                logger.info("处理第一阶段过期,设备第二维修人未设置,无法发送消息,设备编号:" + sbInfoVO.getNo());
+            }
+
+            // redis登记2级监控
+            RedisUtils.setString(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_SECOND + RedisKeyConstants.EXPIRE_BUSINESS_SEP + repairId,repairId,minute, TimeUnit.MINUTES);
+            return;
+        }
+
+        // 发送给第一维修主管,通过角色来查询
+        if(expiredKeyArr[0].equalsIgnoreCase(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_SECOND)){
+            logger.info("处理第二阶段过期,发送消息给吴");
+            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());
+            }
+            if (CollectionUtil.isEmpty(filterUsers)) {
+                logger.info("处理第二阶段过期,维修主管身份未设置,无法发送消息,设备编号:" + sbInfoVO.getNo());
+            }else{
+                SysUser user = filterUsers.get(0);
+                // 通过给当天值班维修人员
+                sendMessage(repairId, repairApplicationForm,BeanConverterUtil.copyObjectProperties(user, SysUserVO.class),sbInfoVO, "repairEmailSecond.ftl");
+            }
+            // redis登记3级监控
+            RedisUtils.setString(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_THIRD + RedisKeyConstants.EXPIRE_BUSINESS_SEP + repairId,repairId,minute, TimeUnit.MINUTES);
+            return;
+        }
+
+        // 发送给第二维修主管
+        if(expiredKeyArr[0].equalsIgnoreCase(RedisKeyConstants.EXPIRE_BUSINESS_KEY_REPAIR_STEP_THIRD)){
+            logger.info("处理第三阶段过期,发送消息给牛");
+            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.WXZGMANAGER.getValue())).collect(Collectors.toList());
+            }
+            if (CollectionUtil.isEmpty(filterUsers)) {
+                logger.info("处理第三阶段过期,维修主管领导身份未设置,无法发送消息,设备编号:" + sbInfoVO.getNo());
+                return;
+            }else{
+                SysUser user = filterUsers.get(0);
+                // 通过给当天值班维修人员
+                sendMessage(repairId, repairApplicationForm,BeanConverterUtil.copyObjectProperties(user, SysUserVO.class),sbInfoVO, "repairEmailThird.ftl");
+            }
+            return;
+        }
+    }
+
+    public void sendMessage(String repairId, RepairApplicationForm repairApplicationForm, SysUserVO user, SbInfoVO sbInfoVO, String templateFileName ){
+        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=" + repairApplicationForm.getNo();
+        SpringContextHolder.publishEvent(
+                new WorkplaceBacklogEvent(
+                        WorkplaceBacklogTypeEnum.REPAIR.getValue(),
+                        WorkplaceBacklogDetailTypeEnum.REPAIR_APPLICATION.getValue(),
+                        repairId,
+                        MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl, BeanConverterUtil.copyObjectProperties(repairApplicationForm, RepairApplicationFormDTO.class),sbInfoVO, templateFileName),
+                        repairId, ListUtils.newArrayList(user.getUserId()), ListUtils.newArrayList(user.getEmail())
+                )
+        );
+    }
+}

+ 12 - 83
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.platform.common.cache.ConfigCache;
+import com.platform.common.constant.RedisKeyConstants;
 import com.platform.common.enums.DataFilterTypeEnum;
 import com.platform.common.exception.BusinessException;
 import com.platform.common.model.UserInfo;
@@ -63,6 +64,7 @@ import java.lang.reflect.Array;
 import java.time.LocalDateTime;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -255,7 +257,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         // 判断设备第一维修人是否存在
         SbInfo sbInfo = sbInfoService.getModelById(model.getSbId());
         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.setCreatedTime(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(),
                     model.getId(),
-                    getFreemarkerHtmlContent(repairUrl,model,sb),
+                    MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
                     model.getId(), userIds, mails));
         } else {
             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(),
                     model.getId(),
-                    getFreemarkerHtmlContent(repairUrl,model,sb),
+                    MessageTemplateUtil.getFreemarkerHtmlContent(repairUrl,model,sb),
                     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
@@ -503,7 +432,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         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(), 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())));}
 
     /**

+ 1 - 1
platform-service/src/main/java/com/platform/service/upms/impl/SysUserServiceImpl.java

@@ -743,7 +743,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser,
         if (workStatus != null) {
             weekendCriteria.andEqualTo(SysUser::getWorkFlag, workStatus);
         }
-        weekendCriteria.andIn(SysUser::getIdentityType, Arrays.asList(new Integer[]{SysUserIdentityType.WXY.getValue(), SysUserIdentityType.WXZG.getValue()}));
+        weekendCriteria.andIn(SysUser::getIdentityType, Arrays.asList(new Integer[]{SysUserIdentityType.WXY.getValue(), SysUserIdentityType.WXZG.getValue(), SysUserIdentityType.WXZGMANAGER.getValue()}));
         return mapper.selectByExample(weekend);
     }
 }