Commit 908cdcf3 authored by 张亚辉's avatar 张亚辉

私募产品

parent 377a6cc5
......@@ -3,11 +3,9 @@ package com.tanpu.fund.api;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.product.req.ProductListReq;
import com.tanpu.common.model.product.resp.*;
import com.tanpu.common.model.user.resp.SysConstantResp;
import com.tanpu.common.model.product.resp.DynamicRetreatVO;
import com.tanpu.common.model.product.resp.ProductInfoVO;
import com.tanpu.common.resp.CommonResp;
import com.tanpu.fund.api.model.req.FundQaAskReq;
import com.tanpu.fund.api.model.req.FundQaListReq;
import com.tanpu.fund.api.model.req.NetReq;
import com.tanpu.fund.api.model.req.ProductInfoReq;
import com.tanpu.fund.api.model.resp.*;
......@@ -19,8 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Api(tags = "产品服务")
......@@ -58,6 +54,11 @@ public interface ProductApi {
@PostMapping("/get/net/list")
CommonResp<Page<NetVO>> getNetListInfo(@ApiParam("净值列表筛选对象") @RequestBody NetReq req);
@ApiOperation("分红配送")
@GetMapping("/bonus/ratio")
CommonResp<List<BonusRatioVO>> getBonusRatioInfo(@ApiParam("产品id") @RequestParam("id") String id);
@ApiOperation("历史业绩")
@GetMapping("/track/record")
CommonResp<List<TrackRecordVO>> getTrackRecordInfo(@ApiParam("产品id") @RequestParam("id") String id);
......
......@@ -53,6 +53,11 @@ public class ProductController implements ProductApi {
return CommonResp.success(this.productService.getNetList(req));
}
@Override
public CommonResp<List<BonusRatioVO>> getBonusRatioInfo(String id) {
return CommonResp.success(this.productService.getBonusRatio(id));
}
@Override
public CommonResp<List<TrackRecordVO>> getTrackRecordInfo(String id) {
return CommonResp.success(this.productService.getTrackRecord(id));
......
package com.tanpu.fund.entity.generator;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 基金分红
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FundDistribution {
private String id;
/**
* 基金Id
*/
private String fundId;
/**
* 分配日期
*/
private Date distributeDate;
/**
* 基金分配类型标志:-1-其他,1-分红,2-拆分 3-业绩报酬 -1-其他
*/
private Integer distributeType;
/**
* 分红/拆分比例
*/
private BigDecimal distribution;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private Integer deleteTag;
}
\ No newline at end of file
package com.tanpu.fund.mapper.generator;
import com.tanpu.fund.entity.generator.FundDistribution;
import com.tanpu.fund.entity.generator.FundDistributionExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface FundDistributionMapper {
long countByExample(FundDistributionExample example);
int deleteByExample(FundDistributionExample example);
/**
* delete by primary key
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* insert record to table
* @param record the record
* @return insert count
*/
int insert(FundDistribution record);
int insertOrUpdate(FundDistribution record);
int insertOrUpdateSelective(FundDistribution record);
/**
* insert record to table selective
* @param record the record
* @return insert count
*/
int insertSelective(FundDistribution record);
List<FundDistribution> selectByExample(FundDistributionExample example);
/**
* select by primary key
* @param id primary key
* @return object by primary key
*/
FundDistribution selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FundDistribution record, @Param("example") FundDistributionExample example);
int updateByExample(@Param("record") FundDistribution record, @Param("example") FundDistributionExample example);
/**
* update record selective
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(FundDistribution record);
/**
* update record
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(FundDistribution record);
int updateBatch(List<FundDistribution> list);
int batchInsert(@Param("list") List<FundDistribution> list);
}
\ No newline at end of file
......@@ -3,9 +3,7 @@ package com.tanpu.fund.service;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.product.req.ProductListReq;
import com.tanpu.common.model.product.resp.AttachmentInfoVO;
import com.tanpu.common.model.product.resp.DynamicRetreatVO;
import com.tanpu.common.model.product.resp.FundDateResp;
import com.tanpu.common.model.product.resp.ProductInfoVO;
import com.tanpu.fund.api.model.req.NetReq;
import com.tanpu.fund.api.model.req.ProductInfoReq;
......@@ -30,6 +28,8 @@ public interface ProductService {
Page<NetVO> getNetList(NetReq req);
List<BonusRatioVO> getBonusRatio(String id);
List<TrackRecordVO> getTrackRecord(String id);
Page<TrackNetVO> getTrackNetList(String id, Pageable page);
......
......@@ -8,7 +8,9 @@ import com.tanpu.common.enums.Constant;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.product.req.ProductListReq;
import com.tanpu.common.model.product.resp.*;
import com.tanpu.common.model.product.resp.DynamicRetreatVO;
import com.tanpu.common.model.product.resp.Net;
import com.tanpu.common.model.product.resp.ProductInfoVO;
import com.tanpu.common.utils.BigDecimalUtil;
import com.tanpu.fund.api.model.FundInfoVO;
import com.tanpu.fund.api.model.req.NetReq;
......@@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -78,6 +81,9 @@ public class ProductServiceImpl implements ProductService, Constant {
@Resource
private FundRateMappingMapper fundRateMappingMapper;
@Resource
private FundDistributionMapper fundDistributionMapper;
@Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
......@@ -430,6 +436,25 @@ public class ProductServiceImpl implements ProductService, Constant {
fundCounts.stream().map(f -> getNetVO(infoMap, f)).collect(Collectors.toList()));
}
@Override
public List<BonusRatioVO> getBonusRatio(String id) {
FundDistributionExample example = new FundDistributionExample();
example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM);
example.setOrderByClause("distribute_date desc");
List<FundDistribution> list = this.fundDistributionMapper.selectByExample(example);
return list.stream().filter(
l -> l.getDistributeDate() != null && (l.getDistributeType() == 1 || l.getDistributeType() == 2))
.map(l -> {
BonusRatioVO vo = new BonusRatioVO();
vo.setType(l.getDistributeType());
vo.setTime(l.getDistributeDate().getTime());
if (l.getDistribution() != null) {
vo.setDistribution(l.getDistribution().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
return vo;
}).collect(Collectors.toList());
}
private NetVO getNetVO(Map<String, FundInfo> infoMap, FundCount f) {
NetVO netVO = new NetVO();
netVO.setProductId(f.getFundId());
......@@ -1010,7 +1035,7 @@ public class ProductServiceImpl implements ProductService, Constant {
// 查询研报信息是否有研报
Map<String, Object> fundInfoReport = getFundReport(Lists.newArrayList(fundInfoMap.keySet()));
return fundCounts.stream().map(p -> getProductInfoVO(fundInfoMap, rateMappingMap, p,fundInfoReport.keySet()))
return fundCounts.stream().map(p -> getProductInfoVO(fundInfoMap, rateMappingMap, p, fundInfoReport.keySet()))
.collect(Collectors.toList());
}
......
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