晨检一体机相关功能

This commit is contained in:
jjLv 2025-08-15 18:47:23 +08:00
parent fb5b4c4a89
commit ac5557cf92
23 changed files with 192 additions and 4 deletions

View File

@ -63,6 +63,8 @@ public class SM4EncryptUtils {
Base64Decoder.decode(src));
System.out.println(src1);
System.out.println(sm4Decrypt("b4c2f994539a2d6e7a8f5c21f51645c6"));
// String src2 = decryptBySm4("Fm61oDlfUUyw1827TmMJnMym9V7KeX90sFNBSEKklDCCF+xeP6xroJ8h51DSHEkLm9oLIz3zjZ67pyHQbNr1Ewy/IOa3oS3urOcs+GQM1Bbept49M4gYVlR+9T5PVBh/oGTxWCLDFGXniZ//I3TPzTZ4d0lvYYQXdU8urbRlG4h+HwVYHupezgESM/7znsxR1cgVRybPdAiabQBasPzJdI8VKx+g+xVR3ee2hPtLZTXBf6ncvbj4f6eXzq5Ak5NnDASJEdJC9gj4pv2evfogAxZNoFLS0hPRde44sjGBXpJ3pWLWp/03iIrLlCQC2V4qugUULZMWaRXp3VzXbvHxbjqzPybMsocBdylfpPDrlj8AMJwt4c48AV+5VSSX4OM7LWwiW7N1Wi8pXbzzzUiUPwJa2T5y3rd40RG8JCruBEoD58t68vt8PoCcdbi4oyO7iY0AZsGxqXkJML9khMzb7yyGogZ6UHVNuzEMZbwbCmMrr2TNIye47yWD4MrB4Em+AwoiCPQMOcZ4uoqtJ79z4+BKWnhb3wy9/Cre54gpLnnAPlEDcmsjVjphjebp9qeGQH9xYXgI/RujjjAUMVDfEIBCHehKjbxTNEMxKesxsQJ/oK4DTOJV71OK4FmxMzdIqkNj02nzoOJC1c7S6ybJcjSP0ls0KRkQq6BLlPxldzGkT6lIUcFfd9foqqETKVDhCisSmKK1oAkdqCd4G6DKF2HFnZmjlanss6KhjdNJoi5cPxpFfVWFG7WxnswOt8FH0eMbanwaY2OuLJ0IL/AoW89iEQQ1vOFCbA2ijrPvAZ8P/YVlXKxXKrcIBHTRfDNjbNrl4VF1/5b0PZWt2BO3BUbT1hSTW5T4M1K0XAqf91e11DgUcp0wlgXE9oyCrcWAMUqwCYYdWEMtvktN3gSeKCHrmHnb+BWHZDVwHIltTbz90guY0k7GgURXSHLPIu+O",
// Base64Decoder.decode(src));
// System.out.println(src2);

View File

@ -40,6 +40,14 @@ public class DeviceController extends BaseController {
}
return deviceService.getDeviceInfo(dto);
}
@ApiOperation("获取设备信息")
@RequestMapping("/getKitchenDeviceInfo")
public AjaxResult getKitchenDeviceInfo(@RequestBody AppDTO dto) {
if (ObjectUtil.isEmpty(dto.getDeviceSn())) {
throw new ServiceException("设备sn不能为空");
}
return deviceService.getKitchenDeviceInfo(dto);
}
@ApiOperation("获取设备版本信息")
@RequestMapping("/getAppVersion")
public AjaxResult getAppVersion(@RequestBody AppDTO dto) {
@ -81,5 +89,19 @@ public class DeviceController extends BaseController {
this.deviceInfoService.updateTimeBySn(dto.getDeviceSn());
return AjaxResult.success();
}
@ApiOperation(value = "更新设备在线状态")
@PostMapping({"/updateTimeByKitchenSn"})
public AjaxResult updateTimeByKitchenSn(@RequestBody DeviceSearchDTO dto) {
if (ObjectUtil.isEmpty(dto.getDeviceSn())) {
throw new ServiceException("设备sn不能为空");
}
this.deviceInfoService.updateTimeByKitchenSn(dto.getDeviceSn());
return AjaxResult.success();
}
@ApiOperation(value = "验证Token")
@PostMapping({"/checkToken"})
public AjaxResult updateTimeByKitchenSn() {
return AjaxResult.success();
}
}

View File

@ -31,4 +31,13 @@ public class FaceController {
return AjaxResult.error("获取人脸特征值失败!");
}
}
@ApiOperation("获取人脸特征值")
@RequestMapping("/getKitchenFaceFeatureList")
public AjaxResult getKitchenFaceFeatureList(@RequestBody AppDTO dto) {
try {
return faceService.getKitchenFaceFeatureList(dto);
}catch (ServiceException e){
return AjaxResult.error("获取人脸特征值失败!");
}
}
}

View File

