Commit b3d6b32c authored by 王向伟's avatar 王向伟

综合查询修改

parent eeffdbe1
...@@ -369,61 +369,37 @@ public class UserServiceImpl implements IUserService { ...@@ -369,61 +369,37 @@ public class UserServiceImpl implements IUserService {
log.error("{},参数验证失败,{}", logPre, tuple.getValue()); log.error("{},参数验证失败,{}", logPre, tuple.getValue());
return JsonResult.buildErrorStateResult(tuple.getValue(), null); return JsonResult.buildErrorStateResult(tuple.getValue(), null);
} }
//查询用户 JsonResult<List<ApplyOrder>> applyOrders;
JsonResult userInfo; JsonResult userInfo;
if ("2".equals(tuple.getValue())) { if ("1".equals(tuple.getValue())) {
//用户参数查询 //订单参数查询
OrderQueryParam orderQueryParam = new OrderQueryParam(); OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setApplyOrderNo(userCombinationParam.getOrderNo()); orderQueryParam.setApplyOrderNo(userCombinationParam.getOrderNo());
orderQueryParam.setLoanId(userCombinationParam.getLoanId()); orderQueryParam.setLoanId(userCombinationParam.getLoanId());
orderQueryParam.setChannelId(userCombinationParam.getChannelId()); orderQueryParam.setChannelId(userCombinationParam.getChannelId());
orderQueryParam.setChannelOrderNo(userCombinationParam.getChannelOrderNo()); orderQueryParam.setChannelOrderNo(userCombinationParam.getChannelOrderNo());
userInfo = this.findUserInfoByOrderParam(orderQueryParam); userInfo = this.findUserInfoByOrderParam(orderQueryParam);
}else { applyOrders = findApplyOrders(orderQueryParam);
//订单参数查询 } else {
//用户参数查询
UserQueryParam userQueryParam = new UserQueryParam(); UserQueryParam userQueryParam = new UserQueryParam();
userQueryParam.setIdNo(userCombinationParam.getIdNo()); userQueryParam.setIdNo(userCombinationParam.getIdNo());
userQueryParam.setPhoneNo(userCombinationParam.getPhoneNo()); userQueryParam.setPhoneNo(userCombinationParam.getPhoneNo());
userQueryParam.setUserId(userCombinationParam.getUserId()); userQueryParam.setUserId(userCombinationParam.getUserId());
userQueryParam.setUuid(userCombinationParam.getUuid()); userQueryParam.setUuid(userCombinationParam.getUuid());
userInfo = this.findUserInfo(userQueryParam); userInfo = this.findUserInfo(userQueryParam);
applyOrders = findApplyOrders(userQueryParam);
} }
if (!userInfo.isSuccess()) { if (!userInfo.isSuccess()) {
return userInfo; return userInfo;
} }
UserBasicInfo userBasicInfo = (UserBasicInfo) userInfo.getData();
//查询订单
ApplyOrderQuery applyOrderQuery = new ApplyOrderQuery();
if("2".equals(tuple.getValue())){
applyOrderQuery.setUserId(userBasicInfo.getUserId());
}else {
Long loanId = userCombinationParam.getLoanId();
String applyNo = userCombinationParam.getOrderNo();
//申请订单查询(如果查询参数是渠道订单号)将渠道订单号转为借款订单号和申请订单号
if (StringUtils.isNotBlank(userCombinationParam.getChannelOrderNo())) {
OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setChannelId(userCombinationParam.getChannelId());
orderQueryParam.setChannelOrderNo(userCombinationParam.getChannelOrderNo());
JsonResult<LoanOrderMapping> orderMappingJsonResult = kaService.findOrderMapping(orderQueryParam);
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.setLoanId(loanId);
applyOrderQuery.setOrderNo(applyNo);
}
//申请订单查询
JsonResult<List<ApplyOrder>> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
if (!applyOrders.isSuccess()) { if (!applyOrders.isSuccess()) {
return applyOrders; return applyOrders;
} }
UserBasicInfo userBasicInfo = (UserBasicInfo) userInfo.getData();
List<ApplyOrder> applyOrderList = applyOrders.getData(); List<ApplyOrder> applyOrderList = applyOrders.getData();
//通过申请订单号获得渠道订单号 //通过申请订单号获得渠道订单号
List<String> applyOrderNoList = applyOrderList.stream().map(e -> e.getApplyOrderNo()).distinct().collect(Collectors.toList()); List<String> applyOrderNoList = applyOrderList.stream().map(e -> e.getApplyOrderNo()).distinct().collect(Collectors.toList());
...@@ -431,17 +407,51 @@ public class UserServiceImpl implements IUserService { ...@@ -431,17 +407,51 @@ public class UserServiceImpl implements IUserService {
if (!mapJsonResult.isSuccess()) { if (!mapJsonResult.isSuccess()) {
return mapJsonResult; return mapJsonResult;
} }
Map<String, String> data = mapJsonResult.getData(); Map<String, String> data = mapJsonResult.getData();
applyOrderList.forEach(e -> e.setChannelOrderNo(data.get(e.getApplyOrderNo()))); applyOrderList.forEach(e -> e.setChannelOrderNo(data.get(e.getApplyOrderNo())));
UserCombination userCombination = new UserCombination(); UserCombination userCombination = new UserCombination();
userCombination.setUserInfo(userBasicInfo); userCombination.setUserInfo(userBasicInfo);
userCombination.setApplyOrderList(applyOrderList); userCombination.setApplyOrderList(applyOrderList);
return JsonResult.buildSuccessResult("", userCombination); return JsonResult.buildSuccessResult("", userCombination);
} }
//订单信息综合查询
private JsonResult findApplyOrders(OrderQueryParam orderQueryParam) {
String logPre = "UserService.findApplyOrders";
ApplyOrderQuery applyOrderQuery = new ApplyOrderQuery();
Long loanId = orderQueryParam.getLoanId();
String applyNo = orderQueryParam.getApplyOrderNo();
//申请订单查询(如果查询参数是渠道订单号)将渠道订单号转为借款订单号和申请订单号
if (StringUtils.isNotBlank(orderQueryParam.getChannelOrderNo())) {
JsonResult<LoanOrderMapping> orderMappingJsonResult = kaService.findOrderMapping(orderQueryParam);
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.setLoanId(loanId);
applyOrderQuery.setOrderNo(applyNo);
//申请订单查询
JsonResult<List<ApplyOrder>> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
return applyOrders;
}
//用户信息综合查询
private JsonResult findApplyOrders(UserQueryParam userQueryParam) {
ApplyOrderQuery applyOrderQuery = new ApplyOrderQuery();
applyOrderQuery.setUserId(userQueryParam.getUserId());
//申请订单查询
JsonResult<List<ApplyOrder>> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
return applyOrders;
}
@Override @Override
public JsonResult findUserInfoByOrderParam(OrderQueryParam orderQueryParam) { public JsonResult findUserInfoByOrderParam(OrderQueryParam orderQueryParam) {
......
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