Kaynağa Gözat

代码merge

linfutong 2 yıl önce
ebeveyn
işleme
a6aac364cf
31 değiştirilmiş dosya ile 858 ekleme ve 71 silme
  1. 59 0
      zd-common/common-core/src/main/java/com/zd/common/core/alert/DingTalkAlert.java
  2. 11 0
      zd-model/src/main/java/com/zd/model/alert/DingTalkAlert.java
  3. 1 1
      zd-model/src/main/java/com/zd/model/domain/R.java
  4. 4 9
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/monitor/HardwareDeviceMonitor.java
  5. 5 0
      zd-modules/zd-base/pom.xml
  6. 4 0
      zd-modules/zd-modules-laboratory/pom.xml
  7. 31 12
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/device/DeviceRemoteController.java
  8. 11 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabSubjectAccessRecordVo.java
  9. 10 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/ViolationNewVo.java
  10. 2 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabHardwareMapper.java
  11. 7 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSubjectAccessRecordMapper.java
  12. 14 7
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java
  13. 31 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/ChannelMap.java
  14. 29 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/MessageCodec.java
  15. 48 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyClient.java
  16. 76 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyClientHandler.java
  17. 73 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyServer.java
  18. 216 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyServerHandler.java
  19. 18 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/PushMsgService.java
  20. 10 4
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/controller/OneMachineController.java
  21. 119 9
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectAccessRecordServiceImpl.java
  22. 6 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabViolationServiceImpl.java
  23. 3 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/runner/SocketRunner.java
  24. 7 9
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/runner/TCPServer.java
  25. 12 6
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabBuildFloorMapper.xml
  26. 1 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckRecordDetailsMapper.xml
  27. 20 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml
  28. 3 4
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalLogMapper.xml
  29. 18 2
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectAccessRecordMapper.xml
  30. 8 5
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabViolationMapper.xml
  31. 1 1
      zd-modules/zd-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 59 - 0
zd-common/common-core/src/main/java/com/zd/common/core/alert/DingTalkAlert.java

@@ -0,0 +1,59 @@
+package com.zd.common.core.alert;
+
+import com.zd.common.core.utils.HttpUtils;
+import com.zd.common.core.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>钉钉告警</p>
+ *
+ * @author linft
+ * @version 1.0
+ * @date 3/2/2023
+ */
+@Component
+public class DingTalkAlert {
+
+    /**
+     * 告警类应用
+     */
+    private static String SUBJECT = "设备监控";
+
+    private static Boolean dingTalkNotice;
+    private static String dingTalkSubject;
+    private static String dingTalkUrl;
+
+    @Value("${monitor.alert.dingTalkNotice}")
+    public void setDingTalkNotice(Boolean dingTalkNotice) {
+        this.dingTalkNotice = dingTalkNotice;
+    }
+
+    @Value("${monitor.alert.dingTalkSubject}")
+    public void setDingTalkSubject(String dingTalkSubject) {
+        this.dingTalkSubject = dingTalkSubject;
+    }
+
+    @Value("${monitor.alert.dingTalkUrl}")
+    public void setDingTalkUrl(String dingTalkUrl) {
+        this.dingTalkUrl = dingTalkUrl;
+    }
+
+    /**
+     * 发送告警
+     * @param content 告警内容描述
+     * @return
+     */
+    public static String sendAlert(String content) {
+        if (dingTalkNotice != null && dingTalkNotice && StringUtils.isNotEmpty(dingTalkUrl)) {
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("【" + dingTalkSubject +"--"+ SUBJECT + "】\n");
+            buffer.append(content);
+            //封装请求内容
+            String msg = "{\"msgtype\": \"text\",\"text\": {\"content\":\"" + buffer.toString() + "\"}}";
+            return HttpUtils.sendPost(dingTalkUrl, msg, "application/json", null);
+        }
+        return "告警未启动或参数未配置!";
+    }
+
+}

+ 11 - 0
zd-model/src/main/java/com/zd/model/alert/DingTalkAlert.java

@@ -0,0 +1,11 @@
+package com.zd.model.alert;
+
+/**
+ * <p>类注释说明</p>
+ *
+ * @author linft
+ * @version 1.0
+ * @date 3/2/2023
+ */
+public class DingTalkAlert {
+}

+ 1 - 1
zd-model/src/main/java/com/zd/model/domain/R.java

