From 01a3add609a65cfe5c066ebc743ea6308d32a053 Mon Sep 17 00:00:00 2001 From: 张晓波 <bingbo1993@126.com> Date: 星期三, 18 十月 2023 16:12:54 +0800 Subject: [PATCH] 苏州配置文件简化 --- hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java | 6 ++- hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java | 37 ++++++++++++++++++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java | 12 +++++- hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java | 16 ++++++++ hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml | 12 ++++++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java | 10 +++++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java | 2 + 7 files changed, 91 insertions(+), 4 deletions(-) diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java index fe93497..560b42d 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java +++ b/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; + } } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java index 78a0f91..2b859eb 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java +++ b/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); } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java index 98cf8ac..7b4b626 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java +++ b/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); + } } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java index 75a641e..9eb2367 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/DoorLis.java +++ b/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"); + } } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java index 0476b0e..8425be2 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java +++ b/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")){ diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java index f975e44..57595ad 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java +++ b/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)); + } } diff --git a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml index bca8d0f..ef4ab34 100644 --- a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml +++ b/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> -- Gitblit v1.9.3