Commit c90c0c4f authored by 陈宏杰's avatar 陈宏杰

中台提前结清操作

parent 0a28b76a
......@@ -26,7 +26,7 @@ import java.util.Objects;
* @Desc 鉴权过滤器
* @Update
*/
@WebFilter(filterName = "operatePermitFilter",urlPatterns = {"/operate/sys/*"})
@WebFilter(filterName = "operatePermitFilter",urlPatterns = {"/operate/sys/*","/repay/earlySettleOperate"})
@Slf4j
public class ValidOperatePermitFilter implements Filter {
@Autowired
......
package cn.quantgroup.customer.rest;
import cn.quantgroup.customer.aop.OperateLog;
import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.rest.param.card.ModifyCardsQuery;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryReq;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateReq;
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.service.IRepayService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Objects;
import static cn.quantgroup.customer.constant.Constant.GSON;
@Slf4j
......@@ -66,4 +69,20 @@ public class RepayRest {
log.info("[查询还款操作记录],请求参数:businessFlowNo={}", businessFlowNo);
return repayService.queryRepayOptRecords(businessFlowNo);
}
@PostMapping("/earlySettleOperateQuery")
public JsonResult earlySettleOperateQuery(@Valid EarlySettleOperateQueryReq req) {
log.info("[earlySettleOperateQuery],请求参数: {}", JSONObject.toJSONString(req));
return repayService.settleOperateQuery(req);
}
@PostMapping("/earlySettleOperate")
@OperateLog(moduleName = "中台提前结清操作")
public JsonResult earlySettleOperate(@Valid EarlySettleOperateReq req) {
if (Objects.isNull(req) || StringUtils.isBlank(req.getCardNo()) || Objects.isNull(req.getLoanId())) {
return JsonResult.buildErrorStateResult(ErrorCodeEnum.PARAM_ERROR.getMessage(), ErrorCodeEnum.PARAM_ERROR.getCode());
}
return repayService.earlySettleOperate(req);
}
}
package cn.quantgroup.customer.rest.param.repay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EarlySettleOperateQueryReq implements Serializable {
@NotNull(message = "借款订单号不能为空")
private Long loanId;
}
package cn.quantgroup.customer.rest.param.repay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EarlySettleOperateQueryResp implements Serializable {
private Long userId;
private String name;
private String phoneNo;
private String uuid;
private Long loanId;
private BigDecimal earlySettleTotalAmount;
private Boolean supportEarlySettle;
private String orderStatus;
private String orderStatusDesc;
private String cardNo;
}
package cn.quantgroup.customer.rest.param.repay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EarlySettleOperateReq implements Serializable {
@NotNull(message = "借款订单号不能为空")
private Long loanId;
@NotNull(message = "银行卡号不能为空")
private String cardNo;
}
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryReq;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryResp;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateReq;
import cn.quantgroup.customer.rest.vo.JsonResult;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
public interface IKoalaService {
JsonResult<List<EarlySettleOperateQueryResp>> settleOperateQuery(EarlySettleOperateQueryReq req);
JsonResult<JSONObject> earlySettleOperate(EarlySettleOperateReq req);
}
package cn.quantgroup.customer.service;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryReq;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateReq;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
......@@ -10,4 +12,8 @@ public interface IRepayService {
JsonResult queryRepayInfo(RepayOrderInfoQuery repayOrderQuery);
JsonResult queryRepayOptRecords(String businessFlowNo);
JsonResult settleOperateQuery(EarlySettleOperateQueryReq req);
JsonResult earlySettleOperate(EarlySettleOperateReq req);
}
package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryReq;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryResp;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateReq;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IKoalaService;
import cn.quantgroup.customer.service.http.IHttpService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Slf4j
@Service("koalaService")
public class KoalaServiceImpl implements IKoalaService {
@Value("${koala.https}")
private String koalaSysUrl;
private final IHttpService httpService;
private final UserSdkImpl userSdk;
@Autowired
public KoalaServiceImpl(IHttpService httpService, UserSdkImpl userSdk) {
this.httpService = httpService;
this.userSdk = userSdk;
}
@Override
public JsonResult<List<EarlySettleOperateQueryResp>> settleOperateQuery(EarlySettleOperateQueryReq req) {
JsonResult<List<EarlySettleOperateQueryResp>> jsonResult = null;
String url = koalaSysUrl + "/v1/repayment/early_settlement/earlySettleOperateQuery";
Map<String, Object> param = Maps.newHashMap();
param.put("loanId",req.getLoanId());
String response = httpService.get(url, param);
log.info("[KoalaServiceImpl][settleOperateQuery] param:{},请求业务系统返回值:{}", param, response);
if (StringUtils.isBlank(response)) {
return JsonResult.buildErrorStateResult("查询失败", null);
}
JSONObject jsonObject = JSONObject.parseObject(response);
if (jsonObject.getBoolean("success")) {
JSONArray data = jsonObject.getJSONArray("data");
jsonResult = JsonResult.buildSuccessResult("查询成功",data.toJavaList(EarlySettleOperateQueryResp.class));
} else {
jsonResult = JsonResult.buildErrorStateResult(jsonObject.getString("msg"));
}
return jsonResult;
}
@Override
public JsonResult<JSONObject> earlySettleOperate(EarlySettleOperateReq req) {
JsonResult<JSONObject> jsonResult = null;
String url = koalaSysUrl + "/v1/repayment/early_settlement/simpleCallPay";
Map<String, Object> param = Maps.newHashMap();
param.put("loanId",req.getLoanId());
param.put("cardNo",req.getCardNo());
param.put("noncestr","ceshikoalanoncestr");
String response = httpService.post(url, param);
log.info("[KoalaServiceImpl][earlySettleOperate] param:{},请求业务系统返回值:{}", param, response);
if (StringUtils.isBlank(response)) {
return JsonResult.buildErrorStateResult("请求失败", null);
}
JSONObject jsonObject = JSONObject.parseObject(response);
if (jsonObject.getBoolean("success")) {
JsonResult.buildSuccessResult("已操作",null);
} else {
jsonResult = JsonResult.buildErrorStateResult(jsonObject.getString("msg"));
}
return jsonResult;
}
}
......@@ -3,6 +3,8 @@ package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.constant.Constant;
import cn.quantgroup.customer.enums.ErrorCodeEnum;
import cn.quantgroup.customer.exception.BusinessException;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateQueryReq;
import cn.quantgroup.customer.rest.param.repay.EarlySettleOperateReq;
import cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery;
import cn.quantgroup.customer.rest.param.repay.RepayOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
......@@ -10,10 +12,7 @@ import cn.quantgroup.customer.rest.vo.MoResult;
import cn.quantgroup.customer.rest.vo.repay.RepayInfoResult;
import cn.quantgroup.customer.rest.vo.repay.RepayOptRecord;
import cn.quantgroup.customer.rest.vo.repay.XyqbRepayInfo;
import cn.quantgroup.customer.service.IRepayService;
import cn.quantgroup.customer.service.ISidecarService;
import cn.quantgroup.customer.service.IUserService;
import cn.quantgroup.customer.service.IXyqbService;
import cn.quantgroup.customer.service.*;
import cn.quantgroup.user.retbean.XUser;
import cn.quantgroup.user.vo.UserSysResult;
import lombok.extern.slf4j.Slf4j;
......@@ -33,13 +32,15 @@ public class RepayServiceImpl implements IRepayService {
private final UserSdkImpl userSdk;
private final IXyqbService xyqbService;
private final ISidecarService sidecarService;
private final IKoalaService koalaService;
@Autowired
public RepayServiceImpl(IUserService userService, UserSdkImpl userSdk, IXyqbService xyqbService, ISidecarService sidecarService) {
public RepayServiceImpl(IUserService userService, UserSdkImpl userSdk, IXyqbService xyqbService, ISidecarService sidecarService, IKoalaService koalaService) {
this.userService = userService;
this.userSdk = userSdk;
this.xyqbService = xyqbService;
this.sidecarService = sidecarService;
this.koalaService = koalaService;
}
@Override
......@@ -154,4 +155,16 @@ public class RepayServiceImpl implements IRepayService {
log.info("[查询还款操作记录],返回 repayOptRecordResult={}", repayOptRecordResult);
return JsonResult.buildSuccessResult("处理成功", repayOptRecordResult.getData());
}
@Override
public JsonResult settleOperateQuery(EarlySettleOperateQueryReq req) {
return koalaService.settleOperateQuery(req);
}
@Override
public JsonResult earlySettleOperate(EarlySettleOperateReq req) {
req.setCardNo(req.getCardNo().trim());
return koalaService.earlySettleOperate(req);
}
}
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