Commit 6f772c8c authored by 刘帅阳's avatar 刘帅阳

修改

parent db611497
......@@ -32,6 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.math.BigInteger;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
......@@ -241,6 +242,8 @@ public class CmsPriceClickServiceImpl extends ServiceImpl<CmsPriceClickRepositor
//将文件解析成为对象集合
List<CmsPriceClickDTO> cmsPriceClicksDTOList = CyEpExcelUtil.importExcel(file, 0, 2, CmsPriceClickDTO.class);
cmsPriceClicksDTOList.stream().filter(Objects::nonNull).collect(Collectors.toList());
//
Pattern pattern = Pattern.compile("[0-9]*");
//添加前先遍历一下那些数据有问题
for (CmsPriceClickDTO cmsPriceClickDTO : cmsPriceClicksDTOList) {
//1.用户身份证号不能为空 18位 且必须为数字类型
......@@ -266,6 +269,14 @@ public class CmsPriceClickServiceImpl extends ServiceImpl<CmsPriceClickRepositor
if (cmsPriceClickDTO.getPrice() == null) {
throw new CyServiceException(AdminUserInfoExceptionEnums.PRICE_ERROR.getCode(), AdminUserInfoExceptionEnums.PRICE_ERROR.getMessage());
}
//手机号只能是数字
if (!pattern.matcher(cmsPriceClickDTO.getPhone()).matches()) {
throw new CyServiceException(AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.PHONE_LENGTH_ERROR.getMessage());
}
//银行卡号只能是数字
if (!pattern.matcher(cmsPriceClickDTO.getBankCard()).matches()) {
throw new CyServiceException(AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getCode(), AdminUserInfoExceptionEnums.BANK_LENGTH_ERROR.getMessage());
}
}
......
......@@ -40,11 +40,11 @@ public enum AdminUserInfoExceptionEnums implements CyResExcEnum {
USER_NOT_LOGINPERMISSIOR(4007, "当前用户无权登录"),
USERNAME_NOT_EXISTS(4007, "当前用户不存在"),
PHONE_LENGTH_ERROR(4007, "当前手机号长度错误"),
ID_LENGTH_ERROR(4007, "当前身份证号长度错误或不能为空"),
BANK_LENGTH_ERROR(4007, "当前银行卡号长度错误或不能为空"),
CLICK_THROUGH_RATE_ERROR(4007, "当前点击率错误"),
PRICE_ERROR(4007, "当前单价错误");
PHONE_LENGTH_ERROR(4007, "当前手机号错误或不能为空"),
ID_LENGTH_ERROR(4007, "当前身份证号错误或不能为空"),
BANK_LENGTH_ERROR(4007, "当前银行卡号错误或不能为空"),
CLICK_THROUGH_RATE_ERROR(4007, "当前推广次数错误或不能为空"),
PRICE_ERROR(4007, "当前价格错误或不能为空");
private Integer code;
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