|
@@ -11,6 +11,8 @@ import com.simuwang.base.pojo.dto.FundNavDataDTO;
|
|
|
import com.simuwang.base.pojo.dto.FundNavDeletionDTO;
|
|
|
import com.simuwang.base.pojo.dto.TradeDateDTO;
|
|
|
import com.simuwang.base.pojo.dto.competition.CompetitionBaseResultDTO;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -24,6 +26,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class FundNavService {
|
|
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(FundNavService.class);
|
|
|
+
|
|
|
private final NavMapper navMapper;
|
|
|
private final FundInfoMapper fundInfoMapper;
|
|
|
private final AssetMapper assetMapper;
|
|
@@ -46,6 +50,7 @@ public class FundNavService {
|
|
|
List<FundNavDataDTO> navDataDTOList = CollUtil.newArrayList();
|
|
|
List<NavDO> navDOList = navMapper.queryAllNav(competitionId);
|
|
|
if (CollUtil.isEmpty(navDOList)) {
|
|
|
+ log.info("无净值数据");
|
|
|
return navDataDTOList;
|
|
|
}
|
|
|
// 过滤出周频的净值点
|
|
@@ -58,16 +63,20 @@ public class FundNavService {
|
|
|
Map<String, FundAndCompanyInfoDO> fundIdCompanyNameMap = fundInfoCompanyNameList.stream().collect(Collectors.toMap(FundAndCompanyInfoDO::getFundId, v -> v));
|
|
|
List<AssetDO> assetDOList = assetMapper.queryAssetByFundId(fundIdList);
|
|
|
Map<String, List<AssetDO>> fundIdAssetMap = MapUtil.newHashMap();
|
|
|
+ log.info("查询基金规模数据");
|
|
|
if (CollUtil.isNotEmpty(assetDOList)) {
|
|
|
fundIdAssetMap = assetDOList.stream().collect(Collectors.groupingBy(AssetDO::getFundId));
|
|
|
+ log.info("fundIdAssetMap:{}",fundIdAssetMap);
|
|
|
}
|
|
|
Map<String, List<NavDO>> fundIdNavMap = navDOList.stream().collect(Collectors.groupingBy(NavDO::getFundId));
|
|
|
for (Map.Entry<String, List<NavDO>> fundIdNavEntry : fundIdNavMap.entrySet()) {
|
|
|
String fundId = fundIdNavEntry.getKey();
|
|
|
+ log.info("组装基金净值明细数据 -> 基金id:{}",fundId);
|
|
|
List<NavDO> fundNavDoList = fundIdNavEntry.getValue();
|
|
|
List<AssetDO> fundAssetDoList = fundIdAssetMap.get(fundId);
|
|
|
FundAndCompanyInfoDO fundInfoDO = fundIdCompanyNameMap.get(fundId);
|
|
|
List<FundNavDataDTO> fundNavDataDTOList = buildFundNavDataDTO(fundInfoDO, fundNavDoList, fundAssetDoList);
|
|
|
+ log.info("基金净值明细数据:{}",fundNavDataDTOList);
|
|
|
navDataDTOList.addAll(fundNavDataDTOList);
|
|
|
}
|
|
|
return navDataDTOList;
|