瀏覽代碼

fix: 邮件解析详情整改,优化文件ID相同导致数据不一致的情况

chenjianhua 4 月之前
父節點
當前提交
abefbbda17

+ 4 - 2
service-base/src/main/java/com/simuwang/base/mapper/daq/EmailFundNavCollectionMapper.java

@@ -17,11 +17,13 @@ import java.util.Map;
  */
 @Mapper
 public interface EmailFundNavCollectionMapper {
-     Long countByFileId(@Param("fileId") Integer fileId);
+     Long countByFileId(@Param("fileId") Integer fileId,@Param("emailId") Integer emailId);
 
      void batchInsert(@Param("itemDoList") List<EmailFundNavCollectionDO> emailFundNavCollectionVOList);
 
-     List<EmailFundNavCollectionDO> selectEmailFundNavCollectionDOByFileId(EmailFileQuery emailFileQuery);
+     List<EmailFundNavCollectionDO> selectEmailFundNavCollectionDOByEmailFileId(EmailFileQuery emailFileQuery);
 
      Long countDataByExceptionStatus(@Param("item") DataboardQuery databoardQuery,@Param("exceptionStatus") Integer exceptionStatus);
+
+     void delete(@Param("fileId") Integer fileId,@Param("emailId") Integer emailId);
 }

+ 5 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/EmailFundNavCollectionDO.java

@@ -14,6 +14,10 @@ public class EmailFundNavCollectionDO {
      */
     private Integer id;
     /**
+     * 邮件ID
+     */
+    private Integer emailId;
+    /**
      * 附件ID
      */
     private Integer fileId;
@@ -115,6 +119,7 @@ public class EmailFundNavCollectionDO {
     public EmailFundNavCollectionVO toVO() {
         EmailFundNavCollectionVO vo = new EmailFundNavCollectionVO();
         vo.setFileId(fileId);
+        vo.setEmailId(emailId);
         vo.setId(id);
         vo.setFundName(getFundName());
         vo.setAssetNet(getAssetNet());

+ 12 - 0
service-base/src/main/java/com/simuwang/base/pojo/dto/query/EmailFileQuery.java

@@ -14,6 +14,10 @@ public class EmailFileQuery extends PageQuery {
      * 附件ID
      */
     private Integer fileId;
+    /**
+     * 邮件ID
+     */
+    private Integer emailId;
 
     public Integer getFileId() {
         return fileId;
@@ -22,4 +26,12 @@ public class EmailFileQuery extends PageQuery {
     public void setFileId(Integer fileId) {
         this.fileId = fileId;
     }
+
+    public Integer getEmailId() {
+        return emailId;
+    }
+
+    public void setEmailId(Integer emailId) {
+        this.emailId = emailId;
+    }
 }

+ 4 - 0
service-base/src/main/java/com/simuwang/base/pojo/vo/EmailFundNavCollectionVO.java

@@ -12,6 +12,10 @@ public class EmailFundNavCollectionVO {
      */
     private Integer id;
     /**
+     * 邮件ID
+     */
+    private Integer emailId;
+    /**
      * 附件ID
      */
     private Integer fileId;

+ 8 - 8
service-base/src/main/resources/mapper/daq/EmailFundNavCollectionMapper.xml

@@ -3,6 +3,7 @@
 <mapper namespace="com.simuwang.base.mapper.daq.EmailFundNavCollectionMapper">
     <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFundNavCollectionDO">
         <id column="id" property="id"/>
+        <result column="email_id" property="emailId"/>
         <result column="file_id" property="fileId"/>
         <result column="fund_name" property="fundName"/>
         <result column="register_number" property="registerNumber"/>
@@ -22,26 +23,26 @@
     </resultMap>
 
     <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundNavDO">
-        insert into email_fund_nav_collection(file_id, fund_name,register_number,price_date,
+        insert into email_fund_nav_collection(email_id,file_id, fund_name,register_number,price_date,
                                               nav,cumulative_nav_withdrawal,exception_status,template_id,
                                               isvalid, creatorid, createtime, updaterid, updatetime,asset_net,asset_share,parse_date,email,sender_email,email_date)
         values
         <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
-            (#{itemDo.fileId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},
+            (#{itemDo.emailId},#{itemDo.fileId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},
              #{itemDo.nav},#{itemDo.cumulativeNavWithdrawal},#{itemDo.exceptionStatus},#{itemDo.templateId},
              #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime},
              #{itemDo.assetNet}, #{itemDo.assetShare}, #{itemDo.parseDate}, #{itemDo.email}, #{itemDo.senderEmail}, #{itemDo.emailDate})
         </foreach>
     </insert>
-    <select id="countByFileId" resultType="java.lang.Long" parameterType="java.lang.Integer">
-        select count(*) from email_fund_nav_collection where file_id=#{fileId} and isvalid=1
+    <select id="countByFileId" resultType="java.lang.Long">
+        select count(*) from email_fund_nav_collection where file_id=#{fileId} and isvalid=1 and email_id=#{emailId}
     </select>
-    <select id="selectEmailFundNavCollectionDOByFileId" resultMap="BaseResultMap">
-        select id,file_id, fund_name,register_number,price_date,
+    <select id="selectEmailFundNavCollectionDOByEmailFileId" resultMap="BaseResultMap">
+        select id,email_id,file_id, fund_name,register_number,price_date,
                nav,cumulative_nav_withdrawal,exception_status,template_id,
                isvalid, creatorid, createtime, updaterid, updatetime,asset_net,
                asset_share,parse_date,email,sender_email,email_date
-        from email_fund_nav_collection where file_id=#{fileId} and isvalid=1
+        from email_fund_nav_collection where file_id=#{fileId} and isvalid=1 and email_id=#{emailId}
         order by price_date desc
         limit #{offset},#{pageSize}
     </select>
@@ -62,6 +63,5 @@
         <if test="exceptionStatus !=null and exceptionStatus !=''">
             and exception_status = #{exceptionStatus}
         </if>
-
     </select>
 </mapper>

+ 2 - 2
service-manage/src/main/java/com/simuwang/manage/service/impl/ParseEmailServiceImpl.java

@@ -140,9 +140,9 @@ public class ParseEmailServiceImpl implements ParseEmailService {
     @Override
     public MybatisPage<EmailFundNavCollectionVO> searchEmailDetailById(EmailFileQuery emailFileQuery) {
         //根据邮件ID获取附件信息
-        List<EmailFundNavCollectionDO> emailFundNavCollectionDOList = emailFundNavCollectionMapper.selectEmailFundNavCollectionDOByFileId(emailFileQuery);
+        List<EmailFundNavCollectionDO> emailFundNavCollectionDOList = emailFundNavCollectionMapper.selectEmailFundNavCollectionDOByEmailFileId(emailFileQuery);
         List<EmailFundNavCollectionVO> result = emailFundNavCollectionDOList.stream().filter(e -> StringUtil.isNotNull(e)).map(EmailFundNavCollectionDO::toVO).collect(Collectors.toList());
-        Long total = emailFundNavCollectionMapper.countByFileId(emailFileQuery.getFileId());
+        Long total = emailFundNavCollectionMapper.countByFileId(emailFileQuery.getFileId(),emailFileQuery.getEmailId());
         return MybatisPage.of(total,result);
     }
 }