@ -31,5 +31,14 @@ public class UserController {
return AjaxResult.error("获取人员信息失败!");
}
}
@ApiOperation("获取人员信息")
@RequestMapping("/getKitchenUserInfo")
public AjaxResult getKitchenUserInfo(@RequestBody AppDTO dto) {
try {
return userService.getKitchenUserInfo(dto);
}catch (ServiceException e){
return AjaxResult.error("获取人员信息失败!");
}
}
}

View File

@ -108,4 +108,6 @@ public interface DeviceMapper {
* @return 超市设备信息
*/
DeviceInfoVo getSupermarketDeviceInfo(AppDTO dto);
DeviceInfoVo getKitchenDeviceInfo(AppDTO dto);
}

View File

@ -16,4 +16,6 @@ public interface FaceMapper {
* @return 人脸特征值集合
*/
List<UserFace> getFaceFeatureList(AppDTO dto);
List<UserFace> getKitchenFaceFeatureList(AppDTO dto);
}

View File

@ -22,4 +22,6 @@ public interface UserMapper {
* @return
*/
List<UserInfoVo> getMoneyList();
List<UserInfoVo> getKitchenUserInfo(AppDTO dto);
}

View File

@ -48,4 +48,6 @@ public interface DeviceService {
* @return 时间间隔配置
*/
DeviceTimeIntervalVO intervalConfig(String machineSn);
AjaxResult getKitchenDeviceInfo(AppDTO dto);
}

View File

@ -14,4 +14,6 @@ public interface FaceService {
* @return AjaxResult
*/
AjaxResult getFaceFeatureList(AppDTO dto);
AjaxResult getKitchenFaceFeatureList(AppDTO dto);
}

View File

@ -14,4 +14,6 @@ public interface UserService {
* @return
*/
AjaxResult getUserInfo(AppDTO dto);
AjaxResult getKitchenUserInfo(AppDTO dto);
}

View File

@ -239,4 +239,33 @@ public class DeviceServiceImpl implements DeviceService {
deviceTimeIntervalVO.setBasicsTimeIntervals(basicsTimeIntervals);
return deviceTimeIntervalVO;
}
@Override
public AjaxResult getKitchenDeviceInfo(AppDTO dto) {
List<ParamVO> list = mapper.getParamInfo();
DeviceInfoVo deviceInfoVo = mapper.getKitchenDeviceInfo(dto);
if (list != null && !list.isEmpty()) {
for (ParamVO vo : list) {
String key = vo.getParamKey();
String value = vo.getParamValue();
if (key == null) {
continue;
}
switch (vo.getParamKey()) {
case "app_id":
deviceInfoVo.setAppId(value);
break;
case "app_key":
deviceInfoVo.setAppKey(value);
break;
default:
break;
}
}
}else{
return AjaxResult.error("参数信息未配置");
}
deviceInfoVo.setTenantId(String.valueOf(GlobalConstants.TENANT_ID));
return AjaxResult.success(deviceInfoVo);
}
}

View File

@ -23,4 +23,13 @@ public class FaceServiceImpl implements FaceService {
List<UserFace> list = mapper.getFaceFeatureList(dto);
return AjaxResult.success(list);
}
@Override
public AjaxResult getKitchenFaceFeatureList(AppDTO dto) {
List<UserFace> list = mapper.getKitchenFaceFeatureList(dto);
if (list.isEmpty()) {
return AjaxResult.error("未查询到人脸特征值");
}
return AjaxResult.success(list);
}
}

View File

