Explorar o código

修改特殊消息发送逻辑 设置预发送内容 当天组装发送

xueyiming hai 3 meses
pai
achega
8a705156c2
Modificáronse 17 ficheiros con 1986 adicións e 449 borrados
  1. 14 1
      api-module/src/main/java/com/tzld/piaoquan/api/controller/MessageController.java
  2. 1 1
      api-module/src/main/resources/mybatis-generator-config.xml
  3. 35 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/PreSpecialSendMessageMapper.java
  4. 2 1
      common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/SpecialSendMessageMapper.java
  5. 2 8
      common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/WeComUserMapper.java
  6. 136 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/PreSpecialSendMessage.java
  7. 903 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/PreSpecialSendMessageExample.java
  8. 20 2
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageServiceImpl.java
  9. 55 4
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java
  10. 6 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/MessageService.java
  11. 6 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/WeComUserService.java
  12. 309 0
      common-module/src/main/resources/mapper/PreSpecialSendMessageMapper.xml
  13. 4 8
      common-module/src/main/resources/mapper/SpecialSendMessageMapper.xml
  14. 404 412
      common-module/src/main/resources/mapper/WeComUserMapper.xml
  15. 9 1
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComMessageDataJob.java
  16. 71 8
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComSpecialDataJob.java
  17. 9 3
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

+ 14 - 1
api-module/src/main/java/com/tzld/piaoquan/api/controller/MessageController.java

@@ -2,14 +2,18 @@ package com.tzld.piaoquan.api.controller;
 
 
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage;
 import com.tzld.piaoquan.growth.common.model.vo.GuaranteedParam;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
