From 1cccac924ef41930a0b8dab3f9a16c6ce83a29ec Mon Sep 17 00:00:00 2001 From: gaowdong Date: Fri, 4 Jul 2025 09:59:14 +0800 Subject: [PATCH] =?UTF-8?q?6672=20=E5=91=98=E5=B7=A5=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=B8=AD=E6=9C=AA=E5=81=9A=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=94=AF?= =?UTF-8?q?=E4=B8=80=E6=80=A7=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/KitchenStaffInfoServiceImpl.java | 37 ++++++++++++++++--- .../mapper/kitchen/KitchenStaffInfoMapper.xml | 1 + 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffInfoServiceImpl.java index 8e75e46..960141b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffInfoServiceImpl.java @@ -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 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 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()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffInfoMapper.xml index 663fd09..b743707 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffInfoMapper.xml @@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and health_cert_expire = #{healthCertExpire} and nutrity_cert_expire = #{nutrityCertExpire} and safety_cert_expire = #{safetyCertExpire} + mobile = #{mobile} and ksf.face_state = #{faceState}