@ -35,9 +35,6 @@ public class UserServiceImpl implements UserService {
// 构建 userId moneyVo 的映射提升查找效率
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
list.forEach(userInfoVo -> {
// if (userInfoVo.getPhone().length() > PHONE_LENGTH) {
// userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
// }
UserInfoVo money = moneyMap.get(userInfoVo.getUserId());
if (money != null) {
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
@ -49,4 +46,13 @@ public class UserServiceImpl implements UserService {
return AjaxResult.success(list);
}
@Override
public AjaxResult getKitchenUserInfo(AppDTO dto) {
List<UserInfoVo> list = mapper.getKitchenUserInfo(dto);
if (list.isEmpty()) {
return AjaxResult.error("未查询到人员信息");
}
return AjaxResult.success(list);
}
}

View File

@ -144,4 +144,6 @@ public interface DeviceInfoMapper {
* @return 结果
*/
int updateTimeBySn(String sn);
int updateTimeByKitchenSn(String sn);
}

View File

@ -63,4 +63,6 @@ public interface IDeviceInfoService {
* @param deviceSn 设备sn码
*/
void updateTimeBySn(String deviceSn);
void updateTimeByKitchenSn(String deviceSn);
}

View File

@ -175,5 +175,12 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService {
throw new ServiceException("更新时间失败");
}
}
@Override
public void updateTimeByKitchenSn(String sn) {
int code = deviceInfoMapper.updateTimeByKitchenSn(sn);
if (code == 0) {
throw new ServiceException("更新时间失败");
}
}
}

View File

@ -40,7 +40,7 @@ public class KitchenStaffMorningCheck extends BaseEntity {
/** 体温 */
@Excel(name = "体温")
@ApiModelProperty(value = "体温")
private Long temperatureValue;
private String temperatureValue;
/** 体温状态0-未知 1-正常 2-异常) */
@Excel(name = "体温状态", readConverterExp = "0=-未知,1=-正常,2=-异常")
@ -91,4 +91,11 @@ public class KitchenStaffMorningCheck extends BaseEntity {
private String encryptedSearchValue;
private String searchValue;
@ApiModelProperty("人脸照片")
private String faceCheckImg;
@ApiModelProperty("手心照片")
private String handFrontCheckImg;
@ApiModelProperty("手背照片")
private String handBackCheckImg;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.service.impl;
import java.math.BigDecimal;
import java.util.List;
import cn.hutool.core.collection.CollUtil;
@ -65,6 +66,12 @@ public class KitchenStaffMorningCheckServiceImpl implements IKitchenStaffMorning
public int insertKitchenStaffMorningCheck(KitchenStaffMorningCheck kitchenStaffMorningCheck) {
kitchenStaffMorningCheck.setCreateTime(DateUtils.getNowDate());
kitchenStaffMorningCheck.setCheckId(null);
try {
double temperatureValue = Double.parseDouble(kitchenStaffMorningCheck.getTemperatureValue());
kitchenStaffMorningCheck.setTemperatureStatus(temperatureValue > 37.5 ? "2" : "1");
} catch (NumberFormatException e) {
throw new ServiceException("Invalid temperature value: " + kitchenStaffMorningCheck.getTemperatureValue());
}
try {
return kitchenStaffMorningCheckMapper.insertKitchenStaffMorningCheck(kitchenStaffMorningCheck);
} catch (Exception e) {

View File

@ -172,5 +172,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where di.device_sn = #{deviceSn}
GROUP BY di.device_id
</select>
<select id="getKitchenDeviceInfo" resultType="com.bonus.canteen.core.android.vo.DeviceInfoVo">
SELECT di.device_no AS deviceNum,
di.device_name AS deviceName,
di.device_type AS deviceType,
di.canteen_id as canteenId,
CONCAT(aaa.area_name, '/', aa.area_name) AS areaName,
aa.area_id AS areaId,
di.device_pwd as devicePwd
FROM kitchen_device_info di
LEFT JOIN device_bind db ON di.device_id = db.device_id
left join basic_area aa on db.area_id = aa.area_id
left join basic_area aaa on aaa.area_id = aa.parent_id
where di.device_sn = #{deviceSn}
GROUP BY di.device_id
</select>
</mapper>

View File

@ -20,4 +20,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="getKitchenFaceFeatureList" resultType="com.bonus.canteen.core.user.domain.UserFace">
select
staff_id as user_id,
photo_url,
features,
face_state
from kitchen_staff_face
<where>
and face_state = '1'
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
and staff_id = #{userId}
</if>
<if test="time != null and time != ''">
and update_time >= #{time} - INTERVAL 10 SECOND
</if>
</where>
</select>
</mapper>

View File

@ -44,4 +44,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from account_wallet_info)r
GROUP BY r.user_id
</select>
<select id="getKitchenUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
SELECT su.staff_id AS userId,
su.staff_no AS accId,
su.staff_name AS userName,
su.mobile AS phone,
su.post_name as nickName,
su.sex as loginType
FROM kitchen_staff_info su
<where>
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
AND su.staff_id = #{userId}
</if>
</where>
</select>
</mapper>

View File

@ -316,4 +316,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deviceId}
</foreach>
</delete>
<update id="updateTimeByKitchenSn">
update kitchen_device_info
set last_update_time = unix_timestamp()
where device_sn = #{sn}
</update>
</mapper>

View File

@ -21,6 +21,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="canteenName" column="canteen_name" />
<result property="mobile" column="mobile" />
<result property="staffNo" column="staff_no" />
<result property="faceCheckImg" column="face_check_img" />
<result property="handFrontCheckImg" column="hand_front_check_img" />
<result property="handBackCheckImg" column="hand_back_check_img" />
</resultMap>
<sql id="selectKitchenStaffMorningCheckVo">
@ -79,6 +83,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="faceCheckImg != null">face_check_img,</if>
<if test="handFrontCheckImg != null">hand_front_check_img,</if>
<if test="handBackCheckImg != null">hand_back_check_img,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null">#{staffId},</if>
@ -92,6 +99,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="faceCheckImg != null">#{faceCheckImg},</if>
<if test="handFrontCheckImg != null">#{handFrontCheckImg},</if>
<if test="handBackCheckImg != null">#{handBackCheckImg},</if>
</trim>
</insert>