Browse Source

安全生产-特种设备、特种设备证书、安全附件 定时任务提醒,增加提醒角色“生产副总”,增加邮件按 人 整合提醒

sucheng 11 months ago
parent
commit
ee6715c83e

+ 78 - 3
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafeAttachmentsServiceImpl.java

@@ -2,17 +2,23 @@ package com.rongwei.sfcommon.sys.service.impl;
 
 import cn.afterturn.easypoi.excel.ExcelImportUtil;
 import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwe.scentity.domian.AspSafeAttachmentsDo;
+import com.rongwe.scentity.domian.CheckItemsDo;
 import com.rongwe.scentity.vo.CheckAreaVo;
 import com.rongwe.scentity.vo.ImportAspSafeAttachmentsVo;
 import com.rongwe.scentity.vo.UserMailOrgVo;
+import com.rongwei.rwadmincommon.system.domain.SysDictDo;
 import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
 import com.rongwei.rwadmincommon.system.domain.SysUserDo;
+import com.rongwei.rwadmincommon.system.service.SysConfigFeignService;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.rwcommon.vo.MailDo;
 import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.AspSafeAttachmentsDao;
@@ -27,6 +33,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -52,6 +59,7 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
     public static final List<String> ROLE_CODE_LIST = new ArrayList<String>() {{
         add("code-safe");
         add("role031");
+        add("produce");
     }};
     /**
      * 特种设备管理员
@@ -71,6 +79,8 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
     private SaveCheckCommonDao saveCheckCommonDao;
     @Autowired
     private ClassExcelVerifyHandler verifyHandler;
+    @Resource
+    private SysConfigFeignService sysConfigFeignService;
 
     @Override
     public R stateUpdateScheduledTasks() {
@@ -84,9 +94,19 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
         List<AspSafeAttachmentsDo> saveData = new ArrayList<>();
         // 发送消息提醒的参数
         Map<AspSafeAttachmentsDo, List<String>> sendNotifyMap = new HashMap<AspSafeAttachmentsDo, List<String>>();
+        // 发送邮件的集合《用户ID,List<设备信息>》
+        Map<String, List<AspSafeAttachmentsDo>> sendMailMap = new HashMap<>();
+        // 用户的信息集合
+        Map<String, UserMailOrgVo> userMap = new HashMap<>();
         dataMap.forEach((k, v) -> {
-            //获取工厂对应的 安全管理员和特种设备管理员
+            //获取工厂对应的 安全管理员和特种设备管理员 和生产副总
             List<UserMailOrgVo> userInfO = saveCheckCommonDao.getUserInfoByTenantIdAndRoleCode(k, ROLE_CODE_LIST);
+            for (UserMailOrgVo userMailOrgVo : userInfO) {
+                if (ObjectUtil.isNotEmpty(userMailOrgVo.getEmail())) {
+                    sendMailMap.put(userMailOrgVo.getId(), new LinkedList<>());
+                    userMap.put(userMailOrgVo.getId(), userMailOrgVo);
+                }
+            }
             Date manufacturedate;
             long daysBetween;
             List<String> alertUser;
@@ -100,10 +120,20 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
                     data.setReminderstate(HIGH);
                     alertUser = userInfO.stream().map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else if (daysBetween <= 90) {
                     alertUser = userInfO.stream().filter(user -> SPECIAL_EQUIPMENT_ADMINISTRATOR.equals(user.getRoleCode())).map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
                     data.setReminderstate(MIDDLE);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else {
 
                     data.setReminderstate(LOW);
@@ -114,9 +144,54 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
         });
         this.updateBatchById(saveData);
         sendNotify(sendNotifyMap);
+
+        sendMail(sendMailMap, userMap);
+
         return R.ok();
     }
 
+
+    private void sendMail(Map<String, List<AspSafeAttachmentsDo>> sendMailMap, Map<String, UserMailOrgVo> userMap) {
+        if (ObjectUtil.isEmpty(sendMailMap)) {
+            return;
+        }
+        sendMailMap.forEach((key, value) -> {
+            if (ObjectUtil.isEmpty(value)) {
+                return;
+            }
+            StringBuilder mailContent = new StringBuilder("您好!有如下安全附件即将年检到期,请及时处理!\n");
+            for (int i = 0; i < value.size(); i++) {
+                AspSafeAttachmentsDo attachmentsDo = value.get(i);
+
+
+                //附件类型
+                String attachmenttype = ObjectUtil.isNotEmpty(attachmentsDo.getAttachmenttype()) ? attachmentsDo.getAttachmenttype() : "";
+                //证书/报告编号
+                String number = ObjectUtil.isNotEmpty(attachmentsDo.getNumber()) ? attachmentsDo.getNumber() : "";
+                //名称
+                String name = ObjectUtil.isNotEmpty(attachmentsDo.getName()) ? attachmentsDo.getName() : "";
+                //检验日期
+                Date inspectiondate = attachmentsDo.getInspectiondate();
+                String checkDate = "";
+                if (ObjectUtil.isNotEmpty(inspectiondate)) {
+                    checkDate = DateUtil.format(inspectiondate, "yyyy-MM-dd");
+                }
+                mailContent.append((i + 1) + "、附件类型:【" + attachmenttype + "】,证书/报告编号:【" + number + "】,名称:【" + name + "】,检验日期:【" + checkDate + "】\n");
+            }
+            mailContent.append("详见安全生产平台,如果无法点击请复制链接到浏览器中:http://192.168.100.78/#/page/lr/a02bf613b27c422f8e6e3b9d427b15dd");
+
+            //发送邮件
+            MailDo mailDo = new MailDo();
+            mailDo.setSubject("安全附件年检提醒");
+            mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
+            mailDo.setNeedTransReceive(false);
+            mailDo.setContent(mailContent.toString());
+            sysConfigFeignService.sendTextMail(mailDo);
+        });
+
+    }
+
+
     /**
      * 发送消息提醒
      *
@@ -154,7 +229,7 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
         params.setHeadRows(1);
         params.setVerifyHandler(verifyHandler);
         List<ImportAspSafeAttachmentsVo> userList = ExcelImportUtil.importExcel(file, ImportAspSafeAttachmentsVo.class, params);
-        log.info("userList:{}",userList);
+        log.info("userList:{}", userList);
         // 存放异常数据
         List<String> errorMsgList = new ArrayList<>();
         // 解析后的数据
@@ -220,7 +295,7 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
             errorMsgList.add(String.format(DATE_FORMAT_ERROR_MSG, index, "下次检验/更换日期"));
         }
         // 校验时间格式是否正确
-        if (StringUtils.isNotBlank(importAspSafeAttachmentsVo.getInspectionstr()) &&  dateFormatValidation(importAspSafeAttachmentsVo.getInspectionstr()) == null) {
+        if (StringUtils.isNotBlank(importAspSafeAttachmentsVo.getInspectionstr()) && dateFormatValidation(importAspSafeAttachmentsVo.getInspectionstr()) == null) {
             errorMsgList.add(String.format(DATE_FORMAT_ERROR_MSG, index, "检验/更换日期"));
         }
     }

+ 83 - 3
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSpecialEquipmentCertificateServiceImpl.java

@@ -1,11 +1,16 @@
 package com.rongwei.sfcommon.sys.service.impl;
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwe.scentity.domian.AspSafeAttachmentsDo;
 import com.rongwe.scentity.domian.AspSpecialEquipmentCertificateDo;
 import com.rongwe.scentity.vo.UserMailOrgVo;
 import com.rongwei.rwadmincommon.system.domain.SysDictDo;
+import com.rongwei.rwadmincommon.system.service.SysConfigFeignService;
 import com.rongwei.rwadmincommon.system.service.SysDictService;
 import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.vo.MailDo;
 import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.AspSpecialEquipmentCertificateDao;
 import com.rongwei.sfcommon.sys.dao.SaveCheckCommonDao;
@@ -15,6 +20,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.time.LocalDate;
 import java.time.ZoneId;
 import java.time.temporal.ChronoUnit;
@@ -38,6 +44,7 @@ public class AspSpecialEquipmentCertificateServiceImpl extends ServiceImpl<AspSp
     public static final List<String> ROLE_CODE_LIST = new ArrayList<String>() {{
         add("code-safe");
         add("role031");
+        add("produce");
     }};
     /**
      * 特种设备管理员
@@ -49,22 +56,34 @@ public class AspSpecialEquipmentCertificateServiceImpl extends ServiceImpl<AspSp
     private SaveCheckCommonDao saveCheckCommonDao;
     @Autowired
     private SysDictService sysDictService;
+    @Resource
+    private SysConfigFeignService sysConfigFeignService;
 
     @Override
     public R stateUpdateScheduledTasks() {
-        // 获取所有的安全附件
+        // 获取所有的特种设备证书
         List<AspSpecialEquipmentCertificateDo> safeAttachmentsDos = this.list();
         if (safeAttachmentsDos.isEmpty()) {
-            return R.ok("暂无安全附件");
+            return R.ok("暂无特种设备证书");
         }
         // 对数据按照租户ID 分组
         Map<String, List<AspSpecialEquipmentCertificateDo>> dataMap = safeAttachmentsDos.stream().collect(Collectors.groupingBy(AspSpecialEquipmentCertificateDo::getTenantid));
         List<AspSpecialEquipmentCertificateDo> saveData = new ArrayList<>();
         // 发送消息提醒的参数
         Map<AspSpecialEquipmentCertificateDo, List<String>> sendNotifyMap = new HashMap<>();
+        // 发送邮件的集合《用户ID,List<设备信息>》
+        Map<String, List<AspSpecialEquipmentCertificateDo>> sendMailMap = new HashMap<>();
+        // 用户的信息集合
+        Map<String, UserMailOrgVo> userMap = new HashMap<>();
         dataMap.forEach((k, v) -> {
-            //获取工厂对应的 安全管理员和特种设备管理员
+            //获取工厂对应的 安全管理员和特种设备管理员 和生产副总
             List<UserMailOrgVo> userInfO = saveCheckCommonDao.getUserInfoByTenantIdAndRoleCode(k, ROLE_CODE_LIST);
+            for (UserMailOrgVo userMailOrgVo : userInfO) {
+                if (ObjectUtil.isNotEmpty(userMailOrgVo.getEmail())) {
+                    sendMailMap.put(userMailOrgVo.getId(), new LinkedList<>());
+                    userMap.put(userMailOrgVo.getId(), userMailOrgVo);
+                }
+            }
             Date manufacturedate;
             long daysBetween;
             List<String> alertUser;
@@ -78,10 +97,20 @@ public class AspSpecialEquipmentCertificateServiceImpl extends ServiceImpl<AspSp
                     data.setReminderstate(HIGH);
                     alertUser = userInfO.stream().map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else if (daysBetween <= 90) {
                     alertUser = userInfO.stream().filter(user -> SPECIAL_EQUIPMENT_ADMINISTRATOR.equals(user.getRoleCode())).map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
                     data.setReminderstate(MIDDLE);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else {
                     data.setReminderstate(LOW);
                 }
@@ -91,9 +120,60 @@ public class AspSpecialEquipmentCertificateServiceImpl extends ServiceImpl<AspSp
         });
         this.updateBatchById(saveData);
         sendNotify(sendNotifyMap);
+
+        sendMail(sendMailMap, userMap);
+
         return R.ok();
     }
 
+    private void sendMail(Map<String, List<AspSpecialEquipmentCertificateDo>> sendMailMap, Map<String, UserMailOrgVo> userMap) {
+        if (ObjectUtil.isEmpty(sendMailMap)) {
+            return;
+        }
+        // 获取数据字典-证书类别
+        List<SysDictDo> aspCheckItemType = sysDictService.getDictsByType("zslb");
+        sendMailMap.forEach((key, value) -> {
+            if (ObjectUtil.isEmpty(value)) {
+                return;
+            }
+            StringBuilder mailContent = new StringBuilder("您好!有如下特种设备人员证书即将年检到期,请及时处理!\n");
+            for (int i = 0; i < value.size(); i++) {
+                AspSpecialEquipmentCertificateDo item = value.get(i);
+
+                //姓名
+                String name = ObjectUtil.isNotEmpty(item.getName()) ? item.getName() : "";
+                //所属部门
+                String orgName = ObjectUtil.isNotEmpty(item.getOrgname()) ? item.getOrgname() : "";
+                //证书类别
+                String certificate = "";
+                String certificatesort = item.getCertificatesort();
+                if (ObjectUtil.isNotEmpty(certificatesort)) {
+                    SysDictDo sysDictDo = aspCheckItemType.stream().filter(info -> info.getValue().equals(item.getCertificatesort())).findFirst().orElse(null);
+                    if (ObjectUtil.isNotEmpty(sysDictDo)) {
+                        certificate = sysDictDo.getName();
+                    }
+                }
+
+                //复审日期
+                Date reviewdate = item.getReviewdate();
+                String reviewDate = "";
+                if (ObjectUtil.isNotEmpty(reviewdate)) {
+                    reviewDate = DateUtil.format(reviewdate, "yyyy-MM-dd");
+                }
+                mailContent.append((i + 1) + "、姓名:【" + name + "】,所属部门:【" + orgName + "】证书类别:【" + certificate + "】,复审日期:【" + reviewDate + "】\n");
+            }
+            mailContent.append("详见安全生产平台,如果无法点击请复制链接到浏览器中:http://192.168.100.78/#/page/s/76711fe45ac941efa3d58d43b28b4f39");
+
+            //发送邮件
+            MailDo mailDo = new MailDo();
+            mailDo.setSubject("特种设备人员证书年检提醒");
+            mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
+            mailDo.setNeedTransReceive(false);
+            mailDo.setContent(mailContent.toString());
+            sysConfigFeignService.sendTextMail(mailDo);
+        });
+
+    }
 
     public void sendNotify(Map<AspSpecialEquipmentCertificateDo, List<String>> sendNotifyMap) {
         // 获取数据字典

+ 78 - 3
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckItemsServiceImpl.java

@@ -15,11 +15,13 @@ import com.rongwe.scentity.vo.CheckItemsTypeVo;
 import com.rongwe.scentity.vo.ImportCheckItemsVo;
 import com.rongwe.scentity.vo.UserMailOrgVo;
 import com.rongwei.rwadmincommon.system.domain.SysDictDo;
+import com.rongwei.rwadmincommon.system.service.SysConfigFeignService;
 import com.rongwei.rwadmincommon.system.service.impl.SysDictServiceImpl;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.rwcommon.vo.MailDo;
 import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.CheckItemsDao;
@@ -35,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -57,6 +60,7 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
     public static final List<String> ROLE_CODE_LIST = new ArrayList<String>() {{
         add("code-safe");
         add("role031");
+        add("produce");
     }};
     // 设备使用状态数据字典
     public static final String SBSYZT_DICT = "sbsyzt";
@@ -91,6 +95,8 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
     private SysDictServiceImpl sysDictService;
     @Autowired
     private ClassExcelVerifyHandler verifyHandler;
+    @Resource
+    private SysConfigFeignService sysConfigFeignService;
 
     /**
      * 设备列表删除验证是否存在点检记录
@@ -182,7 +188,7 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
 
     @Override
     public R stateUpdateScheduledTasks() {
-        // 获取所有的安全附件
+        // 获取所有的特种设备
         List<CheckItemsDo> safeAttachmentsDos = this.list(new LambdaQueryWrapper<CheckItemsDo>().eq(CheckItemsDo::getSource, 1));
         if (safeAttachmentsDos.isEmpty()) {
             return R.ok("暂无设备需要检验");
@@ -192,9 +198,19 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
         List<CheckItemsDo> saveData = new ArrayList<>();
         // 发送消息提醒的参数
         Map<CheckItemsDo, List<String>> sendNotifyMap = new HashMap<CheckItemsDo, List<String>>();
+        // 发送邮件的集合《用户ID,List<设备信息>》
+        Map<String, List<CheckItemsDo>> sendMailMap = new HashMap<>();
+        // 用户的信息集合
+        Map<String, UserMailOrgVo> userMap = new HashMap<>();
         dataMap.forEach((k, v) -> {
-            //获取工厂对应的 安全管理员和特种设备管理员
+            //获取工厂对应的 安全管理员和特种设备管理员 和生产副总
             List<UserMailOrgVo> userInfO = saveCheckCommonDao.getUserInfoByTenantIdAndRoleCode(k, ROLE_CODE_LIST);
+            for (UserMailOrgVo userMailOrgVo : userInfO) {
+                if (ObjectUtil.isNotEmpty(userMailOrgVo.getEmail())) {
+                    sendMailMap.put(userMailOrgVo.getId(), new LinkedList<>());
+                    userMap.put(userMailOrgVo.getId(), userMailOrgVo);
+                }
+            }
             Date manufacturedate;
             long daysBetween;
             List<String> alertUser;
@@ -208,10 +224,20 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
                     data.setReminderstate(HIGH);
                     alertUser = userInfO.stream().map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else if (daysBetween <= 90) {
                     alertUser = userInfO.stream().filter(user -> SPECIAL_EQUIPMENT_ADMINISTRATOR.equals(user.getRoleCode())).map(UserMailOrgVo::getId).collect(Collectors.toList());
                     sendNotifyMap.put(data, alertUser);
                     data.setReminderstate(MIDDLE);
+                    for (String userId : alertUser) {
+                        if (sendMailMap.containsKey(userId)) {
+                            sendMailMap.get(userId).add(data);
+                        }
+                    }
                 } else {
                     data.setReminderstate(LOW);
                 }
@@ -221,9 +247,58 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
         });
         this.updateBatchById(saveData);
         sendNotify(sendNotifyMap);
+
+        sendMail(sendMailMap, userMap);
+
         return R.ok();
     }
 
+    private void sendMail(Map<String, List<CheckItemsDo>> sendMailMap, Map<String, UserMailOrgVo> userMap) {
+        if (ObjectUtil.isEmpty(sendMailMap)) {
+            return;
+        }
+        // 获取数据字典
+        List<SysDictDo> aspCheckItemType = sysDictService.getDictsByType("asp_check_item_type");
+        sendMailMap.forEach((key, value) -> {
+            if (ObjectUtil.isEmpty(value)) {
+                return;
+            }
+            StringBuilder mailContent = new StringBuilder("您好!有如下特种设备即将年检到期,请及时处理!\n");
+            for (int i = 0; i < value.size(); i++) {
+                CheckItemsDo checkItemsDo = value.get(i);
+
+                SysDictDo sysDictDo = aspCheckItemType.stream().filter(info -> info.getValue().equals(checkItemsDo.getCheckitemtype())).findFirst().orElse(null);
+                //设备类型
+                String checkitemtype = "";
+                if (ObjectUtil.isNotEmpty(sysDictDo) && ObjectUtil.isNotEmpty(checkItemsDo.getCheckitemtype())) {
+                    checkitemtype = sysDictDo.getName();
+                }
+
+                //设备编号
+                String deviceoutcode = ObjectUtil.isNotEmpty(checkItemsDo.getDeviceoutcode()) ? checkItemsDo.getDeviceoutcode() : "";
+                //设备名称
+                String checkitemname = ObjectUtil.isNotEmpty(checkItemsDo.getCheckitemname()) ? checkItemsDo.getCheckitemname() : "";
+                //检验日期
+                Date devicecheckdate = checkItemsDo.getDevicecheckdate();
+                String checkDate = "";
+                if (ObjectUtil.isNotEmpty(devicecheckdate)) {
+                    checkDate = DateUtil.format(devicecheckdate, "yyyy-MM-dd");
+                }
+                mailContent.append((i + 1) + "、设备类型:【" + checkitemtype + "】,设备编号:【" + deviceoutcode + "】,设备名称:【" + checkitemname + "】,检验日期:【" + checkDate + "】\n");
+            }
+            mailContent.append("详见安全生产平台,如果无法点击请复制链接到浏览器中:http://192.168.100.78/#/page/lr/9329c07dd31b4b8b95d4decaa021adc3");
+
+            //发送邮件
+            MailDo mailDo = new MailDo();
+            mailDo.setSubject("特种设备年检提醒");
+            mailDo.setReceiveEmail(new String[]{userMap.get(key).getEmail()});
+            mailDo.setNeedTransReceive(false);
+            mailDo.setContent(mailContent.toString());
+            sysConfigFeignService.sendTextMail(mailDo);
+        });
+
+    }
+
     public void sendNotify(Map<CheckItemsDo, List<String>> sendNotifyMap) {
         if (sendNotifyMap.isEmpty()) {
             return;
@@ -235,7 +310,7 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
 
             // 发送消息提醒
             CXCommonUtils.sendNotify(EQUIPMENT_CHECK_TITLE,
-                    String.format(EQUIPMENT_CHECK_CONTENT, sysDictDo == null ? "" : sysDictDo.getName(), k.getCheckitemcode(), k.getCheckitemname(),
+                    String.format(EQUIPMENT_CHECK_CONTENT, sysDictDo == null ? "" : sysDictDo.getName(), k.getDeviceoutcode(), k.getCheckitemname(),
                             k.getNextcheckdate()), null, v.stream().distinct().collect(Collectors.toList()),
                     k.getId(), SPECIALEQUIPMENT, false);
         });

+ 2 - 1
cx-safe-check/cx-save-check-common/src/main/resources/mybatis/SaveCheckCommonDao.xml

@@ -102,7 +102,8 @@
         select
         su.ID as id,
         su.NAME as name,
-        sr.CODE AS roleCode
+        sr.CODE AS roleCode,
+        su.EMAIL AS email
         from sys_user su
         LEFT JOIN sys_user_role sur on sur.USERID = su.ID and sur.DELETED = '0'
         LEFT JOIN sys_role sr on sur.ROLEID = sr.ID and sr.DELETED = '0'

+ 2 - 1
cx-safe-check/cx-save-check-server/src/main/java/com/rongwei/savecheck/controller/CheckItemsController.java

@@ -42,6 +42,7 @@ public class CheckItemsController {
 
     /**
      * 设备定时任务提醒,定时任务每天执行一次,【预计提醒日期】在今天及今天之前的数据,给所有设备管理员角色下的员工提醒(分所属工厂)
+     * (废弃)
      */
     @PostMapping("/reportEquMessage")
     public R reportEquMessage(){
@@ -57,7 +58,7 @@ public class CheckItemsController {
     @Scheduled(cron = "0 0 3 ? * *")
     @PostMapping("/state")
     public R stateUpdateScheduledTasks(){
-        log.info("安全附件定时任务,更改安全附件预警级别");
+        log.info("特种设备定时任务,更改特种设备预警级别");
         return checkItemsService.stateUpdateScheduledTasks();
     }