Browse Source

Merge branch 'master' into fu-normal-push

fuyuchuan 3 months ago
parent
commit
36560c0d1f
27 changed files with 792 additions and 211 deletions
  1. 50 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttBaseConfig.java
  2. 52 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttInConfig.java
  3. 84 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttOutConfig.java
  4. 86 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/enums/TopListener.java
  5. 57 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/listener/MqttListener.java
  6. 57 53
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/listener/RabbitMQListener.java
  7. 21 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/MqttStrategy.java
  8. 26 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/SimpleContext.java
  9. 61 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/event/event.java
  10. 41 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/info/Info.java
  11. 21 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/MqttBaseVO.java
  12. 3 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java
  13. 1 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/RuoYiSystemApplication.java
  14. 31 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/config/SyncPatrolInspectionEvent.java
  15. 14 6
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java
  16. 17 19
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java
  17. 19 19
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/listener/RabbitMQListener.java
  18. 1 1
      service-iot/service-iot-biz/src/main/java/com/usky/iot/RuoYiSystemApplication.java
  19. 4 2
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/DingTalkAndMessage.java
  20. 49 49
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/ExecutorConfig.java
  21. 2 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/rabbitmq/RabbitMQConfig.java
  22. 9 5
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseAppInfoServiceImpl.java
  23. 48 48
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/CrmDeviceRepairServiceImpl.java
  24. 30 8
      service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/controller/web/MeetingFaceController.java
  25. 5 0
      service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/domain/MeetingFace.java
  26. 2 0
      service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/mapper/SysDeptMapper.java
  27. 1 0
      service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/server/FaceContrastServer.java

+ 50 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttBaseConfig.java

@@ -0,0 +1,50 @@
+package com.usky.agbox.service.config.mqtt;
+
+import lombok.Data;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory;
+import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
+import org.springframework.stereotype.Component;
+
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Data
+@Component
+@ConfigurationProperties(prefix = "mqtt")
+public class MqttBaseConfig {
+
+	@Value("${mqtt.username}")
+	private String username;
+
+	@Value("${mqtt.password}")
+	private String password;
+
+	@Value("${mqtt.url}")
+	private String hostUrl;
+
+	@Value("${mqtt.sub-topics}")
+	private String msgTopic;
+
+	@Value("${mqtt.keep-alive-interval}")
+	//心跳间隔
+	private int keepAliveInterval;
+	@Value("${mqtt.completionTimeout}")
+	//心跳间隔
+	private int completionTimeout;
+
+
+	@Bean
+	public MqttPahoClientFactory mqttClientFactory() {
+		DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
+		MqttConnectOptions options = new MqttConnectOptions();
+		options.setServerURIs(new String[]{this.getHostUrl()});
+		options.setUserName(this.getUsername());
+		options.setPassword(this.getPassword().toCharArray());
+		factory.setConnectionOptions(options);
+		return factory;
+	}
+
+}

+ 52 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttInConfig.java

@@ -0,0 +1,52 @@
+package com.usky.agbox.service.config.mqtt;
+
+import com.usky.agbox.service.enums.TopListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.core.MessageProducer;
+import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
+import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
+import org.springframework.messaging.MessageChannel;
+
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/11/1 16:37
+ */
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Configuration
+public class MqttInConfig {
+
+    @Autowired
+    private MqttBaseConfig mqttBaseConfig;
+
+    public static final String CHANNEL_NAME_INPUT = "mqttInputChannel";
+
+    @Bean(name = CHANNEL_NAME_INPUT)
+    public MessageChannel mqttInputChannel() {
+        return new DirectChannel();
+    }
+
+
+    /**
+     * 消息订阅绑定-消费者
+     *
+     * @return
+     */
+    @Bean
+    public MessageProducer inbound() {
+        String[] tops = mqttBaseConfig.getMsgTopic().split(",");
+        String clientId = "h-agbox-mqtt-in-" + System.currentTimeMillis();
+        MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(clientId,
+                mqttBaseConfig.mqttClientFactory(), tops);
+        adapter.setCompletionTimeout(mqttBaseConfig.getCompletionTimeout());
+        adapter.setConverter(new DefaultPahoMessageConverter());
+        adapter.setQos(2);
+        adapter.setOutputChannel(mqttInputChannel());
+        return adapter;
+    }
+}

+ 84 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/config/mqtt/MqttOutConfig.java

@@ -0,0 +1,84 @@
+package com.usky.agbox.service.config.mqtt;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.annotation.MessagingGateway;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
+import org.springframework.integration.mqtt.support.MqttHeaders;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.messaging.handler.annotation.Header;
+
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Configuration
+public class MqttOutConfig {
+
+    @Autowired
+    public MqttBaseConfig mqttBaseConfig;
+
+    public static final String CHANNEL_NAME_OUT = "mqttOutboundChannel";
+
+    public static final String MESSAGE_NAME = "messageOut";
+
+    public static final String DEFAULT_TOPIC = "testTopic";
+
+    /**
+     * 连接通道
+     *
+     * @return
+     */
+    @Bean(name = CHANNEL_NAME_OUT)
+    public MessageChannel mqttOutboundChannel() {
+        return new DirectChannel();
+    }
+
+    /**
+     * 发送消息和消费消息Channel可以使用相同MqttPahoClientFactory
+     *
+     * @return
+     */
+    @Bean(name = MESSAGE_NAME)
+    @ServiceActivator(inputChannel = CHANNEL_NAME_OUT)
+    public MessageHandler outbound() {
+        // 在这里进行mqttOutboundChannel的相关设置
+        String clientId = "h-backend-mqtt-in-" + System.currentTimeMillis();
+        MqttPahoMessageHandler messageHandler =
+                new MqttPahoMessageHandler(clientId, mqttBaseConfig.mqttClientFactory());
+        //如果设置成true,发送消息时将不会阻塞。
+        messageHandler.setAsync(true);
+        messageHandler.setDefaultTopic(DEFAULT_TOPIC);
+        return messageHandler;
+    }
+
+    @MessagingGateway(defaultRequestChannel = CHANNEL_NAME_OUT)
+    public interface MqttGateway {
+        /**
+         * 发送消息
+         *
+         * @param payload
+         */
+        void sendToMqtt(String payload);
+
+        /**
+         * 指定top发送消息
+         *
+         * @param topic
+         * @param payload
+         */
+        void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, String payload);
+
+        /**
+         * 指定队列和qos
+         *
+         * @param topic
+         * @param qos
+         * @param payload
+         */
+        void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, @Header(MqttHeaders.QOS) int qos, String payload);
+    }
+}

