Browse Source

Merge branch 'dev-api' into dev

tom 8 months ago
parent
commit
12b977a986
22 changed files with 918 additions and 474 deletions
  1. 68 70
      pla-sim/01_SQL/02_table/sim_fault.sql
  2. 8 4
      pla-sim/01_SQL/02_table/sim_real_exam_fault.sql
  3. 24 6
      pla-sim/01_SQL/02_table/sim_sim.sql
  4. 6 3
      pla-sim/01_SQL/02_table/sim_sim_msg.sql
  5. 186 154
      pla-sim/01_SQL/03_dev_backup/pla-chem-sim-dev-1.sql
  6. 13 0
      ruoyi-sim/pom.xml
  7. 1 1
      ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamController.java
  8. 17 1
      ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SeatController.java
  9. 17 24
      ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SimController.java
  10. 16 16
      ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Fault.java
  11. 83 18
      ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExamFault.java
  12. 69 2
      ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Sim.java
  13. 56 7
      ruoyi-sim/src/main/java/com/ruoyi/sim/domain/SimMsg.java
  14. 3 19
      ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/FaultService.java
  15. 148 110
      ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/IotService.java
  16. 20 0
      ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimReceiveService.java
  17. 78 0
      ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimService.java
  18. 12 9
      ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/TaskService.java
  19. 15 12
      ruoyi-sim/src/main/resources/mapper/sim/FaultMapper.xml
  20. 44 12
      ruoyi-sim/src/main/resources/mapper/sim/RealExamFaultMapper.xml
  21. 6 0
      ruoyi-sim/src/main/resources/mapper/sim/SimMapper.xml
  22. 28 6
      ruoyi-sim/src/main/resources/mapper/sim/SimMsg.xml

+ 68 - 70
pla-sim/01_SQL/02_table/sim_fault.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50740 (5.7.40-log)
  File Encoding         : 65001
 
- Date: 15/12/2024 19:22:09
+ Date: 18/12/2024 21:39:39
 */
 
 SET NAMES utf8mb4;
