Commit bbc90cc9 authored by 张亚辉's avatar 张亚辉

Merge branch 'master' into dev

parents 7fde136c 2adf19c0
...@@ -30,7 +30,7 @@ public interface ProductOrderApi { ...@@ -30,7 +30,7 @@ public interface ProductOrderApi {
@ApiOperation("查询基金分红信息") @ApiOperation("查询基金分红信息")
@GetMapping("/get/fund/bounsinfo") @GetMapping("/get/fund/bounsinfo")
CommonResp<List<FundBounsResp>> getFundBounsinfo(@ApiParam("基金代码") @RequestParam("list") List<String> list, CommonResp<List<FundBounsResp>> getFundBounsinfo(@ApiParam("基金代码") @RequestParam(value = "list", required = false) List<String> list,
@ApiParam("指定日期") @RequestParam("date") String date); @ApiParam("分红除息日") @RequestParam("date") String date);
} }
...@@ -44,7 +44,7 @@ public class ProductOrderController implements ProductOrderApi { ...@@ -44,7 +44,7 @@ public class ProductOrderController implements ProductOrderApi {
@Override @Override
public CommonResp<List<FundBounsResp>> getFundBounsinfo(List<String> list, String date) { public CommonResp<List<FundBounsResp>> getFundBounsinfo(List<String> list, String date) {
if (CollectionUtils.isEmpty(list) || StringUtils.isBlank(date)) { if (StringUtils.isBlank(date)) {
return CommonResp.error(CommonResp.PARAMETER_INVALID_STATUS_CODE, CommonResp.PARAMETER_INVALID_MESSAGE); return CommonResp.error(CommonResp.PARAMETER_INVALID_STATUS_CODE, CommonResp.PARAMETER_INVALID_MESSAGE);
} }
......
...@@ -132,13 +132,19 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant { ...@@ -132,13 +132,19 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant {
@Override @Override
public List<FundBounsResp> getFundBounsinfo(List<String> list, String date) { public List<FundBounsResp> getFundBounsinfo(List<String> list, String date) {
LambdaQueryWrapper<TxFundDistribution> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TxFundDistribution> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TxFundDistribution::getExDate, date)
.eq(TxFundDistribution::getDeleteTag, BizEnums.DeleteTag.tag_init);
if (CollectionUtils.isNotEmpty(list)) {
queryWrapper.in(TxFundDistribution::getFundCode, list);
}
final List<TxFundDistribution> distributionList = this.txFundDistributionMapper final List<TxFundDistribution> distributionList = this.txFundDistributionMapper
.selectList(queryWrapper.ge(TxFundDistribution::getExDate, date) .selectList(queryWrapper);
.in(TxFundDistribution::getFundCode, list)
.eq(TxFundDistribution::getDeleteTag, BizEnums.DeleteTag.tag_init));
if (CollectionUtils.isNotEmpty(distributionList)) { if (CollectionUtils.isNotEmpty(distributionList)) {
// 查询分红权益日内基金净值 // 查询分红除息日内基金净值
TxFundNavExample fundNavExample = new TxFundNavExample(); TxFundNavExample fundNavExample = new TxFundNavExample();
fundNavExample.createCriteria() fundNavExample.createCriteria()
.andFundIdIn(distributionList.stream().map(c -> String.valueOf(c.getFundId())).collect(Collectors.toList())) .andFundIdIn(distributionList.stream().map(c -> String.valueOf(c.getFundId())).collect(Collectors.toList()))
...@@ -148,6 +154,9 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant { ...@@ -148,6 +154,9 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant {
.stream().collect(Collectors.groupingBy(TxFundNav::getFundId)); .stream().collect(Collectors.groupingBy(TxFundNav::getFundId));
return distributionList.stream().map(c -> { return distributionList.stream().map(c -> {
if (!txFundNavMap.containsKey(String.valueOf(c.getFundId()))) {
return null;
}
final FundBounsResp build = FundBounsResp.builder() final FundBounsResp build = FundBounsResp.builder()
.fundId(c.getFundId()) .fundId(c.getFundId())
.fundCode(c.getFundCode()) .fundCode(c.getFundCode())
...@@ -158,11 +167,14 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant { ...@@ -158,11 +167,14 @@ public class ProductOrderServiceImpl implements ProductOrderService, Constant {
final TxFundNav txFundNav = txFundNavMap.get(String.valueOf(c.getFundId())).stream() final TxFundNav txFundNav = txFundNavMap.get(String.valueOf(c.getFundId())).stream()
.filter(nav -> StringUtils.equals(String.valueOf(c.getFundId()), nav.getFundId()) .filter(nav -> StringUtils.equals(String.valueOf(c.getFundId()), nav.getFundId())
&& c.getExDate().getTime() == nav.getPriceDate().getTime()).findFirst().get(); && c.getExDate().getTime() == nav.getPriceDate().getTime()).findFirst().orElse(null);
if (txFundNav == null) {
return null;
}
build.setFundNet(txFundNav.getNav()); build.setFundNet(txFundNav.getNav());
return build; return build;
}).collect(Collectors.toList()); }).collect(Collectors.toList()).stream().filter(Objects::nonNull).collect(Collectors.toList());
} }
return new ArrayList<>(0); return new ArrayList<>(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment