Browse Source

Merge remote-tracking branch 'origin/master'

hyq 1 year ago
parent
commit
dcad945adb

+ 14 - 4
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -75,15 +75,19 @@ public class SaveConstans {
 
     }
 
-    public static class NotifyType{
+    public static class NotifyType {
         /**
          * 我的培训
          */
-        public static final String TRAINING="training";
+        public static final String TRAINING = "training";
+        /**
+         * 我的课程
+         */
+        public static final String COURSE = "course";
         /**
          * 培训需求调查表
          */
-        public static final String  TRAININGFORM="trainingform";
+        public static final String TRAININGFORM = "trainingform";
         /**
          * 安全应急
          */
@@ -126,7 +130,9 @@ public class SaveConstans {
         /**
          * 我的培训
          */
-        public static final String TRAIN_NOTIFY_TITLE = "我的培训";
+        public static final String TRAIN_NOTIFY_TITLE = "培训试卷提醒";
+
+        public static final String COURSE_NOTIFY_TITLE = "培训课程提醒";
         /**
          * 培训取消提醒
          */
@@ -159,6 +165,10 @@ public class SaveConstans {
          * 我的培训提醒内容
          */
         public static final String TRAIN_NOTIFY_CONTENT = "%s,培训时间:%tF至%tF";
+        /**
+         * 我的培训课程提醒内容
+         */
+        public static final String COURSE_NOTIFY_CONTENT = "%s,培训时间:%tF至%tF";
         /**
          * 培训取消提醒内容
          */

+ 24 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/dao/AspSafetyProductObjectiveDao.java

@@ -1,7 +1,31 @@
 package com.rongwei.sfcommon.sys.dao;
 
 import com.rongwe.scentity.domian.AspSafetyProductObjective;
+import com.rongwe.scentity.vo.RoleIdAndUserIdsVo;
 import com.rongwei.rwcommon.base.BaseDao;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 public interface AspSafetyProductObjectiveDao extends BaseDao<AspSafetyProductObjective> {
+    @Select("SELECT\n" +
+            "\tsr.ID AS 'id',\n" +
+            "\tGROUP_CONCAT( sur.USERID ) AS 'userIds' \n" +
+            "FROM\n" +
+            "\tsys_role sr\n" +
+            "\tLEFT JOIN sys_user_role sur ON sr.ID = sur.ROLEID \n" +
+            "\tAND sur.DELETED = 0\n" +
+            "\tLEFT JOIN sys_user_org suo ON suo.USERID = sur.USERID \n" +
+            "\tAND suo.DELETED = 0\n" +
+            "\tLEFT JOIN sys_organization so ON suo.ORGID = so.ID \n" +
+            "\tAND so.DELETED = 0 \n" +
+            "WHERE\n" +
+            "\tsr.DELETED = 0 \n" +
+            "\tAND sr.ID IN ( 'e9133e738d67492aa4b3a641894f85c2', 'b104293d47e34df8847d1634c29ab031', '16963f62b94149d9ae16eabc9248999b', '104ac71c72704bbd953da6d7c167ed3a', 'efed8df42bde46c9970c1476e74d6374' ) \n" +
+            "\tAND (\n" +
+            "\t\tso.ID = #{tenantId} \n" +
+            "\tOR so.FULLPID LIKE CONCAT( '%', #{tenantId}, '%' )) \n" +
+            "GROUP BY\n" +
+            "\tsr.ID")
+    List<RoleIdAndUserIdsVo> selectManagerByTenantId(String tenantId);
 }

+ 22 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/dao/CheckItemsDao.java

@@ -19,4 +19,26 @@ public interface CheckItemsDao extends BaseDao<CheckItemsDo> {
 
     @Select("select *  from asp_check_items WHERE DELETED='0' and STANDBY='y' and (ENABLED is NULL  or ENABLED ='enable' or ENABLED='')")
     IPage<CheckItemsDo> spareList(Page page);
+
+    @Select("SELECT * FROM asp_check_items where DELETED = 0 and DATE_FORMAT(WARNDATE, '%Y-%m-%d') <= DATE_FORMAT(NOW(), '%Y-%m-%d')")
+    List<CheckItemsDo> selectNeedReportEqu();
+
+    //特种设备管理员的ID:08e111e9dbc04706a3eb8367a65a3dc5
+    @Select("SELECT\n" +
+            "\tsu.ID \n" +
+            "FROM\n" +
+            "\tsys_user su\n" +
+            "\tLEFT JOIN sys_user_role sur ON su.ID = sur.USERID \n" +
+            "\tAND sur.DELETED = 0\n" +
+            "\tLEFT JOIN sys_user_org suo ON suo.USERID = su.ID \n" +
+            "\tAND suo.DELETED = 0\n" +
+            "\tLEFT JOIN sys_organization so ON suo.ORGID = so.ID \n" +
+            "\tAND so.DELETED = 0 \n" +
+            "WHERE\n" +
+            "\tsu.DELETED = 0 \n" +
+            "\tAND sur.ROLEID = '08e111e9dbc04706a3eb8367a65a3dc5' \n" +
+            "\tAND (\n" +
+            "\tso.ID = #{tenantId} \n" +
+            "\tOR so.FULLPID LIKE CONCAT( '%', #{tenantId}, '%' ))")
+    List<String> selectUserByTenantId(String tenantId);
 }

+ 2 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/CheckItemsService.java

@@ -20,5 +20,7 @@ public interface CheckItemsService extends IService<CheckItemsDo> {
     String deleteValidate(List<String> ids);
 
     IPage<CheckItemsDo> spareList(Page page);
+
+    void reportEquMessage();
 }
 

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

@@ -9,7 +9,9 @@ import com.rongwe.scentity.domian.AspSafetyProductObjective;
 import com.rongwe.scentity.domian.AspSafetyProductObjectiveResult;
 import com.rongwe.scentity.domian.AspSafetyProductObjectiveResultScoreDetail;
 import com.rongwe.scentity.domian.AspSafetyProductObjectiveScoreDetail;
+import com.rongwe.scentity.vo.RoleIdAndUserIdsVo;
 import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.AspSafetyProductObjectiveDao;
 import com.rongwei.sfcommon.sys.service.AspSafetyProductObjectiveResultScoreDetailService;
 import com.rongwei.sfcommon.sys.service.AspSafetyProductObjectiveResultService;
@@ -18,8 +20,7 @@ import com.rongwei.sfcommon.sys.service.AspSafetyProductObjectiveService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -54,7 +55,7 @@ public class AspSafetyProductObjectiveServiceImpl extends ServiceImpl<AspSafetyP
 
         //遍历目标获取所有目标的ID集合
         List<String> collectIds = aspSafetyProductObjectives.stream().map(AspSafetyProductObjective::getId).collect(Collectors.toList());
-        if (ObjectUtil.isEmpty(collectIds)){
+        if (ObjectUtil.isEmpty(collectIds)) {
             return;
         }
         //查询出所有目标的子表数据
@@ -105,5 +106,66 @@ public class AspSafetyProductObjectiveServiceImpl extends ServiceImpl<AspSafetyP
         objectiveResultService.saveBatch(mainResList);
         //插入考核子表
         objectiveResultScoreDetailService.saveBatch(childResList);
+
+        //发送已生成考核的消息,按照工厂、指标级别,分别下发给对应角色的人
+        sendMessage(mainResList);
+
+    }
+
+    private void sendMessage(List<AspSafetyProductObjectiveResult> mainResList) {
+        //维护指标级别对应的角色ID
+        //objectivelevel:指标级别。
+        // 10:工厂级,副总:e9133e738d67492aa4b3a641894f85c2
+        // 20:部门级,部门长:b104293d47e34df8847d1634c29ab031
+        // 30:车间级,车间主任:16963f62b94149d9ae16eabc9248999b
+        // 40:工段级,工段主管:104ac71c72704bbd953da6d7c167ed3a
+        // 50:班组级,班长:efed8df42bde46c9970c1476e74d6374
+        Map<String, String> levelMap = new HashMap<>();
+        levelMap.put("10", "e9133e738d67492aa4b3a641894f85c2");
+        levelMap.put("20", "b104293d47e34df8847d1634c29ab031");
+        levelMap.put("30", "16963f62b94149d9ae16eabc9248999b");
+        levelMap.put("40", "104ac71c72704bbd953da6d7c167ed3a");
+        levelMap.put("50", "efed8df42bde46c9970c1476e74d6374");
+        //获取需要发送消息的工厂
+        Set<String> tenantIds = mainResList.stream().map(AspSafetyProductObjectiveResult::getTenantid).collect(Collectors.toSet());
+        //整理工厂下、各个指标级别、对应的角色(职位)下的员工ID,:<工厂ID,<角色ID,用户IDs(英文逗号隔开)>>
+        Map<String, Map<String, String>> tenantManagerMap = new HashMap<>();
+        tenantIds.forEach(tenantId -> {
+            List<RoleIdAndUserIdsVo> roleIdAndUserIdsVos = this.baseMapper.selectManagerByTenantId(tenantId);
+            Map<String, String> map = new HashMap<>();
+            roleIdAndUserIdsVos.forEach(item -> {
+                if (ObjectUtil.isNotEmpty(item.getId())) {
+                    map.put(item.getId(), item.getUserIds());
+                }
+            });
+            tenantManagerMap.put(tenantId, map);
+        });
+        //处理考核主表,发送消息
+        mainResList.forEach(item -> {
+            //判断工厂ID是否存在
+            if (ObjectUtil.isEmpty(item.getTenantid())) {
+                return;
+            }
+            //判断指标级别是否存在
+            if (ObjectUtil.isEmpty(item.getObjectivelevel())) {
+                return;
+            }
+            //获取该工厂下的角色对应的USERIDs
+            Map<String, String> map = tenantManagerMap.get(item.getTenantid());
+            //获取该数据的指标级别对应的角色ID
+            String roleId = levelMap.get(item.getObjectivelevel());
+            //获取该消息对应的用户IDs
+            if (ObjectUtil.isEmpty(roleId)) {
+                return;
+            }
+            List<String> userIdList = Arrays.asList(map.get(roleId).split(","));
+            //发送消息
+            CXCommonUtils.sendNotify("目标考核",
+                    "目标考核:【" + item.getYear().split("-")[0] + "】年,【" + item.getQuerter() + "】季度,【" + item.getDepartname() + "】单位的考核已生成,请及时完善",
+                    null,
+                    userIdList,
+                    item.getId(),
+                    "targetassessment");
+        });
     }
 }

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

@@ -1,9 +1,11 @@
 package com.rongwei.sfcommon.sys.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.rongwe.scentity.domian.CheckItemsDo;
 import com.rongwe.scentity.domian.PointCheckDo;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.CheckItemsDao;
 import com.rongwei.sfcommon.sys.service.CheckItemsService;
 import com.rongwei.sfcommon.sys.service.PointCheckService;
@@ -11,10 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service("checkItemsService")
 public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItemsDo> implements CheckItemsService {
@@ -62,4 +62,32 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
         return checkItemsDao.spareList(page);
     }
 
+    @Override
+    public void reportEquMessage() {
+        //查询所有需要提醒的设备
+        List<CheckItemsDo> list = this.baseMapper.selectNeedReportEqu();
+        //查询设备的工厂,三个工厂的设备管理员角色下的员工ID
+        Set<String> tenantIds = list.stream().map(CheckItemsDo::getTenantid).collect(Collectors.toSet());
+        Map<String, List<String>> equManager = new HashMap<>();
+        tenantIds.forEach(tenantId ->{
+            List<String> userIdList = this.baseMapper.selectUserByTenantId(tenantId);
+            equManager.put(tenantId, userIdList);
+        });
+
+        //根据设备的所属工厂给自己工厂的设备管理员发送消息
+        list.forEach(item->{
+            if(ObjectUtil.isNotEmpty(item.getTenantid())) {
+                //发送消息
+                CXCommonUtils.sendNotify("特种设备提醒",
+                        "特种设备【" + item.getCheckitemname() + "】预计提醒时间已到",
+                        null,
+                        equManager.get(item.getTenantid()),
+                        item.getId(),
+                        "specialequipment");
+            }
+        });
+
+
+    }
+
 }

+ 267 - 14
cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/domian/CheckItemsDo.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -25,89 +26,341 @@ public class CheckItemsDo extends BaseDo implements Serializable {
 	/**
 	 * 主键
 	 */
-	@TableId
 	private String id;
+
 	/**
 	 * 检查项名称
 	 */
 	private String checkitemname;
+
 	/**
 	 * 检查项编号
 	 */
 	private String checkitemcode;
+
 	/**
 	 * 检查项类型
 	 */
 	private String checkitemtype;
+
 	/**
 	 * 检查项所属区域ID
 	 */
 	private String checkitemareaid;
+
 	/**
 	 * 年检日期
 	 */
 	private Date yearlyinspectiondate;
+
 	/**
 	 * 提前预警天数
 	 */
 	private Integer earlywarndays;
+
 	/**
 	 * 设备用途
 	 */
 	private String equipmentusage;
+
 	/**
 	 * 检查对象负责人IDS
 	 */
 	private String chargeuserid;
+
 	/**
 	 * 检查对象负责人名称
 	 */
 	private String chargeusername;
+
 	/**
-	 * 检查对象负责组织机构ID
+	 * 检查对象负责组织二级机构ID
 	 */
-	private String chargeorgid;
+	private String chargeorgpid;
+
 	/**
-	 * 检查对象负责组织机构名称
+	 * 检查对象负责组织二级机构名称
 	 */
-	private String chargeorgname;
+	private String chargeorgpname;
+
 	/**
-	 * 检查对象负责组织机构ID
+	 * 检查对象负责组织一级机构ID
 	 */
-	private String chargeorgpid;
+	private String chargeorgcid;
+
 	/**
-	 * 检查对象负责组织机构名称
+	 * 检查对象负责组织一级机构名称
 	 */
-	private String chargeorgpname;
+	private String chargeorgcname;
+
 	/**
-	 * 启用/禁用
+	 * 检查对象负责组织机构ID
 	 */
-	private String enabled;
+	private String chargeorgid;
+
 	/**
-	 * 是否备用
+	 * 检查对象负责组织机构名称
 	 */
-	private String standby;
+	private String chargeorgname;
 
 	/**
 	 * 排序
 	 */
 	private Integer sort;
+
+	/**
+	 * 启用/禁用
+	 */
+	private String enabled;
+
 	/**
 	 * 租户ID
 	 */
-	@TableField(value = "TENANTID", fill = FieldFill.INSERT)
 	private String tenantid;
+
 	/**
 	 * 扩展json格式配置
 	 */
 	private String roption;
+
+	/**
+	 * 是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * 创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * 修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * 修改用户ID
+	 */
+	private String modifyuserid;
+
 	/**
 	 * 创建人名称
 	 */
 	private String createusername;
+
 	/**
 	 * 修改人名称
 	 */
 	private String modifyusername;
 
+	/**
+	 * 是否备用
+	 */
+	private String standby;
+
+	/**
+	 * 规格型号
+	 */
+	private String devicemodel;
+
+	/**
+	 * 出厂编号
+	 */
+	private String deviceoutcode;
+
+	/**
+	 * 安装地点
+	 */
+	private String deviceaddress;
+
+	/**
+	 * 制造单位名称
+	 */
+	private String devicenakedname;
+
+	/**
+	 * 设备代码
+	 */
+	private String devicecode;
+
+	/**
+	 * 注册代码
+	 */
+	private String signupcode;
+
+	/**
+	 * 设备制造日期
+	 */
+	private Date devicecreatedate;
+
+	/**
+	 * 检验日期
+	 */
+	private Date devicecheckdate;
+
+	/**
+	 * 下次检验日期
+	 */
+	private Date nextcheckdate;
+
+	/**
+	 * 环保号
+	 */
+	private String environmentalprotectionno;
+
+	/**
+	 * 备案号
+	 */
+	private String filingno;
+
+	/**
+	 * 使用登记证编号
+	 */
+	private String registrationno;
+
+	/**
+	 * 设备状态
+	 */
+	private String devicestatus;
+
+	/**
+	 * 设备分类
+	 */
+	private String devicesort;
+
+	/**
+	 * 类别
+	 */
+	private String category;
+
+	/**
+	 * 年限
+	 */
+	private Integer life;
+
+	/**
+	 * 预计提醒日期
+	 */
+	private Date warndate;
+
+	/**
+	 * 公称直径(mm)
+	 */
+	private String nominaldiameter;
+
+	/**
+	 * 公称壁厚(mm)
+	 */
+	private String nominalwallthickness;
+
+	/**
+	 * 管道长度(m)
+	 */
+	private String pipelinelength;
+
+	/**
+	 * 管道总长度(m)
+	 */
+	private String pipelinelengthsum;
+
+	/**
+	 * 压力(Mpa)
+	 */
+	private String pressure;
+
+	/**
+	 * 温度(°C)
+	 */
+	private String temperature;
+
+	/**
+	 * 介质
+	 */
+	private String medium;
+
+	/**
+	 * 备注
+	 */
+	private String deviceremark;
+
+	/**
+	 * 设备图
+	 */
+	private String devicephoto;
+
+	/**
+	 * 设备其他资料
+	 */
+	private String deviceotherinformation;
+
+	/**
+	 * 设备安装日期
+	 */
+	private Date deviceinstalldate;
+
+	/**
+	 * 设备开始使用日期
+	 */
+	private Date devicestartdate;
+
+	/**
+	 * 检验结论
+	 */
+	private String inspectresult;
+
+	/**
+	 * 检验机构名称
+	 */
+	private String inspectby;
+
+	/**
+	 * 数据来源(0-普通设备 1-特种设备)
+	 */
+	private String source;
+
+	/**
+	 * 移交设备ID
+	 */
+	private String transferid;
+
+	/**
+	 * 使用部门车间id
+	 */
+	private String usedeptid;
+
+	/**
+	 * 使用部门车间名称
+	 */
+	private String usedeptname;
+
+	/**
+	 * 所属部分
+	 */
+	private String belongpart;
+
+	/**
+	 * 设备原价值(万元)
+	 */
+	private BigDecimal rawvalue;
+
+	/**
+	 * 设备性能
+	 */
+	private String property;
+
+	/**
+	 * 所属工厂
+	 */
+	private String ownedfactory;
+
 }

+ 13 - 0
cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/vo/RoleIdAndUserIdsVo.java

@@ -0,0 +1,13 @@
+package com.rongwe.scentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2023/12/22
+ */
+@Data
+public class RoleIdAndUserIdsVo {
+    private String id;
+    private String userIds;
+}

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

@@ -39,4 +39,17 @@ public class CheckItemsController {
         }
     }
 
+    /**
+     * 设备定时任务提醒,定时任务每天执行一次,【预计提醒日期】在今天及今天之前的数据,给所有设备管理员角色下的员工提醒(分所属工厂)
+     */
+    @PostMapping("/reportEquMessage")
+    public R reportEquMessage(){
+        try{
+            checkItemsService.reportEquMessage();
+            return R.ok();
+        }catch (Exception e){
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+    }
 }

+ 14 - 1
rw-training/training-common/src/main/java/com/rongwei/trainingcommon/sys/service/impl/TrainingDemandServiceImpl.java

@@ -305,7 +305,20 @@ public class TrainingDemandServiceImpl implements TrainingDemandService {
             log.debug("参数异常");
             return R.ok();
         }
+
         TrainingDemandSurveyBackupsDo trainingDemandSurveyBackupsDo = trainingDemandSurveyBackupsServiceImpl.getById(id);
+        if (trainingDemandSurveyBackupsDo == null) {
+            log.debug("问卷不存在");
+            return R.error("当前问卷已结束");
+        }
+        SysUserVo currentUser = TrainingUtils.getCurrentUser();
+        // 不需要显示答案时如果当前用户已参与培训 则提示
+        if (!showAnswer && currentUser != null && StringUtils.isNotBlank(trainingDemandSurveyBackupsDo.getParticipatinguserid())
+                && trainingDemandSurveyBackupsDo.getParticipatinguserid().contains(currentUser.getId())) {
+            log.debug("已参与问卷");
+            return R.error("您已参与过当前问卷");
+        }
+
         String oldSurveyId = trainingDemandSurveyBackupsDo.getOldSurveyId();
         TrainingDemandSurveyDo trainingDemandSurveyDo = trainingDemandSurveyDao.selectById(oldSurveyId);
         if (StringUtils.isBlank(trainingDemandSurveyDo.getState()) || !"1".equals(trainingDemandSurveyDo.getState())) {
@@ -316,7 +329,7 @@ public class TrainingDemandServiceImpl implements TrainingDemandService {
             log.debug("问卷调查发布状态异常");
             return R.error("问卷调查已结束");
         }
-        SysUserVo currentUser = TrainingUtils.getCurrentUser();
+
         List<TrainingDemandVo> surveyContent = demandSurveyContentDao.getSurveyContent(id,
                 showAnswer ? currentUser == null ? "" : currentUser.getId() : "");
 

+ 5 - 2
rw-training/training-common/src/main/java/com/rongwei/trainingcommon/sys/service/impl/TrainingSendNotifyServiceImpl.java

@@ -29,8 +29,7 @@ import java.util.stream.Collectors;
 
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAINING;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAININGFORM;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.*;
 
 /**
  * SendNotifyService class
@@ -200,7 +199,11 @@ public class TrainingSendNotifyServiceImpl implements TrainingSendNotifyService
             CXCommonUtils.sendNotify(TRAIN_NOTIFY_TITLE, String.format(TRAIN_NOTIFY_CONTENT, k.getCoursename(),
                             k.getTrainingstarttime(), k.getTrainingendtimt()), "", new ArrayList<>(v),
                     k.getId(), TRAINING);
+            CXCommonUtils.sendNotify(COURSE_NOTIFY_TITLE, String.format(TRAIN_NOTIFY_CONTENT, k.getCoursename(),
+                            k.getTrainingstarttime(), k.getTrainingendtimt()), "", new ArrayList<>(v),
+                    k.getId(), COURSE);
         });
+
     }
 
     /**

+ 18 - 8
rw-training/training-server/src/main/java/com/rongwei/training/controller/PlanController.java

@@ -11,6 +11,7 @@ import com.rongwei.rwcommon.base.QueryPar;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.training.domain.*;
 import com.rongwei.trainingcommon.sys.service.*;
 import com.rongwei.trainingcommon.sys.service.impl.TrainingSendNotifyServiceImpl;
@@ -22,6 +23,12 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.TRAIN_NOTIFY_CONTENT;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.COURSE_NOTIFY_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.TRAIN_NOTIFY_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.COURSE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAINING;
+
 @RestController
 @RequestMapping("plan")
 @Slf4j
@@ -45,13 +52,6 @@ public class PlanController {
     @Autowired
     private TrainingSendNotifyServiceImpl sendNotifyService;
 
-    public static final String TRAIN_NOTIFY_TITLE = "我的培训";
-    public static final String TRAIN_NOTIFY_CONTENT = "%s,培训时间:%tF-%tF";
-
-    public static final String CANCEL_TRAIN_TITLE = "培训取消提醒";
-    public static final String CANCEL_TRAIN_CONTENT = "%s已取消";
-
-
     /**
      * 列表
      */
@@ -100,6 +100,16 @@ public class PlanController {
                     if (planPaperList.size() > 1) {
                         return R.errorWithMsg("单一培训计划只可对应一张试卷");
                     }
+                    if(!planCourseList.isEmpty()){
+                        CXCommonUtils.sendNotify(COURSE_NOTIFY_TITLE, String.format(TRAIN_NOTIFY_CONTENT, row.getCoursename(),
+                                        row.getTrainingstarttime(), row.getTrainingendtimt()), "", new ArrayList<>(userIds) ,
+                                row.getId(), COURSE);
+                    }
+                    if(!planPaperList.isEmpty()){
+                        CXCommonUtils.sendNotify(TRAIN_NOTIFY_TITLE, String.format(TRAIN_NOTIFY_CONTENT, row.getCoursename(),
+                                        row.getTrainingstarttime(), row.getTrainingendtimt()), "", new ArrayList<>(userIds) ,
+                                row.getId(), TRAINING);
+                    }
                     // 获取参与过本次培训计划的员工
                     QueryWrapper<EmpExamDo> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("PLANID", row.getId());
@@ -366,7 +376,7 @@ public class PlanController {
         /**
          * 发送提醒通知
          */
-        sendNotifyService.sendTrainingPlanNotify(planAndUserIdMap);
+//        sendNotifyService.sendTrainingPlanNotify(planAndUserIdMap);
         return R.ok();
     }