فهرست منبع

安全会议定时任务提醒,定时任务每天凌晨执行一次,发送今天和明天的会议提醒

sucheng 1 سال پیش
والد
کامیت
9b3591aa52

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

@@ -0,0 +1,12 @@
+package com.rongwei.sfcommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwe.scentity.domian.AspSafetyMeeting;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface AspSafetyMeetingDao extends BaseMapper<AspSafetyMeeting> {
+    @Select("select * from asp_safety_meeting where DELETED = 0 AND MEETINGDATE >= CURDATE() AND MEETINGDATE <= DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 DAY),'%Y-%m-%d 23:59:59') AND ISSTAGING = 1")
+    List<AspSafetyMeeting> selectNeedReportMessage();
+}

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

@@ -0,0 +1,16 @@
+package com.rongwei.sfcommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwe.scentity.domian.AspSafetyMeeting;
+
+
+/**
+ * 安全会议
+ */
+public interface AspSafetyMeetingService extends IService<AspSafetyMeeting> {
+
+
+    void reportMessage();
+
+}
+

+ 41 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafetyMeetingImpl.java

@@ -0,0 +1,41 @@
+package com.rongwei.sfcommon.sys.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ArrayUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwe.scentity.domian.AspSafetyMeeting;
+import com.rongwei.safecommon.utils.CXCommonUtils;
+import com.rongwei.sfcommon.sys.dao.AspSafetyMeetingDao;
+import com.rongwei.sfcommon.sys.service.AspSafetyMeetingService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Array;
+import java.util.Arrays;
+import java.util.List;
+
+@Service
+public class AspSafetyMeetingImpl extends ServiceImpl<AspSafetyMeetingDao, AspSafetyMeeting> implements AspSafetyMeetingService {
+
+    @Override
+    public void reportMessage() {
+        //查询今天和明天需要提醒的会议
+        List<AspSafetyMeeting> list = this.baseMapper.selectNeedReportMessage();
+
+        //遍历list处理发送消息
+        list.forEach(item -> {
+            //处理需要接收消息的人
+            List<String> userIdList = Arrays.asList(item.getMeetingparticipationid().split(","));
+            //发送消息
+            CXCommonUtils.sendNotify("会议提醒",
+                    "由【" + item.getMeetingheader() + "】主持的【"
+                            + item.getMeetingtitle() + "】,将于【"
+                            + DateUtil.format(item.getMeetingdate(), "yyyy-MM-dd HH:mm:ss") + "】在【"
+                            + item.getMeetingaddress() + "】召开会议、会议说明:【"
+                            + item.getMeetingremark() + "】,请届时参加!",
+                    null,
+                    userIdList,
+                    item.getId(),
+                    "safetymeeting");
+        });
+    }
+}

+ 124 - 0
cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/domian/AspSafetyMeeting.java

@@ -0,0 +1,124 @@
+package com.rongwe.scentity.domian;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * asp_safety_meeting
+ * @author 
+ */
+@Data
+public class AspSafetyMeeting implements Serializable {
+    /**
+     * 主键ID
+     */
+    private String id;
+
+    /**
+     * 租户ID
+     */
+    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;
+
+    /**
+     * 部门ID
+     */
+    private String orgid;
+
+    /**
+     * 会议主题
+     */
+    private String meetingtitle;
+
+    /**
+     * 会议时间
+     */
+    private Date meetingdate;
+
+    /**
+     * 会议地点
+     */
+    private String meetingaddress;
+
+    /**
+     * 会议负责人
+     */
+    private String meetingheader;
+
+    /**
+     * 会议负责人ID
+     */
+    private String meetingheaderid;
+
+    /**
+     * 参会人员
+     */
+    private String meetingparticipation;
+
+    /**
+     * 参会人员id
+     */
+    private String meetingparticipationid;
+
+    /**
+     * 会议说明
+     */
+    private String meetingremark;
+
+    /**
+     * 附件
+     */
+    private String meetingfile;
+
+    /**
+     * 状态(0:暂存,1:已发送)
+     */
+    private String isstaging;
+
+    private static final long serialVersionUID = 1L;
+}

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

@@ -0,0 +1,32 @@
+package com.rongwei.savecheck.controller;
+
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.sfcommon.sys.service.AspSafetyMeetingService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("aspSafetyMeeting")
+@Slf4j
+public class AspSafetyMeetingController {
+
+    @Autowired
+    private AspSafetyMeetingService aspSafetyMeetingService;
+
+    /**
+     * 安全会议定时任务提醒,定时任务每天凌晨执行一次,发送今天和明天的会议提醒
+     */
+    @PostMapping("/reportMessage")
+    public R reportMessage(){
+        try{
+            aspSafetyMeetingService.reportMessage();
+            return R.ok();
+        }catch (Exception e){
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+    }
+}