6672 员工信息中未做手机号唯一性校验
This commit is contained in:
parent
717fd7441b
commit
1cccac924e
|
|
@ -20,6 +20,7 @@ import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.houqin.constant.DeviceTypeEnum;
|
import com.bonus.common.houqin.constant.DeviceTypeEnum;
|
||||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
||||||
import org.apache.catalina.security.SecurityUtil;
|
import org.apache.catalina.security.SecurityUtil;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -137,7 +138,16 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
kitchenStaffInfo.setCreateTime(DateUtils.getNowDate());
|
kitchenStaffInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
|
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
kitchenStaffInfo.setStaffId(null);
|
kitchenStaffInfo.setStaffId(null);
|
||||||
|
kitchenStaffInfo.setMobile(StringUtils.defaultIfBlank(kitchenStaffInfo.getMobile(), null));
|
||||||
try {
|
try {
|
||||||
|
if(Objects.nonNull(kitchenStaffInfo.getMobile())) {
|
||||||
|
KitchenStaffInfo kitchenStaffInfoDTO = new KitchenStaffInfo();
|
||||||
|
kitchenStaffInfoDTO.setMobile(kitchenStaffInfo.getMobile());
|
||||||
|
List<KitchenStaffInfo> oldKitchenStaffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoDTO);
|
||||||
|
if(CollUtil.isNotEmpty(oldKitchenStaffInfoList)) {
|
||||||
|
throw new ServiceException("手机号已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
if(StringUtils.isNotBlank(kitchenStaffInfo.getHealthCertFrontImg())
|
if(StringUtils.isNotBlank(kitchenStaffInfo.getHealthCertFrontImg())
|
||||||
&& Objects.isNull(kitchenStaffInfo.getHealthCertExpire())) {
|
&& Objects.isNull(kitchenStaffInfo.getHealthCertExpire())) {
|
||||||
throw new ServiceException("健康证有效期不能为空");
|
throw new ServiceException("健康证有效期不能为空");
|
||||||
|
|
@ -167,12 +177,29 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
||||||
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
if(Objects.isNull(kitchenStaffInfo.getStaffNo())) {
|
|
||||||
throw new ServiceException("员工编号不能为空");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if(Objects.isNull(kitchenStaffInfo.getStaffId())) {
|
||||||
|
throw new ServiceException("员工ID不能为空");
|
||||||
|
}
|
||||||
|
kitchenStaffInfo.setMobile(StringUtils.defaultIfBlank(kitchenStaffInfo.getMobile(), null));
|
||||||
|
if(Objects.nonNull(kitchenStaffInfo.getMobile())) {
|
||||||
|
kitchenStaffInfo.setMobile(kitchenStaffInfo.getMobile().trim());
|
||||||
|
KitchenStaffInfo staffInfo = kitchenStaffInfoMapper.selectKitchenStaffInfoByStaffId(kitchenStaffInfo.getStaffId());
|
||||||
|
if(Objects.nonNull(staffInfo) && !kitchenStaffInfo.getMobile().equals(staffInfo.getMobile())) {
|
||||||
|
KitchenStaffInfo kitchenStaffInfoDTO = new KitchenStaffInfo();
|
||||||
|
kitchenStaffInfoDTO.setMobile(kitchenStaffInfo.getMobile());
|
||||||
|
List<KitchenStaffInfo> oldKitchenStaffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoDTO);
|
||||||
|
if(CollUtil.isNotEmpty(oldKitchenStaffInfoList)) {
|
||||||
|
throw new ServiceException("手机号已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
if(Objects.isNull(kitchenStaffInfo.getStaffNo())) {
|
||||||
|
throw new ServiceException("员工编号不能为空");
|
||||||
|
}
|
||||||
checkUser(kitchenStaffInfo);
|
checkUser(kitchenStaffInfo);
|
||||||
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
|
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
|
||||||
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());
|
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="healthCertExpire != null "> and health_cert_expire = #{healthCertExpire}</if>
|
<if test="healthCertExpire != null "> and health_cert_expire = #{healthCertExpire}</if>
|
||||||
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
|
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
|
||||||
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
|
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
|
||||||
|
<if test="mobile != null and mobile != ''">mobile = #{mobile}</if>
|
||||||
<if test="faceState != null">
|
<if test="faceState != null">
|
||||||
and ksf.face_state = #{faceState}</if>
|
and ksf.face_state = #{faceState}</if>
|
||||||
<if test="healthCertStatus != null ">
|
<if test="healthCertStatus != null ">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue