Commit f433dfcf authored by 张亚辉's avatar 张亚辉

基金详情

parent 08498a8f
package com.tanpu.fund.feign.user;
import com.tanpu.common.model.product.resp.ProductLabel;
import com.tanpu.common.model.product.resp.UserInfoVo;
import com.tanpu.common.model.user.resp.ColumnVO;
import com.tanpu.common.model.user.resp.SysConstantResp;
import com.tanpu.common.resp.CommonResp;
import feign.Headers;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
//@FeignClient(value = "fatools", fallbackFactory = FeignbackForFatools.class, url = "http://127.0.0.1:8189/fatools")
@FeignClient(value = "fatools", contextId = "fatoolsUser", fallbackFactory = FeignbackForFatools.class, path = "/fatools")
public interface FeignClientForFatools {
@PostMapping(value = "/h6/userinfo/queryinfos")
@Headers({"Content-Type: application/json"})
CommonResp<ArrayList<UserInfoVo>> queryUsersList(List<String> userIds);
@GetMapping(value = "/h5/tag/querybyrelid", produces = {"application/json"})
CommonResp<List<ProductLabel>> querytagbyrelid(@RequestParam("relId") String relId);
@GetMapping(value = "/h5/sysconstant/queryByconstantGroup", produces = {"application/json"})
CommonResp<List<SysConstantResp>> queryLabels(@RequestParam("constantGroup") String constantGroup);
@GetMapping("/column")
CommonResp<List<ColumnVO>> getColumnInfo(@RequestParam("id") String id);
@ApiOperation("批量查询标签信息")
@GetMapping("/batch/get/label")
CommonResp<Map<String, List<ProductLabel>>> batchGetLabelByIdInfo(@RequestParam("list")@Valid @NotEmpty List<String> list);
}
package com.tanpu.fund.feign.user;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.model.product.resp.ProductLabel;
import com.tanpu.common.model.product.resp.UserInfoVo;
import com.tanpu.common.model.user.resp.ColumnVO;
import com.tanpu.common.model.user.resp.SysConstantResp;
import com.tanpu.common.resp.CommonResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
public class FeignbackForFatools implements FallbackFactory<FeignClientForFatools> {
@Override
public FeignClientForFatools create(Throwable throwable) {
return new FeignClientForFatools() {
@Override
public CommonResp<ArrayList<UserInfoVo>> queryUsersList(List<String> userIds) {
log.error("请求信息", throwable);
log.error("FeignClientForUser.queryUsersList用户信息查询失败");
return null;
}
@Override
public CommonResp<List<ProductLabel>> querytagbyrelid(String relId) {
log.error("请求信息", throwable);
log.error("FeignClientForUser.querytagbyrelid 查询标签失败 relId:{}", relId);
return null;
}
@Override
public CommonResp<List<SysConstantResp>> queryLabels(String constantGroup) {
log.error("请求信息", throwable);
log.error("FeignClientForUser.queryLabels 查询标签失败 constantGroup:{}", constantGroup);
return null;
}
@Override
public CommonResp<List<ColumnVO>> getColumnInfo(String id) {
log.error("请求信息", throwable);
log.error("FeignClientForUser.getColumnInfo 查询栏目失败 id:{}", id);
return null;
}
@Override
public CommonResp<Map<String, List<ProductLabel>>> batchGetLabelByIdInfo(@Valid @NotEmpty List<String> list) {
log.error("请求信息", throwable);
log.error("FeignClientForUser.getColumnInfo 查询栏目失败 id:{}", JSON.toJSONString(list));
return null;
}
};
}
}
...@@ -7,6 +7,7 @@ import com.google.common.collect.Lists; ...@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import com.tanpu.common.auth.UserInfoThreadLocalHolder; import com.tanpu.common.auth.UserInfoThreadLocalHolder;
import com.tanpu.common.enums.BizEnums; import com.tanpu.common.enums.BizEnums;
import com.tanpu.common.enums.Constant; import com.tanpu.common.enums.Constant;
import com.tanpu.common.enums.SysConstEnums;
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;
...@@ -14,10 +15,13 @@ import com.tanpu.common.model.product.req.NetReq; ...@@ -14,10 +15,13 @@ 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;
import com.tanpu.common.model.product.resp.*; import com.tanpu.common.model.product.resp.*;
import com.tanpu.common.model.user.resp.SysConstantResp;
import com.tanpu.common.resp.CommonResp;
import com.tanpu.common.utils.BigDecimalUtil; import com.tanpu.common.utils.BigDecimalUtil;
import com.tanpu.fund.entity.generator.*; import com.tanpu.fund.entity.generator.*;
import com.tanpu.fund.enums.FilterTypeEnum; import com.tanpu.fund.enums.FilterTypeEnum;
import com.tanpu.fund.enums.ProStrategyEnums; import com.tanpu.fund.enums.ProStrategyEnums;
import com.tanpu.fund.feign.user.FeignClientForFatools;
import com.tanpu.fund.mapper.generator.*; import com.tanpu.fund.mapper.generator.*;
import com.tanpu.fund.mapper.generator.custom.FundInfoCustomMapper; import com.tanpu.fund.mapper.generator.custom.FundInfoCustomMapper;
import com.tanpu.fund.service.ProductCommonService; import com.tanpu.fund.service.ProductCommonService;
...@@ -95,6 +99,9 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -95,6 +99,9 @@ public class ProductServiceImpl implements ProductService, Constant {
@Resource @Resource
private ProductCommonService productCommonService; private ProductCommonService productCommonService;
@Resource
private FeignClientForFatools fatools;
@Override @Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) { public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
...@@ -179,6 +186,17 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -179,6 +186,17 @@ public class ProductServiceImpl implements ProductService, Constant {
vo.setManagerName(fundManagerVO.getManagerName()); vo.setManagerName(fundManagerVO.getManagerName());
} }
//子策略名称
if (vo.getSubstrategy() != null) {
CommonResp<List<SysConstantResp>> listCommonResp = this.fatools.queryLabels(SysConstEnums.TAMPSUBSTRATEGY.getConstantGroup());
if (listCommonResp.isSuccess()) {
SysConstantResp sysConstantResp = listCommonResp.getAttributes().stream().filter(item -> StringUtils.equals(String.valueOf(vo.getSubstrategy()), item.getConstantCode())).findFirst().orElse(null);
if (sysConstantResp != null) {
vo.setStrategyName(sysConstantResp.getConstantName());
}
}
}
return vo; return vo;
} }
...@@ -1197,7 +1215,8 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -1197,7 +1215,8 @@ public class ProductServiceImpl implements ProductService, Constant {
if (CollectionUtils.isNotEmpty(navs)) { if (CollectionUtils.isNotEmpty(navs)) {
net.setNetDate(navs.get(0).getPriceDate().getTime()); net.setNetDate(navs.get(0).getPriceDate().getTime());
net.setNetValue(BigDecimalUtil.toString(navs.get(0).getCumulativeNav(), 4)); net.setNetValue(BigDecimalUtil.toString(navs.get(0).getNav(), 4));
net.setCumulativeNav(BigDecimalUtil.toString(navs.get(0).getCumulativeNav(), 4));
} }
return net; return net;
} }
...@@ -1353,6 +1372,17 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -1353,6 +1372,17 @@ public class ProductServiceImpl implements ProductService, Constant {
.netValue(BigDecimalUtil.toString(fundCountList.get(0).getNetNav())).build()); .netValue(BigDecimalUtil.toString(fundCountList.get(0).getNetNav())).build());
} }
//子策略名称
if (detailResp.getSubstrategy() != null) {
CommonResp<List<SysConstantResp>> listCommonResp = this.fatools.queryLabels(SysConstEnums.TAMPSUBSTRATEGY.getConstantGroup());
if (listCommonResp.isSuccess()) {
SysConstantResp sysConstantResp = listCommonResp.getAttributes().stream().filter(item -> StringUtils.equals(String.valueOf(detailResp.getSubstrategy()), item.getConstantCode())).findFirst().orElse(null);
if (sysConstantResp != null) {
detailResp.setStrategyName(sysConstantResp.getConstantName());
}
}
}
return detailResp; return detailResp;
} }
......
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