hanzhiwei лет назад: 2
Родитель
Сommit
eef5101996

+ 0 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpAlarmRecordController.java

@@ -137,8 +137,6 @@ public class HxpAlarmRecordController extends BaseController {
     @Log(title = "化学品报警记录", businessType = BusinessType.UPDATE)
     @Log(title = "化学品报警记录", businessType = BusinessType.UPDATE)
     @PutMapping("/handle")
     @PutMapping("/handle")
     public ResultData<Boolean> handle(@RequestBody HxpAlarmRecord hxpAlarmRecord) {
     public ResultData<Boolean> handle(@RequestBody HxpAlarmRecord hxpAlarmRecord) {
-        hxpAlarmRecord.setHandlingTime(new Date());
-        hxpAlarmRecord.setHandlingStatus(2);
         return ResultData.result(hxpAlarmRecordService.updateHxpAlarmRecord(hxpAlarmRecord));
         return ResultData.result(hxpAlarmRecordService.updateHxpAlarmRecord(hxpAlarmRecord));
     }
     }
 
 

+ 33 - 30
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpAlarmRecordServiceImpl.java

@@ -72,34 +72,34 @@ public class HxpAlarmRecordServiceImpl implements IHxpAlarmRecordService {
 
 
         List<Map<String,String>> userInfos = hxpAlarmRecordMapper.selectHxpAlarmRecordUserInfo();
         List<Map<String,String>> userInfos = hxpAlarmRecordMapper.selectHxpAlarmRecordUserInfo();
 
 
-        list.forEach(a -> {
-            if(a.getAlarmModeStatus() != null){
-                if(a.getAlarmModeStatus() == 1 && a.getLiableUserIds() != null){
-                    a.setLiableUserName(
-                            userInfos.stream().filter(u -> a.getLiableUserIds().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
-                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
-                    );
-                }else if(a.getSafeUserId() != null){
-                    a.setLiableUserName(
-                            userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
-                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
-                    );
-                }
-            }
-
-            if(a.getAdminId() != null){
-                a.setAdminNames(
-                        userInfos.stream().filter(u -> a.getAdminId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
-                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
-                );
-            }
-            if(a.getSafeUserId() != null){
-                a.setSafeUserNames(
-                        userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
-                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
-                );
-            }
-        });
+//        list.forEach(a -> {
+//            if(a.getAlarmModeStatus() != null){
+//                if(a.getAlarmModeStatus() == 1 && a.getLiableUserIds() != null){
+//                    a.setLiableUserName(
+//                            userInfos.stream().filter(u -> a.getLiableUserIds().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+//                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+//                    );
+//                }else if(a.getSafeUserId() != null){
+//                    a.setLiableUserName(
+//                            userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+//                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+//                    );
+//                }
+//            }
+//
+//            if(a.getAdminId() != null){
+//                a.setAdminNames(
+//                        userInfos.stream().filter(u -> a.getAdminId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+//                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
+//                );
+//            }
+//            if(a.getSafeUserId() != null){
+//                a.setSafeUserNames(
+//                        userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+//                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
+//                );
+//            }
+//        });
 
 
         return list;
         return list;
     }
     }
@@ -213,7 +213,8 @@ public class HxpAlarmRecordServiceImpl implements IHxpAlarmRecordService {
         int count = hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord);
         int count = hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord);
 
 
         if(hxpAlarmRecord.getHandlingStatus() == 2){
         if(hxpAlarmRecord.getHandlingStatus() == 2){
-            hxpAlarmRecordMapper.updateOtherByParentId(hxpAlarmRecord.getId());
+//            hxpAlarmRecordMapper.updateOtherByParentId(hxpAlarmRecord.getId());
+            hxpAlarmRecordMapper.updateByReturnUserecord(hxpAlarmRecord.getId());
         }
         }
         return count;
         return count;
     }
     }
@@ -283,7 +284,9 @@ public class HxpAlarmRecordServiceImpl implements IHxpAlarmRecordService {
             } catch (Exception e) {
             } catch (Exception e) {
                 log.error("阶梯电话通知发送异常:" + e.getMessage());
                 log.error("阶梯电话通知发送异常:" + e.getMessage());
             }
             }
