Browse Source

fix: 主页解析异常原因概述优化

chenjianhua 5 months ago
parent
commit
9e09bedb3b

+ 76 - 0
service-base/src/main/java/com/simuwang/base/common/conts/NavParseStatusConst.java

@@ -13,72 +13,148 @@ public class NavParseStatusConst {
     public final static Integer NAV_DEFICIENCY = 2;
 
     /**
+     * 净值缺失
+     */
+    public final static String NAV_DEFICIENCY_TEXT = "净值缺失";
+
+    /**
      * 未匹配基金
      */
     public final static Integer NOT_MATCH = 3;
 
     /**
+     * 未匹配基金
+     */
+    public final static String NOT_MATCH_TEXT = "未匹配基金";
+
+    /**
      * 净值不大于0
      */
     public final static Integer NAV_NEGATIVE = 4;
 
     /**
+     * 净值不大于0
+     */
+    public final static String NAV_NEGATIVE_TEXT = "净值不大于0";
+
+    /**
      * 资产净值不大于0
      */
     public final static Integer ASSET_NET_NEGATIVE = 5;
 
     /**
+     * 资产净值不大于0
+     */
+    public final static String ASSET_NET_NEGATIVE_TEXT = "资产净值不大于0";
+
+    /**
      * 当期(单位净值)与上期(单位净值)振幅大于等于20%
      */
     public final static Integer AMPLITUDE_EXCEPTION = 6;
 
+    /**
+     * 当期(单位净值)与上期(单位净值)振幅大于等于20%
+     */
+    public final static String AMPLITUDE_EXCEPTION_TEXT = "当期(单位净值)与上期(单位净值)振幅大于等于20%";
 
     /**
      * 当期(单位净值)与上期(单位净值)振幅大于等于100%拦截
      */
     public final static Integer AMPLITUDE_ERROR = 7;
 
+
+    /**
+     * 当期(单位净值)与上期(单位净值)振幅大于等于100%拦截
+     */
+    public final static String AMPLITUDE_ERROR_TEXT = "当期(单位净值)与上期(单位净值)振幅大于等于100%拦截";
+
     /**
      * 净值日期不能大于当前日期
      */
     public final static Integer PRICE_DATE_AFTER_NOW = 8;
 
     /**
+     * 净值日期不能大于当前日期
+     */
+    public final static String PRICE_DATE_AFTER_NOW_TEXT = "净值日期不能大于当前日期";
+
+    /**
      * 净值日期不能早于成立日期
      */
     public final static Integer PRICE_DATE_BEFORE_INCEPTION = 9;
 
     /**
+     * 净值日期不能早于成立日期
+     */
+    public final static String PRICE_DATE_BEFORE_INCEPTION_TEXT = "净值日期不能早于成立日期";
+
+
+    /**
      * 净值日期不能晚于清算日期
      */
     public final static Integer PRICE_DATE_AFTER_LIQUIDATE = 10;
 
+
+    /**
+     * 净值日期不能晚于清算日期
+     */
+    public final static String PRICE_DATE_AFTER_LIQUIDATE_TEXT = "净值日期不能晚于清算日期";
+
     /**
      * 净值日期不能是周末(成立日除外)
      */
     public final static Integer PRICE_DATE_NOT_WORK_DAY = 11;
 
     /**
+     * 净值日期不能是周末(成立日除外)
+     */
+    public final static String PRICE_DATE_NOT_WORK_DAY_TEXT = "净值日期不能是周末(成立日除外)";
+
+    /**
      * 净值日期为空
      */
     public final static Integer PRICE_DATE_IS_NULL = 12;
+
+    /**
+     * 净值日期为空
+     */
+    public final static String PRICE_DATE_IS_NULL_TEXT = "净值日期为空";
     /**
      * 净值日期错误
      */
     public final static Integer PRICE_DATE_IS_ERROR = 13;
 
     /**
+     * 净值日期错误
+     */
+    public final static String PRICE_DATE_IS_ERROR_TEXT = "净值日期错误";
+
+    /**
      * 净值规模数据格式有误
      */
     public final static Integer NAV_ASSET_IS_ERROR = 14;
 
     /**
+     * 净值规模数据格式有误
+     */
+    public final static String NAV_ASSET_IS_ERROR_TEXT = "净值规模数据格式有误";
+
+    /**
      * 基金名称和备案编码均缺失
      */
     public final static Integer FUND_NAME_REGISTER_IS_NULL = 15;
 
     /**
+     * 基金名称和备案编码均缺失
+     */
+    public final static String FUND_NAME_REGISTER_IS_NULL_TEXT = "基金名称和备案编码均缺失";
+
+    /**
      * 单位净值和累计净值和资产净值均缺失
      */
     public final static Integer NAV_ASSET_IS_NULL = 16;
+    /**
+     * 单位净值和累计净值和资产净值均缺失
+     */
+    public final static String NAV_ASSET_IS_NULL_TEXT = "单位净值和累计净值和资产净值均缺失";
 }

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

