This commit is contained in:
skjia 2025-07-04 10:23:32 +08:00
commit c426c1dc8d
2 changed files with 33 additions and 5 deletions

View File

@ -20,6 +20,7 @@ import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.houqin.constant.DeviceTypeEnum;
import com.bonus.common.houqin.utils.SM4EncryptUtils;
import com.bonus.common.security.utils.SecurityUtils;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import org.apache.catalina.security.SecurityUtil;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
@ -137,7 +138,16 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
kitchenStaffInfo.setCreateTime(DateUtils.getNowDate());
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
kitchenStaffInfo.setStaffId(null);
kitchenStaffInfo.setMobile(StringUtils.defaultIfBlank(kitchenStaffInfo.getMobile(), null));
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())
&& Objects.isNull(kitchenStaffInfo.getHealthCertExpire())) {
throw new ServiceException("健康证有效期不能为空");
@ -167,12 +177,29 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
*/
@Override
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
if(Objects.isNull(kitchenStaffInfo.getStaffNo())) {
throw new ServiceException("员工编号不能为空");
}
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);
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());

View File

@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="healthCertExpire != null "> and health_cert_expire = #{healthCertExpire}</if>
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
<if test="mobile != null and mobile != ''">mobile = #{mobile}</if>
<if test="faceState != null">
and ksf.face_state = #{faceState}</if>
<if test="healthCertStatus != null ">