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

增加xyqb接口调用

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