Commit 15ccb3f3 authored by 杨钧's avatar 杨钧

修改绑卡相关接口

parent c9200409
......@@ -4,6 +4,10 @@ import cn.quantgroup.customer.rest.param.card.ModifyCardsQuery;
import cn.quantgroup.customer.rest.param.card.ModifyReservePhone;
import cn.quantgroup.customer.rest.param.card.UnBindCardModel;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.card.CardResult;
import cn.quantgroup.customer.rest.vo.card.XyqbCardRelation;
import java.util.List;
/**
* @author yangjun
......@@ -11,11 +15,31 @@ import cn.quantgroup.customer.rest.vo.JsonResult;
* @Desc 银行卡相关
*/
public interface ICardService {
JsonResult queryCardLists(ModifyCardsQuery cardsQuery);
/**
* 查询绑卡信息
* @param cardsQuery
* @return
*/
JsonResult<CardResult> queryCardLists(ModifyCardsQuery cardsQuery);
JsonResult queryCardRelation(Long bankId);
/**
* 查询卡关联信息
* @param bankId
* @return
*/
JsonResult<List<XyqbCardRelation>> queryCardRelation(Long bankId);
JsonResult unBindCardRelation(UnBindCardModel unBindCardModel);
/**
* 解绑
* @param unBindCardModel
* @return
*/
JsonResult<String> unBindCardRelation(UnBindCardModel unBindCardModel);
JsonResult modifyReservePhone(ModifyReservePhone modifyReservePhone);
/**
* 修改用户预留手机号
* @param modifyReservePhone
* @return
*/
JsonResult<String> modifyReservePhone(ModifyReservePhone modifyReservePhone);
}
......@@ -8,6 +8,8 @@ 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.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.card.XyqbCardRelation;
import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
import java.util.List;
......@@ -44,13 +46,33 @@ public interface IXyqbService {
*/
JsonResult<OrderRepayment> repaymentPlanQuery(Long loanId);
String queryCardLists(Long userId);
/**
* 查询信用钱包返回用户绑卡列表信息
* @param userId
* @return
*/
JsonResult<List<XyqbCardsInfo>> queryCardLists(Long userId);
String queryCardRelation(Long bankId);
/**
* 查询信用钱包卡关联信息
* @param bankId
* @return
*/
JsonResult<List<XyqbCardRelation>> queryCardRelation(Long bankId);
String unBindCardRelation(UnBindCardModel unBindCardModel);
/**
* 卡解绑
* @param unBindCardModel
* @return
*/
JsonResult<String> unBindCardRelation(UnBindCardModel unBindCardModel);
String modifyReservePhone(ModifyReservePhone modifyReservePhone);
/**
* 修改预留手机号
* @param modifyReservePhone
* @return
*/
JsonResult<String> modifyReservePhone(ModifyReservePhone modifyReservePhone);
String queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
......
package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.constant.Constant;
import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
......@@ -9,6 +10,8 @@ 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.vo.JsonResult;
import cn.quantgroup.customer.rest.vo.card.XyqbCardRelation;
import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
import cn.quantgroup.customer.service.IXyqbService;
import cn.quantgroup.customer.service.http.IHttpService;
import cn.quantgroup.customer.util.JSONTools;
......@@ -17,10 +20,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
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.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -194,7 +199,8 @@ public class XyqbServiceImpl implements IXyqbService {
* @return
*/
@Override
public String queryCardLists(Long userId) {
public JsonResult<List<XyqbCardsInfo>> queryCardLists(Long userId) {
final String logPre = "XyqbServiceImpl.queryCardLists 查询信用钱包用户绑卡信息";
String url = xyqbSysUrl + "/ex/customer_sys/query/bankcard";
Map<String, Object> param = new HashMap<>(4);
if (Objects.nonNull(userId)) {
......@@ -203,15 +209,24 @@ public class XyqbServiceImpl implements IXyqbService {
String response = null;
try {
response = httpService.post(url, param);
log.info("[queryCardLists] 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<XyqbCardsInfo>>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[queryCardLists] 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 queryCardRelation(Long bankId) {
public JsonResult<List<XyqbCardRelation>> queryCardRelation(Long bankId) {
final String logPre = "XyqbServiceImpl.queryCardRelation 查询信用钱包卡关联信息";
String url = xyqbSysUrl + "/ex/customer_sys/query/cardrelation";
Map<String, Object> param = new HashMap<>(4);
if (Objects.nonNull(bankId)) {
......@@ -221,60 +236,67 @@ public class XyqbServiceImpl implements IXyqbService {
String response = null;
try {
response = httpService.post(url, param);
log.info("[queryCardRelation] 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<XyqbCardRelation>>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[queryCardRelation] 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 unBindCardRelation(UnBindCardModel unBindCardModel) {
public JsonResult<String> unBindCardRelation(UnBindCardModel unBindCardModel) {
final String logPre = "XyqbServiceImpl.unBindCardRelation 银行卡解绑";
String url = xyqbSysUrl + "/ex/customer_sys/unbundle/relation";
Map<String, Object> param = new HashMap<>(4);
Long userId = unBindCardModel.getUserId();
Long bindCardRecordId = unBindCardModel.getBindCardRecordId();
if (Objects.nonNull(bindCardRecordId)) {
param.put("bindCardRecordId", bindCardRecordId);
}
if (Objects.nonNull(userId)) {
param.put("userId", userId);
}
Map<String, Object> param = JSONTools.toMap(unBindCardModel);
String response = null;
try {
response = httpService.post(url, param);
log.info("[unBindCardRelation] 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<String>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[unBindCardRelation] 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 modifyReservePhone(ModifyReservePhone modifyReservePhone) {
public JsonResult<String> modifyReservePhone(ModifyReservePhone modifyReservePhone) {
final String logPre = "XyqbServiceImpl.modifyReservePhone 修改预留手机号";
String url = xyqbSysUrl + "/ex/customer_sys/modify/reservedphone";
Map<String, Object> param = new HashMap<>(8);
Long userId = modifyReservePhone.getUserId();
Long bankId = modifyReservePhone.getBankId();
String phoneNo = modifyReservePhone.getPhoneNo();
if (Objects.nonNull(bankId)) {
param.put("bankId", bankId);
}
if (Objects.nonNull(userId)) {
param.put("userId", userId);
}
if (StringUtils.isNotBlank(phoneNo)) {
param.put("phoneNo", phoneNo);
}
Map<String, Object> param = JSONTools.toMap(modifyReservePhone);
String response = null;
try {
response = httpService.post(url, param);
log.info("[modifyReservePhone] 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<String>>() {
}.getType();
return Constant.GSON.fromJson(response, jsonType);
} catch (Exception e) {
log.error("[modifyReservePhone] 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
......@@ -313,7 +335,7 @@ public class XyqbServiceImpl implements IXyqbService {
response = httpService.post(url, param);
log.info("[queryRepayOptRecords] param:{},请求业务系统返回值:{}", param, response);
} catch (Exception e) {
log.error("[queryRepayOptRecords] param:{},请求业务系统异常:{}", param, e);
log.error("[queryRepayOptRecords] param:{},请求业务系统异常:{}", param, ExceptionUtils.getStackTrace(e));
}
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