Commit c17ca44c authored by yexiong.wang's avatar yexiong.wang

Merge branch 'master' into offlineRepayClear_20220115

parents 7c75febc c8632e52
......@@ -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
......
......@@ -2,6 +2,8 @@ package cn.quantgroup.customer.model.xyqbuser;
import lombok.Data;
import java.math.BigDecimal;
/**
* 信用钱包用户基本展示信息
*
......@@ -41,6 +43,24 @@ public class UserBasicInfo {
* 手机号(明文)
*/
private String phoneNumber;
/**
*客户权益
*/
private String levelBenefit;
/**
* 等级
*/
private Integer level;
/**
* 等级名称
*/
private String levelName;
/**
* 积分
*/
private BigDecimal point;
/**
* 有效期
*/
private String levelValidityTerm;
}
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);
}
}
......@@ -23,13 +23,14 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.security.Principal;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static cn.quantgroup.customer.constant.Constant.GSON;
......@@ -246,8 +247,56 @@ public class UserRest {
}
return JsonResult.buildSuccessResult("success", result);
}
//add by wuq 2022-01-14 begin
/**
* 积分类型初始化
* @return
*/
@PostMapping(value = "/search/getRewardPointsType")
public JsonResult getRewardPointsTypeInit() {
MoResult<String> result = userService.getRewardPointsType();
if(!"0000".equals(result.getCode())){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult("success", result.getData());
}
/**
*根据userId和phoneNo查询基本信息
*/
@PostMapping(value = "/search/userInfo")
public JsonResult getBasicUserInfo(UserQueryParam userQueryParam) {
JsonResult result = userService.findUserInfoByUserParam(userQueryParam);
if(!result.isSuccess()){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult("success",result);
}
/**
*根据userId查询优惠券信息(详情)
*/
@RequestMapping(value = "/search/getUserCouponInfo")
public JsonResult getUserCouponInfo(UserQueryParam userQueryParam) {
MoResult<String> result = userService.queryUserCouponInfoByUserParam(userQueryParam);
if(!"0000".equals(result.getCode())){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult("success",result);
}
/**
*根据积分类型和操作时间查询积分明细
*/
@PostMapping(value = "/search/queryPointDetailByPage")
public JsonResult queryPointDetailByPage(UserQueryParam userQueryParam) {
if(Objects.isNull(userQueryParam.getUserId())){
return JsonResult.buildErrorStateResult("userId不能为空",null);
}
MoResult<String> result = userService.queryPointDetailByPage(userQueryParam);
if(result == null || !"0000".equals(result.getCode())){
return JsonResult.buildErrorStateResult(result.getMsg(),result.getData());
}
return JsonResult.buildSuccessResult("success", result.getData());
}
}
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;
}
......@@ -22,4 +22,22 @@ public class UserQueryParam {
private Long userId;
private String uuid;
/**
* 积分类型
*/
private Integer eventType;
/**
* 操作时间
*/
private String operationTime;
/**
* 当前页数
*/
private Integer pageNo;
/**
* 每页多少条数据
*/
private Integer pageSize;
private String status;
}
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);
}
......@@ -68,4 +68,11 @@ public interface IUserService extends UserDetailsService {
*/
MoResult<String> modifyUserDetail(Long userId, String realName, String idNO);
MoResult<String> getRewardPointsType();
JsonResult<UserBasicInfo> findUserInfoByUserParam(UserQueryParam userQueryParam);
MoResult<String> queryPointDetailByPage(UserQueryParam userQueryParam);
MoResult<String> queryUserCouponInfoByUserParam(UserQueryParam userQueryParam);
}
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 = JsonResult.buildSuccessResult("已操作",response);
} 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