@@ -1,11 +1,13 @@
 package com.simuwang.base.mapper.daq;
 
 import com.simuwang.base.pojo.dos.EmailFundNavCollectionDO;
+import com.simuwang.base.pojo.dto.query.DataboardQuery;
 import com.simuwang.base.pojo.dto.query.EmailFileQuery;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * FileName: EmailFundNavCollectionMapper
@@ -20,4 +22,6 @@ public interface EmailFundNavCollectionMapper {
      void batchInsert(@Param("itemDoList") List<EmailFundNavCollectionDO> emailFundNavCollectionVOList);
 
      List<EmailFundNavCollectionDO> selectEmailFundNavCollectionDOByFileId(EmailFileQuery emailFileQuery);
+
+     Long countDataByExceptionStatus(@Param("item") DataboardQuery databoardQuery,@Param("exceptionStatus") Integer exceptionStatus);
 }

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

@@ -17,6 +17,19 @@ public class EmailFundNavCollectionDO {
      * 附件ID
      */
     private Integer fileId;
+    /**
+     * 收件邮箱地址
+     */
+    private String email;
+    /**
+     * 发件邮箱地址
+     */
+    private String senderEmail;
+
+    /**
+     * 发件邮箱地址
+     */
+    private Date emailDate;
 
     /**
      * 邮件解析的基金名称

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

@@ -24,13 +24,13 @@
     <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundNavDO">
         insert into email_fund_nav_collection(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)
+                                              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.nav},#{itemDo.cumulativeNavWithdrawal},#{itemDo.exceptionStatus},#{itemDo.templateId},
              #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime},
-             #{itemDo.assetNet}, #{itemDo.assetShare}, #{itemDo.parseDate})
+             #{itemDo.assetNet}, #{itemDo.assetShare}, #{itemDo.parseDate}, #{itemDo.email}, #{itemDo.sender_email}, #{itemDo.email_date})
         </foreach>
     </insert>
     <select id="countByFileId" resultType="java.lang.Long" parameterType="java.lang.Integer">
@@ -39,9 +39,29 @@
     <select id="selectEmailFundNavCollectionDOByFileId" resultMap="BaseResultMap">
         select 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
+               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
         order by price_date desc
         limit #{offset},#{pageSize}
     </select>
+    <select id="countDataByExceptionStatus" resultType="java.lang.Long">
+        select count(1) as total from email_fund_nav_collection where  isvalid=1
+        <if test="item.startDate != null  and item.startDate != ''">
+            and email_date >= #{item.startDate}
+        </if>
+        <if test="item.endDate != null and item.endDate != ''">
+            and email_date <![CDATA[ <= ]]> #{item.endDate}
+        </if>
+        <if test="item.email !=null and item.email !=''">
+            and email like concat('%',#{item.email},'%')
+        </if>
+        <if test="item.senderEmail !=null and item.senderEmail !=''">
+            and sender_email like concat('%',#{item.senderEmail},'%')
+        </if>
+        <if test="exceptionStatus !=null and exceptionStatus !=''">
+            and exception_status = #{exceptionStatus}
+        </if>
+
+    </select>
 </mapper>

+ 89 - 22
service-daq/src/main/java/com/simuwang/daq/service/EmailParseService.java

@@ -203,7 +203,7 @@ public class EmailParseService {
             //记录采集表
             if(CollUtil.isNotEmpty(fundNavDTOList)){
                 List<EmailFundNavCollectionDO> emailFundNavCollectionVOList = new ArrayList<>();
-                fundNavDTOList.stream().forEach( e -> emailFundNavCollectionVOList.add(toEmailFundNavCollectionVO(e,fileId,parseDate)));
+                fundNavDTOList.stream().forEach( e -> emailFundNavCollectionVOList.add(toEmailFundNavCollectionVO(e,fileId,parseDate,emailAddress,senderEmail,emailDate)));
                 batchSaveEmailFundNavCollection(emailFundNavCollectionVOList);
             }
             if (CollUtil.isNotEmpty(fundNavDTOList)) {
@@ -283,7 +283,7 @@ public class EmailParseService {
         }
     }
 
-    private EmailFundNavCollectionDO toEmailFundNavCollectionVO(EmailFundNavDTO fundNavDTO, Integer fileId,Date parseDate) {
+    private EmailFundNavCollectionDO toEmailFundNavCollectionVO(EmailFundNavDTO fundNavDTO, Integer fileId,Date parseDate,String email,String senderEmail,String emailDate) {
         EmailFundNavCollectionDO vo = new EmailFundNavCollectionDO();
         vo.setFileId(fileId);
         vo.setFundName(fundNavDTO.getFundName());
@@ -299,6 +299,9 @@ public class EmailParseService {
         vo.setUpdateTime(DateUtils.getNowDate());
         vo.setIsvalid(1);
         vo.setParseDate(parseDate);
+        vo.setEmail(email);
+        vo.setSenderEmail(senderEmail);
+        vo.setEmailDate(DateUtils.parse(emailDate,DateUtils.YYYY_MM_DD_HH_MM_SS));
         return vo;
     }
 
@@ -1123,34 +1126,98 @@ public class EmailParseService {
         EmailParseFailAnalysisVO result = new EmailParseFailAnalysisVO();
         //净值规模
         List<NameValueVO> navNameValueVOS = new ArrayList<>();
-        NameValueVO pdfNoDataVO = new NameValueVO();
+        NameValueVO navAssetIsErrorVO = new NameValueVO();
         databoardQuery.setEmailType(1);
-        Long pdfNoData = emailParseInfoMapper.countpdfNoData(databoardQuery, "无法从PDF文件中获取到数据");
-        pdfNoDataVO.setName("无法从PDF文件中获取到数据");
-        pdfNoDataVO.setValue(pdfNoData);
-        navNameValueVOS.add(pdfNoDataVO);
+        Long navAssetIsError = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.NAV_ASSET_IS_ERROR);
+        navAssetIsErrorVO.setName(NavParseStatusConst.NAV_ASSET_IS_ERROR_TEXT);
+        navAssetIsErrorVO.setValue(navAssetIsError);
+        navNameValueVOS.add(navAssetIsErrorVO);
+
         NameValueVO priceDateMissVO = new NameValueVO();
-        Long priceDateMiss = emailParseInfoMapper.countpdfNoData(databoardQuery, "缺少净值日期");
+        Long priceDateMiss = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_IS_NULL);
         priceDateMissVO.setValue(priceDateMiss);
-        priceDateMissVO.setName("缺少净值日期");
+        priceDateMissVO.setName(NavParseStatusConst.PRICE_DATE_IS_NULL_TEXT);
         navNameValueVOS.add(priceDateMissVO);
-        NameValueVO navMissVO = new NameValueVO();
-        Long navMiss = emailParseInfoMapper.countpdfNoData(databoardQuery, "单位净值和累计净值和资产净值均缺失");
-        navMissVO.setName("单位净值和累计净值和资产净值均缺失");
-        navMissVO.setValue(navMiss);
-        navNameValueVOS.add(navMissVO);
+
+        NameValueVO navAssetMissVO = new NameValueVO();
+        Long navAssetMiss = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.NAV_ASSET_IS_NULL);
+        navAssetMissVO.setName(NavParseStatusConst.NAV_ASSET_IS_NULL_TEXT);
+        navAssetMissVO.setValue(navAssetMiss);
+        navNameValueVOS.add(navAssetMissVO);
+
         NameValueVO fundNameNumberMissVO = new NameValueVO();
-        Long fundNameNumberMiss = emailParseInfoMapper.countpdfNoData(databoardQuery, "基金名称和备案编码均缺失");
-        fundNameNumberMissVO.setName("基金名称和备案编码均缺失");
+        Long fundNameNumberMiss = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.FUND_NAME_REGISTER_IS_NULL);
+        fundNameNumberMissVO.setName(NavParseStatusConst.FUND_NAME_REGISTER_IS_NULL_TEXT);
         fundNameNumberMissVO.setValue(fundNameNumberMiss);
         navNameValueVOS.add(fundNameNumberMissVO);
+
+        NameValueVO navMissVO = new NameValueVO();
+        Long navMiss = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.NAV_DEFICIENCY);
+        navMissVO.setName(NavParseStatusConst.NAV_DEFICIENCY_TEXT);
+        navMissVO.setValue(navMiss);
+        navNameValueVOS.add(navMissVO);
+
+        NameValueVO navNegativeVO = new NameValueVO();
+        Long navNegative = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.NAV_NEGATIVE);
+        navNegativeVO.setName(NavParseStatusConst.NAV_NEGATIVE_TEXT);
+        navNegativeVO.setValue(navNegative);
+        navNameValueVOS.add(navNegativeVO);
+
+        NameValueVO assetLessZeroVO = new NameValueVO();
+        Long assetLessZero = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.ASSET_NET_NEGATIVE);
+        assetLessZeroVO.setName(NavParseStatusConst.ASSET_NET_NEGATIVE_TEXT);
+        assetLessZeroVO.setValue(assetLessZero);
+        navNameValueVOS.add(assetLessZeroVO);
+
+        NameValueVO notMatchFundVO = new NameValueVO();
+        Long notMatch = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.NOT_MATCH);
+        notMatchFundVO.setName(NavParseStatusConst.NOT_MATCH_TEXT);
+        notMatchFundVO.setValue(notMatch);
+        navNameValueVOS.add(notMatchFundVO);
+
+        NameValueVO amplitudeNavVO = new NameValueVO();
+        Long amplitudeNav = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.AMPLITUDE_EXCEPTION);
+        amplitudeNavVO.setName(NavParseStatusConst.AMPLITUDE_EXCEPTION_TEXT);
+        amplitudeNavVO.setValue(amplitudeNav);
+        navNameValueVOS.add(amplitudeNavVO);
+
+        NameValueVO amplitudeNavErrorVO = new NameValueVO();
+        Long amplitudeNavError = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.AMPLITUDE_ERROR);
+        amplitudeNavErrorVO.setName(NavParseStatusConst.AMPLITUDE_ERROR_TEXT);
+        amplitudeNavErrorVO.setValue(amplitudeNavError);
+        navNameValueVOS.add(amplitudeNavErrorVO);
+
+        NameValueVO priceDateAfterNowVO = new NameValueVO();
+        Long priceDateAfterNow = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_AFTER_NOW);
+        priceDateAfterNowVO.setName(NavParseStatusConst.PRICE_DATE_AFTER_NOW_TEXT);
+        priceDateAfterNowVO.setValue(priceDateAfterNow);
+        navNameValueVOS.add(priceDateAfterNowVO);
+
+        NameValueVO priceDateErrorVO = new NameValueVO();
+        Long priceDateError = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_IS_ERROR);
+        priceDateErrorVO.setName(NavParseStatusConst.PRICE_DATE_IS_ERROR_TEXT);
+        priceDateErrorVO.setValue(priceDateError);
+        navNameValueVOS.add(priceDateErrorVO);
+
+        NameValueVO priceDateBeforeInceptionVO = new NameValueVO();
+        Long priceDateBeforeInception = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_BEFORE_INCEPTION);
+        priceDateBeforeInceptionVO.setName(NavParseStatusConst.PRICE_DATE_BEFORE_INCEPTION_TEXT);
+        priceDateBeforeInceptionVO.setValue(priceDateBeforeInception);
+        navNameValueVOS.add(priceDateBeforeInceptionVO);
+
+        NameValueVO priceDateNotWorkDayVO = new NameValueVO();
+        Long priceDateNotWorkDay = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_NOT_WORK_DAY);
+        priceDateNotWorkDayVO.setName(NavParseStatusConst.PRICE_DATE_NOT_WORK_DAY_TEXT);
+        priceDateNotWorkDayVO.setValue(priceDateNotWorkDay);
+        navNameValueVOS.add(priceDateNotWorkDayVO);
+
+        NameValueVO priceDateAfterLiquidateVO = new NameValueVO();
+        Long priceDateAfterLiquidate = emailFundNavCollectionMapper.countDataByExceptionStatus(databoardQuery, NavParseStatusConst.PRICE_DATE_AFTER_LIQUIDATE);
+        priceDateAfterLiquidateVO.setName(NavParseStatusConst.PRICE_DATE_AFTER_LIQUIDATE_TEXT);
+        priceDateAfterLiquidateVO.setValue(priceDateAfterLiquidate);
+        navNameValueVOS.add(priceDateAfterLiquidateVO);
         result.setNavFailAnalysisVO(navNameValueVOS);
-        NameValueVO templateUnSupportVO = new NameValueVO();
-        Long templateUnSupport = emailParseInfoMapper.countpdfNoData(databoardQuery, "模板不支持");
-        templateUnSupportVO.setName("模板不支持");
-        templateUnSupportVO.setValue(templateUnSupport);
-        navNameValueVOS.add(templateUnSupportVO);
-        result.setNavFailAnalysisVO(navNameValueVOS);
+
         //估值表规模
         databoardQuery.setEmailType(2);
         List<NameValueVO> valuationNameValueVOS = new ArrayList<>();