+ 86 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/enums/TopListener.java

@@ -0,0 +1,86 @@
+package com.usky.agbox.service.enums;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/12/31 11:11
+ */
+public enum TopListener {
+
+    /**
+     * 城运对接
+     */
+    MH_WATER_INFO("fireInfo","mh/water/info",1),
+    MH_WATER_ALERT("fireInfo","mh/water/alert",1),
+    MH_WATER_STATISTICS("fireInfo","mh/water/statistics",1),
+    DEVICE_INFO("fireInfo","device/info",1),
+    DEVICE_ALERT("fireInfo","device/alert",1),
+    DEVICE_DETAIL("fireInfo","device/detail",1),
+    DEVICE_AJ("fireInfo","device/aj",1),
+
+    /**
+     * 全部设备对接
+     */
+    FIRE_INFO("fireInfo","/usky/ytDP0001/+/+/info",1),
+    FIRE_ALERT("fireAlarm","/usky/ytDP0001/+/+/alarm",1),
+    WATER_INFO("waterInfo","/usky/ytDP0002/+/+/info",1),
+    WATER_ALERT("waterAlert","/usky/ytDP0002/+/+/alarm",1),
+    SMOKE_INFO("smokeInfo","/usky/ytDP0003/+/+/info",1),
+    SMOKE_ALERT("smokeAlarm","/usky/ytDP0003/+/+/alarm",1),
+    LIQUID_INFO("waterInfo","/usky/ytDP0005/+/+/info",1),
+    LIQUID_ALERT("waterAlert","/usky/ytDP0005/+/+/alarm",1),
+    RTU_INFO("rtuinfo","/usky/ytDP0006/+/+/info",1),
+    RTU_ALERT("rtuAlert","/usky/ytDP0006/+/+/alarm",1),
+    ELECTRICAL_INFO("electricalInfo","/usky/ytDP0007/+/+/info",1),
+    ELECTRICAL_ALERT("electricalAlarm","/usky/ytDP0007/+/+/alarm",1),
+    MH_COVER_INFO("waterInfo","/usky/ytDP0008/+/+/info",1),
+    MH_COVER_ALERT("waterAlert","/usky/ytDP0008/+/+/alarm",1),
+    VIDEO_ALERT("videoAlert","/usky/ytCamCore/+/+/alarm",1),
+    LR_SMOKE_INFO("smokeInfo","/usky/ytDP00033/+/+/info",1),
+    LR_SMOKE_ALERT("smokeAlarm","/usky/ytDP00033/+/+/alarm",1);
+
+
+
+
+    private String name;
+    private String code;
+    //0发送队列,1监听队列2都是
+    private Integer type;
+
+    TopListener(String name, String code, Integer type){
+        this.name = name;
+        this.code = code;
+        this.type = type;
+    }
+
+    public static TopListener parse(String code){
+        TopListener topListener = null;
+        for (TopListener t:TopListener.values()) {
+            if (t.getCode().equals(code)){
+                topListener = t;
+                break;
+            }
+        }
+        return topListener;
+    }
+    public static List<TopListener> parse(Integer type){
+        List<TopListener> listeners = new ArrayList<>();
+        for (TopListener t:TopListener.values()) {
+            if (t.getType().equals(type)){
+                listeners.add(t);
+            }
+        }
+        return listeners;
+    }
+    public String getCode(){
+        return code;
+    }
+    public String getName(){
+        return name;
+    }
+    public Integer getType(){
+        return type;
+    }
+}

+ 57 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/listener/MqttListener.java

@@ -0,0 +1,57 @@
+package com.usky.agbox.service.listener;
+
+
+import com.usky.agbox.service.config.mqtt.MqttInConfig;
+import com.usky.agbox.service.mqtt.SimpleContext;
+import com.usky.agbox.service.vo.MqttBaseVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author yq
+ * @date 2021/11/3 8:13
+ */
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Slf4j
+@Component
+public class MqttListener {
+
+    public static final String MESSAGE_NAME = "messageInput";
+
+    @Autowired
+    private SimpleContext simpleContext;
+
+    /**
+     * 处理消息-消费者
+     *
+     * @return
+     */
+    @Bean(MESSAGE_NAME)
+    @ServiceActivator(inputChannel = MqttInConfig.CHANNEL_NAME_INPUT)
+    public MessageHandler handler() {
+        return message -> {
+            String payload = message.getPayload().toString();
+            //进行接口推送
+            Object mqttReceivedTopic = message.getHeaders().get("mqtt_receivedTopic");
+            if (null != mqttReceivedTopic) {
+                String topic = mqttReceivedTopic.toString();
+                MqttBaseVO mqttBaseVO = new MqttBaseVO();
+                mqttBaseVO.setTopic(topic);
+                if (topic.indexOf("info") != -1 ) {
+                    mqttBaseVO.setDescribe("info");
+                    mqttBaseVO.setData(payload);
+                }else if(topic.indexOf("event") != -1 ) {
+                    mqttBaseVO.setDescribe("event");
+                    mqttBaseVO.setData(payload);
+                }
+                //统一处理数据
+                simpleContext.getResource(mqttBaseVO);
+            }
+        };
+    }
+}

+ 57 - 53
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/listener/RabbitMQListener.java

