Commit e01fddf6 authored by xiaozhe.chen's avatar xiaozhe.chen

运营系统替换中台接口

parent 446ea102
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
public interface IIceService {
JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery);
}
package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IIceService;
import cn.quantgroup.customer.service.http.IHttpService;
import cn.quantgroup.customer.util.JSONTools;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Objects;
@Slf4j
@Service("iceService")
public class IceServiceImpl implements IIceService {
@Value("${mo.ice.http}")
private String iceUrl;
private final IHttpService httpService;
@Autowired
public IceServiceImpl(IHttpService httpService) {
this.httpService = httpService;
}
@Override
public JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery) {
String logPre = "IceService.findApplyOrders";
log.info("{} 申请订单查询 applyOrderQuery={}", logPre, applyOrderQuery);
String orderNo = applyOrderQuery.getOrderNo();
Long loanId = applyOrderQuery.getLoanId();
Long userId = applyOrderQuery.getUserId();
String url = iceUrl + "/ex/customer_sys/query/applyOrder";
Map<String, Object> param = Maps.newHashMap();
if (StringUtils.isNotEmpty(orderNo)) {
param.put("orderNo", orderNo);
}
if (Objects.nonNull(userId)) {
param.put("userId", userId.toString());
}
if (Objects.nonNull(loanId)) {
param.put("loanId", loanId.toString());
}
Map<String, String> header = Maps.newHashMap();
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = httpService.post(url, header, param);
log.info("{} 用户申请订单列表 url={}, header={},param={},result={}", logPre, url, header, param, result);
if (StringUtils.isBlank(result)) {
log.error("{} 调用信用钱包失败 url={}, header={},param={},result={}", logPre, url, header, param, result);
return JsonResult.buildErrorStateResult("申请订单查询失败", null);
}
TypeReference<JsonResult<ApplyOrder>> typeToken = new TypeReference<JsonResult<ApplyOrder>>() {
};
JsonResult<ApplyOrder> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
}
...@@ -20,6 +20,7 @@ import cn.quantgroup.customer.rest.param.user.UserCombinationParam; ...@@ -20,6 +20,7 @@ import cn.quantgroup.customer.rest.param.user.UserCombinationParam;
import cn.quantgroup.customer.rest.param.user.UserQueryParam; import cn.quantgroup.customer.rest.param.user.UserQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.MoResult; import cn.quantgroup.customer.rest.vo.MoResult;
import cn.quantgroup.customer.service.IIceService;
import cn.quantgroup.customer.service.IKaService; import cn.quantgroup.customer.service.IKaService;
import cn.quantgroup.customer.service.IUserService; import cn.quantgroup.customer.service.IUserService;
import cn.quantgroup.customer.service.IXyqbService; import cn.quantgroup.customer.service.IXyqbService;
...@@ -69,14 +70,16 @@ public class UserServiceImpl implements IUserService { ...@@ -69,14 +70,16 @@ public class UserServiceImpl implements IUserService {
private final IXyqbService xyqbService; private final IXyqbService xyqbService;
private final IKaService kaService; private final IKaService kaService;
private final IIceService iceService;
@Autowired @Autowired
public UserServiceImpl(UserRepo userRepo, IHttpService httpService, UserSdkImpl userSdk, IXyqbService xyqbService, IKaService kaService) { public UserServiceImpl(UserRepo userRepo, IHttpService httpService, UserSdkImpl userSdk, IXyqbService xyqbService, IKaService kaService, IIceService iceService) {
this.userRepo = userRepo; this.userRepo = userRepo;
this.httpService = httpService; this.httpService = httpService;
this.userSdk = userSdk; this.userSdk = userSdk;
this.xyqbService = xyqbService; this.xyqbService = xyqbService;
this.kaService = kaService; this.kaService = kaService;
this.iceService = iceService;
} }
@Override @Override
...@@ -495,7 +498,9 @@ public class UserServiceImpl implements IUserService { ...@@ -495,7 +498,9 @@ public class UserServiceImpl implements IUserService {
applyOrderQuery.setLoanId(loanId); applyOrderQuery.setLoanId(loanId);
applyOrderQuery.setOrderNo(applyNo); applyOrderQuery.setOrderNo(applyNo);
//申请订单查询 //申请订单查询
JsonResult<ApplyOrder> applyOrders = xyqbService.findApplyOrders(applyOrderQuery); //JsonResult<ApplyOrder> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
//todo 替换中台接口
JsonResult<ApplyOrder> applyOrders = iceService.findApplyOrders(applyOrderQuery);
return applyOrders; return applyOrders;
} }
......
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