Browse Source

自动报警任务添加

xueyiming 6 tháng trước cách đây
mục cha
commit
004080a241

+ 30 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/AlertMessageMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.wecom.dao.mapper;
+
+import com.tzld.piaoquan.wecom.model.po.AlertMessage;
+import com.tzld.piaoquan.wecom.model.po.AlertMessageExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface AlertMessageMapper {
+    long countByExample(AlertMessageExample example);
+
+    int deleteByExample(AlertMessageExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(AlertMessage record);
+
+    int insertSelective(AlertMessage record);
+
+    List<AlertMessage> selectByExample(AlertMessageExample example);
+
+    AlertMessage selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") AlertMessage record, @Param("example") AlertMessageExample example);
+
+    int updateByExample(@Param("record") AlertMessage record, @Param("example") AlertMessageExample example);
+
+    int updateByPrimaryKeySelective(AlertMessage record);
+
+    int updateByPrimaryKey(AlertMessage record);
+}

+ 53 - 11
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComHistoryDataJob.java

@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.wecom.common.constant.TimeConstant;
 import com.tzld.piaoquan.wecom.common.enums.MessageAttachmentTypeEnum;
+import com.tzld.piaoquan.wecom.dao.mapper.AlertMessageMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.HistoryMessageMapper;
+import com.tzld.piaoquan.wecom.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.UserMapper;
 import com.tzld.piaoquan.wecom.model.bo.MiniprogramRecord;
 import com.tzld.piaoquan.wecom.model.bo.XxlJobParam;
@@ -19,6 +21,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
@@ -53,6 +56,12 @@ public class WeComHistoryDataJob {
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
+    @Autowired
+    private AlertMessageMapper alertMessageMapper;
+
+    @Autowired
+    private StaffMapper staffMapper;
+
 
     @XxlJob("saveHistoryMessageJob")
     public ReturnT<String> selectHistoryMessageByDay(String param) {
@@ -217,17 +226,18 @@ public class WeComHistoryDataJob {
             if (total == null || total == 0) {
                 return;
             }
+            List<AlertMessage> alertMessageList = new ArrayList<>();
             int page = total / size + 1;
             for (int n = 0; n < page; n++) {
                 String res = getHistoryData(size, n * size, startTime, endTime);
-                log.info("selectAlertHistoryMessage size={}, n={}, startTime={}, endTime={}, res={}", size, n, startTime, endTime, res);
+//                log.info("selectAlertHistoryMessage size={}, n={}, startTime={}, endTime={}, res={}", size, n, startTime, endTime, res);
                 if (ObjectUtils.isEmpty(res)) {
                     return;
                 }
                 JSONObject jsonObject = JSONObject.parseObject(res);
                 JSONArray jsonArray = jsonObject.getJSONArray("missions");
                 for (int i = 0; i < jsonArray.size(); i++) {
-                    Date sendAt = jsonArray.getJSONObject(i).getDate("send_at");
+
                     JSONArray attachments = jsonArray.getJSONObject(i).getJSONObject("msg_data").getJSONArray("attachments");
                     List<Long> videoIds = new ArrayList<>();
                     for (int j = 0; j < attachments.size(); j++) {
@@ -238,19 +248,51 @@ public class WeComHistoryDataJob {
                     JSONArray subMissionList = jsonArray.getJSONObject(i).getJSONArray("sub_mission_list");
                     for (int k = 0; k < subMissionList.size(); k++) {
                         if (!"sended".equals(subMissionList.getJSONObject(k).getString("status"))) {
-                            Integer id = jsonArray.getJSONObject(i).getInteger("id");
-                            JSONArray staffExtIdList = jsonArray.getJSONObject(i).getJSONArray("staff_id_list");
-                            JSONObject error = new JSONObject();
-                            error.put("id", id);
-                            error.put("sentAt", sendAt);
-                            error.put("staff_id_list", staffExtIdList);
-                            error.put("videoIds", videoIds);
-                            error.put("status", subMissionList.getJSONObject(k).getString("status"));
-                            LarkRobotUtil.sendMessage(error.toJSONString());
+                            Long messageId = jsonArray.getJSONObject(i).getLong("id");
+                            AlertMessageExample example = new AlertMessageExample();
+                            example.createCriteria().andMessageIdEqualTo(messageId);
+                            List<AlertMessage> alertMessages = alertMessageMapper.selectByExample(example);
+                            if (!CollectionUtils.isEmpty(alertMessages)) {
+                                continue;
+                            }
+                            Long sendAt = jsonArray.getJSONObject(i).getLong("send_at");
+                            AlertMessage alertMessage = new AlertMessage();
+                            alertMessage.setMessageId(messageId);
+                            alertMessage.setSendTime(DateUtil.getDateString(sendAt));
+                            for (int v = 0; v < videoIds.size(); v++) {
+                                if (v == 0) {
+                                    alertMessage.setVideoId1(videoIds.get(v));
+                                }
+                                if (v == 1) {
+                                    alertMessage.setVideoId2(videoIds.get(v));
+                                }
+                                if (v == 2) {
+                                    alertMessage.setVideoId3(videoIds.get(v));
+                                }
+                            }
+                            alertMessage.setStatus(subMissionList.getJSONObject(k).getString("status"));
+                            JSONArray staffIdList = jsonArray.getJSONObject(i).getJSONArray("staff_id_list");
+                            for (int s = 0; s < staffIdList.size(); s++) {
+                                String staffExtId = staffIdList.getString(s);
+                                AlertMessage newAlertMessage = new AlertMessage();
+                                BeanUtils.copyProperties(alertMessage, newAlertMessage);
+                                StaffExample staffExample = new StaffExample();
+                                staffExample.createCriteria().andStaffExtIdEqualTo(staffIdList.getString(s));
+                                List<Staff> staffList = staffMapper.selectByExample(staffExample);
+                                if (CollectionUtils.isEmpty(staffList)) {
+                                    continue;
+                                }
+                                newAlertMessage.setStaffName(staffList.get(0).getRemark());
+                                alertMessageList.add(newAlertMessage);
+                                alertMessageMapper.insert(newAlertMessage);
+                            }
                         }
                     }
                 }
             }
+
+
+            System.out.println(JSONArray.toJSONString(alertMessageList));
         } catch (IOException e) {
             log.error("selectAlertHistoryMessage error", e);
         }

+ 114 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/AlertMessage.java

@@ -0,0 +1,114 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import java.util.Date;
+
+public class AlertMessage {
+    private Long id;
+
+    private Long messageId;
+
+    private String staffName;
+
+    private Long videoId1;
+
+    private Long videoId2;
+
+    private Long videoId3;
+
+    private String status;
+
+    private String sendTime;
+
+    private Date createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getMessageId() {
+        return messageId;
+    }
+
+    public void setMessageId(Long messageId) {
+        this.messageId = messageId;
+    }
+
+    public String getStaffName() {
+        return staffName;
+    }
+
+    public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+
+    public Long getVideoId1() {
+        return videoId1;
+    }
+
+    public void setVideoId1(Long videoId1) {
+        this.videoId1 = videoId1;
+    }
+
+    public Long getVideoId2() {
+        return videoId2;
+    }
+
+    public void setVideoId2(Long videoId2) {
+        this.videoId2 = videoId2;
+    }
+
+    public Long getVideoId3() {
+        return videoId3;
+    }
+
+    public void setVideoId3(Long videoId3) {
+        this.videoId3 = videoId3;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getSendTime() {
+        return sendTime;
+    }
+
+    public void setSendTime(String sendTime) {
+        this.sendTime = sendTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", messageId=").append(messageId);
+        sb.append(", staffName=").append(staffName);
+        sb.append(", videoId1=").append(videoId1);
+        sb.append(", videoId2=").append(videoId2);
+        sb.append(", videoId3=").append(videoId3);
+        sb.append(", status=").append(status);
+        sb.append(", sendTime=").append(sendTime);
+        sb.append(", createTime=").append(createTime);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 772 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/AlertMessageExample.java

@@ -0,0 +1,772 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import com.tzld.piaoquan.wecom.utils.page.Page;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class AlertMessageExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public AlertMessageExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdIsNull() {
+            addCriterion("message_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdIsNotNull() {
+            addCriterion("message_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdEqualTo(Long value) {
+            addCriterion("message_id =", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdNotEqualTo(Long value) {
+            addCriterion("message_id <>", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdGreaterThan(Long value) {
+            addCriterion("message_id >", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("message_id >=", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdLessThan(Long value) {
+            addCriterion("message_id <", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdLessThanOrEqualTo(Long value) {
+            addCriterion("message_id <=", value, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdIn(List<Long> values) {
+            addCriterion("message_id in", values, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdNotIn(List<Long> values) {
+            addCriterion("message_id not in", values, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdBetween(Long value1, Long value2) {
+            addCriterion("message_id between", value1, value2, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andMessageIdNotBetween(Long value1, Long value2) {
+            addCriterion("message_id not between", value1, value2, "messageId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameIsNull() {
+            addCriterion("staff_name is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameIsNotNull() {
+            addCriterion("staff_name is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameEqualTo(String value) {
+            addCriterion("staff_name =", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameNotEqualTo(String value) {
+            addCriterion("staff_name <>", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameGreaterThan(String value) {
+            addCriterion("staff_name >", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameGreaterThanOrEqualTo(String value) {
+            addCriterion("staff_name >=", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameLessThan(String value) {
+            addCriterion("staff_name <", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameLessThanOrEqualTo(String value) {
+            addCriterion("staff_name <=", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameLike(String value) {
+            addCriterion("staff_name like", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameNotLike(String value) {
+            addCriterion("staff_name not like", value, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameIn(List<String> values) {
+            addCriterion("staff_name in", values, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameNotIn(List<String> values) {
+            addCriterion("staff_name not in", values, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameBetween(String value1, String value2) {
+            addCriterion("staff_name between", value1, value2, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffNameNotBetween(String value1, String value2) {
+            addCriterion("staff_name not between", value1, value2, "staffName");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1IsNull() {
+            addCriterion("video_id_1 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1IsNotNull() {
+            addCriterion("video_id_1 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1EqualTo(Long value) {
+            addCriterion("video_id_1 =", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1NotEqualTo(Long value) {
+            addCriterion("video_id_1 <>", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1GreaterThan(Long value) {
+            addCriterion("video_id_1 >", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1GreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id_1 >=", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1LessThan(Long value) {
+            addCriterion("video_id_1 <", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1LessThanOrEqualTo(Long value) {
+            addCriterion("video_id_1 <=", value, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1In(List<Long> values) {
+            addCriterion("video_id_1 in", values, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1NotIn(List<Long> values) {
+            addCriterion("video_id_1 not in", values, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1Between(Long value1, Long value2) {
+            addCriterion("video_id_1 between", value1, value2, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId1NotBetween(Long value1, Long value2) {
+            addCriterion("video_id_1 not between", value1, value2, "videoId1");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2IsNull() {
+            addCriterion("video_id_2 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2IsNotNull() {
+            addCriterion("video_id_2 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2EqualTo(Long value) {
+            addCriterion("video_id_2 =", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2NotEqualTo(Long value) {
+            addCriterion("video_id_2 <>", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2GreaterThan(Long value) {
+            addCriterion("video_id_2 >", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2GreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id_2 >=", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2LessThan(Long value) {
+            addCriterion("video_id_2 <", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2LessThanOrEqualTo(Long value) {
+            addCriterion("video_id_2 <=", value, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2In(List<Long> values) {
+            addCriterion("video_id_2 in", values, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2NotIn(List<Long> values) {
+            addCriterion("video_id_2 not in", values, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2Between(Long value1, Long value2) {
+            addCriterion("video_id_2 between", value1, value2, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId2NotBetween(Long value1, Long value2) {
+            addCriterion("video_id_2 not between", value1, value2, "videoId2");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3IsNull() {
+            addCriterion("video_id_3 is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3IsNotNull() {
+            addCriterion("video_id_3 is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3EqualTo(Long value) {
+            addCriterion("video_id_3 =", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3NotEqualTo(Long value) {
+            addCriterion("video_id_3 <>", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3GreaterThan(Long value) {
+            addCriterion("video_id_3 >", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3GreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id_3 >=", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3LessThan(Long value) {
+            addCriterion("video_id_3 <", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3LessThanOrEqualTo(Long value) {
+            addCriterion("video_id_3 <=", value, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3In(List<Long> values) {
+            addCriterion("video_id_3 in", values, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3NotIn(List<Long> values) {
+            addCriterion("video_id_3 not in", values, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3Between(Long value1, Long value2) {
+            addCriterion("video_id_3 between", value1, value2, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoId3NotBetween(Long value1, Long value2) {
+            addCriterion("video_id_3 not between", value1, value2, "videoId3");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNull() {
+            addCriterion("`status` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNotNull() {
+            addCriterion("`status` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusEqualTo(String value) {
+            addCriterion("`status` =", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotEqualTo(String value) {
+            addCriterion("`status` <>", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThan(String value) {
+            addCriterion("`status` >", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThanOrEqualTo(String value) {
+            addCriterion("`status` >=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThan(String value) {
+            addCriterion("`status` <", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThanOrEqualTo(String value) {
+            addCriterion("`status` <=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLike(String value) {
+            addCriterion("`status` like", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotLike(String value) {
+            addCriterion("`status` not like", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIn(List<String> values) {
+            addCriterion("`status` in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotIn(List<String> values) {
+            addCriterion("`status` not in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusBetween(String value1, String value2) {
+            addCriterion("`status` between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotBetween(String value1, String value2) {
+            addCriterion("`status` not between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeIsNull() {
+            addCriterion("send_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeIsNotNull() {
+            addCriterion("send_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeEqualTo(Date value) {
+            addCriterion("send_time =", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeNotEqualTo(Date value) {
+            addCriterion("send_time <>", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeGreaterThan(Date value) {
+            addCriterion("send_time >", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("send_time >=", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeLessThan(Date value) {
+            addCriterion("send_time <", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeLessThanOrEqualTo(Date value) {
+            addCriterion("send_time <=", value, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeIn(List<Date> values) {
+            addCriterion("send_time in", values, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeNotIn(List<Date> values) {
+            addCriterion("send_time not in", values, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeBetween(Date value1, Date value2) {
+            addCriterion("send_time between", value1, value2, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTimeNotBetween(Date value1, Date value2) {
+            addCriterion("send_time not between", value1, value2, "sendTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 12 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/utils/DateUtil.java

@@ -1,7 +1,10 @@
 package com.tzld.piaoquan.wecom.utils;
 
 
+import java.time.Instant;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Date;
@@ -31,6 +34,15 @@ public class DateUtil {
         return dateFormat.format(today);
     }
 
+    public static String getDateString(Long timestamp) {
+        // 创建日期时间格式化器
+        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        // 将时间戳转换为 LocalDateTime
+        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
+        // 格式化日期时间并返回
+        return dateTime.format(dateFormat);
+    }
+
     public static Long dateDifference(Date date1, Date date2) {
         return Math.abs(date1.getTime() - date2.getTime());
     }

+ 1 - 1
we-com-server/src/main/resources/application-test.properties

@@ -1,6 +1,6 @@
 spring.datasource.username=crawler
 spring.datasource.password=crawler123456@
-spring.datasource.url=jdbc:mysql://rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true
+spring.datasource.url=jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true
 
 spring.redis.database=2
 spring.redis.host=r-bp154bpw97gptefiqkpd.redis.rds.aliyuncs.com

+ 279 - 0
we-com-server/src/main/resources/mapper/AlertMessageMapper.xml

@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.AlertMessageMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.AlertMessage">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="message_id" jdbcType="BIGINT" property="messageId" />
+    <result column="staff_name" jdbcType="VARCHAR" property="staffName" />
+    <result column="video_id_1" jdbcType="BIGINT" property="videoId1" />
+    <result column="video_id_2" jdbcType="BIGINT" property="videoId2" />
+    <result column="video_id_3" jdbcType="BIGINT" property="videoId3" />
+    <result column="status" jdbcType="VARCHAR" property="status" />
+    <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, message_id, staff_name, video_id_1, video_id_2, video_id_3, `status`, send_time, 
+    create_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessageExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from we_com_alert_message
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from we_com_alert_message
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from we_com_alert_message
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessageExample">
+    delete from we_com_alert_message
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessage">
+    insert into we_com_alert_message (id, message_id, staff_name, 
+      video_id_1, video_id_2, video_id_3, 
+      `status`, send_time, create_time
+      )
+    values (#{id,jdbcType=BIGINT}, #{messageId,jdbcType=BIGINT}, #{staffName,jdbcType=VARCHAR}, 
+      #{videoId1,jdbcType=BIGINT}, #{videoId2,jdbcType=BIGINT}, #{videoId3,jdbcType=BIGINT}, 
+      #{status,jdbcType=VARCHAR}, #{sendTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessage">
+    insert into we_com_alert_message
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="messageId != null">
+        message_id,
+      </if>
+      <if test="staffName != null">
+        staff_name,
+      </if>
+      <if test="videoId1 != null">
+        video_id_1,
+      </if>
+      <if test="videoId2 != null">
+        video_id_2,
+      </if>
+      <if test="videoId3 != null">
+        video_id_3,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="sendTime != null">
+        send_time,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="messageId != null">
+        #{messageId,jdbcType=BIGINT},
+      </if>
+      <if test="staffName != null">
+        #{staffName,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId1 != null">
+        #{videoId1,jdbcType=BIGINT},
+      </if>
+      <if test="videoId2 != null">
+        #{videoId2,jdbcType=BIGINT},
+      </if>
+      <if test="videoId3 != null">
+        #{videoId3,jdbcType=BIGINT},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=VARCHAR},
+      </if>
+      <if test="sendTime != null">
+        #{sendTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessageExample" resultType="java.lang.Long">
+    select count(*) from we_com_alert_message
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update we_com_alert_message
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.messageId != null">
+        message_id = #{record.messageId,jdbcType=BIGINT},
+      </if>
+      <if test="record.staffName != null">
+        staff_name = #{record.staffName,jdbcType=VARCHAR},
+      </if>
+      <if test="record.videoId1 != null">
+        video_id_1 = #{record.videoId1,jdbcType=BIGINT},
+      </if>
+      <if test="record.videoId2 != null">
+        video_id_2 = #{record.videoId2,jdbcType=BIGINT},
+      </if>
+      <if test="record.videoId3 != null">
+        video_id_3 = #{record.videoId3,jdbcType=BIGINT},
+      </if>
+      <if test="record.status != null">
+        `status` = #{record.status,jdbcType=VARCHAR},
+      </if>
+      <if test="record.sendTime != null">
+        send_time = #{record.sendTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update we_com_alert_message
+    set id = #{record.id,jdbcType=BIGINT},
+      message_id = #{record.messageId,jdbcType=BIGINT},
+      staff_name = #{record.staffName,jdbcType=VARCHAR},
+      video_id_1 = #{record.videoId1,jdbcType=BIGINT},
+      video_id_2 = #{record.videoId2,jdbcType=BIGINT},
+      video_id_3 = #{record.videoId3,jdbcType=BIGINT},
+      `status` = #{record.status,jdbcType=VARCHAR},
+      send_time = #{record.sendTime,jdbcType=TIMESTAMP},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessage">
+    update we_com_alert_message
+    <set>
+      <if test="messageId != null">
+        message_id = #{messageId,jdbcType=BIGINT},
+      </if>
+      <if test="staffName != null">
+        staff_name = #{staffName,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId1 != null">
+        video_id_1 = #{videoId1,jdbcType=BIGINT},
+      </if>
+      <if test="videoId2 != null">
+        video_id_2 = #{videoId2,jdbcType=BIGINT},
+      </if>
+      <if test="videoId3 != null">
+        video_id_3 = #{videoId3,jdbcType=BIGINT},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=VARCHAR},
+      </if>
+      <if test="sendTime != null">
+        send_time = #{sendTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.AlertMessage">
+    update we_com_alert_message
+    set message_id = #{messageId,jdbcType=BIGINT},
+      staff_name = #{staffName,jdbcType=VARCHAR},
+      video_id_1 = #{videoId1,jdbcType=BIGINT},
+      video_id_2 = #{videoId2,jdbcType=BIGINT},
+      video_id_3 = #{videoId3,jdbcType=BIGINT},
+      `status` = #{status,jdbcType=VARCHAR},
+      send_time = #{sendTime,jdbcType=TIMESTAMP},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 1 - 1
we-com-server/src/main/resources/mybatis-generator-config.xml

@@ -50,7 +50,7 @@
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
-        <table tableName="we_com_user" domainObjectName="User" alias=""/>
+        <table tableName="we_com_alert_message" domainObjectName="AlertMessage" alias=""/>
 <!--        <table tableName="we_com_history_message" domainObjectName="HistoryMessage" alias=""/>-->
 <!--        <table tableName="we_com_message_attachment" domainObjectName="MessageAttachment" alias=""/>-->
 <!--        <table tableName="we_com_staff" domainObjectName="Staff" alias=""/>-->