|
@@ -283,8 +283,12 @@ public class FactoryServiceImpl implements FactoryService {
|
|
|
req.setKeymanName(factoryProperty.getKeymanName());
|
|
|
req.setKeymanMobile(factoryProperty.getKeymanMobile());
|
|
|
req.setEmail(factoryProperty.getEmail());
|
|
|
+ req.setProvince(factoryProperty.getProvince());
|
|
|
+ req.setCity(factoryProperty.getCity());
|
|
|
+ req.setDistrict(factoryProperty.getDistrict());
|
|
|
+ req.setMaxFileCount(IMathUtils.toLong(factoryProperty.getMaxFileCount()));
|
|
|
+ req.setAddress(factoryProperty.getAddress());
|
|
|
}
|
|
|
- req.setMaxFileCount(IMathUtils.toLong(factoryProperty.getMaxFileCount()));
|
|
|
req.setDescription(factoryProperty.getDescription());
|
|
|
|
|
|
saveFactory(req);
|
|
@@ -361,9 +365,41 @@ public class FactoryServiceImpl implements FactoryService {
|
|
|
if(FactoryTypeEnum.getCode(factoryProperty.getFactoryType()) == null){
|
|
|
errorMessage.append("供应商类型").append("枚举值不正确,");
|
|
|
}else {
|
|
|
+ if (FactoryTypeEnum.COVER.is(FactoryTypeEnum.getCode(factoryProperty.getFactoryType()))){
|
|
|
+ if (StringUtils.isNotBlank(factoryProperty.getIsFirstFactory())) {
|
|
|
+ if(FirstFactoryEnum.getCode(factoryProperty.getIsFirstFactory()) == null){
|
|
|
+ errorMessage.append("是否一级供应商").append("枚举值不正确,");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ errorMessage.append("是否一级供应商").append("为空,");
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!FactoryTypeEnum.BEER.is(FactoryTypeEnum.getCode(factoryProperty.getFactoryType()))) {
|
|
|
+ //邮箱判空或格式校验
|
|
|
if (StringUtils.isBlank(factoryProperty.getEmail())) {
|
|
|
errorMessage.append("邮箱").append("为空,");
|
|
|
+ }else {
|
|
|
+ Pattern emailFormat = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
|
|
|
+ if (!emailFormat.matcher(factoryProperty.getEmail()).matches()) {
|
|
|
+ errorMessage.append("邮箱").append("格式不正确,");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //详细地址判空或格式校验
|
|
|
+ if (StringUtils.isBlank(factoryProperty.getAddress())) {
|
|
|
+ errorMessage.append("详细地址").append("为空,");
|
|
|
+ }else {
|
|
|
+ if (factoryProperty.getAddress().length() > 50){
|
|
|
+ errorMessage.append("详细地址").append("超出5o限制,");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //手机号判空或格式校验
|
|
|
+ if (StringUtils.isBlank(factoryProperty.getKeymanMobile())) {
|
|
|
+ errorMessage.append("联系人手机号").append("为空,");
|
|
|
+ }else {
|
|
|
+ Pattern keymanMobileFormat = Pattern.compile("^1[0-9]{10}$");
|
|
|
+ if (!keymanMobileFormat.matcher(factoryProperty.getKeymanMobile()).matches()){
|
|
|
+ errorMessage.append("联系人手机号").append("格式不正确,");
|
|
|
+ }
|
|
|
}
|
|
|
if (StringUtils.isBlank(factoryProperty.getProvince())) {
|
|
|
errorMessage.append("省").append("为空,");
|
|
@@ -374,45 +410,18 @@ public class FactoryServiceImpl implements FactoryService {
|
|
|
if (StringUtils.isBlank(factoryProperty.getDistrict())) {
|
|
|
errorMessage.append("区").append("为空,");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(factoryProperty.getAddress())) {
|
|
|
- errorMessage.append("详细地址").append("为空,");
|
|
|
- }
|
|
|
- }
|
|
|
- if (FactoryTypeEnum.TWO_COVER.is(FactoryTypeEnum.getCode(factoryProperty.getFactoryType()))) {
|
|
|
if (StringUtils.isBlank(factoryProperty.getKeymanName())) {
|
|
|
errorMessage.append("联系人姓名").append("为空,");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(factoryProperty.getKeymanMobile())) {
|
|
|
- errorMessage.append("联系人手机号").append("为空,");
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
errorMessage.append("供应商类型").append("为空,");
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(factoryProperty.getIsFirstFactory())) {
|
|
|
- if(FirstFactoryEnum.getCode(factoryProperty.getIsFirstFactory()) == null){
|
|
|
- errorMessage.append("是否一级供应商").append("枚举值不正确,");
|
|
|
- }
|
|
|
- }else {
|
|
|
- if (StringUtils.isNotBlank(factoryProperty.getFactoryType())
|
|
|
- && FactoryTypeEnum.COVER.is(FactoryTypeEnum.getCode(factoryProperty.getFactoryType()))){
|
|
|
- errorMessage.append("是否一级供应商").append("为空,");
|
|
|
- }
|
|
|
- }
|
|
|
- //验证手机号
|
|
|
- if (StringUtils.isNotBlank(factoryProperty.getKeymanMobile())){
|
|
|
- Pattern keymanMobileFormat = Pattern.compile("^1[0-9]{10}$");
|
|
|
- if (!keymanMobileFormat.matcher(factoryProperty.getKeymanMobile()).matches()){
|
|
|
- errorMessage.append("联系人手机号").append("格式不正确,");
|
|
|
- }
|
|
|
- }
|
|
|
- //验证邮箱
|
|
|
- if (StringUtils.isNotBlank(factoryProperty.getEmail())) {
|
|
|
- Pattern emailFormat = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
|
|
|
- if (!emailFormat.matcher(factoryProperty.getEmail()).matches()) {
|
|
|
- errorMessage.append("邮箱").append("格式不正确,");
|
|
|
- }
|
|
|
+
|
|
|
+ //描述
|
|
|
+ if (StringUtils.isBlank(factoryProperty.getDescription()) && factoryProperty.getDescription().length() > 50) {
|
|
|
+ errorMessage.append("描述").append("超出5o限制,");
|
|
|
}
|
|
|
|
|
|
return errorMessage.toString();
|