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

综合查询修改

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