Commit 033bfbad authored by 张亚辉's avatar 张亚辉

Merge branch 'v1.2.0' of 47.100.44.39:zhoupeng/tamp_fund into v1.2.0

parents 4503a5b7 ceee864e
...@@ -125,11 +125,13 @@ public interface ProductApi { ...@@ -125,11 +125,13 @@ public interface ProductApi {
@ApiOperation("基金公司 - 私有基金") @ApiOperation("基金公司 - 私有基金")
@GetMapping("/private/fund/company") @GetMapping("/private/fund/company")
CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(@ApiParam("基金公司id") @RequestParam("id") String id, CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(@ApiParam("基金公司id") @RequestParam("id") String id,
@ApiParam(value = "理财师id") @RequestParam(required = false) String ifaId,
@ApiParam("分页对象") Pageable page); @ApiParam("分页对象") Pageable page);
@ApiOperation("基金经理 - 私有基金") @ApiOperation("基金经理 - 私有基金")
@GetMapping("/private/fund/manager") @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("分红配送 - 私有基金") @ApiOperation("分红配送 - 私有基金")
@GetMapping("/private/bonus/ratio") @GetMapping("/private/bonus/ratio")
......
...@@ -169,8 +169,8 @@ public class ProductController implements ProductApi { ...@@ -169,8 +169,8 @@ public class ProductController implements ProductApi {
} }
@Override @Override
public CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(String id, Pageable page) { public CommonResp<FundCompanyVO> getPrivateFundCompanyInfo(String id, String ifaId, Pageable page) {
return CommonResp.success(this.productPrivateService.getFundCompany(id, page)); return CommonResp.success(this.productPrivateService.getFundCompany(id, ifaId, page));
} }
@Override @Override
...@@ -179,8 +179,8 @@ public class ProductController implements ProductApi { ...@@ -179,8 +179,8 @@ public class ProductController implements ProductApi {
} }
@Override @Override
public CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(String id) { public CommonResp<List<FundManagerVO>> getPrivateFundManagerInfo(String id, String ifaId) {
return CommonResp.success(this.productPrivateService.getFundManager(id)); return CommonResp.success(this.productPrivateService.getFundManager(id, ifaId));
} }
......
package com.tanpu.fund.feign.diagnose; package com.tanpu.fund.feign.diagnose;
import com.tanpu.common.model.product.req.ExternalReq;
import com.tanpu.common.resp.CommonResp; import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -17,4 +18,8 @@ public interface FeignClientForDiagnose { ...@@ -17,4 +18,8 @@ public interface FeignClientForDiagnose {
@ApiOperation("是否加入了自选") @ApiOperation("是否加入了自选")
@PostMapping("/fund/collect") @PostMapping("/fund/collect")
CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") @RequestBody List<String> ids); 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; package com.tanpu.fund.feign.diagnose;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.tanpu.common.model.product.req.ExternalReq;
import com.tanpu.common.resp.CommonResp; import com.tanpu.common.resp.CommonResp;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -23,6 +24,13 @@ public class FeignbackForDiagnose implements FallbackFactory<FeignClientForDiagn ...@@ -23,6 +24,13 @@ public class FeignbackForDiagnose implements FallbackFactory<FeignClientForDiagn
log.error("FeignClientForDiagnose.getFundCollectInfo 基金 收藏信息:{}", JSON.toJSONString(ids)); log.error("FeignClientForDiagnose.getFundCollectInfo 基金 收藏信息:{}", JSON.toJSONString(ids));
return null; 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 { ...@@ -49,11 +49,11 @@ public interface ProductPrivateService {
List<RiskRatingVO> getRiskRating(String id); List<RiskRatingVO> getRiskRating(String id);
List<FundManagerVO> getFundManager(String id); List<FundManagerVO> getFundManager(String id,String ifaId);
FundRecordVO getFundRecord(String id); FundRecordVO getFundRecord(String id);
FundCompanyVO getFundCompany(String id, Pageable page); FundCompanyVO getFundCompany(String id, String ifaId, Pageable page);
FundCompanyVO getPrivateFundCompany(String id); FundCompanyVO getPrivateFundCompany(String id);
......
package com.tanpu.fund.service.impl; package com.tanpu.fund.service.impl;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.tanpu.common.enums.Constant; import com.tanpu.common.enums.Constant;
import com.tanpu.common.model.Page; import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable; import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.product.FundInfoVO; 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.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq; import com.tanpu.common.model.product.req.ProductInfoReq;
import com.tanpu.common.model.product.req.ProductListReq; import com.tanpu.common.model.product.req.ProductListReq;
...@@ -25,7 +28,6 @@ import com.tanpu.common.model.product.resp.TrackRecordVO; ...@@ -25,7 +28,6 @@ import com.tanpu.common.model.product.resp.TrackRecordVO;
import com.tanpu.common.model.product.resp.UnitNetVO; import com.tanpu.common.model.product.resp.UnitNetVO;
import com.tanpu.common.model.tanpuroom.Type; import com.tanpu.common.model.tanpuroom.Type;
import com.tanpu.common.utils.BigDecimalUtil; 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.CompanyInfo;
import com.tanpu.fund.entity.generator.CompanyTnaPersonnel; import com.tanpu.fund.entity.generator.CompanyTnaPersonnel;
import com.tanpu.fund.entity.generator.CompanyTnaPersonnelExample; import com.tanpu.fund.entity.generator.CompanyTnaPersonnelExample;
...@@ -42,6 +44,7 @@ import com.tanpu.fund.entity.generator.PersonCompanyPositionMappingExample; ...@@ -42,6 +44,7 @@ import com.tanpu.fund.entity.generator.PersonCompanyPositionMappingExample;
import com.tanpu.fund.entity.generator.PersonnelInfo; import com.tanpu.fund.entity.generator.PersonnelInfo;
import com.tanpu.fund.entity.generator.PersonnelInfoExample; import com.tanpu.fund.entity.generator.PersonnelInfoExample;
import com.tanpu.fund.enums.ProTypeEnums; 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.CompanyInfoMapper;
import com.tanpu.fund.mapper.generator.CompanyTnaPersonnelMapper; import com.tanpu.fund.mapper.generator.CompanyTnaPersonnelMapper;
import com.tanpu.fund.mapper.generator.FundCountMapper; import com.tanpu.fund.mapper.generator.FundCountMapper;
...@@ -52,16 +55,19 @@ import com.tanpu.fund.mapper.generator.PersonCompanyPositionMappingMapper; ...@@ -52,16 +55,19 @@ import com.tanpu.fund.mapper.generator.PersonCompanyPositionMappingMapper;
import com.tanpu.fund.mapper.generator.PersonnelInfoMapper; import com.tanpu.fund.mapper.generator.PersonnelInfoMapper;
import com.tanpu.fund.service.ProductPrivateService; import com.tanpu.fund.service.ProductPrivateService;
import com.tanpu.fund.utils.LongUtil; import com.tanpu.fund.utils.LongUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.tanpu.common.utils.BigDecimalUtil.multiply100; import static com.tanpu.common.utils.BigDecimalUtil.multiply100;
...@@ -85,6 +91,7 @@ import static com.tanpu.common.utils.BigDecimalUtil.multiply100; ...@@ -85,6 +91,7 @@ import static com.tanpu.common.utils.BigDecimalUtil.multiply100;
* @email: zhoupeng_08@163.com * @email: zhoupeng_08@163.com
*/ */
@Service @Service
@Slf4j
public class ProductPrivateServiceImpl implements ProductPrivateService, Constant { public class ProductPrivateServiceImpl implements ProductPrivateService, Constant {
@Value("${company.oss.prefix}") @Value("${company.oss.prefix}")
...@@ -114,6 +121,9 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -114,6 +121,9 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
@Resource @Resource
private PersonCompanyPositionMappingMapper personCompanyPositionMappingMapper; private PersonCompanyPositionMappingMapper personCompanyPositionMappingMapper;
@Resource
private FeignClientForDiagnose diagnose;
@Override @Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) { public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
return null; return null;
...@@ -161,9 +171,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -161,9 +171,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
BonusRatioVO vo = new BonusRatioVO(); BonusRatioVO vo = new BonusRatioVO();
vo.setType(l.getDistributeType()); vo.setType(l.getDistributeType());
vo.setTime(l.getDistributeDate().getTime()); vo.setTime(l.getDistributeDate().getTime());
if (l.getDistribution() != null) { vo.setDistribution(BigDecimalUtil.toString(l.getDistribution(), 2));
vo.setDistribution(l.getDistribution().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
...@@ -184,7 +192,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -184,7 +192,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
} }
@Override @Override
public List<FundManagerVO> getFundManager(String id) { public List<FundManagerVO> getFundManager(String id, String ifaId) {
FundManagerMappingExample example = new FundManagerMappingExample(); FundManagerMappingExample example = new FundManagerMappingExample();
example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM); example.createCriteria().andFundIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM);
example.setOrderByClause("update_time desc"); example.setOrderByClause("update_time desc");
...@@ -226,6 +234,8 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -226,6 +234,8 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
example1.createCriteria().andIdIn(list).andDeleteTagEqualTo(ZERO_NUM); example1.createCriteria().andIdIn(list).andDeleteTagEqualTo(ZERO_NUM);
List<PersonnelInfo> infos = this.personnelInfoMapper.selectByExampleWithBLOBs(example1); List<PersonnelInfo> infos = this.personnelInfoMapper.selectByExampleWithBLOBs(example1);
Set<String> isCheckSet = getIsCheck(ifaId, fundIds);
// 基金经理 // 基金经理
return infos.stream().map(i -> { return infos.stream().map(i -> {
FundManagerVO vo = new FundManagerVO(); FundManagerVO vo = new FundManagerVO();
...@@ -235,6 +245,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -235,6 +245,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
vo.setPersonalProfile(i.getProfile()); vo.setPersonalProfile(i.getProfile());
vo.setEducation(i.getEducation()); vo.setEducation(i.getEducation());
List<FundManagerMapping> managerMappingList = map.get(i.getId()); List<FundManagerMapping> managerMappingList = map.get(i.getId());
if (CollectionUtils.isNotEmpty(managerMappingList)) { if (CollectionUtils.isNotEmpty(managerMappingList)) {
String fundId = managerMappingList.get(0).getFundId(); String fundId = managerMappingList.get(0).getFundId();
...@@ -242,6 +253,11 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -242,6 +253,11 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
if (managerMappingList.get(0).getManagementStartDate() != null) { if (managerMappingList.get(0).getManagementStartDate() != null) {
vo.setManagementStartDate(managerMappingList.get(0).getManagementStartDate().getTime()); vo.setManagementStartDate(managerMappingList.get(0).getManagementStartDate().getTime());
} }
vo.setIsCheck(0);
if (isCheckSet.contains(vo.getId())) {
vo.setIsCheck(1);
}
FundInfo info = infoMap.get(fundId); FundInfo info = infoMap.get(fundId);
vo.setFundName(info.getFundShortName()); vo.setFundName(info.getFundShortName());
vo.setRatioId(info.getPrimaryBenchmarkId()); vo.setRatioId(info.getPrimaryBenchmarkId());
...@@ -318,7 +334,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -318,7 +334,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
} }
@Override @Override
public FundCompanyVO getFundCompany(String id, Pageable page) { public FundCompanyVO getFundCompany(String id, String ifaId, Pageable page) {
CompanyInfo companyInfo = this.companyInfoMapper.selectByPrimaryKey(id); CompanyInfo companyInfo = this.companyInfoMapper.selectByPrimaryKey(id);
if (companyInfo == null) { if (companyInfo == null) {
return new FundCompanyVO(); return new FundCompanyVO();
...@@ -352,7 +368,17 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -352,7 +368,17 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
} }
// 其他基金信息 // 其他基金信息
otherFundInfo(vo, id, page); otherFundInfo(vo, id, ifaId, page);
vo.setIsCheck(0);
if (StringUtils.isNotEmpty(ifaId)) {
List<String> attributes = diagnose.getFundCollectInfo(ExternalReq.builder().ids(Lists.newArrayList(vo.getFundId())).ifaId(ifaId).build()).getAttributes();
if (!CollectionUtils.isEmpty(attributes)) {
Set<String> checkSet = Sets.newHashSet(attributes);
vo.setIsCheck(checkSet.contains(vo.getFundId()) ? 1 : 0);
}
}
return vo; return vo;
} }
...@@ -367,7 +393,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -367,7 +393,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
return personnelInfos.stream().collect(Collectors.toMap(PersonnelInfo::getId, s -> s)); return personnelInfos.stream().collect(Collectors.toMap(PersonnelInfo::getId, s -> s));
} }
private void otherFundInfo(FundCompanyVO vo, String id, Pageable page) { private void otherFundInfo(FundCompanyVO vo, String id, String ifaId, Pageable page) {
FundInfoExample example1 = new FundInfoExample(); FundInfoExample example1 = new FundInfoExample();
example1.createCriteria().andTrustIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM); example1.createCriteria().andTrustIdEqualTo(id).andDeleteTagEqualTo(ZERO_NUM);
...@@ -387,6 +413,9 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -387,6 +413,9 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
List<FundCount> fundCounts = this.fundCountMapper.selectByExample(example2); List<FundCount> fundCounts = this.fundCountMapper.selectByExample(example2);
if (CollectionUtils.isNotEmpty(fundCounts)) { if (CollectionUtils.isNotEmpty(fundCounts)) {
Set<String> isCheckSet = getIsCheck(ifaId, list);
fundCounts.sort(Comparator.comparing(FundCount::getRetIncep).reversed()); fundCounts.sort(Comparator.comparing(FundCount::getRetIncep).reversed());
FundCount fundCount = fundCounts.get(0); FundCount fundCount = fundCounts.get(0);
...@@ -410,6 +439,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -410,6 +439,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
FundInfoVO vo1 = new FundInfoVO(); FundInfoVO vo1 = new FundInfoVO();
String fundId = f.getFundId(); String fundId = f.getFundId();
vo1.setFundId(fundId); vo1.setFundId(fundId);
vo1.setIsCheck(isCheckSet.contains(fundId) ? 1 : 0);
vo1.setBonusTypeName(ProTypeEnums.getName(mapFundInfo.get(fundId).getFundType())); vo1.setBonusTypeName(ProTypeEnums.getName(mapFundInfo.get(fundId).getFundType()));
vo1.setBonusType(mapFundInfo.get(fundId).getFundType()); vo1.setBonusType(mapFundInfo.get(fundId).getFundType());
vo1.setRetIncep(multiply100(f.getRetIncep())); vo1.setRetIncep(multiply100(f.getRetIncep()));
...@@ -436,6 +466,27 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan ...@@ -436,6 +466,27 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
} }
} }
private Set<String> getIsCheck(String ifaId, List<String> list) {
log.info("入参信息 ifa : {},基金id : {}", ifaId, JSON.toJSONString(list));
Set<String> isCheckSet;
if (StringUtils.isEmpty(ifaId)) {
isCheckSet = new HashSet<>(0);
} else {
List<String> attributes = diagnose.getFundCollectInfo(ExternalReq.builder().ids(list).ifaId(ifaId).build()).getAttributes();
log.info("getFundCollectInfo 返回信息:{}", JSON.toJSONString(attributes));
if (CollectionUtils.isEmpty(attributes)) {
isCheckSet = new HashSet<>(0);
} else {
isCheckSet = Sets.newHashSet(attributes);
}
}
log.info("返回参数 {}", JSON.toJSONString(isCheckSet));
return isCheckSet;
}
@Override @Override
public FundCompanyVO getPrivateFundCompany(String id) { public FundCompanyVO getPrivateFundCompany(String id) {
return null; return null;
......
...@@ -533,9 +533,7 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -533,9 +533,7 @@ public class ProductServiceImpl implements ProductService, Constant {
BonusRatioVO vo = new BonusRatioVO(); BonusRatioVO vo = new BonusRatioVO();
vo.setType(l.getDistributeType()); vo.setType(l.getDistributeType());
vo.setTime(l.getDistributeDate().getTime()); vo.setTime(l.getDistributeDate().getTime());
if (l.getDistribution() != null) { vo.setDistribution(BigDecimalUtil.toString(l.getDistribution(), 2));
vo.setDistribution(l.getDistribution().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
}
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
...@@ -1377,7 +1375,7 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -1377,7 +1375,7 @@ public class ProductServiceImpl implements ProductService, Constant {
detailResp.setRet1y(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2)); detailResp.setRet1y(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2));
detailResp.setRetYtd(BigDecimalUtil.toString(fundCountList.get(0).getRetYtd(), 2)); detailResp.setRetYtd(BigDecimalUtil.toString(fundCountList.get(0).getRetYtd(), 2));
detailResp.setNet(Net.builder().netDate(fundCountList.get(0).getPriceDate().getTime()) 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