|
@@ -39,7 +39,7 @@ public class DeletionServiceImpl implements DeletionService {
|
|
private FundInfoMapper fundInfoMapper;
|
|
private FundInfoMapper fundInfoMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private ValuationTableMapper valuationTableMapper;
|
|
|
|
|
|
+ private FundPositionDetailMapper fundPositionDetailMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private AssetMapper assetMapper;
|
|
private AssetMapper assetMapper;
|
|
@@ -142,7 +142,7 @@ public class DeletionServiceImpl implements DeletionService {
|
|
}
|
|
}
|
|
List<NavDO> navDOList = navMapper.selectNavByFundId(fundId);
|
|
List<NavDO> navDOList = navMapper.selectNavByFundId(fundId);
|
|
List<AssetDO> assetDOList = assetMapper.selectAssetByFundId(fundId);
|
|
List<AssetDO> assetDOList = assetMapper.selectAssetByFundId(fundId);
|
|
- List<ValuationTableDO> valuationTableDOList = valuationTableMapper.selectValuationTableByFundId(fundId);
|
|
|
|
|
|
+ List<FundPositionDetailDO> fundPositionDetailDOList = fundPositionDetailMapper.fundPositionDetailByFundId(fundId);
|
|
//查询成立日到今天为止的交易日集合
|
|
//查询成立日到今天为止的交易日集合
|
|
List<TradeDateDO> tradeDateDOList = tradeDateMapper.selectTradeDate(inceptionDate,today);
|
|
List<TradeDateDO> tradeDateDOList = tradeDateMapper.selectTradeDate(inceptionDate,today);
|
|
if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.NAV_DELETION.getCode())){
|
|
if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.NAV_DELETION.getCode())){
|
|
@@ -152,12 +152,12 @@ public class DeletionServiceImpl implements DeletionService {
|
|
}else if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.DISTRIBUTION_DELETION.getCode())){
|
|
}else if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.DISTRIBUTION_DELETION.getCode())){
|
|
distributionDeletion(fundId,navDOList);
|
|
distributionDeletion(fundId,navDOList);
|
|
}else if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.VALUATION_DELETION.getCode())){
|
|
}else if(deletionDownParam.getDeletionType() != null && deletionDownParam.getDeletionType().equals(DeletionType.VALUATION_DELETION.getCode())){
|
|
- valuationDeletion(fundId,valuationTableDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
|
|
|
|
+ valuationDeletion(fundId,fundPositionDetailDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
}else{
|
|
}else{
|
|
navDeletion(fundId,navDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
navDeletion(fundId,navDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
assetDeletion(fundId,assetDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
assetDeletion(fundId,assetDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
distributionDeletion(fundId,navDOList);
|
|
distributionDeletion(fundId,navDOList);
|
|
- valuationDeletion(fundId,valuationTableDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
|
|
|
|
+ valuationDeletion(fundId,fundPositionDetailDOList,tradeDateDOList,fundReportFrequencyDO);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -475,12 +475,12 @@ public class DeletionServiceImpl implements DeletionService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void valuationDeletion(String fundId,List<ValuationTableDO> valuationTableDOList, List<TradeDateDO> tradeDateDOList,FundReportFrequencyDO fundReportFrequencyDO) {
|
|
|
|
|
|
+ private void valuationDeletion(String fundId,List<FundPositionDetailDO> fundPositionDetailDOList, List<TradeDateDO> tradeDateDOList,FundReportFrequencyDO fundReportFrequencyDO) {
|
|
//将现有数据无效掉
|
|
//将现有数据无效掉
|
|
deletionInfoMapper.deleteDeletion(fundId,DeletionType.VALUATION_DELETION.getCode());
|
|
deletionInfoMapper.deleteDeletion(fundId,DeletionType.VALUATION_DELETION.getCode());
|
|
//只处理日月季频率
|
|
//只处理日月季频率
|
|
if(Frequency.DAY == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
if(Frequency.DAY == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
- Map<String,List<ValuationTableDO>> valuationListMap = valuationTableDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
|
|
|
|
+ Map<String,List<FundPositionDetailDO>> valuationListMap = fundPositionDetailDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
Map<String,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getTradeDate(),DateUtils.YYYY_MM_DD)));
|
|
Map<String,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getTradeDate(),DateUtils.YYYY_MM_DD)));
|
|
for(String tradeDate : tradeListMap.keySet()){
|
|
for(String tradeDate : tradeListMap.keySet()){
|
|
if(valuationListMap.containsKey(tradeDate)){
|
|
if(valuationListMap.containsKey(tradeDate)){
|
|
@@ -499,24 +499,24 @@ public class DeletionServiceImpl implements DeletionService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(Frequency.WEEK == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
if(Frequency.WEEK == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
- Map<String,List<ValuationTableDO>> valuationListMap = valuationTableDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
|
|
- TreeMap<Integer,List<ValuationTableDO>> weekNavListMap = new TreeMap<>();
|
|
|
|
|
|
+ Map<String,List<FundPositionDetailDO>> valuationListMap = fundPositionDetailDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
|
|
+ TreeMap<Integer,List<FundPositionDetailDO>> weekNavListMap = new TreeMap<>();
|
|
//按周数整合
|
|
//按周数整合
|
|
for(String priceDate : valuationListMap.keySet()){
|
|
for(String priceDate : valuationListMap.keySet()){
|
|
Integer weekOfYear = Integer.parseInt(priceDate.substring(0,4)+DateUtil.weekOfYear(DateUtils.parse(priceDate,DateUtils.YYYY_MM_DD)));;
|
|
Integer weekOfYear = Integer.parseInt(priceDate.substring(0,4)+DateUtil.weekOfYear(DateUtils.parse(priceDate,DateUtils.YYYY_MM_DD)));;
|
|
if(weekNavListMap.containsKey(weekOfYear)){
|
|
if(weekNavListMap.containsKey(weekOfYear)){
|
|
- List<ValuationTableDO> valuationDOS = weekNavListMap.get(weekOfYear);
|
|
|
|
|
|
+ List<FundPositionDetailDO> valuationDOS = weekNavListMap.get(weekOfYear);
|
|
valuationDOS.addAll(valuationListMap.get(priceDate));
|
|
valuationDOS.addAll(valuationListMap.get(priceDate));
|
|
weekNavListMap.put(weekOfYear,valuationDOS);
|
|
weekNavListMap.put(weekOfYear,valuationDOS);
|
|
}else{
|
|
}else{
|
|
- List<ValuationTableDO> valuationDOS = new ArrayList<>();
|
|
|
|
|
|
+ List<FundPositionDetailDO> valuationDOS = new ArrayList<>();
|
|
valuationDOS.addAll(valuationListMap.get(priceDate));
|
|
valuationDOS.addAll(valuationListMap.get(priceDate));
|
|
weekNavListMap.put(weekOfYear,valuationDOS);
|
|
weekNavListMap.put(weekOfYear,valuationDOS);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Map<Integer,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> e.getYearWeek()));
|
|
Map<Integer,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> e.getYearWeek()));
|
|
for(Integer weekOfYear : tradeListMap.keySet()){
|
|
for(Integer weekOfYear : tradeListMap.keySet()){
|
|
- List<ValuationTableDO> valuationDOS = weekNavListMap.get(weekOfYear);
|
|
|
|
|
|
+ List<FundPositionDetailDO> valuationDOS = weekNavListMap.get(weekOfYear);
|
|
if(weekNavListMap.containsKey(weekOfYear)){
|
|
if(weekNavListMap.containsKey(weekOfYear)){
|
|
for(TradeDateDO tradeDateDO : tradeListMap.get(weekOfYear)){
|
|
for(TradeDateDO tradeDateDO : tradeListMap.get(weekOfYear)){
|
|
String tradeDate = DateUtils.format(tradeDateDO.getTradeDate(),DateUtils.YYYY_MM_DD);
|
|
String tradeDate = DateUtils.format(tradeDateDO.getTradeDate(),DateUtils.YYYY_MM_DD);
|
|
@@ -527,7 +527,7 @@ public class DeletionServiceImpl implements DeletionService {
|
|
//防止频率变更导致数据异常,需要把当前日期下所在的频率全部无效掉
|
|
//防止频率变更导致数据异常,需要把当前日期下所在的频率全部无效掉
|
|
if(StringUtil.isNotEmpty(valuationDOS)){
|
|
if(StringUtil.isNotEmpty(valuationDOS)){
|
|
for(int idx=0;idx < valuationDOS.size()-1 ; idx++){
|
|
for(int idx=0;idx < valuationDOS.size()-1 ; idx++){
|
|
- ValuationTableDO valautionDO = valuationDOS.get(idx);
|
|
|
|
|
|
+ FundPositionDetailDO valautionDO = valuationDOS.get(idx);
|
|
String tradeDate = DateUtils.format(valautionDO.getValuationDate(),DateUtils.YYYY_MM_DD);
|
|
String tradeDate = DateUtils.format(valautionDO.getValuationDate(),DateUtils.YYYY_MM_DD);
|
|
deletionInfoMapper.deleteDeletionRemark(fundId,DeletionType.VALUATION_DELETION.getCode(),tradeDate);
|
|
deletionInfoMapper.deleteDeletionRemark(fundId,DeletionType.VALUATION_DELETION.getCode(),tradeDate);
|
|
}
|
|
}
|
|
@@ -551,19 +551,19 @@ public class DeletionServiceImpl implements DeletionService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(Frequency.MONTH == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
if(Frequency.MONTH == Frequency.getFrequencyByCode(fundReportFrequencyDO.getValuationFrequency())){
|
|
- Map<String,List<ValuationTableDO>> valuationListMap = valuationTableDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
|
|
- TreeMap<String,List<ValuationTableDO>> monthNavListMap = new TreeMap<>();
|
|
|
|
|
|
+ Map<String,List<FundPositionDetailDO>> valuationListMap = fundPositionDetailDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getValuationDate(),DateUtils.YYYY_MM_DD)));
|
|
|
|
+ TreeMap<String,List<FundPositionDetailDO>> monthNavListMap = new TreeMap<>();
|
|
//按周数整合
|
|
//按周数整合
|
|
for(String priceDate : valuationListMap.keySet()){
|
|
for(String priceDate : valuationListMap.keySet()){
|
|
String yearMonth = priceDate.substring(0,7);
|
|
String yearMonth = priceDate.substring(0,7);
|
|
if(monthNavListMap.containsKey(yearMonth)){
|
|
if(monthNavListMap.containsKey(yearMonth)){
|
|
- List<ValuationTableDO> valuationTableDOS = monthNavListMap.get(yearMonth);
|
|
|
|
- valuationTableDOS.addAll(valuationListMap.get(priceDate));
|
|
|
|
- monthNavListMap.put(yearMonth,valuationTableDOS);
|
|
|
|
|
|
+ List<FundPositionDetailDO> fundPositionDetailDOS = monthNavListMap.get(yearMonth);
|
|
|
|
+ fundPositionDetailDOS.addAll(valuationListMap.get(priceDate));
|
|
|
|
+ monthNavListMap.put(yearMonth,fundPositionDetailDOS);
|
|
}else{
|
|
}else{
|
|
- List<ValuationTableDO> valuationTableDOS = new ArrayList<>();
|
|
|
|
- valuationTableDOS.addAll(valuationListMap.get(priceDate));
|
|
|
|
- monthNavListMap.put(yearMonth,valuationTableDOS);
|
|
|
|
|
|
+ List<FundPositionDetailDO> fundPositionDetailDOS = new ArrayList<>();
|
|
|
|
+ fundPositionDetailDOS.addAll(valuationListMap.get(priceDate));
|
|
|
|
+ monthNavListMap.put(yearMonth,fundPositionDetailDOS);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Map<String,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> e.getYearmonth()));
|
|
Map<String,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> e.getYearmonth()));
|
|
@@ -573,7 +573,7 @@ public class DeletionServiceImpl implements DeletionService {
|
|
if(yearMonth.equals(thisMonth)){
|
|
if(yearMonth.equals(thisMonth)){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- List<ValuationTableDO> valuationTableDOS = monthNavListMap.get(yearMonth);
|
|
|
|
|
|
+ List<FundPositionDetailDO> fundPositionDetailDOS = monthNavListMap.get(yearMonth);
|
|
if(monthNavListMap.containsKey(yearMonth)){
|
|
if(monthNavListMap.containsKey(yearMonth)){
|
|
for(TradeDateDO tradeDateDO : tradeListMap.get(yearMonth)){
|
|
for(TradeDateDO tradeDateDO : tradeListMap.get(yearMonth)){
|
|
String tradeDate = DateUtils.format(tradeDateDO.getTradeDate(),DateUtils.YYYY_MM_DD);
|
|
String tradeDate = DateUtils.format(tradeDateDO.getTradeDate(),DateUtils.YYYY_MM_DD);
|
|
@@ -582,9 +582,9 @@ public class DeletionServiceImpl implements DeletionService {
|
|
continue;
|
|
continue;
|
|
}else{
|
|
}else{
|
|
//防止频率变更导致数据异常,需要把当前日期下所在的频率全部无效掉
|
|
//防止频率变更导致数据异常,需要把当前日期下所在的频率全部无效掉
|
|
- if(StringUtil.isNotEmpty(valuationTableDOS)){
|
|
|
|
- for(ValuationTableDO valuationTableDO : valuationTableDOS){
|
|
|
|
- String tradeDate = DateUtils.format(valuationTableDO.getValuationDate(),DateUtils.YYYY_MM_DD);
|
|
|
|
|
|
+ if(StringUtil.isNotEmpty(fundPositionDetailDOS)){
|
|
|
|
+ for(FundPositionDetailDO fundPositionDetailDO : fundPositionDetailDOS){
|
|
|
|
+ String tradeDate = DateUtils.format(fundPositionDetailDO.getValuationDate(),DateUtils.YYYY_MM_DD);
|
|
deletionInfoMapper.deleteDeletionRemark(fundId,DeletionType.VALUATION_DELETION.getCode(),tradeDate);
|
|
deletionInfoMapper.deleteDeletionRemark(fundId,DeletionType.VALUATION_DELETION.getCode(),tradeDate);
|
|
}
|
|
}
|
|
}
|
|
}
|