|
@@ -0,0 +1,101 @@
|
|
|
+//package com.simuwang.manage.task;
|
|
|
+//
|
|
|
+//import com.simuwang.base.common.enums.DeletionType;
|
|
|
+//import com.simuwang.base.common.enums.Frequency;
|
|
|
+//import com.simuwang.base.common.util.DateUtils;
|
|
|
+//import com.simuwang.base.common.util.StringUtil;
|
|
|
+//import com.simuwang.base.mapper.*;
|
|
|
+//import com.simuwang.base.pojo.dos.DeletionInfoDO;
|
|
|
+//import com.simuwang.base.pojo.dos.FundReportFrequencyDO;
|
|
|
+//import com.simuwang.base.pojo.dos.NavDO;
|
|
|
+//import com.simuwang.base.pojo.dos.TradeDateDO;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
+//import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//
|
|
|
+//import java.util.List;
|
|
|
+//import java.util.Map;
|
|
|
+//import java.util.stream.Collectors;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * FileName: FundDeletionTask
|
|
|
+// * Author: chenjianhua
|
|
|
+// * Date: 2024/9/18 22:43
|
|
|
+// * Description: ${DESCRIPTION}
|
|
|
+// */
|
|
|
+//@EnableScheduling
|
|
|
+//@Component
|
|
|
+//public class FundDeletionTask {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private NavMapper navMapper;
|
|
|
+// @Autowired
|
|
|
+// private FundInfoMapper fundInfoMapper;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private FundReportFrequencyMapper fundReportFrequencyMapper;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private TradeDateMapper tradeDateMapper;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private DeletionInfoMapper deletionInfoMapper;
|
|
|
+// @Scheduled(cron = "0 0 0/2 * * ?")
|
|
|
+// public void computeDeletion(){
|
|
|
+// List<String> fundIdList = navMapper.getAllFundId();
|
|
|
+// for(String fundId : fundIdList){
|
|
|
+// String inceptionDate = fundInfoMapper.getInceptionDateByFundId(fundId);
|
|
|
+// if(inceptionDate == null){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// String today = DateUtils.getAroundToday(0);
|
|
|
+// //获取基金对应的净值报送频率
|
|
|
+// FundReportFrequencyDO fundReportFrequencyDO = fundReportFrequencyMapper.getFrequencyByFundId(fundId);
|
|
|
+// if(StringUtil.isNull(fundReportFrequencyDO)){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// List<NavDO> navDOList = navMapper.selectNavByFundId(fundId);
|
|
|
+// //查询成立日到今天为止的交易日集合
|
|
|
+// List<TradeDateDO> tradeDateDOList = tradeDateMapper.selectTradeDate(inceptionDate,today);
|
|
|
+// //只处理日月季频率
|
|
|
+// if(Frequency.DAY == Frequency.getFrequencyByCode(fundReportFrequencyDO.getNavFrequency())){
|
|
|
+// Map<String,List<NavDO>> navListMap = navDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getPriceDate(),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()){
|
|
|
+// if(navListMap.containsKey(tradeDate)){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// //写入缺失信息表
|
|
|
+// saveDeletionInfoDO(fundId,tradeDate,DeletionType.NAV_DELETION.getCode());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(Frequency.WEEK == Frequency.getFrequencyByCode(fundReportFrequencyDO.getNavFrequency())){
|
|
|
+// Map<String,List<NavDO>> navListMap = navDOList.stream().collect(Collectors.groupingBy(e -> DateUtils.format(e.getPriceDate(),DateUtils.YYYY_MM_DD)));
|
|
|
+//
|
|
|
+// Map<Integer,List<TradeDateDO>> tradeListMap = tradeDateDOList.stream().collect(Collectors.groupingBy(e -> e.getWeekOfYear()));
|
|
|
+// for(Integer weekOfYear : tradeListMap.keySet()){
|
|
|
+// if(navListMap.containsKey(tradeDate)){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// //写入缺失信息表
|
|
|
+// saveDeletionInfoDO(fundId,tradeDate,DeletionType.NAV_DELETION.getCode());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private void saveDeletionInfoDO(String fundId, String tradeDate, Integer code) {
|
|
|
+// DeletionInfoDO deletionInfoDO = new DeletionInfoDO();
|
|
|
+// deletionInfoDO.setFundId(fundId);
|
|
|
+// deletionInfoDO.setDeletionDate(tradeDate);
|
|
|
+// deletionInfoDO.setDeletionType(code);
|
|
|
+// DeletionInfoDO oldDeletionDO = deletionInfoMapper.getDeletionInfoDO(deletionInfoDO);
|
|
|
+// if(StringUtil.isNull(oldDeletionDO)){
|
|
|
+// deletionInfoDO.setIsvalid(1);
|
|
|
+// deletionInfoDO.setUpdateTime(DateUtils.getNowDate());
|
|
|
+// deletionInfoDO.setCreateTime(DateUtils.getNowDate());
|
|
|
+// deletionInfoMapper.saveDeletionInfoDO(deletionInfoDO);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|