Commit c8803ecf authored by 杨钧's avatar 杨钧

修改绑卡相关接口

parent b877328e
......@@ -53,11 +53,11 @@ public class RepayRest {
@GetMapping("/info")
public JsonResult queryRepayInfo(@Valid RepayOrderInfoQuery repayOrderQuery, BindingResult bindingResult) {
log.info("[查询还款信息],请求参数:repayOrderQuery={}", repayOrderQuery);
if(bindingResult.hasErrors()){
if (bindingResult.hasErrors()) {
StringJoiner errorStr = new StringJoiner(";");
bindingResult.getFieldErrors().forEach(fieldError -> errorStr.add(fieldError.getDefaultMessage()));
log.info("[查询还款信息],请求参数验证异常:errorStr={}", errorStr);
return JsonResult.buildErrorStateResult(errorStr.toString(),ErrorCodeEnum.PARAM_ERROR.getCode());
return JsonResult.buildErrorStateResult(errorStr.toString(), ErrorCodeEnum.PARAM_ERROR.getCode());
}
return repayService.queryRepayInfo(repayOrderQuery);
}
......
......@@ -18,6 +18,7 @@ import java.math.BigDecimal;
@AllArgsConstructor
@NoArgsConstructor
public class XyqbRepayInfo {
private Integer repayType;
private String repayTypeDesc;
private Long loanId;
private Integer termNo;
......
......@@ -3,11 +3,27 @@ package cn.quantgroup.customer.service;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.repay.RepayInfoResult;
import cn.quantgroup.customer.rest.vo.repay.RepayOptRecord;
import java.util.List;
public interface IRepayService {
String findRepayOrders(RepayOrderQuery repayOrderQuery);
JsonResult queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
/**
* 查询还款信息
*
* @param repayOrderQuery
* @return
*/
JsonResult<RepayInfoResult> queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
JsonResult queryRepayOptRecords(String businessFlowNo);
/**
* 查询还款操作记录
*
* @param businessFlowNo
* @return
*/
JsonResult<List<RepayOptRecord>> queryRepayOptRecords(String businessFlowNo);
}
......@@ -10,6 +10,8 @@ import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.card.XyqbCardRelation;
import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
import cn.quantgroup.customer.rest.vo.repay.RepayOptRecord;
import cn.quantgroup.customer.rest.vo.repay.XyqbRepayInfo;
import java.util.List;
......@@ -74,9 +76,19 @@ public interface IXyqbService {
*/
JsonResult<String> modifyReservePhone(ModifyReservePhone modifyReservePhone);
String queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
/**
* 查询还款信息
* @param repayOrderQuery
* @return
*/
JsonResult<List<XyqbRepayInfo>> queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
String queryRepayOptRecords(String businessFlowNo);
/**
* 查询还款操作记录
* @param businessFlowNo
* @return
*/
JsonResult<List<RepayOptRecord>> queryRepayOptRecords(String businessFlowNo);
/**
* 订单状态查询
......
......@@ -65,7 +65,6 @@ public class CardServiceImpl implements ICardService {
if (Objects.isNull(userbasicinfo = userJsonResult.getData())) {
log.warn("{} 不存在对应用户 userQueryParam={},userJsonResult={}", logPre, userQueryParam, userJsonResult);
return JsonResult.buildSuccessResult("不存在对应用户信息", null);
}
//发起xyqb查询
......
......@@ -8,6 +8,7 @@ import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.param.user.UserCombinationParam;
import cn.quantgroup.customer.rest.param.user.UserQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.repay.RepayInfoResult;
import cn.quantgroup.customer.rest.vo.repay.RepayOptRecord;
......@@ -15,6 +16,7 @@ import cn.quantgroup.customer.rest.vo.repay.XyqbRepayInfo;
import cn.quantgroup.customer.service.IRepayService;
import cn.quantgroup.customer.service.IUserService;
import cn.quantgroup.customer.service.IXyqbService;
import cn.quantgroup.customer.util.JSONTools;
import cn.quantgroup.user.retbean.XUser;
import cn.quantgroup.user.vo.UserSysResult;
import lombok.extern.slf4j.Slf4j;
......@@ -62,91 +64,76 @@ public class RepayServiceImpl implements IRepayService {
}
@Override
public JsonResult queryRepayInfo(RepayOrderInfoQuery repayOrderQuery) {
public JsonResult<RepayInfoResult> queryRepayInfo(RepayOrderInfoQuery repayOrderQuery) {
final String logPre = "[queryRepayInfo] 查询还款信息";
// 参数校验
if (Objects.isNull(repayOrderQuery)) {
log.error("查询还款信息,请求参数 repayOrderQuery 为空");
log.error("{} 请求参数 repayOrderQuery 为空", logPre);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.PARAM_ERROR.getMessage(), ErrorCodeEnum.PARAM_ERROR.getCode());
}
if (Objects.isNull(repayOrderQuery.getLoanId())) {
log.error("查询还款信息,请求参数 loanId 不能为空");
return JsonResult.buildErrorStateResult("借款订单号不能为空", ErrorCodeEnum.RETURN_ERROR.getCode());
log.error("{} 请求参数 loanId 不能为空,repayOrderQuery:{}", logPre, repayOrderQuery);
return JsonResult.buildErrorStateResult("借款订单号不能为空", ErrorCodeEnum.PARAM_ERROR.getCode());
}
Long loanId = repayOrderQuery.getLoanId();
RepayInfoResult repayInfoResult = new RepayInfoResult();
// 处理用户信息
OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setLoanId(loanId);
JsonResult userJsonResult = userService.findUserInfoByOrderParam(orderQueryParam);
if (Objects.isNull(userJsonResult)
|| !userJsonResult.isSuccess()) {
log.error("根据loanId查不到用户信息");
return JsonResult.buildErrorStateResult("该笔借款申请号查询不到用户信息", ErrorCodeEnum.PARAM_ERROR.getCode());
JsonResult<UserBasicInfo> userJsonResult = userService.findUserInfoByOrderParam(orderQueryParam);
log.info("{} 查询用户信息 userJsonResult={} ", logPre, userJsonResult);
if (Objects.isNull(userJsonResult) || !userJsonResult.isSuccess()) {
log.error("{} 获取用户信息失败 orderQueryParam={},userJsonResult={}", logPre, orderQueryParam, userJsonResult);
return JsonResult.buildErrorStateResult("获取用户信息失败", ErrorCodeEnum.RETURN_ERROR.getCode());
}
UserBasicInfo userbasicinfo = (UserBasicInfo) userJsonResult.getData();
repayInfoResult.setUserInfo(userbasicinfo);
//处理还款信息
String repayInfoStr = xyqbService.queryRepayInfo(repayOrderQuery);
log.info("[查询xyqb返回还款信息],repayInfoStr={}", repayInfoStr);
if (StringUtils.isBlank(repayInfoStr)) {
log.error("[查询xyqb返回还款信息],返回结果为null");
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
UserBasicInfo userbasicinfo;
if (Objects.isNull(userbasicinfo = userJsonResult.getData())) {
log.warn("{} 不存在对应用户 orderQueryParam={},userJsonResult={}", logPre, orderQueryParam, userJsonResult);
return JsonResult.buildSuccessResult("不存在对应用户信息", null);
}
JsonResult<List<XyqbRepayInfo>> xyqbRepayInfoResult;
try {
Type jsonType = new com.google.gson.reflect.TypeToken<JsonResult<List<XyqbRepayInfo>>>() {
}.getType();
xyqbRepayInfoResult = Constant.GSON.fromJson(repayInfoStr, jsonType);
} catch (Exception e) {
log.error("[还款信息转换异常]", e);
//处理还款信息
JsonResult<List<XyqbRepayInfo>> xyqbRepayInfoResult = xyqbService.queryRepayInfo(repayOrderQuery);
log.info("{} 信用钱包返回信息 xyqbRepayInfoResult:{}", logPre, xyqbRepayInfoResult);
if (Objects.isNull(xyqbRepayInfoResult)) {
log.error("{} 返回为空 repayOrderQuery={}", logPre, repayOrderQuery);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
if (!xyqbRepayInfoResult.isSuccess()) {
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
log.error("{} 信息异常 repayOrderQuery={},xyqbRepayInfoResult={}", logPre, repayOrderQuery, xyqbRepayInfoResult);
return JsonResult.buildErrorStateResult(xyqbRepayInfoResult.getMsg(), xyqbRepayInfoResult.getCode());
}
RepayInfoResult repayInfoResult = new RepayInfoResult();
repayInfoResult.setUserInfo(userbasicinfo);
repayInfoResult.setRepaymentList(xyqbRepayInfoResult.getData());
log.info("[查询还款信息],返回 repayInfoResult={}", repayInfoResult);
log.info("{},返回结果 repayInfoResult={}", logPre, repayInfoResult);
return JsonResult.buildSuccessResult("处理成功", repayInfoResult);
}
@Override
public JsonResult queryRepayOptRecords(String businessFlowNo) {
log.info("[查询还款操作记录][queryRepayOptRecords],请求参数:businessFlowNo={}", businessFlowNo);
public JsonResult<List<RepayOptRecord>> queryRepayOptRecords(String businessFlowNo) {
final String logPre = "[queryRepayOptRecords] 查询还款操作记录";
if (StringUtils.isBlank(businessFlowNo)) {
log.error("查询还款操作记录,流水号为空");
log.error("{} 请求参数 流水号为空", logPre);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.PARAM_ERROR.getMessage(), ErrorCodeEnum.PARAM_ERROR.getCode());
}
//发起xyqb查询
String optRecordsStr = xyqbService.queryRepayOptRecords(businessFlowNo);
log.info("[查询xyqb还款操作记录],optRecordsStr={}", optRecordsStr);
if (StringUtils.isBlank(optRecordsStr)) {
log.error("[查询xyqb还款操作记录],返回结果为null");
JsonResult<List<RepayOptRecord>> repayOptRecordResult = xyqbService.queryRepayOptRecords(businessFlowNo);
log.info("{} 信用钱包返回信息 repayOptRecordResult:{}", logPre, repayOptRecordResult);
if (Objects.isNull(repayOptRecordResult)) {
log.error("{} 返回为空 businessFlowNo={}", logPre, businessFlowNo);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
JsonResult<List<RepayOptRecord>> repayOptRecordResult;
try {
Type jsonType = new com.google.gson.reflect.TypeToken<JsonResult<List<RepayOptRecord>>>() {
}.getType();
repayOptRecordResult = Constant.GSON.fromJson(optRecordsStr, jsonType);
} catch (Exception e) {
log.error("[还款操作记录转换异常]", e);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
if (!repayOptRecordResult.isSuccess()) {
log.error("{} 信息异常 businessFlowNo={},repayOptRecordResult={}", logPre, businessFlowNo, repayOptRecordResult);
return JsonResult.buildErrorStateResult(repayOptRecordResult.getMsg(), repayOptRecordResult.getCode());
}
log.info("[查询还款操作记录],返回 repayOptRecordResult={}", repayOptRecordResult);
log.info("{},返回信息 repayOptRecordResult={}", repayOptRecordResult);
return repayOptRecordResult;
}
}
......@@ -12,6 +12,8 @@ import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.card.XyqbCardRelation;
import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
import cn.quantgroup.customer.rest.vo.repay.RepayOptRecord;
import cn.quantgroup.customer.rest.vo.repay.XyqbRepayInfo;
import cn.quantgroup.customer.service.IXyqbService;
import cn.quantgroup.customer.service.http.IHttpService;
import cn.quantgroup.customer.util.JSONTools;
......@@ -300,30 +302,33 @@ public class XyqbServiceImpl implements IXyqbService {
}
@Override
public String queryRepayInfo(RepayOrderInfoQuery repayOrderQuery) {
String url = xyqbSysUrl + "/ex/customer_sys/query/repayment";
Map<String, Object> param = new HashMap<>(4);
Long loanId = repayOrderQuery.getLoanId();
Integer termNo = repayOrderQuery.getTermNo();
if (Objects.nonNull(loanId)) {
param.put("loanId", loanId);
}
if (Objects.nonNull(termNo)) {
param.put("termNo", termNo);
}
public JsonResult<List<XyqbRepayInfo>> queryRepayInfo(RepayOrderInfoQuery repayOrderQuery) {
final String logPre = "XyqbServiceImpl.queryRepayInfo 查询还款信息";
String url = xyqbSysUrl + "/ex/customer_sys/query/repayment";
Map<String, Object> param = JSONTools.toMap(repayOrderQuery);
String response = null;
try {
response = httpService.post(url, param);
log.info("[queryRepayInfo] param:{},请求业务系统返回值:{}", param, response);
log.info("{} response={}", logPre, response);
if (StringUtils.isBlank(response)) {
log.error("{} 返回结果为null", logPre);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
Type jsonType = new com.google.gson.reflect.TypeToken<JsonResult<List<XyqbRepayInfo>>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[queryRepayInfo] param:{},请求业务系统异常:{}", param, e);
log.error("{} 处理失败 param:{},response:{}, 异常信息:{}", logPre, param, response, ExceptionUtils.getStackTrace(e));
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
return response;
}
@Override
public String queryRepayOptRecords(String businessFlowNo) {
public JsonResult<List<RepayOptRecord>> queryRepayOptRecords(String businessFlowNo) {
final String logPre = "XyqbServiceImpl.queryRepayOptRecords 查询还款操作记录";
String url = xyqbSysUrl + "/ex/customer_sys/repayment/detail";
Map<String, Object> param = new HashMap<>(4);
if (StringUtils.isNotBlank(businessFlowNo)) {
......@@ -333,11 +338,19 @@ public class XyqbServiceImpl implements IXyqbService {
String response = null;
try {
response = httpService.post(url, param);
log.info("[queryRepayOptRecords] param:{},请求业务系统返回值:{}", param, response);
log.info("{} response={}", logPre, response);
if (StringUtils.isBlank(response)) {
log.error("{} 返回结果为null", logPre);
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
Type jsonType = new com.google.gson.reflect.TypeToken<JsonResult<List<RepayOptRecord>>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[queryRepayOptRecords] param:{},请求业务系统异常:{}", param, ExceptionUtils.getStackTrace(e));
log.error("{} 处理失败 param:{},response:{}, 异常信息:{}", logPre, param, response, ExceptionUtils.getStackTrace(e));
return JsonResult.buildErrorStateResult(ErrorCodeEnum.RETURN_ERROR.getMessage(), ErrorCodeEnum.RETURN_ERROR.getCode());
}
return response;
}
/**
......
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