Commit c7d8df64 authored by zp's avatar zp

自选

parent 85b9a431
......@@ -127,11 +127,13 @@ public interface ProductApi {
@ApiOperation("基金公司 - 私有基金")
@GetMapping("/private/fund/company")
CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(@ApiParam("基金公司id") @RequestParam("id") String id,
@ApiParam(value = "理财师id") @RequestParam(required = false) String ifaId,
@ApiParam("分页对象") Pageable page);
@ApiOperation("基金经理 - 私有基金")
@GetMapping("/private/fund/manager")
CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(@ApiParam("产品id") @RequestParam("id") String id);
CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(@ApiParam("产品id") @RequestParam("id") String id,
@ApiParam("理财师id") @RequestParam(value = "ifaId", required = false) String ifaId);
@ApiOperation("分红配送 - 私有基金")
@GetMapping("/private/bonus/ratio")
......
......@@ -168,8 +168,8 @@ public class ProductController implements ProductApi {
}
@Override
public CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(String id, Pageable page) {
return CommonResp.success(this.productPrivateService.getFundCompany(id, page));
public CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(String id, String ifaId, Pageable page) {
return CommonResp.success(this.productPrivateService.getFundCompany(id, ifaId, page));
}
@Override
......@@ -178,8 +178,8 @@ public class ProductController implements ProductApi {
}
@Override
public CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(String id) {
return CommonResp.success(this.productPrivateService.getFundManager(id));
public CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(String id, String ifaId) {
return CommonResp.success(this.productPrivateService.getFundManager(id, ifaId));
}
......
package com.tanpu.fund.feign.diagnose;
import com.tanpu.common.model.product.req.ExternalReq;
import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -17,4 +18,8 @@ public interface FeignClientForDiagnose {
@ApiOperation("是否加入了自选")
@PostMapping("/fund/collect")
CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") @RequestBody List<String> ids);
@ApiOperation("是否加入了自选")
@PostMapping("/fund/ifa/collect")
CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") ExternalReq req);
}
package com.tanpu.fund.feign.diagnose;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.model.product.req.ExternalReq;
import com.tanpu.common.resp.CommonResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -23,6 +24,13 @@ public class FeignbackForDiagnose implements FallbackFactory<FeignClientForDiagn
log.error("FeignClientForDiagnose.getFundCollectInfo 基金 收藏信息:{}", JSON.toJSONString(ids));
return null;
}
@Override
public CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") ExternalReq req) {
log.error("请求信息", throwable);
log.error("FeignClientForDiagnose.getFundCollectInfo 基金 收藏信息:{}", JSON.toJSONString(req));
return null;
}
};
}
......
......@@ -49,11 +49,11 @@ public interface ProductPrivateService {
List<RiskRatingVO> getRiskRating(String id);
List<FundManagerVO> getFundManager(String id);
List<FundManagerVO> getFundManager(String id,String ifaId);
FundRecordVO getFundRecord(String id);
FundCompanyVO getFundCompany(String id, Pageable page);
FundCompanyVO getFundCompany(String id, String ifaId, Pageable page);
FundCompanyVO getPrivateFundCompany(String id);
......
......@@ -2,10 +2,12 @@ package com.tanpu.fund.service.impl;
import com.github.pagehelper.page.PageMethod;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.tanpu.common.enums.Constant;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.product.FundInfoVO;
import com.tanpu.common.model.product.req.ExternalReq;
import com.tanpu.common.model.product.req.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq;
import com.tanpu.common.model.product.req.ProductListReq;
......@@ -25,7 +27,6 @@ import com.tanpu.common.model.product.resp.TrackRecordVO;
import com.tanpu.common.model.product.resp.UnitNetVO;
import com.tanpu.common.model.tanpuroom.Type;
import com.tanpu.common.utils.BigDecimalUtil;
import com.tanpu.common.utils.PageUtils;
import com.tanpu.fund.entity.generator.CompanyInfo;
import com.tanpu.fund.entity.generator.CompanyTnaPersonnel;
import com.tanpu.fund.entity.generator.CompanyTnaPersonnelExample;
......@@ -42,6 +43,7 @@ import com.tanpu.fund.entity.generator.PersonCompanyPositionMappingExample;
import com.tanpu.fund.entity.generator.PersonnelInfo;
import com.tanpu.fund.entity.generator.PersonnelInfoExample;
import com.tanpu.fund.enums.ProTypeEnums;
import com.tanpu.fund.feign.diagnose.FeignClientForDiagnose;
import com.tanpu.fund.mapper.generator.CompanyInfoMapper;
import com.tanpu.fund.mapper.generator.CompanyTnaPersonnelMapper;
import com.tanpu.fund.mapper.generator.FundCountMapper;
......@@ -53,15 +55,17 @@ import com.tanpu.fund.mapper.generator.PersonnelInfoMapper;
import com.tanpu.fund.service.ProductPrivateService;
import com.tanpu.fund.utils.LongUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.tanpu.common.utils.BigDecimalUtil.multiply100;
......@@ -114,6 +118,9 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
@Resource
private PersonCompanyPositionMappingMapper personCompanyPositionMappingMapper;
@Resource
private FeignClientForDiagnose diagnose;
@Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
return null;
......@@ -182,7 +189,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
}
@Override
public List<FundManagerVO> getFundManager(String id) {
public List<FundManagerVO> getFundManager(String id, String ifaId) {
FundManagerMappingExample example = new FundManagerMappingExample();
example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM);
example.setOrderByClause("update_time desc");
......@@ -224,6 +231,14 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
example1.createCriteria().andIdIn(list).andDeleteTagEqualTo(ZERO_NUM);
List<PersonnelInfo> infos = this.personnelInfoMapper.selectByExampleWithBLOBs(example1);
Set<String> isCheckSet;
if (StringUtils.isEmpty(ifaId)) {
isCheckSet = new HashSet<>(0);
} else {
isCheckSet = Sets.newHashSet(diagnose.getFundCollectInfo(ExternalReq.builder().ids(fundIds).ifaId(ifaId).build()).getAttributes());
}
// 基金经理
return infos.stream().map(i -> {
FundManagerVO vo = new FundManagerVO();
......@@ -233,6 +248,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
vo.setPersonalProfile(i.getProfile());
vo.setEducation(i.getEducation());
List<FundManagerMapping> managerMappingList = map.get(i.getId());
if (CollectionUtils.isNotEmpty(managerMappingList)) {
String fundId = managerMappingList.get(0).getFundId();
......@@ -240,6 +256,11 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
if (managerMappingList.get(0).getManagementStartDate() != null) {
vo.setManagementStartDate(managerMappingList.get(0).getManagementStartDate().getTime());
}
vo.setIsCheck(0);
if (isCheckSet.contains(vo.getId())) {
vo.setIsCheck(1);
}
FundInfo info = infoMap.get(fundId);
vo.setFundName(info.getFundShortName());
vo.setRatioId(info.getPrimaryBenchmarkId());
......@@ -316,7 +337,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
}
@Override
public FundCompanyVO getFundCompany(String id, Pageable page) {
public FundCompanyVO getFundCompany(String id, String ifaId, Pageable page) {
CompanyInfo companyInfo = this.companyInfoMapper.selectByPrimaryKey(id);
if (companyInfo == null) {
return new FundCompanyVO();
......@@ -351,6 +372,14 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
// 其他基金信息
otherFundInfo(vo, id, page);
if (StringUtils.isEmpty(ifaId)) {
vo.setIsCheck(0);
} else {
Set<String> checkSet = Sets.newHashSet(diagnose.getFundCollectInfo(ExternalReq.builder().ids(Lists.newArrayList(vo.getFundId())).ifaId(ifaId).build()).getAttributes());
vo.setIsCheck(checkSet.contains(vo.getFundId()) ? 1 : 0);
}
return vo;
}
......
......@@ -1375,7 +1375,7 @@ public class ProductServiceImpl implements ProductService, Constant {
detailResp.setRet1y(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2));
detailResp.setRetYtd(BigDecimalUtil.toString(fundCountList.get(0).getRetYtd(), 2));
detailResp.setNet(Net.builder().netDate(fundCountList.get(0).getPriceDate().getTime())
.netValue(BigDecimalUtil.toString(fundCountList.get(0).getNetNav())).build());
.netValue(BigDecimalUtil.toString(fundCountList.get(0).getNetNav(), 4)).build());
}
//子策略名称
......
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