Commit 2932e091 authored by 杨钧's avatar 杨钧

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

parents 45fa7939 bf8aaec0
......@@ -15,6 +15,8 @@ public class ApplyOrder {
*/
private Long num;
private String channelOrderNo;
private String channelNo;
private Long userId;
......
......@@ -70,7 +70,7 @@ public class Repayment {
/**
*还款时间
*/
private String repaidAt;
private String repaymentReceivedAt;
/**
*还款状态
......
......@@ -4,6 +4,9 @@ import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.rest.param.ordermapping.OrderMappingQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import java.util.List;
import java.util.Map;
/**
* @author Wang Xiangwei
* @version 2020/3/9
......@@ -12,4 +15,11 @@ public interface IKaService {
JsonResult<LoanOrderMapping> findOrderMapping(OrderMappingQueryParam orderMappingQueryParam);
/**
* key 申请订单号 value 渠道订单号
* @param applyOrderNos
* @return
*/
JsonResult<Map<String,String>> findMap(List<String> applyOrderNos);
}
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.order.FlowNode;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
......@@ -19,7 +20,7 @@ public interface IXyqbService {
* @param applyOrderQuery
* @return
*/
JsonResult findApplyOrders(ApplyOrderQuery applyOrderQuery);
JsonResult<List<ApplyOrder>> findApplyOrders(ApplyOrderQuery applyOrderQuery);
/**
* 流程日志查看
......
......@@ -9,14 +9,17 @@ import cn.quantgroup.customer.service.IKaService;
import cn.quantgroup.customer.service.http.IHttpService;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;
import static cn.quantgroup.customer.constant.Constant.GSON;
......@@ -49,7 +52,7 @@ public class KaServiceImpl implements IKaService {
Long loanId = orderMappingQueryParam.getLoanId();
String url = kaSysUrl + "/api/order_mapping/get";
String url = kaSysUrl + "/external/get/orderMapping";
try {
Map<String, Object> param = Maps.newHashMap();
if(!Objects.isNull(applyOrderNo)){
......@@ -60,7 +63,7 @@ public class KaServiceImpl implements IKaService {
param.put("channelOrderNo", channelOrderNo);
}
if(StringUtils.isNotBlank(channelOrderNo)){
if(!Objects.isNull(loanId)){
param.put("loanId", loanId);
}
......@@ -84,4 +87,33 @@ public class KaServiceImpl implements IKaService {
}
}
@Override
public JsonResult<Map<String,String>> findMap(List<String> applyOrderNos) {
String logPre = "KaServiceImpl.findOrderMappingByApplyOrderNos";
log.info("{},获得orderMapping applyOrderNos={}",logPre,applyOrderNos);
if(CollectionUtils.isEmpty(applyOrderNos)){
log.error("{} 查询参数为空 applyOrderNos={}",logPre,applyOrderNos);
return JsonResult.buildErrorStateResult("查询参数为空",null);
}
String url = kaSysUrl + "/external/query/channelOrder/applyNos";
StringJoiner stringJoiner = new StringJoiner(",");
applyOrderNos.forEach(e -> stringJoiner.add(e));
Map<String, Object> param = Maps.newHashMap();
param.put("applyNos",stringJoiner.toString());
String result = httpService.get(kaSysUrl, param);
log.info("{} 请求ka系统返回值:{}",logPre, result);
JsonResult jsonResult = GSON.fromJson(result, JsonResult.class);
if(Objects.isNull(jsonResult) || !jsonResult.isSuccess()){
log.error("{} 查询orderMapping失败 jsonResult={}",logPre,jsonResult);
return JsonResult.buildErrorStateResult("查询orderMapping失败",null);
}
return jsonResult;
}
}
......@@ -6,6 +6,7 @@ import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.exception.BusinessException;
import cn.quantgroup.customer.model.Tuple;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.model.order.ApplyOrder;
import cn.quantgroup.customer.model.xyqbuser.UserBasicInfo;
import cn.quantgroup.customer.model.xyqbuser.UserCombination;
import cn.quantgroup.customer.repo.UserRepo;
......@@ -43,6 +44,7 @@ import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static cn.quantgroup.customer.constant.Constant.GSON;
......@@ -401,12 +403,23 @@ public class UserServiceImpl implements IUserService {
applyOrderQuery.setLoanId(loanId);
applyOrderQuery.setOrderNo(applyNo);
applyOrderQuery.setUserId(userBasicInfo.getUserId());
JsonResult applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
JsonResult<List<ApplyOrder>> applyOrders = xyqbService.findApplyOrders(applyOrderQuery);
if (!applyOrders.isSuccess()) {
return applyOrders;
}
List applyOrderList = (List) applyOrders.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);
......
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