فهرست منبع

fix:针对净值日期错误,规模单发问题处理

chenjianhua 1 ماه پیش
والد
کامیت
06291524e6

+ 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 PRICE_DATE_ERROR = 6;
+
 }

+ 14 - 15
service-base/src/main/java/com/simuwang/base/common/util/NavDataUtil.java

@@ -48,27 +48,26 @@ public class NavDataUtil {
         if (StrUtil.isBlank(fundNavDTO.getPriceDate())) {
             return "缺少净值日期";
         }
-        String priceDate = fundNavDTO.getPriceDate();
-        try{
-            if(DateUtils.parse(priceDate, DateUtils.YYYY_MM_DD).after(DateUtils.getNowDate())){
-                return "净值日期不合法";
-            }
-        }catch (Exception e){
-
-        }
         if (StrUtil.isBlank(fundNavDTO.getFundName()) && StrUtil.isBlank(fundNavDTO.getRegisterNumber())) {
             return "基金名称和备案编码均缺失";
         }
         if(StrUtil.isBlank(fundNavDTO.getNav()) && StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal()) && StrUtil.isBlank(fundNavDTO.getAssetNet())){
             return "单位净值和累计净值和资产净值均缺失";
         }
-        // 单位净值,累计单位净值,资产净值,资产份额数字格式校验
-        boolean isvalidNumericFormat = (StrUtil.isBlank(fundNavDTO.getNav()) || StringUtil.isNumeric(fundNavDTO.getNav()))
-                && (StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal()) || StringUtil.isNumeric(fundNavDTO.getCumulativeNavWithdrawal()))
-                && (StrUtil.isBlank(fundNavDTO.getAssetNet()) || StringUtil.isNumeric(fundNavDTO.getAssetNet()))
-                && (StrUtil.isBlank(fundNavDTO.getAssetShare()) || StringUtil.isNumeric(fundNavDTO.getAssetShare()));
-        if (!isvalidNumericFormat) {
-            return "单位净值或累计净值或资产净值或资产份额格式不正确";
+        if(StrUtil.isNotBlank(fundNavDTO.getAssetNet()) && !StringUtil.isNumeric(fundNavDTO.getAssetNet())){
+            return "资产净值格式不正确";
+        }
+        if(StrUtil.isNotBlank(fundNavDTO.getAssetShare()) && !StringUtil.isNumeric(fundNavDTO.getAssetShare())){
+            return "资产份额格式不正确";
+        }
+        //当资产净值为空才校验净值数据
+        if(StrUtil.isBlank(fundNavDTO.getAssetNet())){
+            boolean isvalidNumericFormat = (StrUtil.isBlank(fundNavDTO.getNav()) || StringUtil.isNumeric(fundNavDTO.getNav()))
+                    && (StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal()) || StringUtil.isNumeric(fundNavDTO.getCumulativeNavWithdrawal())
+                    );
+            if (!isvalidNumericFormat) {
+                return "单位净值或累计净值格式不正确";
+            }
         }
         return null;
     }

+ 17 - 5
service-daq/src/main/java/com/simuwang/daq/service/EmailParseService.java

@@ -600,7 +600,7 @@ public class EmailParseService {
             return fundAssetDOList;
         }
         Integer isStored = fundNavDTO.getParseStatus() != null && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.ASSET_NET_NEGATIVE)
-                && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NOT_MATCH)? 1 : 0;
+                && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NOT_MATCH) && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.PRICE_DATE_ERROR)? 1 : 0;
         Date priceDate = DateUtil.parse(fundNavDTO.getPriceDate(), DateConst.YYYY_MM_DD);
         if (CollUtil.isNotEmpty(fundNavDTO.getFundIdList())) {
             for (String fundId : fundNavDTO.getFundIdList()) {
@@ -647,7 +647,8 @@ public class EmailParseService {
         BigDecimal nav = StrUtil.isNotBlank(fundNavDTO.getNav()) ? new BigDecimal(fundNavDTO.getNav()) : null;
         BigDecimal cumulativeNavWithdrawal = StrUtil.isNotBlank(fundNavDTO.getCumulativeNavWithdrawal()) ? new BigDecimal(fundNavDTO.getCumulativeNavWithdrawal()) : null;
         Integer isStored = fundNavDTO.getParseStatus() != null && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NAV_DEFICIENCY)
-                && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NOT_MATCH) && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NAV_NEGATIVE) ? 1 : 0;
+                && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NOT_MATCH) && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.NAV_NEGATIVE)
+                && !fundNavDTO.getParseStatus().equals(NavParseStatusConst.PRICE_DATE_ERROR)? 1 : 0;
         if (CollUtil.isNotEmpty(fundNavDTO.getFundIdList())) {
             for (String fundId : fundNavDTO.getFundIdList()) {
                 if(nav == null && cumulativeNavWithdrawal == null){
@@ -721,9 +722,20 @@ public class EmailParseService {
 
     private void setNavParseStatus(EmailFundNavDTO fundNavDTO, String emailTitle) {
         // 1.单位净值或累计净值缺失
-        if ((StrUtil.isBlank(fundNavDTO.getNav()) || StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal()) ) && StrUtil.isBlank(fundNavDTO.getAssetNet())) {
-            fundNavDTO.setParseStatus(NavParseStatusConst.NAV_DEFICIENCY);
-            return;
+        if(StringUtil.isEmpty(fundNavDTO.getAssetNet())){
+            if (StrUtil.isBlank(fundNavDTO.getNav()) || StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal())) {
+                fundNavDTO.setParseStatus(NavParseStatusConst.NAV_DEFICIENCY);
+                return;
+            }
+        }
+        try{
+            Date priceDate = DateUtils.parse(fundNavDTO.getPriceDate(),DateUtils.YYYY_MM_DD);
+            if(priceDate != null && priceDate.after(new Date())){
+                fundNavDTO.setParseStatus(NavParseStatusConst.PRICE_DATE_ERROR);
+                return;
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
         }
         // 考虑单独规模文件时 -> 无单位净值和累计净值
         // 2.单位净值或累计净值不大于0