master:新增客户可以不输入手机号;
parent
df6f7d9425
commit
f888c180b0
|
|
@ -27,7 +27,6 @@ public class StoreCusVO {
|
||||||
@ApiModelProperty(value = "客户名称", required = true)
|
@ApiModelProperty(value = "客户名称", required = true)
|
||||||
private String cusName;
|
private String cusName;
|
||||||
@ApiModelProperty(value = "客户联系电话")
|
@ApiModelProperty(value = "客户联系电话")
|
||||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号")
|
|
||||||
private String phone;
|
private String phone;
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
|
# active: prod
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,6 +68,12 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService {
|
||||||
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(storeCusDTO.getStoreId())) {
|
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(storeCusDTO.getStoreId())) {
|
||||||
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
|
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(storeCusDTO.getPhone())) {
|
||||||
|
final String regex = "^1[3-9]\\d{9}$";
|
||||||
|
if (!Pattern.matches(regex, storeCusDTO.getPhone().trim())) {
|
||||||
|
throw new ServiceException("请输入正确的手机号!", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.storeCusMapper.insert(BeanUtil.toBean(storeCusDTO, StoreCustomer.class));
|
return this.storeCusMapper.insert(BeanUtil.toBean(storeCusDTO, StoreCustomer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,6 +126,12 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService {
|
||||||
StoreCustomer storeCus = Optional.ofNullable(this.storeCusMapper.selectOne(new LambdaQueryWrapper<StoreCustomer>()
|
StoreCustomer storeCus = Optional.ofNullable(this.storeCusMapper.selectOne(new LambdaQueryWrapper<StoreCustomer>()
|
||||||
.eq(StoreCustomer::getId, storeCusDTO.getStoreCusId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)))
|
.eq(StoreCustomer::getId, storeCusDTO.getStoreCusId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED)))
|
||||||
.orElseThrow(() -> new ServiceException("档口客户不存在!"));
|
.orElseThrow(() -> new ServiceException("档口客户不存在!"));
|
||||||
|
if (StringUtils.isNotBlank(storeCusDTO.getPhone())) {
|
||||||
|
final String regex = "^1[3-9]\\d{9}$";
|
||||||
|
if (!Pattern.matches(regex, storeCusDTO.getPhone().trim())) {
|
||||||
|
throw new ServiceException("请输入正确的手机号!", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
BeanUtil.copyProperties(storeCusDTO, storeCus);
|
BeanUtil.copyProperties(storeCusDTO, storeCus);
|
||||||
return storeCusMapper.updateById(storeCus);
|
return storeCusMapper.updateById(storeCus);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue