Commit 8e4bc1fe authored by xiaozhe.chen's avatar xiaozhe.chen

运营系统替换中台接口

parent e01fddf6
package cn.quantgroup.customer.service; package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.ApplyOrder; import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.model.order.LoanOrder;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery; import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List;
public interface IIceService { public interface IIceService {
JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery); JsonResult<ApplyOrder> findApplyOrders(ApplyOrderQuery applyOrderQuery);
JsonResult<LoanOrder> findLoanOrder(Long loanId);
JsonResult<List<FlowNode>> findFlowChart(String orderNo);
} }
package cn.quantgroup.customer.service.impl; package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.model.order.ApplyOrder; import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.model.order.LoanOrder;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery; import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IIceService; import cn.quantgroup.customer.service.IIceService;
...@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
...@@ -64,4 +67,70 @@ public class IceServiceImpl implements IIceService { ...@@ -64,4 +67,70 @@ public class IceServiceImpl implements IIceService {
JsonResult<ApplyOrder> jsonResult = JSONTools.deserialize(result, typeToken); JsonResult<ApplyOrder> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult; return jsonResult;
} }
@Override
public JsonResult<LoanOrder> findLoanOrder(Long loanId) {
String logPre = "IceService.findLoanOrder";
log.info("{} 提现订单详情 loanId={}", logPre, loanId);
String url = iceUrl + "/ex/customer_sys/loan/detail";
if (Objects.isNull(loanId)) {
log.error("{} 借款订单号为空 orderNo={}", logPre, loanId);
return JsonResult.buildErrorStateResult("借款订单号为空", null);
}
Map<String, Object> param = Maps.newHashMap();
param.put("loanId", loanId.toString());
Map<String, String> header = Maps.newHashMap();
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = null;
try {
result = httpService.post(url, header, param);
} catch (Exception e) {
log.error("{} 远程调用异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("网络异常", null);
}
if (StringUtils.isBlank(result)) {
log.error("{} 调用信用钱包失败 url={}, header={},param={},result={}", logPre, url, header, param, result);
return JsonResult.buildErrorStateResult("提现订单详情查询失败", null);
}
TypeReference<JsonResult<LoanOrder>> typeToken = new TypeReference<JsonResult<LoanOrder>>() {
};
JsonResult<LoanOrder> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
@Override
public JsonResult<List<FlowNode>> findFlowChart(String orderNo) {
String logPre = "IceService.findFlowChart";
log.info("{} 流程日志查询 orderNo={}", logPre, orderNo);
String url = iceUrl + "/ex/customer_sys/query/flow";
if (StringUtils.isEmpty(orderNo)) {
log.error("{} 申请订单号为空 orderNo={}", logPre, orderNo);
return JsonResult.buildErrorStateResult("申请订单号为空", null);
}
Map<String, Object> param = Maps.newHashMap();
param.put("orderNo", orderNo);
Map<String, String> header = Maps.newHashMap();
header.put("Content-Type", "application/x-www-form-urlencoded");
String result = null;
try {
result = httpService.post(url, header, param);
} catch (Exception e) {
log.error("{} 通讯异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("通讯异常", null);
}
if (StringUtils.isBlank(result)) {
log.error("{} 调用信用钱包失败 url={}, header={},param={},result={}", logPre, url, header, param, result);
return JsonResult.buildErrorStateResult("流程日志查询失败", null);
}
TypeReference<JsonResult<List<FlowNode>>> typeToken = new TypeReference<JsonResult<List<FlowNode>>>() {
};
JsonResult<List<FlowNode>> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
} }
...@@ -44,6 +44,10 @@ public class OrderServiceImpl implements IOrderService { ...@@ -44,6 +44,10 @@ public class OrderServiceImpl implements IOrderService {
@Autowired @Autowired
private ISidecarService sidecarService; private ISidecarService sidecarService;
@Autowired
private IIceService iceService;
@Override @Override
public JsonResult<List<FlowNode>> findFlowChart(String applyOrderNo) { public JsonResult<List<FlowNode>> findFlowChart(String applyOrderNo) {
...@@ -58,7 +62,9 @@ public class OrderServiceImpl implements IOrderService { ...@@ -58,7 +62,9 @@ public class OrderServiceImpl implements IOrderService {
log.info("{},申请订单号查询orderMapping applyOrderNo={},data={}", logPre, applyOrderNo, head); log.info("{},申请订单号查询orderMapping applyOrderNo={},data={}", logPre, applyOrderNo, head);
} }
JsonResult<List<FlowNode>> flowChart = xyqbService.findFlowChart(applyOrderNo); //JsonResult<List<FlowNode>> flowChart = xyqbService.findFlowChart(applyOrderNo);
//todo 替换中台接口
JsonResult<List<FlowNode>> flowChart = iceService.findFlowChart(applyOrderNo);
if (!flowChart.isSuccess()) { if (!flowChart.isSuccess()) {
log.error("{} 流程图查询失败 result={}", logPre, flowChart); log.error("{} 流程图查询失败 result={}", logPre, flowChart);
return flowChart; return flowChart;
...@@ -83,7 +89,9 @@ public class OrderServiceImpl implements IOrderService { ...@@ -83,7 +89,9 @@ public class OrderServiceImpl implements IOrderService {
public JsonResult<LoanOrderDetail> getLoanOrderDetail(Long loanId) { public JsonResult<LoanOrderDetail> getLoanOrderDetail(Long loanId) {
String logPre = "OrderServiceImpl.getLoanOrderDetail"; String logPre = "OrderServiceImpl.getLoanOrderDetail";
log.info("{} 提现详情 loanId={}", logPre, loanId); log.info("{} 提现详情 loanId={}", logPre, loanId);
JsonResult<LoanOrder> loanOrder = xyqbService.findLoanOrder(loanId); //JsonResult<LoanOrder> loanOrder = xyqbService.findLoanOrder(loanId);
//todo 替换中台接口
JsonResult<LoanOrder> loanOrder = iceService.findLoanOrder(loanId);
if (!loanOrder.isSuccess()) { if (!loanOrder.isSuccess()) {
log.error("{} 提现订单查询失败 loanId={}, result={}", logPre, loanId, loanOrder); log.error("{} 提现订单查询失败 loanId={}, result={}", logPre, loanId, loanOrder);
......
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