Commit cb3f3acd authored by 王向伟's avatar 王向伟

客服系统自测,修改问题,添加渠道查询接口

parent b3d6b32c
...@@ -3,6 +3,7 @@ package cn.quantgroup.customer.config.http.security; ...@@ -3,6 +3,7 @@ package cn.quantgroup.customer.config.http.security;
import cn.quantgroup.customer.config.http.mvc.filter.CsrfHeaderFilter; import cn.quantgroup.customer.config.http.mvc.filter.CsrfHeaderFilter;
import cn.quantgroup.customer.service.IUserService; import cn.quantgroup.customer.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
...@@ -21,6 +22,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -21,6 +22,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private final IUserService userService; private final IUserService userService;
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
@Value("${allowed.routes}")
private String allowedRoutes;
@Autowired @Autowired
public WebSecurityConfig(IUserService userService, PasswordEncoder passwordEncoder) { public WebSecurityConfig(IUserService userService, PasswordEncoder passwordEncoder) {
this.userService = userService; this.userService = userService;
...@@ -30,8 +33,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -30,8 +33,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
//String allowedRoutes = "/test/**,/error/**,/user/**,/repay/**"; //String allowedRoutes = "/test/**,/error/**,/user/login";
String allowedRoutes = "/test/**,/error/**,/user/login";
String[] allowedRoutesArr = allowedRoutes.split(","); String[] allowedRoutesArr = allowedRoutes.split(",");
http.httpBasic().and() http.httpBasic().and()
.authorizeRequests() .authorizeRequests()
......
package cn.quantgroup.customer.model.kaordermapping;
import lombok.Data;
/**
* Created by wudi on 2016/11/28.
*/
@Data
public class ChannelConfigurationResult {
private Long id;
private String channelName;
private String channelCode;
private Long registeredFrom;
}
\ No newline at end of file
...@@ -133,8 +133,6 @@ public class Repayment { ...@@ -133,8 +133,6 @@ public class Repayment {
} }
repayment.setRepaymentStatus(repayStatus); repayment.setRepaymentStatus(repayStatus);
//还款类型 待确定
repayment.setRepayType(repaymentPlanItem.getRepaymentType()); repayment.setRepayType(repaymentPlanItem.getRepaymentType());
repayment.setOverdueDays(repaymentPlanItem.getOverdueDays()); repayment.setOverdueDays(repaymentPlanItem.getOverdueDays());
return repayment; return repayment;
......
package cn.quantgroup.customer.rest;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IKaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 渠道相关
*
* @author Wang Xiangwei
* @version 2020/3/13
*/
@Slf4j
@RestController
@RequestMapping("/channel")
public class ChannelRest {
@Autowired
private IKaService kaService;
@GetMapping("/all")
public JsonResult<List<ChannelConfigurationResult>> getAllChannel() {
JsonResult<List<ChannelConfigurationResult>> allChannelConfiguration = kaService.getAllChannelConfiguration();
return allChannelConfiguration;
}
}
package cn.quantgroup.customer.service; package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping; import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam; import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
...@@ -17,9 +18,12 @@ public interface IKaService { ...@@ -17,9 +18,12 @@ public interface IKaService {
/** /**
* key 申请订单号 value 渠道订单号 * key 申请订单号 value 渠道订单号
*
* @param applyOrderNos * @param applyOrderNos
* @return * @return
*/ */
JsonResult<Map<String,String>> findMap(List<String> applyOrderNos); JsonResult<Map<String, String>> findMap(List<String> applyOrderNos);
JsonResult<List<ChannelConfigurationResult>> getAllChannelConfiguration();
} }
package cn.quantgroup.customer.service; package cn.quantgroup.customer.service;
import cn.quantgroup.customer.model.xyqbuser.UserBasicInfo;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam; import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneAudit; import cn.quantgroup.customer.rest.param.phone.ModifyPhoneAudit;
import cn.quantgroup.customer.rest.param.phone.ModifyPhoneFeedback; import cn.quantgroup.customer.rest.param.phone.ModifyPhoneFeedback;
...@@ -24,16 +25,15 @@ public interface IUserService extends UserDetailsService { ...@@ -24,16 +25,15 @@ public interface IUserService extends UserDetailsService {
/** /**
* 用户基本信息 * 用户基本信息
*
* @param userQueryParam * @param userQueryParam
* @return * @return
*/ */
JsonResult findUserInfo(UserQueryParam userQueryParam); JsonResult<UserBasicInfo> findUserInfo(UserQueryParam userQueryParam);
JsonResult findUserInfoByOrderParam(OrderQueryParam orderQueryParam); JsonResult<UserBasicInfo> findUserInfoByOrderParam(OrderQueryParam orderQueryParam);
JsonResult findUserCombination(UserCombinationParam userCombinationParam); JsonResult findUserCombination(UserCombinationParam userCombinationParam);
} }
...@@ -2,11 +2,14 @@ package cn.quantgroup.customer.service.impl; ...@@ -2,11 +2,14 @@ package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.enums.ErrorCodeEnum; import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.exception.BusinessException; import cn.quantgroup.customer.exception.BusinessException;
import cn.quantgroup.customer.model.kaordermapping.ChannelConfigurationResult;
import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping; import cn.quantgroup.customer.model.kaordermapping.LoanOrderMapping;
import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam; import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IKaService; import cn.quantgroup.customer.service.IKaService;
import cn.quantgroup.customer.service.http.IHttpService; import cn.quantgroup.customer.service.http.IHttpService;
import cn.quantgroup.customer.util.JSONTools;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -21,8 +24,6 @@ import java.util.Map; ...@@ -21,8 +24,6 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.StringJoiner; import java.util.StringJoiner;
import static cn.quantgroup.customer.constant.Constant.GSON;
/** /**
* @author Wang Xiangwei * @author Wang Xiangwei
* @version 2020/3/9 * @version 2020/3/9
...@@ -32,7 +33,7 @@ import static cn.quantgroup.customer.constant.Constant.GSON; ...@@ -32,7 +33,7 @@ import static cn.quantgroup.customer.constant.Constant.GSON;
public class KaServiceImpl implements IKaService { public class KaServiceImpl implements IKaService {
@Value("${ka.api.http}") @Value("${qapi.http}")
private String kaSysUrl; private String kaSysUrl;
@Autowired @Autowired
...@@ -51,34 +52,40 @@ public class KaServiceImpl implements IKaService { ...@@ -51,34 +52,40 @@ public class KaServiceImpl implements IKaService {
String applyOrderNo = orderQueryParam.getApplyOrderNo(); String applyOrderNo = orderQueryParam.getApplyOrderNo();
String channelOrderNo = orderQueryParam.getChannelOrderNo(); String channelOrderNo = orderQueryParam.getChannelOrderNo();
Long loanId = orderQueryParam.getLoanId(); Long loanId = orderQueryParam.getLoanId();
Long channelId = orderQueryParam.getChannelId();
String url = kaSysUrl + "/external/get/orderMapping"; String url = kaSysUrl + "/external/get/orderMapping";
try { try {
Map<String, Object> param = Maps.newHashMap(); Map<String, Object> param = Maps.newHashMap();
if (!Objects.isNull(applyOrderNo)) { if (Objects.nonNull(applyOrderNo)) {
param.put("applyOrderNo", applyOrderNo); param.put("applyOrderNo", applyOrderNo);
} }
if (StringUtils.isNotBlank(channelOrderNo)) { if (StringUtils.isNotBlank(channelOrderNo)) {
param.put("channelOrderNo", channelOrderNo); param.put("channelOrderNo", channelOrderNo);
} }
if (!Objects.isNull(loanId)) { if (Objects.nonNull(channelId)) {
param.put("channelId", channelId);
}
if (Objects.nonNull(loanId)) {
param.put("loanId", loanId); param.put("loanId", loanId);
} }
String result = httpService.get(url, param); String result = null;
try {
result = httpService.get(url, param);
} catch (Exception e) {
log.error(" {}查询orderMapping失败http请求异常 url={},param={}", logPre, url, param, e);
return JsonResult.buildErrorStateResult("通讯异常", null);
}
log.info("{} 请求ka系统返回值:{}", logPre, result); log.info("{} 请求ka系统返回值:{}", logPre, result);
JsonResult jsonResult = GSON.fromJson(result, JsonResult.class);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) { if (StringUtils.isBlank(result)) {
log.error("{} 查询orderMapping失败 jsonResult={}", logPre, jsonResult); log.error("{} 查询orderMapping失败 jsonResult={}", logPre, result);
return JsonResult.buildErrorStateResult("查询orderMapping失败", null); return JsonResult.buildErrorStateResult("查询orderMapping失败", null);
} }
TypeReference<JsonResult<LoanOrderMapping>> typeToken = new TypeReference<JsonResult<LoanOrderMapping>>() {
Object data = jsonResult.getData(); };
LoanOrderMapping loanOrderMapping = GSON.fromJson(data.toString(), LoanOrderMapping.class); JsonResult<LoanOrderMapping> jsonResult = JSONTools.deserialize(result, typeToken);
jsonResult.setData(loanOrderMapping);
return jsonResult; return jsonResult;
...@@ -106,15 +113,49 @@ public class KaServiceImpl implements IKaService { ...@@ -106,15 +113,49 @@ public class KaServiceImpl implements IKaService {
Map<String, Object> param = Maps.newHashMap(); Map<String, Object> param = Maps.newHashMap();
param.put("applyNos", stringJoiner.toString()); param.put("applyNos", stringJoiner.toString());
String result = httpService.get(url, param); String result;
try {
result = httpService.get(url, param);
} catch (Exception e) {
log.error("{} 通过申请订单号获取渠道订单号失败", logPre, e);
return JsonResult.buildErrorStateResult("查询渠道订单号失败", null);
}
log.info("{} 请求ka系统返回值:{}", logPre, result); if (StringUtils.isBlank(result)) {
JsonResult jsonResult = GSON.fromJson(result, JsonResult.class); log.error("{} 获得渠道订单号 jsonResult={}", logPre, result);
if (Objects.isNull(jsonResult) || !jsonResult.isSuccess()) {
log.error("{} 获得渠道订单号 jsonResult={}", logPre, jsonResult);
return JsonResult.buildErrorStateResult("获得渠道订单号", null); return JsonResult.buildErrorStateResult("获得渠道订单号", null);
} }
TypeReference<JsonResult<Map<String, String>>> typeToken = new TypeReference<JsonResult<Map<String, String>>>() {
};
JsonResult<Map<String, String>> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult;
}
@Override
public JsonResult<List<ChannelConfigurationResult>> getAllChannelConfiguration() {
String logPre = "KaServiceImpl.getAllChannelConfiguration";
log.info("{},获得所有渠道", logPre);
String url = kaSysUrl + "/external//query/all/channelConfiguration";
String result;
try {
result = httpService.get(url);
} catch (Exception e) {
log.error("{} 获得所有渠道失败", logPre, e);
return JsonResult.buildErrorStateResult("获得所有渠道失败", null);
}
if (StringUtils.isBlank(result)) {
log.error("{} 获得所有渠道 jsonResult={}", logPre, result);
return JsonResult.buildErrorStateResult("获得所有渠道失败", null);
}
TypeReference<JsonResult<List<ChannelConfigurationResult>>> typeToken = new TypeReference<JsonResult<List<ChannelConfigurationResult>>>() {
};
JsonResult<List<ChannelConfigurationResult>> jsonResult = JSONTools.deserialize(result, typeToken);
return jsonResult; return jsonResult;
} }
} }
...@@ -43,11 +43,12 @@ public class OrderServiceImpl implements IOrderService { ...@@ -43,11 +43,12 @@ public class OrderServiceImpl implements IOrderService {
JsonResult<List<FlowNode>> flowChart = xyqbService.findFlowChart(applyOrderNo); JsonResult<List<FlowNode>> flowChart = xyqbService.findFlowChart(applyOrderNo);
if (!flowChart.isSuccess()) { if (!flowChart.isSuccess()) {
log.error("{} 流程图查询失败 result={}", logPre, flowChart);
return flowChart; return flowChart;
} }
List<FlowNode> flowNodeList = flowChart.getData(); List<FlowNode> flowNodeList = flowChart.getData();
if (!Objects.isNull(head)) { if (Objects.nonNull(head)) {
FlowNode flowNode = new FlowNode(); FlowNode flowNode = new FlowNode();
flowNode.setName("渠道用户信息导入"); flowNode.setName("渠道用户信息导入");
flowNode.setStatus(1); flowNode.setStatus(1);
...@@ -66,8 +67,8 @@ public class OrderServiceImpl implements IOrderService { ...@@ -66,8 +67,8 @@ public class OrderServiceImpl implements IOrderService {
JsonResult<LoanOrder> loanOrder = xyqbService.findLoanOrder(loanId); JsonResult<LoanOrder> loanOrder = xyqbService.findLoanOrder(loanId);
if (!loanOrder.isSuccess()) { if (!loanOrder.isSuccess()) {
log.error("{} 提现订单查询失败 loanId={}, result={}",logPre,loanId,loanOrder); log.error("{} 提现订单查询失败 loanId={}, result={}", logPre, loanId, loanOrder);
return JsonResult.buildErrorStateResult(loanOrder.getMsg(),loanOrder.getData()); return JsonResult.buildErrorStateResult(loanOrder.getMsg(), loanOrder.getData());
} }
...@@ -80,13 +81,12 @@ public class OrderServiceImpl implements IOrderService { ...@@ -80,13 +81,12 @@ public class OrderServiceImpl implements IOrderService {
List<Repayment> repaymentList = new ArrayList<>(); List<Repayment> repaymentList = new ArrayList<>();
List<RepaymentPlanItem> repaymentPlans = orderRepaymentJsonResult.getData().getRepaymentPlans(); List<RepaymentPlanItem> repaymentPlans = orderRepaymentJsonResult.getData().getRepaymentPlans();
repaymentPlans.forEach(e->repaymentList.add(Repayment.valueOf(e))); repaymentPlans.forEach(e -> repaymentList.add(Repayment.valueOf(e)));
LoanOrderDetail loanOrderDetail = new LoanOrderDetail(); LoanOrderDetail loanOrderDetail = new LoanOrderDetail();
loanOrderDetail.setLoanOrder(loanOrder.getData()); loanOrderDetail.setLoanOrder(loanOrder.getData());
loanOrderDetail.setRepaymentList(repaymentList); loanOrderDetail.setRepaymentList(repaymentList);
return JsonResult.buildSuccessResult("",loanOrderDetail); return JsonResult.buildSuccessResult("", loanOrderDetail);
} }
} }
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