张晓波
2023-10-18 01a3add609a65cfe5c066ebc743ea6308d32a053
苏州配置文件简化
已修改7个文件
95 ■■■■■ 文件已修改
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java
@@ -48,4 +48,14 @@
        jsonObject.put("success",true);
        return jsonObject;
    }
    @RequestMapping("/record/upload/online")
    public JSONObject record(@RequestBody String mess){
        faceServer.record(mess);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("msg","OK");
        jsonObject.put("success",true);
        return jsonObject;
    }
}
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java
@@ -12,4 +12,6 @@
    JSONObject syncPersonSingle(String mess);
    void personNotify(String mess);
    void record(String mess);
}
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java
@@ -4,15 +4,15 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.api.utils.StringUtils;
import com.thhy.general.utils.DeepCopyUtils;
import com.thhy.staff.config.EmqxConfig;
import com.thhy.staff.config.EmqxProperties;
import com.thhy.staff.modules.biz.face.entity.FaceDevice;
import com.thhy.staff.modules.biz.face.entity.FaceResult;
import com.thhy.staff.modules.biz.face.entity.UserFaceVo;
import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper;
import com.thhy.staff.modules.biz.face.service.FaceServer;
import com.thhy.staff.modules.biz.platuser.entity.DoorLis;
import com.thhy.staff.modules.biz.platuser.mapper.PlatUserMapper;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -111,4 +111,12 @@
            }
        }
    }
    @Override
    public void record(String mess) {
        JSONObject jsonObject = JSON.parseObject(mess);
        DoorLis doorLis = new DoorLis(jsonObject);
        userMapper.insertDoorLis(doorLis);
    }
}
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java
@@ -1,5 +1,6 @@
package com.thhy.staff.modules.biz.platuser.entity;
import com.alibaba.fastjson.JSONObject;
import com.thhy.general.annotations.Idkey;
import lombok.Data;
@@ -28,6 +29,10 @@
    private String oriStr;
    private Integer cmpType;
    private String captureScore;
    public DoorLis() {
    }
@@ -35,4 +40,15 @@
    public DoorLis(String oriStr) {
        this.oriStr = oriStr;
    }
    public DoorLis(JSONObject jsonObject) {
        this.macAddress = jsonObject.getString("dev_sno");
        long time = jsonObject.getLong("capture_time");
        this.dateTime = new Date(time);
        this.employeeNoString = jsonObject.getString("person_id");
        this.oriStr = jsonObject.getString("capture_img");
        this.cmpType = jsonObject.getInteger("cmp_type");
        this.verify = jsonObject.getInteger("capture_status");
        this.captureScore = jsonObject.getString("capture_score");
    }
}
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java
@@ -399,11 +399,13 @@
            pathParamJson.put("limit",10);
            pathParamJson.put("offset",0);
            pathParamJson.put("total",1);
            pathParamJson.put("person_list","[\""+faceDto.getUserId()+"\"]");
            List<String> userIds = new ArrayList<>();
            userIds.add(faceDto.getUserId());
            pathParamJson.put("person_list",userIds);
            pathParamJson.put("person_type","4");
            jsonObject.put("path_params",pathParamJson);
            mqContent.setData(jsonObject);
            logger.info("下发人脸参数:"+JSON.toJSONString(mqContent));
            MqUtils.createClient(emqxConfig,sns,JSON.toJSONString(mqContent));
            /*Map<String,Object> map = AcsMain.addFace(fd.getJobNum(),filePrefix+"/"+fd.getPhoto());
            if(map.containsKey("code")){
hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java
@@ -1,13 +1,17 @@
package com.thhy.staff.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.thhy.general.utils.UUIDUtils;
import com.thhy.staff.config.EmqxConfig;
import com.thhy.staff.modules.biz.face.entity.MqContent;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import java.util.ArrayList;
import java.util.List;
public class MqUtils {
@@ -51,4 +55,37 @@
            throw new RuntimeException(e);
        }
    }
    public static void main(String[] args) {
        EmqxConfig emqxConfig = new EmqxConfig();
        emqxConfig.setHost("111.30.93.215");
        emqxConfig.setPort("1883");
        emqxConfig.setQos(1);
        emqxConfig.setUsername("thhy");
        emqxConfig.setPassword("Thhy@123");
        List<String> list = new ArrayList<>();
        list.add("0A:0C:E1:25:75:2C");
        String prefix = "http://111.30.93.212:15002/staff/face/";
        String notify = "/sp/notify";
        MqContent mqContent = new MqContent("sync_person", prefix+notify);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("path",prefix+"syncPersonSingle");
        JSONObject pathParamJson = new JSONObject();
        pathParamJson.put("dev_sno","");
        pathParamJson.put("limit",10);
        pathParamJson.put("offset",0);
        pathParamJson.put("total",1);
        List<String> userIds = new ArrayList<>();
        userIds.add("02e6d1c4ded41512d0ca3622");
        pathParamJson.put("person_list",userIds);
        pathParamJson.put("person_type","4");
        jsonObject.put("path_params",pathParamJson);
        mqContent.setData(jsonObject);
        System.out.println(JSON.toJSONString(mqContent));
    }
}
hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml
@@ -736,6 +736,12 @@
            <if test="oriStr!=null and oriStr !=''">
                ori_str,
            </if>
            <if test="cmpType!=null and cmpType !=''">
                cmp_type,
            </if>
            <if test="captureScore!=null and captureScore !=''">
                capture_score,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{id},
@@ -760,6 +766,12 @@
            <if test="oriStr!=null and oriStr !=''">
                #{oriStr},
            </if>
            <if test="cmpType!=null and cmpType !=''">
                #{cmpType},
            </if>
            <if test="captureScore!=null and captureScore !=''">
                #{captureScore},
            </if>
        </trim>
    </insert>