Commit db611497 authored by 刘帅阳's avatar 刘帅阳

修改

parent 776e8672
...@@ -243,23 +243,28 @@ public class CmsPriceClickServiceImpl extends ServiceImpl<CmsPriceClickRepositor ...@@ -243,23 +243,28 @@ public class CmsPriceClickServiceImpl extends ServiceImpl<CmsPriceClickRepositor
cmsPriceClicksDTOList.stream().filter(Objects::nonNull).collect(Collectors.toList()); cmsPriceClicksDTOList.stream().filter(Objects::nonNull).collect(Collectors.toList());
//添加前先遍历一下那些数据有问题 //添加前先遍历一下那些数据有问题
for (CmsPriceClickDTO cmsPriceClickDTO : cmsPriceClicksDTOList) { for (CmsPriceClickDTO cmsPriceClickDTO : cmsPriceClicksDTOList) {
//身份证号,手机号,银行卡号不为空时 //1.用户身份证号不能为空 18位 且必须为数字类型
if (cmsPriceClickDTO.getIdCard() != null || cmsPriceClickDTO.getPhone() != null || cmsPriceClickDTO.getBankCard() != null) { if (cmsPriceClickDTO.getIdCard() == null || cmsPriceClickDTO.getIdCard().length() != 18) {
//1.用户身份证号不能为空 18位 且必须为数字类型
if (cmsPriceClickDTO.getIdCard() == null || cmsPriceClickDTO.getIdCard().length() != 18) {
// throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getIdCard()); // throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getIdCard());
throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getMessage()); throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getMessage());
} }
//2.用户手机号 11位 //2.用户手机号 11位
if (cmsPriceClickDTO.getPhone() == null || cmsPriceClickDTO.getPhone().length() != 11) { if (cmsPriceClickDTO.getPhone() == null || cmsPriceClickDTO.getPhone().length() != 11) {
// throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getPhone()); // throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getPhone());
throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getMessage()); throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getMessage());
} }
//3.银行卡号不能为空 19位 //3.银行卡号不能为空 19位
if (cmsPriceClickDTO.getBankCard() == null || cmsPriceClickDTO.getBankCard().length() > 19) { if (cmsPriceClickDTO.getBankCard() == null || cmsPriceClickDTO.getBankCard().length() > 19) {
// throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getBankCard()); // throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getMessage() + ":" + cmsPriceClickDTO.getBankCard());
throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getMessage()); throw new CyServiceException(AdminUserInfoExceptionEnums.ID_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getMessage());
} }
//4.推广次数不能为空
if (cmsPriceClickDTO.getClickThroughRate() == null) {
throw new CyServiceException(AdminUserInfoExceptionEnums.CLICK_THROUGH_RATE_ERROR.getCode(), AdminUserInfoExceptionEnums.CLICK_THROUGH_RATE_ERROR.getMessage());
}
//5.价格不能为空
if (cmsPriceClickDTO.getPrice() == null) {
throw new CyServiceException(AdminUserInfoExceptionEnums.PRICE_ERROR.getCode(), AdminUserInfoExceptionEnums.PRICE_ERROR.getMessage());
} }
} }
......
...@@ -42,7 +42,9 @@ public enum AdminUserInfoExceptionEnums implements CyResExcEnum { ...@@ -42,7 +42,9 @@ public enum AdminUserInfoExceptionEnums implements CyResExcEnum {
USERNAME_NOT_EXISTS(4007, "当前用户不存在"), USERNAME_NOT_EXISTS(4007, "当前用户不存在"),
PHONE_LENGTH_ERROR(4007, "当前手机号长度错误"), PHONE_LENGTH_ERROR(4007, "当前手机号长度错误"),
ID_LENGTH_ERROR(4007, "当前身份证号长度错误或不能为空"), ID_LENGTH_ERROR(4007, "当前身份证号长度错误或不能为空"),
BANK_LENGTH_ERROR(4007, "当前银行卡号长度错误或不能为空"); BANK_LENGTH_ERROR(4007, "当前银行卡号长度错误或不能为空"),
CLICK_THROUGH_RATE_ERROR(4007, "当前点击率错误"),
PRICE_ERROR(4007, "当前单价错误");
private Integer code; private Integer code;
private String message; private String message;
......
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