|
@@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
-import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
@@ -70,6 +69,7 @@ public class EmailParseService {
|
|
|
private final EmailFileInfoMapper emailFileInfoMapper;
|
|
|
private final EmailFundNavMapper emailFundNavMapper;
|
|
|
private final EmailFundAssetMapper emailFundAssetMapper;
|
|
|
+ private final EmailFundNavCollectionMapper emailFundNavCollectionMapper;
|
|
|
private final AssetMapper assetMapper;
|
|
|
private final NavMapper navMapper;
|
|
|
private final FundService fundService;
|
|
@@ -97,7 +97,7 @@ public class EmailParseService {
|
|
|
public EmailParseService(EmailTypeRuleMapper emailTypeRuleMapper, EmailRuleConfig emailRuleConfig,
|
|
|
EmailFieldMappingMapper emailFieldMapper, EmailParserFactory emailParserFactory,
|
|
|
EmailParseInfoMapper emailParseInfoMapper, EmailFileInfoMapper emailFileInfoMapper,
|
|
|
- EmailFundNavMapper emailFundNavMapper, EmailFundAssetMapper emailFundAssetMapper,
|
|
|
+ EmailFundNavMapper emailFundNavMapper, EmailFundAssetMapper emailFundAssetMapper, EmailFundNavCollectionMapper emailFundNavCollectionMapper,
|
|
|
AssetMapper assetMapper, NavMapper navMapper, FundService fundService,
|
|
|
FundAliasMapper fundAliasMapper,
|
|
|
ValuationTableMapper valuationTableMapper, ValuationTableAttributeMapper valuationTableAttributeMapper,
|
|
@@ -110,6 +110,7 @@ public class EmailParseService {
|
|
|
this.emailFileInfoMapper = emailFileInfoMapper;
|
|
|
this.emailFundNavMapper = emailFundNavMapper;
|
|
|
this.emailFundAssetMapper = emailFundAssetMapper;
|
|
|
+ this.emailFundNavCollectionMapper = emailFundNavCollectionMapper;
|
|
|
this.assetMapper = assetMapper;
|
|
|
this.navMapper = navMapper;
|
|
|
this.fundService = fundService;
|
|
@@ -199,6 +200,12 @@ public class EmailParseService {
|
|
|
Integer fileId = saveEmailFileInfo(emailId, emailContentInfoDTO.getFileId(), fileName, emailContentInfoDTO.getFilePath(), parseDate);
|
|
|
|
|
|
List<EmailFundNavDTO> fundNavDTOList = fileNameNavEntry.getValue();
|
|
|
+ //记录采集表
|
|
|
+ if(CollUtil.isNotEmpty(fundNavDTOList)){
|
|
|
+ List<EmailFundNavCollectionDO> emailFundNavCollectionVOList = new ArrayList<>();
|
|
|
+ fundNavDTOList.stream().forEach( e -> emailFundNavCollectionVOList.add(toEmailFundNavCollectionVO(e,fileId,parseDate)));
|
|
|
+ batchSaveEmailFundNavCollection(emailFundNavCollectionVOList);
|
|
|
+ }
|
|
|
if (CollUtil.isNotEmpty(fundNavDTOList)) {
|
|
|
// 过滤出解析成功的数据
|
|
|
fundNavDTOList = fundNavDTOList.stream().filter(e -> e != null && StrUtil.isBlank(e.getFailReason())).toList();
|
|
@@ -247,6 +254,35 @@ public class EmailParseService {
|
|
|
emailParseInfoMapper.updateParseStatus(emailId, emailParseStatus, failReason);
|
|
|
}
|
|
|
|
|
|
+ private void batchSaveEmailFundNavCollection(List<EmailFundNavCollectionDO> emailFundNavCollectionVOList) {
|
|
|
+ if(CollUtil.isNotEmpty(emailFundNavCollectionVOList)){
|
|
|
+ Integer fileId = emailFundNavCollectionVOList.get(0).getFileId();
|
|
|
+ Long count = emailFundNavCollectionMapper.countByFileId(fileId);
|
|
|
+ if(count == 0L){
|
|
|
+ emailFundNavCollectionMapper.batchInsert(emailFundNavCollectionVOList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private EmailFundNavCollectionDO toEmailFundNavCollectionVO(EmailFundNavDTO fundNavDTO, Integer fileId,Date parseDate) {
|
|
|
+ EmailFundNavCollectionDO vo = new EmailFundNavCollectionDO();
|
|
|
+ vo.setFileId(fileId);
|
|
|
+ vo.setFundName(fundNavDTO.getFundName());
|
|
|
+ vo.setAssetNet(fundNavDTO.getAssetNet());
|
|
|
+ vo.setAssetShare(fundNavDTO.getAssetShare());
|
|
|
+ vo.setRegisterNumber(fundNavDTO.getRegisterNumber());
|
|
|
+ vo.setPriceDate(fundNavDTO.getPriceDate());
|
|
|
+ vo.setNav(fundNavDTO.getCumulativeNavWithdrawal());
|
|
|
+ vo.setExceptionStatus(fundNavDTO.getParseStatus());
|
|
|
+ vo.setVirtualNav(fundNavDTO.getVirtualNav());
|
|
|
+ vo.setCumulativeNavWithdrawal(fundNavDTO.getCumulativeNavWithdrawal());
|
|
|
+ vo.setCreateTime(DateUtils.getNowDate());
|
|
|
+ vo.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ vo.setIsvalid(1);
|
|
|
+ vo.setParseDate(parseDate);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
private void saveValuationInfo(Integer fileId, List<EmailFundNavDTO> fundNavDTOList) {
|
|
|
if (CollUtil.isEmpty(fundNavDTOList)) {
|
|
|
return;
|