diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgApplyAmountInfoController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgApplyAmountInfoController.java index 16082a66..3dc9adb7 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgApplyAmountInfoController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgApplyAmountInfoController.java @@ -12,6 +12,7 @@ import com.daqing.financial.guarantee.model.response.BusinessApplicationExportRe import com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse; import com.daqing.financial.guarantee.service.IDgApplyAmountInfoService; import com.daqing.financial.guarantee.service.IDgApplyAmountListService; +import com.daqing.financial.guarantee.util.MoneyUtil; import com.daqing.framework.annotation.Log; import com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest; import com.daqing.framework.domain.guarantee.DgApplyField; @@ -100,9 +101,15 @@ public class DgApplyAmountInfoController implements DgApplyAmountInfoControllerA @Log(detail = "业务申请",level = 3,operationUnit = OperationUnit.APPLYAMOUNTINFO,operationType = OperationType.INSERT) @PostMapping("/businessApplication") @ApiOperation(value = "业务申请") - public ResponseResult businessApplication(@RequestBody @Valid BusinessApplicationRequest businessApplication){ - int result = applyAmountInfoService.businessApplication(businessApplication); - return result>0 ? ResponseResult.SUCCESS("上传成功"):ResponseResult.FAIL(40004,"上传失败"); + public ResponseResult businessApplication(@RequestBody BusinessApplicationRequest businessApplication){ + boolean legal = MoneyUtil.judgeTwoDecimal(businessApplication.getApplyAmount()); + if(legal==true){ + int result = applyAmountInfoService.businessApplication(businessApplication); + return result>0 ? ResponseResult.SUCCESS("上传成功"):ResponseResult.FAIL(40004,"上传失败"); + }else{ + return ResponseResult.FAIL(40009,"申请额度格式错误!"); + } + } /** diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java index 842aa85a..3bc132d0 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java @@ -44,7 +44,7 @@ public class BusinessApplicationRequest implements Serializable { /** * 申请额度 */ - @Pattern(regexp = "^(([1-9]{1}\\d*)|(0{1}))(\\.\\d{1,2})?$", message = "申请额度格式错误!") + //@Pattern(regexp = "^(([1-9]{1}\\d*)|(0{1}))(\\.\\d{1,2})?$", message = "申请额度格式错误!") @ApiModelProperty(value = "申请额度") private BigDecimal applyAmount; diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/util/MoneyUtil.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/util/MoneyUtil.java new file mode 100644 index 00000000..652210a8 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/util/MoneyUtil.java @@ -0,0 +1,26 @@ +package com.daqing.financial.guarantee.util; + + +import java.util.regex.Pattern; + +public class MoneyUtil { + + //两位小数金额校验 + public static boolean judgeTwoDecimal(Object obj) { + boolean flag = false; + try { + if (obj != null) { + String source = obj.toString(); + // 判断是否是整数或者是携带一位或者两位的小数 + Pattern pattern = Pattern.compile("^[+]?([0-9]+(.[0-9]{1,2})?)$"); + if (pattern.matcher(source).matches()) { + flag = true; + } + } + } catch (Exception e) { + e.getMessage(); + } + return flag; + } + +} \ No newline at end of file diff --git a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountListMapper.xml b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountListMapper.xml index e8e56b79..f0602c7a 100644 --- a/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountListMapper.xml +++ b/dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountListMapper.xml @@ -17,7 +17,7 @@ - select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,au.create_time, + select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,ai.create_time, au.status,au.operating_status,cc.name,cc.phone,ps.business_status from dg_assets_investigation au left join dg_apply_amount_info ai on au.business_id = ai.id @@ -64,7 +64,7 @@ - select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,au.create_time, + select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,ai.create_time, au.status,au.operating_status,cc.name,cc.phone,ps.business_status from dg_guarantee_assign_user au left join dg_apply_amount_info ai on au.business_id = ai.id @@ -47,7 +47,7 @@ - select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,au.create_time, + select au.id,au.role_id,au.company_id,au.business_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,ai.create_time, au.status,au.operating_status,cc.name,cc.phone,ps.business_status from dg_message_investigation au left join dg_apply_amount_info ai on au.business_id = ai.id @@ -46,7 +46,7 @@