Commit a4ee531e authored by 杨钧's avatar 杨钧

Merge branch 'login' of http://git.quantgroup.cn/QG/customer-service into login

parents 305fa38c 66b0c50e
package cn.quantgroup.customer.model.order;
import lombok.Data;
/**
*
* @author Wang Xiangwei
* @version 2020/3/10
*/
@Data
public class FlowNode {
/**
* 节点标识
*/
private String node;
/**
* 节点描述
*/
private String name;
/**
* 节点备注
*/
private String remark;
/**
* 0: 未经过, 1: 已经过, 2: 当前节点, 3: 失败最终节点
*/
private Integer status;
}
package cn.quantgroup.customer.rest; package cn.quantgroup.customer.rest;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IOrderService;
import cn.quantgroup.customer.service.IXyqbService; import cn.quantgroup.customer.service.IXyqbService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,9 +23,18 @@ public class OrderRest { ...@@ -22,9 +23,18 @@ public class OrderRest {
@Autowired @Autowired
private IXyqbService xyqbService; private IXyqbService xyqbService;
@Autowired
private IOrderService orderService;
@GetMapping("/loan/{loanId}") @GetMapping("/loan/{loanId}")
public JsonResult getLoanOrderDetail(@PathVariable Long loanId){ public JsonResult getLoanOrderDetail(@PathVariable Long loanId){
return xyqbService.findLoanDetail(loanId); return xyqbService.findLoanDetail(loanId);
} }
@GetMapping("/flowchart/{orderNo}")
public JsonResult getFlowChart(@PathVariable String orderNo){
return orderService.findFlowChart(orderNo);
}
} }
...@@ -13,5 +13,7 @@ public class OrderMappingQueryParam { ...@@ -13,5 +13,7 @@ public class OrderMappingQueryParam {
private String channelOrderNo; private String channelOrderNo;
private Long channelId;
private String applyOrderNo; private String applyOrderNo;
} }
...@@ -10,6 +10,11 @@ import lombok.Data; ...@@ -10,6 +10,11 @@ import lombok.Data;
@Data @Data
public class UserCombinationParam { public class UserCombinationParam {
/**
* 渠道号
*/
private Long channelId;
/** /**
* 渠道订单号 * 渠道订单号
*/ */
......
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List;
/**
* @author Wang Xiangwei
* @version 2020/3/10
*/
public interface IOrderService{
/**
* 查看流程图
* @param applyOrderNo
* @return
*/
JsonResult<List<FlowNode>> findFlowChart(String applyOrderNo);
}
package cn.quantgroup.customer.service; package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.xyqbuser.UserBasicInfo;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneAudit; import cn.quantgroup.customer.rest.param.phone.ModifyPhoneAudit;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneFeedback; import cn.quantgroup.customer.rest.param.phone.ModifyPhoneFeedback;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneQuery; import cn.quantgroup.customer.rest.param.phone.ModifyPhoneQuery;
......
package cn.quantgroup.customer.service; package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone; import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel; import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery; import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
...@@ -7,6 +8,8 @@ import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery; ...@@ -7,6 +8,8 @@ import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery; import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List;
public interface IXyqbService { public interface IXyqbService {
String findRepayOrders(RepayOrderQuery repayOrderQuery); String findRepayOrders(RepayOrderQuery repayOrderQuery);
...@@ -23,7 +26,7 @@ public interface IXyqbService { ...@@ -23,7 +26,7 @@ public interface IXyqbService {
* @param orderNo 申请订单号 * @param orderNo 申请订单号
* @return * @return
*/ */
JsonResult findFlowChart(String orderNo); JsonResult<List<FlowNode>> findFlowChart(String orderNo);
/** /**
......
package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.rest.param.ordermapping.OrderMappingQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IKaService;
import cn.quantgroup.customer.service.IOrderService;
import cn.quantgroup.customer.service.IXyqbService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* @author Wang Xiangwei
* @version 2020/3/10
*/
@Slf4j
@Service
public class OrderServiceImpl implements IOrderService {
@Autowired
private IKaService kaService;
@Autowired
private IXyqbService xyqbService;
@Override
public JsonResult<List<FlowNode>> findFlowChart(String applyOrderNo) {
String logPre="OrderServiceImpl.findFlowChart";
log.info("{} 查询流程图 applyOrderNo={}",logPre,applyOrderNo);
OrderMappingQueryParam param = new OrderMappingQueryParam();
param.setApplyOrderNo(applyOrderNo);
JsonResult<LoanOrderMapping> orderMappingResult = kaService.findOrderMapping(param);
LoanOrderMapping head = null;
if(orderMappingResult.isSuccess()){
head = orderMappingResult.getData();
log.info("{},申请订单号查询orderMapping applyOrderNo={},data={}",logPre,applyOrderNo,head);
}
JsonResult<List<FlowNode>> flowChart = xyqbService.findFlowChart(applyOrderNo);
if(!flowChart.isSuccess()){
return flowChart;
}
List<FlowNode> flowNodeList = flowChart.getData();
if(!Objects.isNull(head)){
FlowNode flowNode = new FlowNode();
flowNode.setName("渠道用户信息导入");
flowNode.setStatus(1);
flowNode.setNode(head.getId().toString());
flowNodeList.add(0,flowNode);
}
return JsonResult.buildSuccessResult("",flowNodeList);
}
}
...@@ -187,15 +187,18 @@ public class UserServiceImpl implements IUserService { ...@@ -187,15 +187,18 @@ public class UserServiceImpl implements IUserService {
} }
if (!Objects.isNull(userCombinationParam.getLoanId()) || StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo()) || StringUtils.isNotBlank(userCombinationParam.getOrderNo())) { if (!Objects.isNull(userCombinationParam.getLoanId()) ||
StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo()) ||
StringUtils.isNotBlank(userCombinationParam.getOrderNo())) {
//通过ka获得userId然后通过userId查询 //通过ka获得userId然后通过userId查询
OrderMappingQueryParam param = new OrderMappingQueryParam(); OrderMappingQueryParam param = new OrderMappingQueryParam();
param.setApplyOrderNo(userCombinationParam.getOrderNo()); param.setApplyOrderNo(userCombinationParam.getOrderNo());
param.setChannelOrderNo(userCombinationParam.getChannelOrderNo()); param.setChannelOrderNo(userCombinationParam.getChannelOrderNo());
param.setLoanId(userCombinationParam.getLoanId()); param.setLoanId(userCombinationParam.getLoanId());
param.setChannelId(userCombinationParam.getChannelId());
JsonResult<LoanOrderMapping> orderMapping = kaService.findOrderMapping(param); JsonResult<LoanOrderMapping> orderMapping = kaService.findOrderMapping(param);
if(!orderMapping.isSuccess()){ if (!orderMapping.isSuccess() || Objects.isNull(orderMapping.getData())) {
log.error("{} 查询用户失败 param={} result={}",LOG_PRE,param,orderMapping); log.error("{} 查询用户失败 param={} result={}", LOG_PRE, param, orderMapping);
return orderMapping; return orderMapping;
} }
Long qgUserId = orderMapping.getData().getQgUserId(); Long qgUserId = orderMapping.getData().getQgUserId();
...@@ -292,63 +295,75 @@ public class UserServiceImpl implements IUserService { ...@@ -292,63 +295,75 @@ public class UserServiceImpl implements IUserService {
} }
/** /**
* 验证参数不全为空且合法 * 验证参数
* 分两类 订单类查询参数 用户类查询参数 订单类参数优先级高
* 每类参数只能有一个 如 订单类参数只能有一个(有申请订单号就不能有借款订单号和渠道订单号) 用户类同理
* *
* @param userCombinationParam * @param userCombinationParam
* @return * @return
*/ */
private Tuple<Boolean, String> validate(UserCombinationParam userCombinationParam) { private Tuple<Boolean, String> validate(UserCombinationParam userCombinationParam) {
Tuple<Boolean, String> result = new Tuple<>(); Tuple<Boolean, String> result = new Tuple<>();
result.setKey(true); int paramCount = 0;
if (Objects.isNull(userCombinationParam)) {
result.setKey(false); result.setKey(false);
if (Objects.isNull(userCombinationParam)) {
result.setValue("对象为空"); result.setValue("对象为空");
return result; return result;
} }
if (StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo())) { if (StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo())) {
if (Objects.isNull(userCombinationParam.getChannelId())) {
result.setValue("查询参数渠道订单号和渠道号要同时存在");
return result; return result;
}
paramCount++;
} }
if (StringUtils.isNotBlank(userCombinationParam.getIdNo())) { if (StringUtils.isNotBlank(userCombinationParam.getIdNo())) {
if (IdcardUtils.validateIdCard18(userCombinationParam.getIdNo()) || IdcardUtils.validateIdCard15(userCombinationParam.getIdNo())) { if (IdcardUtils.validateIdCard18(userCombinationParam.getIdNo()) || IdcardUtils.validateIdCard15(userCombinationParam.getIdNo())) {
return result; paramCount++;
} else { } else {
result.setKey(false);
result.setValue("身份证号格式有误"); result.setValue("身份证号格式有误");
return result; return result;
} }
} }
if (StringUtils.isNotBlank(userCombinationParam.getOrderNo())) { if (StringUtils.isNotBlank(userCombinationParam.getOrderNo())) {
return result; paramCount++;
} }
if (!Objects.isNull(userCombinationParam.getUserId())) { if (!Objects.isNull(userCombinationParam.getUserId())) {
return result; paramCount++;
} }
if (StringUtils.isNotBlank(userCombinationParam.getPhoneNo())) { if (StringUtils.isNotBlank(userCombinationParam.getPhoneNo())) {
if (ValidationUtil.validatePhoneNo(userCombinationParam.getPhoneNo())) { if (ValidationUtil.validatePhoneNo(userCombinationParam.getPhoneNo())) {
return result; paramCount++;
} else { } else {
result.setKey(false);
result.setValue("手机号格式错误"); result.setValue("手机号格式错误");
return result; return result;
} }
} }
if (StringUtils.isNotBlank(userCombinationParam.getUuid())) { if (StringUtils.isNotBlank(userCombinationParam.getUuid())) {
return result; paramCount++;
} }
if (!Objects.isNull(userCombinationParam.getLoanId())) { if (!Objects.isNull(userCombinationParam.getLoanId())) {
paramCount++;
}
//参数个数验证
if (paramCount == 0) {
result.setValue("参数全部为空");
return result;
}
if (paramCount > 1) {
result.setValue("参数个数大于一个");
return result; return result;
} }
result.setKey(false); result.setKey(true);
result.setValue("字段全部为空");
return result; return result;
} }
...@@ -362,9 +377,29 @@ public class UserServiceImpl implements IUserService { ...@@ -362,9 +377,29 @@ public class UserServiceImpl implements IUserService {
return userInfo; return userInfo;
} }
UserBasicInfo userBasicInfo = (UserBasicInfo) userInfo.getData(); UserBasicInfo userBasicInfo = (UserBasicInfo) userInfo.getData();
//申请订单查询(如果查询参数是渠道订单号)将渠道订单号转为借款订单号和申请订单号
Long loanId = userCombinationParam.getLoanId();
String applyNo = userCombinationParam.getOrderNo();
if (StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo())) {
OrderMappingQueryParam orderMappingQueryParam = new OrderMappingQueryParam();
orderMappingQueryParam.setChannelId(userCombinationParam.getChannelId());
orderMappingQueryParam.setChannelOrderNo(userCombinationParam.getChannelOrderNo());
JsonResult<LoanOrderMapping> orderMappingJsonResult = kaService.findOrderMapping(orderMappingQueryParam);
LoanOrderMapping data;
if (!orderMappingJsonResult.isSuccess() || Objects.isNull(data = orderMappingJsonResult.getData())) {
log.error("{} 根据渠道号查询orderMapping失败 result={}", logPre, orderMappingJsonResult);
return orderMappingJsonResult;
}
loanId = data.getLoanId();
applyNo = data.getApplyNo();
}
//申请订单查询
ApplyOrderQuery applyOrderQuery = new ApplyOrderQuery(); ApplyOrderQuery applyOrderQuery = new ApplyOrderQuery();
applyOrderQuery.setLoanId(userCombinationParam.getLoanId()); applyOrderQuery.setLoanId(loanId);
applyOrderQuery.setOrderNo(userCombinationParam.getOrderNo()); applyOrderQuery.setOrderNo(applyNo);
applyOrderQuery.setUserId(userBasicInfo.getUserId()); applyOrderQuery.setUserId(userBasicInfo.getUserId());
JsonResult applyOrders = xyqbService.findApplyOrders(applyOrderQuery); JsonResult applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
if (!applyOrders.isSuccess()) { if (!applyOrders.isSuccess()) {
......
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.rest.param.applyorder.ApplyOrderQuery; import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone; import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel; import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
...@@ -94,9 +95,9 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -94,9 +95,9 @@ public class XyqbServiceImpl implements IXyqbService {
} }
@Override @Override
public JsonResult findFlowChart(String orderNo) { public JsonResult<List<FlowNode>> findFlowChart(String orderNo) {
String logPre = "XyqbServiceImpl.findFlowChart"; String logPre="XyqbServiceImpl.findFlowChart";
log.info("{} 流程日志查询 orderNo={}", logPre, orderNo); log.info("{} 流程日志查询 orderNo={}",logPre,orderNo);
String url = xyqbSysUrl + "/ex/inside/customer_sys/query/applyOrder"; String url = xyqbSysUrl + "/ex/inside/customer_sys/query/applyOrder";
if (StringUtils.isEmpty(orderNo)) { if (StringUtils.isEmpty(orderNo)) {
log.error("{} 申请订单号为空 orderNo={}", logPre, orderNo); log.error("{} 申请订单号为空 orderNo={}", logPre, orderNo);
...@@ -109,10 +110,17 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -109,10 +110,17 @@ public class XyqbServiceImpl implements IXyqbService {
header.put("Content-type", "application/x-www-form-urlencoded"); header.put("Content-type", "application/x-www-form-urlencoded");
JsonResult jsonResult = httpService.post(url, header, param, JsonResult.class); JsonResult jsonResult = httpService.post(url, header, param, JsonResult.class);
if (Objects.isNull(jsonResult) || jsonResult.isSuccess()) { if(Objects.isNull(jsonResult) || !jsonResult.isSuccess()){
log.error("{} 调用信用钱包失败 url={}, header={},param={},result={}", logPre, url, header, param, jsonResult); log.error("{} 调用信用钱包失败 url={}, header={},param={},result={}",logPre,url, header,param,jsonResult);
return JsonResult.buildErrorStateResult("流程日志查询失败", null); return JsonResult.buildErrorStateResult("流程日志查询失败",null);
} }
List data = (List) jsonResult.getData();
List<FlowNode> flowNodeList = new ArrayList<>();
data.forEach( e ->{
flowNodeList.add(GSON.fromJson(e.toString(),FlowNode.class));
});
jsonResult.setData(flowNodeList);
return jsonResult; return jsonResult;
} }
......
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