厨房首页 设备问题修复
This commit is contained in:
		
							parent
							
								
									04b953dd8f
								
							
						
					
					
						commit
						b9c6165229
					
				| 
						 | 
				
			
			@ -3,6 +3,8 @@ package com.bonus.canteen.core.kitchen.domain;
 | 
			
		|||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
import com.bonus.canteen.core.common.utils.FileUrlUtil;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
			
		||||
import com.bonus.common.core.annotation.Excel;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +15,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 厨房员工违规报警对象 kitchen_staff_illegal_warning
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author xsheng
 | 
			
		||||
 * @date 2025-06-16
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +44,11 @@ public class KitchenStaffIllegalWarning extends BaseEntity {
 | 
			
		|||
    @ApiModelProperty(value = "记录照片地址")
 | 
			
		||||
    private String imgUrl;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getImgUrl() {
 | 
			
		||||
        return FileUrlUtil.getFileUrl(this.imgUrl);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 记录内容 */
 | 
			
		||||
    @Excel(name = "记录内容")
 | 
			
		||||
    @ApiModelProperty(value = "记录内容")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,47 +63,67 @@ public class KitchenStaffFaceServiceImpl implements IKitchenStaffFaceService {
 | 
			
		|||
        } else {
 | 
			
		||||
            long startTime = System.currentTimeMillis();
 | 
			
		||||
            //发送请求 调用人脸特征提取接口
 | 
			
		||||
            String url = FileUrlUtil.getFileUrl(dto.getPhotoUrl());
 | 
			
		||||
            System.out.println("人脸特征提取url:" + url);
 | 
			
		||||
            String response = FaceFeatureDetector.detectFaceFeature(url);
 | 
			
		||||
            System.out.println("人脸特征提取接口返回结果:" + response);
 | 
			
		||||
            JSONObject jsonResponse = JSONObject.parseObject(response.toString());
 | 
			
		||||
            if (jsonResponse.getInteger("code") != 30002) {
 | 
			
		||||
                System.out.println("人脸特征提取失败," + jsonResponse.getString("msg"));
 | 
			
		||||
                log.error("人脸特征提取失败,{}", jsonResponse.getString("msg"));
 | 
			
		||||
                throw new ServiceException("人脸特征提取失败," + jsonResponse.getString("msg"));
 | 
			
		||||
            }
 | 
			
		||||
            long endTime = System.currentTimeMillis();
 | 
			
		||||
            System.out.println("人脸特征提取耗时:" + (endTime - startTime) + "ms");
 | 
			
		||||
            List<KitchenStaffFace> list = new ArrayList<>();
 | 
			
		||||
            String dataStr = jsonResponse.getString("data");
 | 
			
		||||
            // 将data字符串解析为JSONArray
 | 
			
		||||
            JSONArray dataArray = JSONArray.parseArray(dataStr);
 | 
			
		||||
            if (dataArray != null && !dataArray.isEmpty()) {
 | 
			
		||||
                Object faceFeature = dataArray.get(0);
 | 
			
		||||
                KitchenStaffFace faceVO = new KitchenStaffFace();
 | 
			
		||||
                faceVO.setErrorMsg("[软件]成功");
 | 
			
		||||
                faceVO.setFeatures(faceFeature.toString());
 | 
			
		||||
                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);
 | 
			
		||||
                int code = kitchenStaffFaceMapper.insertStaffFace(list.get(0));
 | 
			
		||||
                if (code == 0) {
 | 
			
		||||
                    System.out.println("[人脸识别算法]:保存失败");
 | 
			
		||||
                    log.error("[人脸识别算法]:保存失败");
 | 
			
		||||
                    throw new ServiceException("[人脸识别算法]:保存失败");
 | 
			
		||||
                }
 | 
			
		||||
                DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(dto.getStaffId().intValue(),"update");
 | 
			
		||||
                MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.MORNING_INSPECTION_DEVICE_UPDATE_PERSONAL_CONFIG_V4);
 | 
			
		||||
            }else{
 | 
			
		||||
                throw new ServiceException("人脸特征提取失败,未检测到人脸");
 | 
			
		||||
//            String url = FileUrlUtil.getFileUrl(dto.getPhotoUrl());
 | 
			
		||||
//            System.out.println("人脸特征提取url:" + url);
 | 
			
		||||
//            String response = FaceFeatureDetector.detectFaceFeature(url);
 | 
			
		||||
//            System.out.println("人脸特征提取接口返回结果:" + response);
 | 
			
		||||
//            JSONObject jsonResponse = JSONObject.parseObject(response.toString());
 | 
			
		||||
//            if (jsonResponse.getInteger("code") != 30002) {
 | 
			
		||||
//                System.out.println("人脸特征提取失败," + jsonResponse.getString("msg"));
 | 
			
		||||
//                log.error("人脸特征提取失败,{}", jsonResponse.getString("msg"));
 | 
			
		||||
//                throw new ServiceException("人脸特征提取失败," + jsonResponse.getString("msg"));
 | 
			
		||||
//            }
 | 
			
		||||
//            long endTime = System.currentTimeMillis();
 | 
			
		||||
//            System.out.println("人脸特征提取耗时:" + (endTime - startTime) + "ms");
 | 
			
		||||
//            List<KitchenStaffFace> list = new ArrayList<>();
 | 
			
		||||
//            String dataStr = jsonResponse.getString("data");
 | 
			
		||||
//            // 将data字符串解析为JSONArray
 | 
			
		||||
//            JSONArray dataArray = JSONArray.parseArray(dataStr);
 | 
			
		||||
//            if (dataArray != null && !dataArray.isEmpty()) {
 | 
			
		||||
//                Object faceFeature = dataArray.get(0);
 | 
			
		||||
//                KitchenStaffFace faceVO = new KitchenStaffFace();
 | 
			
		||||
//                faceVO.setErrorMsg("[软件]成功");
 | 
			
		||||
//                faceVO.setFeatures(faceFeature.toString());
 | 
			
		||||
//                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);
 | 
			
		||||
//                int code = kitchenStaffFaceMapper.insertStaffFace(list.get(0));
 | 
			
		||||
//                if (code == 0) {
 | 
			
		||||
//                    System.out.println("[人脸识别算法]:保存失败");
 | 
			
		||||
//                    log.error("[人脸识别算法]:保存失败");
 | 
			
		||||
//                    throw new ServiceException("[人脸识别算法]:保存失败");
 | 
			
		||||
//                }
 | 
			
		||||
//
 | 
			
		||||
//                DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(dto.getStaffId().intValue(),"update");
 | 
			
		||||
//                MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.MORNING_INSPECTION_DEVICE_UPDATE_PERSONAL_CONFIG_V4);
 | 
			
		||||
//            }else{
 | 
			
		||||
//                throw new ServiceException("人脸特征提取失败,未检测到人脸");
 | 
			
		||||
//            }
 | 
			
		||||
            KitchenStaffFace faceVO = new KitchenStaffFace();
 | 
			
		||||
            faceVO.setErrorMsg("[软件]成功");
 | 
			
		||||
            faceVO.setFeatures("");
 | 
			
		||||
            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());
 | 
			
		||||
            int code = kitchenStaffFaceMapper.insertStaffFace(faceVO);
 | 
			
		||||
            DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(dto.getStaffId().intValue(),"update");
 | 
			
		||||
            MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.MORNING_INSPECTION_DEVICE_UPDATE_PERSONAL_CONFIG_V4);
 | 
			
		||||
            if (code == 0) {
 | 
			
		||||
                System.out.println("[人脸识别算法]:保存失败");
 | 
			
		||||
                log.error("[人脸识别算法]:保存失败");
 | 
			
		||||
                throw new ServiceException("[人脸识别算法]:保存失败");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return AjaxResult.success();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,6 +135,7 @@ public class KitchenStaffIllegalWarningServiceImpl implements IKitchenStaffIlleg
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void uploadVideoPhoto(byte[] imageBytes, VideoPhotoDTO videoPhotoDTO) {
 | 
			
		||||
        System.err.println("接收到图片 bytes 长度=" + (imageBytes != null ? imageBytes.length : 0));
 | 
			
		||||
        AjaxResult ar = fileServiceClient.uploadVideoFile(convertByteToMultipartFile(imageBytes,"demo.jpg"));
 | 
			
		||||
        SysFile sysFile = ar.getDataAs(SysFile.class);
 | 
			
		||||
        KitchenStaffIllegalWarning kitchenStaffIllegalWarning = new KitchenStaffIllegalWarning();
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +149,9 @@ public class KitchenStaffIllegalWarningServiceImpl implements IKitchenStaffIlleg
 | 
			
		|||
        kitchenStaffIllegalWarning.setCreateBy(SecurityUtils.getUsername());
 | 
			
		||||
        kitchenStaffIllegalWarning.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
        kitchenStaffIllegalWarning.setStaffId(11L);
 | 
			
		||||
        KitchenDeviceInfo  kitchenDeviceInfo =  kitchenDeviceInfoMapper.selectKitchenDeviceInfoByChannelAndDeviceType(videoPhotoDTO.getChannel(), DeviceTypeEnum.CAMERA.getKey()+"");
 | 
			
		||||
        int  channel =  Integer.parseInt(videoPhotoDTO.getChannel())-33;
 | 
			
		||||
 | 
			
		||||
        KitchenDeviceInfo  kitchenDeviceInfo =  kitchenDeviceInfoMapper.selectKitchenDeviceInfoByChannelAndDeviceType(channel+"", DeviceTypeEnum.CAMERA.getKey()+"");
 | 
			
		||||
        if(kitchenDeviceInfo != null){
 | 
			
		||||
            kitchenStaffIllegalWarning.setDeviceId(kitchenDeviceInfo.getDeviceId());
 | 
			
		||||
        }else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ public class initServer implements CommandLineRunner {
 | 
			
		|||
    public static String devPass = "hzx12345";
 | 
			
		||||
 | 
			
		||||
    public static int lUserID2 = -1;//用户句柄
 | 
			
		||||
    public static String devIp2 = "192.168.10.89";
 | 
			
		||||
    public static String devIp2 = "192.168.20.32";
 | 
			
		||||
    public static String devUser2 = "admin";
 | 
			
		||||
    public static String devPass2 = "JYY202509";
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -593,7 +593,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="unitPrice != null">unit_price = #{unitPrice},</if>
 | 
			
		||||
            <if test="largePrice != null">large_price = #{largePrice},</if>
 | 
			
		||||
            <if test="littlePrice != null">little_price = #{littlePrice},</if>
 | 
			
		||||
            <if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
 | 
			
		||||
            <if test="imageUrl != null">image_url = #{imageUrl},</if>
 | 
			
		||||
            <if test="particulars != null">particulars = #{particulars},</if>
 | 
			
		||||
            <if test="recommend != null and recommend != ''">recommend = #{recommend},</if>
 | 
			
		||||
            <if test="indexRecommend != null">index_recommend = #{indexRecommend},</if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,15 +17,16 @@
 | 
			
		|||
 | 
			
		||||
    <insert id="addPhysicalExaminationData">
 | 
			
		||||
        insert into kitchen_staff_physical_examination(staff_id, device_id, sex, age, height, weight, bmi, bodyFat, muscle, boneMass,
 | 
			
		||||
        waterContent, extwater, protein, metabolism, fatLevel, bodyAge)
 | 
			
		||||
        waterContent, extwater, protein, metabolism, fatLevel, bodyAge,phone)
 | 
			
		||||
        values (#{dto.userId},#{dto.machineId},#{dto.sex},#{dto.age},#{dto.height},#{dto.weight},#{dto.bmi},#{dto.bodyFat},#{dto.muscle},#{dto.boneMass},#{dto.waterContent},#{dto.extwater},#{dto.protein}
 | 
			
		||||
        ,#{dto.metabolism},#{dto.fatLevel},#{dto.bodyAge})
 | 
			
		||||
        ,#{dto.metabolism},#{dto.fatLevel},#{dto.bodyAge},#{dto.phone})
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <select id="selectUserById" resultType="com.bonus.canteen.core.healthmachine.bean.BodyMeasurement">
 | 
			
		||||
        select
 | 
			
		||||
            staff_id as userId,
 | 
			
		||||
            staff_no as userCode
 | 
			
		||||
            staff_no as userCode,
 | 
			
		||||
            mobile as phone
 | 
			
		||||
        from kitchen_staff_info
 | 
			
		||||
        where staff_id = #{userId}
 | 
			
		||||
        limit 1
 | 
			
		||||
| 
						 | 
				
			
			@ -50,4 +51,4 @@
 | 
			
		|||
        where user_id = #{userId} and del_flag = 0
 | 
			
		||||
        limit 1
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue