|
@@ -3,7 +3,9 @@ package com.simuwang.manage.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.simuwang.base.common.util.DateUtils;
|
|
|
+import com.simuwang.base.common.util.StringUtil;
|
|
|
import com.simuwang.base.mapper.EmailFundNavMapper;
|
|
|
+import com.simuwang.base.mapper.NavMapper;
|
|
|
import com.simuwang.base.pojo.dos.CompanyEmailSendHistoryDO;
|
|
|
import com.simuwang.base.pojo.dos.EmailFundNavDO;
|
|
|
import com.simuwang.base.pojo.dos.NavDO;
|
|
@@ -33,8 +35,11 @@ public class EmailFundNavServiceImpl implements EmailFundNavService {
|
|
|
@Autowired
|
|
|
private EmailParseService emailParseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private NavMapper navMapper;
|
|
|
+
|
|
|
@Override
|
|
|
- public void reparseFileNav(String sourceFundName,String registerNumber, String targetFundId) {
|
|
|
+ public void reparseFileNav(String sourceFundName,String registerNumber, String targetFundId,String sourceFundId) {
|
|
|
List<EmailFundNavDO> fundNavDOList = emailFundNavMapper.selectNotMappingNav(sourceFundName,registerNumber);
|
|
|
Map<String,List<EmailFundNavDO>> fundNavDOGroup = fundNavDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getPriceDate(),DateUtils.YYYY_MM_DD)));
|
|
|
List<EmailFundNavDO> dataList = new ArrayList<>();
|
|
@@ -57,8 +62,21 @@ public class EmailFundNavServiceImpl implements EmailFundNavService {
|
|
|
.map(e -> BeanUtil.copyProperties(e, NavDO.class)).collect(Collectors.toList());
|
|
|
navDOList.forEach(e -> e.setUpdateTime(DateUtils.getNowDate()));
|
|
|
emailParseService.saveNavDo(navDOList);
|
|
|
-
|
|
|
-
|
|
|
+ //还原历史基金的净值数据
|
|
|
+ if(StringUtil.isNotEmpty(sourceFundId)){
|
|
|
+ List<String> priceDateList = new ArrayList<>();
|
|
|
+ for(EmailFundNavDO fundNavDO : fundNavDOList){
|
|
|
+ priceDateList.add(DateUtils.format(fundNavDO.getPriceDate(),DateUtils.YYYY_MM_DD));
|
|
|
+ }
|
|
|
+ //将匹配错的数据删除
|
|
|
+ navMapper.batchDeleteNav(sourceFundId,priceDateList);
|
|
|
+ //从解析库把原来的净值数据重新写入到sourceFundId对应的基金上
|
|
|
+ List<EmailFundNavDO> sourceNavList = emailFundNavMapper.selectNavByFundId(sourceFundId);
|
|
|
+ List<NavDO> sourcenavDOList = sourceNavList.stream().filter(e -> StrUtil.isNotBlank(e.getFundId()))
|
|
|
+ .map(e -> BeanUtil.copyProperties(e, NavDO.class)).collect(Collectors.toList());
|
|
|
+ sourcenavDOList.forEach(e -> e.setUpdateTime(DateUtils.getNowDate()));
|
|
|
+ emailParseService.saveNavDo(sourcenavDOList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|