Browse Source

对象、关系发生变化后,记录变更历史

linhuili 3 years ago
parent
commit
21de85c4f4
16 changed files with 779 additions and 64 deletions
  1. 54 50
      dmp-business/dmp-dic/src/main/resources/db/init/data.sql
  2. 15 6
      dmp-business/dmp-rwd-plus/pom.xml
  3. 4 4
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/qrcode/controller/QrCodeController.java
  4. 1 1
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/qrcode/handler/QrCodeMessageHandler.java
  5. 95 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/controller/ObjectDigitalHistoryController.java
  6. 93 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/controller/ObjectRelationHistoryController.java
  7. 13 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/dao/ObjectDigitalHistoryMapper.java
  8. 14 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/dao/ObjectRelationHistoryMapper.java
  9. 66 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/handler/ObjectDigitalHistoryMessageHandler.java
  10. 68 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/handler/ObjectRelationHistoryMessageHandler.java
  11. 60 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/IObjectDigitalHistoryService.java
  12. 60 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/IObjectRelationHistoryService.java
  13. 117 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/impl/IObjectDigitalHistoryServiceImpl.java
  14. 115 0
      dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/impl/IObjectRelationHistoryServiceImpl.java
  15. 1 0
      dmp-business/dmp-rwd-plus/src/main/resources/db/init/data.sql
  16. 3 3
      dmp-business/dmp-rwd-plus/src/main/resources/db/init/schema.sql

+ 54 - 50
dmp-business/dmp-dic/src/main/resources/db/init/data.sql