@@ -7,63 +7,67 @@ import org.springframework.amqp.core.ExchangeTypes;
 import org.springframework.amqp.core.Message;
 import org.springframework.amqp.rabbit.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 @Slf4j
 @Component
 public class RabbitMQListener {
-    @Autowired
-    private patrolAgbox PatrolAgbox;
-    @RabbitHandler
-    @RabbitListener(bindings = @QueueBinding(
-            value = @Queue(),
-            exchange = @Exchange(value = "Patrol_FEvent",type = ExchangeTypes.FANOUT)
-    ))
-    public void getData(Message message){
-        try {
-            String str = new String(message.getBody(),"utf-8");
-            JSONObject eventVO1 = JSONObject.parseObject(str);
-            JSONObject eventVO = new JSONObject();
-            if (eventVO1.get("eventType").equals(31)){
-                eventVO1.put("eventCode",1);
-                PatrolAgbox.addEvent(eventVO1.toJSONString());
-            }else if (eventVO1.get("eventType").equals(32)){
-                eventVO1.put("eventCode",2);
-                PatrolAgbox.addEvent(eventVO1.toJSONString());
-            }else {
-                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)){
-                    eventVO.put("eventCode",5);
-                }else {
-                    eventVO.put("eventCode",16);
-                }
-                String timeWithT = eventVO1.get("createTime").toString();
-                eventVO.put("deviceId",eventVO1.get("deviceId"));
-                eventVO.put("triggerTime",timeWithT.replace("T", " "));
-                eventVO.put("name",eventVO1.get("createBy"));
-                eventVO.put("certifiedNo","");
-                PatrolAgbox.addEvent(eventVO.toJSONString());
-            }
-            System.out.println("FEventReceiver消费者收到消息: " + str);
-        } catch (Exception e){
-            e.printStackTrace();
-        }
-    }
 
-    @RabbitHandler
-    @RabbitListener(bindings = @QueueBinding(
-            value = @Queue(),
-            exchange = @Exchange(value = "Patrol_FInfo",type = ExchangeTypes.FANOUT)
-    ))
-    public void getDataInfo(Message message){
-        try {
-            String str = new String(message.getBody(),"utf-8");
-            JSONObject eventVO1 = JSONObject.parseObject(str);
-            JSONObject eventVO = new JSONObject();
-            eventVO.put("deviceId",eventVO1.get("deviceId"));
-            PatrolAgbox.updateHeart(eventVO.toJSONString());
-            System.out.println("FInfoReceiver消费者收到消息: " + str);
-        } catch (Exception e){
-            e.printStackTrace();
-        }
-    }
+//    @Autowired
+//    private patrolAgbox PatrolAgbox;
+//    @RabbitHandler
+//    @RabbitListener(bindings = @QueueBinding(
+//            value = @Queue(),
+//            exchange = @Exchange(value = "Patrol_EEvent"),
+//            key = {"${agBox.routeKey}"}
+//    ))
+//    public void getData(Message message){
+//        try {
+//            String str = new String(message.getBody(),"utf-8");
+//            JSONObject eventVO1 = JSONObject.parseObject(str);
+//            JSONObject eventVO = new JSONObject();
+//            if (eventVO1.get("eventType").equals(31)){
+//                eventVO1.put("eventCode",1);
+//                PatrolAgbox.addEvent(eventVO1.toJSONString());
+//            }else if (eventVO1.get("eventType").equals(32)){
+//                eventVO1.put("eventCode",2);
+//                PatrolAgbox.addEvent(eventVO1.toJSONString());
+//            }else {
+//                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)){
+//                    eventVO.put("eventCode",5);
+//                }else {
+//                    eventVO.put("eventCode",16);
+//                }
+//                String timeWithT = eventVO1.get("createTime").toString();
+//                eventVO.put("deviceId",eventVO1.get("deviceId"));
+//                eventVO.put("triggerTime",timeWithT.replace("T", " "));
+//                eventVO.put("name",eventVO1.get("createBy"));
+//                eventVO.put("certifiedNo","");
+//                PatrolAgbox.addEvent(eventVO.toJSONString());
+//            }
+//            System.out.println("FEventReceiver消费者收到消息: " + str);
+//        } catch (Exception e){
+//            e.printStackTrace();
+//        }
+//    }
+//
+//    @RabbitHandler
+//    @RabbitListener(bindings = @QueueBinding(
+//            value = @Queue(),
+//            exchange = @Exchange(value = "Patrol_EInfo"),
+//            key = {"${agBox.routeKey}"}
+//    ))
+//    public void getDataInfo(Message message){
+//        try {
+//            String str = new String(message.getBody(),"utf-8");
+//            JSONObject eventVO1 = JSONObject.parseObject(str);
+//            JSONObject eventVO = new JSONObject();
+//            eventVO.put("deviceId",eventVO1.get("deviceId"));
+//            PatrolAgbox.updateHeart(eventVO.toJSONString());
+//            System.out.println("FInfoReceiver消费者收到消息: " + str);
+//        } catch (Exception e){
+//            e.printStackTrace();
+//        }
+//    }
 }

+ 21 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/MqttStrategy.java

@@ -0,0 +1,21 @@
+package com.usky.agbox.service.mqtt;
+
+
+import com.usky.agbox.service.vo.MqttBaseVO;
+
+/**
+ * 策略类
+ *
+ * @author yq
+ * @date 2021/11/3 8:27
+ */
+public interface MqttStrategy {
+    /**
+     * 处理消息(策略模式由子类实现)
+     *
+     * @param mqttBaseVO
+     * @return
+     */
+    String disposeMessage(MqttBaseVO mqttBaseVO);
+
+}

+ 26 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/SimpleContext.java

@@ -0,0 +1,26 @@
+package com.usky.agbox.service.mqtt;
+
+
+import com.usky.agbox.service.vo.MqttBaseVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 中间处理消息转发
+ */
+@Service
+public class SimpleContext {
+    @Autowired
+    private final Map<String, MqttStrategy> strategyMap = new ConcurrentHashMap<>();
+
+    public SimpleContext(Map<String, MqttStrategy> strategyMap) {
+        strategyMap.forEach(this.strategyMap::put);
+    }
+
+    public String getResource(MqttBaseVO mqttBaseVO) {
+        return strategyMap.get(mqttBaseVO.getDescribe()).disposeMessage(mqttBaseVO);
+    }
+}

