Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2025-06-23 16:24:38 +08:00
commit 87def2c183
24 changed files with 491 additions and 112 deletions

View File

@ -98,6 +98,23 @@ public class KitchenStaffInfoController extends BaseController {
}
}
/**
* 修改厨房员工资料
*/
@ApiOperation(value = "修改厨房员工人脸状态")
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:info:edit")
@SysLog(title = "厨房员工资料", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改厨房员工人脸状态")
@PostMapping("/edit/face-state")
public AjaxResult editFaceState(@RequestBody KitchenStaffInfo kitchenStaffInfo) {
try {
return toAjax(kitchenStaffInfoService.updateKitchenStaffFaceState(kitchenStaffInfo));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 删除厨房员工资料
*/

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
@ -113,4 +114,6 @@ public class KitchenDeviceSensorRecord extends BaseEntity {
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
private String searchValue;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
@ -85,9 +86,6 @@ public class KitchenSampleCabinetRecord extends BaseEntity {
@ApiModelProperty(value = "食堂名称")
private String canteenName;
@ApiModelProperty(value = "操作人")
private String nickName;
@ApiModelProperty(value = "动作类型名称 1:留样 2:取样 3无操作")
private String actionTypeName;
@ -102,4 +100,6 @@ public class KitchenSampleCabinetRecord extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
private String searchValue;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -179,5 +180,7 @@ public class KitchenSampleDishesRecord extends BaseEntity {
private String deviceName;
@ApiModelProperty("留样人")
private String userName;
private String staffName;
private String searchValue;
}

View File

@ -0,0 +1,76 @@
package com.bonus.canteen.core.kitchen.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 人员生物识别特征对象 sys_user_face
*
* @author xsheng
* @date 2025-04-03
*/
@Data
@ToString
public class KitchenStaffFace implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键自增 */
private Long faceId;
/** 人员id */
@ApiModelProperty(value = "人员id")
@NotBlank(message = "人员id必填")
private Long staffId;
/** 照片地址 */
@ApiModelProperty(value = "照片地址")
//@NotBlank(message = "照片地址必填")
private String photoUrl;
/** 特征码 */
@Excel(name = "特征码")
@ApiModelProperty(value = "特征码")
private String features;
/** 类型 1-照片 2-指纹 3-掌纹 4-掌静脉 5-指静脉 6-虹膜 */
@Excel(name = "类型 1-照片 2-指纹 3-掌纹 4-掌静脉 5-指静脉 6-虹膜")
@ApiModelProperty(value = "类型 1-照片 2-指纹 3-掌纹 4-掌静脉 5-指静脉 6-虹膜")
private Long photoType = 1L;
/** 特征码生成状态 1-未生成 2-生成成功 3-生成失败 */
@Excel(name = "特征码生成状态 1-未生成 2-生成成功 3-生成失败")
@ApiModelProperty(value = "特征码生成状态 1-未生成 2-生成成功 3-生成失败")
private Long featuresBuildStatus;
/** 特征码生成时间 */
@ApiModelProperty(value = "特征码生成时间")
private Date featuresBuildTime;
/** 状态 1-正常 2-冻结 3-销户 4-挂失 */
@ApiModelProperty(value = "状态 1-正常 2-冻结 3-销户 4-挂失")
private String faceState;
/** 特征码生成失败原因 */
@Excel(name = "特征码生成失败原因")
@ApiModelProperty(value = "特征码生成失败原因")
private String errorMsg;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private String createBy;
private String createTime;
private String updateBy;
private String updateTime;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -92,12 +93,14 @@ public class KitchenStaffIllegalWarning extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
private String nickName;
private String staffName;
private Long userId;
private String staffNo;
private String canteenName;
@JsonIgnore
private String encryptedSearchValue;
private String searchValue;
}

View File

@ -1,10 +1,10 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.system.api.domain.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonIgnore;
@ -23,7 +23,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
@Data
@ToString
public class KitchenStaffInfo extends SysUser {
public class KitchenStaffInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 食堂后场人员id */
@ -34,10 +34,42 @@ public class KitchenStaffInfo extends SysUser {
@ApiModelProperty(value = "食堂后场人员编号")
private String staffNo;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty(value = "用户id")
private Long userId;
/** 食堂后场人员姓名 */
@Excel(name = "食堂后场人员姓名")
@ApiModelProperty(value = "食堂后场人员姓名")
private String staffName;
/** 食堂后场人员岗位 */
@Excel(name = "食堂后场人员岗位")
@ApiModelProperty(value = "食堂后场人员岗位")
private String postName;
/** 食堂后场人员手机号 */
@Excel(name = "食堂后场人员手机号")
@ApiModelProperty(value = "食堂后场人员手机号")
private String mobile;
/** 食堂后场人员性别 */
@Excel(name = "食堂后场人员性别")
@ApiModelProperty(value = "食堂后场人员性别")
private Integer sex;
/** 区域 */
@Excel(name = "区域")
@ApiModelProperty(value = "区域")
private Long areaId;
@Excel(name = "食堂后场人员人脸照片地址")
@ApiModelProperty(value = "食堂后场人员人脸照片地址")
private String faceUrl;
@Excel(name = "关联食堂")
@ApiModelProperty(value = "关联食堂")
private String canteenName;
@Excel(name = "关联区域")
@ApiModelProperty(value = "关联区域")
private String areaName;
/** 健康证到期时间 */
@ApiModelProperty(value = "健康证到期时间")
@ -73,18 +105,20 @@ public class KitchenStaffInfo extends SysUser {
@ApiModelProperty(value = "健康证状态")
private Integer healthCertStatus;
@ApiModelProperty(value = "岗位名称")
private String postName;
@ApiModelProperty(value = "员工设备权限")
private List<AccessAuthority> accessAuthorityList;
@ApiModelProperty(value = "食堂编号")
private Long canteenId;
@ApiModelProperty(value = "人脸状态")
private Integer faceState;
@JsonIgnore
private String encryptedSearchValue;
private String searchValue;
public String getHealthCertFrontImg() {
return FileUrlUtil.getFileUrl(this.healthCertFrontImg);
}
@ -92,4 +126,8 @@ public class KitchenStaffInfo extends SysUser {
public String getHealthCertBackImg() {
return FileUrlUtil.getFileUrl(this.healthCertBackImg);
}
public String getFaceUrl() {
return FileUrlUtil.getFileUrl(this.faceUrl);
}
}

View File

@ -1,6 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.time.LocalDate;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -76,17 +76,19 @@ public class KitchenStaffMorningCheck extends BaseEntity {
private String postName;
@ApiModelProperty("用户名称")
private String nickName;
private String staffName;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("手机号码")
private String phonenumber;
private String mobile;
@ApiModelProperty("员工编号")
private Long staffNo;
private String staffNo;
@JsonIgnore
private String encryptedSearchValue;
private String searchValue;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
@ -103,4 +104,6 @@ public class KitchenWasteDeal extends BaseEntity {
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDateTime;
private String searchValue;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -70,4 +71,6 @@ public class KitchenWasteMeal extends BaseEntity {
@Excel(name = "区域Id")
@ApiModelProperty(value = "厨余汇总")
private Long wasteMealCount;
private String searchValue;
}

View File

@ -0,0 +1,30 @@
package com.bonus.canteen.core.kitchen.domain.constants;
public enum StaffFaceStateEnum {
ENABLE(1, "正常"),
HISTORY(2, "禁用");
private final Integer key;
private final String desc;
private StaffFaceStateEnum(Integer key, String desc) {
this.key = key;
this.desc = desc;
}
public Integer getKey() {
return this.key;
}
public String getDesc() {
return this.desc;
}
public static boolean isValidFaceState(int value) {
for (StaffFaceStateEnum state : StaffFaceStateEnum.values()) {
if (state.getKey() == value) {
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,20 @@
package com.bonus.canteen.core.kitchen.mapper;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffFace;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo;
/**
* 人员生物识别特征Mapper接口
*
* @author xsheng
* @date 2025-04-03
*/
public interface KitchenStaffFaceMapper {
int insertStaffFace(KitchenStaffFace kitchenStaffFace);
int deleteStaffFace(KitchenStaffFace kitchenStaffFace);
int deleteStaffFaces(Long[] staffIds);
int updateStaffFaceState(KitchenStaffInfo kitchenStaffInfo);
}

View File

@ -0,0 +1,23 @@
package com.bonus.canteen.core.kitchen.service;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffFace;
import com.bonus.canteen.core.user.domain.UserFace;
import com.bonus.common.core.web.domain.AjaxResult;
import javax.validation.Valid;
/**
* 人员生物识别特征Service接口
*
* @author xsheng
* @date 2025-04-03
*/
public interface IKitchenStaffFaceService {
/**
* 查询人员生物识别特征
*
* @param dto 人员生物识别特征主键
* @return 人员生物识别特征
*/
AjaxResult uploadUserFace(@Valid KitchenStaffFace dto);
}

View File

@ -42,6 +42,14 @@ public interface IKitchenStaffInfoService {
*/
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo);
/**
* 修改厨房员工人脸状态
*
* @param kitchenStaffInfo 厨房员工资料
* @return 结果
*/
public int updateKitchenStaffFaceState(KitchenStaffInfo kitchenStaffInfo);
/**
* 批量删除厨房员工资料
*

View File

@ -0,0 +1,93 @@
package com.bonus.canteen.core.kitchen.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.canteen.core.common.utils.MqUtil;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffFace;
import com.bonus.canteen.core.kitchen.mapper.KitchenStaffFaceMapper;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffFaceService;
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
import com.bonus.canteen.core.user.utils.ArcFaceHelper;
import com.bonus.canteen.core.user.utils.FaceResult;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.houqin.mq.constant.LeMqConstant;
import com.bonus.common.security.utils.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
/**
* 人员生物识别特征Service业务层处理
*
* @author xsheng
* @date 2025-04-03
*/
@Service
public class KitchenStaffFaceServiceImpl implements IKitchenStaffFaceService {
private static final Logger log = LoggerFactory.getLogger(KitchenStaffFaceServiceImpl.class);
@Autowired
private KitchenStaffFaceMapper kitchenStaffFaceMapper;
/**
* 查询人员生物识别特征
*
* @param dto 人员生物识别特征主键
* @return 人员生物识别特征
*/
@Override
public AjaxResult uploadUserFace(KitchenStaffFace dto) {
if (ObjectUtil.isNull(dto)) {
throw new ServiceException("参数为空!");
}
if (ObjectUtil.isNull(dto.getStaffId())) {
throw new ServiceException("用户ID为空");
}
if (StringUtils.isEmpty(dto.getPhotoUrl())) {
kitchenStaffFaceMapper.deleteStaffFace(dto);
// //发送mq
// DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(dto.getStaffId().intValue(),"del");
// MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
} else {
log.info("开始采集虹软人脸");
ArcFaceHelper arcFaceHelper = new ArcFaceHelper();
String url = FileUrlUtil.getFileUrl(dto.getPhotoUrl());
FaceResult faceResult = arcFaceHelper.getFaceFeatures(url);
log.info("采集结束");
List<KitchenStaffFace> list = new ArrayList<>();
if (faceResult != null) {
KitchenStaffFace faceVO = new KitchenStaffFace();
faceVO.setErrorMsg("[软件]成功");
faceVO.setFeatures(Base64.getEncoder().encodeToString(faceResult.getFeatures()));
faceVO.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
faceVO.setStaffId(dto.getStaffId());
faceVO.setPhotoUrl(dto.getPhotoUrl());
faceVO.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
faceVO.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
faceVO.setCreateTime(DateUtils.getTime());
faceVO.setUpdateTime(DateUtils.getTime());
list.add(faceVO);
log.info("faceResult.getFeatures():" + Base64.getEncoder().encodeToString(faceResult.getFeatures()));
log.info("人脸采集成功");
} else {
throw new ServiceException("[虹软算法]:特征值提取失败");
}
int code = kitchenStaffFaceMapper.insertStaffFace(list.get(0));
if (code == 0){
throw new ServiceException("[虹软算法]:保存失败");
}
// //发送mq
// DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(dto.getStaffId().intValue(),"update");
// MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
}
return AjaxResult.success();
}
}

View File

@ -5,15 +5,12 @@ import java.time.LocalDateTime;
import java.util.*;
import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.kitchen.domain.KitchenSetting;
import com.bonus.canteen.core.kitchen.mapper.KitchenSettingMapper;
import com.bonus.canteen.core.kitchen.domain.AccessAuthority;
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
import com.bonus.canteen.core.kitchen.domain.*;
import com.bonus.canteen.core.kitchen.domain.constants.StaffFaceStateEnum;
import com.bonus.canteen.core.kitchen.mapper.*;
import com.bonus.canteen.core.kitchen.domain.constants.HealthCertStatusEnum;
import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceInfoMapper;
import com.bonus.canteen.core.kitchen.mapper.KitchenStaffDevicePrivilegeMapper;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffDevicePrivilegeService;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffFaceService;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.canteen.core.user.domain.UserFace;
import com.bonus.canteen.core.user.service.IUserFaceService;
@ -27,8 +24,6 @@ import org.apache.catalina.security.SecurityUtil;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.kitchen.mapper.KitchenStaffInfoMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffInfoService;
import org.springframework.transaction.annotation.Transactional;
@ -50,6 +45,10 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
private KitchenDeviceInfoMapper kitchenDeviceInfoMapper;
@Autowired
private KitchenSettingMapper kitchenSettingMapper;
@Autowired
private IKitchenStaffFaceService kitchenStaffFaceService;
@Autowired
private KitchenStaffFaceMapper kitchenStaffFaceMapper;
/**
* 查询厨房员工资料
@ -61,29 +60,32 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
public KitchenStaffInfo selectKitchenStaffInfoByStaffId(Long staffId) {
KitchenStaffInfo kitchenStaffInfo = kitchenStaffInfoMapper.selectKitchenStaffInfoByStaffId(staffId);
if(Objects.nonNull(kitchenStaffInfo)) {
kitchenStaffInfo.setPhonenumber(SM4EncryptUtils.sm4Decrypt(kitchenStaffInfo.getPhonenumber()));
List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList = kitchenStaffDevicePrivilegeMapper
.selectKitchenStaffDevicePrivilegeByStaffId(staffId);
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilegeList)) {
List<AccessAuthority> accessAuthorityList = Lists.newArrayList();
for (KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege : kitchenStaffDevicePrivilegeList) {
AccessAuthority accessAuthority = new AccessAuthority();
KitchenDeviceListVO deviceInfo = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
if(Objects.nonNull(deviceInfo)) {
accessAuthority.setDeviceName(deviceInfo.getDeviceName());
accessAuthority.setLocation(deviceInfo.getSubPlace());
}
accessAuthority.setDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
accessAuthority.setDeviceType(kitchenStaffDevicePrivilege.getDeviceType());
accessAuthority.setPrivilegeValue(kitchenStaffDevicePrivilege.getPrivilegeValue());
accessAuthorityList.add(accessAuthority);
}
kitchenStaffInfo.setAccessAuthorityList(accessAuthorityList);
}
composeDeviceAccess(kitchenStaffDevicePrivilegeList, kitchenStaffInfo);
}
return kitchenStaffInfo;
}
private void composeDeviceAccess(List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList, KitchenStaffInfo kitchenStaffInfo) {
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilegeList)) {
List<AccessAuthority> accessAuthorityList = Lists.newArrayList();
for (KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege : kitchenStaffDevicePrivilegeList) {
AccessAuthority accessAuthority = new AccessAuthority();
KitchenDeviceListVO deviceInfo = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
if(Objects.nonNull(deviceInfo)) {
accessAuthority.setDeviceName(deviceInfo.getDeviceName());
accessAuthority.setLocation(deviceInfo.getSubPlace());
}
accessAuthority.setDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
accessAuthority.setDeviceType(kitchenStaffDevicePrivilege.getDeviceType());
accessAuthority.setPrivilegeValue(kitchenStaffDevicePrivilege.getPrivilegeValue());
accessAuthorityList.add(accessAuthority);
}
kitchenStaffInfo.setAccessAuthorityList(accessAuthorityList);
}
}
/**
* 查询厨房员工资料列表
*
@ -106,7 +108,9 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
reminderDays = kitchenSettingList.get(0).getItemValue() == null ? 30L : Long.parseLong(kitchenSettingList.get(0).getItemValue());
}
for (KitchenStaffInfo info : kitchenStaffInfoList) {
info.setPhonenumber(SM4EncryptUtils.sm4Decrypt(info.getPhonenumber()));
List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList = kitchenStaffDevicePrivilegeMapper
.selectKitchenStaffDevicePrivilegeByStaffId(info.getStaffId());
composeDeviceAccess(kitchenStaffDevicePrivilegeList, info);
if(StringUtils.isBlank(info.getHealthCertFrontImg())) {
info.setHealthCertStatusName(HealthCertStatusEnum.NO_IMG.getDesc());
}else if(Objects.nonNull(info.getHealthCertExpire()) && info.getHealthCertExpire().isBefore(LocalDate.now())){
@ -145,6 +149,10 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
checkUser(kitchenStaffInfo);
int result = kitchenStaffInfoMapper.insertKitchenStaffInfo(kitchenStaffInfo);
addPrivileges(kitchenStaffInfo);
KitchenStaffFace kitchenStaffFace = new KitchenStaffFace();
kitchenStaffFace.setStaffId(kitchenStaffInfo.getStaffId());
kitchenStaffFace.setPhotoUrl(kitchenStaffInfo.getFaceUrl());
kitchenStaffFaceService.uploadUserFace(kitchenStaffFace);
return result;
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -161,7 +169,7 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
if(Objects.isNull(kitchenStaffInfo.getStaffId())) {
if(Objects.isNull(kitchenStaffInfo.getStaffNo())) {
throw new ServiceException("员工编号不能为空");
}
try {
@ -169,22 +177,31 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());
addPrivileges(kitchenStaffInfo);
KitchenStaffFace kitchenStaffFace = new KitchenStaffFace();
kitchenStaffFace.setStaffId(kitchenStaffInfo.getStaffId());
kitchenStaffFace.setPhotoUrl(kitchenStaffInfo.getFaceUrl());
kitchenStaffFaceService.uploadUserFace(kitchenStaffFace);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
return 1;
}
@Override
public int updateKitchenStaffFaceState(KitchenStaffInfo kitchenStaffInfo) {
if(Objects.isNull(kitchenStaffInfo.getStaffId())) {
throw new ServiceException("员工ID不能为空");
}
if(!StaffFaceStateEnum.isValidFaceState(kitchenStaffInfo.getFaceState())) {
throw new ServiceException("无效的人脸状态");
}
return kitchenStaffFaceMapper.updateStaffFaceState(kitchenStaffInfo);
}
private void checkUser(KitchenStaffInfo kitchenStaffInfo) {
KitchenStaffInfo kitchenStaffInfoByPhone = new KitchenStaffInfo();
kitchenStaffInfoByPhone.setUserId(kitchenStaffInfo.getUserId());
List<KitchenStaffInfo> staffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoByPhone);
if(CollUtil.isNotEmpty(staffInfoList) && !Objects.equals(staffInfoList.get(0).getStaffId(), kitchenStaffInfo.getStaffId())) {
throw new ServiceException("该用户已存在");
}
kitchenStaffInfoByPhone = new KitchenStaffInfo();
kitchenStaffInfoByPhone.setStaffNo(kitchenStaffInfo.getStaffNo());
staffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoByPhone);
List<KitchenStaffInfo> staffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoByPhone);
if(CollUtil.isNotEmpty(staffInfoList) && !Objects.equals(staffInfoList.get(0).getStaffId(), kitchenStaffInfo.getStaffId())) {
throw new ServiceException("该用户编号已存在");
}
@ -215,6 +232,7 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
@Override
public int deleteKitchenStaffInfoByStaffIds(Long[] staffIds) {
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffIds(staffIds);
kitchenStaffFaceMapper.deleteStaffFaces(staffIds);
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffIds(staffIds);
}
@ -227,6 +245,9 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
@Override
public int deleteKitchenStaffInfoByStaffId(Long staffId) {
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(staffId);
KitchenStaffFace kitchenStaffFace = new KitchenStaffFace();
kitchenStaffFace.setStaffId(staffId);
kitchenStaffFaceMapper.deleteStaffFace(kitchenStaffFace);
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffId(staffId);
}
}

View File

@ -48,7 +48,7 @@ public class KitchenStaffMorningCheckServiceImpl implements IKitchenStaffMorning
.selectKitchenStaffMorningCheckList(kitchenStaffMorningCheck);
if(CollUtil.isNotEmpty(kitchenStaffMorningCheckList)) {
kitchenStaffMorningCheckList.forEach(value -> {
value.setPhonenumber(SM4EncryptUtils.sm4Decrypt(value.getPhonenumber()));
value.setMobile(SM4EncryptUtils.sm4Decrypt(value.getMobile()));
});
}

View File

@ -21,19 +21,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="deviceName" column="device_name" />
<result property="canteenName" column="canteen_name" />
<result property="nickName" column="nick_name" />
<result property="staffName" column="staff_name" />
</resultMap>
<sql id="selectKitchenSampleCabinetRecordVo">
select record_id, kscr.device_id, open_cabinet_temp, close_cabinet_temp, kscr.staff_id,
open_cabinet_time, close_cabinet_time, operate_type, action_type,
operate_photo, operate_date, kscr.create_by, kscr.create_time, kscr.update_by, kscr.update_time,
kdi.device_name, bc.canteen_name, su.nick_name
kdi.device_name, bc.canteen_name, ksi.staff_name
from kitchen_sample_cabinet_record kscr
left join kitchen_device_info kdi on kdi.device_id = kscr.device_id
left join basic_canteen bc on bc.canteen_id = kdi.canteen_id
left join kitchen_staff_info ksi on ksi.staff_id = kscr.staff_id
left join sys_user su on su.user_id = ksi.user_id
</sql>
<select id="selectKitchenSampleCabinetRecordList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSampleCabinetRecord" resultMap="KitchenSampleCabinetRecordResult">
@ -55,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</if>
<if test="staffName != null and staffName != ''">
and (su.nick_name like CONCAT('%',#{staffName},'%')
and (ksi.staff_name like CONCAT('%',#{staffName},'%')
)
</if>
<if test="startDateTime != null">

View File

@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="stallName" column="stall_name" />
<result property="dishesName" column="dishes_name" />
<result property="deviceName" column="device_name" />
<result property="userName" column="user_name" />
<result property="staffName" column="staff_name" />
</resultMap>
<sql id="selectKitchenSampleDishesRecordVo">
@ -46,13 +46,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
enter_cabinet_time, leave_cabinet_time, expiration_time, weight_standard,
valid_duration, duration_standard, ksdr.status, cabinet_no, save_status,
ksdr.create_by, ksdr.create_time, ksdr.update_by, ksdr.update_time,
bc.canteen_name, bs.stall_name, bd.dishes_name, kdi.device_name, su.user_name
bc.canteen_name, bs.stall_name, bd.dishes_name, kdi.device_name, ksi.staff_name
from kitchen_sample_dishes_record ksdr
left join basic_canteen bc on bc.canteen_id = ksdr.canteen_id
left join basic_stall bs on bs.stall_id = ksdr.stall_id
left join cook_dishes bd on bd.dishes_id = ksdr.dishes_id
left join kitchen_device_info kdi on kdi.device_id = ksdr.device_id
left join sys_user su on su.user_id = ksdr.sample_save_staff_id
left join kitchen_staff_info ksi on ksi.staff_id = ksdr.sample_save_staff_id
</sql>
<select id="selectKitchenSampleDishesRecordList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSampleDishesRecord" resultMap="KitchenSampleDishesRecordResult">

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.kitchen.mapper.KitchenStaffFaceMapper">
<insert id="insertStaffFace" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffFace">
insert into kitchen_staff_face(staff_id,photo_url,features,create_by,error_msg,create_time,update_by,update_time)
values(#{staffId},#{photoUrl},#{features},#{createBy},#{errorMsg},#{createTime},#{updateBy},#{updateTime})
on duplicate key update features = #{features},
photo_url = #{photoUrl},
error_msg = #{errorMsg},
update_by = #{updateBy},
update_time = #{updateTime}
</insert>
<update id="updateStaffFaceState" >
update kitchen_staff_face set face_state = #{faceState}
where staff_id = #{staffId}
</update>
<delete id="deleteStaffFace" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffFace">
delete from kitchen_staff_face
where staff_id = #{staffId}
</delete>
<delete id="deleteStaffFaces">
delete from kitchen_staff_face
where staff_id in
<foreach item="staffId" collection="array" open="(" separator="," close=")">
#{staffId}
</foreach>
</delete>
</mapper>

View File

@ -21,8 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="nickName" column="nick_name" />
<result property="userId" column="user_id" />
<result property="staffName" column="staff_name" />
<result property="staffNo" column="staff_no" />
<result property="canteenName" column="canteen_name" />
</resultMap>
@ -30,10 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select illegal_warning_id, ksiw.staff_id, device_id, ksiw.img_url, record_desc, record_time,
illegal_warning_type, handle_state, handle_time, handler_person, notify_state,
notify_desc, alarm_type, ksiw.create_by, ksiw.create_time, ksiw.update_by, ksiw.update_time,
su.nick_name, su.user_id, bc.canteen_name
ksi.staff_name, ksi.staff_no, bc.canteen_name
from kitchen_staff_illegal_warning ksiw
left join kitchen_staff_info ksi on ksiw.staff_id = ksi.staff_id
left join sys_user su on su.user_id = ksi.user_id
left join basic_canteen bc on bc.canteen_id = ksi.canteen_id
</sql>
@ -53,9 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="notifyDesc != null and notifyDesc != ''"> and notify_desc = #{notifyDesc}</if>
<if test="alarmType != null "> and alarm_type = #{alarmType}</if>
<if test="searchValue != null and searchValue != ''">
and (su.nick_name like CONCAT('%',#{searchValue},'%')
or su.phonenumber = #{encryptedSearchValue}
or su.user_id like CONCAT('%',#{searchValue},'%')
and (ksi.staff_name like CONCAT('%',#{searchValue},'%')
or ksi.mobile like CONCAT('%',#{searchValue},'%')
or ksi.staff_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="startDateTime != null">

View File

@ -7,7 +7,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="staffId" column="staff_id" />
<result property="canteenId" column="canteen_id" />
<result property="staffNo" column="staff_no" />
<result property="userId" column="user_id" />
<result property="staffName" column="staff_name" />
<result property="postName" column="post_name" />
<result property="mobile" column="mobile" />
<result property="sex" column="sex" />
<result property="areaId" column="area_id" />
<result property="faceUrl" column="photo_url" />
<result property="faceState" column="face_state" />
<result property="canteenName" column="canteen_name" />
<result property="areaName" column="area_name" />
<result property="healthCertExpire" column="health_cert_expire" />
<result property="healthCertFrontImg" column="health_cert_front_img" />
<result property="healthCertBackImg" column="health_cert_back_img" />
@ -20,35 +28,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectKitchenStaffInfoVo">
select staff_id, canteen_id, staff_no, kst.user_id, health_cert_expire,
select kst.staff_id, kst.canteen_id, staff_no, staff_name, post_name, mobile, sex, kst.area_id, health_cert_expire,
health_cert_front_img, health_cert_back_img, nutrity_cert_expire,
safety_cert_expire, kst.create_by, kst.create_time, kst.update_by, kst.update_time,
su.nick_name, su.phonenumber, su.sex, uf.photo_url, uf.face_state as faceStatus, sp.post_name
ksf.photo_url, ksf.face_state, bc.canteen_name, ba.area_name
from kitchen_staff_info kst
left join sys_user su on kst.user_id = su.user_id
left join sys_user_post sup on kst.user_id = sup.user_id
left join sys_post sp on sup.post_id = sp.post_id
left join user_face uf on kst.user_id = uf.user_id
left join kitchen_staff_face ksf on kst.staff_id = ksf.staff_id
left join basic_canteen bc on kst.canteen_id = bc.canteen_id
left join basic_area ba on kst.area_id = ba.area_id
</sql>
<select id="selectKitchenStaffInfoList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo" resultMap="KitchenStaffInfoResult">
<include refid="selectKitchenStaffInfoVo"/>
<where>
<if test="staffNo != null and staffNo != ''"> and staff_no = #{staffNo}</if>
<if test="userId != null "> and kst.user_id = #{userId}</if>
<if test="staffName != null and staffName != ''"> and staff_name = #{staffNo}</if>
<if test="postName != null and postName != ''"> and post_name like CONCAT('%',#{postName},'%')</if>
<if test="sex != null"> and sex = #{sex}</if>
<if test="areaId != null"> and kst.area_id = #{areaId}</if>
<if test="healthCertExpire != null "> and health_cert_expire = #{healthCertExpire}</if>
<if test="healthCertFrontImg != null "> and health_cert_front_img = #{healthCertFrontImg}</if>
<if test="healthCertBackImg != null "> and health_cert_back_img = #{healthCertBackImg}</if>
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
<if test="sex != null "> and su.sex = #{sex}</if>
<if test="postIds != null and postIds.length > 0">
and sup.post_id in
<foreach item="postId" collection="postIds" open="(" separator="," close=")">
#{postId}
</foreach>
</if>
<if test="faceStatus != null "> and uf.face_state = #{faceStatus}</if>
<if test="faceState != null">
and ksf.face_state = #{faceState}</if>
<if test="healthCertStatus != null ">
and case
when #{healthCertStatus} = 1 then
@ -75,9 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end
</if>
<if test="searchValue != null and searchValue != ''">
and (su.nick_name like CONCAT('%',#{searchValue},'%')
or su.phonenumber = #{encryptedSearchValue}
or su.user_id like CONCAT('%',#{searchValue},'%')
and (kst.staff_name like CONCAT('%',#{searchValue},'%')
or kst.mobile like CONCAT('%',#{searchValue},'%')
or kst.staff_no like CONCAT('%',#{searchValue},'%')
)
</if>
</where>
@ -86,15 +88,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectKitchenStaffInfoByStaffId" parameterType="Long" resultMap="KitchenStaffInfoResult">
<include refid="selectKitchenStaffInfoVo"/>
where staff_id = #{staffId}
where kst.staff_id = #{staffId}
</select>
<insert id="insertKitchenStaffInfo" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo" useGeneratedKeys="true" keyProperty="staffId">
insert into kitchen_staff_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="staffNo != null and staffNo != ''">staff_no,</if>
<if test="staffName != null and staffName != ''">staff_name,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="mobile != null and mobile != ''">mobile,</if>
<if test="sex != null">sex,</if>
<if test="areaId != null">area_id,</if>
<if test="canteenId != null">canteen_id,</if>
<if test="userId != null">user_id,</if>
<if test="healthCertExpire != null">health_cert_expire,</if>
<if test="healthCertFrontImg != null">health_cert_front_img,</if>
<if test="healthCertBackImg != null">health_cert_back_img,</if>
@ -107,8 +113,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffNo != null and staffNo != ''">#{staffNo},</if>
<if test="staffName != null and staffName != ''">#{staffName},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="sex != null">#{sex},</if>
<if test="areaId != null">#{areaId},</if>
<if test="canteenId != null">#{canteenId},</if>
<if test="userId != null">#{userId},</if>
<if test="healthCertExpire != null">#{healthCertExpire},</if>
<if test="healthCertFrontImg != null">#{healthCertFrontImg},</if>
<if test="healthCertBackImg != null">#{healthCertBackImg},</if>
@ -125,8 +135,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update kitchen_staff_info
<trim prefix="SET" suffixOverrides=",">
<if test="staffNo != null and staffNo != ''">staff_no = #{staffNo},</if>
<if test="staffName != null and staffName != ''">staff_name = #{staffName},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="canteenId != null">canteen_id = #{canteenId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="healthCertExpire != null">health_cert_expire = #{healthCertExpire},</if>
<if test="healthCertFrontImg != null">health_cert_front_img = #{healthCertFrontImg},</if>
<if test="healthCertBackImg != null">health_cert_back_img = #{healthCertBackImg},</if>

View File

@ -16,23 +16,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="nickName" column="nick_name" />
<result property="staffName" column="staff_name" />
<result property="postName" column="post_name" />
<result property="canteenName" column="canteen_name" />
<result property="phonenumber" column="phonenumber" />
<result property="mobile" column="mobile" />
<result property="staffNo" column="staff_no" />
</resultMap>
<sql id="selectKitchenStaffMorningCheckVo">
select check_Id, ksmc.staff_id, device_id, temperature_value, temperature_status,
check_status, record_time, check_video_url, ksmc.create_by, ksmc.create_time,
ksmc.update_by, ksmc.update_time, su.nick_name, sp.post_name, bc.canteen_name,
su.phonenumber, ksi.staff_no
ksmc.update_by, ksmc.update_time, ksi.staff_name, ksi.post_name, bc.canteen_name,
ksi.mobile, ksi.staff_no
from kitchen_staff_morning_check ksmc
left join kitchen_staff_info ksi on ksmc.staff_id = ksi.staff_id
left join sys_user su on ksi.user_id = su.user_id
left join sys_user_post sup on ksi.user_id = sup.user_id
left join sys_post sp on sup.post_id = sp.post_id
left join basic_canteen bc on ksi.canteen_id = bc.canteen_id
</sql>
@ -46,18 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkStatus != null "> and check_status = #{checkStatus}</if>
<if test="recordTime != null "> and record_time = #{recordTime}</if>
<if test="checkVideoUrl != null and checkVideoUrl != ''"> and check_video_url = #{checkVideoUrl}</if>
<if test="postName != null and postName != ''"> and post_name like CONCAT('%',#{postName},'%')</if>
<if test="searchValue != null and searchValue != ''">
and (su.nick_name like CONCAT('%',#{searchValue},'%')
or su.phonenumber = #{encryptedSearchValue}
or su.user_id like CONCAT('%',#{searchValue},'%')
and (ksi.staff_name like CONCAT('%',#{searchValue},'%')
or ksi.mobile like CONCAT('%',#{searchValue},'%')
or ksi.staff_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="postIds != null and postIds.length > 0">
and sup.post_id in
<foreach item="postId" collection="postIds" open="(" separator="," close=")">
#{postId}
</foreach>
</if>
<if test="startDateTime != null">
and ksmc.record_time <![CDATA[ >= ]]> #{startDateTime}
</if>

View File

@ -28,11 +28,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select waste_id, weight, garbage_name, action_date, device_id, mealtime_type,
kwd.canteen_id, kwd.area_id, deal_type, sale_amount, scene_picture, kwd.staff_id,
kwd.create_by, kwd.create_time, kwd.update_by, kwd.update_time, bc.canteen_name,
su.user_name as deal_user_name
ksi.staff_name as deal_user_name
from kitchen_waste_deal kwd
left join basic_canteen bc on kwd.canteen_id = bc.canteen_id
left join kitchen_staff_info ksi on kwd.staff_id = ksi.staff_id
left join sys_user su on ksi.user_id = su.user_id
</sql>
<select id="selectKitchenWasteDealList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal" resultMap="KitchenWasteDealResult">