智慧厨房
This commit is contained in:
parent
890357723c
commit
089b201732
|
|
@ -31,4 +31,12 @@ public enum DeviceClassEnum {
|
|||
public List<Integer> getDeviceTypes() {
|
||||
return deviceTypes;
|
||||
}
|
||||
|
||||
public static List<Integer> getDeviceTypesByKey(Integer key) {
|
||||
return Arrays.stream(values())
|
||||
.filter(e -> e.getKey().equals(key))
|
||||
.map(DeviceClassEnum::getDeviceTypes)
|
||||
.findFirst()
|
||||
.orElse(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
|
@ -68,7 +67,7 @@ public class KitchenDeviceSensorRecord extends BaseEntity {
|
|||
/** 位置 */
|
||||
@Excel(name = "位置")
|
||||
@ApiModelProperty(value = "位置")
|
||||
private Long subPlace;
|
||||
private String subPlace;
|
||||
|
||||
/** 食堂id */
|
||||
@Excel(name = "食堂id")
|
||||
|
|
@ -95,8 +94,14 @@ public class KitchenDeviceSensorRecord extends BaseEntity {
|
|||
@ApiModelProperty(value = "测量指标最小值")
|
||||
private BigDecimal measureMinValue;
|
||||
|
||||
@ApiModelProperty(value = "测量结果类型")
|
||||
private List<Integer> sensorResultTypeList;
|
||||
@ApiModelProperty(value = "环境类测量结果类型 1 正常 2 温度过高 3 温度过低 4 湿度过高 5 湿度过低 6 烟雾浓度高")
|
||||
private List<Integer> envSensorResultTypeList;
|
||||
|
||||
@ApiModelProperty(value = "设备大类 5 环境类 1 门禁类 6 监控类")
|
||||
private Integer deviceCategory;
|
||||
|
||||
@ApiModelProperty(value = "设备细类")
|
||||
private List<Integer> deviceTypes;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ public class KitchenSampleCabinetRecord extends BaseEntity {
|
|||
|
||||
/** 开柜时间 */
|
||||
@ApiModelProperty(value = "开柜时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开柜时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开柜时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date openCabinetTime;
|
||||
|
||||
/** 关柜时间 */
|
||||
@ApiModelProperty(value = "关柜时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "关柜时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "关柜时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date closeCabinetTime;
|
||||
|
||||
/** 操作类型 1开柜 2关柜 */
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.kitchen.domain;
|
|||
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;
|
||||
|
|
@ -84,4 +85,11 @@ public class KitchenStaffInfo extends SysUser {
|
|||
@JsonIgnore
|
||||
private String encryptedSearchValue;
|
||||
|
||||
public String getHealthCertFrontImg() {
|
||||
return FileUrlUtil.getFileUrl(this.healthCertFrontImg);
|
||||
}
|
||||
|
||||
public String getHealthCertBackImg() {
|
||||
return FileUrlUtil.getFileUrl(this.healthCertBackImg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.bonus.canteen.core.kitchen.domain.constants;
|
||||
|
||||
import com.bonus.canteen.core.account.constants.AccTradeTypeEnum;
|
||||
|
||||
public enum HealthCertStatusEnum {
|
||||
NOT_APPROVE(1, "正常"),
|
||||
APPROVE(2, "过期"),
|
||||
NOT_APPROVE_AGAIN(3, "缺失"),
|
||||
EXPIRED(4, "临期");
|
||||
NORMAL(1, "正常"),
|
||||
EXPIRED(2, "过期"),
|
||||
NO_IMG(3, "缺失"),
|
||||
ADVENT(4, "临期");
|
||||
|
||||
private final Integer key;
|
||||
private final String desc;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.alibaba.excel.util.StringUtils;
|
|||
import com.bonus.canteen.core.kitchen.domain.constants.DeviceSensorResultEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.houqin.constant.DeviceClassEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceSensorRecordMapper;
|
||||
|
|
@ -45,6 +46,10 @@ public class KitchenDeviceSensorRecordServiceImpl implements IKitchenDeviceSenso
|
|||
*/
|
||||
@Override
|
||||
public List<KitchenDeviceSensorRecord> selectKitchenDeviceSensorRecordList(KitchenDeviceSensorRecord kitchenDeviceSensorRecord) {
|
||||
if(Objects.isNull(kitchenDeviceSensorRecord.getDeviceCategory())) {
|
||||
throw new ServiceException("设备分类不能为空");
|
||||
}
|
||||
kitchenDeviceSensorRecord.setDeviceTypes(DeviceClassEnum.getDeviceTypesByKey(kitchenDeviceSensorRecord.getDeviceCategory()));
|
||||
List<KitchenDeviceSensorRecord> kitchenDeviceSensorRecordList = kitchenDeviceSensorRecordMapper
|
||||
.selectKitchenDeviceSensorRecordList(kitchenDeviceSensorRecord);
|
||||
if(CollUtil.isNotEmpty(kitchenDeviceSensorRecordList)) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
package com.bonus.canteen.core.kitchen.service.impl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.basic.domain.BasicSetting;
|
||||
import com.bonus.canteen.core.basic.mapper.BasicSettingMapper;
|
||||
import com.bonus.canteen.core.kitchen.domain.AccessAuthority;
|
||||
import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo;
|
||||
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
|
||||
|
|
@ -15,6 +19,7 @@ import com.bonus.canteen.core.user.domain.UserFace;
|
|||
import com.bonus.canteen.core.user.service.IUserFaceService;
|
||||
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.houqin.constant.DeviceTypeEnum;
|
||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
|
|
@ -43,6 +48,8 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
private KitchenStaffDevicePrivilegeMapper kitchenStaffDevicePrivilegeMapper;
|
||||
@Autowired
|
||||
private KitchenDeviceInfoMapper kitchenDeviceInfoMapper;
|
||||
@Autowired
|
||||
private BasicSettingMapper basicSettingMapper;
|
||||
|
||||
/**
|
||||
* 查询厨房员工资料
|
||||
|
|
@ -59,8 +66,8 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
.selectKitchenStaffDevicePrivilegeByStaffId(staffId);
|
||||
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilegeList)) {
|
||||
List<AccessAuthority> accessAuthorityList = Lists.newArrayList();
|
||||
AccessAuthority accessAuthority = new AccessAuthority();
|
||||
for (KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege : kitchenStaffDevicePrivilegeList) {
|
||||
AccessAuthority accessAuthority = new AccessAuthority();
|
||||
KitchenDeviceListVO deviceInfo = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
|
||||
if(Objects.nonNull(deviceInfo)) {
|
||||
accessAuthority.setDeviceName(deviceInfo.getDeviceName());
|
||||
|
|
@ -89,9 +96,26 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
kitchenStaffInfo.setEncryptedSearchValue(encryptedSearchValue);
|
||||
List<KitchenStaffInfo> kitchenStaffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfo);
|
||||
if(CollUtil.isNotEmpty(kitchenStaffInfoList)) {
|
||||
BasicSetting basicSetting = new BasicSetting();
|
||||
basicSetting.setItemName("staff_health_cert_left_day_reminder");
|
||||
List<BasicSetting> basicSettingList = basicSettingMapper.selectBasicSettingList(basicSetting);
|
||||
Long reminderDays = null;
|
||||
if(CollUtil.isEmpty(basicSettingList)) {
|
||||
reminderDays = 30L;
|
||||
}else {
|
||||
reminderDays = basicSettingList.get(0).getItemValue() == null ? 30L : Long.parseLong(basicSettingList.get(0).getItemValue());
|
||||
}
|
||||
for (KitchenStaffInfo info : kitchenStaffInfoList) {
|
||||
info.setPhonenumber(SM4EncryptUtils.sm4Decrypt(info.getPhonenumber()));
|
||||
info.setHealthCertStatusName(HealthCertStatusEnum.getDescByKey(info.getHealthCertStatus()));
|
||||
if(StringUtils.isBlank(info.getHealthCertFrontImg())) {
|
||||
info.setHealthCertStatusName(HealthCertStatusEnum.NO_IMG.getDesc());
|
||||
}else if(Objects.nonNull(info.getHealthCertExpire()) && info.getHealthCertExpire().isBefore(LocalDate.now())){
|
||||
info.setHealthCertStatusName(HealthCertStatusEnum.EXPIRED.getDesc());
|
||||
}else if(Objects.nonNull(info.getHealthCertExpire()) && info.getHealthCertExpire().isBefore(LocalDate.now().plusDays(reminderDays))){
|
||||
info.setHealthCertStatusName(HealthCertStatusEnum.ADVENT.getDesc());
|
||||
}else if(Objects.nonNull(info.getHealthCertExpire()) && info.getHealthCertExpire().isAfter(LocalDate.now().plusDays(reminderDays))){
|
||||
info.setHealthCertStatusName(HealthCertStatusEnum.NORMAL.getDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
return kitchenStaffInfoList;
|
||||
|
|
@ -110,6 +134,14 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
kitchenStaffInfo.setStaffId(null);
|
||||
try {
|
||||
if(StringUtils.isNotBlank(kitchenStaffInfo.getHealthCertFrontImg())
|
||||
&& Objects.isNull(kitchenStaffInfo.getHealthCertExpire())) {
|
||||
throw new ServiceException("健康证有效期不能为空");
|
||||
}
|
||||
if(StringUtils.isBlank(kitchenStaffInfo.getHealthCertFrontImg())
|
||||
&& Objects.nonNull(kitchenStaffInfo.getHealthCertExpire())) {
|
||||
throw new ServiceException("健康证不能为空");
|
||||
}
|
||||
checkUser(kitchenStaffInfo);
|
||||
int result = kitchenStaffInfoMapper.insertKitchenStaffInfo(kitchenStaffInfo);
|
||||
addPrivileges(kitchenStaffInfo);
|
||||
|
|
|
|||
|
|
@ -44,15 +44,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deviceId != null "> and kdsr.device_id = #{deviceId}</if>
|
||||
<if test="deviceType != null "> and kdsr.device_type = #{deviceType}</if>
|
||||
<if test="measureCode != null and measureCode != ''"> and kdsr.measure_code = #{measureCode}</if>
|
||||
<if test="measureData != null and measureData != ''"> and measure_data = #{measureData}</if>
|
||||
<if test="measureData != null and measureData != ''"> and measure_data like CONCAT('%',#{measureData},'%')</if>
|
||||
<if test="gatewayDeviceId != null "> and gateway_device_id = #{gatewayDeviceId}</if>
|
||||
<if test="deviceTime != null "> and device_time = #{deviceTime}</if>
|
||||
<if test="subPlace != null "> and kdsr.sub_place = #{subPlace}</if>
|
||||
<if test="canteenId != null "> and kdsr.canteen_id = #{canteenId}</if>
|
||||
<if test="areaId != null "> and kdsr.area_id = #{areaId}</if>
|
||||
<if test="sensorResultTypeList != null and sensorResultTypeList.size() > 0">
|
||||
<if test="deviceTypes != null and deviceTypes.size() > 0">
|
||||
and kdsr.device_type in
|
||||
<foreach collection="deviceTypes" item="deviceType" separator="," open="(" close=")">
|
||||
#{deviceType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="envSensorResultTypeList != null and envSensorResultTypeList.size() > 0">
|
||||
and (
|
||||
<foreach item="type" collection="sensorResultTypeList" separator=" or ">
|
||||
<foreach item="type" collection="envSensorResultTypeList" separator=" or ">
|
||||
<choose>
|
||||
<when test="type == 1">
|
||||
((kdsm.measure_code = 'temperature'
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="postName" column="post_name" />
|
||||
<result property="canteenName" column="canteen_name" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="staffNo" column="staffNo" />
|
||||
<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, su.user_id as staffNo
|
||||
su.phonenumber, 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue