소스 검색

增加附件和消息关联表

xueyiming 3 달 전
부모
커밋
d98fe76347

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

@@ -54,9 +54,9 @@
 <!--        <table tableName="gh_detail" domainObjectName="GhDetail" alias=""/>-->
 <!--        <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_message_attachment" domainObjectName="MessageAttachment" alias=""/>-->
         <table tableName="we_com_attachment_with_msg_result" domainObjectName="AttachmentWithMsgResult" alias=""/>
-        <table tableName="we_com_send_msg_result" domainObjectName="SendMsgResult" alias=""/>
+<!--        <table tableName="we_com_send_msg_result" domainObjectName="SendMsgResult" alias=""/>-->
 <!--        <table tableName="we_com_corp" domainObjectName="Corp" alias=""/>-->
 
     </context>

+ 3 - 3
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/AttachmentWithMsgResult.java

@@ -7,7 +7,7 @@ public class AttachmentWithMsgResult {
 
     private Long attachmentId;
 
-    private Integer msgResultId;
+    private Long msgResultId;
 
     private Date createTime;
 
@@ -29,11 +29,11 @@ public class AttachmentWithMsgResult {
         this.attachmentId = attachmentId;
     }
 
-    public Integer getMsgResultId() {
+    public Long getMsgResultId() {
         return msgResultId;
     }
 
-    public void setMsgResultId(Integer msgResultId) {
+    public void setMsgResultId(Long msgResultId) {
         this.msgResultId = msgResultId;
     }
 

+ 10 - 10
common-module/src/main/java/com/tzld/piaoquan/growth/common/model/po/AttachmentWithMsgResultExample.java

@@ -247,52 +247,52 @@ public class AttachmentWithMsgResultExample {
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdEqualTo(Integer value) {
+        public Criteria andMsgResultIdEqualTo(Long value) {
             addCriterion("msg_result_id =", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdNotEqualTo(Integer value) {
+        public Criteria andMsgResultIdNotEqualTo(Long value) {
             addCriterion("msg_result_id <>", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdGreaterThan(Integer value) {
+        public Criteria andMsgResultIdGreaterThan(Long value) {
             addCriterion("msg_result_id >", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdGreaterThanOrEqualTo(Integer value) {
+        public Criteria andMsgResultIdGreaterThanOrEqualTo(Long value) {
             addCriterion("msg_result_id >=", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdLessThan(Integer value) {
+        public Criteria andMsgResultIdLessThan(Long value) {
             addCriterion("msg_result_id <", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdLessThanOrEqualTo(Integer value) {
+        public Criteria andMsgResultIdLessThanOrEqualTo(Long value) {
             addCriterion("msg_result_id <=", value, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdIn(List<Integer> values) {
+        public Criteria andMsgResultIdIn(List<Long> values) {
             addCriterion("msg_result_id in", values, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdNotIn(List<Integer> values) {
+        public Criteria andMsgResultIdNotIn(List<Long> values) {
             addCriterion("msg_result_id not in", values, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdBetween(Integer value1, Integer value2) {
+        public Criteria andMsgResultIdBetween(Long value1, Long value2) {
             addCriterion("msg_result_id between", value1, value2, "msgResultId");
             return (Criteria) this;
         }
 
-        public Criteria andMsgResultIdNotBetween(Integer value1, Integer value2) {
+        public Criteria andMsgResultIdNotBetween(Long value1, Long value2) {
             addCriterion("msg_result_id not between", value1, value2, "msgResultId");
             return (Criteria) this;
         }

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

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.growth.common.model.po;
 
-import com.tzld.piaoquan.common.utils.page.Page;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;

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

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.growth.common.model.po;
 
-import com.tzld.piaoquan.common.utils.page.Page;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;

+ 7 - 7
common-module/src/main/resources/mapper/AttachmentWithMsgResultMapper.xml

@@ -4,7 +4,7 @@
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.growth.common.model.po.AttachmentWithMsgResult">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="attachment_id" jdbcType="BIGINT" property="attachmentId" />
-    <result column="msg_result_id" jdbcType="INTEGER" property="msgResultId" />
+    <result column="msg_result_id" jdbcType="BIGINT" property="msgResultId" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
   </resultMap>
@@ -105,7 +105,7 @@
   <insert id="insert" parameterType="com.tzld.piaoquan.growth.common.model.po.AttachmentWithMsgResult">
     insert into we_com_attachment_with_msg_result (id, attachment_id, msg_result_id, 
       create_time, update_time)
-    values (#{id,jdbcType=BIGINT}, #{attachmentId,jdbcType=BIGINT}, #{msgResultId,jdbcType=INTEGER}, 
+    values (#{id,jdbcType=BIGINT}, #{attachmentId,jdbcType=BIGINT}, #{msgResultId,jdbcType=BIGINT}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.growth.common.model.po.AttachmentWithMsgResult">
@@ -135,7 +135,7 @@
         #{attachmentId,jdbcType=BIGINT},
       </if>
       <if test="msgResultId != null">
-        #{msgResultId,jdbcType=INTEGER},
+        #{msgResultId,jdbcType=BIGINT},
       </if>
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
@@ -161,7 +161,7 @@
         attachment_id = #{record.attachmentId,jdbcType=BIGINT},
       </if>
       <if test="record.msgResultId != null">
-        msg_result_id = #{record.msgResultId,jdbcType=INTEGER},
+        msg_result_id = #{record.msgResultId,jdbcType=BIGINT},
       </if>
       <if test="record.createTime != null">
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
@@ -178,7 +178,7 @@
     update we_com_attachment_with_msg_result
     set id = #{record.id,jdbcType=BIGINT},
       attachment_id = #{record.attachmentId,jdbcType=BIGINT},
-      msg_result_id = #{record.msgResultId,jdbcType=INTEGER},
+      msg_result_id = #{record.msgResultId,jdbcType=BIGINT},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
       update_time = #{record.updateTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
@@ -192,7 +192,7 @@
         attachment_id = #{attachmentId,jdbcType=BIGINT},
       </if>
       <if test="msgResultId != null">
-        msg_result_id = #{msgResultId,jdbcType=INTEGER},
+        msg_result_id = #{msgResultId,jdbcType=BIGINT},
       </if>
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
@@ -206,7 +206,7 @@
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.growth.common.model.po.AttachmentWithMsgResult">
     update we_com_attachment_with_msg_result
     set attachment_id = #{attachmentId,jdbcType=BIGINT},
-      msg_result_id = #{msgResultId,jdbcType=INTEGER},
+      msg_result_id = #{msgResultId,jdbcType=BIGINT},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       update_time = #{updateTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}

+ 11 - 3
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComHistoryDataJob.java

@@ -77,6 +77,9 @@ public class WeComHistoryDataJob {
     @Autowired
     private SendMsgResultMapper sendMsgResultMapper;
 
+    @Autowired
+    private AttachmentWithMsgResultMapper attachmentWithMsgResultMapper;
+
 
     @XxlJob("saveHistoryMessageJob")
     public ReturnT<String> selectHistoryMessageByDay(String param) {
@@ -490,9 +493,14 @@ public class WeComHistoryDataJob {
         }
         for (Long attachmentId : attachmentIds) {
             for (Long sendMsgResultId : sendMsgResultIds) {
-                AttachmentWithMsgResult attachmentWithMsgResult = new AttachmentWithMsgResult();
-
-
+                try {
+                    AttachmentWithMsgResult attachmentWithMsgResult = new AttachmentWithMsgResult();
+                    attachmentWithMsgResult.setAttachmentId(attachmentId);
+                    attachmentWithMsgResult.setMsgResultId(sendMsgResultId);
+                    attachmentWithMsgResultMapper.insertSelective(attachmentWithMsgResult);
+                } catch (Exception e) {
+                    log.error("insert error", e);
+                }
             }
         }
     }