+ 61 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/event/event.java

@@ -0,0 +1,61 @@
+package com.usky.agbox.service.mqtt.event;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.usky.agbox.service.job.patrolAgbox;
+import com.usky.agbox.service.mqtt.MqttStrategy;
+import com.usky.agbox.service.vo.MqttBaseVO;
+import com.usky.common.core.util.JsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.Map;
+
+@Service("event")
+public class event implements MqttStrategy {
+    @Autowired
+    private patrolAgbox PatrolAgbox;
+
+    //处理下发命令响应消息
+    public String disposeMessage(MqttBaseVO mqttBaseVO) {
+
+        try {
+            JSONObject eventVO1 = JSONObject.parseObject(mqttBaseVO.getData().toString());
+            JSONObject eventVO = new JSONObject();
+            JSONObject eventVO2 = new JSONObject();
+            if (eventVO1.get("eventType").equals(31)){
+                eventVO1.put("eventCode",1);
+                PatrolAgbox.addEvent(eventVO1.toString());
+                eventVO2.put("deviceId",eventVO1.get("deviceId"));
+                PatrolAgbox.updateHeart(eventVO2.toJSONString());
+            }else if (eventVO1.get("eventType").equals(32)){
+                eventVO1.put("eventCode",2);
+                PatrolAgbox.addEvent(eventVO1.toString());
+                eventVO2.put("deviceId",eventVO1.get("deviceId"));
+                PatrolAgbox.updateHeart(eventVO2.toJSONString());
+            }else {
+                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)){
+                    eventVO.put("eventCode",5);
+                }else {
+                    eventVO.put("eventCode",16);
+                }
+                String timeWithT = eventVO1.get("createTime").toString();
+                eventVO.put("deviceId",eventVO1.get("deviceId"));
+                eventVO.put("triggerTime",timeWithT.replace("T", " "));
+                eventVO.put("name",eventVO1.get("createBy"));
+                eventVO.put("certifiedNo","");
+                PatrolAgbox.addEvent(eventVO.toJSONString());
+                eventVO2.put("deviceId",eventVO1.get("deviceId"));
+                PatrolAgbox.updateHeart(eventVO2.toJSONString());
+            }
+            System.out.println("FEventReceiver消费者收到消息: " + mqttBaseVO.getData().toString());
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+
+}

+ 41 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/info/Info.java

