Commit 75db6237 authored by 杨钧's avatar 杨钧

增加xyqb接口调用

parent 56b5ecf8
...@@ -24,12 +24,11 @@ import java.util.Objects; ...@@ -24,12 +24,11 @@ import java.util.Objects;
*/ */
@Slf4j @Slf4j
@Component @Component
public class UserTokenInterceptor implements HandlerInterceptor{ public class UserTokenInterceptor implements HandlerInterceptor {
@Autowired @Autowired
private IOpSystemService IOpSystemService; private IOpSystemService IOpSystemService;
@Override @Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
if (HttpMethod.OPTIONS.toString().equals(httpServletRequest.getMethod())) { if (HttpMethod.OPTIONS.toString().equals(httpServletRequest.getMethod())) {
...@@ -39,16 +38,16 @@ public class UserTokenInterceptor implements HandlerInterceptor{ ...@@ -39,16 +38,16 @@ public class UserTokenInterceptor implements HandlerInterceptor{
String token = httpServletRequest.getHeader("x-auth-token"); String token = httpServletRequest.getHeader("x-auth-token");
String system = httpServletRequest.getHeader("x-auth-system"); String system = httpServletRequest.getHeader("x-auth-system");
if(StringUtils.isAnyBlank(token,system)){ if (StringUtils.isAnyBlank(token, system)) {
log.error("缺少token信息,拦截"); log.error("缺少token信息,拦截");
return false; return false;
} }
JsonResult<OpUser> opUserResult= IOpSystemService.findUserByToken(token,system); JsonResult<OpUser> opUserResult = IOpSystemService.findUserByToken(token, system);
if(Objects.isNull(opUserResult) || !opUserResult.isSuccess()){ if (Objects.isNull(opUserResult) || !opUserResult.isSuccess()) {
log.error("根据token查询不到用户信息 token:{}",token); log.error("根据token查询不到用户信息 token:{}", token);
return false; return false;
}else{ } else {
OpUser opUser = opUserResult.getData(); OpUser opUser = opUserResult.getData();
UserThreadLocal.set(opUser); UserThreadLocal.set(opUser);
return true; return true;
......
...@@ -52,6 +52,7 @@ public class OrderRest { ...@@ -52,6 +52,7 @@ public class OrderRest {
/** /**
* 订单提前一次性结清查询 * 订单提前一次性结清查询
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
...@@ -63,6 +64,7 @@ public class OrderRest { ...@@ -63,6 +64,7 @@ public class OrderRest {
/** /**
* 结清白名单操作 * 结清白名单操作
*
* @param operateEntryParam * @param operateEntryParam
* @return * @return
*/ */
...@@ -75,6 +77,7 @@ public class OrderRest { ...@@ -75,6 +77,7 @@ public class OrderRest {
/** /**
* 提前一次性结清金额试算 * 提前一次性结清金额试算
*
* @param loanId * @param loanId
* @return * @return
*/ */
...@@ -87,6 +90,7 @@ public class OrderRest { ...@@ -87,6 +90,7 @@ public class OrderRest {
/** /**
* 操作日志查询 * 操作日志查询
*
* @param loanId * @param loanId
* @return * @return
*/ */
......
...@@ -7,5 +7,5 @@ import cn.quantgroup.customer.rest.vo.JsonResult; ...@@ -7,5 +7,5 @@ import cn.quantgroup.customer.rest.vo.JsonResult;
* 查询运营系统后台 * 查询运营系统后台
*/ */
public interface IOpSystemService { public interface IOpSystemService {
JsonResult<OpUser> findUserByToken(String token, String system); JsonResult<OpUser> findUserByToken(String token, String system);
} }
...@@ -35,27 +35,31 @@ public interface IOrderService{ ...@@ -35,27 +35,31 @@ public interface IOrderService{
/** /**
* 查询提前一次性结清订单信息 * 查询提前一次性结清订单信息
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
JsonResult<List<EarlySettleUpOrder>> queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery); JsonResult<List<EarlySettleUpOrder>> queryEarlySettleUpOrders(EarlySettleUpOrderQueryParam orderQuery);
/** /**
* 显示or隐藏操作 * 显示or隐藏操作
*
* @param operateEntryParam * @param operateEntryParam
* @return * @return
*/ */
JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam); JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam);
/** /**
* 提前一次性结清金额试算 * 提前一次性结清金额试算
*
* @param loanId * @param loanId
* @return * @return
*/ */
JsonResult<List<Map<String,Object>>> earlySettleUpTrial(Long loanId); JsonResult<List<Map<String, Object>>> earlySettleUpTrial(Long loanId);
/** /**
* 查询操作日志 * 查询操作日志
*
* @param loanId * @param loanId
* @return * @return
*/ */
......
...@@ -68,6 +68,7 @@ public interface IXyqbService { ...@@ -68,6 +68,7 @@ public interface IXyqbService {
/** /**
* 查询xyqb一次性结清订单相关信息 * 查询xyqb一次性结清订单相关信息
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
...@@ -75,10 +76,17 @@ public interface IXyqbService { ...@@ -75,10 +76,17 @@ public interface IXyqbService {
/** /**
* 处理新增或删除白名单操作 * 处理新增或删除白名单操作
*
* @param operateEntryParam * @param operateEntryParam
* @return * @return
*/ */
JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam); JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam);
/**
* 提前一次性结清金额试算
*
* @param loanId
* @return
*/
JsonResult<EarlySettleUpTrial> earlySettleUpTrial(Long loanId); JsonResult<EarlySettleUpTrial> earlySettleUpTrial(Long loanId);
} }
...@@ -38,16 +38,16 @@ public class OpSystemServiceImpl implements IOpSystemService { ...@@ -38,16 +38,16 @@ public class OpSystemServiceImpl implements IOpSystemService {
@Override @Override
public JsonResult<OpUser> findUserByToken(String token, String system) { public JsonResult<OpUser> findUserByToken(String token, String system) {
String logPre = "OpSystemServiceImpl.findUserByToken"; String logPre = "OpSystemServiceImpl.findUserByToken";
log.info("{} 通过token查询用户登录信息 token={},system={}", logPre, token,system); log.info("{} 通过token查询用户登录信息 token={},system={}", logPre, token, system);
String url = kaSysUrl + "/user/info"; String url = kaSysUrl + "/user/info";
try { try {
Map<String, String> param = Maps.newHashMap(); Map<String, String> param = Maps.newHashMap();
param.put("x-auth-token",token); param.put("x-auth-token", token);
param.put("x-auth-system",system); param.put("x-auth-system", system);
String result = null; String result = null;
try { try {
result = httpService.post(url, param,null); result = httpService.post(url, param, null);
} catch (Exception e) { } catch (Exception e) {
log.error(" {}查询用户登录信息失败http请求异常 url={},param={}", logPre, url, param, e); log.error(" {}查询用户登录信息失败http请求异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("通讯异常", null); return JsonResult.buildErrorStateResult("通讯异常", null);
...@@ -63,7 +63,7 @@ public class OpSystemServiceImpl implements IOpSystemService { ...@@ -63,7 +63,7 @@ public class OpSystemServiceImpl implements IOpSystemService {
JsonResult<OpUser> jsonResult = JSONTools.deserialize(result, typeToken); JsonResult<OpUser> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult; return jsonResult;
} catch (Exception e) { } catch (Exception e) {
log.error("{} 网络通讯异常,token:{},system:{},ex:{}", logPre,token, system,ExceptionUtils.getStackTrace(e)); log.error("{} 网络通讯异常,token:{},system:{},ex:{}", logPre, token, system, ExceptionUtils.getStackTrace(e));
throw new BusinessException(ErrorCodeEnum.NET_ERROR); throw new BusinessException(ErrorCodeEnum.NET_ERROR);
} }
} }
......
...@@ -20,7 +20,7 @@ import java.util.Map; ...@@ -20,7 +20,7 @@ import java.util.Map;
* @Update * @Update
*/ */
@Service("operateLogService") @Service("operateLogService")
public class OperateLogServiceImpl implements IOperateLogService{ public class OperateLogServiceImpl implements IOperateLogService {
@Autowired @Autowired
private OperateLogRepo operateLogRepo; private OperateLogRepo operateLogRepo;
......
...@@ -165,7 +165,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -165,7 +165,7 @@ public class OrderServiceImpl implements IOrderService {
// 获取用户userId // 获取用户userId
JsonResult<UserBasicInfo> userInfo = this.queryAndCheckUserInfo(orderQuery); JsonResult<UserBasicInfo> userInfo = this.queryAndCheckUserInfo(orderQuery);
if (Objects.isNull(userInfo)||!userInfo.isSuccess()) { if (Objects.isNull(userInfo) || !userInfo.isSuccess()) {
return JsonResult.buildErrorStateResult("查询不到用户信息", null); return JsonResult.buildErrorStateResult("查询不到用户信息", null);
} }
...@@ -173,7 +173,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -173,7 +173,7 @@ public class OrderServiceImpl implements IOrderService {
UserBasicInfo userBasicInfo = userInfo.getData(); UserBasicInfo userBasicInfo = userInfo.getData();
orderQuery.setUserId(userBasicInfo.getUserId()); orderQuery.setUserId(userBasicInfo.getUserId());
JsonResult<List<EarlySettleUpOrder>> xyqbOrderResult = this.xyqbService.findLoanOrder4EarlySettleUp(orderQuery); JsonResult<List<EarlySettleUpOrder>> xyqbOrderResult = this.xyqbService.findLoanOrder4EarlySettleUp(orderQuery);
if (Objects.isNull(xyqbOrderResult)||!xyqbOrderResult.isSuccess()) { if (Objects.isNull(xyqbOrderResult) || !xyqbOrderResult.isSuccess()) {
return JsonResult.buildErrorStateResult("查询订单信息出错", null); return JsonResult.buildErrorStateResult("查询订单信息出错", null);
} }
...@@ -182,11 +182,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -182,11 +182,11 @@ public class OrderServiceImpl implements IOrderService {
* 查询渠道配置信息 * 查询渠道配置信息
*/ */
JsonResult<List<ChannelConfigurationResult>> channelConfigs = this.kaService.getAllChannelConfiguration(); JsonResult<List<ChannelConfigurationResult>> channelConfigs = this.kaService.getAllChannelConfiguration();
if (Objects.isNull(channelConfigs)||!channelConfigs.isSuccess()) { if (Objects.isNull(channelConfigs) || !channelConfigs.isSuccess()) {
return JsonResult.buildErrorStateResult("查询渠道配置出错", null); return JsonResult.buildErrorStateResult("查询渠道配置出错", null);
} }
List<ChannelConfigurationResult> channelConfigLists = channelConfigs.getData(); List<ChannelConfigurationResult> channelConfigLists = channelConfigs.getData();
Map<Long,List<ChannelConfigurationResult>> configurationResultMap = channelConfigLists.stream().collect(Collectors.groupingBy(ChannelConfigurationResult::getRegisteredFrom)); Map<Long, List<ChannelConfigurationResult>> configurationResultMap = channelConfigLists.stream().collect(Collectors.groupingBy(ChannelConfigurationResult::getRegisteredFrom));
/** /**
...@@ -195,16 +195,16 @@ public class OrderServiceImpl implements IOrderService { ...@@ -195,16 +195,16 @@ public class OrderServiceImpl implements IOrderService {
List<EarlySettleUpOrder> settleUpOrders = xyqbOrderResult.getData(); List<EarlySettleUpOrder> settleUpOrders = xyqbOrderResult.getData();
settleUpOrders.forEach(e -> { settleUpOrders.forEach(e -> {
ChannelConfigurationResult configurationResult = null; ChannelConfigurationResult configurationResult = null;
if(configurationResultMap.get(e.getChannelId()).size()!=1 || if (configurationResultMap.get(e.getChannelId()).size() != 1 ||
(configurationResultMap.get(e.getChannelId()).size()==1 && Objects.isNull(configurationResult = configurationResultMap.get(e.getChannelId()).get(0)))){ (configurationResultMap.get(e.getChannelId()).size() == 1 && Objects.isNull(configurationResult = configurationResultMap.get(e.getChannelId()).get(0)))) {
return; return;
} }
OrderQueryParam orderQueryParam = new OrderQueryParam(); OrderQueryParam orderQueryParam = new OrderQueryParam();
orderQueryParam.setLoanId(e.getLoanId()); orderQueryParam.setLoanId(e.getLoanId());
JsonResult<LoanOrderMapping> orderMappingJsonResult = this.kaService.findOrderMapping(orderQueryParam); JsonResult<LoanOrderMapping> orderMappingJsonResult = this.kaService.findOrderMapping(orderQueryParam);
if(Objects.isNull(orderMappingJsonResult) || !orderMappingJsonResult.isSuccess()){ if (Objects.isNull(orderMappingJsonResult) || !orderMappingJsonResult.isSuccess()) {
log.error("{} 查询渠道订单表数据为空 loanId={}",logPre,e.getLoanId()); log.error("{} 查询渠道订单表数据为空 loanId={}", logPre, e.getLoanId());
return; return;
} }
...@@ -232,7 +232,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -232,7 +232,7 @@ public class OrderServiceImpl implements IOrderService {
/** /**
* 查询用户信息 * 查询用户信息
*/ */
private JsonResult<UserBasicInfo> queryAndCheckUserInfo(EarlySettleUpOrderQueryParam orderQuery) { private JsonResult<UserBasicInfo> queryAndCheckUserInfo(EarlySettleUpOrderQueryParam orderQuery) {
String logPre = "OrderServiceImpl.queryAndCheckUserInfo"; String logPre = "OrderServiceImpl.queryAndCheckUserInfo";
...@@ -288,6 +288,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -288,6 +288,7 @@ public class OrderServiceImpl implements IOrderService {
/** /**
* 判断是否存在用户基础字段 * 判断是否存在用户基础字段
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
...@@ -297,6 +298,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -297,6 +298,7 @@ public class OrderServiceImpl implements IOrderService {
/** /**
* 判断是否存在订单基础字段 * 判断是否存在订单基础字段
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
...@@ -306,6 +308,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -306,6 +308,7 @@ public class OrderServiceImpl implements IOrderService {
/** /**
* 渠道号和渠道订单号同时存在判断 * 渠道号和渠道订单号同时存在判断
*
* @param orderQuery * @param orderQuery
* @return * @return
*/ */
...@@ -325,7 +328,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -325,7 +328,7 @@ public class OrderServiceImpl implements IOrderService {
} }
@Override @Override
public JsonResult<List<Map<String,Object>>> earlySettleUpTrial(Long loanId) { public JsonResult<List<Map<String, Object>>> earlySettleUpTrial(Long loanId) {
String logPre = "OrderServiceImpl.queryAndCheckUserInfo"; String logPre = "OrderServiceImpl.queryAndCheckUserInfo";
JsonResult<EarlySettleUpTrial> jsonResult = this.xyqbService.earlySettleUpTrial(loanId); JsonResult<EarlySettleUpTrial> jsonResult = this.xyqbService.earlySettleUpTrial(loanId);
......
...@@ -362,15 +362,15 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -362,15 +362,15 @@ public class XyqbServiceImpl implements IXyqbService {
String logPre = "[XyqbServiceImpl.findLoanOrder4EarlySettleUp] 查询一次性结清订单相关信息"; String logPre = "[XyqbServiceImpl.findLoanOrder4EarlySettleUp] 查询一次性结清订单相关信息";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/query"; String url = xyqbSysUrl + "/ex/operate/config/earlysettle/query";
Map<String, Object> queryParam = new HashMap<>(8); Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(orderQuery.getUserId()) && if (Objects.isNull(orderQuery.getUserId()) &&
Objects.isNull(orderQuery.getLoanId()) && Objects.isNull(orderQuery.getLoanId()) &&
StringUtils.isBlank(orderQuery.getFundOrderNo())){ StringUtils.isBlank(orderQuery.getFundOrderNo())) {
log.error("{} 请求参数都为空,不允许查询 orderQuery={}",logPre,orderQuery); log.error("{} 请求参数都为空,不允许查询 orderQuery={}", logPre, orderQuery);
return JsonResult.buildErrorStateResult("查询参数都为空,不允许查询", null); return JsonResult.buildErrorStateResult("查询参数都为空,不允许查询", null);
} }
queryParam.put("loan_id", orderQuery.getLoanId()); queryParam.put("loan_id", orderQuery.getLoanId());
queryParam.put("user_id",orderQuery.getUserId()); queryParam.put("user_id", orderQuery.getUserId());
queryParam.put("fund_order_no",orderQuery.getFundOrderNo()); queryParam.put("fund_order_no", orderQuery.getFundOrderNo());
log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, orderQuery, queryParam); log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, orderQuery, queryParam);
Map<String, String> header = new HashMap<>(2); Map<String, String> header = new HashMap<>(2);
...@@ -394,20 +394,20 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -394,20 +394,20 @@ public class XyqbServiceImpl implements IXyqbService {
} }
@Override @Override
public JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam){ public JsonResult<Boolean> operateEntry(OperateEntryParam operateEntryParam) {
String logPre = "[XyqbServiceImpl.operateEntry] 处理新增或删除白名单操作"; String logPre = "[XyqbServiceImpl.operateEntry] 处理新增或删除白名单操作";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/opt_white_list"; String url = xyqbSysUrl + "/ex/operate/config/earlysettle/opt_white_list";
Map<String, Object> queryParam = new HashMap<>(8); Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(operateEntryParam.getLoanId()) && if (Objects.isNull(operateEntryParam.getLoanId()) &&
Objects.isNull(operateEntryParam.getOpState())){ Objects.isNull(operateEntryParam.getOpState())) {
log.error("{} 请求参数都为空,不允许操作 orderQuery={}",logPre,operateEntryParam); log.error("{} 请求参数都为空,不允许操作 orderQuery={}", logPre, operateEntryParam);
return JsonResult.buildErrorStateResult("查询参数都为空,不允许操作", null); return JsonResult.buildErrorStateResult("查询参数都为空,不允许操作", null);
} }
queryParam.put("loan_id", operateEntryParam.getLoanId()); queryParam.put("loan_id", operateEntryParam.getLoanId());
if(operateEntryParam.getOpState()==1){ if (operateEntryParam.getOpState() == 1) {
queryParam.put("opt","ADD"); queryParam.put("opt", "ADD");
}else{ } else {
queryParam.put("opt","DEL"); queryParam.put("opt", "DEL");
} }
log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, operateEntryParam, queryParam); log.info("{} 请求参数 orderQuery={},queryParam={}", logPre, operateEntryParam, queryParam);
...@@ -426,7 +426,7 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -426,7 +426,7 @@ public class XyqbServiceImpl implements IXyqbService {
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) { if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
return JsonResult.buildErrorStateResult("[处理失败]", Boolean.FALSE); return JsonResult.buildErrorStateResult("[处理失败]", Boolean.FALSE);
} else { } else {
return JsonResult.buildSuccessResult("[操作成功]",Boolean.TRUE); return JsonResult.buildSuccessResult("[操作成功]", Boolean.TRUE);
} }
} }
} }
...@@ -436,8 +436,8 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -436,8 +436,8 @@ public class XyqbServiceImpl implements IXyqbService {
String logPre = "[XyqbServiceImpl.earlySettleUpTrial] 提前一次性结清金额试算"; String logPre = "[XyqbServiceImpl.earlySettleUpTrial] 提前一次性结清金额试算";
String url = xyqbSysUrl + "/ex/operate/config/earlysettle/trial_order"; String url = xyqbSysUrl + "/ex/operate/config/earlysettle/trial_order";
Map<String, Object> queryParam = new HashMap<>(8); Map<String, Object> queryParam = new HashMap<>(8);
if(Objects.isNull(loanId)){ if (Objects.isNull(loanId)) {
log.error("{} 请求参数为空,不允许操作 loanId={}",logPre,loanId); log.error("{} 请求参数为空,不允许操作 loanId={}", logPre, loanId);
return JsonResult.buildErrorStateResult("借据单号为空,不允许操作", null); return JsonResult.buildErrorStateResult("借据单号为空,不允许操作", null);
} }
queryParam.put("loan_id", loanId); queryParam.put("loan_id", loanId);
...@@ -457,7 +457,7 @@ public class XyqbServiceImpl implements IXyqbService { ...@@ -457,7 +457,7 @@ public class XyqbServiceImpl implements IXyqbService {
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) { if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
return JsonResult.buildErrorStateResult("[处理失败]", null); return JsonResult.buildErrorStateResult("[处理失败]", null);
} else { } else {
return JsonResult.buildSuccessResult("[操作成功]",jsonResult.getData()); return JsonResult.buildSuccessResult("[操作成功]", jsonResult.getData());
} }
} }
} }
......
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