@@ -18,56 +18,60 @@ replace into `dic_dt_type` ( `id`, `description`, `valid`, `modified_time`, `typ
 -- ----------------------------
 -- ----------------------------
 --  Data for `dic_dt_data`
 --  Data for `dic_dt_data`
 -- ----------------------------
 -- ----------------------------
-replace into `dic_dt_data` ( `id`, `label`, `valid`, `parent_id`, `dict_type_id`, `modified_time`, `type`, `code`, `creator`, `remark`, `modifier`, `ts`, `creation_time`, `order_num`) values ( '0377f724-9a3f-1d9a-7d44-381b2a19019a', '冷站能效报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'CS', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '040d7cbd-4c44-42ff-baa1-c323ee53f0b1', '处理完成', '1', '', '7781b335-129b-443b-a6e7-e360b14cde3b', null, 'alarm_treat_state', '3', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '0533f62c-7cd2-4739-9343-d86c2df7d695', '处理中', '1', '', '7781b335-129b-443b-a6e7-e360b14cde3b', null, 'alarm_treat_state', '2', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '077fbbd3-231d-4a1c-b79c-f0659c68d003', '中控产品线', '1', '', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', null, 'PRODUCT', 'centerControl', null, '中控产品线', null, '2021-08-09 09:50:13', null, '0'),
-( '0963c1c2ca8944cdb3b20185aac50a67', '通用报警定义表头', '1', '', '0ae529c8a8ea489abf74463f73f20fbd', null, 'alarmConfigFields', 'general', null, '', null, '2021-08-09 09:50:13', null, '1'),
-( '0dab25ca339b47a983e71db24d52a670', '上帝', '1', '', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', null, 'sex', '3', null, '上帝', null, '2021-08-09 09:50:13', null, '0'),
-( '130982ff-3618-4830-9dd6-c47cbacf241d', '男', '1', '', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', null, 'sex', '1', null, '性别-男', null, '2021-08-09 09:50:13', null, '0'),
-( '19fc5f82-b371-4309-b772-9ea470c87454', '中', '1', '', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', null, 'alarm_level', '2', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '1df8ec4f-9986-4065-8bc9-0c48a915082e', '未恢复', '1', '', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', null, 'alarm_state', '1', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '1f216cf4-7c94-4b66-a13b-f419f529e20c', '真实报警', '1', '', '63d30019-c958-4693-90e9-effa2261ddd0', null, 'alarm_nature', '2', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '234b85ba-508b-4993-a871-f027eb1e09f0', '环境报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Env', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '28a0d1c564b94a848e5c8d3e49db545c', 'IBMS_U3D', '1', '', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', null, 'PRODUCT', 'IBMS_U3D', null, '关联达产品线-U3D端', null, '2021-08-09 09:50:13', null, '0'),
-( '35818e94-064d-80c7-41fa-38cfffc30bb1', '租户报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Tenant', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '3739f6b1-ef9e-443f-a586-3d60f39d5d55', '女', '1', '', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', null, 'sex', '0', null, '性别-女', null, '2021-08-09 09:50:13', null, '0'),
-( '3d0706d5-15c0-44b4-90a4-8dba1073a4a3', '设备报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Eq', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '4368e25e4eee4e90a4dc91daf4e6b768', '模式管理', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'modelManagement', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '46494192-8928-0584-f97f-82dd9c590ec6', '配电报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Electric', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '58307329-c9d9-4014-b10f-f51d6004ec1f', '转工单', '1', '', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', null, 'alarm_treat_mode', '2', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '5accec9c-6e4f-467d-bfff-172d8413409d', '已忽略', '1', '', '7781b335-129b-443b-a6e7-e360b14cde3b', null, 'alarm_treat_state', '4', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '5adaad02-ec80-4d63-bf6e-ff3ed641f3d2', '低', '1', '', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', null, 'alarm_level', '3', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '5cb6a11c6c1443c2b1868a16a2de0bae', '系统日历', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'calendar', null, '', null, '2021-08-09 09:50:13', null, '6'),
-( '6404350d-8b98-4584-9f6e-efad79e44842', '高', '1', '', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', null, 'alarm_level', '1', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '69e439ea85e54df4b7c247801dbd1e91', '系统整体', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'loginLogout', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '6accfdb7-a7ba-4637-906b-7f880c3930b0', '关闭报警', '1', '', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', null, 'alarm_treat_mode', '3', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '7680623a-202e-487d-814a-bdaded5bf8e5', '已恢复', '1', '', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', null, 'alarm_state', '2', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '8edc7bbb4ef24e0a880bf16f328b5884', '用户管理', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'userManagement', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( '90b2fa452d3549d7b253785c9723eb08', '通用报警定义表头', '1', '', '0ae529c8a8ea489abf74463f73f20fbd', null, 'alarmConfigFields', 'general2', null, ' {\"itemCode\":\"报警类型编码\",\"itemName\":\"报警类型名称\"}', null, '2021-08-09 09:50:13', null, '1'),
-( '9bee97c1-6b6c-f872-7ce6-856231209063', '能源报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Energy', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'a1aff428-5cd5-edd8-2148-fd955388368c', 'BIM报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Bim', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'a27c2bc4-340b-4d7d-8b3b-5affa4b783b5', '空间报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Sp', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'a4c43fad-735a-4d2a-8436-3d7532c845e3', '系统报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Sy', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'bb62d7de720448fd827becf853df6f3f', '报警处理', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'alarmDealWith', null, '', null, '2021-08-09 09:50:13', null, '5'),
-( 'be233ea5-0619-41ef-868d-170503cfb747', '高效运行报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Run', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'be72dbf50bc044b2a237c6c1392b32fb', '导出报表', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'reportExport', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'c01d007d-5bdf-403b-9ec6-4f3e70eaf938', '误报', '1', '', '63d30019-c958-4693-90e9-effa2261ddd0', null, 'alarm_nature', '1', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'c2b617a6b594472ca4e57041eddf0c02', '远程控制', '1', '', '0194b530b70e4997973027934db58ee5', null, 'functionLog', 'remoteControl', null, '', null, '2021-08-09 09:50:13', null, '3'),
-( 'c87be492-7e26-477a-b235-b0453b835844', '测试报警', '1', '', '63d30019-c958-4693-90e9-effa2261ddd0', null, 'alarm_nature', '3', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'ceed41d0ac5b4c04892224da6eb2f0b5', 'IBMS_WEB', '1', '', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', null, 'PRODUCT', 'IBMS_WEB', null, '关联达产品线-web端', null, '2021-08-09 09:50:13', null, '0'),
-( 'da01867d-b108-bbdf-04ab-3f14b3b9443b', '安全报警', '1', '', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', null, 'alarm_category', 'Safe', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'dev_data_1', '强电专业', '1', '', 'dev_1', null, 'major', 'SE', null, '', null, '2021-08-09 09:50:13', null, '10'),
-( 'dev_data_2', '弱电专业', '1', '', 'dev_1', null, 'major', 'WE', null, '', null, '2021-08-09 09:50:13', null, '20'),
-( 'dev_data_3', '空调专业', '1', '', 'dev_1', null, 'major', 'AC', null, '', null, '2021-08-09 09:50:13', null, '30'),
-( 'dev_data_4', '消防专业', '1', '', 'dev_1', null, 'major', 'FF', null, '', null, '2021-08-09 09:50:13', null, '40'),
-( 'dev_data_5', '安防专业', '1', '', 'dev_1', null, 'major', 'SP', null, '', null, '2021-08-09 09:50:13', null, '50'),
-( 'dev_data_6', '给排水专业', '1', '', 'dev_1', null, 'major', 'WS', null, '', null, '2021-08-09 09:50:13', null, '60'),
-( 'dev_data_7', '土建专业', '1', '', 'dev_1', null, 'major', 'CF', null, '', null, '2021-08-09 09:50:13', null, '70'),
-( 'dev_data_8', '其他', '1', '', 'dev_1', null, 'major', 'OT', null, '', null, '2021-08-09 09:50:13', null, '80'),
-( 'e08d1c3f-efd2-4ed1-8cea-087671e68a03', '忽略', '1', '', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', null, 'alarm_treat_mode', '1', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'e8294979-b994-4f44-9ca8-2eed59878611', '已过期', '1', '', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', null, 'alarm_state', '3', null, '', null, '2021-08-09 09:50:13', null, '0'),
-( 'fe23c1b7-eb4a-44b3-a371-5793d83c9529', '未处理', '1', '', '7781b335-129b-443b-a6e7-e360b14cde3b', null, 'alarm_treat_state', '1', null, '', null, '2021-08-09 09:50:13', null, '0');
+replace into `dic_dt_data` ( `id`, `dict_type_id`, `parent_id`, `type`, `code`, `label`, `type`, `valid`, `creator`, `creation_time`, `modifier`, `modified_time`, `remark`, `order_num`,`ts`) values
+ ('0377f724-9a3f-1d9a-7d44-381b2a19019a', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'CS', '冷站能效报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('040d7cbd-4c44-42ff-baa1-c323ee53f0b1', '7781b335-129b-443b-a6e7-e360b14cde3b', '', 'alarm_treat_state', '3', '处理完成', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('0533f62c-7cd2-4739-9343-d86c2df7d695', '7781b335-129b-443b-a6e7-e360b14cde3b', '', 'alarm_treat_state', '2', '处理中', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('077fbbd3-231d-4a1c-b79c-f0659c68d003', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', '', 'PRODUCT', 'centerControl', '中控产品线', 1, NULL, NULL, NULL, NULL, '中控产品线', 0, '2021-08-09 09:50:13' ),
+ ('0963c1c2ca8944cdb3b20185aac50a67', '0ae529c8a8ea489abf74463f73f20fbd', '', 'alarmConfigFields', 'general', '通用报警定义表头', 1, NULL, NULL, NULL, NULL, '', 1, '2021-08-09 09:50:13' ),
+ ('0dab25ca339b47a983e71db24d52a670', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', '', 'sex', '3', '上帝', 1, NULL, NULL, NULL, NULL, '上帝', 0, '2021-08-09 09:50:13' ),
+ ('130982ff-3618-4830-9dd6-c47cbacf241d', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', '', 'sex', '1', '男', 1, NULL, NULL, NULL, NULL, '性别-男', 0, '2021-08-09 09:50:13' ),
+ ('19fc5f82-b371-4309-b772-9ea470c87454', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', '', 'alarm_level', '2', '中', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('1df8ec4f-9986-4065-8bc9-0c48a915082e', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', '', 'alarm_state', '1', '未恢复', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('1f216cf4-7c94-4b66-a13b-f419f529e20c', '63d30019-c958-4693-90e9-effa2261ddd0', '', 'alarm_nature', '2', '真实报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('234b85ba-508b-4993-a871-f027eb1e09f0', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Env', '环境报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('28a0d1c564b94a848e5c8d3e49db545c', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', '', 'PRODUCT', 'IBMS_U3D', 'IBMS_U3D', 1, NULL, NULL, NULL, NULL, '关联达产品线-U3D端', 0, '2021-08-09 09:50:13' ),
+ ('35818e94-064d-80c7-41fa-38cfffc30bb1', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Tenant', '租户报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('3739f6b1-ef9e-443f-a586-3d60f39d5d55', 'b3fda223-4d82-48ab-b36b-ed5471eb5ea4', '', 'sex', '0', '女', 1, NULL, NULL, NULL, NULL, '性别-女', 0, '2021-08-09 09:50:13' ),
+ ('3d0706d5-15c0-44b4-90a4-8dba1073a4a3', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Eq', '设备报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('4368e25e4eee4e90a4dc91daf4e6b768', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'modelManagement', '模式管理', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('46494192-8928-0584-f97f-82dd9c590ec6', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Electric', '配电报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('58307329-c9d9-4014-b10f-f51d6004ec1f', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', '', 'alarm_treat_mode', '2', '转工单', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('5accec9c-6e4f-467d-bfff-172d8413409d', '7781b335-129b-443b-a6e7-e360b14cde3b', '', 'alarm_treat_state', '4', '已忽略', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('5adaad02-ec80-4d63-bf6e-ff3ed641f3d2', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', '', 'alarm_level', '3', '低', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('5cb6a11c6c1443c2b1868a16a2de0bae', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'calendar', '系统日历', 1, NULL, NULL, NULL, NULL, '', 6, '2021-08-09 09:50:13' ),
+ ('6404350d-8b98-4584-9f6e-efad79e44842', '2000f980-fcf3-4a43-bce4-c229f45a1e6f', '', 'alarm_level', '1', '高', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('69e439ea85e54df4b7c247801dbd1e91', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'loginLogout', '系统整体', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('6accfdb7-a7ba-4637-906b-7f880c3930b0', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', '', 'alarm_treat_mode', '3', '关闭报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('7680623a-202e-487d-814a-bdaded5bf8e5', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', '', 'alarm_state', '2', '已恢复', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('8edc7bbb4ef24e0a880bf16f328b5884', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'userManagement', '用户管理', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('90b2fa452d3549d7b253785c9723eb08', '0ae529c8a8ea489abf74463f73f20fbd', '', 'alarmConfigFields', 'general2', '通用报警定义表头', 1, NULL, NULL, NULL, NULL, ' {\"itemCode\":\"报警类型编码\",\"itemName\":\"报警类型名称\"}', 1, '2021-08-09 09:50:13' ),
+ ('9bee97c1-6b6c-f872-7ce6-856231209063', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Energy', '能源报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('a1aff428-5cd5-edd8-2148-fd955388368c', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Bim', 'BIM报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('a27c2bc4-340b-4d7d-8b3b-5affa4b783b5', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Sp', '空间报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('a4c43fad-735a-4d2a-8436-3d7532c845e3', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Sy', '系统报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('bb62d7de720448fd827becf853df6f3f', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'alarmDealWith', '报警处理', 1, NULL, NULL, NULL, NULL, '', 5, '2021-08-09 09:50:13' ),
+ ('be233ea5-0619-41ef-868d-170503cfb747', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Run', '高效运行报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('be72dbf50bc044b2a237c6c1392b32fb', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'reportExport', '导出报表', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('c01d007d-5bdf-403b-9ec6-4f3e70eaf938', '63d30019-c958-4693-90e9-effa2261ddd0', '', 'alarm_nature', '1', '误报', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('c2b617a6b594472ca4e57041eddf0c02', '0194b530b70e4997973027934db58ee5', '', 'functionLog', 'remoteControl', '远程控制', 1, NULL, NULL, NULL, NULL, '', 3, '2021-08-09 09:50:13' ),
+ ('c87be492-7e26-477a-b235-b0453b835844', '63d30019-c958-4693-90e9-effa2261ddd0', '', 'alarm_nature', '3', '测试报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('ceed41d0ac5b4c04892224da6eb2f0b5', 'b4fb854e-ab10-4f6b-8934-933ec5ced571', '', 'PRODUCT', 'IBMS_WEB', 'IBMS_WEB', 1, NULL, NULL, NULL, NULL, '关联达产品线-web端', 0, '2021-08-09 09:50:13' ),
+ ('da01867d-b108-bbdf-04ab-3f14b3b9443b', 'dae4fca7-65ec-475a-9a6f-22445474e4fa', '', 'alarm_category', 'Safe', '安全报警', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('dev_data_1', 'dev_1', '', 'major', 'SE', '强电专业', 1, NULL, NULL, NULL, NULL, '', 10, '2021-08-09 09:50:13' ),
+ ('dev_data_10', 'dev_1', '', 'major', 'LT', '照明专业', 1, NULL, NULL, NULL, NULL, '', 90, '2021-11-02 16:15:27' ),
+ ('dev_data_11', 'dev_1', '', 'major', 'FG', '燃气专业', 1, NULL, NULL, NULL, NULL, '', 100, '2021-11-02 16:15:30' ),
+ ('dev_data_2', 'dev_1', '', 'major', 'WE', '弱电专业', 1, NULL, NULL, NULL, NULL, '', 20, '2021-08-09 09:50:13' ),
+ ('dev_data_3', 'dev_1', '', 'major', 'AC', '空调专业', 1, NULL, NULL, NULL, NULL, '', 30, '2021-08-09 09:50:13' ),
+ ('dev_data_4', 'dev_1', '', 'major', 'FF', '消防专业', 1, NULL, NULL, NULL, NULL, '', 40, '2021-08-09 09:50:13' ),
+ ('dev_data_5', 'dev_1', '', 'major', 'SP', '安防专业', 1, NULL, NULL, NULL, NULL, '', 50, '2021-08-09 09:50:13' ),
+ ('dev_data_6', 'dev_1', '', 'major', 'WS', '给排水专业', 1, NULL, NULL, NULL, NULL, '', 60, '2021-08-09 09:50:13' ),
+ ('dev_data_7', 'dev_1', '', 'major', 'CF', '土建专业', 1, NULL, NULL, NULL, NULL, '', 70, '2021-08-09 09:50:13' ),
+ ('dev_data_8', 'dev_1', '', 'major', 'OT', '其他', 1, NULL, NULL, NULL, NULL, '', 80, '2021-08-09 09:50:13' ),
+ ('dev_data_9', 'dev_1', '', 'major', 'EL', '电梯专业', 1, NULL, NULL, NULL, NULL, '', 80, '2021-11-02 15:37:59' ),
+ ('e08d1c3f-efd2-4ed1-8cea-087671e68a03', 'f37caad0-6137-428a-af0b-7ea0a2d51e3b', '', 'alarm_treat_mode', '1', '忽略', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('e8294979-b994-4f44-9ca8-2eed59878611', '717b2d89-b0dd-4969-88e2-0cb76bba0c97', '', 'alarm_state', '3', '已过期', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' ),
+ ('fe23c1b7-eb4a-44b3-a371-5793d83c9529', '7781b335-129b-443b-a6e7-e360b14cde3b', '', 'alarm_treat_state', '1', '未处理', 1, NULL, NULL, NULL, NULL, '', 0, '2021-08-09 09:50:13' );
 
 
 -- ----------------------------
 -- ----------------------------
 --  Data for `dic_dt_data_map`
 --  Data for `dic_dt_data_map`

+ 15 - 6
dmp-business/dmp-rwd-plus/pom.xml

@@ -12,9 +12,19 @@
     <packaging>jar</packaging>
     <packaging>jar</packaging>
 
 
     <dependencies>
     <dependencies>
+        <!-- 配置中心(包含注册中心) -->
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
-            <artifactId>dmp-file-starter</artifactId>
+            <artifactId>integrated-config-client</artifactId>
+        </dependency>
+        <!-- 项目启动 -->
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-mybatis</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
@@ -22,6 +32,10 @@
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
+            <artifactId>dmp-file-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
             <artifactId>dmp-amqp-starter</artifactId>
             <artifactId>dmp-amqp-starter</artifactId>
         </dependency>
         </dependency>
         <!--生成二维码-->
         <!--生成二维码-->
@@ -30,11 +44,6 @@
             <artifactId>core</artifactId>
             <artifactId>core</artifactId>
             <version>3.3.3</version>
             <version>3.3.3</version>
         </dependency>
         </dependency>
-<!--        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>dmp-rwd</artifactId>
-            <version>1.0.0</version>
-        </dependency>-->
     </dependencies>
     </dependencies>
 
 
 </project>
 </project>

+ 4 - 4
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/qrcode/controller/QrCodeController.java

@@ -39,13 +39,13 @@ public class QrCodeController {
         String groupCode = AppContext.getContext().getGroupCode();
         String groupCode = AppContext.getContext().getGroupCode();
         //统计对象数据总数
         //统计对象数据总数
         criteria.setOnlyCount(true);
         criteria.setOnlyCount(true);
-        List<ObjectNode> onlyCountList = DigitalObjectFacade.query(groupCode, projectId, null, null, criteria);
-        Integer total = onlyCountList.size();
-        if(total <= 0){
+        CommonResult<List<ObjectNode>> countCommonResult = DigitalObjectFacade.queryPrototype(groupCode, projectId, null, null, criteria);
+        Long total = countCommonResult.getCount();
+        if(total == null || total <= 0){
             return CommonResult.success("暂无可生成二维码的对象数据");
             return CommonResult.success("暂无可生成二维码的对象数据");
         }
         }
         //分页处理:生成对象二维码
         //分页处理:生成对象二维码
-        int pageNum = total / 500;
+        int pageNum = total.intValue() / 500 + 1 ;
         for(int i=0 ; i< pageNum ; i++){
         for(int i=0 ; i< pageNum ; i++){
             criteria.setOnlyCount(false);
             criteria.setOnlyCount(false);
             criteria.setPage(Long.valueOf(i));
             criteria.setPage(Long.valueOf(i));

+ 1 - 1
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/qrcode/handler/QrCodeMessageHandler.java

@@ -67,7 +67,7 @@ public class QrCodeMessageHandler extends AbstractRabbitHandlerTemplate {
     }
     }
 
 
     /**
     /**
-     * 生成二维码信息
+     * 生成对象二维码信息
      * @param digital
      * @param digital
      */
      */
     private void createObjectQrCode(String groupCode,String projectId,ObjectNode digital){
     private void createObjectQrCode(String groupCode,String projectId,ObjectNode digital){

+ 95 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/controller/ObjectDigitalHistoryController.java

@@ -0,0 +1,95 @@
+package com.persagy.dmp.rwd.version.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.basic.utils.QueryCriteriaHelper;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.common.utils.ResultHelper;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.rwd.version.entity.ObjectDigitalHistory;
+import com.persagy.dmp.rwd.version.service.IObjectDigitalHistoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 对象历史记录管理
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@RestController
+@RequestMapping("/rwd/instance/object/his")
+public class ObjectDigitalHistoryController {
+
+    @Autowired
+    private IObjectDigitalHistoryService service;
+
+    /**
+     * 查询对象历史记录
+     * @param criteria
+     * @return
+     */
+    @PostMapping("/query")
+    public CommonResult<List<ObjectDigitalHistory>> query(@RequestBody QueryCriteria criteria) {
+        if(criteria == null) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), ResponseCode.A0400.getDesc());
+        }
+        QueryWrapper<ObjectDigitalHistory> wrapper = new QueryWrapper<>();
+        // 转换查询条件
+        QueryCriteriaHelper.toWrapper(wrapper, criteria, ObjectDigitalHistory.class);
+        Page page = QueryCriteriaHelper.toPage(criteria);
+        if(criteria.isOnlyCount()) {
+            Integer total = service.queryCount(wrapper);
+            page.setTotal(total);
+        } else {
+            page = service.queryByCondition(QueryCriteriaHelper.toPage(criteria), wrapper);
+        }
+        return ResultHelper.multi(page.getRecords(), page.getTotal());
+    }
+
+    /**
+     * 添加对象历史记录
+     * @param vo
+     * @return
+     */
+    @PostMapping("/create")
+    public CommonResult<ObjectDigitalHistory> create(@Valid @RequestBody ObjectDigital vo) throws Exception{
+        //新增信息点
+        ObjectDigitalHistory insert = service.insert(vo);
+        return ResultHelper.single(insert);
+    }
+
+    /**
+     * 修改对象历史记录
+     * @param vo
+     * @return
+     */
+    @PostMapping("/update")
+    public CommonResult<ObjectDigitalHistory> update(@Valid @RequestBody ObjectDigital vo) throws Exception{
+        //修改信息点
+        ObjectDigitalHistory update = service.update(vo);
+        return ResultHelper.single(update);
+    }
+
+    /**
+     * 删除对象时,进行历史记录
+     * @return
+     */
+    @PostMapping("/delete")
+    public CommonResult<ObjectDigitalHistory> delete(@Valid @RequestBody ObjectDigital vo) throws Exception{
+        //修改信息点
+        ObjectDigitalHistory objHistory = service.delete(vo);
+        return ResultHelper.single(objHistory);
+    }
+
+
+
+}

+ 93 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/controller/ObjectRelationHistoryController.java

@@ -0,0 +1,93 @@
+package com.persagy.dmp.rwd.version.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.basic.utils.QueryCriteriaHelper;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.common.utils.ResultHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.dmp.rwd.version.entity.ObjectRelationHistory;
+import com.persagy.dmp.rwd.version.service.IObjectRelationHistoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 对象关系历史记录管理
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@RestController
+@RequestMapping("/rwd/instance/relation/his")
+public class ObjectRelationHistoryController {
+
+    @Autowired
+    private IObjectRelationHistoryService service;
+
+    /**
+     * 查询对象关系历史记录
+     * @param criteria
+     * @return
+     */
+    @PostMapping("/query")
+    public CommonResult<List<ObjectRelationHistory>> query(@RequestBody QueryCriteria criteria) {
+        if(criteria == null) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), ResponseCode.A0400.getDesc());
+        }
+        QueryWrapper<ObjectRelationHistory> wrapper = new QueryWrapper<>();
+        // 转换查询条件
+        QueryCriteriaHelper.toWrapper(wrapper, criteria, ObjectRelationHistory.class);
+        Page page = QueryCriteriaHelper.toPage(criteria);
+        if(criteria.isOnlyCount()) {
+            Integer total = service.queryCount(wrapper);
+            page.setTotal(total);
+        } else {
+            page = service.queryByCondition(QueryCriteriaHelper.toPage(criteria), wrapper);
+        }
+        return ResultHelper.multi(page.getRecords(), page.getTotal());
+    }
+
+    /**
+     * 添加对象关系历史记录
+     * @param vo
+     * @return
+     */
+    @PostMapping("/create")
+    public CommonResult<ObjectRelationHistory> create(@Valid @RequestBody ObjectRelation vo) throws Exception{
+        //新增信息点
+        ObjectRelationHistory insert = service.insert(vo);
+        return ResultHelper.single(insert);
+    }
+
+    /**
+     * 修改对象关系历史记录
+     * @param vo
+     * @return
+     */
+    @PostMapping("/update")
+    public CommonResult<ObjectRelationHistory> update(@Valid @RequestBody ObjectRelation vo) throws Exception{
+        //修改信息点
+        ObjectRelationHistory update = service.update(vo);
+        return ResultHelper.single(update);
+    }
+
+    /**
+     * 删除对象关系时,进行历史记录
+     * @return
+     */
+    @PostMapping("/delete")
+    public CommonResult<ObjectRelationHistory> delete(@Valid @RequestBody ObjectRelation vo) throws Exception{
+        //修改信息点
+        ObjectRelationHistory objHistory = service.delete(vo);
+        return ResultHelper.single(objHistory);
+    }
+
+}

+ 13 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/dao/ObjectDigitalHistoryMapper.java

@@ -0,0 +1,13 @@
+package com.persagy.dmp.rwd.version.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.dmp.rwd.version.entity.ObjectDigitalHistory;
+
+/**
+ * 对象历史记录 DAO
+ *
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+public interface ObjectDigitalHistoryMapper extends BaseMapper<ObjectDigitalHistory> {
+}

+ 14 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/dao/ObjectRelationHistoryMapper.java

@@ -0,0 +1,14 @@
+package com.persagy.dmp.rwd.version.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.dmp.rwd.version.entity.ObjectDigitalHistory;
+import com.persagy.dmp.rwd.version.entity.ObjectRelationHistory;
+
+/**
+ * 关系历史记录 DAO
+ *
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+public interface ObjectRelationHistoryMapper extends BaseMapper<ObjectRelationHistory> {
+}

+ 66 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/handler/ObjectDigitalHistoryMessageHandler.java

@@ -0,0 +1,66 @@
+package com.persagy.dmp.rwd.version.handler;
+
+import cn.hutool.core.util.StrUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.amqp.handler.AbstractRabbitHandlerTemplate;
+import com.persagy.dmp.basic.constant.DigitalMessageConstant;
+import com.persagy.dmp.basic.model.DigitalManageMessage;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.rwd.version.service.IObjectDigitalHistoryService;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.DataInput;
+
+/**
+ * 历史对象记录消息处理
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@Slf4j
+@Component
+@RabbitListener
+public class ObjectDigitalHistoryMessageHandler extends AbstractRabbitHandlerTemplate {
+
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    @Autowired
+    private IObjectDigitalHistoryService objectDigitalHisService;
+
+    @Override
+    protected void handler(String message, Channel channel, Message vo) {
+        try {
+            log.info("接收对象消息:{}", message);
+            //接收对象消息
+            DigitalManageMessage messageVO = objectMapper.readValue(message, DigitalManageMessage.class);
+            ObjectNode objectDigital = messageVO.getNewObj();
+            if(objectDigital == null || StrUtil.isEmpty(messageVO.getOperatorType())){
+                log.info("对象消息格式有误:{}"+ messageVO);
+            }
+            ObjectDigital objectDigitalVO = objectMapper.readValue((DataInput) objectDigital, ObjectDigital.class);
+            //新增对象,历史记录
+            if(DigitalMessageConstant.OPERATE_AFTER_INSERT.equals(messageVO.getOperatorType())){
+                objectDigitalHisService.insert(objectDigitalVO);
+            }
+            //修改对象,历史记录
+            if(DigitalMessageConstant.OPERATE_AFTER_UPDATE.equals(messageVO.getOperatorType())){
+                objectDigitalHisService.update(objectDigitalVO);
+            }
+            //删除对象,历史记录
+            if(DigitalMessageConstant.OPERATE_AFTER_DELETE.equals(messageVO.getOperatorType())){
+                objectDigitalHisService.delete(objectDigitalVO);
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException(e.getMessage(), e);
+        }
+
+    }
+}

+ 68 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/handler/ObjectRelationHistoryMessageHandler.java

@@ -0,0 +1,68 @@
+package com.persagy.dmp.rwd.version.handler;
+
+import cn.hutool.core.util.StrUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.amqp.handler.AbstractRabbitHandlerTemplate;
+import com.persagy.dmp.basic.constant.DigitalMessageConstant;
+import com.persagy.dmp.basic.model.DigitalManageMessage;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.dmp.rwd.version.service.IObjectDigitalHistoryService;
+import com.persagy.dmp.rwd.version.service.IObjectRelationHistoryService;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.DataInput;
+
+/**
+ * 历史关系记录消息处理
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@Slf4j
+@Component
+@RabbitListener
+public class ObjectRelationHistoryMessageHandler extends AbstractRabbitHandlerTemplate {
+
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    @Autowired
+    private IObjectRelationHistoryService objectRelationHisService;
+
+    @Override
+    protected void handler(String message, Channel channel, Message vo) {
+        try {
+            log.info("接收对象关系消息:{}", message);
+            //接收对象消息
+            DigitalManageMessage messageVO = objectMapper.readValue(message, DigitalManageMessage.class);
+            ObjectNode objectRelation = messageVO.getNewObj();
+            if(objectRelation == null || StrUtil.isEmpty(messageVO.getOperatorType())){
+                log.info("对象关系消息格式有误:{}"+ messageVO);
+            }
+            ObjectRelation objectRelationVO = objectMapper.readValue((DataInput) objectRelation, ObjectRelation.class);
+            //新增对象关系,历史记录
+            if(DigitalMessageConstant.OPERATE_REL_AFTER_INSERT.equals(messageVO.getOperatorType())){
+                objectRelationHisService.insert(objectRelationVO);
+            }
+            //修改对象关系,历史记录
+            if(DigitalMessageConstant.OPERATE_REL_AFTER_INSERT.equals(messageVO.getOperatorType())){
+                objectRelationHisService.update(objectRelationVO);
+            }
+            //删除对象关系,历史记录
+            if(DigitalMessageConstant.OPERATE_REL_AFTER_INSERT.equals(messageVO.getOperatorType())){
+                objectRelationHisService.delete(objectRelationVO);
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException(e.getMessage(), e);
+        }
+
+    }
+}

+ 60 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/IObjectDigitalHistoryService.java

@@ -0,0 +1,60 @@
+package com.persagy.dmp.rwd.version.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.rwd.version.entity.ObjectDigitalHistory;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+public interface IObjectDigitalHistoryService {
+
+
+    /**
+     * 按条件计数
+     * @param queryWrapper 查询条件
+     * @return 结果数量
+     */
+    Integer queryCount(Wrapper<ObjectDigitalHistory> queryWrapper);
+
+    /**
+     * 按条件查询
+     * @param queryWrapper 查询条件
+     * @return 返回结果
+     */
+    List<ObjectDigitalHistory> queryByCondition(Wrapper<ObjectDigitalHistory> queryWrapper);
+
+    /**
+     * 分页条件查询
+     * @param page 分页条件
+     * @param queryWrapper 查询条件
+     * @return 分页结果
+     */
+    Page queryByCondition(Page page, Wrapper<ObjectDigitalHistory> queryWrapper);
+
+    /**
+     * 新增
+     * @param vo 待新增数据
+     * @return 新增后数据
+     */
+    ObjectDigitalHistory insert(ObjectDigital vo) throws Exception ;
+
+    /**
+     * 修改
+     * @param vo 待修改数据
+     * @return 修改后数据
+     */
+    ObjectDigitalHistory update(ObjectDigital vo) throws Exception;
+
+    /**
+     * 删除
+     * @param vo 主键
+     */
+    ObjectDigitalHistory delete(ObjectDigital vo) throws Exception ;
+}

+ 60 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/IObjectRelationHistoryService.java

@@ -0,0 +1,60 @@
+package com.persagy.dmp.rwd.version.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.dmp.rwd.version.entity.ObjectRelationHistory;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+public interface IObjectRelationHistoryService {
+
+
+    /**
+     * 按条件计数
+     * @param queryWrapper 查询条件
+     * @return 结果数量
+     */
+    Integer queryCount(Wrapper<ObjectRelationHistory> queryWrapper);
+
+    /**
+     * 按条件查询
+     * @param queryWrapper 查询条件
+     * @return 返回结果
+     */
+    List<ObjectRelationHistory> queryByCondition(Wrapper<ObjectRelationHistory> queryWrapper);
+
+    /**
+     * 分页条件查询
+     * @param page 分页条件
+     * @param queryWrapper 查询条件
+     * @return 分页结果
+     */
+    Page queryByCondition(Page page, Wrapper<ObjectRelationHistory> queryWrapper);
+
+    /**
+     * 新增
+     * @param vo 待新增数据
+     * @return 新增后数据
+     */
+    ObjectRelationHistory insert(ObjectRelation vo) throws Exception ;
+
+    /**
+     * 修改
+     * @param vo 待修改数据
+     * @return 修改后数据
+     */
+    ObjectRelationHistory update(ObjectRelation vo) throws Exception;
+
+    /**
+     * 删除
+     * @param vo 主键
+     */
+    ObjectRelationHistory delete(ObjectRelation vo) throws Exception ;
+}

+ 117 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/impl/IObjectDigitalHistoryServiceImpl.java

@@ -0,0 +1,117 @@
+package com.persagy.dmp.rwd.version.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.dmp.common.constant.ValidEnum;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.rwd.version.dao.ObjectDigitalHistoryMapper;
+import com.persagy.dmp.rwd.version.entity.ObjectDigitalHistory;
+import com.persagy.dmp.rwd.version.service.IObjectDigitalHistoryService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对象数据历史记录管理
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@Slf4j
+@Service
+public class IObjectDigitalHistoryServiceImpl extends ServiceImpl<ObjectDigitalHistoryMapper,ObjectDigitalHistory> implements IObjectDigitalHistoryService {
+
+    @Autowired
+    private ObjectDigitalHistoryMapper objectDigitalHistoryMapper;
+
+    /**
+     * 数量统计对象历史数量
+     */
+    @Override
+    public Integer queryCount(Wrapper<ObjectDigitalHistory> queryWrapper) {
+        return objectDigitalHistoryMapper.selectCount(queryWrapper);
+    }
+
+    /**
+     * 条件查询对象历史数据
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public List<ObjectDigitalHistory> queryByCondition(Wrapper<ObjectDigitalHistory> queryWrapper) {
+        return objectDigitalHistoryMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 分页查询对象历史数据
+     * @param page 分页条件
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public Page queryByCondition(Page page, Wrapper<ObjectDigitalHistory> queryWrapper) {
+        return objectDigitalHistoryMapper.selectPage(page, queryWrapper);
+    }
+
+    /**
+     * 保存对象历史记录
+     * @param vo 待新增数据
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public ObjectDigitalHistory insert(ObjectDigital vo) throws Exception {
+        //设置对象历史信息
+        ObjectDigitalHistory objectDigitalHistory = new ObjectDigitalHistory();
+        BeanUtils.copyProperties(vo,objectDigitalHistory);
+        objectDigitalHistory.setObjId(vo.getId());
+        objectDigitalHistory.setId(null);
+        objectDigitalHistory.setLastFlag(true);
+        objectDigitalHistory.setStartTime(vo.getCreationTime());
+        //保存对象历史记录
+        save(objectDigitalHistory);
+        return objectDigitalHistory;
+    }
+
+    /**
+     * 修改对象历史记录
+     * @param vo 待修改数据
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public ObjectDigitalHistory update(ObjectDigital vo) throws Exception {
+        //查询最新历史记录
+        QueryWrapper<ObjectDigitalHistory> wrapper = new QueryWrapper<>();
+        wrapper.eq("last_flag",true);
+        wrapper.eq("obj_id",vo.getId());
+        wrapper.eq("valid", ValidEnum.TRUE.getType());
+        List<ObjectDigitalHistory> objHistoryList = queryByCondition(wrapper);
+        if(CollUtil.isNotEmpty(objHistoryList)){
+            for (ObjectDigitalHistory objHistory : objHistoryList) {
+                objHistory.setLastFlag(false);
+                objHistory.setEndTime(vo.getModifiedTime());
+            }
+            //修改最新历史记录标识
+            saveOrUpdateBatch(objHistoryList);
+        }
+        //新增历史记录
+        return insert(vo);
+    }
+
+    /**
+     * 删除对象,历史记录
+     * @param vo
+     */
+    @Override
+    public ObjectDigitalHistory delete(ObjectDigital vo) throws Exception  {
+        return update(vo);
+    }
+
+
+}

+ 115 - 0
dmp-business/dmp-rwd-plus/src/main/java/com/persagy/dmp/rwd/version/service/impl/IObjectRelationHistoryServiceImpl.java

@@ -0,0 +1,115 @@
+package com.persagy.dmp.rwd.version.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.dmp.common.constant.ValidEnum;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.dmp.rwd.version.dao.ObjectRelationHistoryMapper;
+import com.persagy.dmp.rwd.version.entity.ObjectRelationHistory;
+import com.persagy.dmp.rwd.version.service.IObjectRelationHistoryService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对象关系历史记录
+ * @author:linhuili
+ * @date:2021/11/15
+ */
+@Slf4j
+@Service
+public class IObjectRelationHistoryServiceImpl extends ServiceImpl<ObjectRelationHistoryMapper, ObjectRelationHistory>  implements IObjectRelationHistoryService {
+
+    @Autowired
+    private ObjectRelationHistoryMapper ObjectRelationHistoryMapper;
+
+    /**
+     * 数量统计对象关系历史数据
+     */
+    @Override
+    public Integer queryCount(Wrapper<ObjectRelationHistory> queryWrapper) {
+        return ObjectRelationHistoryMapper.selectCount(queryWrapper);
+    }
+
+    /**
+     * 条件查询对象关系历史数据
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public List<ObjectRelationHistory> queryByCondition(Wrapper<ObjectRelationHistory> queryWrapper) {
+        return ObjectRelationHistoryMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 分页查询对象关系历史数据
+     * @param page 分页条件
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public Page queryByCondition(Page page, Wrapper<ObjectRelationHistory> queryWrapper) {
+        return ObjectRelationHistoryMapper.selectPage(page, queryWrapper);
+    }
+
+    /**
+     * 保存对象关系历史记录
+     * @param vo 待新增数据
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public ObjectRelationHistory insert(ObjectRelation vo) throws Exception {
+        //设置对象历史信息
+        ObjectRelationHistory ObjectRelationHistory = new ObjectRelationHistory();
+        BeanUtils.copyProperties(vo,ObjectRelationHistory);
+        ObjectRelationHistory.setRelId(vo.getId());
+        ObjectRelationHistory.setId(null);
+        ObjectRelationHistory.setLastFlag(true);
+        ObjectRelationHistory.setStartTime(vo.getCreationTime());
+        //保存对象历史记录
+        save(ObjectRelationHistory);
+        return ObjectRelationHistory;
+    }
+
+    /**
+     * 修改对象关系历史记录
+     * @param vo 待修改数据
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public ObjectRelationHistory update(ObjectRelation vo) throws Exception {
+        //查询最新历史记录
+        QueryWrapper<ObjectRelationHistory> wrapper = new QueryWrapper<>();
+        wrapper.eq("last_flag",true);
+        wrapper.eq("obj_id",vo.getId());
+        wrapper.eq("valid", ValidEnum.TRUE.getType());
+        List<ObjectRelationHistory> objHistoryList = queryByCondition(wrapper);
+        if(CollUtil.isNotEmpty(objHistoryList)){
+            for (ObjectRelationHistory objHistory : objHistoryList) {
+                objHistory.setLastFlag(false);
+                objHistory.setEndTime(vo.getModifiedTime());
+            }
+            //修改最新历史记录标识
+            saveOrUpdateBatch(objHistoryList);
+        }
+        //新增历史记录
+        return insert(vo);
+    }
+
+    /**
+     * 删除对象关系,历史记录
+     * @param vo
+     */
+    @Override
+    public ObjectRelationHistory delete(ObjectRelation vo) throws Exception  {
+        return update(vo);
+    }
+}

+ 1 - 0
dmp-business/dmp-rwd-plus/src/main/resources/db/init/data.sql

@@ -0,0 +1 @@
+select 1 from dual;

+ 3 - 3
dmp-business/dmp-rwd-plus/src/main/resources/db/init/schema.sql

@@ -1,7 +1,7 @@
 
 
 CREATE TABLE IF NOT EXISTS `dt_object_his` (
 CREATE TABLE IF NOT EXISTS `dt_object_his` (
-  `id` varchar(100) NOT NULL,
-  `objId` varchar(100) DEFAULT NULL COMMENT '对象id',
+  `id` varchar(100) NOT NULL COMMENT '主键',
+  `obj_id` varchar(100) DEFAULT NULL COMMENT '对象id',
   `name` varchar(100) DEFAULT NULL COMMENT '对象名称',
   `name` varchar(100) DEFAULT NULL COMMENT '对象名称',
   `local_id` varchar(100) DEFAULT NULL COMMENT '对象本地编码',
   `local_id` varchar(100) DEFAULT NULL COMMENT '对象本地编码',
   `local_name` varchar(100) DEFAULT NULL COMMENT '对象本地名称',
   `local_name` varchar(100) DEFAULT NULL COMMENT '对象本地名称',
@@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `dt_object_his` (
 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='对象实例表';
 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='对象实例表';
 
 
 CREATE TABLE IF NOT EXISTS `dt_relation_his` (
 CREATE TABLE IF NOT EXISTS `dt_relation_his` (
-  `id` varchar(40) NOT NULL,
+  `id` varchar(40) NOT NULL COMMENT '主键',
   `rel_id` varchar(40) DEFAULT NULL COMMENT '关系id',
   `rel_id` varchar(40) DEFAULT NULL COMMENT '关系id',
   `group_code` varchar(40) DEFAULT NULL,
   `group_code` varchar(40) DEFAULT NULL,
   `project_id` varchar(40) NOT NULL,
   `project_id` varchar(40) NOT NULL,