Commit 89141ee9 authored by 张亚辉's avatar 张亚辉

私有基金

parent 176a1ed9
......@@ -94,4 +94,12 @@ public interface ProductApi {
@ApiOperation("动态回撤")
@GetMapping("/dynamic/retreat")
CommonResp<DynamicRetreatVO> getDynamicRetreatInfo(@RequestParam("id") String id);
@ApiOperation("私有基金详情")
@GetMapping("/privatefund/detail")
CommonResp<PrivateFundDetailResp> getPrivateDetail(@RequestParam("id") String id);
@ApiOperation("私有基金历史业绩")
@GetMapping("/privatefund/historyprofit")
CommonResp<PrivateHistoryprofitResp> getHistoryprofit(@RequestParam("id") String id);
}
package com.tanpu.fund.api.model.resp;
import com.tanpu.common.model.product.resp.Net;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: zyh
* @date: 2021-02-05 5:23 下午
* @description:
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PrivateFundDetailResp {
@ApiModelProperty("基金ID")
private String fundId;
@ApiModelProperty("基金名称")
private String fundName;
@ApiModelProperty("近一年收益")
private String near1YearProfit;
@ApiModelProperty("最新净值")
private Net net;
}
package com.tanpu.fund.api.model.resp;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: zyh
* @date: 2021-02-05 5:46 下午
* @description:
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PrivateHistoryprofitResp {
@ApiModelProperty("基金ID")
private String fundId;
@ApiModelProperty("近三月收益")
private String ret3m;
@ApiModelProperty("近半年收益")
private String ret6m;
@ApiModelProperty("近一年收益")
private String ret1y;
@ApiModelProperty("近两年收益")
private String ret2y;
@ApiModelProperty("近三年收益")
private String ret3y;
@ApiModelProperty("近四年收益")
private String ret4y;
@ApiModelProperty("近五年收益")
private String ret5y;
@ApiModelProperty("成立以来收益")
private String retIncep;
}
......@@ -104,4 +104,14 @@ public class ProductController implements ProductApi {
public CommonResp<DynamicRetreatVO> getDynamicRetreatInfo(String id) {
return CommonResp.success(this.productService.getDynamicRetreat(id));
}
@Override
public CommonResp<PrivateFundDetailResp> getPrivateDetail(String id) {
return CommonResp.success(this.productService.getPrivateDetail(id));
}
@Override
public CommonResp<PrivateHistoryprofitResp> getHistoryprofit(String id) {
return CommonResp.success(this.productService.getHistoryprofit(id));
}
}
......@@ -48,4 +48,7 @@ public interface ProductService {
DynamicRetreatVO getDynamicRetreat(String id);
PrivateFundDetailResp getPrivateDetail(String id);
PrivateHistoryprofitResp getHistoryprofit(String id);
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.page.PageMethod;
import com.google.common.collect.Lists;
import com.tanpu.common.enums.BizEnums;
import com.tanpu.common.enums.Constant;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
......@@ -84,6 +85,11 @@ public class ProductServiceImpl implements ProductService, Constant {
@Resource
private FundDistributionMapper fundDistributionMapper;
@Resource
private IfaImportedFundInfoMapper ifaImportedFundInfoMapper;
@Resource
private IfaImportedFundNavMapper ifaImportedFundNavMapper;
@Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
......@@ -1247,4 +1253,60 @@ public class ProductServiceImpl implements ProductService, Constant {
return vo;
}
@Override
public PrivateFundDetailResp getPrivateDetail(String id) {
IfaImportedFundInfo fundInfo = ifaImportedFundInfoMapper.selectByPrimaryKey(id);
//查询收益率
FundCountExample example = new FundCountExample();
example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(BizEnums.DeleteTag.tag_init);
List<FundCount> fundCountList = fundCountMapper.selectByExample(example);
//查询净值
PageMethod.startPage(1, 1);
IfaImportedFundNavExample navExample = new IfaImportedFundNavExample();
navExample.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(BizEnums.DeleteTag.tag_init);
navExample.setOrderByClause("price_date desc");
List<IfaImportedFundNav> navList = ifaImportedFundNavMapper.selectByExample(navExample);
PrivateFundDetailResp detailResp = PrivateFundDetailResp.builder()
.fundId(fundInfo.getId())
.fundName(fundInfo.getFundName())
.build();
if (CollectionUtils.isNotEmpty(fundCountList)) {
detailResp.setNear1YearProfit(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2));
}
if (CollectionUtils.isNotEmpty(navList)) {
detailResp.setNet(Net.builder().netDate(navList.get(0).getPriceDate().getTime())
.netValue(BigDecimalUtil.toString(navList.get(0).getNav())).build());
}
return detailResp;
}
@Override
public PrivateHistoryprofitResp getHistoryprofit(String id) {
FundCountExample example = new FundCountExample();
example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(BizEnums.DeleteTag.tag_init);
List<FundCount> fundCountList = fundCountMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(fundCountList)) {
FundCount fundCount = fundCountList.get(0);
return PrivateHistoryprofitResp.builder()
.fundId(fundCount.getFundId())
.ret3m(BigDecimalUtil.toString(fundCount.getRet3m(), 2))
.ret6m(BigDecimalUtil.toString(fundCount.getRet6m(), 2))
.ret1y(BigDecimalUtil.toString(fundCount.getRet1y(), 2))
.ret2y(BigDecimalUtil.toString(fundCount.getRet2y(), 2))
.ret3y(BigDecimalUtil.toString(fundCount.getRet3y(), 2))
.ret4y(BigDecimalUtil.toString(fundCount.getRet4y(), 2))
.ret5y(BigDecimalUtil.toString(fundCount.getRet5y(), 2))
.retIncep(BigDecimalUtil.toString(fundCount.getRetIncep(), 2))
.build();
}
return null;
}
}
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