-            hxpAlarmRecord.setHasValid(1);
+//            hxpAlarmRecord.setHasValid(1);
+            //已处理
+            hxpAlarmRecord.setHandlingStatus(2);
             hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord);
             hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord);
         }
         }
     }
     }

+ 11 - 9
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java

@@ -1118,6 +1118,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
                         }
                         }
                     }
                     }
 
 
+                    Long alarmId = null;
                     //声光报警
                     //声光报警
                     if (timeout.contains("3")) {
                     if (timeout.contains("3")) {
                         List<Map<String, Object>> terminalList = hxpSmartTerminalMapper.selectTerminalBySubId(8, hxpStock.getSubId());
                         List<Map<String, Object>> terminalList = hxpSmartTerminalMapper.selectTerminalBySubId(8, hxpStock.getSubId());
@@ -1144,18 +1145,18 @@ public class HxpStockServiceImpl implements IHxpStockService {
                             hxpAlarmRecord.setTerminalNum(terminalNum);
                             hxpAlarmRecord.setTerminalNum(terminalNum);
                             hxpAlarmRecord.setHandlingStatus(1);
                             hxpAlarmRecord.setHandlingStatus(1);
                             hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
                             hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
-                            Long recordId = hxpAlarmRecord.getId();
+                            alarmId = hxpAlarmRecord.getId();
                             scheduledExecutorService.schedule(new TimerTask() {
                             scheduledExecutorService.schedule(new TimerTask() {
                                 @Override
                                 @Override
                                 public void run() {
                                 public void run() {
                                     remoteLaboratoryService.controlDevice(id, 0);
                                     remoteLaboratoryService.controlDevice(id, 0);
                                     // 自动处理声光报警状态
                                     // 自动处理声光报警状态
-                                    HxpAlarmRecord hxpAlarmRecord1 = new HxpAlarmRecord();
-                                    hxpAlarmRecord1.setId(recordId);
-                                    hxpAlarmRecord1.setHandlingStatus(2);
-                                    hxpAlarmRecord1.setHandlingTime(DateUtils.getNowDate());
-                                    hxpAlarmRecord1.setHandlingUserId(-2L);
-                                    hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord1);
+                                    //HxpAlarmRecord hxpAlarmRecord1 = new HxpAlarmRecord();
+                                    //hxpAlarmRecord1.setId(hxpAlarmRecord.getId());
+                                    //hxpAlarmRecord1.setHandlingStatus(2);
+                                    //hxpAlarmRecord1.setHandlingTime(DateUtils.getNowDate());
+                                    //hxpAlarmRecord1.setHandlingUserId(-2L);
+                                    //hxpAlarmRecordMapper.updateHxpAlarmRecord(hxpAlarmRecord1);
                                 }
                                 }
                             }, Long.parseLong(terminalList.get(0).get("ringTime") + ""), TimeUnit.SECONDS);
                             }, Long.parseLong(terminalList.get(0).get("ringTime") + ""), TimeUnit.SECONDS);
                         }
                         }
@@ -1179,8 +1180,9 @@ public class HxpStockServiceImpl implements IHxpStockService {
                             hxpAlarmRecord.setAlarmTime(date);
                             hxpAlarmRecord.setAlarmTime(date);
                             hxpAlarmRecord.setSubId(hxpStock.getSubId());
                             hxpAlarmRecord.setSubId(hxpStock.getSubId());
                             hxpAlarmRecord.setStockId(hxpStock.getId());
                             hxpAlarmRecord.setStockId(hxpStock.getId());
-                            //hxpAlarmRecord.setParentId(recordId);
-                            //hxpAlarmRecord.setTerminalNum();
+                            hxpAlarmRecord.setParentId(hxpUserecord.getId());
+                            hxpAlarmRecord.setUserecordId(alarmId);
+                            // hxpAlarmRecord.setTerminalNum();
                             hxpAlarmRecord.setHandlingStatus(1);
                             hxpAlarmRecord.setHandlingStatus(1);
                             hxpAlarmRecord.setLiableUserIds(hxpAlarmConfig.getAlarmPhone());
                             hxpAlarmRecord.setLiableUserIds(hxpAlarmConfig.getAlarmPhone());
                             hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);
                             hxpAlarmRecordMapper.insertHxpAlarmRecord(hxpAlarmRecord);