+import com.tzld.piaoquan.growth.common.service.MessageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/wecom/message")
 public class MessageController {
@@ -17,10 +21,19 @@ public class MessageController {
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
+    @Autowired
+    private MessageService messageService;
+
     //创建保底小程序
     @PostMapping("/miniprogram/guaranteed/create")
-    public CommonResponse<Void> createGuaranteedMiniProgram(@RequestBody GuaranteedParam guaranteedParam){
+    public CommonResponse<Void> createGuaranteedMiniProgram(@RequestBody GuaranteedParam guaranteedParam) {
         return messageAttachmentService.createGuaranteedMiniProgram(guaranteedParam);
     }
 
+    //创建保底小程序
+    @PostMapping("/preSpecialAssembleSendMessage/create")
+    public CommonResponse<Void> createPreSpecialAssembleSendMessage(@RequestBody List<PreSpecialSendMessage> preSpecialSendMessage) {
+        return messageService.createPreSpecialAssembleSendMessage(preSpecialSendMessage);
+    }
+
 }

+ 1 - 1
api-module/src/main/resources/mybatis-generator-config.xml

@@ -55,7 +55,7 @@
 <!--        <table tableName="we_com_guarantees_video" domainObjectName="GuaranteesVideo" alias=""/>-->
 <!--        <table tableName="we_com_staff" domainObjectName="Staff" alias=""/>-->
 <!--        <table tableName="we_com_message_attachment" domainObjectName="MessageAttachment" alias=""/>-->
-        <table tableName="we_com_special_send_message" domainObjectName="SpecialSendMessage" alias=""/>
+        <table tableName="we_com_special_pre_send_message" domainObjectName="PreSpecialSendMessage" alias=""/>
 <!--        <table tableName="we_com_send_msg_result" domainObjectName="SendMsgResult" alias=""/>-->
 <!--        <table tableName="we_com_corp" domainObjectName="Corp" alias=""/>-->
 

+ 35 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/PreSpecialSendMessageMapper.java

@@ -0,0 +1,35 @@
+package com.tzld.piaoquan.growth.common.dao.mapper;
+
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage;
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessageExample;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface PreSpecialSendMessageMapper {
+    long countByExample(PreSpecialSendMessageExample example);
+
+    int deleteByExample(PreSpecialSendMessageExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(PreSpecialSendMessage record);
+
+    int insertSelective(PreSpecialSendMessage record);
+
+    List<PreSpecialSendMessage> selectByExample(PreSpecialSendMessageExample example);
+
+    PreSpecialSendMessage selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") PreSpecialSendMessage record, @Param("example") PreSpecialSendMessageExample example);
+
+    int updateByExample(@Param("record") PreSpecialSendMessage record, @Param("example") PreSpecialSendMessageExample example);
+
+    int updateByPrimaryKeySelective(PreSpecialSendMessage record);
+
+    int updateByPrimaryKey(PreSpecialSendMessage record);
+}

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

@@ -36,5 +36,6 @@ public interface SpecialSendMessageMapper {
 
     List<SpecialSendMessage> getGroupList(@Param("preSendDate") String preSendDate);
 
-    List<String> selectExternalUserId(@Param("staffId") Long staffId, @Param("group") Integer group, @Param("preSendDate") String preSendDate);
+    List<String> selectExternalUserId(@Param("staffId") Long staffId, @Param("group") Integer group,
+                                      @Param("preSendDate") String preSendDate);
 }

+ 2 - 8
common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/WeComUserMapper.java

@@ -39,16 +39,10 @@ public interface WeComUserMapper {
 
     List<WeComUser> selectUserList(@Param("staffId") Long staffId,
                                    @Param("groupMsgDisabled") byte groupMsgDisabled,
+                                   @Param("filterTagIdList") List<Long> filterTagIdList,
                                    @Param("pageNum") Integer pageNum,
                                    @Param("pageSize") Integer pageSize);
 
-    List<WeComUser> selectSendUserList(@Param("staffId") Long staffId,
-                                       @Param("groupMsgDisabled") byte groupMsgDisabled,
-                                       @Param("pageNum") Integer pageNum,
-                                       @Param("pageSize") Integer pageSize);
+    List<WeComUser> selectByTagUserList(@Param("tagId") Long tagId);
 
-    List<WeComUser> selectNotSendUserList(@Param("staffId") Long staffId,
-                                          @Param("groupMsgDisabled") byte groupMsgDisabled,
-                                          @Param("pageNum") Integer pageNum,
-                                          @Param("pageSize") Integer pageSize);
 }

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

@@ -0,0 +1,136 @@
+package com.tzld.piaoquan.growth.common.model.po;
+
+import java.util.Date;
+
+public class PreSpecialSendMessage {
+    private Long id;
+
+    private String preSendDate;
+
+    private Long staffId;
+
+    private String content;
+
+    private String attachmentIds;
+
+    private Integer groupMsgDisabled;
+
+    private Integer pageNum;
+
+    private Integer pageSize;
+
+    private Long tagId;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getPreSendDate() {
+        return preSendDate;
+    }
+
+    public void setPreSendDate(String preSendDate) {
+        this.preSendDate = preSendDate;
+    }
+
+    public Long getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(Long staffId) {
+        this.staffId = staffId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getAttachmentIds() {
+        return attachmentIds;
+    }
+
+    public void setAttachmentIds(String attachmentIds) {
+        this.attachmentIds = attachmentIds;
+    }
+
+    public Integer getGroupMsgDisabled() {
+        return groupMsgDisabled;
+    }
+
+    public void setGroupMsgDisabled(Integer groupMsgDisabled) {
+        this.groupMsgDisabled = groupMsgDisabled;
+    }
+
+    public Integer getPageNum() {
+        return pageNum;
+    }
+
+    public void setPageNum(Integer pageNum) {
+        this.pageNum = pageNum;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Long getTagId() {
+        return tagId;
+    }
+
+    public void setTagId(Long tagId) {
+        this.tagId = tagId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @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(", preSendDate=").append(preSendDate);
+        sb.append(", staffId=").append(staffId);
+        sb.append(", content=").append(content);
+        sb.append(", attachmentIds=").append(attachmentIds);
+        sb.append(", groupMsgDisabled=").append(groupMsgDisabled);
+        sb.append(", pageNum=").append(pageNum);
+        sb.append(", pageSize=").append(pageSize);
+        sb.append(", tagId=").append(tagId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -0,0 +1,903 @@
+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;
+
+public class PreSpecialSendMessageExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public PreSpecialSendMessageExample() {
+        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 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 andStaffIdIsNull() {
+            addCriterion("staff_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIsNotNull() {
+            addCriterion("staff_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdEqualTo(Long value) {
+            addCriterion("staff_id =", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotEqualTo(Long value) {
+            addCriterion("staff_id <>", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThan(Long value) {
+            addCriterion("staff_id >", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("staff_id >=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThan(Long value) {
+            addCriterion("staff_id <", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThanOrEqualTo(Long value) {
+            addCriterion("staff_id <=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIn(List<Long> values) {
+            addCriterion("staff_id in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotIn(List<Long> values) {
+            addCriterion("staff_id not in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdBetween(Long value1, Long value2) {
+            addCriterion("staff_id between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotBetween(Long value1, Long value2) {
+            addCriterion("staff_id not between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIsNull() {
+            addCriterion("content is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIsNotNull() {
+            addCriterion("content is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentEqualTo(String value) {
+            addCriterion("content =", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotEqualTo(String value) {
+            addCriterion("content <>", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentGreaterThan(String value) {
+            addCriterion("content >", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentGreaterThanOrEqualTo(String value) {
+            addCriterion("content >=", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLessThan(String value) {
+            addCriterion("content <", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLessThanOrEqualTo(String value) {
+            addCriterion("content <=", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLike(String value) {
+            addCriterion("content like", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotLike(String value) {
+            addCriterion("content not like", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIn(List<String> values) {
+            addCriterion("content in", values, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotIn(List<String> values) {
+            addCriterion("content not in", values, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentBetween(String value1, String value2) {
+            addCriterion("content between", value1, value2, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotBetween(String value1, String value2) {
+            addCriterion("content not between", value1, value2, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsIsNull() {
+            addCriterion("attachment_ids is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsIsNotNull() {
+            addCriterion("attachment_ids is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsEqualTo(String value) {
+            addCriterion("attachment_ids =", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsNotEqualTo(String value) {
+            addCriterion("attachment_ids <>", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsGreaterThan(String value) {
+            addCriterion("attachment_ids >", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsGreaterThanOrEqualTo(String value) {
+            addCriterion("attachment_ids >=", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsLessThan(String value) {
+            addCriterion("attachment_ids <", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsLessThanOrEqualTo(String value) {
+            addCriterion("attachment_ids <=", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsLike(String value) {
+            addCriterion("attachment_ids like", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsNotLike(String value) {
+            addCriterion("attachment_ids not like", value, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsIn(List<String> values) {
+            addCriterion("attachment_ids in", values, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsNotIn(List<String> values) {
+            addCriterion("attachment_ids not in", values, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsBetween(String value1, String value2) {
+            addCriterion("attachment_ids between", value1, value2, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andAttachmentIdsNotBetween(String value1, String value2) {
+            addCriterion("attachment_ids not between", value1, value2, "attachmentIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledIsNull() {
+            addCriterion("group_msg_disabled is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledIsNotNull() {
+            addCriterion("group_msg_disabled is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledEqualTo(Integer value) {
+            addCriterion("group_msg_disabled =", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledNotEqualTo(Integer value) {
+            addCriterion("group_msg_disabled <>", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledGreaterThan(Integer value) {
+            addCriterion("group_msg_disabled >", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledGreaterThanOrEqualTo(Integer value) {
+            addCriterion("group_msg_disabled >=", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledLessThan(Integer value) {
+            addCriterion("group_msg_disabled <", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledLessThanOrEqualTo(Integer value) {
+            addCriterion("group_msg_disabled <=", value, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledIn(List<Integer> values) {
+            addCriterion("group_msg_disabled in", values, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledNotIn(List<Integer> values) {
+            addCriterion("group_msg_disabled not in", values, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledBetween(Integer value1, Integer value2) {
+            addCriterion("group_msg_disabled between", value1, value2, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andGroupMsgDisabledNotBetween(Integer value1, Integer value2) {
+            addCriterion("group_msg_disabled not between", value1, value2, "groupMsgDisabled");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumIsNull() {
+            addCriterion("page_num is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumIsNotNull() {
+            addCriterion("page_num is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumEqualTo(Integer value) {
+            addCriterion("page_num =", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumNotEqualTo(Integer value) {
+            addCriterion("page_num <>", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumGreaterThan(Integer value) {
+            addCriterion("page_num >", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumGreaterThanOrEqualTo(Integer value) {
+            addCriterion("page_num >=", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumLessThan(Integer value) {
+            addCriterion("page_num <", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumLessThanOrEqualTo(Integer value) {
+            addCriterion("page_num <=", value, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumIn(List<Integer> values) {
+            addCriterion("page_num in", values, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumNotIn(List<Integer> values) {
+            addCriterion("page_num not in", values, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumBetween(Integer value1, Integer value2) {
+            addCriterion("page_num between", value1, value2, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageNumNotBetween(Integer value1, Integer value2) {
+            addCriterion("page_num not between", value1, value2, "pageNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeIsNull() {
+            addCriterion("page_size is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeIsNotNull() {
+            addCriterion("page_size is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeEqualTo(Integer value) {
+            addCriterion("page_size =", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeNotEqualTo(Integer value) {
+            addCriterion("page_size <>", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeGreaterThan(Integer value) {
+            addCriterion("page_size >", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeGreaterThanOrEqualTo(Integer value) {
+            addCriterion("page_size >=", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeLessThan(Integer value) {
+            addCriterion("page_size <", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeLessThanOrEqualTo(Integer value) {
+            addCriterion("page_size <=", value, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeIn(List<Integer> values) {
+            addCriterion("page_size in", values, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeNotIn(List<Integer> values) {
+            addCriterion("page_size not in", values, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeBetween(Integer value1, Integer value2) {
+            addCriterion("page_size between", value1, value2, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageSizeNotBetween(Integer value1, Integer value2) {
+            addCriterion("page_size not between", value1, value2, "pageSize");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdIsNull() {
+            addCriterion("tag_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdIsNotNull() {
+            addCriterion("tag_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdEqualTo(Long value) {
+            addCriterion("tag_id =", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdNotEqualTo(Long value) {
+            addCriterion("tag_id <>", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdGreaterThan(Long value) {
+            addCriterion("tag_id >", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("tag_id >=", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdLessThan(Long value) {
+            addCriterion("tag_id <", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdLessThanOrEqualTo(Long value) {
+            addCriterion("tag_id <=", value, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdIn(List<Long> values) {
+            addCriterion("tag_id in", values, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdNotIn(List<Long> values) {
+            addCriterion("tag_id not in", values, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdBetween(Long value1, Long value2) {
+            addCriterion("tag_id between", value1, value2, "tagId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTagIdNotBetween(Long value1, Long value2) {
+            addCriterion("tag_id not between", value1, value2, "tagId");
+            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 Criteria andUpdateTimeIsNull() {
+            addCriterion("update_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNotNull() {
+            addCriterion("update_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeEqualTo(Date value) {
+            addCriterion("update_time =", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotEqualTo(Date value) {
+            addCriterion("update_time <>", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThan(Date value) {
+            addCriterion("update_time >", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("update_time >=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThan(Date value) {
+            addCriterion("update_time <", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("update_time <=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIn(List<Date> values) {
+            addCriterion("update_time in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotIn(List<Date> values) {
+            addCriterion("update_time not in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
+            addCriterion("update_time between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("update_time not between", value1, value2, "updateTime");
+            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);
+        }
+    }
+}

+ 20 - 2
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageServiceImpl.java

@@ -1,17 +1,24 @@
 package com.tzld.piaoquan.growth.common.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
 import com.tzld.piaoquan.growth.common.common.constant.MessageConstant;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.dao.mapper.PreSpecialSendMessageMapper;
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage;
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessageExample;
 import com.tzld.piaoquan.growth.common.service.WeComAccessTokenService;
 import com.tzld.piaoquan.growth.common.service.MessageService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
+import java.util.List;
 
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.POST_WE_COM_ADD_MSG_TEMPLATE;
 
@@ -26,6 +33,9 @@ public class MessageServiceImpl implements MessageService {
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
+    @Autowired
+    private PreSpecialSendMessageMapper preSpecialSendMessageMapper;
+
     @Override
     public boolean pushWeComMessage(JSONObject jsonObject, Long corpId) {
         try {
@@ -48,8 +58,6 @@ public class MessageServiceImpl implements MessageService {
     }
 
 
-
-
     @Override
     public String getMessageText() {
         Integer hour = DateUtil.getHourOfDay();
@@ -59,4 +67,14 @@ public class MessageServiceImpl implements MessageService {
             return MessageConstant.guaranteedText;
         }
     }
+
+    @Override
+    public CommonResponse<Void> createPreSpecialAssembleSendMessage(List<PreSpecialSendMessage> preSpecialSendMessages) {
+        for (PreSpecialSendMessage preSpecialSendMessage : preSpecialSendMessages) {
+            preSpecialSendMessageMapper.insertSelective(preSpecialSendMessage);
+        }
+        return CommonResponse.success();
+    }
+
+
 }

+ 55 - 4
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.StaffWithUserMapper;
+import com.tzld.piaoquan.growth.common.dao.mapper.UserWithTagMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.WeComUserMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.ext.WeComUserMapperExt;
 import com.tzld.piaoquan.growth.common.model.bo.GroupSendWeComUserParam;
@@ -17,16 +18,16 @@ import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.GET_WE_COM_EXTERNAL_CONTACT_GET;
 
@@ -51,6 +52,13 @@ public class WeComUserServiceImpl implements WeComUserService {
     @Autowired
     private StaffMapper staffMapper;
 
+    @Autowired
+    private UserWithTagMapper userWithTagMapper;
+
+    @Value("${needFilterTagIdConfig:[]}")
+    private String needFilterTagIdConfig;
+
+
     @Override
     public void addStaffWithUser(String externalUserId, String carrierId, Long corpId) {
         if (StringUtils.isEmpty(externalUserId) || StringUtils.isEmpty(carrierId)) {
@@ -281,4 +289,47 @@ public class WeComUserServiceImpl implements WeComUserService {
         page.setObjs(list);
         return page;
     }
+
+
+    public List<Long> getFilterTagUserId() {
+        List<Long> needFilterTagIdList = JSONArray.parseArray(needFilterTagIdConfig, Long.class);
+        if (CollectionUtils.isEmpty(needFilterTagIdList)) {
+            return new ArrayList<>();
+        }
+        UserWithTagExample example = new UserWithTagExample();
+        example.createCriteria().andTagIdIn(needFilterTagIdList).andIsDeleteEqualTo(0);
+        List<UserWithTag> userWithTags = userWithTagMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(userWithTags)) {
+            return new ArrayList<>();
+        }
+        return userWithTags.stream().map(UserWithTag::getUserId).distinct().collect(Collectors.toList());
+    }
+
+    public List<Long> getFilterTagId() {
+        List<Long> needFilterTagIdList = JSONArray.parseArray(needFilterTagIdConfig, Long.class);
+        if (CollectionUtils.isEmpty(needFilterTagIdList)) {
+            return new ArrayList<>();
+        }
+        return needFilterTagIdList;
+    }
+
+    @Override
+    public List<Staff> getStaffByUserId(Long userId) {
+        StaffWithUserExample example = new StaffWithUserExample();
+        example.createCriteria().andUserIdEqualTo(userId);
+        List<StaffWithUser> staffWithUsers = staffWithUserMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(staffWithUsers)) {
+            return null;
+        }
+        List<Staff> allStaffs = new ArrayList<>();
+        for (StaffWithUser staffWithUser : staffWithUsers) {
+            StaffExample staffExample = new StaffExample();
+            staffExample.createCriteria().andIdEqualTo(staffWithUser.getStaffId());
+            List<Staff> staffs = staffMapper.selectByExample(staffExample);
+            if (!CollectionUtils.isEmpty(staffs)) {
+                allStaffs.addAll(staffs);
+            }
+        }
+        return allStaffs;
+    }
 }

+ 6 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/MessageService.java

@@ -1,10 +1,16 @@
 package com.tzld.piaoquan.growth.common.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage;
+
+import java.util.List;
 
 public interface MessageService {
 
     boolean pushWeComMessage(JSONObject jsonObject, Long corpId);
 
     String getMessageText();
+
+    CommonResponse<Void> createPreSpecialAssembleSendMessage(List<PreSpecialSendMessage> preSpecialSendMessages);
 }

+ 6 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/WeComUserService.java

@@ -26,4 +26,10 @@ public interface WeComUserService {
     JSONObject getUserDetail(String externalUserId, Long corpId);
 
     Page<WeComUserVo> getGroupSendWeComUser(GroupSendWeComUserParam param);
+
+    List<Long> getFilterTagUserId();
+
+    List<Long> getFilterTagId();
+
+    List<Staff> getStaffByUserId(Long userId);
 }

+ 309 - 0
common-module/src/main/resources/mapper/PreSpecialSendMessageMapper.xml

@@ -0,0 +1,309 @@
+<?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.growth.common.dao.mapper.PreSpecialSendMessageMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="pre_send_date" jdbcType="VARCHAR" property="preSendDate" />
+    <result column="staff_id" jdbcType="BIGINT" property="staffId" />
+    <result column="content" jdbcType="VARCHAR" property="content" />
+    <result column="attachment_ids" jdbcType="VARCHAR" property="attachmentIds" />
+    <result column="group_msg_disabled" jdbcType="INTEGER" property="groupMsgDisabled" />
+    <result column="page_num" jdbcType="INTEGER" property="pageNum" />
+    <result column="page_size" jdbcType="INTEGER" property="pageSize" />
+    <result column="tag_id" jdbcType="BIGINT" property="tagId" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+  </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, pre_send_date, staff_id, content, attachment_ids, group_msg_disabled, page_num, 
+    page_size, tag_id, create_time, update_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessageExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from we_com_special_pre_send_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_special_pre_send_message
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from we_com_special_pre_send_message
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessageExample">
+    delete from we_com_special_pre_send_message
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage">
+    insert into we_com_special_pre_send_message (id, pre_send_date, staff_id, 
+      content, attachment_ids, group_msg_disabled, 
+      page_num, page_size, tag_id, 
+      create_time, update_time)
+    values (#{id,jdbcType=BIGINT}, #{preSendDate,jdbcType=VARCHAR}, #{staffId,jdbcType=BIGINT}, 
+      #{content,jdbcType=VARCHAR}, #{attachmentIds,jdbcType=VARCHAR}, #{groupMsgDisabled,jdbcType=INTEGER}, 
+      #{pageNum,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}, #{tagId,jdbcType=BIGINT}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage">
+    insert into we_com_special_pre_send_message
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="preSendDate != null">
+        pre_send_date,
+      </if>
+      <if test="staffId != null">
+        staff_id,
+      </if>
+      <if test="content != null">
+        content,
+      </if>
+      <if test="attachmentIds != null">
+        attachment_ids,
+      </if>
+      <if test="groupMsgDisabled != null">
+        group_msg_disabled,
+      </if>
+      <if test="pageNum != null">
+        page_num,
+      </if>
+      <if test="pageSize != null">
+        page_size,
+      </if>
+      <if test="tagId != null">
+        tag_id,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="preSendDate != null">
+        #{preSendDate,jdbcType=VARCHAR},
+      </if>
+      <if test="staffId != null">
+        #{staffId,jdbcType=BIGINT},
+      </if>
+      <if test="content != null">
+        #{content,jdbcType=VARCHAR},
+      </if>
+      <if test="attachmentIds != null">
+        #{attachmentIds,jdbcType=VARCHAR},
+      </if>
+      <if test="groupMsgDisabled != null">
+        #{groupMsgDisabled,jdbcType=INTEGER},
+      </if>
+      <if test="pageNum != null">
+        #{pageNum,jdbcType=INTEGER},
+      </if>
+      <if test="pageSize != null">
+        #{pageSize,jdbcType=INTEGER},
+      </if>
+      <if test="tagId != null">
+        #{tagId,jdbcType=BIGINT},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessageExample" resultType="java.lang.Long">
+    select count(*) from we_com_special_pre_send_message
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update we_com_special_pre_send_message
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.preSendDate != null">
+        pre_send_date = #{record.preSendDate,jdbcType=VARCHAR},
+      </if>
+      <if test="record.staffId != null">
+        staff_id = #{record.staffId,jdbcType=BIGINT},
+      </if>
+      <if test="record.content != null">
+        content = #{record.content,jdbcType=VARCHAR},
+      </if>
+      <if test="record.attachmentIds != null">
+        attachment_ids = #{record.attachmentIds,jdbcType=VARCHAR},
+      </if>
+      <if test="record.groupMsgDisabled != null">
+        group_msg_disabled = #{record.groupMsgDisabled,jdbcType=INTEGER},
+      </if>
+      <if test="record.pageNum != null">
+        page_num = #{record.pageNum,jdbcType=INTEGER},
+      </if>
+      <if test="record.pageSize != null">
+        page_size = #{record.pageSize,jdbcType=INTEGER},
+      </if>
+      <if test="record.tagId != null">
+        tag_id = #{record.tagId,jdbcType=BIGINT},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updateTime != null">
+        update_time = #{record.updateTime,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_special_pre_send_message
+    set id = #{record.id,jdbcType=BIGINT},
+      pre_send_date = #{record.preSendDate,jdbcType=VARCHAR},
+      staff_id = #{record.staffId,jdbcType=BIGINT},
+      content = #{record.content,jdbcType=VARCHAR},
+      attachment_ids = #{record.attachmentIds,jdbcType=VARCHAR},
+      group_msg_disabled = #{record.groupMsgDisabled,jdbcType=INTEGER},
+      page_num = #{record.pageNum,jdbcType=INTEGER},
+      page_size = #{record.pageSize,jdbcType=INTEGER},
+      tag_id = #{record.tagId,jdbcType=BIGINT},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage">
+    update we_com_special_pre_send_message
+    <set>
+      <if test="preSendDate != null">
+        pre_send_date = #{preSendDate,jdbcType=VARCHAR},
+      </if>
+      <if test="staffId != null">
+        staff_id = #{staffId,jdbcType=BIGINT},
+      </if>
+      <if test="content != null">
+        content = #{content,jdbcType=VARCHAR},
+      </if>
+      <if test="attachmentIds != null">
+        attachment_ids = #{attachmentIds,jdbcType=VARCHAR},
+      </if>
+      <if test="groupMsgDisabled != null">
+        group_msg_disabled = #{groupMsgDisabled,jdbcType=INTEGER},
+      </if>
+      <if test="pageNum != null">
+        page_num = #{pageNum,jdbcType=INTEGER},
+      </if>
+      <if test="pageSize != null">
+        page_size = #{pageSize,jdbcType=INTEGER},
+      </if>
+      <if test="tagId != null">
+        tag_id = #{tagId,jdbcType=BIGINT},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage">
+    update we_com_special_pre_send_message
+    set pre_send_date = #{preSendDate,jdbcType=VARCHAR},
+      staff_id = #{staffId,jdbcType=BIGINT},
+      content = #{content,jdbcType=VARCHAR},
+      attachment_ids = #{attachmentIds,jdbcType=VARCHAR},
+      group_msg_disabled = #{groupMsgDisabled,jdbcType=INTEGER},
+      page_num = #{pageNum,jdbcType=INTEGER},
+      page_size = #{pageSize,jdbcType=INTEGER},
+      tag_id = #{tagId,jdbcType=BIGINT},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

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

@@ -309,14 +309,10 @@
     <select id="selectExternalUserId" resultType="java.lang.String">
         select t2.external_user_id
         from we_com_special_send_message t1
-                 left join we_com_user t2 on t1.user_id = t2.id
+        left join we_com_user t2 on t1.user_id = t2.id
         where t1.staff_id = #{staffId,jdbcType=BIGINT}
-          and t1.group = #{group,jdbcType=INTEGER}
-          and t1.pre_send_date = #{preSendDate,jdbcType=VARCHAR}
-          and t1.is_send = 0
-          and t2.id not in (select t2.id
-                            from we_com_user_with_tag t1
-                                     join we_com_user t2
-                                          on t1.user_id = t2.id and t1.tag_id in (1, 2, 8, 9, 10))
+        and t1.group = #{group,jdbcType=INTEGER}
+        and t1.pre_send_date = #{preSendDate,jdbcType=VARCHAR}
+        and t1.is_send = 0
     </select>
 </mapper>

+ 404 - 412
common-module/src/main/resources/mapper/WeComUserMapper.xml

@@ -1,397 +1,405 @@
 <?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.growth.common.dao.mapper.WeComUserMapper">
-  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
-    <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId" />
-    <result column="union_id" jdbcType="VARCHAR" property="unionId" />
-    <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty" />
-    <result column="type" jdbcType="INTEGER" property="type" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
-    <result column="gender" jdbcType="INTEGER" property="gender" />
-    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
-    <result column="group_msg_disabled" jdbcType="TINYINT" property="groupMsgDisabled" />
-    <result column="created_at" jdbcType="BIGINT" property="createdAt" />
-    <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
-    <result column="deleted_at" jdbcType="BIGINT" property="deletedAt" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-  </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>
+    <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="corp_id" jdbcType="BIGINT" property="corpId"/>
+        <result column="external_user_id" jdbcType="VARCHAR" property="externalUserId"/>
+        <result column="union_id" jdbcType="VARCHAR" property="unionId"/>
+        <result column="external_user_id_3rd_party" jdbcType="VARCHAR" property="externalUserId3rdParty"/>
+        <result column="type" jdbcType="INTEGER" property="type"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="avatar" jdbcType="VARCHAR" property="avatar"/>
+        <result column="gender" jdbcType="INTEGER" property="gender"/>
+        <result column="is_delete" jdbcType="INTEGER" property="isDelete"/>
+        <result column="group_msg_disabled" jdbcType="TINYINT" property="groupMsgDisabled"/>
+        <result column="created_at" jdbcType="BIGINT" property="createdAt"/>
+        <result column="updated_at" jdbcType="BIGINT" property="updatedAt"/>
+        <result column="deleted_at" jdbcType="BIGINT" property="deletedAt"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+    </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>
-          </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>
+        </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>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    id, corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`, 
+        </where>
+    </sql>
+    <sql id="Base_Column_List">
+        id
+        , corp_id, external_user_id, union_id, external_user_id_3rd_party, `type`, `name`,
     avatar, gender, is_delete, group_msg_disabled, created_at, updated_at, deleted_at, 
     create_time, update_time
-  </sql>
-  <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultMap="BaseResultMap">
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from we_com_user
-    <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_user
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from we_com_user
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample">
-    delete from we_com_user
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
-    insert into we_com_user (id, corp_id, external_user_id, 
-      union_id, external_user_id_3rd_party, `type`, 
-      `name`, avatar, gender, 
-      is_delete, group_msg_disabled, created_at, 
-      updated_at, deleted_at, create_time, 
-      update_time)
-    values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, 
-      #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, 
-      #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, 
-      #{isDelete,jdbcType=INTEGER}, #{groupMsgDisabled,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT}, 
-      #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateTime,jdbcType=TIMESTAMP})
-    <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-      select LAST_INSERT_ID()
-    </selectKey>
-  </insert>
-  <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true" keyProperty="id">
-      insert into we_com_user
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-          <if test="id != null">
-              id,
-          </if>
-          <if test="corpId != null">
-              corp_id,
-          </if>
-          <if test="externalUserId != null">
-              external_user_id,
-          </if>
-          <if test="unionId != null">
-              union_id,
-          </if>
-          <if test="externalUserId3rdParty != null">
-              external_user_id_3rd_party,
-          </if>
-          <if test="type != null">
-              `type`,
-          </if>
-          <if test="name != null">
-              `name`,
-          </if>
-          <if test="avatar != null">
-              avatar,
-          </if>
-          <if test="gender != null">
-              gender,
-          </if>
-          <if test="isDelete != null">
-              is_delete,
-          </if>
-          <if test="groupMsgDisabled != null">
-              group_msg_disabled,
-          </if>
-          <if test="createdAt != null">
-              created_at,
-          </if>
-          <if test="updatedAt != null">
-              updated_at,
-          </if>
-          <if test="deletedAt != null">
-              deleted_at,
-          </if>
-          <if test="createTime != null">
-              create_time,
-          </if>
-          <if test="updateTime != null">
-              update_time,
-          </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides=",">
-          <if test="id != null">
-              #{id,jdbcType=BIGINT},
-          </if>
-          <if test="corpId != null">
-              #{corpId,jdbcType=BIGINT},
-          </if>
-          <if test="externalUserId != null">
-              #{externalUserId,jdbcType=VARCHAR},
-          </if>
-          <if test="unionId != null">
-              #{unionId,jdbcType=VARCHAR},
-          </if>
-          <if test="externalUserId3rdParty != null">
-              #{externalUserId3rdParty,jdbcType=VARCHAR},
-          </if>
-          <if test="type != null">
-              #{type,jdbcType=INTEGER},
-          </if>
-          <if test="name != null">
-              #{name,jdbcType=VARCHAR},
-          </if>
-          <if test="avatar != null">
-              #{avatar,jdbcType=VARCHAR},
-          </if>
-          <if test="gender != null">
-              #{gender,jdbcType=INTEGER},
-          </if>
-          <if test="isDelete != null">
-              #{isDelete,jdbcType=INTEGER},
-          </if>
-          <if test="groupMsgDisabled != null">
-              #{groupMsgDisabled,jdbcType=TINYINT},
-          </if>
-          <if test="createdAt != null">
-              #{createdAt,jdbcType=BIGINT},
-          </if>
-          <if test="updatedAt != null">
-              #{updatedAt,jdbcType=BIGINT},
-          </if>
-          <if test="deletedAt != null">
-              #{deletedAt,jdbcType=BIGINT},
-          </if>
-          <if test="createTime != null">
-              #{createTime,jdbcType=TIMESTAMP},
-          </if>
-          <if test="updateTime != null">
-              #{updateTime,jdbcType=TIMESTAMP},
-          </if>
-      </trim>
-      <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
-          select LAST_INSERT_ID()
-      </selectKey>
-  </insert>
-  <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample" resultType="java.lang.Long">
-    select count(*) from we_com_user
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    update we_com_user
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=BIGINT},
-      </if>
-      <if test="record.corpId != null">
+    </sql>
+    <select id="selectByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample"
+            resultMap="BaseResultMap">
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        <include refid="Base_Column_List"/>
+        from we_com_user
+        <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_user
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete
+        from we_com_user
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <delete id="deleteByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample">
+        delete from we_com_user
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </delete>
+    <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into we_com_user (id, corp_id, external_user_id,
+        union_id, external_user_id_3rd_party, `type`,
+        `name`, avatar, gender,
+        is_delete, group_msg_disabled, created_at,
+        updated_at, deleted_at, create_time,
+        update_time)
+        values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR},
+        #{unionId,jdbcType=VARCHAR}, #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
+        #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
+        #{isDelete,jdbcType=INTEGER}, #{groupMsgDisabled,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT},
+        #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
+        #{updateTime,jdbcType=TIMESTAMP})
+        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+            select LAST_INSERT_ID()
+        </selectKey>
+    </insert>
+    <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into we_com_user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="corpId != null">
+                corp_id,
+            </if>
+            <if test="externalUserId != null">
+                external_user_id,
+            </if>
+            <if test="unionId != null">
+                union_id,
+            </if>
+            <if test="externalUserId3rdParty != null">
+                external_user_id_3rd_party,
+            </if>
+            <if test="type != null">
+                `type`,
+            </if>
+            <if test="name != null">
+                `name`,
+            </if>
+            <if test="avatar != null">
+                avatar,
+            </if>
+            <if test="gender != null">
+                gender,
+            </if>
+            <if test="isDelete != null">
+                is_delete,
+            </if>
+            <if test="groupMsgDisabled != null">
+                group_msg_disabled,
+            </if>
+            <if test="createdAt != null">
+                created_at,
+            </if>
+            <if test="updatedAt != null">
+                updated_at,
+            </if>
+            <if test="deletedAt != null">
+                deleted_at,
+            </if>
+            <if test="createTime != null">
+                create_time,
+            </if>
+            <if test="updateTime != null">
+                update_time,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="corpId != null">
+                #{corpId,jdbcType=BIGINT},
+            </if>
+            <if test="externalUserId != null">
+                #{externalUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="unionId != null">
+                #{unionId,jdbcType=VARCHAR},
+            </if>
+            <if test="externalUserId3rdParty != null">
+                #{externalUserId3rdParty,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="avatar != null">
+                #{avatar,jdbcType=VARCHAR},
+            </if>
+            <if test="gender != null">
+                #{gender,jdbcType=INTEGER},
+            </if>
+            <if test="isDelete != null">
+                #{isDelete,jdbcType=INTEGER},
+            </if>
+            <if test="groupMsgDisabled != null">
+                #{groupMsgDisabled,jdbcType=TINYINT},
+            </if>
+            <if test="createdAt != null">
+                #{createdAt,jdbcType=BIGINT},
+            </if>
+            <if test="updatedAt != null">
+                #{updatedAt,jdbcType=BIGINT},
+            </if>
+            <if test="deletedAt != null">
+                #{deletedAt,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+            select LAST_INSERT_ID()
+        </selectKey>
+    </insert>
+    <select id="countByExample" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUserExample"
+            resultType="java.lang.Long">
+        select count(*) from we_com_user
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </select>
+    <update id="updateByExampleSelective" parameterType="map">
+        update we_com_user
+        <set>
+            <if test="record.id != null">
+                id = #{record.id,jdbcType=BIGINT},
+            </if>
+            <if test="record.corpId != null">
+                corp_id = #{record.corpId,jdbcType=BIGINT},
+            </if>
+            <if test="record.externalUserId != null">
+                external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="record.unionId != null">
+                union_id = #{record.unionId,jdbcType=VARCHAR},
+            </if>
+            <if test="record.externalUserId3rdParty != null">
+                external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
+            </if>
+            <if test="record.type != null">
+                `type` = #{record.type,jdbcType=INTEGER},
+            </if>
+            <if test="record.name != null">
+                `name` = #{record.name,jdbcType=VARCHAR},
+            </if>
+            <if test="record.avatar != null">
+                avatar = #{record.avatar,jdbcType=VARCHAR},
+            </if>
+            <if test="record.gender != null">
+                gender = #{record.gender,jdbcType=INTEGER},
+            </if>
+            <if test="record.isDelete != null">
+                is_delete = #{record.isDelete,jdbcType=INTEGER},
+            </if>
+            <if test="record.groupMsgDisabled != null">
+                group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
+            </if>
+            <if test="record.createdAt != null">
+                created_at = #{record.createdAt,jdbcType=BIGINT},
+            </if>
+            <if test="record.updatedAt != null">
+                updated_at = #{record.updatedAt,jdbcType=BIGINT},
+            </if>
+            <if test="record.deletedAt != null">
+                deleted_at = #{record.deletedAt,jdbcType=BIGINT},
+            </if>
+            <if test="record.createTime != null">
+                create_time = #{record.createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="record.updateTime != null">
+                update_time = #{record.updateTime,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_user
+        set id = #{record.id,jdbcType=BIGINT},
         corp_id = #{record.corpId,jdbcType=BIGINT},
-      </if>
-      <if test="record.externalUserId != null">
         external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.unionId != null">
         union_id = #{record.unionId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.externalUserId3rdParty != null">
         external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
-      </if>
-      <if test="record.type != null">
         `type` = #{record.type,jdbcType=INTEGER},
-      </if>
-      <if test="record.name != null">
         `name` = #{record.name,jdbcType=VARCHAR},
-      </if>
-      <if test="record.avatar != null">
         avatar = #{record.avatar,jdbcType=VARCHAR},
-      </if>
-      <if test="record.gender != null">
         gender = #{record.gender,jdbcType=INTEGER},
-      </if>
-      <if test="record.isDelete != null">
         is_delete = #{record.isDelete,jdbcType=INTEGER},
-      </if>
-      <if test="record.groupMsgDisabled != null">
         group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
-      </if>
-      <if test="record.createdAt != null">
         created_at = #{record.createdAt,jdbcType=BIGINT},
-      </if>
-      <if test="record.updatedAt != null">
         updated_at = #{record.updatedAt,jdbcType=BIGINT},
-      </if>
-      <if test="record.deletedAt != null">
         deleted_at = #{record.deletedAt,jdbcType=BIGINT},
-      </if>
-      <if test="record.createTime != null">
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.updateTime != null">
-        update_time = #{record.updateTime,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_user
-    set id = #{record.id,jdbcType=BIGINT},
-      corp_id = #{record.corpId,jdbcType=BIGINT},
-      external_user_id = #{record.externalUserId,jdbcType=VARCHAR},
-      union_id = #{record.unionId,jdbcType=VARCHAR},
-      external_user_id_3rd_party = #{record.externalUserId3rdParty,jdbcType=VARCHAR},
-      `type` = #{record.type,jdbcType=INTEGER},
-      `name` = #{record.name,jdbcType=VARCHAR},
-      avatar = #{record.avatar,jdbcType=VARCHAR},
-      gender = #{record.gender,jdbcType=INTEGER},
-      is_delete = #{record.isDelete,jdbcType=INTEGER},
-      group_msg_disabled = #{record.groupMsgDisabled,jdbcType=TINYINT},
-      created_at = #{record.createdAt,jdbcType=BIGINT},
-      updated_at = #{record.updatedAt,jdbcType=BIGINT},
-      deleted_at = #{record.deletedAt,jdbcType=BIGINT},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-    update we_com_user
-    <set>
-      <if test="corpId != null">
-        corp_id = #{corpId,jdbcType=BIGINT},
-      </if>
-      <if test="externalUserId != null">
-        external_user_id = #{externalUserId,jdbcType=VARCHAR},
-      </if>
-      <if test="unionId != null">
-        union_id = #{unionId,jdbcType=VARCHAR},
-      </if>
-      <if test="externalUserId3rdParty != null">
-        external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
-      </if>
-      <if test="type != null">
-        `type` = #{type,jdbcType=INTEGER},
-      </if>
-      <if test="name != null">
-        `name` = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="avatar != null">
-        avatar = #{avatar,jdbcType=VARCHAR},
-      </if>
-      <if test="gender != null">
-        gender = #{gender,jdbcType=INTEGER},
-      </if>
-      <if test="isDelete != null">
-        is_delete = #{isDelete,jdbcType=INTEGER},
-      </if>
-      <if test="groupMsgDisabled != null">
-        group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
-      </if>
-      <if test="createdAt != null">
-        created_at = #{createdAt,jdbcType=BIGINT},
-      </if>
-      <if test="updatedAt != null">
-        updated_at = #{updatedAt,jdbcType=BIGINT},
-      </if>
-      <if test="deletedAt != null">
-        deleted_at = #{deletedAt,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-    update we_com_user
-    set corp_id = #{corpId,jdbcType=BIGINT},
-      external_user_id = #{externalUserId,jdbcType=VARCHAR},
-      union_id = #{unionId,jdbcType=VARCHAR},
-      external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
-      `type` = #{type,jdbcType=INTEGER},
-      `name` = #{name,jdbcType=VARCHAR},
-      avatar = #{avatar,jdbcType=VARCHAR},
-      gender = #{gender,jdbcType=INTEGER},
-      is_delete = #{isDelete,jdbcType=INTEGER},
-      group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
-      created_at = #{createdAt,jdbcType=BIGINT},
-      updated_at = #{updatedAt,jdbcType=BIGINT},
-      deleted_at = #{deletedAt,jdbcType=BIGINT},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      update_time = #{updateTime,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP}
+        <if test="_parameter != null">
+            <include refid="Update_By_Example_Where_Clause"/>
+        </if>
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+        update we_com_user
+        <set>
+            <if test="corpId != null">
+                corp_id = #{corpId,jdbcType=BIGINT},
+            </if>
+            <if test="externalUserId != null">
+                external_user_id = #{externalUserId,jdbcType=VARCHAR},
+            </if>
+            <if test="unionId != null">
+                union_id = #{unionId,jdbcType=VARCHAR},
+            </if>
+            <if test="externalUserId3rdParty != null">
+                external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                `type` = #{type,jdbcType=INTEGER},
+            </if>
+            <if test="name != null">
+                `name` = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="avatar != null">
+                avatar = #{avatar,jdbcType=VARCHAR},
+            </if>
+            <if test="gender != null">
+                gender = #{gender,jdbcType=INTEGER},
+            </if>
+            <if test="isDelete != null">
+                is_delete = #{isDelete,jdbcType=INTEGER},
+            </if>
+            <if test="groupMsgDisabled != null">
+                group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT},
+            </if>
+            <if test="createdAt != null">
+                created_at = #{createdAt,jdbcType=BIGINT},
+            </if>
+            <if test="updatedAt != null">
+                updated_at = #{updatedAt,jdbcType=BIGINT},
+            </if>
+            <if test="deletedAt != null">
+                deleted_at = #{deletedAt,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+        update we_com_user
+        set corp_id                    = #{corpId,jdbcType=BIGINT},
+            external_user_id           = #{externalUserId,jdbcType=VARCHAR},
+            union_id                   = #{unionId,jdbcType=VARCHAR},
+            external_user_id_3rd_party = #{externalUserId3rdParty,jdbcType=VARCHAR},
+            `type`                     = #{type,jdbcType=INTEGER},
+            `name`                     = #{name,jdbcType=VARCHAR},
+            avatar                     = #{avatar,jdbcType=VARCHAR},
+            gender                     = #{gender,jdbcType=INTEGER},
+            is_delete                  = #{isDelete,jdbcType=INTEGER},
+            group_msg_disabled         = #{groupMsgDisabled,jdbcType=TINYINT},
+            created_at                 = #{createdAt,jdbcType=BIGINT},
+            updated_at                 = #{updatedAt,jdbcType=BIGINT},
+            deleted_at                 = #{deletedAt,jdbcType=BIGINT},
+            create_time                = #{createTime,jdbcType=TIMESTAMP},
+            update_time                = #{updateTime,jdbcType=TIMESTAMP}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
 
     <select id="selectIdByExternalUserId" parameterType="String" resultType="Long">
         select id
@@ -437,48 +445,32 @@
     </insert>
 
 
-    <select id="selectSendUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        select t2.*
-        from we_com_staff_with_user t1
-                 left join we_com_user t2 on t2.id = t1.user_id
-        where staff_id = #{staffId,jdbcType=BIGINT}
-          and t1.is_delete = 0
-          and t2.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
-          and user_id in (select user_id
-                          from (select user_id, count(*) as num from we_com_staff_with_user group by user_id) c
-                          where c.num = 1)
-          and user_id in (select distinct user_id
-                              from we_com_send_message
-                              where (create_time between '2025-02-27 10:00:00' and '2025-02-27 17:00:00')
-                                 or (create_time between '2025-02-28 10:00:00' and '2025-02-28 17:00:00')
-                                 or (create_time between '2025-03-03 10:00:00' and '2025-03-03 17:00:00')
-                                  and staff_id = #{staffId,jdbcType=BIGINT}) limit #{pageNum}, #{pageSize}
-    </select>
-
-    <select id="selectNotSendUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
-        select t2.*
-        from we_com_staff_with_user t1
-                 left join we_com_user t2 on t2.id = t1.user_id
-        where staff_id = #{staffId,jdbcType=BIGINT}
-          and t1.is_delete = 0
-          and t2.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
-          and user_id in (select user_id
-                          from (select user_id, count(*) as num from we_com_staff_with_user group by user_id) c
-                          where c.num = 1)
-          and user_id not in (select distinct user_id
-                              from we_com_send_message
-                              where (create_time between '2025-02-27 10:00:00' and '2025-02-27 17:00:00')
-                                 or (create_time between '2025-02-28 10:00:00' and '2025-02-28 17:00:00')
-                                 or (create_time between '2025-03-03 10:00:00' and '2025-03-03 17:00:00')
-                                  and staff_id = #{staffId,jdbcType=BIGINT}) limit #{pageNum}, #{pageSize}
-    </select>
-
     <select id="selectUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
         select t1.*
         from we_com_user t1
-                 left join we_com_staff_with_user t2 on t1.id = t2.user_id
+        left join we_com_staff_with_user t2 on t1.id = t2.user_id
         where t1.group_msg_disabled = #{groupMsgDisabled,jdbcType=TINYINT}
-          and t2.staff_id = #{staffId,jdbcType=BIGINT} and t2.is_delete = 0
-            limit #{pageNum}, #{pageSize}
+        and t2.staff_id = #{staffId,jdbcType=BIGINT}
+        and t2.is_delete = 0
+        <if test="filterTagIdList != null and filterTagIdList.size() > 0">
+            and t1.id not in (
+            select t2.id
+            from we_com_user_with_tag t1
+            join we_com_user t2 on t1.user_id = t2.id
+            where t1.tag_id in
+            <foreach item="item" index="index" collection="filterTagIdList"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
+        limit #{pageNum}, #{pageSize}
+    </select>
+
+    <select id="selectByTagUserList" resultType="com.tzld.piaoquan.growth.common.model.po.WeComUser">
+        select t1.*
+        from we_com_user t1
+                 join we_com_user_with_tag t2 on t1.id = t2.user_id
+        where t2.tag_id = #{tagId,jdbcType=BIGINT}
     </select>
 </mapper>

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

@@ -15,6 +15,7 @@ import com.tzld.piaoquan.growth.common.model.po.*;
 import com.tzld.piaoquan.growth.common.model.vo.GuaranteedParam;
 import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.service.MessageService;
+import com.tzld.piaoquan.growth.common.service.WeComUserService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
 import com.tzld.piaoquan.growth.common.utils.OdpsUtil;
@@ -67,6 +68,9 @@ public class WeComMessageDataJob {
     @Autowired
     private CorpMapper corpMapper;
 
+    @Autowired
+    private WeComUserService weComUserService;
+
     //发送小程序标题限制字节数
     private static final int MAX_BYTES = 64;
 
@@ -236,6 +240,7 @@ public class WeComMessageDataJob {
             staffIds.addAll(xxlJobParam.getStaffIds());
         }
         init(staffIds);
+        List<Long> filterUserId = weComUserService.getFilterTagUserId();
         for (Corp corp : corps) {
             WeComUserExample weComUserExample = new WeComUserExample();
             WeComUserExample.Criteria criteria = weComUserExample.createCriteria().andExternalUserIdIsNotNull().andCorpIdEqualTo(corp.getId())
@@ -253,9 +258,12 @@ public class WeComMessageDataJob {
                 if (CollectionUtils.isEmpty(weComUserList)) {
                     continue;
                 }
+                //过滤用户
+                List<WeComUser> filtered = weComUserList.stream()
+                        .filter(e -> filterUserId.contains(e.getId())).collect(Collectors.toList());
                 //落库逻辑
                 List<SendMessage> allSeneMessageList = new ArrayList<>();
-                for (WeComUser weComUser : weComUserList) {
+                for (WeComUser weComUser : filtered) {
                     List<SendMessage> sendMessageList = getSendMessage(weComUser, staffIds, corp.getId());
                     if (CollectionUtils.isEmpty(sendMessageList)) {
                         continue;

+ 71 - 8
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComSpecialDataJob.java

@@ -6,12 +6,14 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.tzld.piaoquan.growth.common.common.constant.MessageConstant;
 import com.tzld.piaoquan.growth.common.common.enums.MessageAttachmentTypeEnum;
+import com.tzld.piaoquan.growth.common.dao.mapper.PreSpecialSendMessageMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.SpecialSendMessageMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.StaffMapper;
 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.service.WeComUserService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.ToolUtils;
 import com.xxl.job.core.biz.model.ReturnT;
@@ -25,6 +27,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 
 @Component
@@ -45,28 +48,89 @@ public class WeComSpecialDataJob {
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
+    @Autowired
+    private WeComUserService weComUserService;
+
+    @Autowired
+    private PreSpecialSendMessageMapper preSpecialSendMessageMapper;
+
     //发送小程序标题限制字节数
     private static final int MAX_BYTES = 64;
 
+    @XxlJob("sendSpecialPushMessageJob")
+    public ReturnT<String> getAndAddSpecialAssembleSendMessage(String param) {
+        String thatDayDateString = DateUtil.getThatDayDateString();
+        PreSpecialSendMessageExample example = new PreSpecialSendMessageExample();
+        example.createCriteria().andPreSendDateEqualTo(thatDayDateString);
+        List<PreSpecialSendMessage> preSpecialSendMessages = preSpecialSendMessageMapper.selectByExample(example);
+        List<PreSpecialSendMessage> notHasTagPreSpecialSendMessage = preSpecialSendMessages.stream().filter(e -> e.getTagId() == null).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(notHasTagPreSpecialSendMessage)) {
+            for (PreSpecialSendMessage preSpecialSendMessage : notHasTagPreSpecialSendMessage) {
+                notHasTagSpecialAssembleSendMessage(preSpecialSendMessage.getId(), preSpecialSendMessage.getStaffId(),
+                        preSpecialSendMessage.getPageNum(), preSpecialSendMessage.getPageSize(),
+                        preSpecialSendMessage.getGroupMsgDisabled().byteValue(), preSpecialSendMessage.getAttachmentIds(),
+                        preSpecialSendMessage.getContent(), preSpecialSendMessage.getPreSendDate());
+            }
+        }
+        List<PreSpecialSendMessage> hasTagPreSpecialSendMessage = preSpecialSendMessages.stream().filter(e -> e.getTagId() != null).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(hasTagPreSpecialSendMessage)) {
+            for (PreSpecialSendMessage preSpecialSendMessage : hasTagPreSpecialSendMessage) {
+                hasTagSpecialAssembleSendMessage(preSpecialSendMessage.getId(), preSpecialSendMessage.getStaffId(), preSpecialSendMessage.getAttachmentIds(),
+                        preSpecialSendMessage.getContent(), preSpecialSendMessage.getPreSendDate(), preSpecialSendMessage.getTagId());
+            }
+        }
+        //发送拼装好的消息
+        sendSpecialPushMessage();
+        return ReturnT.SUCCESS;
+    }
+
 
-    public void specialAssembleSendMessage(Long staffId, Integer pageNum, Integer pageSize,
-                                           byte groupMsgDisabled, List<Long> attachmentIds, String content, String date) {
-        List<WeComUser> weComUserList = weComUserMapper.selectUserList(staffId, groupMsgDisabled, (pageNum - 1) * pageSize, pageSize);
+    public void notHasTagSpecialAssembleSendMessage(Long preId, Long staffId, Integer pageNum, Integer pageSize,
+                                                    byte groupMsgDisabled, String attachmentIds, String content, String date) {
+        List<Long> filterTagId = weComUserService.getFilterTagId();
+        List<WeComUser> weComUserList = weComUserMapper.selectUserList(staffId, groupMsgDisabled, filterTagId, (pageNum - 1) * pageSize, pageSize);
         //落库逻辑
         for (WeComUser weComUser : weComUserList) {
             SpecialSendMessage specialSendMessage = new SpecialSendMessage();
             specialSendMessage.setStaffId(staffId);
             specialSendMessage.setUserId(weComUser.getId());
-            specialSendMessage.setGroup(pageNum);
-            specialSendMessage.setAttachmentIds(JSONObject.toJSONString(attachmentIds));
+            specialSendMessage.setGroup(preId.intValue());
+            specialSendMessage.setAttachmentIds(attachmentIds);
             specialSendMessage.setContent(content);
             specialSendMessage.setPreSendDate(date);
             specialSendMessageMapper.insertSelective(specialSendMessage);
         }
     }
 
-    @XxlJob("sendSpecialPushMessageJob")
-    public ReturnT<String> sendSpecialPushMessage(String param) {
+    public void hasTagSpecialAssembleSendMessage(Long preId, Long staffId, String attachmentIds, String content, String date, Long tagId) {
+        List<WeComUser> weComUsers = weComUserMapper.selectByTagUserList(tagId);
+        if (CollectionUtils.isEmpty(weComUsers)) {
+            return;
+        }
+        for (WeComUser weComUser : weComUsers) {
+            List<Staff> staffs = weComUserService.getStaffByUserId(weComUser.getId());
+            if (CollectionUtils.isEmpty(staffs)) {
+                continue;
+            }
+            for (Staff staff : staffs) {
+                if (staffId != null && !Objects.equals(staff.getId(), staffId)) {
+                    continue;
+                }
+                SpecialSendMessage specialSendMessage = new SpecialSendMessage();
+                specialSendMessage.setStaffId(staff.getId());
+                specialSendMessage.setUserId(weComUser.getId());
+                specialSendMessage.setGroup(preId.intValue());
+                specialSendMessage.setAttachmentIds(attachmentIds);
+                specialSendMessage.setContent(content);
+                specialSendMessage.setPreSendDate(date);
+                specialSendMessageMapper.insertSelective(specialSendMessage);
+            }
+
+        }
+    }
+
+
+    public void sendSpecialPushMessage() {
         String thatDayDateString = DateUtil.getThatDayDateString();
         List<SpecialSendMessage> groupList = specialSendMessageMapper.getGroupList(thatDayDateString);
         for (SpecialSendMessage specialSendMessage : groupList) {
@@ -88,7 +152,6 @@ public class WeComSpecialDataJob {
                 specialSendMessageMapper.updateByExampleSelective(updateSpecialSendMessage, example);
             }
         }
-        return ReturnT.SUCCESS;
     }
 
     private boolean specialPushMessage(List<String> sendUserList, SpecialSendMessage specialSendMessage) {

+ 9 - 3
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

@@ -344,8 +344,15 @@ public class WeComUserDataJob {
                 StaffExample staffExample = new StaffExample();
                 StaffExample.Criteria staffCriteria = staffExample.createCriteria();
                 staffCriteria.andCorpIdEqualTo(corp.getId());
+                List<Long> staffIds = new ArrayList<>();
                 if (xxlJobParam.getStaffId() != null) {
-                    staffCriteria.andIdEqualTo(xxlJobParam.getStaffId());
+                    staffIds.add(xxlJobParam.getStaffId());
+                }
+                if(!CollectionUtils.isEmpty(xxlJobParam.getStaffIds())){
+                    staffIds.addAll(xxlJobParam.getStaffIds());
+                }
+                if(!CollectionUtils.isEmpty(staffIds)){
+                    staffCriteria.andIdIn(staffIds);
                 }
                 List<Staff> staffList = staffMapper.selectByExample(staffExample);
                 for (Staff staff : staffList) {
@@ -391,8 +398,7 @@ public class WeComUserDataJob {
                 }
             }
         } catch (Exception e) {
-//            LarkRobotUtil.sendMessage("insertStaffWithUserJob error" + e);
-            log.error("insertStaffWithUserJob error", e);
+            log.error("getUserTag error", e);
         }
 
         return ReturnT.SUCCESS;