@@ -26,12 +26,12 @@ CREATE TABLE `sim_fault`  (
   `parent_fault_id` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '父故障ID',
   `sim_type` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '模拟器类型\r\n',
   `fault_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '故障类型:\r\n1:故障现象\r\n2:故障现象的可能原因\r\n3:故障部位\r\n4:故障部位的排除方法\r\n5:修复结论',
-  `conflict_fault_id` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '互斥的故障ID',
-  `replace_part` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否是更换件 1:是 0:不是',
-  `replace_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更换件名称',
+  `conflict_fault_ids` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '互斥所有故障ID逗号分割',
+  `replace_part` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否是更换件 1:是 0:不是',
+  `replace_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更换件名称',
   `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '名称',
-  `sim_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '通信报文',
-  `order_num` int(4) NULL DEFAULT NULL COMMENT '显示顺序',
+  `bind_hardware_msg` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '绑定硬件通信报文',
+  `order_num` int(4) NULL DEFAULT 0 COMMENT '显示顺序',
   `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
   `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
@@ -43,69 +43,67 @@ CREATE TABLE `sim_fault`  (
 -- ----------------------------
 -- Records of sim_fault
 -- ----------------------------
-INSERT INTO `sim_fault` VALUES ('000100010000', '000000000000', '0001', '1', '', '0', NULL, '开机无响应', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100010001', '000100010000', '0001', '3', '', '1', NULL, '1.电源开关', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100010002', '000100010000', '0001', '3', '', '1', NULL, '2.DC/DC转换芯片', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100020000', '000000000000', '0001', '1', '', '0', NULL, '开机后按抽气开关,微电机不工作', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100020003', '000100020000', '0001', '3', '', '1', NULL, '3.微电机', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100020004', '000100020000', '0001', '3', '', '1', NULL, '4.Q2', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100030000', '000000000000', '0001', '1', '', '0', NULL, '抽气流量不足', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100030005', '000100030000', '0001', '3', '', '1', NULL, '5.滤网', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100030006', '000100030000', '0001', '3', '', '1', NULL, '6.调速电位器', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100040000', '000000000000', '0001', '1', '', '0', NULL, '开机后按下加热开关,加热灯不亮,也未加热', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100040007', '000100040000', '0001', '3', '', '1', NULL, '7.加热指示灯', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100040008', '000100040000', '0001', '3', '', '1', NULL, '8.热敏开关', '', 8, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100050000', '000000000000', '0001', '1', '', '0', NULL, '不能正常工作', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100050009', '000100050000', '0001', '3', '', '1', NULL, '9.外壳及零件', '', 9, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100060000', '000000000000', '0001', '1', '', '0', NULL, '电压低', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100060010', '000100060000', '0001', '3', '', '1', NULL, '10.供电模块', '', 10, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100070000', '000000000000', '0001', '1', '', '0', NULL, '抽气指示灯不亮', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000100070011', '000100070000', '0001', '3', '', '1', NULL, '11.抽气指示灯', '', 11, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200010000', '000000000000', '0002', '1', '', '0', NULL, '仪器无法开机', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200010001', '000200010000', '0002', '3', '', '1', NULL, '1.薄膜开关FPC排线', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200010002', '000200010000', '0002', '3', '', '1', NULL, '2.主控板开机电路', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200020000', '000000000000', '0002', '1', '', '0', NULL, '蜂鸣器自检时,声音异常', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200020003', '000200020000', '0002', '3', '', NULL, NULL, '3.蜂鸣器出声口', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200020004', '000200020000', '0002', '3', '', NULL, NULL, '4.接口接线板', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200030000', '000000000000', '0002', '1', '', NULL, NULL, '仪器进入检测界面后,通入检测剂不报警', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200030005', '000200030000', '0002', '3', '', NULL, NULL, '5.检测剂', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200030006', '000200030000', '0002', '3', '', NULL, NULL, '6.主控板信号采集电路', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200040000', '000000000000', '0002', '1', '', NULL, NULL, '显示屏无显示', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200040007', '000200040000', '0002', '3', '', NULL, NULL, '7.主控板显示屏供电电路', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200040008', '000200040000', '0002', '3', '', NULL, NULL, '8.显示屏', '', 8, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200050000', '000000000000', '0002', '1', '', NULL, NULL, '长时间不进入“检测中”', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200050009', '000200050000', '0002', '3', '', NULL, NULL, '9.干燥管', '', 9, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200050010', '000200050000', '0002', '3', '', NULL, NULL, '10.维护管', '', 10, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200060000', '000000000000', '0002', '1', '', NULL, NULL, '不能正常工作', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200060011', '000200060000', '0002', '3', '', NULL, NULL, '11.外壳及零件', '', 11, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200070000', '000000000000', '0002', '1', '', NULL, NULL, '电压低', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200070012', '000200070000', '0002', '3', '', NULL, NULL, '12.供电模块', '', 12, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200080000', '000000000000', '0002', '1', '', NULL, NULL, '无法开机', '', 8, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000200080001', '000200080000', '0002', '3', '', NULL, NULL, '13.DC/DC', '', 13, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300010000', '000000000000', '0003', '1', '', NULL, NULL, '仪器无法开机', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300010001', '000300010000', '0003', '3', '', NULL, NULL, '1.FFC排线', '', 1, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300010002', '000300010000', '0003', '3', '', NULL, NULL, '2.汇总主控板', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300020000', '000000000000', '0003', '1', '', NULL, NULL, '开机后,显示屏无显示', '', 2, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300020003', '000300020000', '0003', '3', '', NULL, NULL, '3.显控报警板', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300020004', '000300020000', '0003', '3', '', NULL, NULL, '4.显示屏', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300030000', '000000000000', '0003', '1', '', NULL, NULL, '检测状态下模拟剂不报警', '', 3, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300030005', '000300030000', '0003', '3', '', NULL, NULL, '5.汇总主控板信号采集电路', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300030006', '000300030000', '0003', '3', '', NULL, NULL, '6.检测剂', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300040000', '000000000000', '0003', '1', '', NULL, NULL, '长时间不能进入检测状态', '', 4, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300040007', '000300040000', '0003', '3', '', NULL, NULL, '7.干燥管', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300040008', '000300040000', '0003', '3', '', NULL, NULL, '8.维护管', '', 8, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300050000', '000000000000', '0003', '1', '', NULL, NULL, '固液检测/气体检测模式切换失败', '', 5, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300050009', '000300050000', '0003', '3', '', NULL, NULL, '9.固液检测单元与主控板连接线', '', 9, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300050010', '000300050000', '0003', '3', '', NULL, NULL, '10.汇总主控板固液通信电路', '', 10, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300050011', '000300050000', '0003', '3', '', NULL, NULL, '11.切换按键', '', 11, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300060000', '000000000000', '0003', '1', '', NULL, NULL, '有毒有害气体检测模块不报警', '', 6, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300060012', '000300060000', '0003', '3', '', NULL, NULL, '12.高压驱动板与汇总主控板连接线', '', 12, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300060013', '000300060000', '0003', '3', '', NULL, NULL, '13.汇总主控板毒害模块通信电路', '', 13, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300070000', '000000000000', '0003', '1', '', NULL, NULL, '不能正常工作', '', 7, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300070014', '000300070000', '0003', '3', '', NULL, NULL, '14.外壳及零件', '', 14, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300080000', '000000000000', '0003', '1', '', NULL, NULL, '电压低', '', 8, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300080015', '000300080000', '0003', '3', '', NULL, NULL, '15.供电模块', '', 15, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300090000', '000000000000', '0003', '1', '', NULL, NULL, '无法开机', '', 9, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_fault` VALUES ('000300090016', '000300090000', '0003', '3', '', NULL, NULL, '16.DC/DC', '', 16, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100010000', '000000000000', '0001', '1', '', '0', '', '开机无响应', '', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100010001', '000100010000', '0001', '3', '', '1', '电源开关', '1.电源开关', '01', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100010002', '000100010000', '0001', '3', '', '1', 'DC/DC转换芯片', '2.DC/DC转换芯片', '02', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100020000', '000000000000', '0001', '1', '', '0', '', '开机后按抽气开关,微电机不工作', '', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100020003', '000100020000', '0001', '3', '', '1', '微电机', '3.微电机', '03', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100020004', '000100020000', '0001', '3', '', '1', 'Q2', '4.Q2', '04', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100030000', '000000000000', '0001', '1', '', '0', '', '抽气流量不足', '', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100030005', '000100030000', '0001', '3', '', '1', '滤网', '5.滤网', '05', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100030006', '000100030000', '0001', '3', '', '1', '调速电位器', '6.调速电位器', '06', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100040000', '000000000000', '0001', '1', '', '0', '', '开机后按下加热开关,加热灯不亮,也未加热', '', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100040007', '000100040000', '0001', '3', '', '1', '加热指示灯', '7.加热指示灯', '07', 7, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100040008', '000100040000', '0001', '3', '', '1', '热敏开关', '8.热敏开关', '08', 8, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100050000', '000000000000', '0001', '1', '', '0', '', '不能正常工作', '', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100050009', '000100050000', '0001', '3', '', '1', '外壳及零件', '9.外壳及零件', '09', 9, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100060000', '000000000000', '0001', '1', '', '0', '', '电压低', '', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000100060010', '000100060000', '0001', '3', '', '1', '供电模块', '10.供电模块', '0A', 10, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200010000', '000000000000', '0002', '1', '', '0', '', '仪器无法开机', '', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200010001', '000200010000', '0002', '3', '', '1', '', '1.薄膜开关FPC排线', '', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200010002', '000200010000', '0002', '3', '', '1', '', '2.主控板开机电路', '', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200020000', '000000000000', '0002', '1', '', '0', '', '蜂鸣器自检时,声音异常', '', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200020003', '000200020000', '0002', '3', '', '0', '', '3.蜂鸣器出声口', '', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200020004', '000200020000', '0002', '3', '', '0', '', '4.接口接线板', '', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200030000', '000000000000', '0002', '1', '', '0', '', '仪器进入检测界面后,通入检测剂不报警', '', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200030005', '000200030000', '0002', '3', '', '0', '', '5.检测剂', '', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200030006', '000200030000', '0002', '3', '', '0', '', '6.主控板信号采集电路', '', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200040000', '000000000000', '0002', '1', '', '0', '', '显示屏无显示', '', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200040007', '000200040000', '0002', '3', '', '0', '', '7.主控板显示屏供电电路', '', 7, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200040008', '000200040000', '0002', '3', '', '0', '', '8.显示屏', '', 8, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200050000', '000000000000', '0002', '1', '', '0', '', '长时间不进入“检测中”', '', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200050009', '000200050000', '0002', '3', '', '0', '', '9.干燥管', '', 9, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200050010', '000200050000', '0002', '3', '', '0', '', '10.维护管', '', 10, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200060000', '000000000000', '0002', '1', '', '0', '', '不能正常工作', '', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200060011', '000200060000', '0002', '3', '', '0', '', '11.外壳及零件', '', 11, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200070000', '000000000000', '0002', '1', '', '0', '', '电压低', '', 7, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200070012', '000200070000', '0002', '3', '', '0', '', '12.供电模块', '', 12, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200080000', '000000000000', '0002', '1', '', '0', '', '无法开机', '', 8, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000200080001', '000200080000', '0002', '3', '', '0', '', '13.DC/DC', '', 13, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300010000', '000000000000', '0003', '1', '', '0', '', '仪器无法开机', '', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300010001', '000300010000', '0003', '3', '', '0', '', '1.FFC排线', '', 1, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300010002', '000300010000', '0003', '3', '', '0', '', '2.汇总主控板', '', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300020000', '000000000000', '0003', '1', '', '0', '', '开机后,显示屏无显示', '', 2, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300020003', '000300020000', '0003', '3', '', '0', '', '3.显控报警板', '', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300020004', '000300020000', '0003', '3', '', '0', '', '4.显示屏', '', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300030000', '000000000000', '0003', '1', '', '0', '', '检测状态下模拟剂不报警', '', 3, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300030005', '000300030000', '0003', '3', '', '0', '', '5.汇总主控板信号采集电路', '', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300030006', '000300030000', '0003', '3', '', '0', '', '6.检测剂', '', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300040000', '000000000000', '0003', '1', '', '0', '', '长时间不能进入检测状态', '', 4, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300040007', '000300040000', '0003', '3', '', '0', '', '7.干燥管', '', 7, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300040008', '000300040000', '0003', '3', '', '0', '', '8.维护管', '', 8, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300050000', '000000000000', '0003', '1', '', '0', '', '固液检测/气体检测模式切换失败', '', 5, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300050009', '000300050000', '0003', '3', '', '0', '', '9.固液检测单元与主控板连接线', '', 9, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300050010', '000300050000', '0003', '3', '', '0', '', '10.汇总主控板固液通信电路', '', 10, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300050011', '000300050000', '0003', '3', '', '0', '', '11.切换按键', '', 11, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300060000', '000000000000', '0003', '1', '', '0', '', '有毒有害气体检测模块不报警', '', 6, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300060012', '000300060000', '0003', '3', '', '0', '', '12.高压驱动板与汇总主控板连接线', '', 12, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300060013', '000300060000', '0003', '3', '', '0', '', '13.汇总主控板毒害模块通信电路', '', 13, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300070000', '000000000000', '0003', '1', '', '0', '', '不能正常工作', '', 7, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300070014', '000300070000', '0003', '3', '', '0', '', '14.外壳及零件', '', 14, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300080000', '000000000000', '0003', '1', '', '0', '', '电压低', '', 8, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300080015', '000300080000', '0003', '3', '', '0', '', '15.供电模块', '', 15, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300090000', '000000000000', '0003', '1', '', '0', '', '无法开机', '', 9, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_fault` VALUES ('000300090016', '000300090000', '0003', '3', '', '0', '', '16.DC/DC', '', 16, NULL, NULL, NULL, NULL, NULL);
 
 SET FOREIGN_KEY_CHECKS = 1;

+ 8 - 4
pla-sim/01_SQL/02_table/sim_real_exam_fault.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50740 (5.7.40-log)
  File Encoding         : 65001
 
- Date: 15/12/2024 19:23:15
+ Date: 18/12/2024 21:39:18
 */
 
 SET NAMES utf8mb4;
@@ -22,12 +22,16 @@ SET FOREIGN_KEY_CHECKS = 0;
 -- ----------------------------
 DROP TABLE IF EXISTS `sim_real_exam_fault`;
 CREATE TABLE `sim_real_exam_fault`  (
-  `ref_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `ref_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联ID',
   `exam_id` bigint(20) NOT NULL COMMENT '考试ID',
   `fault_id` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '故障ID',
+  `ref_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '关联类型 1:选择题 2:模拟器维修故障',
   `flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '7' COMMENT '7:未知\r\n1:选中\r\n0:没有选中',
-  `question_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '出题数值',
-  `answer_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '答题数值',
+  `ref_state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '故障ID关联状态\r\n0:初始化\r\n1:已经清除故障\r\n2:故障已经下发\r\n3:轮训读取刷新电阻代表值\r\n3:考试结束',
+  `choice_question_value` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '选择题的出题数值/正确答案',
+  `choice_answer_value` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '选择题的答题数值/学院填写答案',
+  `sim_fault_question_value` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '模拟器出题值/电阻代表值',
+  `sim_fault_answer_value` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '模拟器答题值/电阻代表值',
   `minus` int(2) NULL DEFAULT 0 COMMENT '减分值 计正数',
   `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',

+ 24 - 6
pla-sim/01_SQL/02_table/sim_sim.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50740 (5.7.40-log)
  File Encoding         : 65001
 
- Date: 15/12/2024 19:23:37
+ Date: 18/12/2024 21:16:24
 */
 
 SET NAMES utf8mb4;
@@ -25,21 +25,39 @@ CREATE TABLE `sim_sim`  (
   `sim_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '模拟器ID',
   `seat_id` bigint(20) NOT NULL COMMENT '座ID',
   `sim_type` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '模拟器类型',
-  `sim_state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '模拟器在线 1:在线 2:离线 3:硬件故障异常',
+  `sim_state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用',
   `sim_sn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '模拟器序列号',
+  `sim_num` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '模拟器设备编号1~30',
   `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
   `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
   `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
   `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`sim_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sim-模拟器表' ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sim-模拟器表' ROW_FORMAT = DYNAMIC;
 
 -- ----------------------------
 -- Records of sim_sim
 -- ----------------------------
-INSERT INTO `sim_sim` VALUES (11, 1, '0001', '0', 'A0001', NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_sim` VALUES (12, 2, '0001', '0', 'A0002', NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `sim_sim` VALUES (13, 3, '0001', '0', 'A0003', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (11, 1, '0001', '0', '01123456', '1', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (12, 2, '0001', '5', 'A0002', '2', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (13, 3, '0001', '5', 'A0003', '3', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (14, 4, '0001', '5', 'A0004', '4', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (15, 5, '0001', '5', 'A0005', '5', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (16, 6, '0001', '5', 'A0006', '6', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (17, 7, '0001', '5', 'A0007', '7', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (18, 8, '0001', '5', 'A0008', '8', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (19, 9, '0001', '5', 'A0009', '9', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (20, 10, '0001', '5', 'A0010', '10', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (21, 1, '0002', '5', 'B0001', '11', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (22, 2, '0002', '5', 'B0002', '12', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (23, 3, '0002', '5', 'B0003', '13', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (24, 4, '0002', '5', 'B0004', '14', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (25, 5, '0002', '5', 'B0005', '15', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (26, 6, '0002', '5', 'B0006', '16', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (27, 7, '0002', '5', 'B0006', '17', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (28, 8, '0002', '5', 'B0007', '18', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (29, 9, '0002', '5', 'B0008', '19', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `sim_sim` VALUES (30, 10, '0002', '5', 'B0008', '20', NULL, NULL, NULL, NULL, NULL);
 
 SET FOREIGN_KEY_CHECKS = 1;

+ 6 - 3
pla-sim/01_SQL/02_table/sim_sim_msg.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50740 (5.7.40-log)
  File Encoding         : 65001
 
- Date: 15/12/2024 19:23:46
+ Date: 18/12/2024 21:39:05
 */
 
 SET NAMES utf8mb4;
@@ -24,8 +24,11 @@ DROP TABLE IF EXISTS `sim_sim_msg`;
 CREATE TABLE `sim_sim_msg`  (
   `sim_msg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '模拟器报文ID',
   `sim_id` bigint(20) NOT NULL COMMENT '模拟器ID',
-  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '状态 0初始值 1成功 2失败',
-  `priority` int(8) NULL DEFAULT NULL COMMENT '优先级',
+  `exam_fault_ref_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '关联ID',
+  `exam_collection_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '考试类型\r\n1:练习\r\n2:自主练习\r\n3:考试',
+  `send_msg_state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '状态 0初始值 1成功 2失败',
+  `priority` int(8) NOT NULL DEFAULT 0 COMMENT '优先级',
+  `send_msg_type` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '发送报文类型 cmd+cmdId',
   `send_msg` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发送报文',
   `send_time` datetime NULL DEFAULT NULL COMMENT '发送时间',
   `receive_msg` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '接收报文',

File diff suppressed because it is too large
+ 186 - 154
pla-sim/01_SQL/03_dev_backup/pla-chem-sim-dev-1.sql


+ 13 - 0
ruoyi-sim/pom.xml

@@ -52,4 +52,17 @@
         <maven.compiler.target>21</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>17</source>
+                    <target>17</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

+ 1 - 1
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamController.java

@@ -71,7 +71,7 @@ public class RealExamController extends BaseController {
 
     // @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
     @GetMapping(value = "/student/{examId}")
-    @ApiOperation("[学生]获取考试详细信息")
+    @ApiOperation("[学生][轮询]获取考试详细信息")
     public AjaxResult getInfoStudent(@PathVariable("examId") Long examId) {
         return success(realExamService.selectRealExamByExamId(examId));
     }

+ 17 - 1
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SeatController.java

@@ -4,6 +4,8 @@ import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
 import com.ruoyi.sim.service.impl.SeatService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -30,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/sim/seat")
+@Api("座Controller")
 public class SeatController extends BaseController {
     @Autowired
     private SeatService seatService;
@@ -37,7 +40,7 @@ public class SeatController extends BaseController {
     /**
      * 查询座列表
      */
-    @PreAuthorize("@ss.hasPermi('sim:seat:list')")
+    // @PreAuthorize("@ss.hasPermi('sim:seat:list')")
     @GetMapping("/list")
     public TableDataInfo list(Seat seat) {
         startPage();
@@ -46,6 +49,19 @@ public class SeatController extends BaseController {
     }
 
     /**
+     * 查询全部座列表
+     */
+    // @PreAuthorize("@ss.hasPermi('sim:seat:list')")
+    @GetMapping("/listAll")
+    @ApiOperation("[老师][轮询]查询全部座列表")
+    public TableDataInfo listAll() {
+        Seat seat = new Seat();
+        startPage();
+        List<Seat> list = seatService.selectSeatList(seat);
+        return getDataTable(list);
+    }
+
+    /**
      * 导出座列表
      */
     @PreAuthorize("@ss.hasPermi('sim:seat:export')")

+ 17 - 24
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SimController.java

@@ -4,20 +4,15 @@ import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
 import com.ruoyi.sim.service.impl.SimService;
-import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.sim.domain.Sim;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
@@ -34,11 +29,9 @@ public class SimController extends BaseController {
     @Autowired
     private SimService simService;
 
-    /**
-     * 查询模拟器列表
-     */
-    @PreAuthorize("@ss.hasPermi('sim:sim:list')")
+    // @PreAuthorize("@ss.hasPermi('sim:sim:list')")
     @GetMapping("/list")
+    @ApiOperation("[分页]查询模拟器列表")
     public TableDataInfo list(Sim sim) {
         startPage();
         List<Sim> list = simService.selectSimList(sim);
@@ -48,19 +41,19 @@ public class SimController extends BaseController {
     /**
      * 导出模拟器列表
      */
-    @PreAuthorize("@ss.hasPermi('sim:sim:export')")
-    @Log(title = "模拟器", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
+    // @PreAuthorize("@ss.hasPermi('sim:sim:export')")
+    // @Log(title = "模拟器", businessType = BusinessType.EXPORT)
+    // @PostMapping("/export")
     public void export(HttpServletResponse response, Sim sim) {
         List<Sim> list = simService.selectSimList(sim);
-        ExcelUtil<Sim> util = new ExcelUtil<Sim>(Sim.class);
+        ExcelUtil<Sim> util = new ExcelUtil<>(Sim.class);
         util.exportExcel(response, list, "模拟器数据");
     }
 
     /**
      * 获取模拟器详细信息
      */
-    @PreAuthorize("@ss.hasPermi('sim:sim:query')")
+    // @PreAuthorize("@ss.hasPermi('sim:sim:query')")
     @GetMapping(value = "/{simId}")
     public AjaxResult getInfo(@PathVariable("simId") Long simId) {
         return success(simService.selectSimBySimId(simId));
@@ -69,9 +62,9 @@ public class SimController extends BaseController {
     /**
      * 新增模拟器
      */
-    @PreAuthorize("@ss.hasPermi('sim:sim:add')")
-    @Log(title = "模拟器", businessType = BusinessType.INSERT)
-    @PostMapping
+    // @PreAuthorize("@ss.hasPermi('sim:sim:add')")
+    // @Log(title = "模拟器", businessType = BusinessType.INSERT)
+    // @PostMapping
     public AjaxResult add(@RequestBody Sim sim) {
         return toAjax(simService.insertSim(sim));
     }
@@ -79,9 +72,9 @@ public class SimController extends BaseController {
     /**
      * 修改模拟器
      */
-    @PreAuthorize("@ss.hasPermi('sim:sim:edit')")
-    @Log(title = "模拟器", businessType = BusinessType.UPDATE)
-    @PutMapping
+    // @PreAuthorize("@ss.hasPermi('sim:sim:edit')")
+    // @Log(title = "模拟器", businessType = BusinessType.UPDATE)
+    // @PutMapping
     public AjaxResult edit(@RequestBody Sim sim) {
         return toAjax(simService.updateSim(sim));
     }
@@ -89,9 +82,9 @@ public class SimController extends BaseController {
     /**
      * 删除模拟器
      */
-    @PreAuthorize("@ss.hasPermi('sim:sim:remove')")
-    @Log(title = "模拟器", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{simIds}")
+    // @PreAuthorize("@ss.hasPermi('sim:sim:remove')")
+    // @Log(title = "模拟器", businessType = BusinessType.DELETE)
+    // @DeleteMapping("/{simIds}")
     public AjaxResult remove(@PathVariable Long[] simIds) {
         return toAjax(simService.deleteSimBySimIds(simIds));
     }

+ 16 - 16
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Fault.java

@@ -44,10 +44,10 @@ public class Fault extends BaseEntity implements Comparable<Fault> {
     private String faultType;
 
     /**
-     * 互斥的故障ID
+     * 互斥所有故障ID逗号分割
      */
-    @Excel(name = "互斥的故障ID")
-    private String conflictFaultId;
+    @Excel(name = "互斥所有故障ID逗号分割")
+    private String conflictFaultIds;
 
     /**
      * 是否是更换件 1:是 0:不是
@@ -68,10 +68,10 @@ public class Fault extends BaseEntity implements Comparable<Fault> {
     private String name;
 
     /**
-     * 通信报文
+     * 绑定硬件通信报文
      */
-    @Excel(name = "通信报文")
-    private String simMsg;
+    @Excel(name = "绑定硬件通信报文")
+    private String bindHardwareMsg;
 
     /**
      * 显示顺序
@@ -111,12 +111,12 @@ public class Fault extends BaseEntity implements Comparable<Fault> {
         return faultType;
     }
 
-    public void setConflictFaultId(String conflictFaultId) {
-        this.conflictFaultId = conflictFaultId;
+    public void setConflictFaultIds(String conflictFaultIds) {
+        this.conflictFaultIds = conflictFaultIds;
     }
 
-    public String getConflictFaultId() {
-        return conflictFaultId;
+    public String getConflictFaultIds() {
+        return conflictFaultIds;
     }
 
     public void setReplacePart(String replacePart) {
@@ -143,12 +143,12 @@ public class Fault extends BaseEntity implements Comparable<Fault> {
         return name;
     }
 
-    public void setSimMsg(String simMsg) {
-        this.simMsg = simMsg;
+    public void setBindHardwareMsg(String bindHardwareMsg) {
+        this.bindHardwareMsg = bindHardwareMsg;
     }
 
-    public String getSimMsg() {
-        return simMsg;
+    public String getBindHardwareMsg() {
+        return bindHardwareMsg;
     }
 
     public void setOrderNum(Integer orderNum) {
@@ -166,11 +166,11 @@ public class Fault extends BaseEntity implements Comparable<Fault> {
                 .append("parentFaultId", getParentFaultId())
                 .append("simType", getSimType())
                 .append("faultType", getFaultType())
-                .append("conflictFaultId", getConflictFaultId())
+                .append("conflictFaultIds", getConflictFaultIds())
                 .append("replacePart", getReplacePart())
                 .append("replaceName", getReplaceName())
                 .append("name", getName())
-                .append("simMsg", getSimMsg())
+                .append("bindHardwareMsg", getBindHardwareMsg())
                 .append("orderNum", getOrderNum())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())

+ 83 - 18
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExamFault.java

@@ -9,13 +9,13 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 考试故障关联对象 sim_real_exam_fault
  *
  * @author tom
- * @date 2024-12-15
+ * @date 2024-12-18
  */
 public class RealExamFault extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
-     * $column.columnComment
+     * 关联ID
      */
     private Long refId;
 
@@ -32,6 +32,12 @@ public class RealExamFault extends BaseEntity {
     private String faultId;
 
     /**
+     * 关联类型 1:选择题 2:模拟器维修故障
+     */
+    @Excel(name = "关联类型 1:选择题 2:模拟器维修故障")
+    private String refType;
+
+    /**
      * 7:未知
      * 1:选中
      * 0:没有选中
@@ -40,16 +46,39 @@ public class RealExamFault extends BaseEntity {
     private String flag;
 
     /**
-     * 出题数值
+     * 故障ID关联状态
+     * 0:初始化
+     * 1:已经清除故障
+     * 2:故障已经下发
+     * 3:轮训读取刷新电阻代表值
+     * 3:考试结束
+     */
+    @Excel(name = "故障ID关联状态")
+    private String refState;
+
+    /**
+     * 选择题的出题数值/正确答案
+     */
+    @Excel(name = "选择题的出题数值/正确答案")
+    private String choiceQuestionValue;
+
+    /**
+     * 选择题的答题数值/学院填写答案
      */
-    @Excel(name = "出题数值")
-    private String questionValue;
+    @Excel(name = "选择题的答题数值/学院填写答案")
+    private String choiceAnswerValue;
 
     /**
-     * 答题数值
+     * 模拟器出题值/电阻代表
      */
-    @Excel(name = "答题数值")
-    private String answerValue;
+    @Excel(name = "模拟器出题值/电阻代表值")
+    private String simFaultQuestionValue;
+
+    /**
+     * 模拟器答题值/电阻代表值
+     */
+    @Excel(name = "模拟器答题值/电阻代表值")
+    private String simFaultAnswerValue;
 
     /**
      * 减分值 计正数
@@ -81,6 +110,14 @@ public class RealExamFault extends BaseEntity {
         return faultId;
     }
 
+    public void setRefType(String refType) {
+        this.refType = refType;
+    }
+
+    public String getRefType() {
+        return refType;
+    }
+
     public void setFlag(String flag) {
         this.flag = flag;
     }
@@ -89,20 +126,44 @@ public class RealExamFault extends BaseEntity {
         return flag;
     }
 
-    public void setQuestionValue(String questionValue) {
-        this.questionValue = questionValue;
+    public void setRefState(String refState) {
+        this.refState = refState;
+    }
+
+    public String getRefState() {
+        return refState;
+    }
+
+    public void setChoiceQuestionValue(String choiceQuestionValue) {
+        this.choiceQuestionValue = choiceQuestionValue;
+    }
+
+    public String getChoiceQuestionValue() {
+        return choiceQuestionValue;
+    }
+
+    public void setChoiceAnswerValue(String choiceAnswerValue) {
+        this.choiceAnswerValue = choiceAnswerValue;
+    }
+
+    public String getChoiceAnswerValue() {
+        return choiceAnswerValue;
+    }
+
+    public void setSimFaultQuestionValue(String simFaultQuestionValue) {
+        this.simFaultQuestionValue = simFaultQuestionValue;
     }
 
-    public String getQuestionValue() {
-        return questionValue;
+    public String getSimFaultQuestionValue() {
+        return simFaultQuestionValue;
     }
 
-    public void setAnswerValue(String answerValue) {
-        this.answerValue = answerValue;
+    public void setSimFaultAnswerValue(String simFaultAnswerValue) {
+        this.simFaultAnswerValue = simFaultAnswerValue;
     }
 
-    public String getAnswerValue() {
-        return answerValue;
+    public String getSimFaultAnswerValue() {
+        return simFaultAnswerValue;
     }
 
     public void setMinus(Integer minus) {
@@ -119,9 +180,13 @@ public class RealExamFault extends BaseEntity {
                 .append("refId", getRefId())
                 .append("examId", getExamId())
                 .append("faultId", getFaultId())
+                .append("refType", getRefType())
                 .append("flag", getFlag())
-                .append("questionValue", getQuestionValue())
-                .append("answerValue", getAnswerValue())
+                .append("refState", getRefState())
+                .append("choiceQuestionValue", getChoiceQuestionValue())
+                .append("choiceAnswerValue", getChoiceAnswerValue())
+                .append("simFaultQuestionValue", getSimFaultQuestionValue())
+                .append("simFaultAnswerValue", getSimFaultAnswerValue())
                 .append("minus", getMinus())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())

+ 69 - 2
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Sim.java

@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.*;
+
 /**
  * 模拟器对象 sim_sim
  *
@@ -12,6 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @date 2024-12-13
  */
 public class Sim extends BaseEntity {
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -32,9 +35,9 @@ public class Sim extends BaseEntity {
     private String simType;
 
     /**
-     * 模拟器在线 1:在线 2:离线 3:硬件故障异常
+     * 模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用
      */
-    @Excel(name = "模拟器在线 1:在线 2:离线 3:硬件故障异常")
+    @Excel(name = "模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用")
     private String simState;
 
     /**
@@ -43,6 +46,12 @@ public class Sim extends BaseEntity {
     @Excel(name = "模拟器序列号")
     private String simSn;
 
+    /**
+     * 模拟器设备编号1~30
+     */
+    @Excel(name = "模拟器设备编号1~30")
+    private String simNum;
+
     public void setSimId(Long simId) {
         this.simId = simId;
     }
@@ -83,6 +92,14 @@ public class Sim extends BaseEntity {
         return simSn;
     }
 
+    public void setSimNum(String simNum) {
+        this.simNum = simNum;
+    }
+
+    public String getSimNum() {
+        return simNum;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -91,6 +108,7 @@ public class Sim extends BaseEntity {
                 .append("simType", getSimType())
                 .append("simState", getSimState())
                 .append("simSn", getSimSn())
+                .append("simNum", getSimNum())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())
@@ -98,4 +116,53 @@ public class Sim extends BaseEntity {
                 .append("remark", getRemark())
                 .toString();
     }
+
+    // -------------------------------- tom add  --------------------------------
+    /**
+     * FZD04B
+     */
+    public static final String TYPE_0001 = "0001";
+    /**
+     * FZB006
+     */
+    public static final String TYPE_0002 = "0002";
+    /**
+     * 防化兵用毒剂报警器
+     */
+    public static final String TYPE_0003 = "0003";
+
+    public static final Set<String> TYPE_SET = new HashSet<>(
+            Arrays.asList(
+                    TYPE_0001,
+                    TYPE_0002,
+                    TYPE_0003
+            )
+    );
+
+    public static final String TYPE_0001_NAME = "FZD04B";
+    public static final String TYPE_0002_NAME = "FZB006";
+    public static final String TYPE_0003_NAME = "防化兵用毒剂报警器";
+
+    public static final Map<String, String> TYPE_NAME_MAP = Map.ofEntries(
+            Map.entry(TYPE_0001, TYPE_0001_NAME),
+            Map.entry(TYPE_0002, TYPE_0002_NAME),
+            Map.entry(TYPE_0003, TYPE_0003_NAME)
+    );
+
+    public static String STATE_ENABLE_INIT = "0";
+    public static String STATE_ONLINE = "1";
+    public static String STATE_SIM_OFFLINE = "2";
+    public static String STATE_GATEWAY_OFFLINE = "3";
+    public static String STATE_SIM_ERROR = "4";
+    public static String STATE_DISABLE = "5";
+
+    public static final Set<String> STATE_SET = new HashSet<>(
+            Arrays.asList(
+                    STATE_ONLINE,
+                    STATE_SIM_OFFLINE,
+                    STATE_GATEWAY_OFFLINE,
+                    STATE_SIM_ERROR,
+                    STATE_DISABLE
+            )
+    );
 }

+ 56 - 7
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/SimMsg.java

@@ -12,9 +12,10 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 模拟器报文对象 sim_sim_msg
  *
  * @author tom
- * @date 2024-12-11
+ * @date 2024-12-18
  */
 public class SimMsg extends BaseEntity {
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -29,10 +30,25 @@ public class SimMsg extends BaseEntity {
     private Long simId;
 
     /**
+     * 关联ID
+     */
+    @Excel(name = "关联ID")
+    private Long examFaultRefId;
+
+    /**
+     * 考试类型
+     * 1:练习
+     * 2:自主练习
+     * 3:考试
+     */
+    @Excel(name = "考试类型")
+    private String examCollectionType;
+
+    /**
      * 状态 0初始值 1成功 2失败
      */
     @Excel(name = "状态 0初始值 1成功 2失败")
-    private String state;
+    private String sendMsgState;
 
     /**
      * 优先级
@@ -41,6 +57,12 @@ public class SimMsg extends BaseEntity {
     private Integer priority;
 
     /**
+     * 发送报文类型 cmd+cmdId
+     */
+    @Excel(name = "发送报文类型 cmd+cmdId")
+    private String sendMsgType;
+
+    /**
      * 发送报文
      */
     @Excel(name = "发送报文")
@@ -88,12 +110,28 @@ public class SimMsg extends BaseEntity {
         return simId;
     }
 
-    public void setState(String state) {
-        this.state = state;
+    public void setExamFaultRefId(Long examFaultRefId) {
+        this.examFaultRefId = examFaultRefId;
+    }
+
+    public Long getExamFaultRefId() {
+        return examFaultRefId;
+    }
+
+    public void setExamCollectionType(String examCollectionType) {
+        this.examCollectionType = examCollectionType;
     }
 
-    public String getState() {
-        return state;
+    public String getExamCollectionType() {
+        return examCollectionType;
+    }
+
+    public void setSendMsgState(String sendMsgState) {
+        this.sendMsgState = sendMsgState;
+    }
+
+    public String getSendMsgState() {
+        return sendMsgState;
     }
 
     public void setPriority(Integer priority) {
@@ -104,6 +142,14 @@ public class SimMsg extends BaseEntity {
         return priority;
     }
 
+    public void setSendMsgType(String sendMsgType) {
+        this.sendMsgType = sendMsgType;
+    }
+
+    public String getSendMsgType() {
+        return sendMsgType;
+    }
+
     public void setSendMsg(String sendMsg) {
         this.sendMsg = sendMsg;
     }
@@ -149,8 +195,11 @@ public class SimMsg extends BaseEntity {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                 .append("simMsgId", getSimMsgId())
                 .append("simId", getSimId())
-                .append("state", getState())
+                .append("examFaultRefId", getExamFaultRefId())
+                .append("examCollectionType", getExamCollectionType())
+                .append("sendMsgState", getSendMsgState())
                 .append("priority", getPriority())
+                .append("sendMsgType", getSendMsgType())
                 .append("sendMsg", getSendMsg())
                 .append("sendTime", getSendTime())
                 .append("receiveMsg", getReceiveMsg())

+ 3 - 19
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/FaultService.java

@@ -90,8 +90,9 @@ public class FaultService {
     }
 
     // -------------------------------- tom add  --------------------------------
-
     private static final Logger log = LoggerFactory.getLogger(FaultService.class);
+    @Autowired
+    private SimService simService;
 
     /**
      * 查询故障列表tree
@@ -103,7 +104,7 @@ public class FaultService {
         if (StringUtils.isEmpty(simType)) {
             return AjaxResult.error("simType empty!");
         }
-        if (!checkSimTypeOk(simType)) {
+        if (!simService.checkSimTypeOk(simType)) {
             return AjaxResult.error("simType value error!");
         }
         // query obj.
@@ -131,23 +132,6 @@ public class FaultService {
         return AjaxResult.success(tree);
     }
 
-    public static final String SIM_TYPE_0001 = "0001";
-    public static final String SIM_TYPE_0002 = "0002";
-    public static final String SIM_TYPE_0003 = "0003";
-    public static final Set<String> SIM_TYPE_SET = new HashSet<>(
-            Arrays.asList(
-                    SIM_TYPE_0001,
-                    SIM_TYPE_0002,
-                    SIM_TYPE_0003)
-    );
-
-    /**
-     * @param simType
-     * @return
-     */
-    public boolean checkSimTypeOk(String simType) {
-        return SIM_TYPE_SET.contains(simType);
-    }
 
 //    private static List<FaultNode> toTree2(List<FaultNode> list) {
 //        List<FaultNode> tree = new ArrayList<>();

+ 148 - 110
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/IotService.java

@@ -1,6 +1,9 @@
 package com.ruoyi.sim.service.impl;
 
 import com.ruoyi.sim.config.SimConfig;
+import com.ruoyi.sim.domain.Sim;
+import com.ruoyi.sim.domain.SimMsg;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,19 +14,22 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetAddress;
 import java.net.Socket;
+import java.util.Objects;
 
 import static com.ruoyi.sim.service.impl.IotService.Const.*;
 
 /**
  * 硬件通信
+ * send service.
  */
 @Service
 public class IotService {
 
     interface Const {
 
-        String IP = "127.0.0.1";
-        int PORT = 9000;
+        String ROUTER_IP = "127.0.0.1";
+        String IP = "123.112.16.165";
+        int PORT = 8899;
         /**
          * 报文长度
          */
@@ -45,125 +51,152 @@ public class IotService {
 
         String CMD_DATA_PLACE_HOLDER = "00000000";
 
-        String CMD_READ = "03";
-
-        String CMD_GET_SIM_TYPE = "B1";
-
+        /**
+         * 故障下发
+         */
         String CMD_SET_FAULT = "01";
+        /**
+         * 故障清清除
+         */
+        String CMD_CLEAR_FAULT = "02";
+        /**
+         * 设备类型读取
+         */
+        String CMD_READ_TYPE = "03";
+        /**
+         * 状态读取 RESISTANCE电阻值
+         */
+        String CMD_READ_FAULT_RESISTANCE = "03";
 
-        String CMD_READ_SIM_FAULT_STATE = "03";
-
-        String CMD_CLEAR_SIM_FAULT = "02";
+        String CMD_ID_GET_SN = "B1";
+        int LENGTH_2 = 2;
+        int LENGTH_8 = 8;
+        int LENGTH_20 = 20;
     }
 
-    private static final Logger logger = LoggerFactory.getLogger(IotService.class);
-
+    private static final Logger l = LoggerFactory.getLogger(IotService.class);
+    /**
+     * 缓存的Socket连接。
+     */
     private Socket cachedSocket = null;
-
+    @Autowired
+    private SimReceiveService simReceiveService;
     @Autowired
     private SimConfig sc;
 
     /**
-     * 检查所有模拟器状态
+     * 初始化方法,项目启动后自动运行。
+     */
+    public void init() {
+        //
+        try {
+            if (!isReachable(ROUTER_IP)) {
+                // todo:ping 不通。
+            }
+            if (!isReachable(IP)) {
+                // todo:ping 不通。
+            }
+            openSocket();
+            //
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 定时。
+     */
+    public void scheduledCheckAllSimState() {
+
+    }
+
+    /**
+     * 查找所有没有被手动禁用,并order by sim_num的模拟器列表。检查所有模拟器状态。
      */
-    public void checkAllSim() {
+    public void checkAllSimState() {
+
+    }
 
+    public void checkOneSimState(final Sim s) {
+        if (Objects.isNull(s)) {
+            return;
+        }
+        try {
+            SimMsg sm = new SimMsg();
+            // "s.getSimNum()"
+            String sendMsg = buildSendMsgReadSimType("s.getSimNum()");
+            sm.setSendMsg(sendMsg);
+            String receiveMsg = send(sendMsg);
+            sm.setReceiveMsg(receiveMsg);
+            simReceiveService.checkOneSimState(sm);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /**
      * 设备类型读取
      *
-     * @param simNum 设备编号
+     * @param simNum sim.sim_num
      */
-    public void getSimType(final String simNum) {
-        // todo:check
-
-        //
-        StringBuffer m = new StringBuffer();
-        m.append(PREFIX);
-        m.append(simNum);
-        m.append(ORN_SEND);
-        m.append(CMD_READ);
-        m.append(CMD_GET_SIM_TYPE);
-        m.append(CMD_DATA_PLACE_HOLDER);
-        m.append(SUFFIX);
-        final String sendMsg = m.toString();
-        final String receiveMsg = send(sendMsg);
+    public String buildSendMsgReadSimType(final String simNum) {
+        return buildSendMsg(simNum, CMD_READ_TYPE, CMD_ID_GET_SN);
     }
 
     /**
      * 故障下发
      *
-     * @param simNum    设备编号
-     * @param faultType 故障类型
+     * @param simNum          sim.sim_num
+     * @param bindHardwareMsg fault.bind_hardware_msg
      */
-    public void setFault(final String simNum, final String faultType) {
-        // todo:check
-
-        //
-        StringBuffer m = new StringBuffer();
-        m.append(PREFIX);
-        m.append(simNum);
-        m.append(ORN_SEND);
-        m.append(CMD_SET_FAULT);
-        m.append(faultType);
-        m.append(CMD_DATA_PLACE_HOLDER);
-        m.append(SUFFIX);
-        //
-
-        //
-        final String receiveMsg = send(m.toString());
-        //
+    public String buildSendMsgWriteFault(final String simNum, final String bindHardwareMsg) {
+        return buildSendMsg(simNum, CMD_SET_FAULT, bindHardwareMsg);
     }
 
     /**
      * 状态读取
      *
-     * @param simNum    设备编号
-     * @param faultType 故障类型
+     * @param simNum          sim.sim_num
+     * @param bindHardwareMsg fault.bind_hardware_msg
      */
-    public void getSimStatus(final String simNum, final String faultType) {
-        // todo:check
-
-        //
-        StringBuffer m = new StringBuffer();
-        m.append(PREFIX);
-        m.append(simNum);
-        m.append(ORN_SEND);
-        m.append(CMD_READ_SIM_FAULT_STATE);
-        m.append(faultType);
-        m.append(CMD_DATA_PLACE_HOLDER);
-        m.append(SUFFIX);
-        //
-
-        //
-        final String receiveMsg = send(m.toString());
-        //
+    public String buildSendMsgReadFaultResistance(final String simNum, final String bindHardwareMsg) {
+        return buildSendMsg(simNum, CMD_READ_FAULT_RESISTANCE, bindHardwareMsg);
     }
 
     /**
      * 故障清清除
      *
-     * @param simNum    设备编号
-     * @param faultType 故障类型
+     * @param simNum          sim.sim_num
+     * @param bindHardwareMsg fault.bind_hardware_msg
      */
-    public void clearSimStatus(final String simNum, final String faultType) {
-        // todo:check
+    public String buildSendMsgClearFault(final String simNum, final String bindHardwareMsg) {
+        return buildSendMsg(simNum, CMD_CLEAR_FAULT, bindHardwareMsg);
+    }
 
-        //
+    public String buildSendMsg(final String simNum, final String cmd, final String cmdId) {
+        return buildSendMsg(simNum, cmd, cmdId, CMD_DATA_PLACE_HOLDER);
+    }
+
+    public String buildSendMsg(final String simNum, final String cmd, final String cmdId, final String data) {
+        if (StringUtils.isEmpty(simNum) || StringUtils.isEmpty(cmd) || StringUtils.isEmpty(cmdId) || StringUtils.isEmpty(data)) {
+            throw new IllegalArgumentException("buildSendMsg isEmpty");
+        }
+        if (simNum.length() != LENGTH_2 || cmd.length() != LENGTH_2 || cmdId.length() != LENGTH_2 || data.length() != LENGTH_8) {
+            throw new IllegalArgumentException("buildSendMsg length error");
+        }
         StringBuffer m = new StringBuffer();
         m.append(PREFIX);
         m.append(simNum);
         m.append(ORN_SEND);
-        m.append(CMD_CLEAR_SIM_FAULT);
-        m.append(faultType);
-        m.append(CMD_DATA_PLACE_HOLDER);
+        m.append(cmd);
+        m.append(cmdId);
+        m.append(data);
         m.append(SUFFIX);
-        //
-
-        //
-        final String receiveMsg = send(m.toString());
-        //
+        final String mFinal = m.toString();
+        if (mFinal.length() != LENGTH_20) {
+            throw new IllegalArgumentException("buildSendMsg length error");
+        }
+        return mFinal;
     }
 
     /**
@@ -172,45 +205,43 @@ public class IotService {
      * @param sendMsg
      * @return
      */
-    public String send(final String sendMsg) {
-        logger.info("sendMsg");
-        logger.info(sendMsg);
+    public String send(final String sendMsg) throws IOException {
+        l.info("sendMsg = " + sendMsg);
         String receiveMsg = null;
-        try {
-            if (cachedSocket == null) {
-                cachedSocket = new Socket(IP, PORT);
-            }
-            InputStream is = cachedSocket.getInputStream();
-            OutputStream os = cachedSocket.getOutputStream();
-            os.write(hexStrToByteArrs(sendMsg));
-            byte[] buffer = new byte[1024];
-            int length = is.read(buffer);
-            StringBuffer sbHex = new StringBuffer();
-            for (int i = 0; i < length; i++) {
-                sbHex.append(String.format("%02X", buffer[i]));
-            }
-            receiveMsg = sbHex.toString();
-        } catch (IOException e) {
-            e.printStackTrace();
+        if (cachedSocket == null) {
+            openSocket();
+        }
+        InputStream is = cachedSocket.getInputStream();
+        OutputStream os = cachedSocket.getOutputStream();
+        os.write(hexStrToByteArrs(sendMsg));
+        byte[] buffer = new byte[1024];
+        int length = is.read(buffer);
+        StringBuffer sbHex = new StringBuffer();
+        for (int i = 0; i < length; i++) {
+            sbHex.append(String.format("%02X", buffer[i]));
         }
-        logger.info("receiveMsg");
-        logger.info(receiveMsg);
+        receiveMsg = sbHex.toString();
+        l.info("receiveMsg = " + receiveMsg);
         return receiveMsg;
     }
 
+    public void openSocket() throws IOException {
+
+        if (cachedSocket == null) {
+            cachedSocket = new Socket(IP, PORT);
+        }
+    }
+
     /**
+     * todo:异常精细处理
      *
+     * @throws IOException
      */
-    public void close() {
-        try {
-            if (cachedSocket != null) {
-                cachedSocket.close();
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        } finally {
-            cachedSocket = null;
+    public void closeSocket() throws IOException {
+        if (cachedSocket != null) {
+            cachedSocket.close();
         }
+        cachedSocket = null;
     }
 
     public byte[] hexStrToByteArrs(String hexString) {
@@ -231,6 +262,13 @@ public class IotService {
         return bytes;
     }
 
+    /**
+     * ping
+     *
+     * @param ipV4
+     * @return
+     * @throws IOException
+     */
     public boolean isReachable(String ipV4) throws IOException {
         InetAddress ia = InetAddress.getByName(ipV4);
         return ia.isReachable(sc.getGatewayReachableTimeout());

+ 20 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimReceiveService.java

@@ -0,0 +1,20 @@
+package com.ruoyi.sim.service.impl;
+
+import com.ruoyi.sim.domain.SimMsg;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+@Service
+// 多实例
+// 异步调用
+// @Scope("prototype")
+public class SimReceiveService {
+
+    private static final Logger l = LoggerFactory.getLogger(IotService.class);
+
+    public void checkOneSimState(SimMsg sm) {
+
+    }
+}

+ 78 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimService.java

@@ -1,8 +1,10 @@
 package com.ruoyi.sim.service.impl;
 
 import java.util.List;
+import java.util.Objects;
 
 import com.ruoyi.common.utils.DateUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.sim.mapper.SimMapper;
@@ -16,6 +18,7 @@ import com.ruoyi.sim.domain.Sim;
  */
 @Service
 public class SimService {
+
     @Autowired
     private SimMapper simMapper;
 
@@ -80,4 +83,79 @@ public class SimService {
     public int deleteSimBySimId(Long simId) {
         return simMapper.deleteSimBySimId(simId);
     }
+
+    // -------------------------------- tom add  --------------------------------
+
+    public List<String> listSimTypes() {
+        return Sim.TYPE_SET.stream().toList();
+    }
+
+    public boolean checkSimTypeOk(String simType) {
+        return Sim.TYPE_SET.contains(simType);
+    }
+
+    public boolean checkState(String simState) {
+        return Sim.STATE_SET.contains(simState);
+    }
+
+    public int updateSimStateBySimId(Long simId, String simState) {
+        // check
+        if (checkState(simState)) {
+
+        }
+        //
+        Sim q = selectSimBySimId(simId);
+        if (Objects.isNull(q)) {
+            return 0;
+        }
+        q.setSimState(simState);
+        return updateSim(q);
+    }
+
+    public boolean isSimStateBySimId(Long simId, String simState) {
+        // check
+        if (checkState(simState)) {
+
+        }
+        Sim q = selectSimBySimId(simId);
+        if (Objects.isNull(q)) {
+            return false;
+        }
+        return (q.getSimState().equals(simState));
+    }
+
+    public boolean isSimDisable(Long simId) {
+        return isSimStateBySimId(simId, Sim.STATE_DISABLE);
+    }
+
+    public int updateSimSnBySimId(Long simId, String simSn) {
+        // check
+        if (StringUtils.isEmpty(simSn)) {
+            return 0;
+        }
+        //
+        Sim q = selectSimBySimId(simId);
+        if (Objects.isNull(q)) {
+            return 0;
+        }
+        q.setSimSn(simSn);
+        q.setUpdateTime(DateUtils.getNowDate());
+        return updateSim(q);
+    }
+
+    public int updateAllEnableStateInit() {
+        List<Sim> list = simMapper.selectSimList(new Sim());
+        int count = 0;
+        for (Sim o : list) {
+            if (o == null) {
+                continue;
+            }
+            if (!Objects.equals(o.getSimState(), Sim.STATE_DISABLE)) {
+                o.setSimState(Sim.STATE_ENABLE_INIT);
+            }
+            updateSim(o);
+            count = count + 1;
+        }
+        return count;
+    }
 }

+ 12 - 9
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/TaskService.java

@@ -28,8 +28,17 @@ import org.springframework.transaction.annotation.Transactional;
  */
 @Service
 public class TaskService {
+
+    private static final Logger l = LoggerFactory.getLogger(TaskService.class);
+
     @Autowired
     private TaskMapper taskMapper;
+    @Autowired
+    private FaultService faultService;
+    @Autowired
+    private TaskFaultService taskFaultService;
+    @Autowired
+    private SimService simService;
 
     /**
      * 查询任务
@@ -95,7 +104,7 @@ public class TaskService {
         if (tv == null) {
             return AjaxResult.error("TaskVo empty!");
         }
-        if (!faultService.checkSimTypeOk(tv.getSimType())) {
+        if (!simService.checkSimTypeOk(tv.getSimType())) {
             return AjaxResult.error("simType error!");
         }
         if (!Task.TASK_TYPE_TEACHER_ADD.equals(tv.getTaskType())) {
@@ -176,12 +185,6 @@ public class TaskService {
         return taskMapper.deleteTaskByTaskId(taskId);
     }
 
-    // -------------------------------- tom add  --------------------------------
-    private static final Logger l = LoggerFactory.getLogger(TaskService.class);
-    @Autowired
-    private FaultService faultService;
-    @Autowired
-    private TaskFaultService taskFaultService;
 
     /**
      * 新增任务
@@ -197,7 +200,7 @@ public class TaskService {
         if (tv == null) {
             return AjaxResult.error("TaskVo empty!");
         }
-        if (!faultService.checkSimTypeOk(tv.getSimType())) {
+        if (!simService.checkSimTypeOk(tv.getSimType())) {
             return AjaxResult.error("simType error!");
         }
         if (!Task.TASK_TYPE_TEACHER_ADD.equals(tv.getTaskType())) {
@@ -259,7 +262,7 @@ public class TaskService {
         if (StringUtils.isEmpty(simType)) {
             return AjaxResult.error("simType empty!");
         }
-        if (!faultService.checkSimTypeOk(simType)) {
+        if (!simService.checkSimTypeOk(simType)) {
             return AjaxResult.error("simType value error!");
         }
         // query obj.

+ 15 - 12
ruoyi-sim/src/main/resources/mapper/sim/FaultMapper.xml

@@ -9,11 +9,11 @@
         <result property="parentFaultId" column="parent_fault_id"/>
         <result property="simType" column="sim_type"/>
         <result property="faultType" column="fault_type"/>
-        <result property="conflictFaultId" column="conflict_fault_id"/>
+        <result property="conflictFaultIds" column="conflict_fault_ids"/>
         <result property="replacePart" column="replace_part"/>
         <result property="replaceName" column="replace_name"/>
         <result property="name" column="name"/>
-        <result property="simMsg" column="sim_msg"/>
+        <result property="bindHardwareMsg" column="bind_hardware_msg"/>
         <result property="orderNum" column="order_num"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -27,11 +27,11 @@
                parent_fault_id,
                sim_type,
                fault_type,
-               conflict_fault_id,
+               conflict_fault_ids,
                replace_part,
                replace_name,
                name,
-               sim_msg,
+               bind_hardware_msg,
                order_num,
                create_by,
                create_time,
@@ -47,14 +47,16 @@
             <if test="parentFaultId != null  and parentFaultId != ''">and parent_fault_id = #{parentFaultId}</if>
             <if test="simType != null  and simType != ''">and sim_type = #{simType}</if>
             <if test="faultType != null  and faultType != ''">and fault_type = #{faultType}</if>
-            <if test="conflictFaultId != null  and conflictFaultId != ''">and conflict_fault_id = #{conflictFaultId}
+            <if test="conflictFaultIds != null  and conflictFaultIds != ''">and conflict_fault_ids =
+                #{conflictFaultIds}
             </if>
             <if test="replacePart != null  and replacePart != ''">and replace_part = #{replacePart}</if>
             <if test="replaceName != null  and replaceName != ''">and replace_name like concat('%', #{replaceName},
                 '%')
             </if>
             <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
-            <if test="simMsg != null  and simMsg != ''">and sim_msg = #{simMsg}</if>
+            <if test="bindHardwareMsg != null  and bindHardwareMsg != ''">and bind_hardware_msg = #{bindHardwareMsg}
+            </if>
             <if test="orderNum != null ">and order_num = #{orderNum}</if>
         </where>
     </select>
@@ -71,11 +73,11 @@
             <if test="parentFaultId != null and parentFaultId != ''">parent_fault_id,</if>
             <if test="simType != null and simType != ''">sim_type,</if>
             <if test="faultType != null">fault_type,</if>
-            <if test="conflictFaultId != null">conflict_fault_id,</if>
+            <if test="conflictFaultIds != null and conflictFaultIds != ''">conflict_fault_ids,</if>
             <if test="replacePart != null">replace_part,</if>
             <if test="replaceName != null">replace_name,</if>
             <if test="name != null">name,</if>
-            <if test="simMsg != null">sim_msg,</if>
+            <if test="bindHardwareMsg != null and bindHardwareMsg != ''">bind_hardware_msg,</if>
             <if test="orderNum != null">order_num,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -88,11 +90,11 @@
             <if test="parentFaultId != null and parentFaultId != ''">#{parentFaultId},</if>
             <if test="simType != null and simType != ''">#{simType},</if>
             <if test="faultType != null">#{faultType},</if>
-            <if test="conflictFaultId != null">#{conflictFaultId},</if>
+            <if test="conflictFaultIds != null and conflictFaultIds != ''">#{conflictFaultIds},</if>
             <if test="replacePart != null">#{replacePart},</if>
             <if test="replaceName != null">#{replaceName},</if>
             <if test="name != null">#{name},</if>
-            <if test="simMsg != null">#{simMsg},</if>
+            <if test="bindHardwareMsg != null and bindHardwareMsg != ''">#{bindHardwareMsg},</if>
             <if test="orderNum != null">#{orderNum},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -108,11 +110,12 @@
             <if test="parentFaultId != null and parentFaultId != ''">parent_fault_id = #{parentFaultId},</if>
             <if test="simType != null and simType != ''">sim_type = #{simType},</if>
             <if test="faultType != null">fault_type = #{faultType},</if>
-            <if test="conflictFaultId != null">conflict_fault_id = #{conflictFaultId},</if>
+            <if test="conflictFaultIds != null and conflictFaultIds != ''">conflict_fault_ids = #{conflictFaultIds},
+            </if>
             <if test="replacePart != null">replace_part = #{replacePart},</if>
             <if test="replaceName != null">replace_name = #{replaceName},</if>
             <if test="name != null">name = #{name},</if>
-            <if test="simMsg != null">sim_msg = #{simMsg},</if>
+            <if test="bindHardwareMsg != null and bindHardwareMsg != ''">bind_hardware_msg = #{bindHardwareMsg},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 44 - 12
ruoyi-sim/src/main/resources/mapper/sim/RealExamFaultMapper.xml

@@ -8,9 +8,13 @@
         <result property="refId" column="ref_id"/>
         <result property="examId" column="exam_id"/>
         <result property="faultId" column="fault_id"/>
+        <result property="refType" column="ref_type"/>
         <result property="flag" column="flag"/>
-        <result property="questionValue" column="question_value"/>
-        <result property="answerValue" column="answer_value"/>
+        <result property="refState" column="ref_state"/>
+        <result property="choiceQuestionValue" column="choice_question_value"/>
+        <result property="choiceAnswerValue" column="choice_answer_value"/>
+        <result property="simFaultQuestionValue" column="sim_fault_question_value"/>
+        <result property="simFaultAnswerValue" column="sim_fault_answer_value"/>
         <result property="minus" column="minus"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -23,9 +27,13 @@
         select ref_id,
                exam_id,
                fault_id,
+               ref_type,
                flag,
-               question_value,
-               answer_value,
+               ref_state,
+               choice_question_value,
+               choice_answer_value,
+               sim_fault_question_value,
+               sim_fault_answer_value,
                minus,
                create_by,
                create_time,
@@ -40,9 +48,21 @@
         <where>
             <if test="examId != null ">and exam_id = #{examId}</if>
             <if test="faultId != null  and faultId != ''">and fault_id = #{faultId}</if>
+            <if test="refType != null  and refType != ''">and ref_type = #{refType}</if>
             <if test="flag != null  and flag != ''">and flag = #{flag}</if>
-            <if test="questionValue != null  and questionValue != ''">and question_value = #{questionValue}</if>
-            <if test="answerValue != null  and answerValue != ''">and answer_value = #{answerValue}</if>
+            <if test="refState != null  and refState != ''">and ref_state = #{refState}</if>
+            <if test="choiceQuestionValue != null  and choiceQuestionValue != ''">and choice_question_value =
+                #{choiceQuestionValue}
+            </if>
+            <if test="choiceAnswerValue != null  and choiceAnswerValue != ''">and choice_answer_value =
+                #{choiceAnswerValue}
+            </if>
+            <if test="simFaultQuestionValue != null  and simFaultQuestionValue != ''">and sim_fault_question_value =
+                #{simFaultQuestionValue}
+            </if>
+            <if test="simFaultAnswerValue != null  and simFaultAnswerValue != ''">and sim_fault_answer_value =
+                #{simFaultAnswerValue}
+            </if>
             <if test="minus != null ">and minus = #{minus}</if>
         </where>
     </select>
@@ -57,9 +77,13 @@
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="examId != null">exam_id,</if>
             <if test="faultId != null and faultId != ''">fault_id,</if>
+            <if test="refType != null and refType != ''">ref_type,</if>
             <if test="flag != null and flag != ''">flag,</if>
-            <if test="questionValue != null">question_value,</if>
-            <if test="answerValue != null">answer_value,</if>
+            <if test="refState != null and refState != ''">ref_state,</if>
+            <if test="choiceQuestionValue != null">choice_question_value,</if>
+            <if test="choiceAnswerValue != null">choice_answer_value,</if>
+            <if test="simFaultQuestionValue != null">sim_fault_question_value,</if>
+            <if test="simFaultAnswerValue != null">sim_fault_answer_value,</if>
             <if test="minus != null">minus,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -70,9 +94,13 @@
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="examId != null">#{examId},</if>
             <if test="faultId != null and faultId != ''">#{faultId},</if>
+            <if test="refType != null and refType != ''">#{refType},</if>
             <if test="flag != null and flag != ''">#{flag},</if>
-            <if test="questionValue != null">#{questionValue},</if>
-            <if test="answerValue != null">#{answerValue},</if>
+            <if test="refState != null and refState != ''">#{refState},</if>
+            <if test="choiceQuestionValue != null">#{choiceQuestionValue},</if>
+            <if test="choiceAnswerValue != null">#{choiceAnswerValue},</if>
+            <if test="simFaultQuestionValue != null">#{simFaultQuestionValue},</if>
+            <if test="simFaultAnswerValue != null">#{simFaultAnswerValue},</if>
             <if test="minus != null">#{minus},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -87,9 +115,13 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="examId != null">exam_id = #{examId},</if>
             <if test="faultId != null and faultId != ''">fault_id = #{faultId},</if>
+            <if test="refType != null and refType != ''">ref_type = #{refType},</if>
             <if test="flag != null and flag != ''">flag = #{flag},</if>
-            <if test="questionValue != null">question_value = #{questionValue},</if>
-            <if test="answerValue != null">answer_value = #{answerValue},</if>
+            <if test="refState != null and refState != ''">ref_state = #{refState},</if>
+            <if test="choiceQuestionValue != null">choice_question_value = #{choiceQuestionValue},</if>
+            <if test="choiceAnswerValue != null">choice_answer_value = #{choiceAnswerValue},</if>
+            <if test="simFaultQuestionValue != null">sim_fault_question_value = #{simFaultQuestionValue},</if>
+            <if test="simFaultAnswerValue != null">sim_fault_answer_value = #{simFaultAnswerValue},</if>
             <if test="minus != null">minus = #{minus},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 6 - 0
ruoyi-sim/src/main/resources/mapper/sim/SimMapper.xml

@@ -10,6 +10,7 @@
         <result property="simType" column="sim_type"/>
         <result property="simState" column="sim_state"/>
         <result property="simSn" column="sim_sn"/>
+        <result property="simNum" column="sim_num"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
@@ -23,6 +24,7 @@
                sim_type,
                sim_state,
                sim_sn,
+               sim_num,
                create_by,
                create_time,
                update_by,
@@ -38,6 +40,7 @@
             <if test="simType != null  and simType != ''">and sim_type = #{simType}</if>
             <if test="simState != null  and simState != ''">and sim_state = #{simState}</if>
             <if test="simSn != null  and simSn != ''">and sim_sn = #{simSn}</if>
+            <if test="simNum != null  and simNum != ''">and sim_num = #{simNum}</if>
         </where>
     </select>
 
@@ -53,6 +56,7 @@
             <if test="simType != null and simType != ''">sim_type,</if>
             <if test="simState != null and simState != ''">sim_state,</if>
             <if test="simSn != null and simSn != ''">sim_sn,</if>
+            <if test="simNum != null and simNum != ''">sim_num,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -64,6 +68,7 @@
             <if test="simType != null and simType != ''">#{simType},</if>
             <if test="simState != null and simState != ''">#{simState},</if>
             <if test="simSn != null and simSn != ''">#{simSn},</if>
+            <if test="simNum != null and simNum != ''">#{simNum},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -79,6 +84,7 @@
             <if test="simType != null and simType != ''">sim_type = #{simType},</if>
             <if test="simState != null and simState != ''">sim_state = #{simState},</if>
             <if test="simSn != null and simSn != ''">sim_sn = #{simSn},</if>
+            <if test="simNum != null and simNum != ''">sim_num = #{simNum},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 28 - 6
ruoyi-sim/src/main/resources/mapper/sim/SimMsg.xml

@@ -7,8 +7,11 @@
     <resultMap type="SimMsg" id="SimMsgResult">
         <result property="simMsgId" column="sim_msg_id"/>
         <result property="simId" column="sim_id"/>
-        <result property="state" column="state"/>
+        <result property="examFaultRefId" column="exam_fault_ref_id"/>
+        <result property="examCollectionType" column="exam_collection_type"/>
+        <result property="sendMsgState" column="send_msg_state"/>
         <result property="priority" column="priority"/>
+        <result property="sendMsgType" column="send_msg_type"/>
         <result property="sendMsg" column="send_msg"/>
         <result property="sendTime" column="send_time"/>
         <result property="receiveMsg" column="receive_msg"/>
@@ -24,8 +27,11 @@
     <sql id="selectSimMsgVo">
         select sim_msg_id,
                sim_id,
-               state,
+               exam_fault_ref_id,
+               exam_collection_type,
+               send_msg_state,
                priority,
+               send_msg_type,
                send_msg,
                send_time,
                receive_msg,
@@ -43,8 +49,13 @@
         <include refid="selectSimMsgVo"/>
         <where>
             <if test="simId != null ">and sim_id = #{simId}</if>
-            <if test="state != null  and state != ''">and state = #{state}</if>
+            <if test="examFaultRefId != null ">and exam_fault_ref_id = #{examFaultRefId}</if>
+            <if test="examCollectionType != null  and examCollectionType != ''">and exam_collection_type =
+                #{examCollectionType}
+            </if>
+            <if test="sendMsgState != null  and sendMsgState != ''">and send_msg_state = #{sendMsgState}</if>
             <if test="priority != null ">and priority = #{priority}</if>
+            <if test="sendMsgType != null  and sendMsgType != ''">and send_msg_type = #{sendMsgType}</if>
             <if test="sendMsg != null  and sendMsg != ''">and send_msg = #{sendMsg}</if>
             <if test="sendTime != null ">and send_time = #{sendTime}</if>
             <if test="receiveMsg != null  and receiveMsg != ''">and receive_msg = #{receiveMsg}</if>
@@ -62,8 +73,11 @@
         insert into sim_sim_msg
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="simId != null">sim_id,</if>
-            <if test="state != null and state != ''">state,</if>
+            <if test="examFaultRefId != null">exam_fault_ref_id,</if>
+            <if test="examCollectionType != null and examCollectionType != ''">exam_collection_type,</if>
+            <if test="sendMsgState != null and sendMsgState != ''">send_msg_state,</if>
             <if test="priority != null">priority,</if>
+            <if test="sendMsgType != null and sendMsgType != ''">send_msg_type,</if>
             <if test="sendMsg != null">send_msg,</if>
             <if test="sendTime != null">send_time,</if>
             <if test="receiveMsg != null">receive_msg,</if>
@@ -77,8 +91,11 @@
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="simId != null">#{simId},</if>
-            <if test="state != null and state != ''">#{state},</if>
+            <if test="examFaultRefId != null">#{examFaultRefId},</if>
+            <if test="examCollectionType != null and examCollectionType != ''">#{examCollectionType},</if>
+            <if test="sendMsgState != null and sendMsgState != ''">#{sendMsgState},</if>
             <if test="priority != null">#{priority},</if>
+            <if test="sendMsgType != null and sendMsgType != ''">#{sendMsgType},</if>
             <if test="sendMsg != null">#{sendMsg},</if>
             <if test="sendTime != null">#{sendTime},</if>
             <if test="receiveMsg != null">#{receiveMsg},</if>
@@ -96,8 +113,13 @@
         update sim_sim_msg
         <trim prefix="SET" suffixOverrides=",">
             <if test="simId != null">sim_id = #{simId},</if>
-            <if test="state != null and state != ''">state = #{state},</if>
+            <if test="examFaultRefId != null">exam_fault_ref_id = #{examFaultRefId},</if>
+            <if test="examCollectionType != null and examCollectionType != ''">exam_collection_type =
+                #{examCollectionType},
+            </if>
+            <if test="sendMsgState != null and sendMsgState != ''">send_msg_state = #{sendMsgState},</if>
             <if test="priority != null">priority = #{priority},</if>
+            <if test="sendMsgType != null and sendMsgType != ''">send_msg_type = #{sendMsgType},</if>
             <if test="sendMsg != null">send_msg = #{sendMsg},</if>
             <if test="sendTime != null">send_time = #{sendTime},</if>
             <if test="receiveMsg != null">receive_msg = #{receiveMsg},</if>

Some files were not shown because too many files changed in this diff