chenjianhua пре 4 месеци
родитељ
комит
42274cf65c

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

@@ -27,4 +27,9 @@ public class NavParseStatusConst {
      */
     public final static Integer ASSET_NET_NEGATIVE = 5;
 
+    /**
+     * 振幅异常
+     */
+    public final static Integer AMPLITUDE_EXCEPTION = 6;
+
 }

+ 2 - 0
service-base/src/main/java/com/simuwang/base/mapper/NavMapper.java

@@ -30,4 +30,6 @@ public interface NavMapper {
     void batchDeleteNav(@Param("fundId")String sourceFundId, @Param("priceDateList")List<String> priceDateList);
 
     Long countNavTotal();
+
+    NavDO queryNavByFundIdDate(@Param("fundId")String fundId, @Param("priceDate")String priceDate);
 }

+ 8 - 28
service-base/src/main/resources/mapper/NavMapper.xml

@@ -101,35 +101,15 @@
     <select id="countNavTotal" resultType="java.lang.Long">
         select count(1) from nav where isvalid=1
     </select>
-    <select id="countNavByTime" resultType="java.lang.Long">
-        select count(1) from nav where updatetime <![CDATA[ <= ]]> #{endDate}
-        <if test="startDate != null and startDate !=''">
-            and updatetime >= #{startDate}
-        </if>
-    </select>
-    <select id="selectNavListByTime" resultMap="BaseResultMap">
-        select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+
+    <select id="queryNavByFundIdDate" resultMap="BaseResultMap">
+        SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
                isvalid, creatorid, createtime, updaterid, updatetime
-        from nav where updatetime <![CDATA[ <= ]]> #{endDate}
-        <if test="startDate != null and startDate !=''">
-            and updatetime >= #{startDate}
-        </if>
-        order by updatetime desc
-    </select>
-    <select id="selectMaxMinId" resultType="java.util.Map">
-        select max(id) as maxId,min(id) as minId from nav where updatetime <![CDATA[ <= ]]> #{endDate}
-        <if test="startDate != null and startDate !=''">
-            and updatetime >= #{startDate}
-        </if>
-    </select>
-    <select id="selectNavListById" resultType="com.simuwang.base.pojo.dos.NavDO">
-        select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
-        isvalid, creatorid, createtime, updaterid, updatetime
-        from nav where updatetime <![CDATA[ <= ]]> #{endDate} and id >= #{minId} and id <![CDATA[ <= ]]> #{maxId}
-        <if test="startDate != null and startDate !=''">
-            and updatetime >= #{startDate}
-        </if>
-        order by updatetime desc
+        from nav
+        where isvalid = 1
+          and fund_id = #{fundId} and price_date <![CDATA[ <= ]]> #{priceDate}
+        order by price_date desc
+        limit 1
     </select>
 
 

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

@@ -704,10 +704,31 @@ public class EmailParseService {
         if (CollUtil.isEmpty(fundIdList)) {
             return;
         }
-
         fundNavDTO.setParseStatus(NavParseStatusConst.SUCCESS);
     }
 
+    private boolean amplitudeNav(EmailFundNavDTO fundNavDTO) {
+        if(CollUtil.isEmpty(fundNavDTO.getFundIdList())){
+            return false;
+        }
+        List<String> fundIdList = fundNavDTO.getFundIdList();
+        String priceDate = fundNavDTO.getPriceDate();
+        for(String fundId : fundIdList){
+            NavDO navDO = navMapper.queryNavByFundIdDate(fundId,priceDate);
+            if(navDO == null){
+                continue;
+            }
+            //|(当期-上期)/ 上期 | >= 0.2
+            BigDecimal amplitudeRate = (new BigDecimal(fundNavDTO.getNav()).subtract(navDO.getNav())).divide(navDO.getNav());
+            Double absAmplitudeRate = Math.abs(amplitudeRate.doubleValue());
+            if(BigDecimal.valueOf(absAmplitudeRate).compareTo(new BigDecimal(0.2)) > 0 ){
+                fundNavDTO.setParseStatus(NavParseStatusConst.AMPLITUDE_EXCEPTION);
+                return true;
+            }
+        }
+        return false;
+    }
+
     private void saveFundAlias(String fundName, String registerNumber, List<String> fundIdList) {
         // 未识别到基金名称和备案编码的数据不写入别名管理
         if (StrUtil.isBlank(fundName) && StrUtil.isBlank(registerNumber)) {

+ 1 - 1
service-deploy/src/main/resources/application.yml

@@ -52,7 +52,7 @@ spring:
 email-rule:
   nav: "净值,业绩报酬,规模"
   valuation: "估值表"
-  report: "月报,年报,季报,报告(待确认)信息披露报告,证券类月报"
+  report: "月报,年报,证券类月报"
 
 email:
   file: