chenjianhua 4 дней назад
Родитель
Сommit
fe255bd2c7

+ 2 - 0
service-base/src/main/java/com/simuwang/base/common/util/EmailUtil.java

@@ -290,6 +290,8 @@ public class EmailUtil {
             props.put("mail.imap.port", mailboxInfoDTO.getPort());
             props.put("mail.imaps.ssl.enable", "true");
             props.put("mail.imaps.ssl.trust", "*");
+            props.put("mail.imap.partialfetch", false);
+            props.put("mail.imaps.partialfetch", false);
             props.put("mail.imap.auth", "true");
             props.put("mail.imap.starttls.enable", "true");
             props.put("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

+ 17 - 16
service-base/src/main/java/com/simuwang/base/common/util/ValuationBusinessUtils.java

@@ -112,13 +112,12 @@ public class ValuationBusinessUtils {
                 return preInfo;
             }
             // 未找到有效净值
-            if (header.getUnitNetValue() <= 0) {
-                error = preInfo.new Error().setCellNum(0).setRowNum(0).setMsg(ERROR_MSG_NOT_MATCH_TEMPLATE + ":未找到单位净值或累计净值");
-                error.setExcelName(valuationNeedParseParam.getOriginFileName());
-                preInfo.setError(error);
-                return preInfo;
-            }
-
+//            if (header.getUnitNetValue() <= 0) {
+//                error = preInfo.new Error().setCellNum(0).setRowNum(0).setMsg(ERROR_MSG_NOT_MATCH_TEMPLATE + ":未找到单位净值或累计净值");
+//                error.setExcelName(valuationNeedParseParam.getOriginFileName());
+//                preInfo.setError(error);
+//                return preInfo;
+//            }
             if (excelInfo.getHeaderRows() == 0 || excelInfo.getTitleRows() == 0) {
                 error = preInfo.new Error().setCellNum(0).setRowNum(0).setMsg(ERROR_MSG_NOT_MATCH_TEMPLATE + ":未找到表头字段行");
                 error.setExcelName(valuationNeedParseParam.getOriginFileName());
@@ -330,15 +329,17 @@ public class ValuationBusinessUtils {
             error = preInfo.new Error().setCellNum(0).setRowNum(0).setMsg(ERROR_MSG_NO_DATA);
             error.setExcelName(preInfo.getExcelOriginName());
             preInfo.setError(error);
-        } else {
-            long marketValueCount = dataList.stream().filter(p -> StringUtils.isEmpty(p.getMarketValue())).count();
-            long amountCount = dataList.stream().filter(p -> StringUtils.isEmpty(p.getAmount())).count();
-            if (marketValueCount == dataList.size() || amountCount == dataList.size()) {
-                error = preInfo.new Error().setMsg(ERROR_MSG_NOT_MARKET_VALUE_OR_AMOUNT);
-                error.setExcelName(preInfo.getExcelOriginName());
-                preInfo.setError(error);
-            }
         }
+        //放开市值和数量列限制
+//        else {
+//            long marketValueCount = dataList.stream().filter(p -> StringUtils.isEmpty(p.getMarketValue())).count();
+//            long amountCount = dataList.stream().filter(p -> StringUtils.isEmpty(p.getAmount())).count();
+//            if (marketValueCount == dataList.size() || amountCount == dataList.size()) {
+//                error = preInfo.new Error().setMsg(ERROR_MSG_NOT_MARKET_VALUE_OR_AMOUNT);
+//                error.setExcelName(preInfo.getExcelOriginName());
+//                preInfo.setError(error);
+//            }
+//        }
     }
 
     /**
@@ -478,7 +479,7 @@ public class ValuationBusinessUtils {
                 }
             } else if (str.contains("今日单位净值") || str.contains("单位净值") || str.contains("净值")) {
                 //header.getUnitNetValue() <= 0 代表还未识别
-                if (header.getUnitNetValue() <= 0) {
+                if (header.getUnitNetValue() == null || header.getUnitNetValue() <= 0) {
                     double nav = extraNumberFromString(str);
                     //单位净值字段名 和 单位净值值 分为两个单元格的情况,此时取下一个单元格的值作为单位净值
                     if (nav == -1D && (i + 1) < headerInfo.size()) {

+ 1 - 1
service-base/src/main/java/com/simuwang/base/pojo/valuation/AssetsValuationDetails.java

@@ -86,7 +86,7 @@ public class AssetsValuationDetails {
 	    ValuationDate = new SimpleDateFormat("yyyy-MM-dd").format(valuationDate);
 	}
 
-	public double getNav() {
+	public Double getNav() {
 		return nav;
 	}
 

+ 2 - 2
service-base/src/main/java/com/simuwang/base/pojo/valuation/PreAssetsValuationInfo.java

@@ -33,7 +33,7 @@ public class PreAssetsValuationInfo<T extends PreAssetsValuationBase> {
 		// 子标题
 		private String subTitle;
 		private Date valuationDate;
-		private double unitNetValue;
+		private Double unitNetValue;
 		private List<String> headerList;
 
 		public String getTitle() {
@@ -60,7 +60,7 @@ public class PreAssetsValuationInfo<T extends PreAssetsValuationBase> {
 			this.valuationDate = valuationDate;
 		}
 
-		public double getUnitNetValue() {
+		public Double getUnitNetValue() {
 			return unitNetValue;
 		}
 

+ 2 - 2
service-base/src/main/resources/mapper/FundAliasMapper.xml

@@ -62,7 +62,7 @@
         select *
         from PPW_EMAIL.fund_alias
         where isvalid = 1
-          and source_fund_name = #{fundName}
+          and source_fund_name = #{fundName} and source_register_number is null
     </select>
 
     <select id="queryFundByRegisterNumber" resultMap="BaseResultMap">
@@ -80,7 +80,7 @@
         select *
         from PPW_EMAIL.fund_alias
         where isvalid = 1
-          and source_register_number = #{registerNumber}
+          and source_register_number = #{registerNumber} and source_fund_name is null
     </select>
 
     <select id="searchFundAlias" resultMap="BaseResultMap"

+ 1 - 13
service-base/src/main/resources/mapper/FundNotMappingMapper.xml

@@ -16,18 +16,6 @@
         <result column="updatetime" property="updateTime"/>
     </resultMap>
     <select id="getFundNotMappingInfo" resultMap="BaseResultMap">
-        select * from fund_not_mapping_info where isvalid=1
-        <if test="fundName != null and fundName !=''">
-            and fund_name=#{fundName}
-        </if>
-        <if test="registerNumber != null and registerNumber !=''">
-            and register_number=#{registerNumber}
-        </if>
-        <if test="fundName == null">
-            and fund_name is null
-        </if>
-        <if test="registerNumber == null">
-            and register_number is null
-        </if>
+        select id,fund_name,register_number,fund_alias_id,last_price_date,nav_total,asset_total,isvalid,creatorid,createtime,updaterid,updatetime from fund_not_mapping_info where isvalid=1 and fund_alias_id=#{fundAliasId} limit 1
     </select>
 </mapper>

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

@@ -270,6 +270,7 @@ public class EmailParseService {
                 int valuationId = valuationTableDO.getId();
                 saveValuationTableAttribute(valuationId, valuationTableAttributeList);
                 fundPositionDetailDOList.forEach(e -> e.setValuationId(valuationId));
+                fundNavDTO.setFailReason("未匹配基金");
                 // 不匹配基金的情况下 -> 不写fund_position_detail
                 // saveFundPositionDetail(fundPositionDetailDOList, null, fundNavDTO.getPriceDate());
                 continue;
@@ -644,7 +645,13 @@ public class EmailParseService {
     private List<EmailFundNavDO> buildEmailFundNavDo(Integer fileId, EmailFundNavDTO fundNavDTO, Date parseDate) {
         List<EmailFundNavDO> fundNavDOList = CollUtil.newArrayList();
         Date priceDate = DateUtil.parse(fundNavDTO.getPriceDate(), DateConst.YYYY_MM_DD);
+        if(StrUtil.isNotBlank(fundNavDTO.getNav())){
+            fundNavDTO.setNav(fundNavDTO.getNav().replace("null", ""));
+        }
         BigDecimal nav = StrUtil.isNotBlank(fundNavDTO.getNav()) ? new BigDecimal(fundNavDTO.getNav()) : null;
+        if(StrUtil.isNotBlank(fundNavDTO.getCumulativeNavWithdrawal())){
+            fundNavDTO.setCumulativeNavWithdrawal(fundNavDTO.getCumulativeNavWithdrawal().replace("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)
@@ -726,11 +733,16 @@ public class EmailParseService {
     }
 
     private void setNavParseStatus(EmailFundNavDTO fundNavDTO, String emailTitle) {
-        // 1.单位净值或累计净值缺失
-        if(StringUtil.isEmpty(fundNavDTO.getAssetNet())){
-            if (StrUtil.isBlank(fundNavDTO.getNav()) || StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal())) {
-                fundNavDTO.setParseStatus(NavParseStatusConst.NAV_DEFICIENCY);
-                return;
+
+        //判断是不是估值表,估值表不要求有净值和规模
+        if(fundNavDTO.getFundPositionDetailDOList() == null && fundNavDTO.getFundPositionDetailDOList().size() == 0 && fundNavDTO.getValuationTableDO() != null
+        && fundNavDTO.getValuationTableAttributeList() == null && fundNavDTO.getValuationTableAttributeList().size() == 0) {
+            // 1.单位净值或累计净值缺失
+            if(StringUtil.isEmpty(fundNavDTO.getAssetNet())){
+                if (StrUtil.isBlank(fundNavDTO.getNav()) || StrUtil.isBlank(fundNavDTO.getCumulativeNavWithdrawal())) {
+                    fundNavDTO.setParseStatus(NavParseStatusConst.NAV_DEFICIENCY);
+                    return;
+                }
             }
         }
         try{
@@ -770,7 +782,6 @@ public class EmailParseService {
         if (CollUtil.isEmpty(fundIdList)) {
             return;
         }
-
         fundNavDTO.setParseStatus(NavParseStatusConst.SUCCESS);
     }
 

+ 6 - 3
service-daq/src/main/java/com/simuwang/daq/service/ValuationParseService.java

@@ -76,8 +76,8 @@ public class ValuationParseService {
                             record.setParseValuationInfo(parseValuationInfo);
                             log.info("表格:{},从表格中解析到的基金名称和备案编码:{}", valuationNeedParseParam.getOriginFileName(), parseValuationInfo.toString());
 
-                            record.setNav(String.valueOf(details.getNav()));
-                            record.setCumulativeNavWithdrawal(String.valueOf(details.getCumulativeNav()));
+                            record.setNav(details.getNav()!=null?String.valueOf(details.getNav()):null);
+                            record.setCumulativeNavWithdrawal(details.getCumulativeNav()!=null?String.valueOf(details.getCumulativeNav()):null);
                             record.setExcelName(valuationNeedParseParam.getOriginFileName());
                             record.setDate(details.getValuationDate());
                             record.setExcelName(valuationNeedParseParam.getOriginFileName());
@@ -206,7 +206,10 @@ public class ValuationParseService {
         if (StringUtils.isNotEmpty(headInfo)) {
             List<String> contentList = Arrays.stream(headInfo.split("@")).collect(Collectors.toList());
             for (String content : contentList) {
-                String registerNumber = content.length() > 6 ? content.substring(0, 6) : null;
+                String registerNumber = "";
+                if(content != null && content.trim().matches("^[a-zA-Z0-9]+")) {
+                    registerNumber = content.length() > 6 ? content.substring(0, 6) : null;
+                }
                 if (StrUtil.isNotBlank(registerNumber) && !ValuationDataUtils.hasChinese(registerNumber, false)) {
                     info.setRegisterNumber(registerNumber);
                 }

+ 8 - 7
service-manage/src/main/java/com/simuwang/manage/service/impl/FundAliasServiceImpl.java

@@ -93,24 +93,25 @@ public class FundAliasServiceImpl implements FundAliasService {
         //处理采集数据,将采集的数据入库
         emailFundInfoService.reparseValuationFile(fundAliasVO.getSourceFundName(),fundAliasVO.getSourceRegisterNumber());
         //更新别名统计数据
-        computeFundMappingInfo(fundAliasVO.getSourceFundName(),fundAliasVO.getSourceRegisterNumber());
+        computeFundMappingInfo(fundAliasVO);
     }
 
-    private void computeFundMappingInfo(String fundName,String registerNumber){
+    private void computeFundMappingInfo(FundAliasVO fundAliasVO){
         FundNotMappingInfoDO fundNotMappingInfoDO = new FundNotMappingInfoDO();
-        fundNotMappingInfoDO.setFundName(fundName);
-        fundNotMappingInfoDO.setRegisterNumber(registerNumber);
+        fundNotMappingInfoDO.setFundName(fundAliasVO.getSourceFundName());
+        fundNotMappingInfoDO.setRegisterNumber(fundAliasVO.getSourceRegisterNumber());
         //异常净值数量
-        Integer navTotal = emailFundNavMapper.countNoStoreNav(fundName,registerNumber);
+        Integer navTotal = emailFundNavMapper.countNoStoreNav(fundAliasVO.getSourceFundName(),fundAliasVO.getSourceRegisterNumber());
         //异常净值数量
-        Integer assetTotal = emailFundAssetMapper.countNoStoreAsset(fundName,registerNumber);
-        String lastPriceDate = emailFundNavMapper.getLastPriceDateByfundRegisterNumber(fundName,registerNumber);
+        Integer assetTotal = emailFundAssetMapper.countNoStoreAsset(fundAliasVO.getSourceFundName(),fundAliasVO.getSourceRegisterNumber());
+        String lastPriceDate = emailFundNavMapper.getLastPriceDateByfundRegisterNumber(fundAliasVO.getSourceFundName(),fundAliasVO.getSourceRegisterNumber());
         fundNotMappingInfoDO.setAssetTotal(assetTotal);
         fundNotMappingInfoDO.setLastPriceDate(lastPriceDate);
         fundNotMappingInfoDO.setNavTotal(navTotal);
         fundNotMappingInfoDO.setIsvalid(1);
         fundNotMappingInfoDO.setCreateTime(new Date());
         fundNotMappingInfoDO.setUpdateTime(new Date());
+        fundNotMappingInfoDO.setFundAliasId(fundAliasVO.getId());
         FundNotMappingInfoDO oldFundNotMappingInfoDO = fundNotMappingMapper.getFundNotMappingInfo(fundNotMappingInfoDO);
         if(oldFundNotMappingInfoDO != null){
             fundNotMappingInfoDO.setId(oldFundNotMappingInfoDO.getId());