use of com.tony.billing.response.fund.DailyFundChangedResponse in project BillingDubbo by TonyJiangWJ.
the class FundHistoryValueServiceImpl method getFundChangedInfosByAssessmentDate.
@Override
public DailyFundChangedResponse getFundChangedInfosByAssessmentDate(String assessmentDate) {
DailyFundChangedResponse response = ResponseUtil.success(new DailyFundChangedResponse());
Long userId = UserIdContainer.getUserId();
List<FundInfo> userFunds = fundInfoService.listGroupedFundsByUserId(userId);
FundInfo fundInfo = new FundInfo();
fundInfo.setUserId(userId);
fundInfo.setInStore(EnumYesOrNo.YES.val());
List<FundInfo> userFundDetailList = fundInfoService.list(fundInfo);
if (CollectionUtils.isNotEmpty(userFunds)) {
List<FundHistoryValue> latestHistoryValues = mapper.getLatestFundHistoryValueByFundCodes(userFunds.stream().map(FundInfo::getFundCode).collect(Collectors.toList()), assessmentDate);
Map<String, FundHistoryValue> latestHistoryValueMap = new HashMap<>(latestHistoryValues.size());
if (CollectionUtils.isNotEmpty(latestHistoryValues)) {
latestHistoryValues.forEach(fundHistoryValue -> latestHistoryValueMap.put(fundHistoryValue.getFundCode(), fundHistoryValue));
}
response.setSummaryFundInfos(getFundChangedInfos(userFunds, latestHistoryValueMap, assessmentDate));
response.setFundDetailInfos(getFundChangedInfos(userFundDetailList, latestHistoryValueMap, assessmentDate));
response.setAssessmentDate(assessmentDate);
response.calculateIncreaseInfo();
}
return response;
}
Aggregations