Commit bc4ec500 authored by zp's avatar zp

aa

parent 176a1ed9
...@@ -38,6 +38,10 @@ public interface ProductApi { ...@@ -38,6 +38,10 @@ public interface ProductApi {
@GetMapping("/product/detail") @GetMapping("/product/detail")
CommonResp<ProductInfoVO> getProductDetailInfo(@ApiParam("产品id") @RequestParam("id") String id); CommonResp<ProductInfoVO> getProductDetailInfo(@ApiParam("产品id") @RequestParam("id") String id);
@ApiOperation("获取产品详情")
@GetMapping("/product/list")
CommonResp<List<ProductInfoVO>> getProductList(@ApiParam("产品id") @RequestParam("ids") List<String> ids);
@ApiOperation("单位净值") @ApiOperation("单位净值")
@GetMapping("/unit/net") @GetMapping("/unit/net")
CommonResp<UnitNetVO> getUnitNetInfo(@ApiParam("产品id") @RequestParam("id") String id, @ApiParam("对比基金id") @RequestParam(value = "ratioId", required = false) String ratioId, CommonResp<UnitNetVO> getUnitNetInfo(@ApiParam("产品id") @RequestParam("id") String id, @ApiParam("对比基金id") @RequestParam(value = "ratioId", required = false) String ratioId,
......
...@@ -38,6 +38,11 @@ public class ProductController implements ProductApi { ...@@ -38,6 +38,11 @@ public class ProductController implements ProductApi {
return CommonResp.success(this.productService.getProductDetail(id)); return CommonResp.success(this.productService.getProductDetail(id));
} }
@Override
public CommonResp<List<ProductInfoVO>> getProductList(List<String> ids) {
return CommonResp.success(this.productService.getProductList(ids));
}
@Override @Override
public CommonResp<UnitNetVO> getUnitNetInfo(String id, String ratioId, String type) { public CommonResp<UnitNetVO> getUnitNetInfo(String id, String ratioId, String type) {
return CommonResp.success(this.productService.getUnitNet(id, ratioId, type)); return CommonResp.success(this.productService.getUnitNet(id, ratioId, type));
......
...@@ -20,6 +20,8 @@ public interface ProductService { ...@@ -20,6 +20,8 @@ public interface ProductService {
ProductInfoVO getProductDetail(String id); ProductInfoVO getProductDetail(String id);
List<ProductInfoVO> getProductList(List<String> ids);
Page<ProductInfoVO> getNotTanpuProduct(ProductInfoReq req); Page<ProductInfoVO> getNotTanpuProduct(ProductInfoReq req);
UnitNetVO getUnitNet(String id, String ratioId, String type); UnitNetVO getUnitNet(String id, String ratioId, String type);
......
...@@ -162,6 +162,44 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -162,6 +162,44 @@ public class ProductServiceImpl implements ProductService, Constant {
return vo; return vo;
} }
@Override
public List<ProductInfoVO> getProductList(List<String> ids) {
List<ProductInfoVO> vos = new ArrayList<>();
FundInfoExample example = new FundInfoExample();
example.createCriteria().andIdIn(ids).andDeleteTagEqualTo(ZERO_NUM);
List<FundInfo> infos = this.fundInfoMapper.selectByExample(example);
if (CollectionUtils.isEmpty(infos)) {
return new ArrayList<>(0);
}
FundCountExample example1 = new FundCountExample();
example1.createCriteria().andFundIdIn(ids);
List<FundCount> fundCounts = this.fundCountMapper.selectByExample(example1);
Map<String, FundCount> fundCountMap = fundCounts.stream().collect(Collectors.toMap(FundCount::getFundId, s -> s, (oldValue, newValue) -> newValue));
infos.forEach(info -> {
ProductInfoVO vo = new ProductInfoVO();
if (fundCountMap.containsKey(info.getId())) {
FundCount fundCount = fundCounts.get(0);
vo.setRet1m(multiply100(fundCount.getRet1m()));
}
BeanUtils.copyProperties(info, vo);
vo.setProductName(info.getFundShortName());
vo.setDesc(info.getDescInfo());
// 最新净值
vo.setNet(getNewNet(info.getId()));
vos.add(vo);
});
return vos;
}
@Override @Override
public Page<ProductInfoVO> getNotTanpuProduct(ProductInfoReq req) { public Page<ProductInfoVO> getNotTanpuProduct(ProductInfoReq req) {
......
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