diff --git a/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/DeviceClassEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/DeviceClassEnum.java index dd397e8..3d1c42a 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/DeviceClassEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/DeviceClassEnum.java @@ -31,4 +31,12 @@ public enum DeviceClassEnum { public List getDeviceTypes() { return deviceTypes; } + + public static List getDeviceTypesByKey(Integer key) { + return Arrays.stream(values()) + .filter(e -> e.getKey().equals(key)) + .map(DeviceClassEnum::getDeviceTypes) + .findFirst() + .orElse(Collections.emptyList()); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorRecord.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorRecord.java index 84886ee..db23cf8 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorRecord.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenDeviceSensorRecord.java @@ -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 sensorResultTypeList; + @ApiModelProperty(value = "环境类测量结果类型 1 正常 2 温度过高 3 温度过低 4 湿度过高 5 湿度过低 6 烟雾浓度高") + private List envSensorResultTypeList; + + @ApiModelProperty(value = "设备大类 5 环境类 1 门禁类 6 监控类") + private Integer deviceCategory; + + @ApiModelProperty(value = "设备细类") + private List deviceTypes; @ApiModelProperty("开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSampleCabinetRecord.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSampleCabinetRecord.java index ba3c28d..a6be934 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSampleCabinetRecord.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSampleCabinetRecord.java @@ -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关柜 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenStaffInfo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenStaffInfo.java index 41bc340..3c1e97a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenStaffInfo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenStaffInfo.java @@ -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); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/constants/HealthCertStatusEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/constants/HealthCertStatusEnum.java index e1fe3ce..db59d0d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/constants/HealthCertStatusEnum.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/constants/HealthCertStatusEnum.java @@ -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; diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorRecordServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorRecordServiceImpl.java index fb005b7..7f8f363 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorRecordServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenDeviceSensorRecordServiceImpl.java @@ -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 selectKitchenDeviceSensorRecordList(KitchenDeviceSensorRecord kitchenDeviceSensorRecord) { + if(Objects.isNull(kitchenDeviceSensorRecord.getDeviceCategory())) { + throw new ServiceException("设备分类不能为空"); + } + kitchenDeviceSensorRecord.setDeviceTypes(DeviceClassEnum.getDeviceTypesByKey(kitchenDeviceSensorRecord.getDeviceCategory())); List kitchenDeviceSensorRecordList = kitchenDeviceSensorRecordMapper .selectKitchenDeviceSensorRecordList(kitchenDeviceSensorRecord); if(CollUtil.isNotEmpty(kitchenDeviceSensorRecordList)) { 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 d83157f..3019ea3 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 @@ -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 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 kitchenStaffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfo); if(CollUtil.isNotEmpty(kitchenStaffInfoList)) { + BasicSetting basicSetting = new BasicSetting(); + basicSetting.setItemName("staff_health_cert_left_day_reminder"); + List 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); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorRecordMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorRecordMapper.xml index d73df52..ef2015e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorRecordMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenDeviceSensorRecordMapper.xml @@ -44,15 +44,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and kdsr.device_id = #{deviceId} and kdsr.device_type = #{deviceType} and kdsr.measure_code = #{measureCode} - and measure_data = #{measureData} + and measure_data like CONCAT('%',#{measureData},'%') and gateway_device_id = #{gatewayDeviceId} and device_time = #{deviceTime} and kdsr.sub_place = #{subPlace} and kdsr.canteen_id = #{canteenId} and kdsr.area_id = #{areaId} - + + and kdsr.device_type in + + #{deviceType} + + + and ( - + ((kdsm.measure_code = 'temperature' diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffMorningCheckMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffMorningCheckMapper.xml index b3887d6..588469c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffMorningCheckMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenStaffMorningCheckMapper.xml @@ -20,14 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + 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