@@ -0,0 +1,41 @@
+package com.usky.agbox.service.mqtt.info;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.usky.agbox.service.job.patrolAgbox;
+import com.usky.agbox.service.mqtt.MqttStrategy;
+import com.usky.agbox.service.vo.MqttBaseVO;
+import com.usky.common.core.util.JsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author zyj
+ * @date 2022/12/6 15:07
+ */
+@Service("info")
+public class Info implements MqttStrategy {
+    @Autowired
+    private patrolAgbox PatrolAgbox;
+
+    public String disposeMessage(MqttBaseVO mqttBaseVO) {
+
+        try {
+            JSONObject map_data = JSONObject.parseObject(mqttBaseVO.getData().toString());
+            JSONObject eventVO = new JSONObject();
+            eventVO.put("deviceId",map_data.get("deviceId"));
+            PatrolAgbox.updateHeart(eventVO.toJSONString());
+            System.out.println("FInfoReceiver消费者收到消息: " + mqttBaseVO.getData().toString());
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+
+}

+ 21 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/MqttBaseVO.java

@@ -0,0 +1,21 @@
+package com.usky.agbox.service.vo;
+
+import lombok.Data;
+
+/**
+ * @author yq
+ * @date 2021/11/3 8:32
+ */
+@Data
+public class MqttBaseVO {
+    /**
+     * 接口描述
+     */
+    private String describe;
+
+    private String topic;
+    /**
+     * 数据内容
+      */
+    private Object data;
+}

+ 3 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java

@@ -3,6 +3,8 @@ package com.usky.eg.controller.web;
 
 import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.bean.CommonPage;
+import com.usky.common.log.annotation.Log;
+import com.usky.common.log.enums.BusinessType;
 import com.usky.eg.domain.EgDevice;
 import com.usky.eg.service.EgDeviceService;
 import com.usky.eg.service.vo.EgDeviceRequestVO;
@@ -66,6 +68,7 @@ public class EgDeviceController {
     /**
      * 下发设备控制命令
      */
+    @Log(title = "门禁系统人员校验开门", businessType = BusinessType.OTHER)
     @GetMapping("/control")
     public ApiResult<Map<String,Object>> control(@RequestParam("productCode") String productCode,
                                                  @RequestParam("deviceUuid") String deviceUuid,

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/RuoYiSystemApplication.java

@@ -14,7 +14,7 @@ import org.springframework.context.annotation.ComponentScan;
  * @author ruoyi
  */
 
-@EnableRabbit
+//@EnableRabbit
 @EnableFeignClients(basePackages = "com.usky")
 @MapperScan(value = "com.usky.fire.mapper")
 @ComponentScan("com.usky")

+ 31 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/config/SyncPatrolInspectionEvent.java

@@ -0,0 +1,31 @@
+package com.usky.fire.service.config;
+
+import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.system.RemoteDictService;
+import com.usky.system.RemoteMceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.Async;
+
+@Configuration
+public class SyncPatrolInspectionEvent {
+
+    @Autowired
+    private RemoteMceService remoteMceService;
+    @Autowired
+    private RemoteDictService remoteDictService;
+
+    @Async("asyncServiceExecutor")
+    public void sendAsyncMessage(Integer eventId,String eventName,Integer eventType){
+        String eventTypeName = remoteDictService.selectNameById("patrol_event_type",
+                eventType.toString());
+        JsonObject jsonObject = new JsonObject();
+        jsonObject.addProperty("infoTitle", eventName);
+        jsonObject.addProperty("infoContent",eventTypeName);
+        jsonObject.addProperty("infoType",2);
+        jsonObject.addProperty("userName", SecurityUtils.getUsername());
+        jsonObject.addProperty("id",eventId);
+        remoteMceService.addMce(jsonObject.toString());
+    }
+}

+ 14 - 6
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -1,5 +1,7 @@
 package com.usky.fire.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,6 +21,7 @@ import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.fire.service.PatrolInspectionPersonnelService;
 import com.usky.fire.service.PatrolInspectionTypeService;
 
+import com.usky.fire.service.config.mqtt.MqttOutConfig;
 import com.usky.fire.service.config.rabbitmq.RabbitMQConfig;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,11 +63,14 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
     @Value("${agBox.push}")
     private Integer pushFlag;
 
-    @Resource
-    private RabbitTemplate rabbitTemplate;
+//    @Resource
+//    private RabbitTemplate rabbitTemplate;
+//
+//    @Autowired
+//    private RabbitMQConfig rabbitMQConfig;
 
-    @Autowired
-    private RabbitMQConfig rabbitMQConfig;
+    @Resource
+    private MqttOutConfig.MqttGateway mqttGateway;
 
     @Override
     public IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, String operateCode, String operator, LocalDateTime startTime, LocalDateTime endTime) {
@@ -98,7 +104,7 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
             userIdList.add(attendance.getOperatorId());
         }
         LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper1 = Wrappers.lambdaQuery();
-        queryWrapper1.in(PatrolInspectionPersonnel::getUserId,userIdList);
+        queryWrapper1.in(!userIdList.isEmpty(),PatrolInspectionPersonnel::getUserId,userIdList);
         List<PatrolInspectionPersonnel> personnelList = patrolInspectionPersonnelService.list(queryWrapper1);
         for (PatrolInspectionAttendance attendance : attendancePage.getRecords()) {
             Map<String, Object> map = new HashMap<>();
@@ -176,7 +182,9 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         jsonObj.put("name", SecurityUtils.getUsername());
         jsonObj.put("certifiedNo", patrolInspectionAttendance.getIdentificationNumber());
 
-        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange, "", jsonObj.toJSONString());
+//        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolEventExchange, SecurityUtils.getTenantId().toString(), jsonObj.toJSONString());
+        mqttGateway.sendToMqtt("/patrolEEvent/"+SecurityUtils.getTenantId()+"/event", jsonObj.toJSONString());
+
 //        if (pushFlag.equals(1)){
 //            JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
 //        }

+ 17 - 19
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java

@@ -18,6 +18,8 @@ import com.usky.fire.service.PatrolInspectionEventService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.fire.service.PatrolInspectionPersonnelService;
 import com.usky.fire.service.PatrolInspectionPlanScheduleService;
+import com.usky.fire.service.config.SyncPatrolInspectionEvent;
+import com.usky.fire.service.config.mqtt.MqttOutConfig;
 import com.usky.fire.service.config.rabbitmq.RabbitMQConfig;
 import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
 import com.usky.system.RemoteDictService;
@@ -32,6 +34,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.util.HashMap;
@@ -52,15 +55,14 @@ public class PatrolInspectionEventServiceImpl extends AbstractCrudService<Patrol
     private PatrolInspectionPlanScheduleService patrolInspectionPlanScheduleService;
     @Autowired
     private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
+//    @Autowired
+//    private RabbitTemplate rabbitTemplate;
+//    @Autowired
+//    private RabbitMQConfig rabbitMQConfig;
+    @Resource
+    private MqttOutConfig.MqttGateway mqttGateway;
     @Autowired
-    private RabbitTemplate rabbitTemplate;
-    @Autowired
-    private RabbitMQConfig rabbitMQConfig;
-    @Autowired
-    private RemoteMceService remoteMceService;
-    @Autowired
-    private RemoteDictService remoteDictService;
-
+    private SyncPatrolInspectionEvent syncPatrolInspectionEvent;
 
     @Override
     public CommonPage<PatrolInspectionEvent> patrolInspectionEventList(PatrolInspectionPlanRequestVO requestVO){
@@ -125,18 +127,14 @@ public class PatrolInspectionEventServiceImpl extends AbstractCrudService<Patrol
         map.put("remark",patrolInspectionEvent.getRemark());
         map.put("createBy",patrolInspectionEvent.getCreateBy());
         map.put("createTime",patrolInspectionEvent.getCreateTime());
-//        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolEventExchange,rabbitMQConfig.patrolEventRoute,map);
-        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange,"", JSONObject.toJSONString(map));
+
+//        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolEventExchange,SecurityUtils.getTenantId().toString(),map);
+        mqttGateway.sendToMqtt("/patrolEEvent/"+SecurityUtils.getTenantId()+"/event",JSONObject.toJSONString(map));
+//      rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange,"", JSONObject.toJSONString(map));
+
         this.save(patrolInspectionEvent);
-        String eventTypeName = remoteDictService.selectNameById("patrol_event_type",
-                patrolInspectionEvent.getEventType().toString());
-        JsonObject jsonObject = new JsonObject();
-        jsonObject.addProperty("infoTitle", patrolInspectionEvent.getEventName());
-        jsonObject.addProperty("infoContent",eventTypeName);
-        jsonObject.addProperty("infoType",2);
-        jsonObject.addProperty("userName",SecurityUtils.getUsername());
-        jsonObject.addProperty("id",patrolInspectionEvent.getId());
-        remoteMceService.addMce(jsonObject.toString());
+
+//        syncPatrolInspectionEvent.sendAsyncMessage(patrolInspectionEvent.getId(),patrolInspectionEvent.getEventName(),patrolInspectionEvent.getEventType());
 
     }
 

+ 19 - 19
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/listener/RabbitMQListener.java

@@ -13,23 +13,23 @@ import java.util.Map;
 @Component
 public class RabbitMQListener {
 
-    @RabbitHandler
-    @RabbitListener(queues = "Patrol_QEvent")  //监听名称为Patrol_QEvent队列消息
-    public void process(Map testMessage){
-        System.out.println("DirectReceiver消费者收到消息: " + testMessage.toString());
-    }
-
-    @RabbitHandler
-    @RabbitListener(bindings = @QueueBinding(
-            value = @Queue(),
-            exchange = @Exchange(value = "Patrol_FEvent",type = ExchangeTypes.FANOUT)
-    ))
-    public void getData(Message message){
-        try {
-            String str = new String(message.getBody(),"utf-8");
-            System.out.println("FanoutReceiver消费者收到消息: " + str);
-        } catch (Exception e){
-            e.printStackTrace();
-        }
-    }
+//    @RabbitHandler
+//    @RabbitListener(queues = "Patrol_QEvent")  //监听名称为Patrol_QEvent队列消息
+//    public void process(Map testMessage){
+//        System.out.println("DirectReceiver消费者收到消息: " + testMessage.toString());
+//    }
+//
+//    @RabbitHandler
+//    @RabbitListener(bindings = @QueueBinding(
+//            value = @Queue(),
+//            exchange = @Exchange(value = "Patrol_FEvent",type = ExchangeTypes.FANOUT)
+//    ))
+//    public void getData(Message message){
+//        try {
+//            String str = new String(message.getBody(),"utf-8");
+//            System.out.println("FanoutReceiver消费者收到消息: " + str);
+//        } catch (Exception e){
+//            e.printStackTrace();
+//        }
+//    }
 }

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/RuoYiSystemApplication.java

@@ -34,7 +34,7 @@ import java.net.UnknownHostException;
 @MapperScan(value = "com.usky.iot.mapper")
 @ComponentScan("com.usky")
 @SpringBootApplication
-@EnableRabbit
+//@EnableRabbit
 public class RuoYiSystemApplication
 {
     private static final Logger LOGGER = LoggerFactory.getLogger(RuoYiSystemApplication.class);

+ 4 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/DingTalkAndMessage.java

@@ -207,7 +207,8 @@ public class DingTalkAndMessage {
         return sysUserMapper.selectOne(phoneQuery);
     }
 
-    @Async("asyncServiceExecutor")// 异步发送
+    @Async// 异步发送
+//    @Async("asyncServiceExecutor")// 异步发送
     public void sendDingTalkDailyReport(PmWorkReport workReport, List<PmWorkContent> workContents) {
         String userName = workReport.getCreateBy();
         log.info(userName + "的工作报告开始发送钉钉-----------------------------------");
@@ -302,7 +303,8 @@ public class DingTalkAndMessage {
     }
 
 
-    @Async("asyncServiceExecutor")
+    @Async
+//    @Async("asyncServiceExecutor")
     public void sendAsyncMessage(PmWorkReport newReport) {
         String username = newReport.getCreateBy();
         Long submitterId = newReport.getSubmitterId();

+ 49 - 49
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/ExecutorConfig.java

@@ -1,49 +1,49 @@
-package com.usky.iot.service.config;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadPoolExecutor;
-
-@Configuration
-@EnableAsync
-@Slf4j
-public class ExecutorConfig {
-
-    /** 核心线程数(默认线程数) */
-    private int corePoolSize = 10;
-    /** 最大线程数 */
-    private int maxPoolSize = 20;
-    /** 允许线程空闲时间(单位:默认为秒) */
-    private static final int keepAliveTime = 60;
-    /** 缓冲队列大小 */
-    private int queueCapacity = 10;
-
-    @Bean(name = "asyncServiceExecutor")
-    public Executor asyncServiceExecutor(){
-        log.info("start asyncServiceExecutor++++++++++++++++++++++");
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        //配置核心线程数
-        executor.setCorePoolSize(corePoolSize);
-        //配置最大线程数
-        executor.setMaxPoolSize(maxPoolSize);
-        //配置空闲时间
-        executor.setKeepAliveSeconds(keepAliveTime);
-        //配置队列大小
-        executor.setQueueCapacity(queueCapacity);
-        //配置线程前缀名
-        executor.setThreadNamePrefix("async-service-");
-
-        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
-        // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
-        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
-
-        //执行初始化
-        executor.initialize();
-        return executor;
-    }
-}
+//package com.usky.iot.service.config;
+//
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.scheduling.annotation.EnableAsync;
+//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+//
+//import java.util.concurrent.Executor;
+//import java.util.concurrent.ThreadPoolExecutor;
+//
+//@Configuration
+//@EnableAsync
+//@Slf4j
+//public class ExecutorConfig {
+//
+//    /** 核心线程数(默认线程数) */
+//    private int corePoolSize = 10;
+//    /** 最大线程数 */
+//    private int maxPoolSize = 20;
+//    /** 允许线程空闲时间(单位:默认为秒) */
+//    private static final int keepAliveTime = 60;
+//    /** 缓冲队列大小 */
+//    private int queueCapacity = 10;
+//
+//    @Bean(name = "asyncServiceExecutor")
+//    public Executor asyncServiceExecutor(){
+//        log.info("start asyncServiceExecutor++++++++++++++++++++++");
+//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+//        //配置核心线程数
+//        executor.setCorePoolSize(corePoolSize);
+//        //配置最大线程数
+//        executor.setMaxPoolSize(maxPoolSize);
+//        //配置空闲时间
+//        executor.setKeepAliveSeconds(keepAliveTime);
+//        //配置队列大小
+//        executor.setQueueCapacity(queueCapacity);
+//        //配置线程前缀名
+//        executor.setThreadNamePrefix("async-service-");
+//
+//        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
+//        // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
+//        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+//
+//        //执行初始化
+//        executor.initialize();
+//        return executor;
+//    }
+//}

+ 2 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/config/rabbitmq/RabbitMQConfig.java

@@ -6,6 +6,8 @@ import org.springframework.context.annotation.Configuration;
 
 @Configuration
 public class RabbitMQConfig {
+    //点对点
+    public String patrolEInfoExchange = "Patrol_EInfo";
 
     //心跳广播
     public String patrolFInfoExchange = "Patrol_FInfo";

+ 9 - 5
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseAppInfoServiceImpl.java

@@ -15,6 +15,7 @@ import com.usky.iot.domain.BaseGgpFacility;
 import com.usky.iot.mapper.BaseAppInfoMapper;
 import com.usky.iot.service.BaseAppInfoService;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.iot.service.config.mqtt.MqttOutConfig;
 import com.usky.iot.service.config.rabbitmq.RabbitMQConfig;
 import com.usky.iot.service.vo.AppInfoRequest;
 import com.usky.iot.service.vo.BaseGgpFacilityRequest;
@@ -57,11 +58,13 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
     @Value("${agBox.push}")
     private Integer pushFlag;
 
+//    @Resource
+//    private RabbitTemplate rabbitTemplate;
+//
+//    @Autowired
+//    private RabbitMQConfig rabbitMQConfig;
     @Resource
-    private RabbitTemplate rabbitTemplate;
-
-    @Autowired
-    private RabbitMQConfig rabbitMQConfig;
+    private MqttOutConfig.MqttGateway mqttGateway;
 
     public String getIpAddress(HttpServletRequest request) {
         String ip = request.getHeader("X-Forwarded-For");
@@ -102,7 +105,8 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
         map.put("deviceId",baseAppInfo.getDeviceId());
         map.put("userName",baseAppInfo.getUserName());
         map.put("createTime",baseAppInfo.getCreateTime());
-        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFInfoExchange,"",JSONObject.toJSONString(map));
+//        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolEInfoExchange,SecurityUtils.getTenantId().toString(),JSONObject.toJSONString(map));
+        mqttGateway.sendToMqtt("/patrolEInfo/"+SecurityUtils.getTenantId()+"/info",JSONObject.toJSONString(map));
 
         this.save(baseAppInfo);
 //        if (pushFlag.equals(1)){

+ 48 - 48
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/CrmDeviceRepairServiceImpl.java

@@ -213,57 +213,57 @@ public class CrmDeviceRepairServiceImpl extends AbstractCrudService<CrmDeviceRep
         crmDeviceRepair1.setHandleTime(LocalDateTime.now());
         this.updateById(crmDeviceRepair1);
 
-        CrmDeviceRepair crmDeviceRepair = this.getById(crmDeviceRepair1.getId());
-
-        //发送短信
-        StringBuffer sendStatus = new StringBuffer();
-        StringBuffer sendContext = new StringBuffer();
-        DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI5tH3VvRL5BUkovCokHJX", "SaaWUouNqvcA0C746gcNOH9m6SRYN4");
-        IAcsClient client = new DefaultAcsClient(profile);
-        SendSmsRequest request = new SendSmsRequest();
-        request.setPhoneNumbers(crmDeviceRepair.getReflectPhone());//接收短信的手机号码
-        request.setSignName("上海永天科技股份有限公司");//短信签名名称
-        request.setTemplateCode("SMS_463206001");//短信模板CODE
-
-        String custom = "#/pages/common/evaluate/index?statusBool=true&repairCode="+crmDeviceRepair.getRepairCode();
-        request.setTemplateParam("{\"name\":\""+crmDeviceRepair.getReflectName()+"\","+"\"date\":\""+crmDeviceRepair.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))+"\","+"\"custom\":\""+custom+"\"}");//短信模板变量对应的实际值
-
-        try {
-            SendSmsResponse response = client.getAcsResponse(request);
-            if(response.getCode() != null){
-                if(response.getCode().equals("OK")){
-//                    sendStatus.append("1");
-//                    //查询发送短信内容
+//        CrmDeviceRepair crmDeviceRepair = this.getById(crmDeviceRepair1.getId());
+
+//        //发送短信
+//        StringBuffer sendStatus = new StringBuffer();
+//        StringBuffer sendContext = new StringBuffer();
+//        DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI5tH3VvRL5BUkovCokHJX", "SaaWUouNqvcA0C746gcNOH9m6SRYN4");
+//        IAcsClient client = new DefaultAcsClient(profile);
+//        SendSmsRequest request = new SendSmsRequest();
+//        request.setPhoneNumbers(crmDeviceRepair.getReflectPhone());//接收短信的手机号码
+//        request.setSignName("上海永天科技股份有限公司");//短信签名名称
+//        request.setTemplateCode("SMS_463206001");//短信模板CODE
 //
-//                    try {
-//                        Thread.sleep(3000);
-//                    } catch (InterruptedException e) {
-//                        e.printStackTrace();
-//                    }
+//        String custom = "#/pages/common/evaluate/index?statusBool=true&repairCode="+crmDeviceRepair.getRepairCode();
+//        request.setTemplateParam("{\"name\":\""+crmDeviceRepair.getReflectName()+"\","+"\"date\":\""+crmDeviceRepair.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))+"\","+"\"custom\":\""+custom+"\"}");//短信模板变量对应的实际值
 //
-//                    QuerySendDetailsRequest request1 = new QuerySendDetailsRequest();
-//                    request1.setPhoneNumber(crmDeviceRepair.getReflectPhone());
-//                    request1.setSendDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
-//                    request1.setPageSize((long)10);
-//                    request1.setCurrentPage((long)1);
-//                    QuerySendDetailsResponse response1 = client.getAcsResponse(request1);
-//                    if(response1.getCode() != null){
-//                        if(response1.getCode().equals("OK")){
-//                            sendContext.append(response1.getSmsSendDetailDTOs().get(0).getContent());
-//                        }
+//        try {
+//            SendSmsResponse response = client.getAcsResponse(request);
+//            if(response.getCode() != null){
+//                if(response.getCode().equals("OK")){
+////                    sendStatus.append("1");
+////                    //查询发送短信内容
+////
+////                    try {
+////                        Thread.sleep(3000);
+////                    } catch (InterruptedException e) {
+////                        e.printStackTrace();
+////                    }
+////
+////                    QuerySendDetailsRequest request1 = new QuerySendDetailsRequest();
+////                    request1.setPhoneNumber(crmDeviceRepair.getReflectPhone());
+////                    request1.setSendDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
+////                    request1.setPageSize((long)10);
+////                    request1.setCurrentPage((long)1);
+////                    QuerySendDetailsResponse response1 = client.getAcsResponse(request1);
+////                    if(response1.getCode() != null){
+////                        if(response1.getCode().equals("OK")){
+////                            sendContext.append(response1.getSmsSendDetailDTOs().get(0).getContent());
+////                        }
+////
+////                    }
 //
-//                    }
-
-                }else{
-//                    sendStatus.append("2");
-                }
-            }
-            System.out.println(new Gson().toJson(response));
-        } catch (ClientException e) {
-            System.out.println("ErrCode:" + e.getErrCode());
-            System.out.println("ErrMsg:" + e.getErrMsg());
-            System.out.println("RequestId:" + e.getRequestId());
-        }
+//                }else{
+////                    sendStatus.append("2");
+//                }
+//            }
+//            System.out.println(new Gson().toJson(response));
+//        } catch (ClientException e) {
+//            System.out.println("ErrCode:" + e.getErrCode());
+//            System.out.println("ErrMsg:" + e.getErrMsg());
+//            System.out.println("RequestId:" + e.getRequestId());
+//        }
 
     }
 

+ 30 - 8
service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/controller/web/MeetingFaceController.java

@@ -17,7 +17,9 @@ import com.usky.common.core.exception.BusinessException;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.meeting.annotation.FaceLog;
 import com.usky.meeting.domain.MeetingFace;
+import com.usky.meeting.domain.SysDept;
 import com.usky.meeting.mapper.MeetingFaceMapper;
+import com.usky.meeting.mapper.SysDeptMapper;
 import com.usky.meeting.repository.MeetingInfoRepository;
 import com.usky.meeting.service.MeetingFaceService;
 import com.usky.meeting.service.vo.DmpDeviceInfoVO;
@@ -59,6 +61,8 @@ public class MeetingFaceController {
     MeetingInfoRepository meetingInfoRepository;
     @Autowired
     private MeetingFaceMapper meetingFaceMapper;
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
 
     @PostMapping("/vef")
     @ApiOperation(value="人脸验证", notes="根据传入的base64编码和数据的base64编码进行对比")
@@ -75,21 +79,39 @@ public class MeetingFaceController {
             @RequestParam(required = false) String faceName,
             @RequestParam(required = false) String faceStatus,
             @RequestParam(required = false) Integer fid,
-            @RequestParam(required = false) Long userId
-            ){
+            @RequestParam(required = false) Long userId,
+            @RequestParam(required = false) Integer deptId
+    ){
         IPage<MeetingFace> page = faceService.page(new Page(current, size), new QueryWrapper<MeetingFace>()
                 .like(StrUtil.isNotBlank(faceName),"face_name",faceName)
                 .like(StrUtil.isNotBlank(faceStatus),"face_status",faceStatus)
                 .eq(fid != null,"fid",fid)
                 .eq(userId != null,"user_id",userId)
+                .eq(deptId != null,"dept_id",deptId)
                 .eq("tenant_id", SecurityUtils.getTenantId()));
         if(page.getRecords().size() > 0){
-            for (int i = 0; i < page.getRecords().size(); i++) {
-                if(Objects.nonNull(page.getRecords().get(i).getBindDevice()) || StringUtils.isNotBlank(page.getRecords().get(i).getBindDevice())){
-                    String[] deviceIdStr = page.getRecords().get(i).getBindDevice().split(",");
-                    Integer[] deviceIds = Arrays.stream(deviceIdStr).map(Integer::parseInt).toArray(Integer[]::new);
-                    List<DmpDeviceInfoVO> list = meetingFaceMapper.getDeviceInfo(Arrays.asList(deviceIds));
-                    page.getRecords().get(i).setDeviceInfos(list);
+//            for (int i = 0; i < page.getRecords().size(); i++) {
+//                if(Objects.nonNull(page.getRecords().get(i).getBindDevice()) || StringUtils.isNotBlank(page.getRecords().get(i).getBindDevice())){
+//                    String[] deviceIdStr = page.getRecords().get(i).getBindDevice().split(",");
+//                    Integer[] deviceIds = Arrays.stream(deviceIdStr).map(Integer::parseInt).toArray(Integer[]::new);
+//                    List<DmpDeviceInfoVO> list = meetingFaceMapper.getDeviceInfo(Arrays.asList(deviceIds));
+//                    page.getRecords().get(i).setDeviceInfos(list);
+//
+//                }
+//            }
+
+            QueryWrapper<SysDept> queryWrapper = Wrappers.query();
+            queryWrapper.eq("del_flag",0).eq("tenant_id",SecurityUtils.getTenantId());
+            List<SysDept> sysDeptList = sysDeptMapper.selectList(queryWrapper);
+            if(sysDeptList.size() > 0){
+                for (int i = 0; i < page.getRecords().size(); i++) {
+                    Integer deptId1 = page.getRecords().get(i).getDeptId();
+                    for (int j = 0; j < sysDeptList.size(); j++) {
+                        if(deptId1.equals(Integer.valueOf(sysDeptList.get(j).getDeptId().toString()))){
+                            page.getRecords().get(i).setSysDept(sysDeptList.get(j));
+                            break;
+                        }
+                    }
 
                 }
             }

+ 5 - 0
service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/domain/MeetingFace.java

@@ -93,4 +93,9 @@ public class MeetingFace implements Serializable {
     @TableField(exist = false)
     private List<DmpDeviceInfoVO> deviceInfos;
 
+    /**
+     * 部门信息
+     */
+    @TableField(exist = false)
+    private SysDept sysDept;
 }

+ 2 - 0
service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/mapper/SysDeptMapper.java

@@ -2,6 +2,7 @@ package com.usky.meeting.mapper;
 
 import com.usky.meeting.domain.SysDept;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author zyj
  * @since 2024-03-18
  */
+@Repository
 public interface SysDeptMapper extends CrudMapper<SysDept> {
 
 }

+ 1 - 0
service-meeting/service-meeting-biz/src/main/java/com/usky/meeting/server/FaceContrastServer.java

@@ -49,6 +49,7 @@ public class FaceContrastServer {
         } catch (TencentCloudSDKException e) {
             faceResult.setCode(FaceResultVO.FACE_ERROR);
             faceResult.setMsg(e.getMessage());
+            System.out.println("e.getMessage() "+e.getMessage());
         }
         return faceResult;
     }