Bladeren bron

Merge branch 'dev-xym-add-field' into dev-xym-addTag

xueyiming 3 maanden geleden
bovenliggende
commit
7d77c9942d

+ 1 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/SpecialSendMessageMapper.java

@@ -34,7 +34,7 @@ public interface SpecialSendMessageMapper {
 
     int updateByPrimaryKey(SpecialSendMessage record);
 
-    List<SpecialSendMessage> getGroupList();
+    List<SpecialSendMessage> getGroupList(@Param("preSendDate") String preSendDate);
 
     List<String> selectExternalUserId(@Param("staffId") Long staffId, @Param("group") Integer group);
 }

+ 11 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/SpecialSendMessage.java

@@ -15,6 +15,8 @@ public class SpecialSendMessage {
 
     private String attachmentIds;
 
+    private String preSendDate;
+
     private Integer isSend;
 
     private Date createTime;
@@ -69,6 +71,14 @@ public class SpecialSendMessage {
         this.attachmentIds = attachmentIds;
     }
 
+    public String getPreSendDate() {
+        return preSendDate;
+    }
+
+    public void setPreSendDate(String preSendDate) {
+        this.preSendDate = preSendDate;
+    }
+
     public Integer getIsSend() {
         return isSend;
     }
@@ -105,6 +115,7 @@ public class SpecialSendMessage {
         sb.append(", group=").append(group);
         sb.append(", content=").append(content);
         sb.append(", attachmentIds=").append(attachmentIds);
+        sb.append(", preSendDate=").append(preSendDate);
         sb.append(", isSend=").append(isSend);
         sb.append(", createTime=").append(createTime);
         sb.append(", updateTime=").append(updateTime);

+ 70 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/SpecialSendMessageExample.java

@@ -1,7 +1,6 @@
 package com.tzld.piaoquan.growth.common.model.po;
 
 import com.tzld.piaoquan.growth.common.utils.page.Page;
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -497,6 +496,76 @@ public class SpecialSendMessageExample {
             return (Criteria) this;
         }
 
+        public Criteria andPreSendDateIsNull() {
+            addCriterion("pre_send_date is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateIsNotNull() {
+            addCriterion("pre_send_date is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateEqualTo(String value) {
+            addCriterion("pre_send_date =", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateNotEqualTo(String value) {
+            addCriterion("pre_send_date <>", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateGreaterThan(String value) {
+            addCriterion("pre_send_date >", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateGreaterThanOrEqualTo(String value) {
+            addCriterion("pre_send_date >=", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateLessThan(String value) {
+            addCriterion("pre_send_date <", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateLessThanOrEqualTo(String value) {
+            addCriterion("pre_send_date <=", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateLike(String value) {
+            addCriterion("pre_send_date like", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateNotLike(String value) {
+            addCriterion("pre_send_date not like", value, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateIn(List<String> values) {
+            addCriterion("pre_send_date in", values, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateNotIn(List<String> values) {
+            addCriterion("pre_send_date not in", values, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateBetween(String value1, String value2) {
+            addCriterion("pre_send_date between", value1, value2, "preSendDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andPreSendDateNotBetween(String value1, String value2) {
+            addCriterion("pre_send_date not between", value1, value2, "preSendDate");
+            return (Criteria) this;
+        }
+
         public Criteria andIsSendIsNull() {
             addCriterion("is_send is null");
             return (Criteria) this;

+ 22 - 4
common-module/src/main/resources/mapper/SpecialSendMessageMapper.xml

@@ -8,6 +8,7 @@
         <result column="group" jdbcType="INTEGER" property="group"/>
         <result column="content" jdbcType="VARCHAR" property="content"/>
         <result column="attachment_ids" jdbcType="VARCHAR" property="attachmentIds"/>
+        <result column="pre_send_date" jdbcType="VARCHAR" property="preSendDate"/>
         <result column="is_send" jdbcType="INTEGER" property="isSend"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
@@ -74,7 +75,8 @@
     </sql>
     <sql id="Base_Column_List">
         id
-        , staff_id, user_id, `group`, content, attachment_ids, is_send, create_time, update_time
+        , staff_id, user_id, `group`, content, attachment_ids, pre_send_date, is_send,
+    create_time, update_time
     </sql>
     <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.SpecialSendMessageExample"
             resultMap="BaseResultMap">
@@ -114,10 +116,12 @@
     <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.SpecialSendMessage">
         insert into we_com_special_send_message (id, staff_id, user_id,
                                                  `group`, content, attachment_ids,
-                                                 is_send, create_time, update_time)
+                                                 pre_send_date, is_send, create_time,
+                                                 update_time)
         values (#{id,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
                 #{group,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{attachmentIds,jdbcType=VARCHAR},
-                #{isSend,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+                #{preSendDate,jdbcType=VARCHAR}, #{isSend,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
+                #{updateTime,jdbcType=TIMESTAMP})
     </insert>
     <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.SpecialSendMessage">
         insert into we_com_special_send_message
@@ -140,6 +144,9 @@
             <if test="attachmentIds != null">
                 attachment_ids,
             </if>
+            <if test="preSendDate != null">
+                pre_send_date,
+            </if>
             <if test="isSend != null">
                 is_send,
             </if>
@@ -169,6 +176,9 @@
             <if test="attachmentIds != null">
                 #{attachmentIds,jdbcType=VARCHAR},
             </if>
+            <if test="preSendDate != null">
+                #{preSendDate,jdbcType=VARCHAR},
+            </if>
             <if test="isSend != null">
                 #{isSend,jdbcType=INTEGER},
             </if>
@@ -208,6 +218,9 @@
             <if test="record.attachmentIds != null">
                 attachment_ids = #{record.attachmentIds,jdbcType=VARCHAR},
             </if>
+            <if test="record.preSendDate != null">
+                pre_send_date = #{record.preSendDate,jdbcType=VARCHAR},
+            </if>
             <if test="record.isSend != null">
                 is_send = #{record.isSend,jdbcType=INTEGER},
             </if>
@@ -230,6 +243,7 @@
         `group` = #{record.group,jdbcType=INTEGER},
         content = #{record.content,jdbcType=VARCHAR},
         attachment_ids = #{record.attachmentIds,jdbcType=VARCHAR},
+        pre_send_date = #{record.preSendDate,jdbcType=VARCHAR},
         is_send = #{record.isSend,jdbcType=INTEGER},
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
         update_time = #{record.updateTime,jdbcType=TIMESTAMP}
@@ -256,6 +270,9 @@
             <if test="attachmentIds != null">
                 attachment_ids = #{attachmentIds,jdbcType=VARCHAR},
             </if>
+            <if test="preSendDate != null">
+                pre_send_date = #{preSendDate,jdbcType=VARCHAR},
+            </if>
             <if test="isSend != null">
                 is_send = #{isSend,jdbcType=INTEGER},
             </if>
@@ -275,6 +292,7 @@
             `group`        = #{group,jdbcType=INTEGER},
             content        = #{content,jdbcType=VARCHAR},
             attachment_ids = #{attachmentIds,jdbcType=VARCHAR},
+            pre_send_date  = #{preSendDate,jdbcType=VARCHAR},
             is_send        = #{isSend,jdbcType=INTEGER},
             create_time    = #{createTime,jdbcType=TIMESTAMP},
             update_time    = #{updateTime,jdbcType=TIMESTAMP}
@@ -284,7 +302,7 @@
     <select id="getGroupList" resultMap="BaseResultMap">
         select staff_id, `group`, content, attachment_ids
         from we_com_special_send_message
-        where is_send = 0
+        where is_send = 0 and pre_send_date = #{preSendDate,jdbcType=VARCHAR}
         group by staff_id, `group`, content, attachment_ids
     </select>
 

+ 2 - 2
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComMessageDataJob.java

@@ -238,10 +238,10 @@ public class WeComMessageDataJob {
         init(staffIds);
         for (Corp corp : corps) {
             WeComUserExample weComUserExample = new WeComUserExample();
-            weComUserExample.createCriteria().andExternalUserIdIsNotNull().andCorpIdEqualTo(corp.getId())
+            WeComUserExample.Criteria criteria = weComUserExample.createCriteria().andExternalUserIdIsNotNull().andCorpIdEqualTo(corp.getId())
                     .andGroupMsgDisabledNotEqualTo((byte) 2);
             if (xxlJobParam.getUserId() != null) {
-                weComUserExample.createCriteria().andIdEqualTo(xxlJobParam.getUserId());
+                criteria.andIdEqualTo(xxlJobParam.getUserId());
             }
             long count = weComUserMapper.countByExample(weComUserExample);
             int page = 1;

+ 5 - 2
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComSpecialDataJob.java

@@ -12,6 +12,7 @@ import com.tzld.piaoquan.growth.common.dao.mapper.WeComUserMapper;
 import com.tzld.piaoquan.growth.common.model.po.*;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.service.MessageService;
+import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.ToolUtils;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -49,7 +50,7 @@ public class WeComSpecialDataJob {
 
 
     public void specialAssembleSendMessage(Long staffId, Integer pageNum, Integer pageSize,
-                                           byte groupMsgDisabled, List<Long> attachmentIds, String content) {
+                                           byte groupMsgDisabled, List<Long> attachmentIds, String content, String date) {
         List<WeComUser> weComUserList = weComUserMapper.selectUserList(staffId, groupMsgDisabled, (pageNum - 1) * pageSize, pageSize);
         //落库逻辑
         for (WeComUser weComUser : weComUserList) {
@@ -59,13 +60,15 @@ public class WeComSpecialDataJob {
             specialSendMessage.setGroup(pageNum);
             specialSendMessage.setAttachmentIds(JSONObject.toJSONString(attachmentIds));
             specialSendMessage.setContent(content);
+            specialSendMessage.setPreSendDate(date);
             specialSendMessageMapper.insertSelective(specialSendMessage);
         }
     }
 
     @XxlJob("sendSpecialPushMessageJob")
     public ReturnT<String> sendSpecialPushMessage(String param) {
-        List<SpecialSendMessage> groupList = specialSendMessageMapper.getGroupList();
+        String thatDayDateString = DateUtil.getThatDayDateString();
+        List<SpecialSendMessage> groupList = specialSendMessageMapper.getGroupList(thatDayDateString);
         for (SpecialSendMessage specialSendMessage : groupList) {
             List<String> externalUserIds = specialSendMessageMapper.selectExternalUserId(specialSendMessage.getStaffId(), specialSendMessage.getGroup());
             boolean flag = specialPushMessage(externalUserIds, specialSendMessage);