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

添加校验

parent 10def013
......@@ -5,8 +5,10 @@ import cn.quantgroup.customer.rest.param.vcc.UserPreRepayInfoQuery;
import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IVccService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -14,6 +16,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Map;
import java.util.Objects;
@Slf4j
@RestController
......@@ -29,7 +32,10 @@ public class VccRest {
* @return
*/
@PostMapping("/offline_pre_repay/query_page")
public JsonResult queryPage(@RequestBody @Valid UserPreRepayInfoQuery query){
public JsonResult queryPage(@RequestBody @Valid UserPreRepayInfoQuery query, BindingResult bindingResult){
if (bindingResult.hasErrors()){
return JsonResult.buildErrorStateResult(bindingResult.getFieldError().getDefaultMessage());
}
log.info("queryPage | 开始用户待还款查询,param={}",query);
if (StringUtils.isBlank(query.getBillId()) && StringUtils.isBlank(query.getPhone())
&& StringUtils.isBlank(query.getUserId()) && StringUtils.isBlank(query.getOrderNo())){
......@@ -72,7 +78,23 @@ public class VccRest {
* @return
*/
@PostMapping("/offline_repay/save_submit")
public JsonResult saveSubmit(HttpServletRequest request, @RequestBody OfflineRepaySubmitParam param){
public JsonResult saveSubmit(HttpServletRequest request, @RequestBody@Valid OfflineRepaySubmitParam param,BindingResult bindingResult){
if (bindingResult.hasErrors()){
return JsonResult.buildErrorStateResult(bindingResult.getFieldError().getDefaultMessage());
}
if (param.getRepayType() == 1){
if (CollectionUtils.isEmpty(param.getList())){
return JsonResult.buildErrorStateResult("还款月还账单时,账单不能为空");
}
}else {
if (StringUtils.isBlank(param.getUniqueId())){
return JsonResult.buildErrorStateResult("提前结清时单号不能为空");
}
if (Objects.isNull(param.getCurrTerm())){
return JsonResult.buildErrorStateResult("提前结清开始期数不能为空");
}
}
log.info("saveSubmit | 开始保存线下还款的申请记录,param={}",param);
try {
String token = request.getHeader("x-auth-token");
......@@ -167,7 +189,15 @@ public class VccRest {
* @return
*/
@PostMapping("/approval/query_applly_record")
public JsonResult queryApplyRecord(@RequestBody UserPreRepayInfoQuery query){
public JsonResult queryApplyRecord(@RequestBody@Valid UserPreRepayInfoQuery query,BindingResult bindingResult){
if (bindingResult.hasErrors()){
return JsonResult.buildErrorStateResult(bindingResult.getFieldError().getDefaultMessage());
}
if (StringUtils.isBlank(query.getBillId()) && StringUtils.isBlank(query.getPhone())
&& StringUtils.isBlank(query.getUserId()) && StringUtils.isBlank(query.getOrderNo())){
log.error("queryPage | 请求参数userId,phone,billId,orderNo不能同时为空");
return JsonResult.buildErrorStateResult("请求参数userId,phone,billId,orderNo不能同时为空");
}
log.info("queryApplyRecord | 开始查看线下还款的申请记录,param={}",query);
try {
JsonResult jsonResult = vccService.queryApplyRecord(query);
......
package cn.quantgroup.customer.rest.param.vcc;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
......@@ -11,18 +14,31 @@ public class OfflineRepaySubmitParam {
private String uniqueId;
private List<ApplyBill> list;
private Integer currTerm;
@NotNull
private BigDecimal amount;
@NotNull
private BigDecimal actualAmount;
@NotNull
private LocalDate actualDate;
@NotBlank
private String transNo;
@NotBlank
private String receiveAccount;
@NotBlank
private String receiveAccountName;
@NotEmpty
private List<String> credentialsAddress;
private String mark;
@NotNull
private Integer repayType;
@NotBlank
private String name;
@NotBlank
private String phone;
@NotBlank
private String idNo;
@NotBlank
private String repayStatus;
@NotNull
private Integer userId;
}
......@@ -118,7 +118,7 @@ public class VccServiceImpl implements IVccService {
@Override
public JsonResult queryRepayCalDetail(String uniqueId, Integer repayType) throws Exception {
String url = talosHttp + "/vcc/pre_repay_cal/detail?uniqueId=" + uniqueId + "&repayType=" + repayType;
String url = talosHttp + "/vcc/offline_pre_repay/detail?uniqueId=" + uniqueId + "&repayType=" + repayType;
log.info("queryRepayCalDetail | 开始请求talos,url={}",url);
String get = httpService.get(url);
log.info("queryRepayCalDetail | 请求talos结束,get={}",get);
......
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