Commit 5b633179 authored by liwenbin's avatar liwenbin

资方列表获取切换到C库

parent 3e177b16
...@@ -37,7 +37,7 @@ public class FundModuleController { ...@@ -37,7 +37,7 @@ public class FundModuleController {
@RequestMapping("/get_all_funds") @RequestMapping("/get_all_funds")
public GlobalResponse getAllFunds() { public GlobalResponse getAllFunds() {
Stopwatch stopwatch = Stopwatch.createStarted(); Stopwatch stopwatch = Stopwatch.createStarted();
GlobalResponse response = fundModuleService.getAllFundsInfo(); GlobalResponse response = fundModuleService.getMiddleOfficeAllFundsInfo();
log.info("资方模块接口, 获取所有资方信息完成, 耗时 : {}, response : {}", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS), JSON.toJSONString(response)); log.info("资方模块接口, 获取所有资方信息完成, 耗时 : {}, response : {}", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS), JSON.toJSONString(response));
return response; return response;
} }
......
package com.quantgroup.asset.distribution.model.entity.fund; package com.quantgroup.asset.distribution.model.entity.fund;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import lombok.Data; import lombok.Data;
...@@ -19,6 +20,8 @@ public class FundInfo implements Serializable{ ...@@ -19,6 +20,8 @@ public class FundInfo implements Serializable{
// 资方Id // 资方Id
private Long fundId; private Long fundId;
private List<FundProductInfo> fundProductList;
// 资方名称 // 资方名称
private String fundName; private String fundName;
...@@ -28,4 +31,12 @@ public class FundInfo implements Serializable{ ...@@ -28,4 +31,12 @@ public class FundInfo implements Serializable{
// 注意事项 // 注意事项
private String remarks; private String remarks;
@Data
public static class FundProductInfo {
private Long fundProductId;
private String fundProductRemark;
}
} }
...@@ -14,10 +14,18 @@ import java.util.List; ...@@ -14,10 +14,18 @@ import java.util.List;
public interface IFundModuleService { public interface IFundModuleService {
/** /**
* 2020-6-8切换到中台新接口,C库,包含所有的资方列表
* 获取所有资方信息 * 获取所有资方信息
* @return * @return
*/ */
@Deprecated
public GlobalResponse getAllFundsInfo(); public GlobalResponse getAllFundsInfo();
/**
* 中台新接口,获取资方列表相关信息
* @return
*/
public GlobalResponse getMiddleOfficeAllFundsInfo();
/** /**
* 获取资方配置所有条件类型, 以及对应的code * 获取资方配置所有条件类型, 以及对应的code
......
...@@ -75,6 +75,8 @@ public class FundModuleServiceImpl implements IFundModuleService{ ...@@ -75,6 +75,8 @@ public class FundModuleServiceImpl implements IFundModuleService{
private IRuleService ruleService; private IRuleService ruleService;
@Value("${clotho.url}") @Value("${clotho.url}")
private String clothoURL; private String clothoURL;
@Value("${mo-config.url}")
private String moConfigURL;
@HandleException @HandleException
@Override @Override
...@@ -99,6 +101,44 @@ public class FundModuleServiceImpl implements IFundModuleService{ ...@@ -99,6 +101,44 @@ public class FundModuleServiceImpl implements IFundModuleService{
return GlobalResponse.create(FundModuleResponse.SUCCESS, fundInfoList); return GlobalResponse.create(FundModuleResponse.SUCCESS, fundInfoList);
} }
@HandleException
@Override
public GlobalResponse getMiddleOfficeAllFundsInfo() {
Stopwatch stopwatch = Stopwatch.createStarted();
String text = httpService.get(moConfigURL + "/finance/fund_product");
log.info("拉取xyqb所有资方信息完成, 耗时 : {}, 结果 : {}", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS), text);
QGPreconditions.checkArgument(StringUtils.isNotEmpty(text), QGExceptionType.GET_ALL_FUNDS_INFO_ERROR, text);
JSONObject data = JSONObject.parseObject(text);
QGPreconditions.checkArgument(data != null && "0".equals(data.getString("code")), QGExceptionType.GET_ALL_FUNDS_INFO_ERROR, text);
List<FundInfo> fundInfoList = new ArrayList<>();
JSONArray fundsArray = data.getJSONArray("data");
for (int i = 0, len = fundsArray.size(); i < len; ++i) {
JSONObject fundInfoJSON = fundsArray.getJSONObject(i);
FundInfo fundInfo = new FundInfo();
fundInfo.setFundId(fundInfoJSON.getLong("fundCorpId"));
fundInfo.setFundName(fundInfoJSON.getString("fundCorpName"));
fundInfo.setStrategyName(fundInfoJSON.getString("fundCorpStrategyName"));
// 该资方产品id
List<FundInfo.FundProductInfo> fundProductInfoList = new ArrayList<>();
JSONArray fundProductArray = fundInfoJSON.getJSONArray("fundProductList");
if (fundProductArray != null && fundProductArray.size() != 0) {
for (int j = 0, lenP = fundProductArray.size(); j < lenP; ++j) {
JSONObject fundProductJSON = fundProductArray.getJSONObject(j);
FundInfo.FundProductInfo fundProductInfo = new FundInfo.FundProductInfo();
fundProductInfo.setFundProductId(fundProductJSON.getLong("fundProductId"));
fundProductInfo.setFundProductRemark(fundProductJSON.getString("fundProductRemark"));
fundProductInfoList.add(fundProductInfo);
}
}
fundInfo.setFundProductList(fundProductInfoList);
fundInfoList.add(fundInfo);
}
return GlobalResponse.create(FundModuleResponse.SUCCESS, fundInfoList);
}
@HandleException @HandleException
@Override @Override
public GlobalResponse getAllLimitType() { public GlobalResponse getAllLimitType() {
......
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