@@ -36,7 +36,7 @@ public class R<T> implements Serializable {
     }
     }
 
 
     public static <T> R<T> ok(T data) {
     public static <T> R<T> ok(T data) {
-        return restResult(data, SUCCESS, null);
+        return restResult(data, SUCCESS, "操作成功");
     }
     }
 
 
     public static <T> R<T> ok(T data, Integer count) {
     public static <T> R<T> ok(T data, Integer count) {

+ 4 - 9
zd-modules/zd-algorithm/src/main/java/com/zd/alg/monitor/HardwareDeviceMonitor.java

@@ -2,6 +2,7 @@ package com.zd.alg.monitor;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.zd.common.core.alert.DingTalkAlert;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.HttpUtils;
 import com.zd.common.core.utils.HttpUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.StringUtils;
@@ -39,12 +40,6 @@ public class HardwareDeviceMonitor {
     @Value("${monitor.alert.dingTalkNotice}")
     @Value("${monitor.alert.dingTalkNotice}")
     private Boolean dingTalkNotice;
     private Boolean dingTalkNotice;
 
 
-    @Value("${monitor.alert.dingTalkSubject}")
-    private String dingTalkSubject;
-
-    @Value("${monitor.alert.dingTalkUrl}")
-    private String dingTalkUrl;
-
     private String redisPrefix = "HARDWARE_DEVICE_MONITOR:";
     private String redisPrefix = "HARDWARE_DEVICE_MONITOR:";
 
 
     private long expire = 30L;
     private long expire = 30L;
@@ -57,7 +52,7 @@ public class HardwareDeviceMonitor {
 
 
     @Scheduled(cron = "0 */9 * * * ?")
     @Scheduled(cron = "0 */9 * * * ?")
     public void checkPowerUse() {
     public void checkPowerUse() {
-        if (dingTalkNotice != null && dingTalkNotice && StringUtils.isNotEmpty(dingTalkUrl)) {
+        if (dingTalkNotice != null && dingTalkNotice) {
             log.info("【设备监听提醒】 开始执行检查..............");
             log.info("【设备监听提醒】 开始执行检查..............");
             ResultData result = remoteLabHardwareService.statistics();
             ResultData result = remoteLabHardwareService.statistics();
             if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
             if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
@@ -86,7 +81,7 @@ public class HardwareDeviceMonitor {
                             if (!map.isEmpty()) {
                             if (!map.isEmpty()) {
                                 Set<String> code = map.keySet();
                                 Set<String> code = map.keySet();
                                 StringBuffer buffer = new StringBuffer();
                                 StringBuffer buffer = new StringBuffer();
-                                buffer.append("【"+dingTalkSubject+"-设备掉线提醒】离线继电器信息:\n");
+                                buffer.append("系统接入继电器设备离线信息:\n");
                                 boolean isSend = Boolean.FALSE;
                                 boolean isSend = Boolean.FALSE;
                                 for (String key : code) {
                                 for (String key : code) {
                                     Integer num = redisService.getCacheObject(redisPrefix+key);
                                     Integer num = redisService.getCacheObject(redisPrefix+key);
@@ -102,7 +97,7 @@ public class HardwareDeviceMonitor {
                                 //通知
                                 //通知
                                 if (isSend) {
                                 if (isSend) {
                                     String msg = "{\"msgtype\": \"text\",\"text\": {\"content\":\"" + buffer.toString() + "\"}}";
                                     String msg = "{\"msgtype\": \"text\",\"text\": {\"content\":\"" + buffer.toString() + "\"}}";
-                                    String rs = HttpUtils.sendPost(dingTalkUrl, msg, "application/json", null);
+                                    DingTalkAlert.sendAlert(msg);
                                     //log.info("【设备监听提醒】 钉钉通知响应:" + rs);
                                     //log.info("【设备监听提醒】 钉钉通知响应:" + rs);
                                 }
                                 }
                             }
                             }

+ 5 - 0
zd-modules/zd-base/pom.xml

@@ -24,6 +24,11 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
         <!-- SpringCloud Alibaba Sentinel -->
         <!-- SpringCloud Alibaba Sentinel -->
         <!--<dependency>
         <!--<dependency>
             <groupId>com.alibaba.cloud</groupId>
             <groupId>com.alibaba.cloud</groupId>

+ 4 - 0
zd-modules/zd-modules-laboratory/pom.xml

@@ -98,6 +98,10 @@
             <groupId>com.baomidou</groupId>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 31 - 12
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/device/DeviceRemoteController.java

@@ -5,6 +5,7 @@ import com.zd.common.core.utils.ReUtil;
 import com.zd.laboratory.api.entity.CabinetLock;
 import com.zd.laboratory.api.entity.CabinetLock;
 import com.zd.laboratory.api.entity.CabinetV2Lock;
 import com.zd.laboratory.api.entity.CabinetV2Lock;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
+import com.zd.laboratory.netty.PushMsgService;
 import com.zd.laboratory.socket.runner.TCPServer;
 import com.zd.laboratory.socket.runner.TCPServer;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.laboratory.utils.CRCCHECK;
 import com.zd.laboratory.utils.CRCCHECK;
@@ -35,6 +36,8 @@ public class DeviceRemoteController {
     private RedisService redisService;
     private RedisService redisService;
     @Autowired
     @Autowired
     private CommonSend commonSend;
     private CommonSend commonSend;
+    @Autowired
+    private PushMsgService pushMsgService;
 
 
     @Value("${sys.lockTimer:30}")
     @Value("${sys.lockTimer:30}")
     private Integer lockTimer;
     private Integer lockTimer;
@@ -57,33 +60,47 @@ public class DeviceRemoteController {
         OutputStream ops = TCPServer.cacheMap.get(relayCode);
         OutputStream ops = TCPServer.cacheMap.get(relayCode);
 
 
         try {
         try {
-            ops.write(ReUtil.hexStringToByteArray(instruct));
-            ops.flush();
-            logger.info("柜锁开锁指令:" + instruct);
+//            ops.write(ReUtil.hexStringToByteArray(instruct));
+//            ops.flush();
+            for (int i = 0; i < 5; i++) {
+                pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
+                logger.info("柜锁开锁指令:" + instruct);
+
+                Thread.sleep(1000);
+            }
+
+//            ops.write(ReUtil.hexStringToByteArray(instruct));
+//            ops.flush();
+//
+//            Thread.sleep(1500);
+//            ops.write(ReUtil.hexStringToByteArray(instruct));
+//            ops.flush();
 
 
-            Thread.sleep(1000);
             instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
             instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
             int timer = lockTimer;
             int timer = lockTimer;
             Integer status;
             Integer status;
             while (timer > 1){
             while (timer > 1){
 
 
-                ops.write(ReUtil.hexStringToByteArray(instruct));
-                ops.flush();
-                timer-=2;
+//                ops.write(ReUtil.hexStringToByteArray(instruct));
+//                ops.flush();
+                pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
+                timer-=3;
 
 
-                Thread.sleep(1900);
+                Thread.sleep(3000);
                 status = redisService.getCacheObject(relayCode + ":" + cabinetV2Lock.getLockId());
                 status = redisService.getCacheObject(relayCode + ":" + cabinetV2Lock.getLockId());
                 logger.info("柜锁开锁锁状态查询:" + instruct + ",开锁结果:" + status);
                 logger.info("柜锁开锁锁状态查询:" + instruct + ",开锁结果:" + status);
                 if(status != null && status == 1){
                 if(status != null && status == 1){
                     return ResultData.success("开锁成功");
                     return ResultData.success("开锁成功");
                 }
                 }
             }
             }
+
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             logger.error("柜锁连接失败:" + e.getMessage());
             logger.error("柜锁连接失败:" + e.getMessage());
             return ResultData.fail("柜锁连接失败!");
             return ResultData.fail("柜锁连接失败!");
         }
         }
         return ResultData.fail("开锁失败");
         return ResultData.fail("开锁失败");
+
     }
     }
 
 
     /**
     /**
@@ -104,10 +121,11 @@ public class DeviceRemoteController {
             String instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
             String instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
             int timer = lockTimer;
             int timer = lockTimer;
             Integer status;
             Integer status;
-            while (timer > 1){
+//            while (timer > 1){
 
 
-                ops.write(ReUtil.hexStringToByteArray(instruct));
-                ops.flush();
+//                ops.write(ReUtil.hexStringToByteArray(instruct));
+//                ops.flush();
+                pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
                 timer-=2;
                 timer-=2;
 
 
                 Thread.sleep(1900);
                 Thread.sleep(1900);
@@ -116,7 +134,8 @@ public class DeviceRemoteController {
                 if(status != null && status == 0){
                 if(status != null && status == 0){
                     return ResultData.success("关锁成功");
                     return ResultData.success("关锁成功");
                 }
                 }
-            }
+//            }
+
 //            return ResultData.success("关锁成功");
 //            return ResultData.success("关锁成功");
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();

+ 11 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabSubjectAccessRecordVo.java

@@ -82,6 +82,9 @@ public class LabSubjectAccessRecordVo extends LabSubjectAccessRecord {
     @ApiModelProperty(value = "进出记录的ids")
     @ApiModelProperty(value = "进出记录的ids")
     private Long[] accessIds;
     private Long[] accessIds;
 
 
+    @ApiModelProperty(value = "违规名称")
+    private String violationName;
+
     private List<LabPhotoInspection> photoList = new ArrayList<>();
     private List<LabPhotoInspection> photoList = new ArrayList<>();
 
 
     public String getNickName() {
     public String getNickName() {
@@ -149,6 +152,14 @@ public class LabSubjectAccessRecordVo extends LabSubjectAccessRecord {
         this.accessIds = accessIds;
         this.accessIds = accessIds;
     }
     }
 
 
+    public String getViolationName() {
+        return violationName;
+    }
+
+    public void setViolationName(String violationName) {
+        this.violationName = violationName;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 10 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/ViolationNewVo.java

@@ -110,6 +110,8 @@ public class ViolationNewVo {
 
 
     private Long deductionVal;
     private Long deductionVal;
 
 
+    private String treatmentMessage;
+
     public Long getCreact_id() {
     public Long getCreact_id() {
         return creact_id;
         return creact_id;
     }
     }
@@ -302,4 +304,12 @@ public class ViolationNewVo {
     public void setViolationReasons(String violationReasons) {
     public void setViolationReasons(String violationReasons) {
         this.violationReasons = violationReasons;
         this.violationReasons = violationReasons;
     }
     }
+
+    public String getTreatmentMessage() {
+        return treatmentMessage;
+    }
+
+    public void setTreatmentMessage(String treatmentMessage) {
+        this.treatmentMessage = treatmentMessage;
+    }
 }
 }

+ 2 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabHardwareMapper.java

@@ -58,6 +58,8 @@ public interface LabHardwareMapper {
      */
      */
     List<LabHardware> selectLabHardwareStatusByRelay(LabHardware labHardware);
     List<LabHardware> selectLabHardwareStatusByRelay(LabHardware labHardware);
 
 
+    List<LabHardwareVO> selectHardwareAndSubInfoByRelay(LabHardware labHardware);
+
     /**
     /**
      * 查询硬件列表
      * 查询硬件列表
      *
      *

+ 7 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabSubjectAccessRecordMapper.java

@@ -137,6 +137,13 @@ public interface LabSubjectAccessRecordMapper {
     public int outTimeRecord();
     public int outTimeRecord();
 
 
     /**
     /**
+     * 查询违规记录列表
+     *
+     * @return 结果
+     */
+    public List<LabSubjectAccessRecordVo> selOutTimeRecord();
+
+    /**
      * 个人工作台 实验室进出统计
      * 个人工作台 实验室进出统计
      */
      */
     Map<String, Object> queryRecordStatistics(LabSubjectAccessRecordVo labSubjectAccessRecord);
     Map<String, Object> queryRecordStatistics(LabSubjectAccessRecordVo labSubjectAccessRecord);

+ 14 - 7
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java

@@ -11,8 +11,8 @@ import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.event.SensorNewStatusEvent;
 import com.zd.laboratory.event.SensorNewStatusEvent;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
+import com.zd.laboratory.utils.CRCCHECK;
 import com.zd.laboratory.utils.FireLaborUtil;
 import com.zd.laboratory.utils.FireLaborUtil;
-import com.zd.laboratory.utils.HexUtils;
 import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.MqttConstants;
 import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
@@ -282,8 +282,7 @@ public class MqttConfig {
             public void handleMessage(Message<?> message) throws MessagingException {
             public void handleMessage(Message<?> message) throws MessagingException {
                 MessageHeaders messageHeaders = message.getHeaders();
                 MessageHeaders messageHeaders = message.getHeaders();
                 String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
                 String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
-                //logger.info("[通道] - [{}]", receivedTopic);
-                //logger.info("[消息] - [{}]", message.getPayload());
+				//logger.info("[通道] - [{}],[{}]", receivedTopic,message.getPayload());
                 String messageStr = message.getPayload().toString();
                 String messageStr = message.getPayload().toString();
                 if (receivedTopic.startsWith(devicePrefix)) {
                 if (receivedTopic.startsWith(devicePrefix)) {
                     if (receivedTopic.contains("788D4C6C6187ABC")) {
                     if (receivedTopic.contains("788D4C6C6187ABC")) {
@@ -319,10 +318,18 @@ public class MqttConfig {
                     TerminalRouter.routerMap.get("HxpTerminalService").offLine(codeNum);
                     TerminalRouter.routerMap.get("HxpTerminalService").offLine(codeNum);
                 } else if (receivedTopic.startsWith(steerPublishPrefix)) {
                 } else if (receivedTopic.startsWith(steerPublishPrefix)) {
 //                    messageStr = byte2Hex(message.getPayload().toString().getBytes(StandardCharsets.UTF_8));
 //                    messageStr = byte2Hex(message.getPayload().toString().getBytes(StandardCharsets.UTF_8));
-                    char[] str = message.getPayload().toString().toCharArray();
-                    logger.info("柜锁mqtt消费:" + messageStr);
-                    String replaceMess = messageStr.replace(" ", "");
+//                    char[] str = message.getPayload().toString().toCharArray();
+
+
+                    // 柜锁bit 位
+                    long bit = CRCCHECK.getBitByCommand(messageStr);
+                    // 1开锁状态 0关锁状态
+                    int status = CRCCHECK.getLockStatus(messageStr);
+                    logger.info("柜锁MQTT状态回调:" + receivedTopic.replaceAll(steerPublishPrefix +"/", "") + ":" + bit + ",回调结果" + (status == 1 ? "开启": "关闭") + ",指令:" + messageStr);
+                    redisService.setCacheObject(receivedTopic.replaceAll(steerPublishPrefix +"/", "") + ":" + bit, status, 3 * 60L, TimeUnit.SECONDS);
+
                     //坨机写指令返回数据
                     //坨机写指令返回数据
+                    /*String replaceMess = messageStr.replace(" ", "");
                     if (replaceMess.length() == 12) {
                     if (replaceMess.length() == 12) {
                         String command = replaceMess.substring(8, 10);
                         String command = replaceMess.substring(8, 10);
                         //表示坨机成功
                         //表示坨机成功
@@ -347,7 +354,7 @@ public class MqttConfig {
                             String relayCode = prefix[prefix.length - 1];
                             String relayCode = prefix[prefix.length - 1];
                             TerminalRouter.routerMap.get("HxpLockService").offLine(relayCode);
                             TerminalRouter.routerMap.get("HxpLockService").offLine(relayCode);
                         }
                         }
-                    }
+                    }*/
                 } else if (receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)) {
                 } else if (receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)) {
                     logger.info("消息处理器1开始处理=====");
                     logger.info("消息处理器1开始处理=====");
                     logger.info("topic:" + receivedTopic);
                     logger.info("topic:" + receivedTopic);

+ 31 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/ChannelMap.java

@@ -0,0 +1,31 @@
+package com.zd.laboratory.netty;
+
+import io.netty.channel.ChannelHandlerContext;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ChannelMap {
+
+    /**
+     * 存放客户端标识ID(消息ID)与channel的对应关系
+     */
+    private static volatile ConcurrentHashMap<String, ChannelHandlerContext> channelMap = null;
+
+    private ChannelMap() {
+    }
+
+    public static ConcurrentHashMap<String, ChannelHandlerContext> getChannelMap() {
+        if (null == channelMap) {
+            synchronized (ChannelMap.class) {
+                if (null == channelMap) {
+                    channelMap = new ConcurrentHashMap<>();
+                }
+            }
+        }
+        return channelMap;
+    }
+
+    public static ChannelHandlerContext getChannel(String id) {
+        return getChannelMap().get(id);
+    }
+}

+ 29 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/MessageCodec.java

@@ -0,0 +1,29 @@
+package com.zd.laboratory.netty;
+
+import com.zd.common.core.utils.ReUtil;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToMessageCodec;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+
+@Slf4j
+public class MessageCodec extends MessageToMessageCodec<ByteBuf, String> {
+
+    @Override
+    protected void encode(ChannelHandlerContext channelHandlerContext, String msg, List<Object> list) throws Exception {
+        log.info("netty消息正在编码 " + msg);
+        list.add(Unpooled.copiedBuffer(ReUtil.hexStringToByteArray(msg)));
+//        list.add(ReUtil.hexStringToByteArray(msg));
+    }
+
+    @Override
+    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
+        log.info("netty消息正在解码" + byteBuf.readableBytes());
+        byte[] bytes = new byte[byteBuf.readableBytes()];
+        byteBuf.readBytes(bytes);
+        list.add(bytes);
+    }
+}

+ 48 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyClient.java

@@ -0,0 +1,48 @@
+package com.zd.laboratory.netty;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioSocketChannel;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class NettyClient {
+
+    /**
+     * Netty客户端
+     */
+    public static void main(String[] args) throws InterruptedException {
+        //1. 创建线程组
+        EventLoopGroup group = new NioEventLoopGroup();
+        //2. 创建客户端启动助手
+        Bootstrap bootstrap = new Bootstrap();
+        //3. 设置线程组
+        bootstrap.group(group)
+                .channel(NioSocketChannel.class)//4. 设置客户端通道实现为NIO
+                .handler(new ChannelInitializer<SocketChannel>() {//5. 创建一个通道初始化对象
+                    @Override
+                    protected void initChannel(SocketChannel socketChannel) throws Exception {
+
+                        //6、向pipeline中添加自定的的解码编码handler
+//                        socketChannel.pipeline().addLast(new MessageDecoder());
+//                        socketChannel.pipeline().addLast(new MessageEncoder());
+                        //6、向pipeline中添加编解码器
+                        socketChannel.pipeline().addLast(new com.zd.laboratory.netty.MessageCodec());
+
+                        //6. 向pipeline中添加自定义业务处理handler
+                        socketChannel.pipeline().addLast(new NettyClientHandler());
+                    }
+                });
+
+        //7. 启动客户端,等待连接服务端,同时将异步改为同步
+        ChannelFuture channelFuture = bootstrap.connect("127.0.0.1", NettyServer.inetPort);
+        log.info("netty客户端已启动。。。 端口号: " + NettyServer.inetPort);
+        //8. 关闭通道和关闭连接池
+        channelFuture.channel().closeFuture().sync();
+        group.shutdownGracefully();
+    }
+}

+ 76 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyClientHandler.java

@@ -0,0 +1,76 @@
+package com.zd.laboratory.netty;
+
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class NettyClientHandler implements ChannelInboundHandler {
+    @Override
+    public void channelRegistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void channelUnregistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    /**
+      * @description: 客户端发送消息
+    */
+    @Override
+    public void channelActive(ChannelHandlerContext channelHandlerContext) throws Exception {
+        ChannelFuture channelFuture = channelHandlerContext.writeAndFlush("你好,我是客户端");
+        channelFuture.addListener(new ChannelFutureListener() {
+            @Override
+            public void operationComplete(ChannelFuture channelFuture) throws Exception {
+                if(channelFuture.isSuccess()){
+                    log.info("客户端数据发送成功");
+                }else{
+                    log.info("客户端数据发送失败");
+                }
+            }
+        });
+    }
+    @Override
+    public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    /**
+      * @description: 读取消息
+    */
+    @Override
+    public void channelRead(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+        String msg = (String) o;
+        log.info("客户端接受消息:"+msg);
+    }
+    @Override
+    public void channelReadComplete(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+    @Override
+    public void userEventTriggered(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+
+    }
+    @Override
+    public void channelWritabilityChanged(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+    @Override
+    public void handlerAdded(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+    @Override
+    public void handlerRemoved(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) throws Exception {
+
+    }
+}

+ 73 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyServer.java

@@ -0,0 +1,73 @@
+package com.zd.laboratory.netty;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.*;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+@Slf4j
+@Order(-999)
+public class NettyServer {
+    public static int inetPort = 12323;
+
+    /**
+     * Netty 服务端
+     */
+    @PostConstruct
+    public void start() throws InterruptedException {
+
+        //1. 创建bossGroup线程组: 处理网络事件--连接事件,不设置线程数默认为2*处理器线程数
+        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
+
+        //2. 创建workerGroup线程组: 处理网络事件--读写事件,不设置线程数默认为2*处理器线程数
+        EventLoopGroup workerGroup = new NioEventLoopGroup();
+
+        //3. 创建服务端启动助手
+        ServerBootstrap bootstrap = new ServerBootstrap();
+
+        //4. 设置bossGroup线程组和workerGroup线程组
+        bootstrap.group(bossGroup,workerGroup)
+                .channel(NioServerSocketChannel.class)//5. 设置服务端通道实现为NIO
+                .option(ChannelOption.SO_BACKLOG,128)//6、参数设置-设置线程队列中等待链接个数
+                .childOption(ChannelOption.SO_KEEPALIVE,Boolean.TRUE)//6、参数设置-设置活跃状态,其中child设置的是workerGroup
+                .childHandler(new ChannelInitializer<SocketChannel>() {//7. 创建一个通道初始化对象
+                    @Override
+                    protected void initChannel(SocketChannel socketChannel) throws Exception {
+
+                        //8、向piple中添加编解码器
+                        socketChannel.pipeline().addLast(new MessageCodec());
+                        //8. 向pipeline中添加自定义业务处理handler
+                        socketChannel.pipeline().addLast(new NettyServerHandler());
+                    }
+                });
+
+        //9. 启动服务端并绑定端口
+        ChannelFuture channelFuture = bootstrap.bind(inetPort).sync();
+        channelFuture.addListener(new ChannelFutureListener() {
+            @Override
+            public void operationComplete(ChannelFuture channelFuture) throws Exception {
+                if(channelFuture.isSuccess()){
+                    log.info("netty绑定端口成功");
+                }else{
+                    log.info("netty绑定端口失败");
+                }
+            }
+        });
+        log.info("服务器启动成功");
+        //10. 关闭通道(并不是真正意义上的关闭通道,而是监听通道的关闭状态)和关闭链接
+        /*try {
+            channelFuture.channel().closeFuture().sync();
+            bossGroup.shutdownGracefully();
+            workerGroup.shutdownGracefully();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }*/
+    }
+}

+ 216 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/NettyServerHandler.java

@@ -0,0 +1,216 @@
+package com.zd.laboratory.netty;
+
+import com.zd.common.core.alert.DingTalkAlert;
+import com.zd.common.core.redis.RedisService;
+import com.zd.common.core.utils.DateUtils;
+import com.zd.common.core.utils.ReUtil;
+import com.zd.common.core.utils.SpringUtils;
+import com.zd.laboratory.domain.LabAbnormal;
+import com.zd.laboratory.domain.LabHardware;
+import com.zd.laboratory.domain.vo.LabHardwareVO;
+import com.zd.laboratory.mapper.LabAbnormalMapper;
+import com.zd.laboratory.mapper.LabHardwareMapper;
+import com.zd.laboratory.socket.runner.TCPServer;
+import com.zd.laboratory.utils.CRCCHECK;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 服务器端handler
+ */
+@Slf4j
+public class NettyServerHandler implements ChannelInboundHandler {
+    ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
+    /**
+    * 读取客户端发送的消息
+    */
+    @Override
+    public void channelRead(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+        byte[] msg  = (byte[]) o;
+        String data = TCPServer.bytesToHexString(msg).toUpperCase();
+        log.info("netty服务端接受消息为:" + data);
+        if(data.equals("6862")){
+            return;
+        }
+
+        log.info("netty服务端接受消息转10进制为:" + ByteBuffer.wrap(msg).getLong());
+//        if(data.startsWith(SocketTypes.LOCK_PREFIX)){
+//        if(data.startsWith("33")){
+
+        String relayCode = data.substring(0, 108);
+//        33 31 20 33 30 20 36 33 20 33 36 20 36 34 20 33 37 20 33 36 20 33 33 20 33 31 20 33 35 20 33 31 20 33 35 20 33 30 20 36 33 20 33 33 20 33 35 20 33 32 20 33 37 20
+
+//        05 05 00 01 ee 00 d0 2e
+
+            // 将通道加入ChannelMap
+            ChannelMap.getChannelMap().put(data, channelHandlerContext);
+//        }else {
+//            if(data.length() != 12){
+//                log.info("netty柜锁回调指令非状态指令!" + data);
+//                return;
+//            }
+
+//            AtomicReference<String> relayCode = new AtomicReference<>("");
+//            ChannelMap.getChannelMap().entrySet().forEach(a -> {
+//                if(a.getValue() == channelHandlerContext){
+//                    relayCode.set(a.getKey());
+//                }
+//            });
+
+            if(data.length() > relayCode.length()) {
+                data = data.replaceAll(relayCode, "");
+                // 柜锁bit 位
+                long bit = CRCCHECK.getBitByCommand(data);
+                // 1开锁状态 0关锁状态
+                int status = CRCCHECK.getLockStatus(data);
+
+                String openData = CRCCHECK.getOpenLockOrder((int)bit).replace(" ", "").toUpperCase();
+                if(data.equals(openData)){
+                    log.info("netty柜锁指令回调:" + relayCode + ":" + bit + ",指令:" + data);
+                    return;
+                }
+
+                log.info("netty柜锁状态回调:" + relayCode + ":" + bit + ",回调结果" + (status == 1 ? "开启": "关闭") + ",指令:" + data);
+
+                RedisService redisService = SpringUtils.getBean(RedisService.class);
+                redisService.setCacheObject(relayCode + ":" + bit, status, 3 * 60L, TimeUnit.SECONDS);
+            }
+
+    }
+
+
+    /**
+    * @description: 读取消息后开始的操作
+    */
+    @Override
+    public void channelReadComplete(ChannelHandlerContext channelHandlerContext) throws Exception {
+        String instruct = CRCCHECK.getOpenLockOrder(1);
+
+        byte[] bytes = ReUtil.hexStringToByteArray(instruct);
+//        log.info("netty服务端数据发送数据:" + instruct);
+//        ChannelFuture channelFuture = channelHandlerContext.writeAndFlush(bytes);
+//        ChannelFuture channelFuture = channelHandlerContext.writeAndFlush(instruct);
+//        channelFuture.addListener(new ChannelFutureListener() {
+//            @Override
+//            public void operationComplete(ChannelFuture channelFuture) throws Exception {
+//                if(channelFuture.isSuccess()){
+//                    log.info("服务端数据发送成功");
+//                }else{
+//                    log.info("服务端数据发送失败");
+//                }
+//            }
+//        });
+    }
+
+    /**
+    * @description: 异常发生时
+    */
+    @Override
+    public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) throws Exception {
+        throwable.printStackTrace();
+        channelHandlerContext.close();
+    }
+
+    @Override
+    public void channelRegistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void channelUnregistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void channelActive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void userEventTriggered(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+
+    }
+
+    @Override
+    public void channelWritabilityChanged(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+    }
+
+    @Override
+    public void handlerAdded(ChannelHandlerContext channelHandlerContext) throws Exception {
+        log.info("netty客户端开始连接" + channelHandlerContext.toString());
+    }
+
+    @Override
+    public void handlerRemoved(ChannelHandlerContext channelHandlerContext) throws Exception {
+        log.info("netty客户端断开连接" + channelHandlerContext.toString());
+
+        for (Map.Entry<String, ChannelHandlerContext> a : ChannelMap.getChannelMap().entrySet()) {
+
+            if(a.getValue() == channelHandlerContext){
+                ChannelMap.getChannelMap().remove(a.getKey());
+                log.info("netty客户端断开连接清除key: " + a.getKey());
+
+                executorService.schedule(new Runnable() {
+                    @Override
+                    public void run() {
+
+                        String relayCode = a.getKey();
+
+                        if(ChannelMap.getChannelMap().get(relayCode) != null){
+                            return;
+                        }
+
+                        LabHardwareMapper labHardwareMapper = SpringUtils.getBean(LabHardwareMapper.class);
+
+                        LabHardware labHardware = new LabHardware();
+                        labHardware.setRelayCode(relayCode);
+
+                        List<LabHardwareVO> list = labHardwareMapper.selectHardwareAndSubInfoByRelay(labHardware);
+
+                        if(list.size() == 0){
+                            return;
+                        }
+
+                        LabAbnormalMapper labAbnormalMapper = SpringUtils.getBean(LabAbnormalMapper.class);
+                        for (LabHardwareVO hardwareVO : list) {
+                            LabAbnormal labAbnormal = new LabAbnormal();
+                            labAbnormal.setName(hardwareVO.getName());
+                            labAbnormal.setType(1);
+                            labAbnormal.setAbnormalReason("netty断开链接超过三分钟");
+                            labAbnormal.setHardwareId(hardwareVO.getId());
+                            labAbnormal.setDeptId(hardwareVO.getDeptId());
+                            labAbnormal.setDeptName(hardwareVO.getDeptName());
+                            labAbnormal.setCreateBy("系统");
+                            labAbnormal.setCreateTime(DateUtils.getNowDate());
+                            labAbnormalMapper.insertLabAbnormal(labAbnormal);
+
+
+                            String content = hardwareVO.getDeptName() + hardwareVO.getSubjectName() + hardwareVO.getName()
+                                    + "netty连接已掉线三分钟未连接!请确认处理!";
+                            DingTalkAlert.sendAlert(content);
+                        }
+
+                    }
+                }, 180, TimeUnit.SECONDS);
+
+                break;
+            }
+        }
+    }
+
+
+}

+ 18 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/netty/PushMsgService.java

@@ -0,0 +1,18 @@
+package com.zd.laboratory.netty;
+
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PushMsgService {
+
+    public void push(String relayCode, byte[] bytes) {
+        // 客户端ID
+        ChannelHandlerContext channelHandlerContext = ChannelMap.getChannel(relayCode);
+        if (null == channelHandlerContext) {
+            throw new RuntimeException("柜锁已离线");
+        }
+        channelHandlerContext.writeAndFlush(Unpooled.copiedBuffer(bytes));
+    }
+}

+ 10 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/controller/OneMachineController.java

@@ -225,10 +225,10 @@ public class OneMachineController extends BaseController {
         }else {
         }else {
             url=fileConfigUtils.getRemoteUrl()+sysUser.getAvatar();
             url=fileConfigUtils.getRemoteUrl()+sysUser.getAvatar();
         }*/
         }*/
-        //通过配置动态加载域名
-        String url = fileConfigUtils.getFileDomainApp() + sysUser.getAvatar();
-        String imgUrl = UrlFormatUtils.getHttpsORHttpUrl(url);
-        sysUser.setAvatar(imgUrl);
+//        //通过配置动态加载域名
+//        String url = fileConfigUtils.getFileDomainApp() + sysUser.getAvatar();
+//        String imgUrl = UrlFormatUtils.getHttpsORHttpUrl(url);
+//        sysUser.setAvatar(imgUrl);
 
 
         //判断当天是否已签到,没有签出
         //判断当天是否已签到,没有签出
 //        int num=labSubjectAccessRecordService.getRecordNoOut(userResult.getData().getUserId());
 //        int num=labSubjectAccessRecordService.getRecordNoOut(userResult.getData().getUserId());
@@ -330,6 +330,12 @@ public class OneMachineController extends BaseController {
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
             throw new ServiceException("用户卡号:" + username + " 不存在");
             throw new ServiceException("用户卡号:" + username + " 不存在");
         }
         }
+        //查询用户使用资格
+        SysUser user = userResult.getData();
+        //通过配置动态加载域名
+        String url = fileConfigUtils.getFileDomainApp() + user.getAvatar();
+        String imgUrl = UrlFormatUtils.getHttpsORHttpUrl(url);
+        user.setAvatar(imgUrl);
         return userResult;
         return userResult;
     }
     }
 
 

+ 119 - 9
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectAccessRecordServiceImpl.java

@@ -1,5 +1,13 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
+import com.zd.common.core.utils.StringUtils;
+import com.zd.exam.api.feign.RemoteExamService;
+import com.zd.laboratory.domain.*;
+import com.zd.laboratory.domain.vo.ElPassConfigdetailVO;
+import com.zd.laboratory.domain.vo.ViolationNewVo;
+import com.zd.laboratory.mapper.LabNegativeListRecordsMapper;
+import com.zd.laboratory.mapper.LabViolationScoreSiteMapper;
+import com.zd.laboratory.service.ILabBlacklistService;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.ResultData;
@@ -9,8 +17,6 @@ import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
-import com.zd.laboratory.domain.LabOnepc;
-import com.zd.laboratory.domain.LabSubjectAccessRecord;
 import com.zd.laboratory.domain.vo.LabSubjectAccessRecordVo;
 import com.zd.laboratory.domain.vo.LabSubjectAccessRecordVo;
 import com.zd.laboratory.mapper.LabSubjectAccessRecordMapper;
 import com.zd.laboratory.mapper.LabSubjectAccessRecordMapper;
 import com.zd.laboratory.mapper.LabViolationMapper;
 import com.zd.laboratory.mapper.LabViolationMapper;
@@ -25,10 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 
 
 /**
 /**
  * 实验室进出记录Service业务层处理
  * 实验室进出记录Service业务层处理
@@ -57,6 +60,21 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     @Autowired
     @Autowired
     private RemoteUserService userService;
     private RemoteUserService userService;
 
 
+    @Autowired
+    private LabViolationScoreSiteMapper scoreSiteMapper;
+
+    @Autowired
+    private RemoteExamService remoteExamService;
+
+    @Autowired
+    private LabNegativeListRecordsMapper negativeListRecordsMapper;
+
+    @Autowired
+    private LabViolationServiceImpl labViolationServiceImpl;
+
+    @Autowired
+    private ILabBlacklistService blacklistService;
+
     /**
     /**
      * 查询实验室进出记录
      * 查询实验室进出记录
      *
      *
@@ -215,11 +233,103 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public int outTimeRecord() {
     public int outTimeRecord() {
-        labSubjectAccessRecordMapper.outTimeRecord();
-        int i = labSubjectAccessRecordMapper.outTimeChangeStatus();
-        if(i>0)
+        //查询超过24小时违规人员列表
+        List<LabSubjectAccessRecordVo> subAccessRecordList = labSubjectAccessRecordMapper.selOutTimeRecord();
+
+//        labSubjectAccessRecordMapper.outTimeRecord();
+        int i = 0;
+        if(subAccessRecordList.size()>0)
         {
         {
+            List<LabViolationScoreSite> scoreSiteList = scoreSiteMapper.selectLabViolationScore();
+            Map<String,String> allMapScore = new HashMap <>();
+            Optional.ofNullable(scoreSiteList).orElseGet(Collections::emptyList)
+                    .stream()
+                    .forEach(a->{
+                        allMapScore.put(a.getViolationName(),a.getViolationVal());
+                    });
+
+
+            Optional.ofNullable(subAccessRecordList).orElseGet(Collections::emptyList)
+                    .parallelStream()
+                    .forEach(a->{
+                        //校验规则
+                        Map<String, Object> p = new HashMap<>();
+                        p.put("userId", a.getJoinUserId());
+                        R<Object> r = remoteExamService.findByUserId(p);
+                        List<Map> list = (List<Map>) r.getData();
+                        if (list != null && list.size() > 0) {
+                            Integer creditScore = Integer.valueOf(list.get(0).get("creditScore").toString())-Integer.parseInt(allMapScore.get(a.getViolationName()));
+                            //这里查询积分规则详情数据
+                            Map<String,Object> markconfigMap = new HashMap<>();
+                            R<Object> data = remoteExamService.getPointsConfig(markconfigMap);
+                            int flag=0;
+                            if (data!=null) {
+                                String code = data.getCode() + "";
+                                if (code.equals("200")) {
+                                    Map<String, Object> pointsConfig = (Map<String, Object>) data.getData();
+                                    //获取积分详情列表
+                                    List<Map<String, Object>> pointsConfigDetail = (List<Map<String, Object>>) pointsConfig.get("configDetailList");
+                                    ElPassConfigdetailVO result = blacklistService.getIntegralMatchingRules(pointsConfigDetail,Integer.valueOf(creditScore));
+
+                                    ViolationNewVo vo = new ViolationNewVo();
+                                    vo.setUserId(a.getJoinUserId());
+                                    vo.setDeptId(a.getDeptId());
+                                    vo.setCreact_id(-2L);
+                                    vo.setReason("-1");
+                                    vo.setViolationReasons(a.getViolationName());
+                                    vo.setDeductionVal(Long.parseLong(allMapScore.get(a.getViolationName())));
+                                    vo.setCreditScore(Long.parseLong(allMapScore.get(a.getViolationName())));
+
+                                    vo.setLaboratoryId(a.getSubjectId());
+                                    vo.setLaboratoryName(a.getSubjectName());
+                                    vo.setUserName(a.getNickName());
+                                    if(StringUtils.isNotNull(result)){
+                                        vo.setWarningStatus(result.getWarningStatus());
+                                        vo.setInterviewStatus(result.getInterviewStatus());
+                                        vo.setTestStatus(result.getTestStatus());
+                                        vo.setLearnStatus(result.getLearnStatus());
+                                        vo.setPracticeStatus(result.getPracticeStatus());
+                                        vo.setHandleDay(result.getHandleDay());
+                                        vo.setTreatmentMessage(a.getViolationName());
+                                        vo.setLearnHour(result.getLearnHour());
+                                        vo.setLearnMinute(result.getLearnMinute());
+                                        if(StringUtils.isNotNull(result.getNumberTopics())){
+                                            vo.setNumberTopics(Integer.parseInt(result.getNumberTopics()+""));
+                                        }else{
+                                            vo.setNumberTopics(null);
+                                        }
+                                        if(StringUtils.isNotNull(result.getNumberAccuracy())){
+                                            vo.setNumberAccuracy(Integer.parseInt(result.getNumberAccuracy()+""));
+                                        }else{
+                                            vo.setNumberAccuracy(null);
+                                        }
+                                    }
+                                    labViolationServiceImpl.addViolationHistory(vo);
+                                }
+                            }
+                        }
+
+
+
+
+
+//                        Map map = new HashMap();
+//                        map.put("joinUserId", a.getJoinUserId());
+//                        if (allMapScore.get(a.getViolationName())!=null) {
+//                            map.put("deductPoints", allMapScore.get(a.getViolationName()));
+//                        } else {
+//                            map.put("deductPoints", 0);
+//                        }
+//                        map.put("pointsType", "1");
+//                        map.put("reason", a.getViolationName());
+//                        remoteExamService.deductionPoints(map);
+//
+//                        LabNegativeListRecords records = negativeListRecordsMapper.findByUserId(a.getJoinUserId());
+//                        Integer score = 0;
+//                        LabNegativelistHistory history = labViolationServiceImpl.CovertHistory(vo);
+                    });
             subMessageSendManager.SendBigViewUpdate(BigViewDataType.SUB_ONLINE);
             subMessageSendManager.SendBigViewUpdate(BigViewDataType.SUB_ONLINE);
+            i = labSubjectAccessRecordMapper.outTimeChangeStatus();
         }
         }
         return i;
         return i;
     }
     }

+ 6 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabViolationServiceImpl.java

@@ -466,7 +466,12 @@ public class LabViolationServiceImpl implements ILabViolationService {
             map.put("deductPoints", scoreSite.getViolationVal());
             map.put("deductPoints", scoreSite.getViolationVal());
         }
         }
         map.put("pointsType", "1");
         map.put("pointsType", "1");
-        map.put("reason", "手动新增违规记录");
+        if(StringUtils.isNotNull(vo.getTreatmentMessage())){
+            map.put("reason", vo.getTreatmentMessage());
+        }else{
+            map.put("reason", "手动新增违规记录");
+        }
+
         remoteExamService.deductionPoints(map);
         remoteExamService.deductionPoints(map);
         LabViolation labViolation = labViolationMapper.selectByUserId(vo.getUserId());
         LabViolation labViolation = labViolationMapper.selectByUserId(vo.getUserId());
         LabNegativeListRecords records = negativeListRecordsMapper.findByUserId(vo.getUserId());
         LabNegativeListRecords records = negativeListRecordsMapper.findByUserId(vo.getUserId());

+ 3 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/runner/SocketRunner.java

@@ -3,6 +3,7 @@ package com.zd.laboratory.socket.runner;
 
 
 import cn.hutool.core.collection.ConcurrentHashSet;
 import cn.hutool.core.collection.ConcurrentHashSet;
 import com.zd.laboratory.socket.properties.SocketProperties;
 import com.zd.laboratory.socket.properties.SocketProperties;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.core.annotation.Order;
 import org.springframework.core.annotation.Order;
@@ -22,6 +23,7 @@ import java.util.concurrent.*;
 
 
 @Component
 @Component
 @Order(Integer.MAX_VALUE)
 @Order(Integer.MAX_VALUE)
+@Slf4j
 public class SocketRunner implements CommandLineRunner {
 public class SocketRunner implements CommandLineRunner {
 
 
     //地址
     //地址
@@ -55,6 +57,7 @@ public class SocketRunner implements CommandLineRunner {
             while (true) {
             while (true) {
                 socket = server.accept();
                 socket = server.accept();
                 pool.execute(new TCPServer(socket));
                 pool.execute(new TCPServer(socket));
+                log.info("SocketRunner---------pool: " + pool.toString());
             }
             }
 
 
         } catch (IOException e) {
         } catch (IOException e) {

+ 7 - 9
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/runner/TCPServer.java

@@ -11,10 +11,7 @@ import com.zd.laboratory.socket.vo.TransmissionVo;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 import java.net.Socket;
 import java.net.Socket;
 import java.net.SocketException;
 import java.net.SocketException;
 import java.util.Map;
 import java.util.Map;
@@ -48,7 +45,7 @@ public class TCPServer implements Runnable {
         }*/
         }*/
         // 设置连接超时90秒
         // 设置连接超时90秒
         try {
         try {
-            socket.setSoTimeout(200000);
+            socket.setSoTimeout(212000);
             log.info("客户 - " + socket.getRemoteSocketAddress() + " -> 机连接成功");
             log.info("客户 - " + socket.getRemoteSocketAddress() + " -> 机连接成功");
             while (true) {
             while (true) {
                 handle();
                 handle();
@@ -73,16 +70,17 @@ public class TCPServer implements Runnable {
     private void handle() throws IOException {
     private void handle() throws IOException {
 
 
         StringBuilder ret = new StringBuilder();
         StringBuilder ret = new StringBuilder();
+        InputStream in = socket.getInputStream();
 
 
         // 解析二进制数据
         // 解析二进制数据
-        BufferedInputStream bs = new BufferedInputStream(socket.getInputStream());
+//        BufferedInputStream bs = new BufferedInputStream(socket.getInputStream());
 
 
-        DataInputStream dis = new DataInputStream(bs);
+//        DataInputStream dis = new DataInputStream(bs);
 
 
         byte[] bytes = new byte[1];
         byte[] bytes = new byte[1];
-        while (dis.read(bytes) != -1){
+        while (in.read(bytes) != -1){
             ret.append(bytesToHexString(bytes) + " ");
             ret.append(bytesToHexString(bytes) + " ");
-            if(dis.available() == 0){
+            if(in.available() == 0){
                 break;
                 break;
             }
             }
         }
         }

+ 12 - 6
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabBuildFloorMapper.xml

@@ -84,19 +84,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           left join lab_subject s on l.sub_id = s.id
           left join lab_subject s on l.sub_id = s.id
           left join lab_subject_access_record sar ON sar.subject_id = s.id
           left join lab_subject_access_record sar ON sar.subject_id = s.id
           and sar.access_status  = 1 AND sar.init_flag = 0
           and sar.access_status  = 1 AND sar.init_flag = 0
+          <where>
+            <if test="id != null "> and t.id = #{id}</if>
+            <if test="parentId != null "> and t.id = #{parentId}</if>
+            <if test="type != null "> and t.`type` = #{type}</if>
+          </where>
         </if>
         </if>
         <if test="type == 3 ">
         <if test="type == 3 ">
             left join lab_build_floor_layout l on t.id = l.floor_id
             left join lab_build_floor_layout l on t.id = l.floor_id
             left join lab_subject s on l.sub_id = s.id
             left join lab_subject s on l.sub_id = s.id
             left join lab_subject_access_record sar ON sar.subject_id = s.id
             left join lab_subject_access_record sar ON sar.subject_id = s.id
             and sar.access_status  = 1 AND sar.init_flag = 0
             and sar.access_status  = 1 AND sar.init_flag = 0
+            <where>
+                (s.admin_id = #{adminId} or find_in_set(#{adminId}, s.safe_user_id))
+                <if test="id != null "> and t.id = #{id}</if>
+                <if test="parentId != null "> and t.parent_id = #{parentId}</if>
+                <if test="type != null "> and t.`type` = #{type}</if>
+            </where>
         </if>
         </if>
-        <where>
-            (s.admin_id = #{adminId} or find_in_set(#{adminId}, s.safe_user_id))
-            <if test="id != null "> and t.id = #{id}</if>
-            <if test="parentId != null "> and t.parent_id = #{parentId}</if>
-            <if test="type != null "> and t.`type` = #{type}</if>
-        </where>
+
         GROUP BY t.id
         GROUP BY t.id
     </select>
     </select>
 
 

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckRecordDetailsMapper.xml

@@ -526,7 +526,7 @@
         select
         select
             rd.yh_ms, co.id as optionId, co.code as optionCode, r.zgjz_time
             rd.yh_ms, co.id as optionId, co.code as optionCode, r.zgjz_time
         from
         from
-             lab_check_record_details rd left join lab_check_option co on rd.jcx_id = co.id
+             lab_check_record_details rd left join lab_check_option co on rd.jcx_sstk_num = co.code
                 left join lab_check_record r on rd.check_id = r.id
                 left join lab_check_record r on rd.check_id = r.id
         where
         where
             rd.check_id = #{checkId}
             rd.check_id = #{checkId}

+ 20 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml

@@ -133,6 +133,26 @@
         </where>
         </where>
     </select>
     </select>
 
 
+    <select id="selectHardwareAndSubInfoByRelay" parameterType="com.zd.laboratory.domain.LabHardware"
+            resultType="com.zd.laboratory.domain.vo.LabHardwareVO">
+        select
+        h.id,
+        h.name,
+        h.subject_id,
+        s.name as subjectName,
+        h.hardware_num,
+        s.dept_id,
+        d.dept_name,
+        h.relay_code
+        from
+        lab_hardware h left join lab_subject s on h.subject_id = s.id
+        left join sys_dept d on s.dept_id = d.dept_id
+        <where>
+            <if test="relayCode != null ">and relay_code = #{relayCode}</if>
+            <if test="hardwareNum != null">and hardware_num = #{hardwareNum}</if>
+        </where>
+    </select>
+
     <select id="selectLabHardwareList" parameterType="com.zd.laboratory.domain.LabHardware"
     <select id="selectLabHardwareList" parameterType="com.zd.laboratory.domain.LabHardware"
             resultMap="LabHardwareVOResult">
             resultMap="LabHardwareVOResult">
         <include refid="selectLabHardwareVo"/>
         <include refid="selectLabHardwareVo"/>

+ 3 - 4
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalLogMapper.xml

@@ -113,10 +113,9 @@
     </select>
     </select>
 
 
     <select id="queryHappenChart" resultType="java.util.Map">
     <select id="queryHappenChart" resultType="java.util.Map">
-
-        select risk_plan_id as riskPlanId,  l.name as riskPlanName, count(1) as count
+        select g.group_name as riskPlanName, count(1) as count
         from lab_risk_plan_abnormal_log p
         from lab_risk_plan_abnormal_log p
-            left join lab_risk_plan l on p.risk_plan_id = l.id
+            LEFT JOIN lab_risk_plan_abnormal_group g ON p.group_id = g.id
             left join lab_subject s on p.subject_id = s.id
             left join lab_subject s on p.subject_id = s.id
         <where>
         <where>
             p.risk_status = 1
             p.risk_status = 1
@@ -134,7 +133,7 @@
             <!-- 数据范围过滤 -->
             <!-- 数据范围过滤 -->
             ${params.dataScope}
             ${params.dataScope}
         </where>
         </where>
-        GROUP BY p.risk_plan_id
+        GROUP BY g.group_name
         ORDER BY count desc
         ORDER BY count desc
     </select>
     </select>
 
 

+ 18 - 2
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSubjectAccessRecordMapper.xml

@@ -49,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="accessStatus" column="access_status"/>
         <result property="accessStatus" column="access_status"/>
         <result property="intervalTime" column="interval_time"/>
         <result property="intervalTime" column="interval_time"/>
         <result property="subjectName" column="subject_name"/>
         <result property="subjectName" column="subject_name"/>
+        <result property="violationName" column="violationName"/>
     </resultMap>
     </resultMap>
 
 
     <sql id="selectLabSubjectAccessRecordVo">
     <sql id="selectLabSubjectAccessRecordVo">
@@ -466,8 +467,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 
 
     <insert id="outTimeRecord">
     <insert id="outTimeRecord">
-        INSERT INTO lab_violation (join_user_id,violation_type,violation_content,subject_id,create_time,dept_id,dept_name,user_id,create_by)
-        SELECT ar.`join_user_id`,1,
+        INSERT INTO lab_violation (user_id,join_user_id,violation_type,violation_content,subject_id,create_time,dept_id,dept_name,user_id,create_by)
+        SELECT ar.`join_user_id`,ar.`join_user_id`,1,
         (SELECT t.dict_label FROM sys_dict_data t WHERE t.dict_type='lab_violation_rules' AND t.dict_value=1),
         (SELECT t.dict_label FROM sys_dict_data t WHERE t.dict_type='lab_violation_rules' AND t.dict_value=1),
         ar.`subject_id`,
         ar.`subject_id`,
         NOW(),
         NOW(),
@@ -481,4 +482,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="outTimeChangeStatus">
     <update id="outTimeChangeStatus">
         UPDATE lab_subject_access_record ar INNER JOIN lab_subject st ON ar.`subject_id` = st.`id` SET ar.access_status=3 WHERE ar.`out_time` IS NULL AND TIMESTAMPDIFF(HOUR,ar.in_time,NOW())>=st.sign_time AND ar.access_status=1 and ar.init_flag = 0
         UPDATE lab_subject_access_record ar INNER JOIN lab_subject st ON ar.`subject_id` = st.`id` SET ar.access_status=3 WHERE ar.`out_time` IS NULL AND TIMESTAMPDIFF(HOUR,ar.in_time,NOW())>=st.sign_time AND ar.access_status=1 and ar.init_flag = 0
     </update>
     </update>
+
+    <select id="selOutTimeRecord" resultMap="labAccessDetail">
+    SELECT ar.`join_user_id`,1,
+        (SELECT t.dict_label FROM sys_dict_data t WHERE t.dict_type='lab_violation_rules' AND t.dict_value=1) violationName,
+        ar.`subject_id`,
+        st.`name` subject_name,
+        NOW(),
+        ar.`dept_id`,
+        ar.`dept_name`,
+        ar.`user_id`,
+        (SELECT su.nick_name FROM  sys_user su WHERE su.`user_id` = ar.`join_user_id`) nick_name,
+        ar.`create_by`
+         FROM lab_subject_access_record ar inner join lab_subject st on ar.`subject_id` = st.`id`
+         WHERE ar.`out_time` IS NULL AND TIMESTAMPDIFF(HOUR,ar.in_time,NOW())>=st.sign_time AND ar.access_status=1 and ar.init_flag = 0
+    </select>
 </mapper>
 </mapper>

+ 8 - 5
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabViolationMapper.xml

@@ -617,12 +617,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                  u.`avatar` as avatar,
                  u.`avatar` as avatar,
                  u.`nick_name` as userName,
                  u.`nick_name` as userName,
                  d.`dept_name` as deptName,
                  d.`dept_name` as deptName,
-                 IFNULL(v.`status`,1) as status,
+                 CASE WHEN b.`id` IS NOT NULL THEN 3 ELSE CASE WHEN r.`id` IS NOT NULL THEN 2 ELSE 1 END END AS status,
                  (SELECT COUNT(1) FROM lab_negativelist_history he WHERE he.user_id = u.`user_id`) as violatioNum,
                  (SELECT COUNT(1) FROM lab_negativelist_history he WHERE he.user_id = u.`user_id`) as violatioNum,
                  IFNULL(v.`negative_list_num`,0) as negativeListCount,
                  IFNULL(v.`negative_list_num`,0) as negativeListCount,
                  IFNULL((SELECT COUNT(1) FROM lab_blackdetail b INNER JOIN lab_blacklist t ON b.black_id = t.id WHERE t.`join_user_id` = u.user_id GROUP BY b.black_id),0) as blackListNum,
                  IFNULL((SELECT COUNT(1) FROM lab_blackdetail b INNER JOIN lab_blacklist t ON b.black_id = t.id WHERE t.`join_user_id` = u.user_id GROUP BY b.black_id),0) as blackListNum,
-                 r.`credit_score` as totalPoints ,
-                 r.`bonus_points` as bonusPoints,
+                 t.`credit_score` as totalPoints ,
+                 t.`bonus_points` as bonusPoints,
                  (SELECT CONCAT(TRUNCATE(IFNULL(SUM(duration), 0)/3600, 0),'小时',TRUNCATE((IFNULL(SUM(duration), 0)%3600/60), 0),'分钟') FROM el_chapter_learn_record lr WHERE lr.join_user_id = u.`user_id`) studyLen
                  (SELECT CONCAT(TRUNCATE(IFNULL(SUM(duration), 0)/3600, 0),'小时',TRUNCATE((IFNULL(SUM(duration), 0)%3600/60), 0),'分钟') FROM el_chapter_learn_record lr WHERE lr.join_user_id = u.`user_id`) studyLen
         FROM
         FROM
             sys_user u
             sys_user u
@@ -630,8 +630,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                            ON v.`join_user_id` = u.`user_id`
                            ON v.`join_user_id` = u.`user_id`
                 left JOIN sys_dept d
                 left JOIN sys_dept d
                            ON u.`dept_id` = d.`dept_id`
                            ON u.`dept_id` = d.`dept_id`
-                left JOIN `el_points_record` r
-                           ON u.`user_id`=r.`join_user_id` WHERE u.user_id=#{userid} GROUP BY u.`user_id`
+                left JOIN `el_points_record` t
+                           ON u.`user_id`=t.`join_user_id`
+                LEFT JOIN lab_negative_list_records r ON r.user_id = t.`join_user_id` AND r.is_negative=1
+                LEFT JOIN lab_blacklist b ON b.join_user_id = t.`join_user_id` AND b.blacklist_status = 1
+                        WHERE u.user_id=#{userid} GROUP BY u.`user_id`
     </select>
     </select>
 
 
     <update id="updateblackStatus">
     <update id="updateblackStatus">

+ 1 - 1
zd-modules/zd-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -356,7 +356,7 @@
 	</select>
 	</select>
 
 
     <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
     <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
+		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag=0  limit 1
 	</select>
 	</select>
 
 
     <select id="checkPhoneUniqueNotOwn" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">
     <select id="checkPhoneUniqueNotOwn" parameterType="com.zd.model.entity.SysUser" resultMap="SysUserResult">