From 22476de82e3d13264f408e98dabe39d621ad7829 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 17 Jan 2024 12:00:44 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=8D=B1=E9=99=A9=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/common/utils/DateUtil.java | 11 + .../maintenance/constants/ScheduledConstant.java | 4 + .../entity/OperMaintenanceTaskEntity.java | 4 + .../com/hnac/hzims/message/MessageConstants.java | 1 + hzims-service-api/safeproduct-api/pom.xml | 12 + .../java/com/hnac/hzims/safeproduct/Constants.java | 5 + .../hnac/hzims/safeproduct/dto/AccidentDTO.java | 9 + .../hnac/hzims/safeproduct/dto/InnerDangerDTO.java | 26 ++ .../safeproduct/entity/DangerSourceEntity.java | 15 + .../safeproduct/entity/InnerDangerEntity.java | 299 ++++++++++++++++ .../safeproduct/hazard/dto/DangerSourceDTO.java | 18 + .../hazard/dto/DangerSourcePositionDTO.java | 17 + .../safeproduct/hazard/dto/HazardInstanceDTO.java | 31 ++ .../safeproduct/hazard/dto/HazardLibraryDTO.java | 15 + .../hazard/entity/HazardLibraryEntity.java | 59 +++ .../hazard/enums/DangerSourceLevelEnum.java | 50 +++ .../hazard/vo/DangerSourcePositionVO.java | 18 + .../safeproduct/hazard/vo/DangerSourceVO.java | 37 ++ .../safeproduct/hazard/vo/HazardLibraryVO.java | 15 + .../hiddendanger/entity/HiddenDanger.java | 30 -- .../hiddendanger/vo/HiddenDangerQueryVo.java | 13 - .../management/entity/DocumentManagement.java | 53 ++- .../safeproduct/management/entity/RatingScale.java | 14 +- .../management/entity/SafeStandardNecessary.java | 33 ++ .../management/entity/SafeStandardResult.java | 44 +++ .../management/entity/TargetManagement.java | 18 +- .../management/entity/TargetTemplate.java | 57 +++ .../management/vo/DocumentManagementQueryVo.java | 6 + .../safeproduct/management/vo/RatingScaleVo.java | 5 + .../management/vo/TargetTemplateQueryVo.java | 19 + .../risk/constants/HazardRiskConstants.java | 58 +++ .../hzims/safeproduct/risk/dto/CorrelationDTO.java | 25 ++ .../safeproduct/risk/dto/HazardRiskProcessDTO.java | 22 ++ .../safeproduct/risk/dto/HazardSourceDTO.java | 22 ++ .../hzims/safeproduct/risk/dto/RiskCheckDTO.java | 24 ++ .../hzims/safeproduct/risk/entity/Correlation.java | 26 ++ .../safeproduct/risk/entity/HazardCategory.java | 26 ++ .../safeproduct/risk/entity/HazardEstimate.java | 71 ++++ .../hzims/safeproduct/risk/entity/HazardLevel.java | 41 +++ .../safeproduct/risk/entity/HazardSource.java | 56 +++ .../hzims/safeproduct/risk/entity/HazardTask.java | 55 +++ .../hzims/safeproduct/risk/entity/HazardWork.java | 48 +++ .../safeproduct/risk/entity/RiskCheckEntity.java | 46 +++ .../safeproduct/risk/entity/RiskEstimate.java | 29 ++ .../safeproduct/risk/entity/RiskEstimatePoint.java | 89 +++++ .../risk/feign/HazardRiskClientFallBack.java | 19 + .../safeproduct/risk/feign/IHazardRiskClient.java | 25 ++ .../safeproduct/risk/vo/CategorySourceVo.java | 29 ++ .../safeproduct/risk/vo/CorrelationDetailsVo.java | 22 ++ .../safeproduct/risk/vo/ExportEstimateVo.java | 78 ++++ .../hzims/safeproduct/risk/vo/HazardDetailsVo.java | 20 ++ .../safeproduct/risk/vo/HazardEstimateVo.java | 32 ++ .../hzims/safeproduct/risk/vo/HazardTaskVo.java | 27 ++ .../safeproduct/risk/vo/PersonalCheckItemVO.java | 48 +++ .../hnac/hzims/safeproduct/risk/vo/SourceVo.java | 42 +++ .../safeproduct/risk/vo/StationEstimateVo.java | 29 ++ .../safeproduct/risk/vo/StationRiskLevelVo.java | 25 ++ .../risk/wrapper/HazardSourceWrapper.java | 26 ++ .../safeproduct/risk/wrapper/RiskCheckWrapper.java | 33 ++ .../riskhazards/entity/ControlLevel.java | 44 +++ .../riskhazards/entity/DangerSourceInfo.java | 52 +++ .../riskhazards/entity/HiddenDanger.java | 30 ++ .../riskhazards/entity/RiskHazardsScreening.java | 59 +++ .../safeproduct/riskhazards/entity/RiskInfo.java | 69 ++++ .../riskhazards/entity/RiskMatrixX.java | 55 +++ .../riskhazards/entity/RiskMatrixY.java | 51 +++ .../riskhazards/entity/RiskPointInfo.java | 54 +++ .../safeproduct/riskhazards/entity/WorkArea.java | 57 +++ .../riskhazards/vo/ControlLevelQueryVo.java | 8 + .../riskhazards/vo/DangerSourceInfoQueryVo.java | 8 + .../riskhazards/vo/HiddenDangerQueryVo.java | 13 + .../riskhazards/vo/RiskHazardsScreeningVo.java | 10 + .../riskhazards/vo/RiskInfoQueryVo.java | 7 + .../riskhazards/vo/RiskMatrixXQueryVo.java | 8 + .../riskhazards/vo/RiskMatrixYQueryVo.java | 7 + .../riskhazards/vo/RiskPointInfoQueryVo.java | 8 + .../riskhazards/vo/WorkAreaQueryVo.java | 32 ++ .../hzims/safeproduct/statistic/Constants.java | 4 + .../statistic/vo/DangerRiskScatterVO.java | 31 ++ .../vo/RiskDangerAccidentMonthCountVO.java | 34 ++ .../statistic/vo/RiskDangerStatisticVO.java | 38 ++ .../safeproduct/statistic/vo/RiskInnerVO.java | 26 ++ .../statistic/vo/StationRiskStatisticVO.java | 29 ++ .../hzims/safeproduct/vo/HiddenDangerBaseVo.java | 170 +++++++++ .../hzims/safeproduct/vo/HiddenDangerCheckVo.java | 69 ++++ .../safeproduct/vo/HiddenDangerConclusionVo.java | 62 ++++ .../safeproduct/vo/HiddenDangerRectifierVo.java | 104 ++++++ .../hnac/hzims/safeproduct/vo/InnerDangerVo.java | 38 ++ .../com/hnac/hzims/safeproduct/vo/RiskCheckVO.java | 29 ++ .../safeproduct/workarea/entity/WorkArea.java | 54 --- .../safeproduct/workarea/vo/WorkAreaQueryVo.java | 32 -- .../message/schedule/MessagePushSchedule.java | 22 +- .../operational/constants/FlowKeyConstants.java | 8 + .../operational/constants/RedisKeyConstants.java | 3 + .../scheduled/MaintenanceTaskRemindHandler.java | 103 ++++++ .../scheduled/MaintenanceTaskSchedule.java | 18 +- .../maintenance/scheduled/TaskOverdueHandler.java | 66 +--- .../controller/DangerSourceController.java | 113 ------ .../controller/SafeReportController.java | 2 +- .../hzims/safeproduct/dto/DangerSourceDTO.java | 18 - .../safeproduct/dto/DangerSourcePositionDTO.java | 17 - .../safeproduct/enums/DangerSourceLevelEnum.java | 50 --- .../safeproduct/excel/DangerSourceImporter.java | 6 +- .../safeproduct/feign/DangerSourceClient.java | 2 +- .../controller/InnerDangerStartController.java | 126 +++++++ .../safeproduct/flow/mapper/InnerDangerMapper.java | 12 + .../safeproduct/flow/mapper/InnerDangerMapper.xml | 33 ++ .../flow/service/IInnerDangerFlowService.java | 42 +++ .../service/impl/InnerDangerFlowServiceImpl.java | 395 +++++++++++++++++++++ .../hazard/controller/DangerSourceController.java | 122 +++++++ .../hazard/controller/HazardLibraryController.java | 77 ++++ .../hazard/controller/RiskHazardController.java | 63 ++++ .../hazard/mapper/DangerSourceMapper.java | 26 ++ .../hazard/mapper/HazardLibraryMapper.java | 8 + .../hazard/service/IDangerSourceService.java | 47 +++ .../hazard/service/IHazardLibraryService.java | 31 ++ .../hazard/service/IRiskHazardService.java | 23 ++ .../service/impl/DangerSourceServiceImpl.java | 341 ++++++++++++++++++ .../service/impl/HazardLibraryServiceImpl.java | 30 ++ .../hazard/service/impl/RiskHazardServiceImpl.java | 249 +++++++++++++ .../safeproduct/hazard/util/ExcelConvertPdf.java | 182 ++++++++++ .../hzims/safeproduct/hazard/util/FILE_TYPE.java | 29 ++ .../safeproduct/hazard/vo/RiskHazardExcelVO.java | 57 +++ .../hazard/wrapper/DangerSourcePostionWrapper.java | 24 ++ .../hazard/wrapper/DangerSourceWrapper.java | 35 ++ .../hazard/wrapper/HazardLibraryWrapper.java | 19 + .../controller/HiddenDangerController.java | 63 ---- .../hiddendanger/mapper/HiddenDangerMapper.java | 7 - .../hiddendanger/service/HiddenDangerService.java | 19 - .../service/impl/HiddenDangerServiceImpl.java | 27 -- .../hzims/safeproduct/mapper/AccidentMapper.java | 7 +- .../hzims/safeproduct/mapper/AccidentMapper.xml | 16 + .../safeproduct/mapper/DangerSourceMapper.java | 26 -- .../safeproduct/mapper/DangerSourceMapper.xml | 2 +- .../risk/controller/CorrelationController.java | 67 ++++ .../risk/controller/EstimateController.java | 48 +++ .../risk/controller/EstimatePointController.java | 44 +++ .../risk/controller/HazardCategoryController.java | 93 +++++ .../risk/controller/HazardLevelController.java | 77 ++++ .../risk/controller/HazardSourceController.java | 55 +++ .../risk/controller/HazardTaskController.java | 55 +++ .../risk/controller/HazardWorkController.java | 89 +++++ .../risk/controller/RiskCheckController.java | 71 ++++ .../safeproduct/risk/feign/HazardRiskClient.java | 34 ++ .../safeproduct/risk/mapper/CorrelationMapper.java | 10 + .../safeproduct/risk/mapper/CorrelationMapper.xml | 6 + .../safeproduct/risk/mapper/EstimateMapper.java | 10 + .../safeproduct/risk/mapper/EstimateMapper.xml | 6 + .../risk/mapper/EstimatePointMapper.java | 10 + .../risk/mapper/EstimatePointMapper.xml | 6 + .../risk/mapper/HazardCategoryMapper.java | 15 + .../risk/mapper/HazardCategoryMapper.xml | 14 + .../risk/mapper/HazardEstimateMapper.java | 16 + .../risk/mapper/HazardEstimateMapper.xml | 15 + .../safeproduct/risk/mapper/HazardLevelMapper.java | 10 + .../safeproduct/risk/mapper/HazardLevelMapper.xml | 6 + .../risk/mapper/HazardSourceMapper.java | 23 ++ .../safeproduct/risk/mapper/HazardSourceMapper.xml | 42 +++ .../safeproduct/risk/mapper/HazardTaskMapper.java | 22 ++ .../safeproduct/risk/mapper/HazardTaskMapper.xml | 35 ++ .../safeproduct/risk/mapper/HazardWorkMapper.java | 14 + .../safeproduct/risk/mapper/HazardWorkMapper.xml | 6 + .../safeproduct/risk/mapper/RiskCheckMapper.java | 10 + .../risk/service/CorrelationService.java | 19 + .../risk/service/EstimatePointService.java | 11 + .../safeproduct/risk/service/EstimateService.java | 16 + .../risk/service/HazardCategoryService.java | 27 ++ .../risk/service/HazardEstimateService.java | 17 + .../risk/service/HazardLevelService.java | 11 + .../risk/service/HazardSourceService.java | 26 ++ .../risk/service/HazardTaskService.java | 34 ++ .../risk/service/HazardWorkService.java | 18 + .../risk/service/IRiskCheckService.java | 15 + .../risk/service/impl/CorrelationServiceImpl.java | 94 +++++ .../service/impl/EstimatePointServiceImpl.java | 30 ++ .../risk/service/impl/EstimateServiceImpl.java | 166 +++++++++ .../service/impl/HazardCategoryServiceImpl.java | 153 ++++++++ .../service/impl/HazardEstimateServiceImpl.java | 124 +++++++ .../risk/service/impl/HazardLevelServiceImpl.java | 19 + .../risk/service/impl/HazardSourceServiceImpl.java | 91 +++++ .../risk/service/impl/HazardTaskServiceImpl.java | 377 ++++++++++++++++++++ .../risk/service/impl/HazardWorkServiceImpl.java | 82 +++++ .../risk/service/impl/RiskCheckServiceImpl.java | 23 ++ .../controller/ControlLevelController.java | 68 ++++ .../controller/DangerSourceInfoController.java | 68 ++++ .../controller/HiddenDangerController.java | 61 ++++ .../controller/RiskHazardsScreeningController.java | 145 ++++++++ .../controller/RiskMatrixController.java | 164 +++++++++ .../controller/RiskPointInfoController.java | 69 ++++ .../riskhazards/controller/WorkAreaController.java | 63 ++++ .../riskhazards/mapper/ControlLevelMapper.java | 16 + .../riskhazards/mapper/DangerSourceInfoMapper.java | 16 + .../riskhazards/mapper/HiddenDangerMapper.java | 7 + .../mapper/RiskHazardsScreeningMapper.java | 7 + .../mapper/RiskHazardsScreeningMapper.xml | 5 + .../riskhazards/mapper/RiskInfoMapper.java | 16 + .../riskhazards/mapper/RiskInfoMapper.xml | 5 + .../riskhazards/mapper/RiskMatrixXMapper.java | 16 + .../riskhazards/mapper/RiskMatrixXMapper.xml | 5 + .../riskhazards/mapper/RiskMatrixYMapper.java | 16 + .../riskhazards/mapper/RiskMatrixYMapper.xml | 5 + .../riskhazards/mapper/RiskPointInfoMapper.java | 16 + .../mapper/SafeStandardNecessaryMapper.java | 16 + .../mapper/SafeStandardResultMapper.java | 16 + .../riskhazards/mapper/WorkAreaMapper.java | 7 + .../riskhazards/mapper/xml/ControlLevelMapper.xml | 5 + .../mapper/xml/DangerSourceInfoMapper.xml | 5 + .../riskhazards/mapper/xml/RiskPointInfoMapper.xml | 5 + .../mapper/xml/SafeStandardNecessaryMapper.xml | 5 + .../mapper/xml/SafeStandardResultMapper.xml | 5 + .../riskhazards/service/HiddenDangerService.java | 19 + .../riskhazards/service/IControlLevelService.java | 26 ++ .../service/IDangerSourceInfoService.java | 27 ++ .../service/IRiskHazardsScreeningService.java | 14 + .../riskhazards/service/IRiskInfoService.java | 19 + .../riskhazards/service/IRiskMatrixXService.java | 20 ++ .../riskhazards/service/IRiskMatrixYService.java | 19 + .../riskhazards/service/IRiskPointInfoService.java | 27 ++ .../riskhazards/service/WorkAreaService.java | 22 ++ .../service/impl/ControlLevelServiceImpl.java | 30 ++ .../service/impl/DangerSourceInfoServiceImpl.java | 31 ++ .../service/impl/HiddenDangerServiceImpl.java | 27 ++ .../impl/RiskHazardsScreeningServiceImpl.java | 110 ++++++ .../service/impl/RiskInfoServiceImpl.java | 30 ++ .../service/impl/RiskMatrixXServiceImpl.java | 30 ++ .../service/impl/RiskMatrixYServiceImpl.java | 30 ++ .../service/impl/RiskPointInfoServiceImpl.java | 31 ++ .../service/impl/WorkAreaServiceImpl.java | 93 +++++ .../safeproduct/riskhazards/util/ParamUtil.java | 34 ++ .../safeproduct/service/IAccidentService.java | 6 +- .../safeproduct/service/IDangerSourceService.java | 44 --- .../service/impl/AccidentServiceImpl.java | 34 ++ .../service/impl/DangerSourceServiceImpl.java | 328 ----------------- .../controller/RiskDangerStatisticController.java | 66 ++++ .../schedule/MainPageStatisticSchedule.java | 265 ++++++++++++++ .../statistic/schedule/RedisKeyConstants.java | 11 + .../statistic/schedule/XxlJobConstants.java | 11 + .../safeproduct/vo/DangerSourceLevelRecordVO.java | 2 +- .../safeproduct/vo/DangerSourcePositionVO.java | 18 - .../hnac/hzims/safeproduct/vo/DangerSourceVO.java | 36 -- .../workarea/controller/WorkAreaController.java | 63 ---- .../workarea/mapper/WorkAreaMapper.java | 7 - .../workarea/service/WorkAreaService.java | 22 -- .../workarea/service/impl/WorkAreaServiceImpl.java | 93 ----- .../wrapper/DangerSourcePostionWrapper.java | 24 -- .../safeproduct/wrapper/DangerSourceWrapper.java | 35 -- .../wrapper/RiskHazardsScreeningWrapper.java | 30 ++ .../safeproduct/src/main/resources/db/1.0.2.sql | 30 +- pom.xml | 3 +- 249 files changed, 9486 insertions(+), 1264 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/InnerDangerDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/InnerDangerEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourceDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourcePositionDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardLibraryDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/entity/HazardLibraryEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/enums/DangerSourceLevelEnum.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourcePositionVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/HazardLibraryVO.java delete mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java delete mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardNecessary.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardResult.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetTemplate.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/TargetTemplateQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/constants/HazardRiskConstants.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/CorrelationDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardRiskProcessDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardSourceDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/RiskCheckDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/Correlation.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardCategory.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardEstimate.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardLevel.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardSource.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardTask.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardWork.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskCheckEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimate.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimatePoint.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClientFallBack.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/IHazardRiskClient.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CategorySourceVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CorrelationDetailsVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/ExportEstimateVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardDetailsVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardEstimateVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardTaskVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/PersonalCheckItemVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/SourceVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationEstimateVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationRiskLevelVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/HazardSourceWrapper.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/RiskCheckWrapper.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/ControlLevel.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/DangerSourceInfo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/HiddenDanger.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskHazardsScreening.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskInfo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixX.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixY.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskPointInfo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/WorkArea.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/ControlLevelQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/DangerSourceInfoQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/HiddenDangerQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskHazardsScreeningVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskInfoQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixXQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixYQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskPointInfoQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/WorkAreaQueryVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/Constants.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/DangerRiskScatterVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerAccidentMonthCountVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerStatisticVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskInnerVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/StationRiskStatisticVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerBaseVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerCheckVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerConclusionVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerRectifierVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/InnerDangerVo.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RiskCheckVO.java delete mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java delete mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/FlowKeyConstants.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourceDTO.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourcePositionDTO.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/enums/DangerSourceLevelEnum.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/controller/InnerDangerStartController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/IInnerDangerFlowService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/RiskHazardController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/DangerSourceMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/HazardLibraryMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IHazardLibraryService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IRiskHazardService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/HazardLibraryServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/RiskHazardServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/ExcelConvertPdf.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/FILE_TYPE.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/RiskHazardExcelVO.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourcePostionWrapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.xml delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/CorrelationController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimateController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimatePointController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardCategoryController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardLevelController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardSourceController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardTaskController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/RiskCheckController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClient.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/RiskCheckMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/CorrelationService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimatePointService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimateService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardCategoryService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardEstimateService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardLevelService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardSourceService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardTaskService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/IRiskCheckService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/CorrelationServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimatePointServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardEstimateServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardLevelServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardSourceServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/RiskCheckServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/ControlLevelController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/DangerSourceInfoController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/HiddenDangerController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskHazardsScreeningController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskMatrixController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskPointInfoController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/WorkAreaController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/ControlLevelMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/DangerSourceInfoMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/HiddenDangerMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskPointInfoMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardNecessaryMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardResultMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/WorkAreaMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/ControlLevelMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/DangerSourceInfoMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/RiskPointInfoMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardNecessaryMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardResultMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/HiddenDangerService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IControlLevelService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IDangerSourceInfoService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskHazardsScreeningService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskInfoService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixXService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixYService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskPointInfoService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/WorkAreaService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/ControlLevelServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/DangerSourceInfoServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/HiddenDangerServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskHazardsScreeningServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskInfoServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixXServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixYServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskPointInfoServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/WorkAreaServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/util/ParamUtil.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/controller/RiskDangerStatisticController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/MainPageStatisticSchedule.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/RedisKeyConstants.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/XxlJobConstants.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourcePositionVO.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceVO.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/controller/WorkAreaController.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/mapper/WorkAreaMapper.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/WorkAreaService.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/impl/WorkAreaServiceImpl.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourcePostionWrapper.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourceWrapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/RiskHazardsScreeningWrapper.java diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java index 15c87dc..b68084b 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java @@ -18,6 +18,17 @@ import java.util.stream.IntStream; */ public class DateUtil { + public static final String yyyy_MM_dd_HH_MM_SS= "yyyy-MM-dd HH:mm:ss"; + public static final String yyyy_MM_dd= "yyyy-MM-dd"; + public static final String yyyy_MM= "yyyy-MM"; + public static final String yyyy= "yyyy"; + + public static final String YEAR = "year"; + public static final String QUARTER = "quarter"; + public static final String MONTH = "month"; + public static final String WEEK = "week"; + public static final String DAY = "day"; + /*** * Date 转换为 LocalDateTime * @param convertDate 需转换的时间 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/constants/ScheduledConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/constants/ScheduledConstant.java index b4dee83..7697529 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/constants/ScheduledConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/constants/ScheduledConstant.java @@ -19,4 +19,8 @@ public interface ScheduledConstant { String STATION_MONTH_REPORT = "stationMonthReport"; //自动生成个人运维月报 String PERSONAL_MONTH_REPORT = "personalMonthReport"; + //生成日常维护任务 + String GENERATE_MAINTENANCE_TASK_SCHEDULE = "generateMaintenanceTask"; + //日常维护任务到期提醒 + String REMIND_MAINTENANCE_BECOME_TASK = "remindMaintenanceBecomeTask"; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java index 5e490db..b0104d5 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java @@ -75,9 +75,13 @@ public class OperMaintenanceTaskEntity extends TenantEntity { * 执行日期 */ @ApiModelProperty(value = "任务按周期生成计划时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private Date disposeTime; @ApiModelProperty(value = "执行时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) private LocalDateTime executeTime; /** * 标准工时 diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java index 86b931f..fcdb8da 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java @@ -50,6 +50,7 @@ public class MessageConstants { OPERATIONAL("dailyRemind","运维管理"), EQUIPMENT("equipment","设备管理"), SAFE_PRODUCT("safeProduct","安全管理"), + SAFEPRODUCT_HIDDENDANGER("safeProduct-hiddenDanger","隐患处理消息"), ASSETS("assets","资产管理"), WARNING("warning","告警消息"), DUTY("duty","值班消息"), diff --git a/hzims-service-api/safeproduct-api/pom.xml b/hzims-service-api/safeproduct-api/pom.xml index b8843ad..1d2c5b7 100644 --- a/hzims-service-api/safeproduct-api/pom.xml +++ b/hzims-service-api/safeproduct-api/pom.xml @@ -20,6 +20,18 @@ com.alibaba easyexcel + + com.hnac.hzims + middle-api + + + org.springblade + blade-user-api + + + org.springblade + blade-dict-api + jar diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java index 0c5734e..eceea8d 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java @@ -55,4 +55,9 @@ public class Constants { this.describe = describe; } } + + /** + * 隐患流程标识 + */ + public static final String HIDDEN_DANGER_CHECK = "hiddenDangerCheck"; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AccidentDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AccidentDTO.java index ad82a82..8e3014a 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AccidentDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/AccidentDTO.java @@ -8,6 +8,7 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import java.io.Serializable; +import java.time.LocalDateTime; /** * @author hx @@ -15,5 +16,13 @@ import java.io.Serializable; @Data @EqualsAndHashCode public class AccidentDTO extends AccidentEntity implements Serializable { + private String yearMonth; + private String stationCode; + + private LocalDateTime startTime; + + private LocalDateTime endTime; + + private Long deptId; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/InnerDangerDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/InnerDangerDTO.java new file mode 100644 index 0000000..08fde24 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/InnerDangerDTO.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.dto; + +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName InnerDangerDTO + * @description: + * @author: hx + * @create: 2023-09-20 14:50 + * @Version 4.0 + **/ +@Data +@ApiModel("隐患信息DTO") +@EqualsAndHashCode +public class InnerDangerDTO extends InnerDangerEntity implements Serializable { + + @ApiModelProperty("隐患发起日期") + private String date; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java index 78d1c8b..ebca8f7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java @@ -22,6 +22,15 @@ public class DangerSourceEntity extends TenantEntity { private static final long serialVersionUID = 1L; + @ApiModelProperty("所属机构") + private Long refDept; + + @ApiModelProperty("所属机构名称") + private String refDeptName; + + @ApiModelProperty(value = "危险源库ID") + private Long libraryId; + /** * 危险源类型 1=作业活动 2=设备 */ @@ -34,6 +43,12 @@ public class DangerSourceEntity extends TenantEntity { @ApiModelProperty(value = "设备ID") @JsonSerialize(nullsUsing = NullSerializer.class) private Long eqId; + + @ApiModelProperty("设备编号") + private String emCode; + + @ApiModelProperty("设备名称") + private String emName; /** * 危险源名称 */ diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/InnerDangerEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/InnerDangerEntity.java new file mode 100644 index 0000000..edee04b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/InnerDangerEntity.java @@ -0,0 +1,299 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@TableName("hzims_inner_danger_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患信息", description = "隐患信息") +public class InnerDangerEntity extends TenantEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 隐患编码 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患编码") + private String code; + /** + * 流程实例 + */ + @ApiModelProperty(value = "流程实例") + private String processInstanceId; + /** + * 平台taskId + */ + @ApiModelProperty(value = "平台任务Id") + private String taskId; + + //===================风险点基础信息======================== + /** + * 站点编码 + */ + @ApiModelProperty(value = "站点编码") + private String stationCode; + /** + * 风险点Id + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "风险点Id") + private String riskPointId; + /** + * 风险点名称 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "风险点名称") + private String riskPointName; + /** + * 排查项目 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "排查项目") + private String investigation; + /** + * 风险点类型 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "风险点类型") + private String riskPointType; + /** + * 隐患责任部门 + */ + @ApiModelProperty(value = "隐患责任部门") + private Long hiddenDangerDept; + /** + * 隐患责任部门 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患责任部门") + private String hiddenDangerDeptName; + /** + * 隐患地点 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患地点") + private String hiddenDangerAddr; + + //===================隐患基础信息======================== + /** + * 隐患名称 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患名称") + private String hiddenDangerName; + /** + * 隐患类别 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患类别") + private String hiddenDangerType; + /** + * 隐患照片地址 + */ + @ApiModelProperty(value = "隐患照片地址") + private String hiddenDangerPic; + /** + * 登记人 + */ + @ApiModelProperty(value = "登记人") + private Long registrant; + /** + * 登记人姓名 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "登记人姓名") + private String registrantName; + /** + * 登记时间 + */ + @ApiModelProperty(value = "登记时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date registrantTime; + /** + * 当前处理环节 + */ + @QueryField(condition = SqlCondition.LIKE) + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前处理环节") + private String currentOperator; + /** + * 当前环节处理人 + */ + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前环节处理人") + private String currentLinkHandler; + //===================判定信息======================== + /** + * 判定人 + */ + @ApiModelProperty(value = "判定人") + private Long judge; + /** + * 判定人姓名 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "判定人姓名") + private String judgeName; + /** + * 是否是隐患 + */ + @ApiModelProperty(value = "是否是隐患") + @QueryField(condition = SqlCondition.EQUAL) + private Integer judgeRes; + /** + * 判定内容 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "判定内容") + private String judgeContext; + //===================核查信息======================== + /** + * 隐患等级(核查结果) + */ + @ApiModelProperty(value = "隐患等级(核查结果)") + private Integer hiddenDangerLevel; + /** + * 核查意见 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "核查意见") + private String checkView; + /** + * 核查治理措施 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "核查治理措施") + private String measures; + + /** + * 核查人 + */ + @ApiModelProperty(value = "核查人") + private Long checkPeople; + /** + * 核查人姓名 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "核查人姓名") + private String checkPeopleName; + /** + * 核查时间 + */ + @ApiModelProperty(value = "核查时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date checkTime; + + //===================整改信息======================== + /** + * 整改责任人 + */ + @ApiModelProperty(value = "整改责任人") + private Long rectifier; + /** + * 整改责任人姓名 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "整改责任人姓名") + private String rectifierName; + /** + * 整改责任部门ID + */ + @ApiModelProperty(value = "整改责任部门ID") + private Long rectifierDept; + /** + * 整改责任部门名称 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "整改责任部门名称") + private String rectifierDeptName; + /** + * 整改类型(立即整改) + */ + @ApiModelProperty(value = "整改类型(立即整改)") + private Integer rectifierType; + /** + * 完成期限 + */ + @ApiModelProperty(value = "完成期限") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date deadLine; + /** + * 整改通知单号 + */ + @ApiModelProperty(value = "整改通知单号") + private Long rectifierId; + //===================隐患整改反馈表======================== + /** + * 隐患存在原因 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患存在原因") + private String rectifierReason; + /** + * 治理后的效果图 + */ + @ApiModelProperty(value = "治理后的效果图") + private String rectifierPic; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "反馈时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date rectifierTime; + //===================验收信息======================== + + /** + * 验收结果(1完成,0未完成) + */ + @ApiModelProperty(value = "验收结果(完成,未完成)") + private Integer conclusionRes; + + /** + * 验收人 + */ + @ApiModelProperty(value = "验收人") + private Long conclusionPeople; + /** + * 验收验收人姓名 + */ + @ApiModelProperty(value = "验收验收人姓名") + private String conclusionPeopleName; + /** + * 验收意见 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "验收意见") + private String conclusionView; + /** + * 验收时间 + */ + @ApiModelProperty(value = "验收时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date conclusionTime; + + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourceDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourceDTO.java new file mode 100644 index 0000000..03def8b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourceDTO.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.safeproduct.hazard.dto; + +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author xiashandong + * @created 2020/9/1 15:16 + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class DangerSourceDTO extends DangerSourceEntity { + + private static final long serialVersionUID = 1L; + + private DangerSourcePositionDTO position; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourcePositionDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourcePositionDTO.java new file mode 100644 index 0000000..6db32b3 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/DangerSourcePositionDTO.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.safeproduct.hazard.dto; + +import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author xiashandong + * @created 2020/9/1 15:19 + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class DangerSourcePositionDTO extends DangerSourcePositionEntity { + + private static final long serialVersionUID = 1L; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java new file mode 100644 index 0000000..f459815 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.hazard.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("危险源库实例化") +@EqualsAndHashCode +public class HazardInstanceDTO implements Serializable { + + @ApiModelProperty("所属站点") + private Long deptId; + + @ApiModelProperty("所属站点名称") + private String deptName; + + @ApiModelProperty("设备编号") + private String emCode; + + @ApiModelProperty("设备名称") + private String emName; + + @ApiModelProperty("危险源列表") + private List hazardList; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardLibraryDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardLibraryDTO.java new file mode 100644 index 0000000..bcad4c0 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardLibraryDTO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.hazard.dto; + +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode +@ApiModel(value = "危险源库DTO对象",description = "危险源库DTO对象") +public class HazardLibraryDTO extends HazardLibraryEntity implements Serializable { + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/entity/HazardLibraryEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/entity/HazardLibraryEntity.java new file mode 100644 index 0000000..bb66d70 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/entity/HazardLibraryEntity.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.safeproduct.hazard.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tenant.mp.TenantEntity; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@TableName("hzims_hazard_library") +@Data +@ApiModel("危险源库") +@EqualsAndHashCode +public class HazardLibraryEntity extends TenantEntity implements Serializable { + + @ApiModelProperty(value = "站点类型") + @QueryField(condition = SqlCondition.EQUAL) + @NotNull + private Integer stationType; + + @ApiModelProperty("站点类型名称") + @NotNull + private String stationTypeName; + + @ApiModelProperty(value = "危险源类型") + @NotNull + private String type; + + @ApiModelProperty("危险源名称") + @QueryField(condition = SqlCondition.LIKE) + @NotNull + private String name; + + @ApiModelProperty("所在部位") + private String position; + + @ApiModelProperty(value = "危险因素") + @NotNull + private String dangerEle; + + @ApiModelProperty(value = "可能导致的事故") + @NotNull + private String cause; + + @ApiModelProperty(value = "措施") + private String measures; + + @ApiModelProperty(value = "风险等级 10=稍有危险 20=一般危险 30=显著危险 40=高度危险") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer level; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/enums/DangerSourceLevelEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/enums/DangerSourceLevelEnum.java new file mode 100644 index 0000000..ad93f58 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/enums/DangerSourceLevelEnum.java @@ -0,0 +1,50 @@ +package com.hnac.hzims.safeproduct.hazard.enums; + +import org.springblade.core.tool.utils.StringUtil; + +/** + * 危险源等级Enum + * + * @author xiashandong + * @created 2020/9/1 15:34 + **/ +public enum DangerSourceLevelEnum { + _10(10, "稍有危险"), + _20(20, "一般危险"), + _30(30, "显著危险"), + _40(40, "高度危险"); + + private int value; + private String name; + + DangerSourceLevelEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } + + public static String getName(int value) { + for (DangerSourceLevelEnum item : DangerSourceLevelEnum.values()) { + if (value == item.getValue()) { + return item.getName(); + } + } + return ""; + } + + public static Integer getValue(String name) { + for (DangerSourceLevelEnum item : DangerSourceLevelEnum.values()) { + if (StringUtil.equals(name, item.getName())) { + return item.getValue(); + } + } + return null; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourcePositionVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourcePositionVO.java new file mode 100644 index 0000000..1371e2e --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourcePositionVO.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.safeproduct.hazard.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; + +/** + * 模型VO + * + * @author Chill + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DangerSourcePositionVO extends DangerSourcePositionEntity { + + private static final long serialVersionUID = 1L; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java new file mode 100644 index 0000000..edab947 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java @@ -0,0 +1,37 @@ +package com.hnac.hzims.safeproduct.hazard.vo; + +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author xiashandong + * @created 2020/9/1 15:46 + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class DangerSourceVO extends DangerSourceEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "危险等级Name") + private String levelName; + + @ApiModelProperty(value = "危险等级Name") + private String applyTypeName; + + @ApiModelProperty("创建人名称") + private String createUserName; + + @ApiModelProperty("修改人名称") + private String updateUserName; + + private DangerSourcePositionVO position; + + public String getLevelName() { + return DangerSourceLevelEnum.getName(super.getLevel()); + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/HazardLibraryVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/HazardLibraryVO.java new file mode 100644 index 0000000..f116aa3 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/HazardLibraryVO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.hazard.vo; + +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode +@ApiModel(value = "危险源库VO对象",description = "危险源库VO对象") +public class HazardLibraryVO extends HazardLibraryEntity implements Serializable { + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java deleted file mode 100644 index 1924629..0000000 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/entity/HiddenDanger.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@TableName("hidden_danger") -public class HiddenDanger { - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 危险行为 - */ - @TableField("danger_behavior") - private String dangerBehavior; - - /** - * 发生次数 - */ - @TableField("times") - private Integer times; -} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java deleted file mode 100644 index 384bab9..0000000 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/vo/HiddenDangerQueryVo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import lombok.Data; - -@Data -public class HiddenDangerQueryVo { - /** - * 危险行为 - */ - @TableField("danger_behavior") - private String dangerBehavior; -} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/DocumentManagement.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/DocumentManagement.java index fafbe44..c082a3f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/DocumentManagement.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/DocumentManagement.java @@ -1,16 +1,15 @@ package com.hnac.hzims.safeproduct.management.entity; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; +import org.springblade.core.mp.base.BaseEntity; /** *

- * 文档管理 + * 电站安全标准化文档管理 *

* * @author dfy @@ -20,13 +19,9 @@ import java.time.LocalDateTime; @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("document_management") -public class DocumentManagement implements Serializable { +public class DocumentManagement extends BaseEntity{ private static final long serialVersionUID=1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - /** * 文档名称 */ @@ -34,41 +29,33 @@ public class DocumentManagement implements Serializable { private String documentName; /** - * 文档路径 + * 电站编码 */ - @TableField("document_url") - private String documentUrl; + @TableField("station_code") + private String stationCode; /** - * 创建人Id + * 指标项id */ - @TableField("creator_id") - private Long creatorId; + @TableField("indicator_management_id") + private String indicatorManagementId; /** - * 创建人名称 - */ - @TableField("creator_name") - private String creatorName; - - /** - * 创建时间 + * 文档路径 */ - @TableField("create_time") - private LocalDateTime createTime; + @TableField("document_url") + private String documentUrl; /** - * 更新时间 + * 电站名称 */ - @TableField("update_time") - private LocalDateTime updateTime; + @TableField(exist = false) + private String stationName; /** - * 逻辑删除 + * 项目名称 */ - @TableLogic - @TableField("is_deleted") - private Integer isDeleted; - + @TableField(exist = false) + private String productName; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/RatingScale.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/RatingScale.java index 9345a44..d7f8584 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/RatingScale.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/RatingScale.java @@ -27,7 +27,7 @@ public class RatingScale implements Serializable { /** * 编号 */ - @TableId(value = "id", type = IdType.AUTO) + @TableId(value = "id", type = IdType.ASSIGN_ID) private Long id; /** @@ -49,6 +49,18 @@ public class RatingScale implements Serializable { private String reviewDescription; /** + * 电站编码 + */ + @TableField("station_code") + private String stationCode; + + /** + * 评分时间 + */ + @TableField("score_time") + private LocalDateTime scoreTime; + + /** * 创建时间 */ @TableField("create_time") diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardNecessary.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardNecessary.java new file mode 100644 index 0000000..b3e9cd3 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardNecessary.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.safeproduct.management.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springblade.core.mp.base.BaseEntity; + +/** + *

+ * 安全标准必要条件 + *

+ * + * @author zhaiqm + * @since 2023-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("safe_standard_necessary") +public class SafeStandardNecessary extends BaseEntity { + + /** + * 名称 + */ + @TableField("name") + private String name; + + @TableField(exist = false) + private String check; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardResult.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardResult.java new file mode 100644 index 0000000..f0734ff --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/SafeStandardResult.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.safeproduct.management.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springblade.core.mp.base.BaseEntity; + +import java.time.LocalDateTime; + +/** + *

+ * 安全标准必要条件结果 + *

+ * + * @author zhaiqm + * @since 2023-09-16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("safe_standard_result") +public class SafeStandardResult extends BaseEntity { + + /** + * 必要条件id + */ + @TableField("necessary_id") + private Long necessaryId; + + /** + * 电站编码 + */ + @TableField("station_code") + private String stationCode; + + /** + * 评分时间 + */ + @TableField("score_time") + private LocalDateTime scoreTime; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetManagement.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetManagement.java index be6f001..7e2fe76 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetManagement.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetManagement.java @@ -5,7 +5,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @@ -21,17 +20,21 @@ import java.util.List; @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("target_management") -public class TargetManagement implements Serializable { - - private static final long serialVersionUID = 1L; +public class TargetManagement { /** * 编号 */ - @TableId(value = "id", type = IdType.AUTO) + @TableId(value = "id", type = IdType.ASSIGN_ID) private Long id; /** + * 模板id + */ + @TableField("template_id") + private Long templateId; + + /** * 名称 */ @TableField("name") @@ -72,10 +75,11 @@ public class TargetManagement implements Serializable { */ @TableLogic @TableField("is_deleted") - private Boolean deleted; - + private Boolean isDeleted; @TableField(exist = false) private List children; + @TableField(exist = false) + private List childrens; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetTemplate.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetTemplate.java new file mode 100644 index 0000000..7e88bb8 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/entity/TargetTemplate.java @@ -0,0 +1,57 @@ +package com.hnac.hzims.safeproduct.management.entity; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("target_template") +public class TargetTemplate implements Serializable { + + private static final long serialVersionUID = 1L; + + + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 模板名称 + */ + @TableField("template_name") + private String templateName; + + /** + * 模板状态 0-未启用,1-启用 + */ + @TableField("state") + private Integer state; + + /** + * 创建时间 + */ + @TableField("create_time") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField("update_time") + private LocalDateTime updateTime; + + /** + * 逻辑删除 + */ + @TableLogic + @TableField("is_deleted") + private Boolean isDeleted; + + @TableField(exist = false) + private List targetManagement; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/DocumentManagementQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/DocumentManagementQueryVo.java index 375c018..9f3180a 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/DocumentManagementQueryVo.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/DocumentManagementQueryVo.java @@ -17,4 +17,10 @@ public class DocumentManagementQueryVo { */ @TableField("document_name") private String documentName; + + @TableField("station_code") + private String stationCode; + + @TableField("indicator_management_id") + private Long indicatorManagementId; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/RatingScaleVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/RatingScaleVo.java index b2527d1..eacaa89 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/RatingScaleVo.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/RatingScaleVo.java @@ -26,4 +26,9 @@ public class RatingScaleVo { * 评审描述 */ private String reviewDescription; + + /** + * 电站编码 + */ + private String stationCode; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/TargetTemplateQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/TargetTemplateQueryVo.java new file mode 100644 index 0000000..d049dc6 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/management/vo/TargetTemplateQueryVo.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.management.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +@Data +public class TargetTemplateQueryVo { + /** + * 模板名称 + */ + @TableField("template_name") + private String templateName; + + /** + * 模板状态 0-未启用,1-启用 + */ + @TableField("state") + private Integer state; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/constants/HazardRiskConstants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/constants/HazardRiskConstants.java new file mode 100644 index 0000000..dff7561 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/constants/HazardRiskConstants.java @@ -0,0 +1,58 @@ +package com.hnac.hzims.safeproduct.risk.constants; + +import java.util.Arrays; +import java.util.List; + +/** + * @author ysj + */ +public interface HazardRiskConstants { + + String END = "流程结束"; + + String EXAMINE = "examine"; + + String REVIEW = "review"; + + /** + * 风险排查用户 + */ + String HAZARD_RISK_KEY = "hazard_risk"; + + /** + * 风险排查用户 + */ + String TROUBLE = "trouble"; + + /** + * LS 风险评估方法 : L * C/S + */ + Integer LS = 1; + + /** + * LEC 风险评估方法 : L * E * C/S + */ + Integer LEC = 2; + + /** + * 风险等级 : 1-低风险 2-一般风险 3-较大风险 4-重大风险 + */ + List HAZARD_LEVELS = Arrays.asList(1L,2L,3L,4L); + + Integer SIGNIFICANT_RISK = 1; + + /** + * 流程步骤 : + * 1 - 危险源排查 + * 2 - 排查结果审核 + * 3 - 重大风险整改 + * 4 - 整改审核 + */ + String HAZARD_RISK_NEW_PROPERTY = "defaultExpression"; + + String HAZARD_RISK_NEW_PROPERTY_1 = "1"; + String HAZARD_RISK_NEW_PROPERTY_2 = "2"; + String HAZARD_RISK_NEW_PROPERTY_3 = "3"; + String HAZARD_RISK_NEW_PROPERTY_4 = "4"; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/CorrelationDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/CorrelationDTO.java new file mode 100644 index 0000000..eaad69b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/CorrelationDTO.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.risk.dto; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ysj + */ +@Data +@ApiModel("风险点实体类DTO") +@EqualsAndHashCode(callSuper = false) +public class CorrelationDTO { + + @ApiModelProperty(value = "作业区域Id") + private Long workId; + + @ApiModelProperty(value = "危险源列表") + private List sources; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardRiskProcessDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardRiskProcessDTO.java new file mode 100644 index 0000000..aa33da3 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardRiskProcessDTO.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.risk.dto; + +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.entity.HazardTask; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ysj + */ +@Data +@ApiModel("风险流程启动实体类") +@EqualsAndHashCode(callSuper = false) +public class HazardRiskProcessDTO extends HazardTask { + + @ApiModelProperty(value = "危险源Id集合") + private List estimates; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardSourceDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardSourceDTO.java new file mode 100644 index 0000000..0547c82 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/HazardSourceDTO.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.risk.dto; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName HazardSourceDTO + * @description: 风险点DTO + * @author: hx + * @create: 2023-09-18 14:11 + * @Version 4.0 + **/ +@Data +@ApiModel("风险点实体类DTO") +@EqualsAndHashCode(callSuper = false) +public class HazardSourceDTO extends HazardSource implements Serializable { + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/RiskCheckDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/RiskCheckDTO.java new file mode 100644 index 0000000..75fdfdd --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/dto/RiskCheckDTO.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.safeproduct.risk.dto; + +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName RiskCheckDTO + * @description: 风险检查项DTO + * @author: hx + * @create: 2023-09-19 09:27 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +@ApiModel("风险检查项DTO") +public class RiskCheckDTO extends RiskCheckEntity implements Serializable { + + + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/Correlation.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/Correlation.java new file mode 100644 index 0000000..caf04ae --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/Correlation.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_work_source_correlation") +public class Correlation extends BaseEntity { + + @ApiModelProperty(value = "作业区域ID") + private Long workId; + + @ApiModelProperty(value = "风险点Id") + private Long categoryId; + + @ApiModelProperty(value = "危险源ID") + private Long sourceId; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardCategory.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardCategory.java new file mode 100644 index 0000000..0c7bb96 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardCategory.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_category") +public class HazardCategory extends BaseEntity { + + @ApiModelProperty(value = "站点类别") + private Integer stationType; + + @ApiModelProperty(value = "类别 :构筑物类、金属结构类、设备设施类") + private Integer category; + + @ApiModelProperty(value = "危险点") + private String perilPoint; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardEstimate.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardEstimate.java new file mode 100644 index 0000000..9bb9208 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardEstimate.java @@ -0,0 +1,71 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_estimate") +public class HazardEstimate extends BaseEntity { + + @ApiModelProperty(value = "风险任务排查Id") + private Long taskId; + + @ApiModelProperty(value = "风险点Id") + private Long categoryId; + + @ApiModelProperty(value = "风险等级ID") + private Long levelId; + + @ApiModelProperty(value = "风险等级") + private Integer level; + + @ApiModelProperty(value = "风险等级名称") + private String levelDesc; + + @ApiModelProperty(value = "危险源Id") + private Long sourceId; + + @ApiModelProperty(value = "危险源名称") + private String hazardName; + + @ApiModelProperty(value = "事故诱因") + private String accidentIncentive; + + @ApiModelProperty(value = "导致后果") + private String causeConsequence; + + @ApiModelProperty(value = "评价方法 :LS、LEC") + private Integer evaluationMethod; + + @ApiModelProperty(value = "L值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double lValue; + + @ApiModelProperty(value = "E值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double eValue; + + @ApiModelProperty(value = "cs值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double cSValue; + + @ApiModelProperty(value = "R/D计算值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double rDValue; + + @ApiModelProperty(value = "整改描述") + private String rectificationDesc; + + @ApiModelProperty(value = "整改附件") + private String rectificationAttachment; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardLevel.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardLevel.java new file mode 100644 index 0000000..0b2478b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardLevel.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_level") +public class HazardLevel extends BaseEntity { + + @ApiModelProperty(value = "风险点Id") + private Long categoryId; + + @ApiModelProperty(value = "危险源Id") + private Long sourceId; + + @ApiModelProperty(value = "危险源名称") + private String hazardName; + + @ApiModelProperty(value = "R值上限值") + private Double rMaxValue; + + @ApiModelProperty(value = "R值下限值") + private Double rMinValue; + + @ApiModelProperty(value = "危险程度 : 极其危险、高度危险、中度危险、轻度危险") + private Integer risk; + + @ApiModelProperty(value = "风险等级 : 重大风险、较大风险、一般风险、低风险") + private Integer riskLevel; + + @ApiModelProperty(value = "颜色标识 : 红、橙、黄、蓝") + private Integer colour; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardSource.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardSource.java new file mode 100644 index 0000000..b6e808b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardSource.java @@ -0,0 +1,56 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_source") +public class HazardSource extends BaseEntity { + + @ApiModelProperty(value = "风险点主键ID") + private Long categoryId; + + @ApiModelProperty(value = "危险源") + @QueryField(condition = SqlCondition.LIKE) + private String hazardName; + + @ApiModelProperty(value = "事故诱因") + @QueryField(condition = SqlCondition.LIKE) + private String accidentIncentive; + + @ApiModelProperty(value = "导致后果") + @QueryField(condition = SqlCondition.LIKE) + private String causeConsequence; + + @ApiModelProperty(value = "评价方法 :LS、LEC") + @QueryField(condition = SqlCondition.EQUAL) + private Integer evaluationMethod; + + @ApiModelProperty(value = "L上限值") + private Double lUpLimit; + + @ApiModelProperty(value = "L下限值") + private Double lDownLimit; + + @ApiModelProperty(value = "E上限值") + private Double eUpLimit; + + @ApiModelProperty(value = "E下限值") + private Double eDownLimit; + + @ApiModelProperty(value = "C/S上限值") + private Double cSUpLimit; + + @ApiModelProperty(value = "C/S下限值") + private Double cSDownLimit; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardTask.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardTask.java new file mode 100644 index 0000000..bbeee20 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardTask.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.util.Date; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_task") +public class HazardTask extends BaseEntity { + + @ApiModelProperty(value = "工作流实例Id") + private String processInstanceId; + + @ApiModelProperty(value = "站点编码") + private String stationCode; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "排查任务名称") + private String taskName; + + @ApiModelProperty(value = "作业区域Id") + private Long workId; + + @ApiModelProperty(value = "负责人") + private Long head; + + @ApiModelProperty(value = "排查任务计划开始时间") + private Date planStartTime; + + @ApiModelProperty(value = "排查任务计划完成时间") + private Date planEndTime; + + @ApiModelProperty(value = "任务实际开始时间") + private Date actStartTime; + + @ApiModelProperty(value = "任务实际完成时间") + private Date actEndTime; + + @ApiModelProperty(value = "流程步骤名称") + private String processSteps; + + @ApiModelProperty(value = "流程步骤人员名称") + private String nextStepOperator; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardWork.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardWork.java new file mode 100644 index 0000000..5aeecc0 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/HazardWork.java @@ -0,0 +1,48 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.mp.support.QueryField; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_hazard_work") +public class HazardWork extends BaseEntity { + + @ApiModelProperty(value = "站点编码") + @QueryField(condition = SqlCondition.EQUAL) + private String stationCode; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "作业区域名称") + @QueryField(condition = SqlCondition.LIKE) + private String regionName; + + @ApiModelProperty(value = "经度") + private Double longitude; + + @ApiModelProperty(value = "经度") + private Double latitude; + + @ApiModelProperty(value = "负责人") + @QueryField(condition = SqlCondition.EQUAL) + private Long head; + + @ApiModelProperty(value = "监管部门") + @QueryField(condition = SqlCondition.LIKE) + private String regulator; + + @ApiModelProperty(value = "分管领导") + @QueryField(condition = SqlCondition.EQUAL) + private Long manage; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskCheckEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskCheckEntity.java new file mode 100644 index 0000000..c43265d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskCheckEntity.java @@ -0,0 +1,46 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tenant.mp.TenantEntity; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @ClassName RiskCheckEntity + * @description: + * @author: hx + * @create: 2023-09-19 09:21 + * @Version 4.0 + **/ +@Data +@ApiModel("风险点检查项") +@EqualsAndHashCode +@TableName("hzims_risk_check") +public class RiskCheckEntity extends TenantEntity implements Serializable { + + @ApiModelProperty(value = "风险点Id",required = true) + @QueryField(condition = SqlCondition.EQUAL) + @NotNull + private Long categoryId; + + @ApiModelProperty("风险点名称") + @QueryField(condition = SqlCondition.LIKE) + private String categoryName; + + @ApiModelProperty("类型") + @QueryField(condition = SqlCondition.EQUAL) + private String type; + + @ApiModelProperty(value = "检查项",required = true) + @QueryField(condition = SqlCondition.LIKE) + @NotNull + private String checkItem; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimate.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimate.java new file mode 100644 index 0000000..3a04c2d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimate.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_estimate") +public class RiskEstimate extends BaseEntity { + + @ApiModelProperty(value = "站点编码") + private String stationCode; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "站点类别 :闸门、水库") + private Integer stationType; + + @ApiModelProperty(value = "风险评估年度") + private String estimateYear; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimatePoint.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimatePoint.java new file mode 100644 index 0000000..0588941 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/entity/RiskEstimatePoint.java @@ -0,0 +1,89 @@ +package com.hnac.hzims.safeproduct.risk.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("hzims_risk_estimate_point") +public class RiskEstimatePoint extends BaseEntity { + + @ApiModelProperty(value = "风险评估Id") + private Long estimateId; + + @ApiModelProperty(value = "风险点Id") + private Long categoryId; + + @ApiModelProperty(value = "风险点类别") + private Integer category; + + @ApiModelProperty(value = "危险点") + private String perilPoint; + + @ApiModelProperty(value = "危险源Id") + private Long sourceId; + + @ApiModelProperty(value = "危险源") + private String hazardName; + + @ApiModelProperty(value = "事故诱因") + private String accidentIncentive; + + @ApiModelProperty(value = "导致后果") + private String causeConsequence; + + @ApiModelProperty(value = "评价方法 :LS、LEC") + private Integer evaluationMethod; + + @ApiModelProperty(value = "L上限值") + private Double lUpLimit; + + @ApiModelProperty(value = "L下限值") + private Double lDownLimit; + + @ApiModelProperty(value = "E上限值") + private Double eUpLimit; + + @ApiModelProperty(value = "E下限值") + private Double eDownLimit; + + @ApiModelProperty(value = "C/S上限值") + private Double cSUpLimit; + + @ApiModelProperty(value = "C/S下限值") + private Double cSDownLimit; + + @ApiModelProperty(value = "L值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double lValue; + + @ApiModelProperty(value = "E值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double eValue; + + @ApiModelProperty(value = "cs值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double cSValue; + + @ApiModelProperty(value = "R/D计算值") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double rDValue; + + @ApiModelProperty(value = "风险等级Id") + private Long levelId; + + @ApiModelProperty(value = "风险等级") + private Integer level; + + @ApiModelProperty(value = "等级描述") + private String levelDesc; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClientFallBack.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClientFallBack.java new file mode 100644 index 0000000..32c7da2 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClientFallBack.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.risk.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + +/** + * @author ysj + */ +@Slf4j +@Component +public class HazardRiskClientFallBack implements IHazardRiskClient { + + @Override + public R listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return R.fail("执行失败!"); + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/IHazardRiskClient.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/IHazardRiskClient.java new file mode 100644 index 0000000..28e4caf --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/feign/IHazardRiskClient.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.risk.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.Constants; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author ysj + */ +@FeignClient( + value = Constants.APP_NAME, + fallback = HazardRiskClientFallBack.class +) +public interface IHazardRiskClient { + + String API_PREFIX = "/feign/hazardRisk"; + + String PLAN_PROCESS_LISTENER = API_PREFIX + "/listener"; + + @PostMapping(PLAN_PROCESS_LISTENER) + R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CategorySourceVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CategorySourceVo.java new file mode 100644 index 0000000..1076908 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CategorySourceVo.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class CategorySourceVo extends HazardSource { + + + @ApiModelProperty(value = "站点类型") + private Integer stationType; + + @ApiModelProperty(value = "类别 :构筑物类、金属结构类、设备设施类") + private Integer category; + + @ApiModelProperty(value = "危险点") + private String perilPoint; + + @ApiModelProperty(value = "创建时间") + private Date time; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CorrelationDetailsVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CorrelationDetailsVo.java new file mode 100644 index 0000000..2aaf4ba --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/CorrelationDetailsVo.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class CorrelationDetailsVo { + + @ApiModelProperty(value = "作业区域Id") + private Long workId; + + @ApiModelProperty(value = "风险点主键ID") + private List sources; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/ExportEstimateVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/ExportEstimateVo.java new file mode 100644 index 0000000..126b7a0 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/ExportEstimateVo.java @@ -0,0 +1,78 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class ExportEstimateVo implements Serializable { + + @ApiModelProperty(value = "序号") + private Integer index; + + @ApiModelProperty(value = "站点编码") + private String stationCode; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "类别") + private Integer category; + + @ApiModelProperty(value = "类别名称") + private String categoryName; + + @ApiModelProperty(value = "风险点Id") + private Long perilPointId; + + @ApiModelProperty(value = "风险点名称") + private String perilPoint; + + @ApiModelProperty(value = "危险源Id") + private Long sourceId; + + @ApiModelProperty(value = "危险源名称") + private String hazardName; + + @ApiModelProperty(value = "事故诱因") + private String accidentIncentive; + + @ApiModelProperty(value = "导致后果") + private String causeConsequence; + + @ApiModelProperty(value = "评价方法") + private Integer evaluationMethod; + + @ApiModelProperty(value = "评价方法描述") + private String methodName; + + @ApiModelProperty(value = "L值") + private Double l; + + @ApiModelProperty(value = "E值") + private Double e; + + @ApiModelProperty(value = "C/S值") + private Double s; + + @ApiModelProperty(value = "R/D值") + private Double r; + + @ApiModelProperty(value = "风险等级") + private Integer level; + + @ApiModelProperty(value = "风险等级名称") + private String levelName; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardDetailsVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardDetailsVo.java new file mode 100644 index 0000000..89095bf --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardDetailsVo.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class HazardDetailsVo extends HazardCategory { + + @ApiModelProperty(value = "风险点主键ID") + private List sources; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardEstimateVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardEstimateVo.java new file mode 100644 index 0000000..c11af94 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardEstimateVo.java @@ -0,0 +1,32 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class HazardEstimateVo extends HazardEstimate { + + @ApiModelProperty(value = "L上限值") + private Double lUpLimit; + + @ApiModelProperty(value = "L下限值") + private Double lDownLimit; + + @ApiModelProperty(value = "E上限值") + private Double eUpLimit; + + @ApiModelProperty(value = "E下限值") + private Double eDownLimit; + + @ApiModelProperty(value = "C/S上限值") + private Double cSUpLimit; + + @ApiModelProperty(value = "C/S下限值") + private Double cSDownLimit; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardTaskVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardTaskVo.java new file mode 100644 index 0000000..f3bfc3e --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardTaskVo.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.entity.HazardTask; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; +import java.util.List; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class HazardTaskVo extends HazardTask { + + @ApiModelProperty("开始时间") + private Date startTime; + + @ApiModelProperty("结束时间") + private Date endTime; + + @ApiModelProperty("风险评估对象") + private List estimates; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/PersonalCheckItemVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/PersonalCheckItemVO.java new file mode 100644 index 0000000..2950de6 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/PersonalCheckItemVO.java @@ -0,0 +1,48 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode +@ApiModel("个人排查项") +public class PersonalCheckItemVO implements Serializable { + + @ApiModelProperty(value = "负责人ID") + private Long userId; + + @ApiModelProperty(value = "负责人名称") + private String userName; + + @ApiModelProperty(value = "区域ID") + private Long areaId; + + @ApiModelProperty(value = "区域") + private String areaName; + + @ApiModelProperty(value = "风险点主键ID") + private Long categoryId; + + @ApiModelProperty(value = "风险点") + private String categoryName; + + @ApiModelProperty(value = "危险源ID") + private Long hazardId; + + @ApiModelProperty(value = "危险源") + private String hazardName; + + @ApiModelProperty(value = "事故诱因") + private String accidentIncentive; + + @ApiModelProperty(value = "导致后果") + private String causeConsequence; + + @ApiModelProperty(value = "评价方法 :LS、LEC") + private Integer evaluationMethod; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/SourceVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/SourceVo.java new file mode 100644 index 0000000..ad3ae7b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/SourceVo.java @@ -0,0 +1,42 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class SourceVo extends HazardSource { + + @ApiModelProperty + private Long workId; + + @ApiModelProperty + private List sourceIds; + + @ApiModelProperty(value = "站点类别") + private Integer stationType; + + @ApiModelProperty(value = "类别 :构筑物类、金属结构类、设备设施类") + private Integer category; + + @ApiModelProperty(value = "危险点") + private String perilPoint; + + @ApiModelProperty(value = "风险评价方法") + private String estimateMethod; + + @ApiModelProperty(value = "类别名称") + private String categoryName; + + @ApiModelProperty(value = "风险评价方法名称") + private String estimateMethodName; + +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationEstimateVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationEstimateVo.java new file mode 100644 index 0000000..dfb0d1b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationEstimateVo.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class StationEstimateVo implements Serializable { + + @ApiModelProperty(value = "年份") + private String year; + + @ApiModelProperty(value = "站点编码") + private String stationCode; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "评估记录列表") + private List exportEstimates; + +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationRiskLevelVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationRiskLevelVo.java new file mode 100644 index 0000000..b31b758 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/StationRiskLevelVo.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.risk.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ysj + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class StationRiskLevelVo { + + @ApiModelProperty("站点编码") + private String stationCode; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("风险等级") + private Long level; + + @ApiModelProperty("风险等级名称") + private Long levelName; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/HazardSourceWrapper.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/HazardSourceWrapper.java new file mode 100644 index 0000000..908a4ec --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/HazardSourceWrapper.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.risk.wrapper; + +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +/** + * @ClassName HazardSourceWrapper + * @description: + * @author: hx + * @create: 2023-09-18 14:21 + * @Version 4.0 + **/ +public class HazardSourceWrapper extends BaseEntityWrapper { + + public static HazardSourceWrapper build() { + return new HazardSourceWrapper(); + } + + @Override + public SourceVo entityVO(HazardSource entity) { + SourceVo sourceVo = BeanUtil.copy(entity, SourceVo.class); + return sourceVo; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/RiskCheckWrapper.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/RiskCheckWrapper.java new file mode 100644 index 0000000..d3ab86c --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/wrapper/RiskCheckWrapper.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.safeproduct.risk.wrapper; + +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import com.hnac.hzims.safeproduct.vo.RiskCheckVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; + +import java.util.Optional; + +/** + * @ClassName RiskCheckWrapper + * @description: + * @author: hx + * @create: 2023-09-19 09:43 + * @Version 4.0 + **/ +public class RiskCheckWrapper extends BaseEntityWrapper { + + public static RiskCheckWrapper build() { + return new RiskCheckWrapper(); + } + + @Override + public RiskCheckVO entityVO(RiskCheckEntity entity) { + RiskCheckVO checkVO = BeanUtil.copy(entity, RiskCheckVO.class); + checkVO.setCreatorName(Optional.ofNullable(entity.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(null)); + checkVO.setUpdateUserName(Optional.ofNullable(entity.getUpdateUser()).map(UserCache::getUser).map(User::getName).orElse(null)); + return checkVO; + } + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/ControlLevel.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/ControlLevel.java new file mode 100644 index 0000000..305f241 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/ControlLevel.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.springblade.core.mp.base.BaseEntity; + +/** + *

+ * 管控级别定义表 + *

+ * + * @author zhaiqm + * @since 2023-09-13 + */ +@Data +@TableName("control_level") +public class ControlLevel extends BaseEntity { + + /** + * 管控级别 + */ + @TableField("level_desc") + private String levelDesc; + + /** + * 风险等级 + */ + @TableField("risk_level_id") + private Long riskLevelId; + + /** + * 到位人员 + */ + @TableField("in_place_op") + private String inPlaceOp; + + /** + * 管理人员 + */ + @TableField("manage_op") + private String manageOp; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/DangerSourceInfo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/DangerSourceInfo.java new file mode 100644 index 0000000..2670019 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/DangerSourceInfo.java @@ -0,0 +1,52 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springblade.core.mp.base.BaseEntity; + +/** + *

+ * 危险源信息 + *

+ * + * @author zhaiqm + * @since 2023-09-15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("danger_source_info") +public class DangerSourceInfo extends BaseEntity { + /** + * 危险源名称 + */ + @TableField("danger_source_name") + private String dangerSourceName; + + /** + * 危险源分类 + */ + @TableField("danger_source_type") + private String dangerSourceType; + + /** + * 风险点id + */ + @TableField("risk_point_id") + private Long riskPointId; + + /** + * 责任人 + */ + @TableField("direct_user") + private Long directUser; + + /** + * 责任部门 + */ + @TableField("direct_dept") + private Long directDept; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/HiddenDanger.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/HiddenDanger.java new file mode 100644 index 0000000..b78faad --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/HiddenDanger.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("hidden_danger") +public class HiddenDanger { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 危险行为 + */ + @TableField("danger_behavior") + private String dangerBehavior; + + /** + * 发生次数 + */ + @TableField("times") + private Integer times; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskHazardsScreening.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskHazardsScreening.java new file mode 100644 index 0000000..f5d806d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskHazardsScreening.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +//风险隐患排查表 +@Data +@TableName("risk_hazards_screening") +public class RiskHazardsScreening extends BaseEntity{ + @ApiModelProperty("项目编码") + private String project;// + + @ApiModelProperty("电站编码") + private String stationCode; + + @ApiModelProperty("电站名称") + private String stationName; + + @ApiModelProperty("项目名称") + private String projectName; + + //企业职工伤亡事故标准 casualty_accident 字典 + @ApiModelProperty("隐患类型") + private String casualtyAccident; + + @ApiModelProperty("隐患部位") + private String dangerArea; + + @ApiModelProperty("隐患内容") + private String dangerContent; + + @ApiModelProperty("隐患等级") + private String dangerLevel; + + @ApiModelProperty("责任人") + private String dutyPerson; + + @ApiModelProperty("责任人电话") + private String dutyPhone; + + @ApiModelProperty("整改措施") + private String correctiveMeasure; + + @ApiModelProperty("整改时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date correctiveDate; + + @ApiModelProperty("是否整改") + private Integer corrective; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskInfo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskInfo.java new file mode 100644 index 0000000..77f9115 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskInfo.java @@ -0,0 +1,69 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 风险信息表 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("risk_info") +public class RiskInfo implements Serializable { + + private static final long serialVersionUID=1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 矩阵ID + */ + @TableField("matrix_id") + private Long matrixId; + + /** + * 最小值 + */ + @TableField("risk_value_min") + private Integer riskValueMin; + + /** + * 最大值 + */ + @TableField("risk_value_max") + private Integer riskValueMax; + + /** + * 可能性 + */ + @TableField("risk_level") + private String riskLevel; + + /** + * 颜色 + */ + @TableField("color") + private String color; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixX.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixX.java new file mode 100644 index 0000000..771104b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixX.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 风险矩阵X表 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("risk_matrix_x") +public class RiskMatrixX implements Serializable { + + private static final long serialVersionUID=1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 矩阵ID + */ + @TableField("matrix_id") + private Long matrixId; + + /** + * 值 + */ + @TableField("risk_value_x") + private Integer riskValueX; + + /** + * 可能性 + */ + @TableField("happen_possible") + private String happenPossible; + + /** + * 发生频率 + */ + @TableField("happen_rate") + private String happenRate; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixY.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixY.java new file mode 100644 index 0000000..356d265 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskMatrixY.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 风险矩阵Y表 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("risk_matrix_y") +public class RiskMatrixY implements Serializable { + + private static final long serialVersionUID=1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 矩阵ID + */ + @TableField("matrix_id") + private Long matrixId; + + /** + * 值 + */ + @TableField("risk_value_y") + private Integer riskValueY; + + /** + * 可能损失 + */ + @TableField("possible_loss") + private String possibleLoss; + + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskPointInfo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskPointInfo.java new file mode 100644 index 0000000..10eee26 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/RiskPointInfo.java @@ -0,0 +1,54 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springblade.core.mp.base.BaseEntity; + +/** + *

+ * 风险点信息表 + *

+ * + * @author zhaiqm + * @since 2023-09-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("risk_point_info") +public class RiskPointInfo extends BaseEntity { + + /** + * 管控级别 + */ + @TableField("risk_point_name") + private String riskPointName; + + /** + * 电站编码 + */ + @TableField("station_code") + private String stationCode; + + /** + * 风险等级 + */ + @TableField("risk_level_id") + private Long riskLevelId; + + /** + * 作业区域 + */ + @TableField("work_area_id") + private Long workAreaId; + + /** + * 事故分类 + */ + @TableField("casualty_accident") + private String casualtyAccident; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/WorkArea.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/WorkArea.java new file mode 100644 index 0000000..6f0b96e --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/entity/WorkArea.java @@ -0,0 +1,57 @@ +package com.hnac.hzims.safeproduct.riskhazards.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("work_area") +public class WorkArea { + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 区域名称 + */ + @TableField("area_name") + private String areaName; + + /** + * 安全责任人 + */ + @TableField("direct_op_id") + private Long directOpId; + + /** + * 监管部门 + */ + @TableField("depart_id") + private Long departId; + + /** + * 分管领导 + */ + @TableField("lead_op_id") + private Long leadOpId; + + /** + * 区域范围 + */ + @TableField("area_range") + private String areaRange; + + @TableField(exist = false) + private String directOpName; + + @TableField(exist = false) + private String departName; + + @TableField(exist = false) + private String leadOpName; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/ControlLevelQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/ControlLevelQueryVo.java new file mode 100644 index 0000000..e782495 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/ControlLevelQueryVo.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.hnac.hzims.safeproduct.riskhazards.entity.ControlLevel; +import lombok.Data; + +@Data +public class ControlLevelQueryVo extends ControlLevel { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/DangerSourceInfoQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/DangerSourceInfoQueryVo.java new file mode 100644 index 0000000..177b15e --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/DangerSourceInfoQueryVo.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import lombok.Data; + +@Data +public class DangerSourceInfoQueryVo extends DangerSourceInfo { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/HiddenDangerQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/HiddenDangerQueryVo.java new file mode 100644 index 0000000..06f9303 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/HiddenDangerQueryVo.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +@Data +public class HiddenDangerQueryVo { + /** + * 危险行为 + */ + @TableField("danger_behavior") + private String dangerBehavior; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskHazardsScreeningVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskHazardsScreeningVo.java new file mode 100644 index 0000000..e309362 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskHazardsScreeningVo.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import lombok.Data; + +@Data +public class RiskHazardsScreeningVo extends RiskHazardsScreening { + String createUserName; + String casualtyAccidentName;//类型名 +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskInfoQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskInfoQueryVo.java new file mode 100644 index 0000000..97d96c0 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskInfoQueryVo.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import lombok.Data; + +@Data +public class RiskInfoQueryVo { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixXQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixXQueryVo.java new file mode 100644 index 0000000..af432f8 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixXQueryVo.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import lombok.Data; + +@Data +public class RiskMatrixXQueryVo { + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixYQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixYQueryVo.java new file mode 100644 index 0000000..3401b69 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskMatrixYQueryVo.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import lombok.Data; + +@Data +public class RiskMatrixYQueryVo { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskPointInfoQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskPointInfoQueryVo.java new file mode 100644 index 0000000..eae991f --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/RiskPointInfoQueryVo.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import lombok.Data; + +@Data +public class RiskPointInfoQueryVo extends RiskPointInfo { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/WorkAreaQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/WorkAreaQueryVo.java new file mode 100644 index 0000000..072bd82 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/riskhazards/vo/WorkAreaQueryVo.java @@ -0,0 +1,32 @@ +package com.hnac.hzims.safeproduct.riskhazards.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +@Data +public class WorkAreaQueryVo { + + /** + * 区域名称 + */ + @TableField("area_name") + private String areaName; + + /** + * 安全责任人 + */ + @TableField("direct_op_id") + private Long directOpId; + + /** + * 监管部门 + */ + @TableField("depart_id") + private Long departId; + + /** + * 分管领导 + */ + @TableField("lead_op_id") + private Long leadOpId; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/Constants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/Constants.java new file mode 100644 index 0000000..d0f7bac --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/Constants.java @@ -0,0 +1,4 @@ +package com.hnac.hzims.safeproduct.statistic; + +public interface Constants { +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/DangerRiskScatterVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/DangerRiskScatterVO.java new file mode 100644 index 0000000..63d0d3d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/DangerRiskScatterVO.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.statistic.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName DangerRiskScatterVO + * @description: + * @author: hx + * @create: 2023-09-20 10:20 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +@ApiModel("隐患分布统计") +public class DangerRiskScatterVO implements Serializable { + + @ApiModelProperty("统计年月") + private String yearAndMonth; + + @ApiModelProperty("隐患等级") + private String hiddenDangerLevel; + + @ApiModelProperty("隐患个数") + private Integer hiddenDangerCount; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerAccidentMonthCountVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerAccidentMonthCountVO.java new file mode 100644 index 0000000..0316fab --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerAccidentMonthCountVO.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.safeproduct.statistic.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName RiskDangerAccidentMonthCount + * @description: + * @author: hx + * @create: 2023-09-20 10:31 + * @Version 4.0 + **/ +@ApiModel("风险/隐患/事故月份统计") +@Data +@EqualsAndHashCode +public class RiskDangerAccidentMonthCountVO implements Serializable { + + @ApiModelProperty("年月") + private String yearAndMonth; + + @ApiModelProperty("风险个数") + private Integer riskCount; + + @ApiModelProperty("隐患个数") + private Integer dangerCount; + + @ApiModelProperty("事故个数") + private Integer accidentCount; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerStatisticVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerStatisticVO.java new file mode 100644 index 0000000..ecd161a --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskDangerStatisticVO.java @@ -0,0 +1,38 @@ +package com.hnac.hzims.safeproduct.statistic.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName RiskDangerStatisticVO + * @description: 首页-风险隐患模块返回数据 + * @author: hx + * @create: 2023-09-20 09:43 + * @Version 4.0 + **/ +@Data +@ApiModel("风险隐患模块返回数据") +@EqualsAndHashCode +public class RiskDangerStatisticVO implements Serializable { + + @ApiModelProperty("风险等级站点统计") + private List stationRiskStatistics; + + @ApiModelProperty("本月风险辨识评价数") + private Integer riskCheckMonthCount; + + @ApiModelProperty("本月隐患排查数") + private Integer dangerCheckMonthCount; + + @ApiModelProperty("今日新增隐患数") + private Integer dangerAddDailyCount; + + @ApiModelProperty("本月各级隐患分布统计") + private List riskScatterCurrentMonth; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskInnerVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskInnerVO.java new file mode 100644 index 0000000..1284a0b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/RiskInnerVO.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.statistic.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @author ysj + */ +@Data +@ApiModel("电站风险/隐患统计") +@EqualsAndHashCode +public class RiskInnerVO implements Serializable { + + @ApiModelProperty("风险等级:1-低风险 2-一般风险 3-较大风险 4-重大风险") + private Integer riskLevel; + + @ApiModelProperty("风险个数") + private Integer riskCount; + + @ApiModelProperty("隐患个数") + private Integer innerCount; +} \ No newline at end of file diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/StationRiskStatisticVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/StationRiskStatisticVO.java new file mode 100644 index 0000000..3f1be67 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/statistic/vo/StationRiskStatisticVO.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.statistic.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName StationRiskStatisticVO + * @description: + * @author: hx + * @create: 2023-09-20 09:50 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +@ApiModel("站点风险统计一览") +public class StationRiskStatisticVO implements Serializable { + + @ApiModelProperty("风险等级") + private Long riskLevel; + + @ApiModelProperty("站点名称集合") + private List stations; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerBaseVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerBaseVo.java new file mode 100644 index 0000000..35f2608 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerBaseVo.java @@ -0,0 +1,170 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患基础信息", description = "隐患基础信息") +public class HiddenDangerBaseVo extends TenantEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 隐患编码 + */ + @QueryField(condition = SqlCondition.LIKE) + @ApiModelProperty(value = "隐患编码") + private String code; + /** + * 平台taskId + */ + @ApiModelProperty(value = "平台任务Id") + private String taskId; + /** + * 流程实例 + */ + @ApiModelProperty(value = "流程实例") + private String processInstanceId; + + //===================风险点基础信息======================== + /** + * 站点编码 + */ + @ApiModelProperty(value = "站点编码") + private String stationCode; + /** + * 风险点Id + */ + @ApiModelProperty(value = "风险点Id") + private String riskPointId; + /** + * 风险点名称 + */ + @ApiModelProperty(value = "风险点名称") + private String riskPointName; + /** + * 排查项目 + */ + @ApiModelProperty(value = "排查项目") + private String investigation; + /** + * 风险点类型 + */ + @ApiModelProperty(value = "风险点类型") + private String riskPointType; + /** + * 隐患责任部门 + */ + @ApiModelProperty(value = "隐患责任部门") + private String hiddenDangerDept; + /** + * 隐患责任部门 + */ + @ApiModelProperty(value = "隐患责任部门") + private String hiddenDangerDeptName; + /** + * 隐患地点 + */ + @ApiModelProperty(value = "隐患地点") + private String hiddenDangerAddr; + + //===================隐患基础信息======================== + /** + * 隐患名称 + */ + @ApiModelProperty(value = "隐患名称") + private String hiddenDangerName; + /** + * 隐患类别 + */ + @ApiModelProperty(value = "隐患类别") + private String hiddenDangerType; + /** + * 隐患照片地址 + */ + @ApiModelProperty(value = "隐患照片地址") + private String hiddenDangerPic; + /** + * 登记人 + */ + @ApiModelProperty(value = "登记人") + private String registrant; + /** + * 登记人姓名 + */ + @ApiModelProperty(value = "登记人姓名") + private String registrantName; + /** + * 登记时间 + */ + @ApiModelProperty(value = "登记时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date registrantTime; + /** + * 登记时间 + */ + @ApiModelProperty(value = "登记时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date registrantStartTime; + /** + * 登记时间 + */ + @ApiModelProperty(value = "登记时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date registrantEndTime; + /** + * 当前处理环节 + */ + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前处理环节") + private String currentOperator; + /** + * 当前环节处理人 + */ + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前环节处理人") + private String currentLinkHandler; + + //===================判定信息======================== + /** + * 判定人 + */ + @ApiModelProperty(value = "判定人") + private String judge; + /** + * 判定人姓名 + */ + @ApiModelProperty(value = "判定人姓名") + private String judgeName; + /** + * 判定结果 + */ + @ApiModelProperty(value = "判定结果") + private String judgeRes; + /** + * 判定结果 + */ + @ApiModelProperty(value = "判定结果") + private String judgeContext; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerCheckVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerCheckVo.java new file mode 100644 index 0000000..bf6c32b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerCheckVo.java @@ -0,0 +1,69 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患核查信息", description = "隐患核查信息") +public class HiddenDangerCheckVo extends HiddenDangerBaseVo { + +//===================核查信息======================== + /** + * 隐患等级(核查结果)1.低风险;2一般风险;3较大风险;4重大风险 + */ + @ApiModelProperty(value = "隐患等级(核查结果)") + private Integer hiddenDangerLevel; + /** + * 核查意见 + */ + @ApiModelProperty(value = "核查意见") + private String checkView; + /** + * 核查治理措施 + */ + @ApiModelProperty(value = "核查治理措施") + private String measures; + + /** + * 核查人 + */ + @ApiModelProperty(value = "核查人") + private Integer checkPeople; + /** + * 核查人姓名 + */ + @ApiModelProperty(value = "核查人姓名") + private String checkPeopleName; + /** + * 核查时间 + */ + @ApiModelProperty(value = "核查时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date checkTime; + /** + * 核查时间 + */ + @ApiModelProperty(value = "核查开始时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date checkStartTime; + /** + * 核查时间 + */ + @ApiModelProperty(value = "核查结束时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date checkEndTime; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerConclusionVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerConclusionVo.java new file mode 100644 index 0000000..00728b2 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerConclusionVo.java @@ -0,0 +1,62 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患验收信息", description = "隐患验收信息") +public class HiddenDangerConclusionVo extends HiddenDangerBaseVo { + /** + * 验收结果(完成,未完成) + */ + @ApiModelProperty(value = "验收结果(完成,未完成)") + private Integer conclusionRes; + + /** + * 验收人 + */ + @ApiModelProperty(value = "验收人") + private String conclusionPeople; + /** + * 验收验收人姓名 + */ + @ApiModelProperty(value = "验收验收人姓名") + private String conclusionPeopleName; + /** + * 验收意见 + */ + @ApiModelProperty(value = "验收意见") + private String conclusionView; + /** + * 验收时间 + */ + @ApiModelProperty(value = "验收时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date conclusionTime; + /** + * 验收时间 + */ + @ApiModelProperty(value = "验收时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date conclusionStartTime; + /** + * 验收时间 + */ + @ApiModelProperty(value = "验收时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date conclusionEndTime; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerRectifierVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerRectifierVo.java new file mode 100644 index 0000000..436a179 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HiddenDangerRectifierVo.java @@ -0,0 +1,104 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患整改信息", description = "隐患整改信息") +public class HiddenDangerRectifierVo extends HiddenDangerBaseVo { + /** + * 整改责任人 + */ + @ApiModelProperty(value = "整改责任人") + private Integer rectifier; + /** + * 整改责任人姓名 + */ + @ApiModelProperty(value = "整改责任人姓名") + private String rectifierName; + /** + * 整改责任部门ID + */ + @ApiModelProperty(value = "整改责任部门ID") + private Integer rectifierDept; + /** + * 整改责任部门名称 + */ + @ApiModelProperty(value = "整改责任部门名称") + private String rectifierDeptName; + /** + * 整改类型(立即整改) + */ + @ApiModelProperty(value = "整改类型(立即整改)1立即整改、2停产停业整改、3限期整改") + private Integer rectifierType; + /** + * 完成期限 + */ + @ApiModelProperty(value = "完成期限") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date deadLine; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "期限开始时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date deadLineStartTime; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "期限结束时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date deadLineEndTime; + /** + * 整改通知单号 + */ + @ApiModelProperty(value = "整改通知单号") + private Long rectifierId; + //===================隐患整改反馈表======================== + /** + * 隐患存在原因 + */ + @ApiModelProperty(value = "隐患存在原因") + private String rectifierReason; + /** + * 治理后的效果图 + */ + @ApiModelProperty(value = "治理后的效果图") + private String rectifierPic; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "反馈时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date rectifierTime; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "反馈开始时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date rectifierStartTime; + /** + * 反馈时间 + */ + @ApiModelProperty(value = "反馈结束时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private Date rectifierEndTime; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/InnerDangerVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/InnerDangerVo.java new file mode 100644 index 0000000..ad4557f --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/InnerDangerVo.java @@ -0,0 +1,38 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * Created by ty 2023/9/18 10:16 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "隐患信息表", description = "隐患信息表") +public class InnerDangerVo extends InnerDangerEntity implements Serializable { + /** + * 判定人 + */ + @ApiModelProperty(value = "判定人") + private String judgeFlow; + /** + * 核查人 + */ + @ApiModelProperty(value = "核查人") + private String checkPeopleFlow; + /** + * 整改责任人 + */ + @ApiModelProperty(value = "整改责任人") + private String rectifierFlow; + /** + * 验收人 + */ + @ApiModelProperty(value = "验收人") + private String conclusionPeopleFlow; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RiskCheckVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RiskCheckVO.java new file mode 100644 index 0000000..566f2bf --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RiskCheckVO.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.vo; + +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName RiskCheckVO + * @description: 风险点检查项VO + * @author: hx + * @create: 2023-09-19 09:28 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +@ApiModel("风险点检查项VO") +public class RiskCheckVO extends RiskCheckEntity implements Serializable { + + @ApiModelProperty("创建人名称") + private String creatorName; + + @ApiModelProperty("更新人名称") + private String updateUserName; + +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java deleted file mode 100644 index 0f1ae1a..0000000 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@TableName("work_area") -public class WorkArea { - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 区域名称 - */ - @TableField("area_name") - private String areaName; - - /** - * 安全责任人 - */ - @TableField("direct_op_id") - private Long directOpId; - - /** - * 监管部门 - */ - @TableField("depart_id") - private Long departId; - - /** - * 分管领导 - */ - @TableField("lead_op_id") - private Long leadOpId; - - /** - * 区域范围 - */ - @TableField("area_range") - private String areaRange; - - private String directOpName; - - private String departName; - - private String leadOpName; -} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java deleted file mode 100644 index 61c2160..0000000 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import lombok.Data; - -@Data -public class WorkAreaQueryVo { - - /** - * 区域名称 - */ - @TableField("area_name") - private String areaName; - - /** - * 安全责任人 - */ - @TableField("direct_op_id") - private Long directOpId; - - /** - * 监管部门 - */ - @TableField("depart_id") - private Long departId; - - /** - * 分管领导 - */ - @TableField("lead_op_id") - private Long leadOpId; -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java index fcf8d24..7d95c29 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java @@ -138,17 +138,19 @@ public class MessagePushSchedule { request.setSmsParam(request.getContent()); } request.setMessageId(IdWorker.getId()); - Boolean flag = service.send(request); - if(!flag) { - return; + try { + Boolean flag = service.send(request); + List ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()); + // 更新消息推送状态 + LambdaUpdateWrapper lwq = Wrappers.lambdaUpdate() + .set(MessagePushRecordEntity::getStatus, flag ? MessageConstants.PUSH_SUCCESS : MessageConstants.PUSH_FAILED) + .set(MessagePushRecordEntity::getPushTime,LocalDateTime.now()) + .in(MessagePushRecordEntity::getId, ids); + recordService.update(lwq); + } + catch (Exception e) { + e.printStackTrace(); } - List ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()); - // 更新消息推送状态 - LambdaUpdateWrapper lwq = Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getStatus, flag ? MessageConstants.PUSH_SUCCESS : MessageConstants.PUSH_FAILED) - .set(MessagePushRecordEntity::getPushTime,LocalDateTime.now()) - .in(MessagePushRecordEntity::getId, ids); - recordService.update(lwq); }); }); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/FlowKeyConstants.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/FlowKeyConstants.java new file mode 100644 index 0000000..f58b7fb --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/FlowKeyConstants.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.operational.constants; + +public interface FlowKeyConstants { + + /**日常维护任务流程key**/ + String MAINTENANCE_TASK_FLOW_KEY = "maintenance_test"; + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java index 219397f..c0f0cad 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/constants/RedisKeyConstants.java @@ -11,6 +11,9 @@ import org.springframework.stereotype.Component; @Data public class RedisKeyConstants { + public static String MAINTENANCE_TASK_DELAY_LIST = "hzims:operation:maintenance:end:delay:tasks"; + public static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:end:delay:tasks"; + /**根据realId获取实时数据**/ @Value("${hzims.operation.realIdKey}") private String realDataByRealId; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java new file mode 100644 index 0000000..917c51c --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java @@ -0,0 +1,103 @@ +package com.hnac.hzims.operational.maintenance.scheduled; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.google.common.collect.Lists; +import com.hnac.hzims.common.constant.CommonConstant; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.operational.constants.RedisKeyConstants; +import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; +import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import com.xxl.job.core.log.XxlJobLogger; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.REMIND_MAINTENANCE_BECOME_TASK; +@Component +@Slf4j +@AllArgsConstructor +public class MaintenanceTaskRemindHandler { + + private final RedisTemplate redisTemplate; + private final IOperMaintenanceTaskService taskService; + private final IUserClient userClient; + private final IMessageClient messageClient; + + @XxlJob(REMIND_MAINTENANCE_BECOME_TASK) + public ReturnT execute(String param) { + //获取当前时间段 redis内缓存的任务列表 + Set taskEntitySet = redisTemplate.opsForZSet().rangeByScore(RedisKeyConstants.REMIND_TASK_END_LIST,0, LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); + XxlJobLogger.log("从redis内取出{}条数据",taskEntitySet.size()); + if(CollectionUtil.isNotEmpty(taskEntitySet)) { + taskEntitySet.forEach(operMaintenanceTaskEntity -> { + OperMaintenanceTaskEntity taskEntity = taskService.getById(operMaintenanceTaskEntity.getId()); + if(StringUtil.isBlank(taskEntity.getFlowTaskName())) { + redisTemplate.opsForZSet().remove(RedisKeyConstants.REMIND_TASK_END_LIST,operMaintenanceTaskEntity); + } + //如果任务仍在待执行则自动结束 + else if(Lists.newArrayList("待领用","待执行").contains(taskEntity.getFlowTaskName())) { + XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L)); + //日常维护任务到期消息提醒,提醒对象:执行人、项目经理角色 取出 + this.sendMessage(taskEntity); + redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity); + } + }); + } + else { + XxlJobLogger.log("无提醒任务!"); + } + return new ReturnT<>("SUCCESS"); + } + + /** + * 推送消息 + * @param taskEntity 日常维护任务 + */ + private void sendMessage(OperMaintenanceTaskEntity taskEntity) { + String disposer = taskEntity.getDisposer(); + BusinessMessageDTO request = new BusinessMessageDTO(); + request.setDeptId(taskEntity.getCreateDept()); + request.setBusinessClassify(MessageConstants.BusinessClassifyEnum.OPERATIONAL.getKey()); + request.setBusinessKey("maintenance_task_remind"); + request.setTaskId(taskEntity.getId()); + request.setContent("您有一条待执行的日常维护任务【"+taskEntity.getTitle()+"】即将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME) +"过期,请即时处理。"); + request.setSubject("日常维护任务到期提醒"); + request.setUserIds(disposer); + request.setCreateUser(taskEntity.getCreateUser()); + request.setTenantId(CommonConstant.TENANT_ID); + R sendFlag = messageClient.sendAppAndWsMsgByUsers(request); + if(!(sendFlag.isSuccess() && sendFlag.getData())) { + XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!"); + } + // 任务执行人发送短信 + R> listR = userClient.userByDeptId(CommonConstant.TENANT_ID, taskEntity.getCreateDept()); + if(listR.isSuccess()) { + request.setUserIds(listR.getData().stream().map(User::getId).map(String::valueOf).collect(Collectors.joining(","))); + request.setContent("有一条待执行的日常维护任务【"+taskEntity.getTitle()+"】即将于"+ DateUtil.format(taskEntity.getPlanEndTime(),DateUtil.PATTERN_DATETIME) +"过期,请确认。"); + R result = messageClient.sendAppAndWsMsgByUsers(request); + if(!(result.isSuccess() && result.getData())) { + XxlJobLogger.log(taskEntity.getId() +"执行人消息推送失败!"); + } + } + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java index ac69b88..cbe29fc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.equipment.feign.IEmInfoClient; +import com.hnac.hzims.operational.constants.FlowKeyConstants; +import com.hnac.hzims.operational.constants.RedisKeyConstants; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceLibraryEntity; @@ -39,9 +41,7 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.TASK_VALUE_MAINTENANCE_TASK_CREATE; -import static com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask.REMIND_TASK_END_LIST; -import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE; +import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.GENERATE_MAINTENANCE_TASK_SCHEDULE; /** * 日常维护任务生成 @@ -58,12 +58,12 @@ public class MaintenanceTaskSchedule { private final IImsDutyMainService dutyMainService; private final RedisTemplate redisTemplate; - //@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE) + @XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE) public ReturnT execute(String param) throws Exception { Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); Date endDate = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(startDate, 1)), DateUtil.PATTERN_DATE); LambdaQueryWrapper planQW = Wrappers.lambdaQuery().isNull(OperMaintenancePlanEntity::getCreateTaskTime) - .gt(OperMaintenancePlanEntity::getDisposeTime, startDate).le(OperMaintenancePlanEntity::getDisposeTime, endDate); + .ge(OperMaintenancePlanEntity::getDisposeTime, startDate).lt(OperMaintenancePlanEntity::getDisposeTime, endDate); List planList = planService.list(planQW); XxlJobLogger.log("日常维护任务生成开始!计划ID为:"+planList.stream().map(OperMaintenancePlanEntity::getId).map(String::valueOf).collect(Collectors.joining(","))); //分页插入日常维护计划 @@ -94,6 +94,7 @@ public class MaintenanceTaskSchedule { else { this.createTask(taskEntity,plan); } + planService.update(Wrappers.lambdaUpdate().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date()).eq(OperMaintenancePlanEntity::getId,plan.getId())); } catch(Exception e) { logger.error("MaintenanceTaskSchedule:generateTaskByPlan",e.getLocalizedMessage()); @@ -142,7 +143,10 @@ public class MaintenanceTaskSchedule { } // 保存日常维护任务 if(taskService.save(task)) { - redisTemplate.opsForZSet().add(REMIND_TASK_END_LIST,task,task.getPlanEndTime().toEpochSecond(ZoneOffset.of("+8"))); + // redis存入待逾期状态处理任务 + redisTemplate.opsForZSet().add(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,task,task.getPlanEndTime().toEpochSecond(ZoneOffset.of("+8"))); + // 到期时间提醒 + redisTemplate.opsForZSet().add(RedisKeyConstants.REMIND_TASK_END_LIST,task,task.getPlanEndTime().toEpochSecond(ZoneOffset.of("+8"))); this.startProcessInstance(task); } } @@ -167,7 +171,7 @@ public class MaintenanceTaskSchedule { }); put("operMaintenanceTaskEntityVo",vo); }}; - R flowResult = flowClient.startProcessInstanceContainNameByKey("", String.valueOf(task.getId()), task.getTitle(), params); + R flowResult = flowClient.startProcessInstanceContainNameByKey(FlowKeyConstants.MAINTENANCE_TASK_FLOW_KEY, String.valueOf(task.getId()), task.getTitle(), params); return Optional.ofNullable(flowResult).filter(r -> r.isSuccess()).map(R::getData).map(BladeFlow::getProcessInstanceId).orElse(null); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/TaskOverdueHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/TaskOverdueHandler.java index d581bd3..18628ff 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/TaskOverdueHandler.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/TaskOverdueHandler.java @@ -1,6 +1,8 @@ package com.hnac.hzims.operational.maintenance.scheduled; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.google.common.collect.Lists; +import com.hnac.hzims.operational.constants.RedisKeyConstants; import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; @@ -14,6 +16,7 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; import org.springblade.flow.core.feign.IFlowClient; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; @@ -27,7 +30,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static com.hnac.hzims.operational.maintenance.constants.ScheduledConstant.TASK_MAINTENANCE_OVERDUE_HANDLER; -import static com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask.REMIND_TASK_END_LIST; /** * @author hx @@ -39,75 +41,27 @@ public class TaskOverdueHandler { private final RedisTemplate redisTemplate; private final IOperMaintenanceTaskService taskService; - private final IFlowClient flowClient; - private final ITicketInfoClient ticketInfoClient; - -// @XxlJob(TASK_MAINTENANCE_OVERDUE_HANDLER) -// public ReturnT execute(String param) throws Exception { -// //获取当前时间段 redis内缓存的任务列表 -// Set taskEntitySet = redisTemplate.opsForZSet().rangeByScore(REMIND_TASK_END_LIST,0, LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); -// //XxlJobLogger.log("从redis内取出{}条数据",taskEntitySet.size()); -// if(CollectionUtil.isNotEmpty(taskEntitySet)) { -// ExecutorService executorService = Executors.newSingleThreadExecutor(); -// executorService.execute(()-> { -// taskEntitySet.forEach(operMaintenanceTaskEntity -> { -// OperMaintenanceTaskEntity taskEntity = taskService.getById(operMaintenanceTaskEntity.getId()); -// //如果任务仍在待执行则自动结束 -// if(MaintenanceConstant.TASK_STATUS_5 != taskEntity.getStatus()) { -// XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L)); -// //将任务置为未完成状态 -// LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper(); -// updateWrapper.set(OperMaintenanceTaskEntity::getStatus,MaintenanceConstant.TASK_STATUS_6); -// updateWrapper.set(OperMaintenanceTaskEntity::getDelayStatus,true); -// updateWrapper.eq(OperMaintenanceTaskEntity::getId,operMaintenanceTaskEntity.getId()); -// taskService.update(updateWrapper); -// //若该任务已领用 则终止工作流 -// if(Func.isNotEmpty(taskEntity.getProcessInstanceId())){ -// R delFlowResult = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(),"该日常维护任务已逾期,删除工作流"); -// if(!delFlowResult.isSuccess()){ -// XxlJobLogger.log(delFlowResult.getMsg()); -// throw new ServiceException(delFlowResult.getMsg()); -// } -// } -// //若该任务开了工作票,则更新工作票状态;终止工作流 -// if(Func.isNotEmpty(taskEntity.getTicketId())){ -// XxlJobLogger.log("开始处理逾期工作票"); -// R ticketSaveResult = ticketInfoClient.updateUndoneStatus(taskEntity.getTicketId()); -// if(!ticketSaveResult.isSuccess()){ -// XxlJobLogger.log("处理逾期工作票失败"); -// throw new ServiceException(ticketSaveResult.getMsg()); -// } -// } -// redisTemplate.opsForZSet().remove(REMIND_TASK_END_LIST,operMaintenanceTaskEntity); -// } -// }); -// }); -// executorService.shutdown(); -// } -// else { -// XxlJobLogger.log("无提醒任务!"); -// } -// -// return new ReturnT<>("SUCCESS"); -// } @XxlJob(TASK_MAINTENANCE_OVERDUE_HANDLER) public ReturnT execute(String param) throws Exception { //获取当前时间段 redis内缓存的任务列表 - Set taskEntitySet = redisTemplate.opsForZSet().rangeByScore(REMIND_TASK_END_LIST,0, LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); + Set taskEntitySet = redisTemplate.opsForZSet().rangeByScore(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,0, LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); XxlJobLogger.log("从redis内取出{}条数据",taskEntitySet.size()); if(CollectionUtil.isNotEmpty(taskEntitySet)) { taskEntitySet.forEach(operMaintenanceTaskEntity -> { OperMaintenanceTaskEntity taskEntity = taskService.getById(operMaintenanceTaskEntity.getId()); + if(StringUtil.isBlank(taskEntity.getFlowTaskName())) { + redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity); + } //如果任务仍在待执行则自动结束 - if(!"结束".equals(taskEntity.getFlowTaskName())) { + else if(Lists.newArrayList("待领用","待执行").contains(taskEntity.getFlowTaskName())) { XxlJobLogger.log("开始执行id为{}的任务", Optional.ofNullable(operMaintenanceTaskEntity.getId()).orElse(0L)); //将任务置为未完成状态 LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper(); - updateWrapper.set(OperMaintenanceTaskEntity::getDelayStatus,true); + updateWrapper.set(OperMaintenanceTaskEntity::getIsDelay,true); updateWrapper.eq(OperMaintenanceTaskEntity::getId,operMaintenanceTaskEntity.getId()); taskService.update(updateWrapper); - redisTemplate.opsForZSet().remove(REMIND_TASK_END_LIST,operMaintenanceTaskEntity); + redisTemplate.opsForZSet().remove(RedisKeyConstants.MAINTENANCE_TASK_DELAY_LIST,operMaintenanceTaskEntity); } }); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java deleted file mode 100644 index db6a7b9..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/DangerSourceController.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.hnac.hzims.safeproduct.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.logs.annotation.OperationAnnotation; -import com.hnac.hzims.common.logs.enums.BusinessType; -import com.hnac.hzims.common.logs.enums.OperatorType; -import com.hnac.hzims.safeproduct.dto.DangerSourceDTO; -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.service.IDangerSourceService; -import com.hnac.hzims.safeproduct.vo.DangerSourceVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.log.annotation.ApiLog; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import java.util.List; - - -/** - * @author xiashandong - * @created 2020/9/1 15:15 - **/ -@RestController -@AllArgsConstructor -@RequestMapping("/dangerSource") -@Api(tags = "危险源") -public class DangerSourceController extends BladeController { - - private final IDangerSourceService dangerSourceService; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(dangerSourceService.deleteLogic(Func.toLongList(ids))); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增", notes = "传入dangerSource") - public R save(@RequestBody DangerSourceDTO req) { - return dangerSourceService.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改", notes = "传入dangerSource") - public R update(@RequestBody DangerSourceDTO req) { - return dangerSourceService.doUpdate(req); - } - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情", notes = "传入dangerSource") - public R detail(@RequestParam Long id) { - return dangerSourceService.detail(id); - } - - /** - * 分页 - */ - @ApiLog - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页", notes = "查询条件:eqId,level,`dangerEle,applyType,type") - @OperationAnnotation(moduleName = "安全管理",title = "危险点列表",operatorType = OperatorType.MOBILE,businessType = - BusinessType.GENCODE, - action = "分页查询危险点列表") - public R> list(DangerSourceEntity req, Query query) { - return dangerSourceService.pageCondition(req, query); - } - - /** - * 根据ID查询危险源 - */ - @GetMapping("/safes") - @ApiOperationSupport(order = 60) - @ApiOperation(value = "查询危险源", notes = "传入safeInfos") - public R> safes(@RequestParam String safeInfos) { - return R.data(dangerSourceService.safes(safeInfos)); - } - - /** - * 导入数据 - */ - @ApiOperation(value = "导入Excel") - @ApiOperationSupport(order = 70) - @PostMapping(value = "/importExcel") - public R importExcel(MultipartFile file) { - dangerSourceService.importExcel(file); - return R.data(true); - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeReportController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeReportController.java index 960783b..ad8e43f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeReportController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeReportController.java @@ -2,7 +2,7 @@ package com.hnac.hzims.safeproduct.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.safeproduct.service.IDangerSourceService; +import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourceDTO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourceDTO.java deleted file mode 100644 index dbad01d..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourceDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.safeproduct.dto; - -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * @author xiashandong - * @created 2020/9/1 15:16 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class DangerSourceDTO extends DangerSourceEntity { - - private static final long serialVersionUID = 1L; - - private DangerSourcePositionDTO position; -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourcePositionDTO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourcePositionDTO.java deleted file mode 100644 index c2554db..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/DangerSourcePositionDTO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.safeproduct.dto; - -import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * @author xiashandong - * @created 2020/9/1 15:19 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class DangerSourcePositionDTO extends DangerSourcePositionEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/enums/DangerSourceLevelEnum.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/enums/DangerSourceLevelEnum.java deleted file mode 100644 index 34cd297..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/enums/DangerSourceLevelEnum.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.safeproduct.enums; - -import org.springblade.core.tool.utils.StringUtil; - -/** - * 危险源等级Enum - * - * @author xiashandong - * @created 2020/9/1 15:34 - **/ -public enum DangerSourceLevelEnum { - _10(10, "稍有危险"), - _20(20, "一般危险"), - _30(30, "显著危险"), - _40(40, "高度危险"); - - private int value; - private String name; - - DangerSourceLevelEnum(int value, String name) { - this.value = value; - this.name = name; - } - - public int getValue() { - return value; - } - - public String getName() { - return name; - } - - public static String getName(int value) { - for (DangerSourceLevelEnum item : DangerSourceLevelEnum.values()) { - if (value == item.getValue()) { - return item.getName(); - } - } - return ""; - } - - public static Integer getValue(String name) { - for (DangerSourceLevelEnum item : DangerSourceLevelEnum.values()) { - if (StringUtil.equals(name, item.getName())) { - return item.getValue(); - } - } - return null; - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/excel/DangerSourceImporter.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/excel/DangerSourceImporter.java index 514e216..e7c4f0d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/excel/DangerSourceImporter.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/excel/DangerSourceImporter.java @@ -1,8 +1,8 @@ package com.hnac.hzims.safeproduct.excel; -import com.hnac.hzims.safeproduct.dto.DangerSourceDTO; -import com.hnac.hzims.safeproduct.enums.DangerSourceLevelEnum; -import com.hnac.hzims.safeproduct.service.IDangerSourceService; +import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; +import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum; +import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; import org.springblade.core.excel.support.ExcelImporter; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java index ceebb1a..76f1389 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/feign/DangerSourceClient.java @@ -1,7 +1,7 @@ package com.hnac.hzims.safeproduct.feign; import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.service.IDangerSourceService; +import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; import com.hnac.hzims.safeproduct.vo.SourceVO; import lombok.AllArgsConstructor; import org.apache.commons.lang.ArrayUtils; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/controller/InnerDangerStartController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/controller/InnerDangerStartController.java new file mode 100644 index 0000000..574768c --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/controller/InnerDangerStartController.java @@ -0,0 +1,126 @@ +package com.hnac.hzims.safeproduct.flow.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.common.logs.annotation.OperationAnnotation; +import com.hnac.hzims.common.logs.enums.BusinessType; +import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import com.hnac.hzims.safeproduct.flow.service.IInnerDangerFlowService; +import com.hnac.hzims.safeproduct.vo.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + + +/** + * @author xiashandong + * @created 2020/9/1 15:15 + **/ +@RestController +@AllArgsConstructor +@RequestMapping("/hiddenDangerStart") +@Api(tags = "隐患") +public class InnerDangerStartController extends BladeController { + + private final IInnerDangerFlowService hiddenDangerFlowService; + + + /** + * 隐患管理 + */ + @ApiLog + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入hiddenDangerEntity") + @OperationAnnotation(moduleName = "隐患管理",title = "隐患管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患管理") + public R> list(InnerDangerEntity innerDangerEntity, Query query) { + IPage pages = hiddenDangerFlowService.selectPage(innerDangerEntity, query); + return R.data(pages); + } + /** + * 隐患管理 + */ + @ApiLog + @GetMapping("/detail") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入hiddenDangerEntity") + @OperationAnnotation(moduleName = "隐患管理",title = "隐患管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患管理") + public R detail(InnerDangerEntity innerDangerEntity) { + InnerDangerEntity one = hiddenDangerFlowService.getOne(Condition.getQueryWrapper(innerDangerEntity)); + return R.data(one); + } + /** + * 隐患排查流程开启 + */ + @ApiLog + @PostMapping("/startHiddenDanger") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "开启隐患流程排查", notes = "传入hiddenDangerEntity") + @OperationAnnotation(moduleName = "隐患排查流程开启",title = "隐患排查流程开启",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患排查流程开启") + public R startHiddenDanger(@RequestBody InnerDangerVo hiddenDangerVo) { + return hiddenDangerFlowService.startHiddenDanger(hiddenDangerVo); + } + /** + * 隐患基础页面 + */ + @ApiLog + @GetMapping("/getHiddenDangerBase") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入hiddenDangerEntity") + @OperationAnnotation(moduleName = "隐患基础页面",title = "隐患基础页面",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患基础页面") + public R> getHiddenDangerBase(HiddenDangerBaseVo hiddenDangerEntity, Query query) { + IPage pages = hiddenDangerFlowService.getHiddenDangerBase(hiddenDangerEntity, query); + return R.data(pages); + } + /** + * 隐患排查页面 + */ + @ApiLog + @GetMapping("/getHiddenDangerCheck") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入hiddenDangerEntity") + @OperationAnnotation(moduleName = "隐患排查页面",title = "隐患排查页面",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患排查页面") + public R> getHiddenDangerCheck(HiddenDangerCheckVo hiddenDangerEntity, Query query) { + IPage pages = hiddenDangerFlowService.getHiddenDangerCheck(hiddenDangerEntity, query); + return R.data(pages); + } + /** + * 隐患整改管理 + */ + @ApiLog + @GetMapping("/getHiddenDangerRectifier") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入HiddenDangerRectifierVo") + @OperationAnnotation(moduleName = "隐患整改管理",title = "隐患整改管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患整改管理") + public R> getHiddenDangerRectifier(HiddenDangerRectifierVo hiddenDangerEntity, Query query) { + IPage pages = hiddenDangerFlowService.getHiddenDangerRectifier(hiddenDangerEntity, query); + return R.data(pages); + } + /** + * 隐患验收管理 + */ + @ApiLog + @GetMapping("/getHiddenDangerConclusion") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入HiddenDangerConclusionVo") + @OperationAnnotation(moduleName = "隐患验收管理",title = "隐患验收管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + action = "隐患验收管理") + public R> getHiddenDangerConclusion(HiddenDangerConclusionVo hiddenDangerEntity, Query query) { + IPage pages = hiddenDangerFlowService.getHiddenDangerConclusion(hiddenDangerEntity, query); + return R.data(pages); + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.java new file mode 100644 index 0000000..767120f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.safeproduct.flow.mapper; + +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * Created by Sam Huang 2022/5/6 8:23 + */ +public interface InnerDangerMapper extends UserDataScopeBaseMapper { + + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.xml new file mode 100644 index 0000000..a119c44 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/mapper/InnerDangerMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/IInnerDangerFlowService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/IInnerDangerFlowService.java new file mode 100644 index 0000000..1c6c749 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/IInnerDangerFlowService.java @@ -0,0 +1,42 @@ +package com.hnac.hzims.safeproduct.flow.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.dto.InnerDangerDTO; +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import com.hnac.hzims.safeproduct.vo.*; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; + +import java.util.List; + +/** + * Created by ty 2023/9/18 10:16 + */ +public interface IInnerDangerFlowService extends BaseService { + + + IPage selectPage(InnerDangerEntity innerDangerEntity, Query query); + + R startHiddenDanger(InnerDangerVo hiddenDangerVo); + /** + * 监听回调消息 + * @param processWorkFlowResponse + * @return + */ + R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse); + + IPage getHiddenDangerBase(HiddenDangerBaseVo hiddenDangerEntity, Query query); + + IPage getHiddenDangerCheck(HiddenDangerCheckVo hiddenDangerEntity, Query query); + + IPage getHiddenDangerRectifier(HiddenDangerRectifierVo hiddenDangerEntity, Query query); + + IPage getHiddenDangerConclusion(HiddenDangerConclusionVo hiddenDangerEntity, Query query); + + List getListByDate(String mon); + + List getList(InnerDangerDTO req); + List getListByDeptAndDate(String startTime,String endTime,String stationCode); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java new file mode 100644 index 0000000..25e5a85 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java @@ -0,0 +1,395 @@ +package com.hnac.hzims.safeproduct.flow.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.dto.InnerDangerDTO; +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import com.hnac.hzims.safeproduct.flow.mapper.InnerDangerMapper; +import com.hnac.hzims.safeproduct.flow.service.IInnerDangerFlowService; +import com.hnac.hzims.safeproduct.vo.*; +import org.apache.commons.collections4.CollectionUtils; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +import static com.hnac.hzims.safeproduct.Constants.HIDDEN_DANGER_CHECK; + +/** + * Created by ty 2023/9/18 10:16 + **/ +@Service +public class InnerDangerFlowServiceImpl extends BaseServiceImpl implements IInnerDangerFlowService { + + @Autowired + private ISysClient sysClient; + @Autowired + private IUserClient userClient; + + @Autowired + private IFlowClient processClient; + + @Autowired + private IMessageClient messageClient; + + + + @Override + public IPage selectPage(InnerDangerEntity innerDangerEntity, Query query) { + return this.baseMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(innerDangerEntity)); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public R startHiddenDanger(InnerDangerVo hiddenDangerVo) { + InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); + BeanUtil.copy(hiddenDangerVo, innerDangerEntity); + if (!saveHiddenDanger(innerDangerEntity)) { + throw new ServiceException("隐患保存失败,请稍后重试!"); + } + InnerDangerEntity saveEntity = this.getOne(new LambdaQueryWrapper() {{ + eq(InnerDangerEntity::getCode, innerDangerEntity.getCode()); + last("limit 1"); + }}); + InnerDangerEntity res = this.startHiddenDangerFlow(saveEntity, hiddenDangerVo); + return R.data(res); + } + + private boolean saveHiddenDanger(InnerDangerEntity entity) { + if (Func.isEmpty(entity.getCode())) { + entity.setCode(UUID.randomUUID().toString()); + } + // 隐患发起人 : 当前用户Id + if (Func.isEmpty(entity.getRegistrant())) { + entity.setRegistrant(AuthUtil.getUserId()); + entity.setRegistrantName(AuthUtil.getUserName()); + } + // 隐患发起时间 + entity.setRegistrantTime(new Date()); + // 隐患发起时间 + entity.setUpdateTime(new Date()); + entity.setCreateUser(AuthUtil.getUserId()); + entity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); + if (Func.isEmpty(entity.getHiddenDangerDept())) { + return false; + } + if (Func.isEmpty(entity.getHiddenDangerDeptName())) { + R deptNameR = sysClient.getDeptName(entity.getHiddenDangerDept()); + if (deptNameR.isSuccess() && StringUtils.isNotEmpty(deptNameR.getData())) { + entity.setHiddenDangerDeptName(deptNameR.getData()); + } + } + return this.save(entity); + } + + private InnerDangerEntity startHiddenDangerFlow(InnerDangerEntity entity,InnerDangerVo hiddenDangerVo) { + BeanUtil.copy(entity,hiddenDangerVo); + // 隐患处理名字 + String userName = Optional.ofNullable(AuthUtil.getUserName()).orElse(""); + // 流程名称 + String processName = "[" + userName + "] 发起 " + "【风险点:" + entity.getRiskPointName() + "】隐患处理流程" + "——>" + entity.getHiddenDangerName(); + // 开启新的隐患处理流程 + Map variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(hiddenDangerVo, DateUtil.PATTERN_DATETIME), Map.class); + R result = processClient.startProcessInstanceContainNameByKey(HIDDEN_DANGER_CHECK, entity.getId().toString(), processName, variable); + // 流程开启失败 + if (!result.isSuccess()) { + throw new ServiceException("隐患处理流程开启失败,错误描述 : " + result.getMsg()); + } + // 关联流程唯一键 + entity.setProcessInstanceId(result.getData().getProcessInstanceId()); + entity.setTaskId(result.getData().getTaskId()); + this.baseMapper.updateById(entity); + return entity; + } + + + /** + * @param processWorkFlowResponse + */ + @Override + public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) { + + InnerDangerVo hiddenDangerVo; + log.warn("隐患处理流程消息开始转换"); + try { + Map variables = (Map) processWorkFlowResponse.getVariables(); + //现象缺陷全表更新 + hiddenDangerVo = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference() { + }); + } catch (Exception e) { + log.error("隐患处理流程消息转换失败:" + e.getMessage()); + return R.fail("隐患处理流程消息转换失败"); + } + InnerDangerEntity saveEntity = this.getOne(new LambdaQueryWrapper() {{ + eq(InnerDangerEntity::getCode, hiddenDangerVo.getCode()); + last("limit 1"); + }}); + Long taskId = saveEntity.getId(); + //设置当前环节+当前环节处理人 + if (StringUtils.isEmpty(processWorkFlowResponse.getNextStepOperator())) { + hiddenDangerVo.setCurrentOperator("流程结束"); + hiddenDangerVo.setCurrentLinkHandler(null); + }else { + hiddenDangerVo.setCurrentOperator(processWorkFlowResponse.getTaskName()); + hiddenDangerVo.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator()); + hiddenDangerVo.setTaskId(processWorkFlowResponse.getTaskId()); + } + this.baseMapper.update(hiddenDangerVo, new LambdaUpdateWrapper() {{ + eq(InnerDangerEntity::getCode, hiddenDangerVo.getCode()); + }}); + //推送消息中心相关消息 + sendMessage(processWorkFlowResponse, saveEntity, taskId); + log.warn("隐患处理流程消息转换结束"); + return R.success("消息保存成功"); + } + + @Override + public IPage getHiddenDangerBase(HiddenDangerBaseVo hiddenDangerBaseVo, Query query) { + InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); + BeanUtil.copy(hiddenDangerBaseVo, innerDangerEntity); + QueryWrapper queryWrapper = getQueryWrapper(innerDangerEntity); + if (ObjectUtils.isNotEmpty(hiddenDangerBaseVo.getRegistrantStartTime())) { + queryWrapper.lambda().gt(InnerDangerEntity::getCheckTime, hiddenDangerBaseVo.getRegistrantStartTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerBaseVo.getRegistrantEndTime())) { + queryWrapper.lambda().lt(InnerDangerEntity::getRegistrantTime, hiddenDangerBaseVo.getRegistrantEndTime()); + } + queryWrapper.orderByDesc("create_time"); + IPage hiddenDangerEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), queryWrapper); + IPage iPage = getIPage(hiddenDangerEntityIPage); + if (CollectionUtils.isNotEmpty(hiddenDangerEntityIPage.getRecords())) { + List voList = hiddenDangerEntityIPage.getRecords().stream().map(s -> { + HiddenDangerBaseVo hiddenDangerBaseVo1 = new HiddenDangerBaseVo(); + BeanUtil.copy(s, hiddenDangerBaseVo1); + return hiddenDangerBaseVo1; + }).collect(Collectors.toList()); + iPage.setRecords(voList); + }else { + iPage.setRecords(new ArrayList<>()); + } + return iPage; + } + + private static IPage getIPage(IPage hiddenDangerEntityIPage) { + IPage res = new Page<>(); + res.setTotal(hiddenDangerEntityIPage.getTotal()); + res.setCurrent(hiddenDangerEntityIPage.getCurrent()); + res.setPages(hiddenDangerEntityIPage.getPages()); + res.setSize(hiddenDangerEntityIPage.getSize()); + return res; + } + + //排查 + @Override + public IPage getHiddenDangerCheck(HiddenDangerCheckVo hiddenDangerCheckVo, Query query) { + InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); + BeanUtil.copy(hiddenDangerCheckVo, innerDangerEntity); + QueryWrapper queryWrapper = getQueryWrapper(innerDangerEntity); + //隐患等级字段不为空,则代表已经结束排查阶段 + queryWrapper.lambda().isNotNull(InnerDangerEntity::getHiddenDangerLevel); + if (ObjectUtils.isNotEmpty(hiddenDangerCheckVo.getCheckStartTime())) { + queryWrapper.lambda().gt(InnerDangerEntity::getCheckTime, hiddenDangerCheckVo.getCheckStartTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerCheckVo.getCheckEndTime())) { + queryWrapper.lambda().lt(InnerDangerEntity::getCheckTime, hiddenDangerCheckVo.getCheckEndTime()); + } + queryWrapper.orderByDesc("create_time"); + IPage hiddenDangerEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), queryWrapper); + IPage iPage = getIPage(hiddenDangerEntityIPage); + if (CollectionUtils.isNotEmpty(hiddenDangerEntityIPage.getRecords())) { + List voList = hiddenDangerEntityIPage.getRecords().stream().map(s -> { + HiddenDangerCheckVo hiddenDangerCheckVo1 = new HiddenDangerCheckVo(); + BeanUtil.copy(s, hiddenDangerCheckVo1); + return hiddenDangerCheckVo1; + }).collect(Collectors.toList()); + iPage.setRecords(voList); + }else { + iPage.setRecords(new ArrayList<>()); + } + return iPage; + } + + //整改 + @Override + public IPage getHiddenDangerRectifier(HiddenDangerRectifierVo hiddenDangerRectifierVo, Query query) { + InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); + BeanUtil.copy(hiddenDangerRectifierVo, innerDangerEntity); + QueryWrapper queryWrapper = getQueryWrapper(innerDangerEntity); + //验收人不为空,则代表已经结束整改 + queryWrapper.lambda().isNotNull(InnerDangerEntity::getRectifierType); + if (ObjectUtils.isNotEmpty(hiddenDangerRectifierVo.getRectifierStartTime())) { + queryWrapper.lambda().gt(InnerDangerEntity::getRectifierTime, hiddenDangerRectifierVo.getRectifierStartTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerRectifierVo.getRectifierEndTime())) { + queryWrapper.lambda().lt(InnerDangerEntity::getRectifierTime, hiddenDangerRectifierVo.getRectifierEndTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerRectifierVo.getDeadLineStartTime())) { + queryWrapper.lambda().gt(InnerDangerEntity::getDeadLine, hiddenDangerRectifierVo.getDeadLineStartTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerRectifierVo.getDeadLineEndTime())) { + queryWrapper.lambda().lt(InnerDangerEntity::getDeadLine, hiddenDangerRectifierVo.getDeadLineEndTime()); + } + queryWrapper.orderByDesc("create_time"); + IPage hiddenDangerEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), queryWrapper); + IPage iPage = getIPage(hiddenDangerEntityIPage); + if (CollectionUtils.isNotEmpty(hiddenDangerEntityIPage.getRecords())) { + List voList = hiddenDangerEntityIPage.getRecords().stream().map(s -> { + HiddenDangerRectifierVo hiddenDangerRectifierVo1 = new HiddenDangerRectifierVo(); + BeanUtil.copy(s, hiddenDangerRectifierVo1); + return hiddenDangerRectifierVo1; + }).collect(Collectors.toList()); + iPage.setRecords(voList); + }else { + iPage.setRecords(new ArrayList<>()); + } + return iPage; + } + + @Override + public IPage getHiddenDangerConclusion(HiddenDangerConclusionVo hiddenDangerConclusionVo, Query query) { + InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); + BeanUtil.copy(hiddenDangerConclusionVo, innerDangerEntity); + QueryWrapper queryWrapper = Condition.getQueryWrapper(innerDangerEntity); + queryWrapper.lambda().eq(InnerDangerEntity::getConclusionRes,"1"); + if (ObjectUtils.isNotEmpty(hiddenDangerConclusionVo.getConclusionStartTime())) { + queryWrapper.lambda().gt(InnerDangerEntity::getConclusionTime, hiddenDangerConclusionVo.getConclusionStartTime()); + } + if (ObjectUtils.isNotEmpty(hiddenDangerConclusionVo.getConclusionEndTime())) { + queryWrapper.lambda().lt(InnerDangerEntity::getConclusionTime, hiddenDangerConclusionVo.getConclusionEndTime()); + } + queryWrapper.orderByDesc("create_time"); + IPage hiddenDangerEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), queryWrapper); + IPage iPage = getIPage(hiddenDangerEntityIPage); + if (CollectionUtils.isNotEmpty(hiddenDangerEntityIPage.getRecords())) { + List voList = hiddenDangerEntityIPage.getRecords().stream().map(s -> { + HiddenDangerConclusionVo hiddenDangerConclusionVo1 = new HiddenDangerConclusionVo(); + BeanUtil.copy(s, hiddenDangerConclusionVo1); + return hiddenDangerConclusionVo1; + }).collect(Collectors.toList()); + iPage.setRecords(voList); + }else { + iPage.setRecords(new ArrayList<>()); + } + return iPage; + } + private QueryWrapper getQueryWrapper( InnerDangerEntity innerDangerEntity){ + QueryWrapper qw = new QueryWrapper<>(); + if (ObjectUtils.isNotEmpty(innerDangerEntity.getHiddenDangerLevel())){ + qw.lambda().eq(InnerDangerEntity::getHiddenDangerLevel,innerDangerEntity.getHiddenDangerLevel()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getHiddenDangerName())){ + qw.lambda().like(InnerDangerEntity::getHiddenDangerName,innerDangerEntity.getHiddenDangerName()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getConclusionRes())){ + qw.lambda().eq(InnerDangerEntity::getConclusionRes,innerDangerEntity.getConclusionRes()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getJudgeRes())){ + qw.lambda().eq(InnerDangerEntity::getJudgeRes,innerDangerEntity.getJudgeRes()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getJudgeContext())){ + qw.lambda().like(InnerDangerEntity::getJudgeContext,innerDangerEntity.getJudgeContext()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getRiskPointType())){ + qw.lambda().like(InnerDangerEntity::getRiskPointType,innerDangerEntity.getRiskPointType()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getHiddenDangerDept())){ + qw.lambda().eq(InnerDangerEntity::getHiddenDangerDept,innerDangerEntity.getHiddenDangerDept()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getInvestigation())){ + qw.lambda().like(InnerDangerEntity::getInvestigation,innerDangerEntity.getInvestigation()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getRiskPointName())){ + qw.lambda().like(InnerDangerEntity::getRiskPointName,innerDangerEntity.getRiskPointName()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getHiddenDangerAddr())){ + qw.lambda().like(InnerDangerEntity::getHiddenDangerAddr,innerDangerEntity.getHiddenDangerAddr()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getHiddenDangerDeptName())){ + qw.lambda().like(InnerDangerEntity::getHiddenDangerDeptName,innerDangerEntity.getHiddenDangerDeptName()); + } + if (ObjectUtils.isNotEmpty(innerDangerEntity.getRectifierType())){ + qw.lambda().eq(InnerDangerEntity::getRectifierType,innerDangerEntity.getRectifierType()); + } + return qw; + } + private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, InnerDangerEntity innerDangerEntity, Long taskId) { + //推送消息 + if (processWorkFlowResponse.getTaskId() != null) { + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setBusinessClassify("business"); + message.setBusinessKey(MessageConstants.BusinessClassifyEnum.SAFEPRODUCT_HIDDENDANGER.getKey()); + message.setSubject(MessageConstants.BusinessClassifyEnum.SAFEPRODUCT_HIDDENDANGER.getDescription()); + message.setTaskId(Optional.ofNullable(taskId).orElse(System.currentTimeMillis())); + message.setTenantId("200000"); + String countent = + "您的隐患处理流程待审批!隐患名称:".concat(Optional.ofNullable(innerDangerEntity.getHiddenDangerName()).orElse("")) + .concat(",审批环节:") + .concat(processWorkFlowResponse.getTaskName()); + message.setContent(countent); + message.setDeptId(innerDangerEntity.getCreateDept()); + R deptName = sysClient.getDeptName(innerDangerEntity.getCreateDept()); + if (deptName.isSuccess()) { + message.setDeptName(deptName.getData()); + } + String userIds = processWorkFlowResponse.getUserId(); + if (StringUtils.isBlank(userIds)) { + log.error("推送的消息不能为空哦"); + return; + } + message.setUserIds(userIds); + message.setCreateUser(innerDangerEntity.getCreateUser()); + messageClient.sendAppAndWsMsgByUsers(message); + } + } + + @Override + public List getList(InnerDangerDTO req) { + QueryWrapper queryWrapper =getQueryWrapper(BeanUtil.copy(req, InnerDangerEntity.class)); + if(Func.isNotEmpty(req.getDate())) { + queryWrapper.eq("DATE_FORMAT(CREATE_TIME,'%Y-%m-%d')",req.getDate()); + } + return this.list(queryWrapper).stream().map(e -> BeanUtil.copy(e,InnerDangerVo.class)).collect(Collectors.toList()); + } + + @Override + public List getListByDate(String mon) { + List innerDangerEntities = this.baseMapper.selectList(Wrappers.query().lambda().like(InnerDangerEntity::getCreateTime, mon)); + return innerDangerEntities; + } + @Override + public List getListByDeptAndDate(String startTime,String endTime,String stationCode) { + List innerDangerEntities = this.baseMapper.selectList(Wrappers.query().lambda() + .gt(InnerDangerEntity::getCreateTime, startTime) + .lt(InnerDangerEntity::getCreateTime, endTime) + .eq(InnerDangerEntity::getStationCode, stationCode)); + return innerDangerEntities; + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java new file mode 100644 index 0000000..268a02b --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java @@ -0,0 +1,122 @@ +package com.hnac.hzims.safeproduct.hazard.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.common.logs.annotation.OperationAnnotation; +import com.hnac.hzims.common.logs.enums.BusinessType; +import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.hazard.dto.HazardInstanceDTO; +import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + + +/** + * @author xiashandong + * @created 2020/9/1 15:15 + **/ +@RestController +@AllArgsConstructor +@RequestMapping("/dangerSource") +@Api(tags = "危险源") +public class DangerSourceController extends BladeController { + + private final IDangerSourceService dangerSourceService; + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(dangerSourceService.deleteLogic(Func.toLongList(ids))); + } + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 20) + @ApiOperation(value = "新增", notes = "传入dangerSource") + public R save(@RequestBody DangerSourceDTO req) { + return dangerSourceService.doSave(req); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 30) + @ApiOperation(value = "修改", notes = "传入dangerSource") + public R update(@RequestBody DangerSourceDTO req) { + return dangerSourceService.doUpdate(req); + } + + /** + * 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情", notes = "传入dangerSource") + public R detail(@RequestParam Long id) { + return dangerSourceService.detail(id); + } + + /** + * 分页 + */ + @ApiLog + @GetMapping("/list") + @ApiOperationSupport(order = 50) + @ApiOperation(value = "分页", notes = "查询条件:eqId,level,`dangerEle,applyType,type") + @OperationAnnotation(moduleName = "安全管理",title = "危险点列表",operatorType = OperatorType.MOBILE,businessType = + BusinessType.GENCODE, + action = "分页查询危险点列表") + public R> list(DangerSourceEntity req, Query query) { + return dangerSourceService.pageCondition(req, query); + } + + /** + * 根据ID查询危险源 + */ + @GetMapping("/safes") + @ApiOperationSupport(order = 60) + @ApiOperation(value = "查询危险源", notes = "传入safeInfos") + public R> safes(@RequestParam String safeInfos) { + return R.data(dangerSourceService.safes(safeInfos)); + } + + /** + * 导入数据 + */ + @ApiOperation(value = "导入Excel") + @ApiOperationSupport(order = 70) + @PostMapping(value = "/importExcel") + public R importExcel(MultipartFile file) { + dangerSourceService.importExcel(file); + return R.data(true); + } + + + @PostMapping("/importDangerSource") + @ApiOperation("批量导入危险源") + @ApiOperationSupport(order = 80) + public R importDangerSource(@RequestBody HazardInstanceDTO req) { + return R.status(dangerSourceService.importDangerSource(req)); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java new file mode 100644 index 0000000..c7cf1d9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java @@ -0,0 +1,77 @@ +package com.hnac.hzims.safeproduct.hazard.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.hazard.dto.HazardLibraryDTO; +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import com.hnac.hzims.safeproduct.hazard.service.IHazardLibraryService; +import com.hnac.hzims.safeproduct.hazard.vo.HazardLibraryVO; +import com.hnac.hzims.safeproduct.hazard.wrapper.HazardLibraryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +@RestController +@Api(value = "危险源库管理",tags = "危险源库管理") +@AllArgsConstructor +@RequestMapping("/hazard/library") +public class HazardLibraryController extends BladeController { + private final IHazardLibraryService hazardLibraryService; + + @GetMapping("/listPage") + @ApiOperation("列表分页查询") + @ApiOperationSupport(order = 1) + public R listPage(HazardLibraryDTO req, Query query) { + return R.data(hazardLibraryService.listPage(req,query)); + } + + @GetMapping("/list") + @ApiOperation("列表查询") + @ApiOperationSupport(order = 2) + public R> list(HazardLibraryDTO req) { + HazardLibraryEntity library = BeanUtil.copy(req, HazardLibraryEntity.class); + List list = hazardLibraryService.list(hazardLibraryService.getQueryWrapper(library)); + return R.data(HazardLibraryWrapper.build().listVO(list)); + } + + @GetMapping("/detail") + @ApiOperation("查看详情") + @ApiOperationSupport(order = 3) + public R detail(@ApiParam("主键ID") @RequestParam Long id) { + HazardLibraryEntity library = hazardLibraryService.getById(id); + return R.data(HazardLibraryWrapper.build().entityVO(library)); + } + + @PostMapping("/save") + @ApiOperation("保存") + @ApiOperationSupport(order = 4) + public R save(@RequestBody @Valid HazardLibraryDTO req) { + HazardLibraryEntity library = BeanUtil.copy(req, HazardLibraryEntity.class); + return R.status(hazardLibraryService.save(library)); + } + + @PutMapping("/modify") + @ApiOperation("编辑") + @ApiOperationSupport(order = 5) + public R modify(@RequestBody HazardLibraryDTO req) { + HazardLibraryEntity library = BeanUtil.copy(req, HazardLibraryEntity.class); + return R.status(hazardLibraryService.updateById(library)); + } + + @DeleteMapping("/remove") + @ApiOperation("删除危险源库") + @ApiOperationSupport(order = 6) + public R remove(@ApiParam("主键ID") @RequestParam Long id) { + return R.status(hazardLibraryService.removeById(id)); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/RiskHazardController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/RiskHazardController.java new file mode 100644 index 0000000..c913848 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/RiskHazardController.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.safeproduct.hazard.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.hazard.service.IRiskHazardService; +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.itextpdf.text.DocumentException; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @ClassName RiskHazardController + * @description: + * @author: hx + * @create: 2023-09-17 12:04 + * @Version 4.0 + **/ +@RestController +@RequestMapping("/riskHazard") +@AllArgsConstructor +@Slf4j +@Api("风险点管理") +public class RiskHazardController extends BladeController { + + private final IRiskHazardService riskHazardService; + + @GetMapping("/exportRiskHazardExcel") + @ApiOperation("导出风险点") + @ApiOperationSupport(order = 1) + public void exportRiskHazardExcel(HazardSourceDTO req, Query query, HttpServletResponse response) { + riskHazardService.exportRiskHazardExcel(req,query,response); + } + + @GetMapping("/exportEstimateExcel") + @ApiOperation("导出风险评价赋分表") + @ApiOperationSupport(order = 2) + public void exportEstimateExcel(@ApiParam(value = "风险评估ID",required = false) Long estimateId, + @ApiParam(value = "站点编号",required = false) String stationCode, + @ApiParam(value = "风险排查任务ID",required = false) Long taskId, + HttpServletResponse response) throws DocumentException, IOException { + riskHazardService.exportEstimateExcel(estimateId,stationCode,taskId,response); + } + + @GetMapping("/exportEstimateWord") + @ApiOperation("导出风险评价赋分表") + @ApiOperationSupport(order = 2) + public void exportEstimateWord(@ApiParam(value = "风险评估ID",required = false) Long estimateId, + @ApiParam(value = "站点编号",required = false) String stationCode, + @ApiParam(value = "风险排查任务ID",required = false) Long taskId, + HttpServletResponse response) throws Exception { + riskHazardService.exportEstimateWord(estimateId,stationCode,taskId,response); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/DangerSourceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/DangerSourceMapper.java new file mode 100644 index 0000000..9a8d09c --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/DangerSourceMapper.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.hazard.mapper; + +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; +import com.hnac.hzims.safeproduct.vo.SourceVO; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author xiashandong + * @created 2020/9/1 15:27 + **/ +public interface DangerSourceMapper extends UserDataScopeBaseMapper { + + /** + * 危险等级统计数 + * @return + */ + List getLevelCount(); + + String getCurDataBaseName(); + + List listByTenantId(@Param("tenantId") String tenantId); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/HazardLibraryMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/HazardLibraryMapper.java new file mode 100644 index 0000000..c07c8be --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/mapper/HazardLibraryMapper.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.safeproduct.hazard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; + +public interface HazardLibraryMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java new file mode 100644 index 0000000..44d2889 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java @@ -0,0 +1,47 @@ +package com.hnac.hzims.safeproduct.hazard.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.hazard.dto.HazardInstanceDTO; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; +import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; +import com.hnac.hzims.safeproduct.vo.SourceVO; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.system.vo.CreateTableVO; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * @author xiashandong + * @created 2020/9/1 16:00 + **/ +public interface IDangerSourceService extends BaseService { + + R doSave(DangerSourceDTO req); + + R doUpdate(DangerSourceDTO req); + + R detail(Long id); + + R> pageCondition(DangerSourceEntity req, Query query); + + void importExcel(MultipartFile file); + + /** + * 危险等级统计数 + * @return + */ + List getLevelCount(); + + List listByTenantId(String tenantId); + + List getSafeCreateTable(List tableNames); + + List safes(String safeInfos); + + Boolean importDangerSource(HazardInstanceDTO req); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IHazardLibraryService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IHazardLibraryService.java new file mode 100644 index 0000000..fcea334 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IHazardLibraryService.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.hazard.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.safeproduct.hazard.dto.HazardLibraryDTO; +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import com.hnac.hzims.safeproduct.hazard.vo.HazardLibraryVO; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; + +public interface IHazardLibraryService extends BaseService { + + /** + * 分页查询 + * @param req 查询条件 + * @param query 分页条件 + * @return 查询结果 + */ + IPage listPage(HazardLibraryDTO req, Query query); + + /** + * 获取危险源库查询wrapper + * @param request 查询条件 + * @return wrapper + */ + default LambdaQueryWrapper getQueryWrapper(HazardLibraryEntity request) { + return Condition.getQueryWrapper(HazardLibraryEntity.class,request); + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IRiskHazardService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IRiskHazardService.java new file mode 100644 index 0000000..b2af119 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IRiskHazardService.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.safeproduct.hazard.service; + +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.itextpdf.text.DocumentException; +import org.springblade.core.mp.support.Query; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @ClassName IRiskHazardService + * @description: 风险点服务类 + * @author: hx + * @create: 2023-09-17 12:02 + * @Version 4.0 + **/ +public interface IRiskHazardService { + void exportRiskHazardExcel(HazardSourceDTO req, Query query, HttpServletResponse response); + + void exportEstimateExcel(Long estimateId,String stationCode,Long taskId, HttpServletResponse response) throws IOException, DocumentException; + + void exportEstimateWord(Long estimateId,String stationCode,Long taskId, HttpServletResponse response) throws Exception; +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java new file mode 100644 index 0000000..6c666fe --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java @@ -0,0 +1,341 @@ +package com.hnac.hzims.safeproduct.hazard.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.feign.IEmInfoClient; +import com.hnac.hzims.safeproduct.constants.DictConstants; +import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; +import com.hnac.hzims.safeproduct.hazard.dto.DangerSourcePositionDTO; +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.entity.DangerSourceLevelRecordEntity; +import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; +import com.hnac.hzims.safeproduct.hazard.dto.HazardInstanceDTO; +import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum; +import com.hnac.hzims.safeproduct.excel.DangerSourceSaveExcel; +import com.hnac.hzims.safeproduct.mapper.DangerSourceLevelRecordMapper; +import com.hnac.hzims.safeproduct.hazard.mapper.DangerSourceMapper; +import com.hnac.hzims.safeproduct.mapper.DangerSourcePositionMapper; +import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; +import com.hnac.hzims.safeproduct.utils.ExcelToolListener; +import com.hnac.hzims.safeproduct.utils.TableJsonUtils; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; +import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; +import com.hnac.hzims.safeproduct.vo.SourceVO; +import com.hnac.hzims.safeproduct.hazard.wrapper.DangerSourcePostionWrapper; +import com.hnac.hzims.safeproduct.hazard.wrapper.DangerSourceWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springblade.core.excel.support.ExcelException; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.cache.DictCache; +import org.springblade.system.vo.CreateTableVO; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @author xiashandong + * @created 2020/9/1 16:00 + **/ +@Service +@AllArgsConstructor +@Slf4j +public class DangerSourceServiceImpl extends BaseServiceImpl implements IDangerSourceService { + + private final DangerSourceMapper dangerSourceMapper; + private final DangerSourcePositionMapper dangerSourcePositionMapper; + private final DangerSourceLevelRecordMapper dangerSourceLevelRecordMapper; + private final IEmInfoClient emInfoClient; + + private final JdbcTemplate jdbcTemplate; + + @Override + public R doSave(DangerSourceDTO req) { + //设备ID唯一性校验 +// Wrapper queryWrapper = new QueryWrapper() {{ +// eq("eq_id", req.getEqId()); +// }}; +// if (super.getBaseMapper().selectCount(queryWrapper) > 0) { +// //throw new RuntimeException(String.format("设备ID[%s]已经设置过危险等级了!", req.getEqId())); +// return R.fail(400,String.format("设备ID[%s]已经设置过危险等级了!", req.getEqId())); +// } + + //新增危险源记录 + if (!super.save(req)) { + throw new RuntimeException("数据库insert失败!"); + } + + //新增危险源位置记录 + if (null != req.getPosition()) { + req.getPosition().setSourceId(req.getId()); + if (dangerSourcePositionMapper.insert(req.getPosition()) == 0) { + throw new RuntimeException("数据库insert失败!"); + } + } + + //记录危险源等级变更 + DangerSourceLevelRecordEntity levelRecordEntity = new DangerSourceLevelRecordEntity() {{ + setSourceId(req.getId()); + setOrgiLevel(-1); + setNewLevel(req.getLevel()); + setType(0); + setFlowId(""); + setUpdateTime(new Date()); + setRemark("初始化危险等级"); + }}; + if (dangerSourceLevelRecordMapper.insert(levelRecordEntity) == 0) { + throw new RuntimeException("数据库insert失败!"); + } + + return R.data(req.getId()); + } + + @Override + public R doUpdate(DangerSourceDTO req) { + //先查询做存在性校验 + DangerSourceEntity orginDangerSource = dangerSourceMapper.selectById(req.getId()); + if (null == orginDangerSource) { + throw new RuntimeException("记录不存在!"); + } + + //更新危险源 + //等级变更需要走工作流 + //req.setLevel(orginDangerSource.getLevel()); + if (!super.updateById(req)) { + throw new RuntimeException("数据库update失败!"); + } + //添加或更新危险源位置信息 + if (null != req.getPosition()) { + QueryWrapper queryWrapper = new QueryWrapper() {{ + eq("source_id", req.getId()); + }}; + + int line; + req.getPosition().setSourceId(req.getId()); + //不存在位置信息则新增位置信息 + if (null == dangerSourcePositionMapper.selectOne(queryWrapper)) { + line = dangerSourcePositionMapper.insert(req.getPosition()); + } else {//否则修改位置信息 + line = dangerSourcePositionMapper.update(req.getPosition(), queryWrapper); + } + + if (line == 0) { + throw new RuntimeException("数据库操作失败!"); + } + + } + + return R.data(req.getId()); + } + + @Override + public R detail(Long id) { + DangerSourceEntity dangerSource = dangerSourceMapper.selectById(id); + if (null == dangerSource) { + throw new RuntimeException("记录不存在!"); + } + + //查询危险源位置信息 + DangerSourcePositionEntity dangerSourcePosition = dangerSourcePositionMapper.selectOne(new QueryWrapper() {{ + eq("source_id", id); + }}); + + DangerSourceVO detail = DangerSourceWrapper.build().entityVO(dangerSource); + DangerSourcePositionVO position = DangerSourcePostionWrapper.build().entityVO(dangerSourcePosition); + detail.setPosition(position); + return R.data(detail); + } + + @Override + public R> pageCondition(DangerSourceEntity req, Query query) { + Wrapper queryWrapper = new LambdaQueryWrapper() {{ + orderByDesc(DangerSourceEntity::getCreateTime); + if (req.getType() != null) { + eq(DangerSourceEntity::getType, req.getType()); + } + if (null != req.getEqId()) { + eq(DangerSourceEntity::getEqId, req.getEqId()); + } + if (null != req.getLevel()) { + eq(DangerSourceEntity::getLevel, req.getLevel()); + } + if (StringUtil.isNotBlank(req.getName())) { + like(DangerSourceEntity::getName, req.getName()); + } + if (StringUtil.isNotBlank(req.getDangerEle())) { + like(DangerSourceEntity::getDangerEle, req.getDangerEle()); + } + if (StringUtil.isNotBlank(req.getApplyType())) { + eq(DangerSourceEntity::getApplyType, req.getApplyType()); + } + }}; + IPage page = super.page(Condition.getPage(query), queryWrapper); + page.setRecords(DangerSourceWrapper.build().listVO(page.getRecords())); + return R.data(page); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void importExcel(MultipartFile file) { + String filename = file.getOriginalFilename(); + ExcelToolListener excelToolListener = new ExcelToolListener(); + if (StringUtils.isEmpty(filename)) { + throw new ExcelException("请上传文件!"); + } else if (!StringUtils.endsWithIgnoreCase(filename, ".xls") && !StringUtils.endsWithIgnoreCase(filename, ".xlsx")) { + throw new ExcelException("请上传正确的excel文件!"); + } else { + try { + InputStream inputStream = new BufferedInputStream(file.getInputStream()); + com.hnac.hzims.safeproduct.utils.ExcelUtil.asyncReadModel(inputStream, excelToolListener, DangerSourceSaveExcel.class,0,1); + } catch (IOException e) { + e.printStackTrace(); + } + } + /**完善内容**/ + List dataList = excelToolListener.getDataList(); + AtomicInteger index = new AtomicInteger(1); + dataList.forEach(data->{ + JSONObject object = JSONObject.parseObject(JSON.toJSONString(data)); + DangerSourceDTO dangerSourceDTO = BeanUtil.copy(data,DangerSourceDTO.class); + if(Func.isEmpty(object.getString("applyTypeName")) || Func.isEmpty(object.getString("typeName")) || Func.isEmpty(object.getString("levelName")) + || Func.isEmpty(object.getString("name")) || Func.isEmpty(object.getString("dangerEle")) || Func.isEmpty(object.getString("cause")) + || Func.isEmpty(object.getString("measures"))){ + throw new ServiceException("第"+index.get()+"行填入数据不全,请检查修改后再导入"); + } + /**完善应用类型**/ + String appType = DictCache.getKey(DictConstants.SAFE_DANGER_SOURCE_APPLY_TYPE,object.getString("applyTypeName")); + if(StringUtil.isEmpty(appType)){ + throw new ServiceException("第"+index.get()+"行填入应用类型查询不到相关数据,请检查修改后重新导入"); + } + dangerSourceDTO.setApplyType(appType); + /**完善危险源类型**/ + String type = DictCache.getKey(DictConstants.DANGER_TYPE,object.getString("typeName")); + if(StringUtil.isEmpty(type)){ + throw new ServiceException("第"+index.get()+"行填入危险源类型查询不到相关数据,请检查修改后重新导入"); + } + dangerSourceDTO.setType(Integer.valueOf(type)); + /**完善风险等级**/ + String level = DictCache.getKey(DictConstants.RISK_LEVEL,object.getString("levelName")); + if(StringUtil.isEmpty(level)){ + throw new ServiceException("第"+index.get()+"行填入风险等级查询不到相关数据,请检查修改后重新导入"); + } + /**完善设备**/ + if(Func.isNotEmpty(object.getString("equName"))){ + String equName = object.getString("equName"); + R emInfoR = emInfoClient.getEmInfoByName(equName); + log.info("设备查询结果为:{}",JSONObject.toJSONString(emInfoR)); + if(!emInfoR.isSuccess() || Func.isEmpty(emInfoR.getData())){ + throw new ServiceException("第"+index.get()+"行填入设备信息查询不到相关数据,请检查修改后重新导入"); + } + dangerSourceDTO.setEqId(emInfoR.getData().getId()); + } + dangerSourceDTO.setLevel(Integer.valueOf(level)); + /**完善危险源位置对象**/ + DangerSourcePositionDTO positionDTO = BeanUtil.copy(object,DangerSourcePositionDTO.class); + dangerSourceDTO.setPosition(positionDTO); + this.doSave(dangerSourceDTO); + index.getAndIncrement(); + }); + } + + /** + * 危险等级统计数 + * + * @return + */ + @Override + public List getLevelCount() { + List re = dangerSourceMapper.getLevelCount(); + if (Func.isNotEmpty(re)) { + for (DangerSourceReportVO vo : re) { + vo.setName(DangerSourceLevelEnum.getName(vo.getLevel())); + } + } + return re; + } + + @Override + public List getSafeCreateTable(List tableNames) { + if(CollectionUtil.isEmpty(tableNames)){ + return null; + } + // 获取数据库名称 + String databaseName = this.baseMapper.getCurDataBaseName(); + + List list = new ArrayList<>(); + // 遍历处理表名 + tableNames.forEach(table -> { + CreateTableVO item = new CreateTableVO(); + // 获取表结构sql语句 + String show_table_sql = "show create table `" + databaseName + "`." + table; + Map result = jdbcTemplate.queryForMap(show_table_sql); + if (MapUtils.isEmpty(result)) { + return; + } + String createTableSql = result.get("Create Table").toString(); + // 表名 + item.setTableName((String) result.get("Table")); + // 建表语句 + item.setCreateSql(TableJsonUtils.createTableSqlProcess(createTableSql)); + list.add(item); + }); + return list; + } + + @Override + public List safes(String safeInfos) { + if(StringUtil.isEmpty(safeInfos)){ + return new ArrayList<>(); + } + List sources = this.listByIds(Arrays.asList(safeInfos.split(","))); + //未查到数据返回空集合 + if (CollectionUtils.isEmpty(sources)) { + return new ArrayList<>(); + } + //查到数据则将数据排序后再返回 + return sources.stream().sorted(Comparator.comparing(DangerSourceEntity::getId)).collect(Collectors.toList()); + } + + @Override + public Boolean importDangerSource(HazardInstanceDTO req) { + List sourceList = req.getHazardList().stream().map(h -> { + DangerSourceEntity result = JSONObject.parseObject(JSON.toJSONString(h), DangerSourceEntity.class); + result.setLibraryId(h.getId()); + result.setRefDept(req.getDeptId()); + result.setRefDeptName(req.getDeptName()); + return result; + }).collect(Collectors.toList()); + return this.saveBatch(sourceList); + } + + @Override + public List listByTenantId(String tenantId) { + return this.baseMapper.listByTenantId(tenantId); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/HazardLibraryServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/HazardLibraryServiceImpl.java new file mode 100644 index 0000000..7c404bd --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/HazardLibraryServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.hazard.service.impl; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.safeproduct.hazard.dto.HazardLibraryDTO; +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import com.hnac.hzims.safeproduct.hazard.mapper.HazardLibraryMapper; +import com.hnac.hzims.safeproduct.hazard.service.IHazardLibraryService; +import com.hnac.hzims.safeproduct.hazard.vo.HazardLibraryVO; +import com.hnac.hzims.safeproduct.hazard.wrapper.HazardLibraryWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +@AllArgsConstructor +public class HazardLibraryServiceImpl extends BaseServiceImpl implements IHazardLibraryService { + + @Override + public IPage listPage(HazardLibraryDTO req, Query query) { + IPage page = this.page(Condition.getPage(query), this.getQueryWrapper(BeanUtil.copy(req, HazardLibraryEntity.class))); + page.setRecords(HazardLibraryWrapper.build().listVO(page.getRecords())); + return page; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/RiskHazardServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/RiskHazardServiceImpl.java new file mode 100644 index 0000000..c68eb51 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/RiskHazardServiceImpl.java @@ -0,0 +1,249 @@ +package com.hnac.hzims.safeproduct.hazard.service.impl; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import cn.afterturn.easypoi.word.WordExportUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.google.common.collect.Lists; +import com.hnac.hzims.safeproduct.hazard.service.IRiskHazardService; +import com.hnac.hzims.safeproduct.hazard.util.ExcelConvertPdf; +import com.hnac.hzims.safeproduct.hazard.vo.RiskHazardExcelVO; +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.service.HazardTaskService; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import com.hnac.hzims.safeproduct.risk.vo.StationEstimateVo; +import com.hnac.hzims.safeproduct.utils.AsposeUtil; +import com.itextpdf.text.DocumentException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.IntStream; + +/** + * @ClassName RiskHazardServiceImpl + * @description: 风险危险源服务类 + * @author: hx + * @create: 2023-09-17 12:03 + * @Version 4.0 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class RiskHazardServiceImpl implements IRiskHazardService { + + private final HazardSourceService hazardSourceService; + private final HazardTaskService hazardTaskService; + + @Value("${hzims.risk.save-path}") + private String riskEvaluateSavePath; + + + @Override + public void exportEstimateWord(Long estimateId,String stationCode,Long taskId, HttpServletResponse response) throws Exception { + // 根据搜索条件查询风险点 + StationEstimateVo stationEstimate = hazardTaskService.exportEstimate(estimateId,stationCode,taskId); + if(ObjectUtil.isEmpty(stationEstimate) || CollectionUtil.isEmpty(stationEstimate.getExportEstimates())){ + if(StringUtil.isEmpty(stationCode)){ + throw new ServiceException("未查询到任务风险评估数据!"); + }else{ + throw new ServiceException("未查询到站点风险评估数据!"); + } + } + List estimate = stationEstimate.getExportEstimates(); + IntStream.iterate(0,n->n+1).limit(estimate.size()).forEachOrdered(index -> estimate.get(index).setIndex(index+1)); + Map data = new HashMap(3){{ + put("stationName",stationEstimate.getStationName()); + put("year",stationEstimate.getYear()); + put("exportEstimates",estimate); + }}; + XWPFDocument word = WordExportUtil.exportWord07("template/"+"风险评估.docx",data); + String stationName = Optional.ofNullable(stationEstimate).map(StationEstimateVo::getStationName).orElse(""); + String wordPath = riskEvaluateSavePath+ "/" + stationName +"风险评价表.docx"; + String pdfPath = riskEvaluateSavePath+ "/" + stationName +"风险评价表.pdf"; + FileOutputStream outputStream = new FileOutputStream(wordPath); + try { + word.write(outputStream); + } + catch(Exception e) { + e.printStackTrace(); + } + finally { + outputStream.close(); + } + AsposeUtil.wordToPdf(wordPath,pdfPath); + readPdf(response,pdfPath); + } + + /** + * 导出风险点 + * @param response + */ + @Override + public void exportRiskHazardExcel(HazardSourceDTO req, Query query, HttpServletResponse response) { + // 根据搜索条件查询风险点 + IPage page = hazardSourceService.page(req, query); + List riskHazardExcelVOList = JSONArray.parseArray(JSON.toJSONString(page.getRecords()), RiskHazardExcelVO.class); + IntStream.iterate(0,n->n+1).limit(riskHazardExcelVOList.size()).forEachOrdered(index -> riskHazardExcelVOList.get(index).setIndex(index+1)); + Map data = new HashMap(1){{ + put("riskList",riskHazardExcelVOList); + }}; + TemplateExportParams params = new TemplateExportParams("template/风险点导出模板.xlsx",true); + try { + String fileName = URLEncoder.encode("风险点.xlsx","UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + fileName); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + Workbook workbook = ExcelExportUtil.exportExcel(params, data); + Sheet sheet = workbook.getSheetAt(0); + this.mergeCell(2,1,JSONArray.parseArray(JSON.toJSONString(riskHazardExcelVOList)),"categoryName") + .forEach(cellRangeAddress -> sheet.addMergedRegion(cellRangeAddress)); + try { + ServletOutputStream outputStream = response.getOutputStream(); + try{ + workbook.write(outputStream); + } catch(Exception e) { + e.printStackTrace(); + } + finally { + outputStream.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public void exportEstimateExcel(Long estimateId,String stationCode,Long taskId, HttpServletResponse response) throws IOException, DocumentException { + StationEstimateVo stationEstimate = hazardTaskService.exportEstimate(estimateId,stationCode,taskId); + if(ObjectUtil.isEmpty(stationEstimate) || CollectionUtil.isEmpty(stationEstimate.getExportEstimates())){ + if(StringUtil.isEmpty(stationCode)){ + throw new ServiceException("未查询到任务风险评估数据!"); + }else{ + throw new ServiceException("未查询到站点风险评估数据!"); + } + } + List estimate = stationEstimate.getExportEstimates(); + IntStream.iterate(0,n->n+1).limit(estimate.size()).forEachOrdered(index -> estimate.get(index).setIndex(index+1)); + Map data = new HashMap(3){{ + put("stationName",stationEstimate.getStationName()); + put("year",stationEstimate.getYear()); + put("exportEstimates",estimate); + }}; + TemplateExportParams params = new TemplateExportParams("template/风险评价赋分表.xlsx",true); + try { + String fileName = URLEncoder.encode("风险评价赋分表.xlsx","UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + fileName); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + Workbook workbook = ExcelExportUtil.exportExcel(params, data); + Sheet sheet = workbook.getSheetAt(0); + this.mergeCell(2,1,JSONArray.parseArray(JSON.toJSONString(estimate)),"categoryName") + .forEach(sheet::addMergedRegion); + String pdfPath = "D:\\pdf" + stationEstimate.getStationName()+ "["+ stationEstimate.getYear() +"]" + "年度_风险评价赋分表.pdf"; + OutputStream outputStream = Files.newOutputStream(Paths.get(pdfPath)); + ExcelConvertPdf.excelConvertPdf(workbook, outputStream); + // pdf流放入response + readPdf(response,pdfPath); + } + + + /** + * + * @param initRow 起始行数 + * @param initColumn 起始列数 + * @param data 数据 + * @param attribute 合并属性 + * @return + */ + private List mergeCell(int initRow, int initColumn, JSONArray data, String attribute) { + List result = Lists.newArrayList(); + String initAttribute = JSONObject.parseObject(JSON.toJSONString(data.get(0))).getString(attribute); + int mergeCount = 1; + for (int index = 0; index < data.size(); index++ ) { + if(index == 0) { + continue; + } + JSONObject object = JSONObject.parseObject(JSON.toJSONString(data.get(index))); + if(object.getString(attribute).equals(initAttribute)) { + mergeCount ++ ; + } + else { + if(mergeCount > 1) { + result.add(new CellRangeAddress(initRow,initRow+mergeCount-1,initColumn,initColumn)); + } + initRow = initRow+mergeCount; + initAttribute = object.getString(attribute); + mergeCount = 1; + } + if(index == data.size() -1) { + if(mergeCount > 1) { + result.add(new CellRangeAddress(initRow,initRow+mergeCount-1,initColumn,initColumn)); + } + } + } + return result; + } + + /** + * 读取本地pdf,这里设置的是预览 + */ + public static void readPdf(HttpServletResponse response, String filePath) { + response.reset(); + response.setContentType("application/pdf"); + FileInputStream fileInputStream = null; + OutputStream outputStream = null; + try { + File file = new File(filePath); + fileInputStream = new FileInputStream(file); + outputStream = response.getOutputStream(); + IOUtils.write(IOUtils.toByteArray(fileInputStream), outputStream); + response.setHeader("Content-Disposition", + "inline; filename= " + URLEncoder.encode(file.getName(), "UTF-8")); + outputStream.flush(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + fileInputStream.close(); + outputStream.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/ExcelConvertPdf.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/ExcelConvertPdf.java new file mode 100644 index 0000000..c68fa1f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/ExcelConvertPdf.java @@ -0,0 +1,182 @@ +package com.hnac.hzims.safeproduct.hazard.util; + +import com.itextpdf.text.*; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author yangshj + * @Date 2021/12/31 17:31 + */ +public class ExcelConvertPdf { + public static void excelConvertPdf(Workbook workbook, OutputStream osOut) throws DocumentException, IOException { + //设置页面大小 + Rectangle rectPageSize = new Rectangle(PageSize.A3);// 定义A3页面大小 + rectPageSize = rectPageSize.rotate(); //横版 + Document document = new Document(rectPageSize, -80, -80, 50, 0); //边距 + + //字体设置 + /* + * 由于itext不支持中文,所以需要进行字体的设置,可以调用项目资源文件或者调用windows系统的中文字体, + * 找到文件后,打开属性,将文件名及所在路径作为字体名即可。 + */ + //创建BaseFont对象,指明字体,编码方式,是否嵌入 + BaseFont bf=BaseFont.createFont("D:\\fonts\\SIMSUN.TTC,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); + //创建Font对象,将基础字体对象,字体大小,字体风格 + Font font = new Font(bf, 13, Font.NORMAL); + int rowNum = 0; + int colNum = 0; + + Sheet sheet = workbook.getSheetAt(0); + int column = sheet.getRow(1).getLastCellNum(); + int row = sheet.getPhysicalNumberOfRows(); + System.out.println(row); + //下面是找出表格中的空行和空列 + List nullCol = new ArrayList<>(); + List nullRow = new ArrayList<>(); + for (int j = 0; j < column; j++) { + int nullColNum = 0; + for (int i = 0; i < row; i++) { + Cell cell = sheet.getRow(i).getCell(j); + if (cell == null || (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) && "".equals(cell.getStringCellValue())) { + nullColNum++; + } + } + if (nullColNum == row) { + nullCol.add(j); + } + } + for (int i = 0; i < row; i++) { + int nullRowNum = 0; + for (int j = 0; j < column; j++) { + Cell cell = sheet.getRow(i).getCell(j); + if (cell == null || (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) && "".equals(cell.getStringCellValue())) { + nullRowNum++; + } + } + if (nullRowNum == column) { + nullRow.add(i); + } + } + PdfWriter writer = PdfWriter.getInstance(document,osOut); + document.open(); + PdfPTable table = new PdfPTable(column-sheet.getRow(1).getFirstCellNum()); + List ranges = new ArrayList(); + int sheetMergeCount = sheet.getNumMergedRegions(); + System.out.println("sheetMergeCount"+sheetMergeCount); + for (int i = 0; i < sheetMergeCount; i++) { + CellRangeAddress range = sheet.getMergedRegion(i); + ranges.add(range); + } + + PdfPCell cell1 = null; + String str = null; + boolean mergeFlag = true; + + for (int i = sheet.getFirstRowNum(); i < row; i++) { + /*if (nullRow.contains(i)) { //如果这一行是空行,这跳过这一行 + continue; + }*/ + + for (int j = sheet.getRow(1).getFirstCellNum(); j < column; j++) { + /*if (nullCol.contains(j)) { //如果这一列是空列,则跳过这一列 + continue; + }*/ + + boolean flag = true; + Cell cell = sheet.getRow(i).getCell(j); + if(null != cell) { + if (cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) { + str = (int) cell.getNumericCellValue() + ""; + } else { + str = cell.getStringCellValue(); + } + + System.out.println("i ::"+i + "j::"+j); + System.out.println(str); + + for (CellRangeAddress range : ranges) { //合并的单元格判断和处理 + + if (j >= range.getFirstColumn() && j <= range.getLastColumn() && i >= range.getFirstRow() + && i <= range.getLastRow()) { + /*if (str == null || "".equals(str)) { + flag = false; + if (ranges.size()>1){ + mergeFlag = true; + }else { + mergeFlag = false; + } + break; + }*/ + if(mergeFlag){ + rowNum = range.getLastRow() - range.getFirstRow() + 1; + colNum = range.getLastColumn() - range.getFirstColumn() + 1; + cell1 = mergeCell(str, font, rowNum, colNum); + System.out.println("合并"+rowNum+"、"+colNum); + table.addCell(cell1); + flag = false; + if (ranges.size()>1){ + mergeFlag = true; + }else { + mergeFlag = false; + } + break; + } + flag = false; + if (ranges.size()>1){ + mergeFlag = true; + }else { + mergeFlag = false; + } + } + } + + if (flag) { + table.addCell(getPDFCell(str, font)); + } + } + + } + } + document.add(table); + document.close(); + writer.close(); + } + + //合并 + public static PdfPCell mergeCell(String str, Font font, int i, int j) { + + PdfPCell cell = new PdfPCell(new Paragraph(str, font)); + cell.setMinimumHeight(25); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setRowspan(i); + cell.setColspan(j); + + return cell; + } + //获取指定内容与字体的单元格 + public static PdfPCell getPDFCell(String string, Font font) { + //创建单元格对象,将内容与字体放入段落中作为单元格内容 + PdfPCell cell = new PdfPCell(new Paragraph(string, font)); + + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + + //设置最小单元格高度 + cell.setMinimumHeight(25); + return cell; + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/FILE_TYPE.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/FILE_TYPE.java new file mode 100644 index 0000000..dd1c410 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/util/FILE_TYPE.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.safeproduct.hazard.util; + +/** + * @author ysj + * @version 4.0.0 + * @create 2023-10-12-22:08 + */ +public enum FILE_TYPE{ + /** + * 统计报表形式 + */ + PDF("pdf"), + EXCLE("excle"); + + String desc; + + FILE_TYPE(String desc){ + this.desc = desc; + } + public static FILE_TYPE getFileTypeEnum(String desc){ + for(FILE_TYPE fileType:FILE_TYPE.values()){ + if(fileType.desc.equals(desc)){ + return fileType; + } + } + return null; + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/RiskHazardExcelVO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/RiskHazardExcelVO.java new file mode 100644 index 0000000..9005021 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/RiskHazardExcelVO.java @@ -0,0 +1,57 @@ +package com.hnac.hzims.safeproduct.hazard.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName HazardExcelVO + * @description: + * @author: hx + * @create: 2023-09-17 11:48 + * @Version 4.0 + **/ +@ApiModel("风险点Excel导出对象") +@Data +@AllArgsConstructor +@EqualsAndHashCode +public class RiskHazardExcelVO implements Serializable { + + @Excel(name = "序号") + private Integer index; + + @Excel(name = "类别") + private String categoryName; + + @Excel(name = "风险点") + private String perilPoint; + + @Excel(name = "危险源") + private String hazardName; + + @Excel(name = "事故诱因") + private String accidentIncentive; + + @Excel(name = "可能导致的后果") + private String causeConsequence; + + @Excel(name = "风险评价方法") + private String estimateMethodName; + + private Integer lUpLimit; + + private Integer lLowerLimit; + + private Integer eUpLimit; + + private Integer eLowerLimit; + + private Integer sUpLimit; + + private Integer sLowerLimit; + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourcePostionWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourcePostionWrapper.java new file mode 100644 index 0000000..1304d4f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourcePostionWrapper.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.safeproduct.hazard.wrapper; + +import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +/** + * @author xiashandong + * @created 2020/9/1 15:45 + **/ +public class DangerSourcePostionWrapper extends BaseEntityWrapper { + + public static DangerSourcePostionWrapper build() { + return new DangerSourcePostionWrapper(); + } + + @Override + public DangerSourcePositionVO entityVO(DangerSourcePositionEntity entity) { + DangerSourcePositionVO vo = BeanUtil.copy(entity, DangerSourcePositionVO.class); + return vo; + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java new file mode 100644 index 0000000..e71adde --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java @@ -0,0 +1,35 @@ +package com.hnac.hzims.safeproduct.hazard.wrapper; + +import com.hnac.hzims.safeproduct.constants.DictConstants; +import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; +import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.system.cache.DictCache; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; + +import java.util.Optional; + +/** + * @author xiashandong + * @created 2020/9/1 15:45 + **/ +public class DangerSourceWrapper extends BaseEntityWrapper { + + public static DangerSourceWrapper build() { + return new DangerSourceWrapper(); + } + + @Override + public DangerSourceVO entityVO(DangerSourceEntity entity) { + DangerSourceVO vo = BeanUtil.copy(entity, DangerSourceVO.class); + User createUser = UserCache.getUser(entity.getCreateUser()); + User updateUser = UserCache.getUser(entity.getUpdateUser()); + vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null)); + vo.setUpdateUserName(Optional.ofNullable(updateUser).map(User::getName).orElse(null)); + vo.setApplyTypeName(DictCache.getValue(DictConstants.SAFE_DANGER_SOURCE_APPLY_TYPE, entity.getApplyType())); + return vo; + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java new file mode 100644 index 0000000..55799b4 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.hazard.wrapper; + +import com.hnac.hzims.safeproduct.hazard.entity.HazardLibraryEntity; +import com.hnac.hzims.safeproduct.hazard.vo.HazardLibraryVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +public class HazardLibraryWrapper extends BaseEntityWrapper { + + public static HazardLibraryWrapper build() { + return new HazardLibraryWrapper(); + } + + @Override + public HazardLibraryVO entityVO(HazardLibraryEntity entity) { + HazardLibraryVO hazardLibraryVO = BeanUtil.copy(entity, HazardLibraryVO.class); + return hazardLibraryVO; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java deleted file mode 100644 index bea8663..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/controller/HiddenDangerController.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; -import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService; -import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; -import lombok.RequiredArgsConstructor; -import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@RequiredArgsConstructor -@RestController -@RequestMapping("/hiddendanger") -public class HiddenDangerController { - - @Autowired - HiddenDangerService hiddenDangerService; - - /** - * 分页查询 - */ - @GetMapping("/listPage/{page}/{size}") - public R listPage(@PathVariable Long page, - @PathVariable Long size, - HiddenDangerQueryVo hiddenDangerQueryVo) { - Page pageParam = new Page<>(page, size); - IPage resultParams = - hiddenDangerService.selectPage(pageParam, - hiddenDangerQueryVo); - return R.data(resultParams); - } - - /** - * 新增指标项管理 - */ - @PostMapping("/save") - public R save(@RequestBody HiddenDanger hiddenDanger) { - hiddenDangerService.save(hiddenDanger); - return R.success("新增成功"); - } - - - /** - * 更新指标项管理 - */ - @PutMapping("/update") - public R update(@RequestBody HiddenDanger hiddenDanger) { - hiddenDangerService.updateById(hiddenDanger); - return R.success("修改成功"); - } - - - /** - * 删除指标项管理 - */ - @DeleteMapping("/remove/{id}") - public R remove(@PathVariable Long id) { - hiddenDangerService.removeById(id); - return R.success("删除成功"); - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java deleted file mode 100644 index a7a4c7a..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/mapper/HiddenDangerMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; - -public interface HiddenDangerMapper extends BaseMapper { -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java deleted file mode 100644 index 35b3dc9..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/HiddenDangerService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; -import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; - -public interface HiddenDangerService extends IService { - - - /** - * 分页查询 - * @param pageParam - * @param hiddenDangerQueryVo - * @return - */ - IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo); -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java deleted file mode 100644 index 2632dbc..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hiddendanger/service/impl/HiddenDangerServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.hnac.hzims.safeproduct.hiddendanger.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzims.safeproduct.hiddendanger.entity.HiddenDanger; -import com.hnac.hzims.safeproduct.hiddendanger.mapper.HiddenDangerMapper; -import com.hnac.hzims.safeproduct.hiddendanger.service.HiddenDangerService; -import com.hnac.hzims.safeproduct.hiddendanger.vo.HiddenDangerQueryVo; -import org.springframework.stereotype.Service; - -@Service -public class HiddenDangerServiceImpl extends ServiceImpl implements HiddenDangerService { - @Override - public IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo) { - String dangerBehavior = hiddenDangerQueryVo.getDangerBehavior(); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotBlank(dangerBehavior)) { - queryWrapper.like(HiddenDanger::getDangerBehavior,dangerBehavior); - } - IPage hiddenDangerIPage = baseMapper.selectPage(pageParam, queryWrapper); - - return hiddenDangerIPage; - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.java index b76f9ca..df347f9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.java @@ -1,12 +1,17 @@ package com.hnac.hzims.safeproduct.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.hnac.hzims.safeproduct.entity.AccidentEntity; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerAccidentMonthCountVO; +import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import java.util.List; + /** * @author hx */ public interface AccidentMapper extends UserDataScopeBaseMapper { - + List getAccidentMonthTrend(@Param("ew") QueryWrapper ew); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.xml new file mode 100644 index 0000000..f6b90db --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/AccidentMapper.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.java deleted file mode 100644 index 9b435a8..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.safeproduct.mapper; - -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; -import com.hnac.hzims.safeproduct.vo.SourceVO; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -import java.util.List; - -/** - * @author xiashandong - * @created 2020/9/1 15:27 - **/ -public interface DangerSourceMapper extends UserDataScopeBaseMapper { - - /** - * 危险等级统计数 - * @return - */ - List getLevelCount(); - - String getCurDataBaseName(); - - List listByTenantId(@Param("tenantId") String tenantId); -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.xml index 6376221..d968c82 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/DangerSourceMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/CorrelationController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/CorrelationController.java new file mode 100644 index 0000000..500f331 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/CorrelationController.java @@ -0,0 +1,67 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.dto.CorrelationDTO; +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import com.hnac.hzims.safeproduct.risk.service.CorrelationService; +import com.hnac.hzims.safeproduct.risk.vo.CorrelationDetailsVo; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/work/correlation") +public class CorrelationController { + + private final CorrelationService service; + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "关联危险源", notes = "传入Correlation") + public R correlation(@RequestBody CorrelationDTO correlation) { + return R.status(service.correlation(correlation)); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "重新关联危险源", notes = "传入Correlation") + public R re_correlation(@RequestBody CorrelationDTO correlation) { + return R.status(service.re_correlation(correlation)); + } + + /** + * 详情 + */ + @GetMapping("/details") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R details(@RequestParam("workId") Long workId) { + return R.data(service.details(workId)); + } + + + /** + * 分页 + */ + @GetMapping("/pageList") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R> page(Correlation entity, Query query) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimateController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimateController.java new file mode 100644 index 0000000..d4d31f5 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimateController.java @@ -0,0 +1,48 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimate; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import com.hnac.hzims.safeproduct.risk.service.EstimateService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +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; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/estimate") +public class EstimateController { + + private final EstimateService estimateService; + + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "风险评估新增", notes = "传入Estimate") + public R save(@RequestBody RiskEstimate entity) { + return R.status(estimateService.saveEstimate(entity)); + } + + @PostMapping("/pageList") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "风险评估任务列表", notes = "传入HazardWork") + public R save(RiskEstimate entity, Query query) { + return R.data(estimateService.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } + + @PostMapping("/execute") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "危险源评估", notes = "传入RiskEstimatePoint") + public R execute(@RequestBody RiskEstimatePoint point) { + return R.status(estimateService.execute(point)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimatePointController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimatePointController.java new file mode 100644 index 0000000..09ee3b4 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/EstimatePointController.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import com.hnac.hzims.safeproduct.risk.service.EstimatePointService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.web.bind.annotation.*; + +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/estimate/point") +public class EstimatePointController { + + private final EstimatePointService pointService; + + @PostMapping("/list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "风险评估任务列表", notes = "传入HazardWork") + public R save(@RequestParam Long estimateId, Query query) { + IPage page = pointService.page(Condition.getPage(query),Wrappers.lambdaQuery() + .eq(RiskEstimatePoint::getEstimateId,estimateId)); + if(CollectionUtil.isEmpty(page.getRecords())){ + throw new ServiceException("风险评估清单获取失败,请联系系统管理员!"); + } + page.setRecords(page.getRecords().stream().sorted(Comparator.comparing(RiskEstimatePoint::getCategory).thenComparing(RiskEstimatePoint::getPerilPoint).thenComparing(RiskEstimatePoint::getHazardName)).collect(Collectors.toList())); + return R.data(page); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardCategoryController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardCategoryController.java new file mode 100644 index 0000000..a9d8a9a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardCategoryController.java @@ -0,0 +1,93 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.service.HazardCategoryService; +import com.hnac.hzims.safeproduct.risk.vo.HazardDetailsVo; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/hazard/category") +public class HazardCategoryController { + + private final HazardCategoryService service; + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增", notes = "传入HazardDetailsVo") + public R save(@RequestBody HazardDetailsVo entity) { + return R.status(service.saveDetail(entity)); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "新增", notes = "传入HazardDetailsVo") + public R update(@RequestBody HazardDetailsVo entity) { + return R.status(service.updateDetail(entity)); + } + + /** + * 分页 + */ + @GetMapping("/details") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R details(@RequestParam("categoryId") Long categoryId) { + return R.data(service.details(categoryId)); + } + + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "删除", notes = "ids") + public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { + return R.status(service.removeDetail(Func.toLongList(ids))); + } + + /** + * 分页 + */ + @GetMapping("/pages") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "分页", notes = "查询条件:entity") + public R> page(HazardCategory entity, Query query) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } + + + /** + * 是否存在危险源 + */ + @GetMapping("/isExist") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "是否存在危险源", notes = "传入风险源名称") + public R isExist(@RequestParam("stationType") Long stationType, + @RequestParam("category") Long category, + @RequestParam("perilPoint") String perilPoint, + @RequestParam("hazardName") String hazardName) { + return R.data(service.isExist(stationType,category,perilPoint,hazardName)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardLevelController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardLevelController.java new file mode 100644 index 0000000..0167d66 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardLevelController.java @@ -0,0 +1,77 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import com.hnac.hzims.safeproduct.risk.service.HazardLevelService; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/hazard/level") +public class HazardLevelController { + + private final HazardLevelService service; + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增", notes = "传入HazardLevel") + public R save(@RequestBody HazardLevel entity) { + return R.status(service.save(entity)); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "修改", notes = "传入HazardLevel") + public R update(@RequestBody HazardLevel entity) { + return R.status(service.updateById(entity)); + } + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(service.deleteLogic(Func.toLongList(ids))); + } + + /** + * 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "详情", notes = "传入id") + public R detail(@RequestParam Long id) { + return R.data(service.getById(id)); + } + + + /** + * 分页 + */ + @GetMapping("/pageList") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R> page(HazardLevel entity, Query query) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardSourceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardSourceController.java new file mode 100644 index 0000000..3acc4a1 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardSourceController.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/hazard/source") +public class HazardSourceController { + + private final HazardSourceService service; + + /** + * 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R> list(HazardSource entity, Query query) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } + + /** + * 分页 + */ + @GetMapping("/pages") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "查询条件:entity") + public R> pages(SourceVo entity, Query query) { + return R.data(service.pageCondition(entity,Condition.getPage(query))); + } + + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "分页查询", notes = "查询条件:HazardSourceDTO") + public R> page(HazardSourceDTO req,Query query) { + return R.data(service.page(req,query)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardTaskController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardTaskController.java new file mode 100644 index 0000000..c95ea34 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardTaskController.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.dto.HazardRiskProcessDTO; +import com.hnac.hzims.safeproduct.risk.service.HazardTaskService; +import com.hnac.hzims.safeproduct.risk.vo.HazardTaskVo; +import com.hnac.hzims.safeproduct.risk.vo.StationEstimateVo; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/hazard/process") +public class HazardTaskController { + + private final HazardTaskService service; + + @PostMapping("/startProcess") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "开启流程", notes = "传入Correlation") + public R startProcess(@RequestBody HazardRiskProcessDTO process) { + return R.status(service.startProcess(process)); + } + + @PostMapping("/pages") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "用户任务列表", notes = "查询条件:entity") + public R> page(HazardTaskVo entity, Query query) { + return R.data(service.pageCondition(entity,Condition.getPage(query))); + } + + @GetMapping("/details") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "任务风险评估详情", notes = "查询条件:entity") + public R details(@RequestParam("taskId") Long taskId) { + return R.data(service.details(taskId)); + } + + @GetMapping("/exportEstimate") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "任务风险导出", notes = "查询条件:entity") + public R exportEstimate(@RequestParam(value = "stationCode",required = false) String stationCode, + @RequestParam(value = "stationCode",required = false) Long taskId) { + return R.data(service.exportEstimate(null,stationCode,taskId)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java new file mode 100644 index 0000000..cad2485 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java @@ -0,0 +1,89 @@ +package com.hnac.hzims.safeproduct.risk.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.risk.dto.CorrelationDTO; +import com.hnac.hzims.safeproduct.risk.entity.HazardWork; +import com.hnac.hzims.safeproduct.risk.service.HazardWorkService; +import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author ysj + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/risk/hazard/work") +public class HazardWorkController { + + private final HazardWorkService service; + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 20) + @ApiOperation(value = "新增", notes = "传入HazardWork") + public R save(@RequestBody HazardWork entity) { + return R.status(service.save(entity)); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 30) + @ApiOperation(value = "修改", notes = "传入HazardWork") + public R update(@RequestBody HazardWork entity) { + return R.status(service.updateById(entity)); + } + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { + return R.status(service.deleteBacth(Func.toLongList(ids))); + } + + /** + * 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情", notes = "传入id") + public R detail(@RequestParam Long id) { + return R.data(service.getById(id)); + } + + + /** + * 分页 + */ + @GetMapping("/pageList") + @ApiOperationSupport(order = 60) + @ApiOperation(value = "分页", notes = "查询条件:item") + public R> page(HazardWork entity, Query query) { + return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity))); + } + + @GetMapping("/getCheckItemByDutyPerson") + @ApiOperationSupport(order = 70) + @ApiOperation(value = "根据负责人ID获取对应区域下的风险排查项") + public R> getCheckItemByDutyPerson(@RequestParam @ApiParam("区域负责人ID") Long userId,@RequestParam @ApiParam("风险点ID")Long categoryId) { + return R.data(service.getCheckItemByDutyPerson(userId,categoryId)); + } + +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/RiskCheckController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/RiskCheckController.java new file mode 100644 index 0000000..9a1686e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/RiskCheckController.java @@ -0,0 +1,71 @@ +package com.hnac.hzims.safeproduct.risk.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.safeproduct.risk.dto.RiskCheckDTO; +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import com.hnac.hzims.safeproduct.risk.service.IRiskCheckService; +import com.hnac.hzims.safeproduct.risk.wrapper.RiskCheckWrapper; +import com.hnac.hzims.safeproduct.vo.RiskCheckVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * @ClassName RiskCheckController + * @description: + * @author: hx + * @create: 2023-09-19 09:32 + * @Version 4.0 + **/ +@RestController +@AllArgsConstructor +@Slf4j +@RequestMapping("/risk/check") +@Api(value = "风险检查项管理",tags = "风险检查项管理") +public class RiskCheckController extends BladeController { + + private final IRiskCheckService riskCheckService; + + @GetMapping("/page") + @ApiOperation("分页查询") + @ApiOperationSupport(order = 1) + public R> page(RiskCheckDTO req, Query query) { + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(RiskCheckEntity.class, BeanUtil.copy(req, RiskCheckEntity.class)); + IPage page = riskCheckService.page(Condition.getPage(query), queryWrapper); + page.setRecords(RiskCheckWrapper.build().listVO(page.getRecords())); + return R.data(page); + } + + @PostMapping("/saveOrUpdateBatch") + @ApiOperation("批量新增/修改") + @ApiOperationSupport(order = 2) + public R saveOrUpdateBatch(@RequestBody @Valid List req) { + List riskCheckList = JSONArray.parseArray(JSON.toJSONString(req), RiskCheckEntity.class); + return R.status(riskCheckService.saveBatch(riskCheckList)); + } + + @DeleteMapping("/delete/{ids}") + @ApiOperation("批量删除") + @ApiOperationSupport(order = 3) + public R delete(@PathVariable @ApiParam("id,按逗号分隔") String ids) { + return R.status(riskCheckService.removeByIds(Func.toLongList(",",ids))); + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClient.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClient.java new file mode 100644 index 0000000..980c22f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/feign/HazardRiskClient.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.safeproduct.risk.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.risk.service.HazardTaskService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +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; + +/** + * @author ysj + */ +@RestController +@RequestMapping("/feign/hazardRisk") +@Slf4j +@RequiredArgsConstructor +public class HazardRiskClient implements IHazardRiskClient { + + private final HazardTaskService service; + + /** + * 检修任务流程监听 + * @param processWorkFlowResponse + * @return + */ + @Override + @PostMapping("/listener") + public R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse) { + return R.status(service.listener(processWorkFlowResponse)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.java new file mode 100644 index 0000000..662bf6c --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface CorrelationMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.xml new file mode 100644 index 0000000..64f6c76 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/CorrelationMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.java new file mode 100644 index 0000000..07a33b7 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimate; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface EstimateMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.xml new file mode 100644 index 0000000..9a5341e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimateMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.java new file mode 100644 index 0000000..b0845a9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface EstimatePointMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.xml new file mode 100644 index 0000000..8885015 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/EstimatePointMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.java new file mode 100644 index 0000000..0b7bb27 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.vo.CategorySourceVo; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardCategoryMapper extends UserDataScopeBaseMapper { + List sourcesByCategory(@Param("stationType") Integer stationType); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.xml new file mode 100644 index 0000000..bd35c38 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardCategoryMapper.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.java new file mode 100644 index 0000000..9c198cf --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardEstimateMapper extends UserDataScopeBaseMapper { + + List exprotEstimate(@Param("taskId") Long taskId); +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.xml new file mode 100644 index 0000000..a039a46 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardEstimateMapper.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.java new file mode 100644 index 0000000..66e76b1 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface HazardLevelMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.xml new file mode 100644 index 0000000..a960623 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardLevelMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.java new file mode 100644 index 0000000..c8ac1c0 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface HazardSourceMapper extends BaseMapper { + + @UserDataAuth + IPage pageCondition(IPage page,@Param("source") SourceVo entity); + + @UserDataAuth + IPage selectPageOverride(IPage page, @Param("ew") Wrapper ew); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.xml new file mode 100644 index 0000000..e659237 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardSourceMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.java new file mode 100644 index 0000000..d9b6e02 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.safeproduct.risk.entity.HazardTask; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import com.hnac.hzims.safeproduct.risk.vo.HazardTaskVo; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardTaskMapper extends UserDataScopeBaseMapper { + + IPage pageCondition(IPage page, @Param("task") HazardTaskVo entity); + + List stationRiskLevel(); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.xml new file mode 100644 index 0000000..6e6b45b --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardTaskMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.java new file mode 100644 index 0000000..18712b9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.hnac.hzims.safeproduct.risk.entity.HazardWork; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardWorkMapper extends UserDataScopeBaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.xml new file mode 100644 index 0000000..e6ab349 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/HazardWorkMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/RiskCheckMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/RiskCheckMapper.java new file mode 100644 index 0000000..7fa3c81 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/mapper/RiskCheckMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.safeproduct.risk.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; + +public interface RiskCheckMapper extends BaseMapper { + + + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/CorrelationService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/CorrelationService.java new file mode 100644 index 0000000..0baadce --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/CorrelationService.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.dto.CorrelationDTO; +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import com.hnac.hzims.safeproduct.risk.vo.CorrelationDetailsVo; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface CorrelationService extends BaseService { + + boolean correlation(CorrelationDTO correlation); + + boolean re_correlation(CorrelationDTO correlation); + + CorrelationDetailsVo details(Long workId); + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimatePointService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimatePointService.java new file mode 100644 index 0000000..f2f7923 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimatePointService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface EstimatePointService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimateService.java new file mode 100644 index 0000000..2971a47 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/EstimateService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimate; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface EstimateService extends BaseService { + + + boolean saveEstimate(RiskEstimate entity); + + boolean execute(RiskEstimatePoint point); +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardCategoryService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardCategoryService.java new file mode 100644 index 0000000..9bd5203 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardCategoryService.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.vo.CategorySourceVo; +import com.hnac.hzims.safeproduct.risk.vo.HazardDetailsVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardCategoryService extends BaseService { + + boolean saveDetail(HazardDetailsVo entity); + + boolean updateDetail(HazardDetailsVo entity); + + HazardDetailsVo details(Long categoryId); + + boolean removeDetail(List ids); + + boolean isExist(Long stationType,Long category,String perilPoint,String hazardName); + + List sourcesByCategory(Integer stationType); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardEstimateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardEstimateService.java new file mode 100644 index 0000000..db31bf9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardEstimateService.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardEstimateService extends BaseService { + + List evaluationLevel(List estimates); + + List exportEstimate(Long taskId); +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardLevelService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardLevelService.java new file mode 100644 index 0000000..01ce5bb --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardLevelService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface HazardLevelService extends BaseService { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardSourceService.java new file mode 100644 index 0000000..bf9b5e4 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardSourceService.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.vo.HazardDetailsVo; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.Query; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardSourceService extends BaseService { + + IPage pageCondition(SourceVo entity, IPage page); + + List list(HazardSourceDTO sourceDTO); + + IPage page(HazardSourceDTO req, Query query); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardTaskService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardTaskService.java new file mode 100644 index 0000000..0db7110 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardTaskService.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.risk.dto.HazardRiskProcessDTO; +import com.hnac.hzims.safeproduct.risk.entity.HazardTask; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import com.hnac.hzims.safeproduct.risk.vo.HazardTaskVo; +import com.hnac.hzims.safeproduct.risk.vo.StationEstimateVo; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import com.hnac.hzims.safeproduct.statistic.vo.RiskInnerVO; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardTaskService extends BaseService { + + boolean startProcess(HazardRiskProcessDTO process); + + boolean listener(ProcessWorkFlowResponse processWorkFlowResponse); + + IPage pageCondition(HazardTaskVo entity, IPage page); + + HazardTaskVo details(Long taskId); + + List stationRiskLevel(); + + StationEstimateVo exportEstimate(Long estimateId,String stationCode,Long taskId); + + RiskInnerVO stationRiskInner(String stationCode); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java new file mode 100644 index 0000000..35cfefa --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.HazardWork; +import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface HazardWorkService extends BaseService { + + boolean deleteBacth(List workIds); + + List getCheckItemByDutyPerson(Long userId,Long categoryId); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/IRiskCheckService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/IRiskCheckService.java new file mode 100644 index 0000000..d3c8996 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/IRiskCheckService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.risk.service; + +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @ClassName IRiskCheckService + * @description: + * @author: hx + * @create: 2023-09-19 09:34 + * @Version 4.0 + **/ +public interface IRiskCheckService extends BaseService { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/CorrelationServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/CorrelationServiceImpl.java new file mode 100644 index 0000000..5eb37f1 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/CorrelationServiceImpl.java @@ -0,0 +1,94 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.dto.CorrelationDTO; +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.mapper.CorrelationMapper; +import com.hnac.hzims.safeproduct.risk.service.CorrelationService; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.vo.CorrelationDetailsVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class CorrelationServiceImpl extends BaseServiceImpl implements CorrelationService { + + private final HazardSourceService sourceService; + + /** + * 危险源关联 + * @param correlation : 危险源关联数据 + * @return + */ + @Override + public boolean correlation(CorrelationDTO correlation) { + if(ObjectUtil.isEmpty(correlation) || CollectionUtil.isEmpty(correlation.getSources())){ + throw new ServiceException("请选择危险源关联数据,再进行保存!"); + } + return super.saveBatch(correlation.getSources().stream().map(source->{ + Correlation entity = new Correlation(); + entity.setWorkId(correlation.getWorkId()); + entity.setCategoryId(source.getCategoryId()); + entity.setSourceId(source.getId()); + return entity; + }).collect(Collectors.toList())); + } + + /** + * 重新关联危险源 + * @param correlation + * @return + */ + @Override + public boolean re_correlation(CorrelationDTO correlation) { + if(ObjectUtil.isEmpty(correlation)){ + throw new ServiceException("请选择危险源关联数据,再进行保存!"); + } + if(CollectionUtil.isEmpty(correlation.getSources())) { + return super.remove(Wrappers.lambdaQuery().eq(Correlation::getWorkId, correlation.getWorkId())); + } + // 删除已关联危险源数据 && 保存新关联危险源数据 + return super.remove(Wrappers.lambdaQuery().eq(Correlation::getWorkId, correlation.getWorkId())) && super.saveBatch(correlation.getSources().stream().map(source->{ + Correlation entity = new Correlation(); + entity.setWorkId(correlation.getWorkId()); + entity.setCategoryId(source.getCategoryId()); + entity.setSourceId(source.getId()); + return entity; + }).collect(Collectors.toList())); + } + + /** + * 查看关联危险源详情 + * @param workId + * @return + */ + @Override + public CorrelationDetailsVo details(Long workId) { + if(ObjectUtil.isEmpty(workId)){ + throw new ServiceException("请选择需要查看的作业区域!"); + } + List sources = this.list(Wrappers.lambdaQuery() + .eq(Correlation::getWorkId,workId)); + if(CollectionUtil.isEmpty(sources)){ + return new CorrelationDetailsVo(); + } + CorrelationDetailsVo correlation = new CorrelationDetailsVo(); + correlation.setWorkId(workId); + correlation.setSources(sourceService.listByIds(sources.stream().map(Correlation::getSourceId).collect(Collectors.toList()))); + return correlation; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimatePointServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimatePointServiceImpl.java new file mode 100644 index 0000000..cc958a1 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimatePointServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.constants.HazardRiskConstants; +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import com.hnac.hzims.safeproduct.risk.mapper.EstimatePointMapper; +import com.hnac.hzims.safeproduct.risk.service.EstimatePointService; +import com.hnac.hzims.safeproduct.risk.service.HazardLevelService; +import com.hnac.hzims.vo.SafeCheckStatisticVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class EstimatePointServiceImpl extends BaseServiceImpl implements EstimatePointService { + +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java new file mode 100644 index 0000000..5494200 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java @@ -0,0 +1,166 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.constants.HazardRiskConstants; +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimate; +import com.hnac.hzims.safeproduct.risk.entity.RiskEstimatePoint; +import com.hnac.hzims.safeproduct.risk.mapper.EstimateMapper; +import com.hnac.hzims.safeproduct.risk.service.EstimatePointService; +import com.hnac.hzims.safeproduct.risk.service.EstimateService; +import com.hnac.hzims.safeproduct.risk.service.HazardCategoryService; +import com.hnac.hzims.safeproduct.risk.service.HazardLevelService; +import com.hnac.hzims.safeproduct.risk.vo.CategorySourceVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class EstimateServiceImpl extends BaseServiceImpl implements EstimateService { + + private final HazardLevelService levelService; + + private final EstimatePointService pointService; + + private final HazardCategoryService categoryService; + + /** + * 风险评估 + * @param entity + * @return + */ + @Override + public boolean saveEstimate(RiskEstimate entity) { + // 检查站点年度评估任务是否存在 + int count = this.count(Wrappers.lambdaQuery() + .eq(RiskEstimate::getStationCode,entity.getStationCode()) + .eq(RiskEstimate::getEstimateYear,entity.getEstimateYear())); + if(count > 0){ + throw new ServiceException("[" + entity.getStationName() + "],在" + entity.getEstimateYear() + "年度已经存在风险评估记录!"); + } + + // 站点年度评估保存 + this.save(entity); + + // 站点类型评估危险源绑定 + List sources = categoryService.sourcesByCategory(entity.getStationType()); + + // 批量评估危险源 + return pointService.saveBatch(sources.stream().map(source->{ + RiskEstimatePoint point = new RiskEstimatePoint(); + point.setEstimateId(entity.getId()); + point.setCategory(source.getCategory()); + point.setPerilPoint(source.getPerilPoint()); + point.setCategoryId(source.getCategoryId()); + point.setSourceId(source.getId()); + point.setHazardName(source.getHazardName()); + point.setAccidentIncentive(source.getAccidentIncentive()); + point.setCauseConsequence(source.getCauseConsequence()); + point.setEvaluationMethod(source.getEvaluationMethod()); + point.setLUpLimit(source.getLUpLimit()); + point.setLDownLimit(source.getLDownLimit()); + point.setEUpLimit(source.getEUpLimit()); + point.setEDownLimit(source.getLDownLimit()); + point.setCSUpLimit(source.getCSUpLimit()); + point.setCSDownLimit(source.getCSDownLimit()); + return point; + }).collect(Collectors.toList())); + } + + /** + * 危险源评估 + * @param point + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean execute(RiskEstimatePoint point) { + // 计算R/D值 + double rdValue = this.rdValue(point); + point.setRDValue(rdValue); + // 评估等级 + HazardLevel level = this.evaluation(point.getSourceId(),rdValue); + if(!ObjectUtil.isEmpty(level) && !ObjectUtil.isEmpty(level.getId())){ + point.setLevel(level.getRiskLevel()); + point.setLevelId(level.getId()); + point.setLevelDesc(Optional.ofNullable(level.getRisk()).map(dict-> DictCache.getValue("hazard_level", Math.toIntExact(dict))).orElse("R/D值评级范围未制定")); + }else{ + if(rdValue < 70){ + point.setLevel(1); + }else if(rdValue > 70 && rdValue < 160){ + point.setLevel(2); + }else if(rdValue > 160 && rdValue < 320){ + point.setLevel(3); + }else{ + point.setLevel(4); + } + point.setLevelDesc(Optional.ofNullable(point.getLevel()).map(dict-> DictCache.getValue("hazard_level", Math.toIntExact(dict))).orElse("R/D值评级范围未制定")); + } + // 同步评估数据 + point.setStatus(2); + pointService.saveOrUpdate(point); + + // 异步修改任务评估状态 + CompletableFuture.supplyAsync(() -> this.syncEstimteStatus(point.getEstimateId())); + return true; + } + + /** + * R/D 值计算 + * @param point + */ + private double rdValue(RiskEstimatePoint point) { + if(HazardRiskConstants.LS.equals(point.getEvaluationMethod())){ + return point.getLValue() * point.getCSValue(); + } + return point.getLValue() * point.getEValue() * point.getCSValue(); + } + + /** + * 风险等级评估 + * @param sourceId + * @param rDValue + * @return + */ + private HazardLevel evaluation(Long sourceId, double rDValue) { + HazardLevel confirm = levelService.getOne(Wrappers.lambdaQuery() + .eq(HazardLevel::getSourceId,sourceId) + .gt(HazardLevel::getRMaxValue,rDValue) + .lt(HazardLevel::getRMinValue,rDValue) + ); + if(ObjectUtil.isNotEmpty(confirm)){ + return confirm; + } + return new HazardLevel(); + } + + private Boolean syncEstimteStatus(Long estimateId) { + List points = pointService.list(Wrappers.lambdaQuery() + .eq(RiskEstimatePoint::getEstimateId,estimateId) + .eq(RiskEstimatePoint::getStatus,1)); + if(CollectionUtil.isEmpty(points)){ + return this.update(Wrappers.lambdaUpdate() + .set(RiskEstimate::getStatus, 3) + .eq(RiskEstimate::getId,estimateId)); + } + return this.update(Wrappers.lambdaUpdate() + .set(RiskEstimate::getStatus, 2) + .eq(RiskEstimate::getId,estimateId)); + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java new file mode 100644 index 0000000..d2d271c --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java @@ -0,0 +1,153 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.mapper.HazardCategoryMapper; +import com.hnac.hzims.safeproduct.risk.service.HazardCategoryService; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.vo.CategorySourceVo; +import com.hnac.hzims.safeproduct.risk.vo.HazardDetailsVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class HazardCategoryServiceImpl extends BaseServiceImpl implements HazardCategoryService { + + private final HazardSourceService sourceService; + + /** + * 保存类别及详情 + * @param entity + * @return + */ + @Override + public boolean saveDetail(HazardDetailsVo entity) { + // 危险源检查 + if(CollectionUtil.isEmpty(entity.getSources())){ + throw new ServiceException("请添加危险点对应危险源信息!"); + } + // 查询项目是否存在 + HazardCategory category = this.getOne(Wrappers.lambdaQuery() + .eq(HazardCategory::getStationType,entity.getStationType()) + .eq(HazardCategory::getCategory,entity.getCategory()) + .eq(HazardCategory::getPerilPoint,entity.getPerilPoint()) + ); + if(ObjectUtil.isEmpty(category)){ + // 保存风险点记录 + this.save(entity); + // 保存危险源 + return sourceService.saveBatch(entity.getSources().stream().peek(source-> source.setCategoryId(entity.getId())).collect(Collectors.toList())); + } + // 保存危险源 + return sourceService.saveBatch(entity.getSources().stream().peek(source-> source.setCategoryId(category.getId())).collect(Collectors.toList())); + } + + /** + * 修改 + * @param entity + * @return + */ + @Override + public boolean updateDetail(HazardDetailsVo entity) { + // 危险源检查 + if(CollectionUtil.isEmpty(entity.getSources())){ + throw new ServiceException("请添加危险点对应危险源信息!"); + } + // 查询项目是否存在 + HazardCategory category = this.getOne(Wrappers.lambdaQuery() + .eq(HazardCategory::getStationType,entity.getStationType()) + .eq(HazardCategory::getCategory,entity.getCategory()) + .eq(HazardCategory::getPerilPoint,entity.getPerilPoint()) + .ne(HazardCategory::getId,entity.getId()) + ); + if(ObjectUtil.isNotEmpty(category)){ + throw new ServiceException("站点类型的对应类别已经存在该危险点,请重新填写危险点!"); + } + // 保存危险类别记录 + this.updateById(entity); + // 保存详情 + return sourceService.updateBatchById(entity.getSources().stream().peek(source-> source.setCategoryId(entity.getId())).collect(Collectors.toList())); + } + + /** + * 根据风险点ID查询危险源列表 + * @param categoryId + * @return + */ + @Override + public HazardDetailsVo details(Long categoryId) { + HazardCategory category = this.getById(categoryId); + if(ObjectUtil.isEmpty(category)){ + throw new ServiceException("未查询风险点详情数据!"); + } + HazardDetailsVo details = new HazardDetailsVo(); + BeanUtil.copyProperties(category,details); + List sources = sourceService.list(Wrappers.lambdaQuery() + .eq(HazardSource::getCategoryId,categoryId)); + if(CollectionUtil.isEmpty(sources)){ + throw new ServiceException("未查询危险源详情数据!"); + } + details.setSources(sources); + return details; + } + + /** + * 删除 + * @param ids + * @return + */ + @Override + public boolean removeDetail(List ids) { + if(CollectionUtil.isEmpty(ids)){ + throw new ServiceException("请选择需要删除的危险点记录,再进行删除!"); + } + // 删除风险点 && 危险源记录 + return super.deleteLogic(ids) && sourceService.remove(Wrappers.lambdaQuery() + .in(HazardSource::getCategoryId,ids)); + } + + /** + * 是否存在危险源 + * @param hazardName : 危险源名称 + * @return + */ + @Override + public boolean isExist(Long stationType,Long category,String perilPoint,String hazardName) { + HazardCategory entity = this.getOne(Wrappers.lambdaQuery() + .eq(HazardCategory::getStationType,stationType) + .eq(HazardCategory::getCategory,category) + .eq(HazardCategory::getPerilPoint,perilPoint)); + if(ObjectUtil.isEmpty(entity)){ + return sourceService.count(Wrappers.lambdaQuery() + .eq(HazardSource::getHazardName,hazardName)) == 0; + } + return sourceService.count(Wrappers.lambdaQuery() + .eq(HazardSource::getHazardName,hazardName) + .eq(HazardSource::getCategoryId,entity.getId())) == 0; + } + + /** + * 根据站点类型获取危险源数据 + * @return + */ + @Override + public List sourcesByCategory(Integer stationType) { + return this.baseMapper.sourcesByCategory(stationType); + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardEstimateServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardEstimateServiceImpl.java new file mode 100644 index 0000000..10aaba6 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardEstimateServiceImpl.java @@ -0,0 +1,124 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.constants.HazardRiskConstants; +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import com.hnac.hzims.safeproduct.risk.mapper.HazardEstimateMapper; +import com.hnac.hzims.safeproduct.risk.service.HazardEstimateService; +import com.hnac.hzims.safeproduct.risk.service.HazardLevelService; +import com.hnac.hzims.safeproduct.risk.vo.ExportEstimateVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class HazardEstimateServiceImpl extends BaseServiceImpl implements HazardEstimateService { + + private final HazardLevelService levelService; + + /** + * 风险等级评估 + * @param estimates + */ + @Override + public List evaluationLevel(List estimates) { + if(CollectionUtil.isEmpty(estimates)){ + return estimates; + } + estimates.forEach(estimate->{ + double rDValue = 0; + if(HazardRiskConstants.LS.equals(estimate.getEvaluationMethod())){ + rDValue = this.LS(estimate.getLValue(),estimate.getCSValue()); + }else if(HazardRiskConstants.LEC.equals(estimate.getEvaluationMethod())){ + rDValue = this.LEC(estimate.getLValue(),estimate.getEValue(),estimate.getCSValue()); + } + if(rDValue <= 0){ + return; + } + // R/D值赋值 + estimate.setRDValue(rDValue); + // 风险等级 + HazardLevel level = this.evaluation(estimate.getSourceId(),rDValue); + estimate.setLevel(level.getRiskLevel()); + estimate.setLevelId(level.getId()); + estimate.setLevelDesc(Optional.ofNullable(level.getRisk()).map(dict->DictCache.getValue("hazard_level", Math.toIntExact(dict))).orElse("R/D值评级范围未制定")); + }); + if (super.updateBatchById(estimates)){ + return estimates; + } + return new ArrayList<>(); + } + + /** + * 站点任务评估记录导出 + * @param taskId + * @return + */ + @Override + public List exportEstimate(Long taskId) { + return this.baseMapper.exprotEstimate(taskId); + } + + /** + * L * S 计算R/D值 + * @return + */ + private double LS(Double lValue, Double csValue) { + if(ObjectUtil.isEmpty(lValue) || ObjectUtil.isEmpty(csValue)){ + return -1.0; + } + if(lValue <= 0 || csValue <= 0 ){ + return -1.0; + } + return lValue * csValue; + } + + /** + * L * E * C计算R/D值 + * @return + */ + private double LEC(Double lValue,Double eValue, Double csValue) { + if(ObjectUtil.isEmpty(lValue) || ObjectUtil.isEmpty(eValue) || ObjectUtil.isEmpty(csValue)){ + return -1.0; + } + if(lValue <= 0 || eValue <= 0 || csValue <= 0){ + return -1.0; + } + return lValue * eValue * csValue; + } + + /** + * 风险等级评估 + * @param sourceId + * @param rDValue + * @return + */ + private HazardLevel evaluation(Long sourceId, double rDValue) { + HazardLevel confirm = levelService.getOne(Wrappers.lambdaQuery() + .eq(HazardLevel::getSourceId,sourceId) + .gt(HazardLevel::getRMaxValue,rDValue) + .lt(HazardLevel::getRMinValue,rDValue) + ); + if(ObjectUtil.isNotEmpty(confirm)){ + return confirm; + } + HazardLevel level = new HazardLevel(); + level.setRiskLevel(-1); + return level; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardLevelServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardLevelServiceImpl.java new file mode 100644 index 0000000..dc5a50d --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardLevelServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.hnac.hzims.safeproduct.risk.entity.HazardLevel; +import com.hnac.hzims.safeproduct.risk.mapper.HazardLevelMapper; +import com.hnac.hzims.safeproduct.risk.service.HazardLevelService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class HazardLevelServiceImpl extends BaseServiceImpl implements HazardLevelService { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardSourceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardSourceServiceImpl.java new file mode 100644 index 0000000..604c2e3 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardSourceServiceImpl.java @@ -0,0 +1,91 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.safeproduct.risk.dto.HazardSourceDTO; +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.mapper.CorrelationMapper; +import com.hnac.hzims.safeproduct.risk.mapper.HazardSourceMapper; +import com.hnac.hzims.safeproduct.risk.service.CorrelationService; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.vo.SourceVo; +import com.hnac.hzims.safeproduct.risk.wrapper.HazardSourceWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class HazardSourceServiceImpl extends BaseServiceImpl implements HazardSourceService { + + + private final CorrelationMapper correlationMapper; + + /** + * 分页查询 + * @param entity + * @param page + * @return + */ + @Override + public IPage pageCondition(SourceVo entity, IPage page) { + if(ObjectUtil.isNotEmpty(entity.getWorkId())){ + List correlations = correlationMapper.selectList(Wrappers.lambdaQuery() + .eq(Correlation::getWorkId,entity.getWorkId())); + entity.setSourceIds(correlations.stream().map(Correlation::getSourceId).collect(Collectors.toList())); + } + IPage sourceVoIPage = this.baseMapper.pageCondition(page,entity); + sourceVoIPage.getRecords().forEach( + record -> record.setCategoryName(Optional.ofNullable(record.getCategory()) + .map(dictKey -> DictCache.getValue("hazard_type", Math.toIntExact(dictKey))).orElse(null)) + ); + return sourceVoIPage; + } + + /** + * 风险点列表查询 + * @param sourceDTO 查询条件 + * @return 危险源VO列表 + */ + @Override + public List list(HazardSourceDTO sourceDTO) { + LambdaQueryWrapper wrapper = Condition.getQueryWrapper(BeanUtil.copy(sourceDTO, HazardSource.class), HazardSource.class); + List hazardSources = this.list(wrapper); + return HazardSourceWrapper.build().listVO(hazardSources); + } + + + + @Override + public IPage page(HazardSourceDTO req, Query query) { + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(HazardSource.class,BeanUtil.copy(req, HazardSource.class)); + IPage sourceVoIPage = this.baseMapper.selectPageOverride(org.springblade.core.mp.support.Condition.getPage(query), queryWrapper); + sourceVoIPage.getRecords().forEach( + record -> { + record.setCategoryName(Optional.ofNullable(record.getCategory()) + .map(dictKey -> DictCache.getValue("hazard_type",dictKey)).orElse(null)); + record.setEstimateMethodName(Optional.ofNullable(record.getEstimateMethod()) + .map(dictKey -> DictCache.getValue("evaluate_method",dictKey)).orElse(null)); + } + ); + return sourceVoIPage; + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java new file mode 100644 index 0000000..351f569 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java @@ -0,0 +1,377 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import com.hnac.hzims.safeproduct.flow.service.IInnerDangerFlowService; +import com.hnac.hzims.safeproduct.risk.constants.HazardRiskConstants; +import com.hnac.hzims.safeproduct.risk.dto.HazardRiskProcessDTO; +import com.hnac.hzims.safeproduct.risk.entity.*; +import com.hnac.hzims.safeproduct.risk.mapper.HazardTaskMapper; +import com.hnac.hzims.safeproduct.risk.service.*; +import com.hnac.hzims.safeproduct.risk.vo.*; +import com.hnac.hzims.safeproduct.statistic.vo.RiskInnerVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.*; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.flow.core.utils.FlowUtil; +import org.springblade.flow.core.utils.TaskUtil; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Slf4j +@AllArgsConstructor +@Service +public class HazardTaskServiceImpl extends BaseServiceImpl implements HazardTaskService { + + private final HazardWorkService workService; + + private final EstimateService estimateService; + + private final EstimatePointService pointService; + + private final HazardSourceService sourceService; + + private final HazardEstimateService hazardEstimateService; + + private final CorrelationService correlationService; + + private final IInnerDangerFlowService innerDangerFlowService; + + private final IFlowClient flowClient; + + /** + * 风险排查流程开启 + * @param process + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean startProcess(HazardRiskProcessDTO process) { + // 查询作业区域是否存在任务流程 + HazardTask task = this.getOne(Wrappers.lambdaQuery() + .eq(HazardTask::getWorkId,process.getWorkId()) + .ne(HazardTask::getProcessSteps, HazardRiskConstants.END)); + if(ObjectUtil.isNotEmpty(task)){ + throw new ServiceException("作业区域正在排查任务中,请等待任务完成,再重新对作业区域发起排查任务!"); + } + // 查询作业区域记录 + HazardWork hazardWork = workService.getOne(Wrappers.lambdaQuery() + .eq(HazardWork::getId,process.getWorkId())); + if(ObjectUtil.isEmpty(hazardWork)){ + throw new ServiceException("作业区域不存在,请检查作业区域是否存在!"); + } + // 查询作业区域绑定危险源 + List correlations = correlationService.list(Wrappers.lambdaQuery() + .eq(Correlation::getWorkId,process.getWorkId())); + if(CollectionUtil.isEmpty(correlations)){ + throw new ServiceException("作业区域未绑定危险源,请给作业区域绑定危险源数据!"); + } + // 查询危险源 + List sources = sourceService.listByIds(correlations.stream().map(Correlation::getSourceId).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(sources)){ + throw new ServiceException("作业区域绑定危险源数据已失效,请重新为作业区域绑定危险源数据!"); + } + process.setHead(hazardWork.getHead()); + process.setActStartTime(new Date()); + process.setStationCode(hazardWork.getStationCode()); + process.setStationName(hazardWork.getStationName()); + + // 保存任务 + super.save(process); + + // 生成风险评估记录 + process.setEstimates(sources.stream().map(source->{ + HazardEstimateVo estimate = new HazardEstimateVo(); + estimate.setCategoryId(source.getCategoryId()); + estimate.setTaskId(process.getId()); + estimate.setSourceId(source.getId()); + estimate.setHazardName(source.getHazardName()); + estimate.setAccidentIncentive(source.getAccidentIncentive()); + estimate.setCauseConsequence(source.getCauseConsequence()); + estimate.setEvaluationMethod(source.getEvaluationMethod()); + estimate.setLUpLimit(source.getLUpLimit()); + estimate.setLDownLimit(source.getLDownLimit()); + estimate.setEUpLimit(source.getEUpLimit()); + estimate.setEDownLimit(source.getLDownLimit()); + estimate.setCSUpLimit(source.getCSUpLimit()); + estimate.setCSDownLimit(source.getCSDownLimit()); + return estimate; + }).collect(Collectors.toList())); + hazardEstimateService.saveBatch(process.getEstimates()); + + // 发起流程 + this.start(process); + return true; + } + + + /** + * 流程发起 + * @param process + * @return + */ + private void start(HazardRiskProcessDTO process) { + // 查询作业区域负责人 + Map variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(process, DateUtil.PATTERN_DATETIME), Map.class); + variables.put(HazardRiskConstants.TROUBLE, TaskUtil.getTaskUser(String.valueOf(process.getHead()))); + R result = flowClient.startProcessInstanceContainNameByKey(HazardRiskConstants.HAZARD_RISK_KEY, FlowUtil.getBusinessKey(HazardRiskConstants.HAZARD_RISK_KEY,String.valueOf(process.getId())), process.getTaskName(), variables); + log.error("start_process_planV4 :{}",result); + // 更新任务流程Id + if (result.isSuccess()) { + BladeFlow flow = result.getData(); + process.setProcessInstanceId(flow.getProcessInstanceId()); + this.updateById(process); + } else { + throw new ServiceException("开启检修计划流程失败,code=" + result.getCode()); + } + } + + /** + * 风险排查流程监听 + * @param processWorkFlowResponse + * @return + */ + @Override + public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { + // 流程参数获取 + Map variables = (Map) processWorkFlowResponse.getVariables(); + // 对象转换 + HazardRiskProcessDTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference(){}); + try{ + // 当前流程名称 + entity.setProcessSteps(processWorkFlowResponse.getTaskName()); + // 流程阶段执行人员名称 + entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator()); + Boolean examine = (Boolean) variables.get(HazardRiskConstants.EXAMINE); + Boolean review = (Boolean) variables.get(HazardRiskConstants.REVIEW); + if(examine || review){ + // 当前流程名称 + entity.setProcessSteps("流程结束"); + // 流程阶段执行人员名称 + entity.setNextStepOperator("流程结束,无需人员处理"); + } + // 更新风险排查任务信息 + this.updateById(entity); + if(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY_1.equals(variables.get(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY)) || + HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY_3.equals(variables.get(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY))){ + // 更新排查情况、等级评估 + List estimates = this.hazardEstimateService.evaluationLevel(entity.getEstimates()); + // 风险评估变量值流程穿插 + variables.put("estimates",estimates.stream().filter(o->HazardRiskConstants.SIGNIFICANT_RISK.equals(o.getLevel())).collect(Collectors.toList())); + return this.updateVariables(processWorkFlowResponse,variables); + } + }catch (Exception ex){ + log.error("hazard_risk_listener_error : {}",ex.getMessage()); + return false; + } + return true; + } + + /** + * 风险评估变量值流程穿插 + * @param processWorkFlowResponse + * @param variables + */ + private boolean updateVariables(ProcessWorkFlowResponse processWorkFlowResponse, Map variables) { + R result = flowClient.updateVariablesTaskId(processWorkFlowResponse.getTaskId(),variables); + if(result.isSuccess()){ + return result.getData(); + } + return false; + } + + /** + * 任务列表查询 + * @param entity + * @param page + * @return + */ + @Override + public IPage pageCondition(HazardTaskVo entity, IPage page) { + return this.baseMapper.pageCondition(page,entity); + } + + /** + * 风险排查任务详情 + * @param taskId + * @return + */ + @Override + public HazardTaskVo details(Long taskId) { + // 查询任务 + HazardTask hazardTask = this.getById(taskId); + if(ObjectUtil.isEmpty(hazardTask)){ + throw new ServiceException("未查询到排查任务详情数据!"); + } + // 字段拷贝 + HazardTaskVo task = BeanUtil.copyProperties(hazardTask,HazardTaskVo.class); + // 危险源评估记录 + task.setEstimates(hazardEstimateService.list(Wrappers.lambdaQuery() + .eq(HazardEstimate::getTaskId,taskId))); + return task; + } + + /** + * 查询站点风险等级 + * @return + */ + @Override + public List stationRiskLevel() { + return this.baseMapper.stationRiskLevel(); + } + + /** + * 站点最新评估报告导出 + * @param stationCode + * @return + */ + @Override + public StationEstimateVo exportEstimate(Long estimateId,String stationCode,Long taskId) { + if(StringUtil.isEmpty(stationCode) && ObjectUtil.isEmpty(taskId) && ObjectUtil.isEmpty(estimateId)){ + return new StationEstimateVo(); + } + // 风险评估预览 + if(!ObjectUtil.isEmpty(estimateId)){ + return this.estimate(estimateId); + } + // 站点、风险排查任务预览 + if(!StringUtil.isEmpty(stationCode)){ + List tasks = this.list(Wrappers.lambdaQuery() + .eq(HazardTask::getStationCode,stationCode) + .orderByDesc(HazardTask::getCreateTime) + ); + if(CollectionUtil.isEmpty(tasks)){ + return new StationEstimateVo(); + } + taskId = tasks.get(0).getId(); + } + if(ObjectUtil.isEmpty(taskId)){ + return new StationEstimateVo(); + } + + // 查询任务对应评价数据 + List exportEstimates = hazardEstimateService.exportEstimate(taskId); + if(CollectionUtil.isEmpty(exportEstimates)){ + return new StationEstimateVo(); + } + StationEstimateVo stationEstimate = new StationEstimateVo(); + stationEstimate.setYear(DateUtil.format(exportEstimates.get(0).getCreateTime(),"YYYY")); + stationEstimate.setStationCode(exportEstimates.get(0).getStationCode()); + stationEstimate.setStationName(exportEstimates.get(0).getStationName()); + stationEstimate.setExportEstimates(exportEstimates.stream().peek(estimate->{ + estimate.setMethodName(Optional.ofNullable(estimate.getEvaluationMethod()) + .map(o->DictCache.getValue("evaluate_method",o)).orElse(null)); + estimate.setLevelName(Optional.ofNullable(estimate.getLevel()) + .map(o->DictCache.getValue("hazard_level",o)).orElse(null)); + estimate.setCategoryName(Optional.ofNullable(estimate.getCategory()) + .map(o->DictCache.getValue("hazard_type",o)).orElse(null)); + }).sorted(Comparator.comparing(ExportEstimateVo::getPerilPoint).thenComparing(ExportEstimateVo::getCategory)).collect(Collectors.toList())); + return stationEstimate; + } + + /** + * 风险评估清单 + * @param estimateId + * @return + */ + private StationEstimateVo estimate(Long estimateId) { + // 评估记录 + RiskEstimate estimate = estimateService.getById(estimateId); + if(ObjectUtil.isEmpty(estimate)){ + return new StationEstimateVo(); + } + // 风险评估清单 + List points = pointService.list(Wrappers.lambdaQuery(). + eq(RiskEstimatePoint::getEstimateId,estimateId)); + if(CollectionUtil.isEmpty(points)){ + return new StationEstimateVo(); + } + StationEstimateVo stationEstimate = new StationEstimateVo(); + stationEstimate.setYear(DateUtil.format(estimate.getCreateTime(),"YYYY")); + stationEstimate.setStationCode(estimate.getStationCode()); + stationEstimate.setStationName(estimate.getStationName()); + stationEstimate.setExportEstimates(points.stream().map(point->{ + ExportEstimateVo export = new ExportEstimateVo(); + export.setCategory(point.getCategory()); + export.setCategoryName(Optional.ofNullable(export.getCategory()) + .map(o->DictCache.getValue("hazard_type",o)).orElse(null)); + export.setPerilPointId(point.getCategoryId()); + export.setPerilPoint(point.getPerilPoint()); + export.setSourceId(point.getSourceId()); + export.setHazardName(point.getHazardName()); + export.setAccidentIncentive(point.getAccidentIncentive()); + export.setCauseConsequence(point.getCauseConsequence()); + export.setEvaluationMethod(point.getEvaluationMethod()); + export.setMethodName(Optional.ofNullable(export.getEvaluationMethod()) + .map(o->DictCache.getValue("evaluate_method",o)).orElse(null)); + export.setL(point.getLValue()); + export.setE(point.getEValue()); + export.setS(point.getCSValue()); + export.setR(point.getRDValue()); + export.setLevel(point.getLevel()); + export.setLevelName(Optional.ofNullable(point.getLevel()) + .map(o->DictCache.getValue("hazard_level",o)).orElse(null)); + export.setCreateTime(point.getCreateTime()); + return export; + }).sorted(Comparator.comparing(ExportEstimateVo::getPerilPoint).thenComparing(ExportEstimateVo::getCategory)).collect(Collectors.toList())); + return stationEstimate; + } + + /** + * 电站风险/隐患统计 + * @param stationCode + * @return + */ + @Override + public RiskInnerVO stationRiskInner(String stationCode) { + RiskInnerVO riskInner = new RiskInnerVO(); + + // 风险 + StationEstimateVo estimate = this.exportEstimate(null,stationCode,null); + if(ObjectUtil.isEmpty(estimate)){ + riskInner.setRiskLevel(1); + riskInner.setRiskCount(0); + }else{ + if(CollectionUtil.isEmpty(estimate.getExportEstimates())){ + riskInner.setRiskLevel(1); + riskInner.setRiskCount(0); + }else{ + riskInner.setRiskLevel(estimate.getExportEstimates().stream().max(Comparator.comparing(ExportEstimateVo::getLevel)).get().getLevel()); + riskInner.setRiskCount(estimate.getExportEstimates().size()); + } + } + + // 站点隐患个数 + Calendar calendar = Calendar.getInstance(); + String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH)); + calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); + calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); + calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); + String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); + List inners = innerDangerFlowService.getListByDeptAndDate(startTime,endTime,stationCode); + if(CollectionUtil.isEmpty(inners)){ + riskInner.setInnerCount(0); + }else{ + riskInner.setInnerCount(inners.size()); + } + return riskInner; + } +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java new file mode 100644 index 0000000..f013a4f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java @@ -0,0 +1,82 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.safeproduct.risk.entity.Correlation; +import com.hnac.hzims.safeproduct.risk.entity.HazardCategory; +import com.hnac.hzims.safeproduct.risk.entity.HazardSource; +import com.hnac.hzims.safeproduct.risk.entity.HazardWork; +import com.hnac.hzims.safeproduct.risk.mapper.HazardWorkMapper; +import com.hnac.hzims.safeproduct.risk.service.CorrelationService; +import com.hnac.hzims.safeproduct.risk.service.HazardCategoryService; +import com.hnac.hzims.safeproduct.risk.service.HazardSourceService; +import com.hnac.hzims.safeproduct.risk.service.HazardWorkService; +import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class HazardWorkServiceImpl extends BaseServiceImpl implements HazardWorkService { + + private final CorrelationService correlationService; + private final HazardSourceService hazardSourceService; + private final HazardCategoryService hazardCategoryService; + + /** + * 作业区域删除 + * @param workIds + * @return + */ + @Override + public boolean deleteBacth(List workIds) { + if(CollectionUtil.isEmpty(workIds)){ + throw new ServiceException("请勾选作业区域,再进行删除!"); + } + // 删除作业区域记录 && 关联危险源记录 + return super.deleteLogic(workIds) && + correlationService.remove(Wrappers.lambdaQuery().in(Correlation::getWorkId,workIds)); + } + + /** + * 根据负责人ID获取对应区域下的风险排查项(风险源) + * @param userId 负责人ID + * @return 负责人隐患排查项列表 + */ + @Override + public List getCheckItemByDutyPerson(Long userId,Long categoryId) { + List hazardWorkList = this.list(Wrappers.lambdaQuery().eq(HazardWork::getManage, userId)); + return hazardWorkList.stream().flatMap(hazardWork -> { + List correlations = correlationService.list(Wrappers.lambdaQuery() + .eq(Correlation::getWorkId, hazardWork.getId()) + .eq(Correlation::getCategoryId,categoryId) + ); + return correlations.stream().map(correlation -> { + HazardSource hazardSource = hazardSourceService.getById(correlation.getSourceId()); + PersonalCheckItemVO checkItem = BeanUtil.copy(hazardSource, PersonalCheckItemVO.class); + checkItem.setCategoryName(Optional.ofNullable(hazardCategoryService.getById(hazardSource.getCategoryId())).map(HazardCategory::getPerilPoint).orElse(null)); + checkItem.setHazardId(hazardSource.getId()); + checkItem.setAreaName(hazardWork.getRegionName()); + checkItem.setAreaId(hazardWork.getId()); + checkItem.setUserId(userId); + checkItem.setUserName(Optional.ofNullable(userId).map(UserCache::getUser).map(User::getName).orElse(null)); + return checkItem; + }); + }).collect(Collectors.toList()); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/RiskCheckServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/RiskCheckServiceImpl.java new file mode 100644 index 0000000..b333425 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/RiskCheckServiceImpl.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.safeproduct.risk.service.impl; + +import com.hnac.hzims.safeproduct.risk.entity.RiskCheckEntity; +import com.hnac.hzims.safeproduct.risk.mapper.RiskCheckMapper; +import com.hnac.hzims.safeproduct.risk.service.IRiskCheckService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @ClassName RiskCheckServiceImpl + * @description: + * @author: hx + * @create: 2023-09-19 09:34 + * @Version 4.0 + **/ +@Slf4j +@AllArgsConstructor +@Service +public class RiskCheckServiceImpl extends BaseServiceImpl implements IRiskCheckService { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/ControlLevelController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/ControlLevelController.java new file mode 100644 index 0000000..52c6107 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/ControlLevelController.java @@ -0,0 +1,68 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.ControlLevel; +import com.hnac.hzims.safeproduct.riskhazards.service.IControlLevelService; +import com.hnac.hzims.safeproduct.riskhazards.vo.ControlLevelQueryVo; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 管控级别定义表 前端控制器 + *

+ * + * @author zhaiqm + * @since 2023-09-13 + */ +@RestController +@RequestMapping("/controllevel") +public class ControlLevelController { + @Autowired + IControlLevelService controlLevelService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + ControlLevelQueryVo controlLevelQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = controlLevelService.selectPage(pageParam, controlLevelQueryVo); + return R.data(resultParams); + } + + /** + * 新增管控级别 + */ + @PostMapping("/save") + public R save(@RequestBody ControlLevel controlLevel) { + controlLevelService.save(controlLevel); + return R.success("新增成功"); + } + + + /** + * 更新管控级别 + */ + @PutMapping("/update") + public R update(@RequestBody ControlLevel controlLevel) { + controlLevelService.updateById(controlLevel); + return R.success("修改成功"); + } + + + /** + * 删除管控级别 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + controlLevelService.removeById(id); + return R.success("删除成功"); + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/DangerSourceInfoController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/DangerSourceInfoController.java new file mode 100644 index 0000000..029f898 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/DangerSourceInfoController.java @@ -0,0 +1,68 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.hnac.hzims.safeproduct.riskhazards.service.IDangerSourceInfoService; +import com.hnac.hzims.safeproduct.riskhazards.vo.DangerSourceInfoQueryVo; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 危险源信息 前端控制器 + *

+ * + * @author zhaiqm + * @since 2023-09-15 + */ +@RestController +@RequestMapping("/dangersourceinfo") +public class DangerSourceInfoController { + @Autowired + IDangerSourceInfoService dangerSourceInfoService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + DangerSourceInfoQueryVo dangerSourceInfoQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = dangerSourceInfoService.selectPage(pageParam, dangerSourceInfoQueryVo); + return R.data(resultParams); + } + + /** + * 新增危险源信息 + */ + @PostMapping("/save") + public R save(@RequestBody DangerSourceInfo dangerSourceInfo) { + dangerSourceInfoService.save(dangerSourceInfo); + return R.success("新增成功"); + } + + + /** + * 更新危险源信息 + */ + @PutMapping("/update") + public R update(@RequestBody DangerSourceInfo dangerSourceInfo) { + dangerSourceInfoService.updateById(dangerSourceInfo); + return R.success("修改成功"); + } + + + /** + * 删除危险源信息 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + dangerSourceInfoService.removeById(id); + return R.success("删除成功"); + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/HiddenDangerController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/HiddenDangerController.java new file mode 100644 index 0000000..681a903 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/HiddenDangerController.java @@ -0,0 +1,61 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.riskhazards.service.HiddenDangerService; +import com.hnac.hzims.safeproduct.riskhazards.vo.HiddenDangerQueryVo; +import lombok.RequiredArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/hiddendanger") +public class HiddenDangerController { + + @Autowired + HiddenDangerService hiddenDangerService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + HiddenDangerQueryVo hiddenDangerQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = hiddenDangerService.selectPage(pageParam, hiddenDangerQueryVo); + return R.data(resultParams); + } + + /** + * 新增不安全行为 + */ + @PostMapping("/save") + public R save(@RequestBody HiddenDanger hiddenDanger) { + hiddenDangerService.save(hiddenDanger); + return R.success("新增成功"); + } + + + /** + * 更新不安全行为 + */ + @PutMapping("/update") + public R update(@RequestBody HiddenDanger hiddenDanger) { + hiddenDangerService.updateById(hiddenDanger); + return R.success("修改成功"); + } + + + /** + * 删除不安全行为 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + hiddenDangerService.removeById(id); + return R.success("删除成功"); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskHazardsScreeningController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskHazardsScreeningController.java new file mode 100644 index 0000000..4cbf99a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskHazardsScreeningController.java @@ -0,0 +1,145 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskHazardsScreeningService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskHazardsScreeningVo; +import com.hnac.hzims.safeproduct.wrapper.RiskHazardsScreeningWrapper; +import io.swagger.annotations.*; +import lombok.AllArgsConstructor; +import org.springblade.common.cache.CacheNames; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import com.hnac.hzims.safeproduct.riskhazards.util.ParamUtil; + +import java.util.List; +import java.util.Map; + +/** + * 风险隐患排查 + */ +@RestController +@RequestMapping("/riskHazardsScreening") +@AllArgsConstructor +@Api(value = "风险隐患排查", tags = "风险隐患排查接口") +public class RiskHazardsScreeningController extends BladeController implements CacheNames { + private final IRiskHazardsScreeningService riskHazardsScreeningService; + + + /** + * 分页 + */ + @GetMapping("/pageList") + @ApiImplicitParams({ + @ApiImplicitParam(name = "project", value = "对象或工程编码 目前已电站编码为主", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "name", value = "建筑物名称", paramType = "query", dataType = "string") + }) + @ApiOperationSupport(order = 1) + @ApiOperation(value = "分页", notes = "传入riskHazardsScreening") + public R> pageList(@ApiIgnore @RequestParam Map param, Query query) { + LambdaQueryWrapper wrapper= ParamUtil.conditionRiskHazardsScreening(param); + IPage pages = riskHazardsScreeningService.page(Condition.getPage(query), wrapper); + return R.data(RiskHazardsScreeningWrapper.build().pageVO(pages)); + } + + /** + * 列表 + */ + @GetMapping("/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "rscd", value = "水库编号", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "name", value = "建筑物名称", paramType = "query", dataType = "string") + }) + @ApiOperationSupport(order = 2) + @ApiOperation(value = "列表", notes = "传入riskHazardsScreening") + public R> list(@ApiIgnore @RequestParam Map param) { + LambdaQueryWrapper wrapper=ParamUtil.conditionRiskHazardsScreening(param); + List list = riskHazardsScreeningService.list(wrapper); + return R.data(RiskHazardsScreeningWrapper.build().listVO(list)); + } + + + /** + * 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "详情", notes = "传入riskHazardsScreening") + public R detail(RiskHazardsScreening riskHazardsScreening) { + RiskHazardsScreening detail = riskHazardsScreeningService.getOne(Condition.getQueryWrapper(riskHazardsScreening)); + return R.data(RiskHazardsScreeningWrapper.build().entityVO(detail)); + } + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "新增", notes = "传入riskHazardsScreening") + public R save(@RequestBody RiskHazardsScreening riskHazardsScreening) { + return R.status(riskHazardsScreeningService.save(riskHazardsScreening)); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "修改", notes = "传入riskHazardsScreening") + public R update(@RequestBody RiskHazardsScreening riskHazardsScreening) { + return R.status(riskHazardsScreeningService.updateById(riskHazardsScreening)); + } + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "逻辑删除", notes = "ids") + public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { + boolean temp = riskHazardsScreeningService.deleteLogic(Func.toLongList(ids)); + return R.status(temp); + } + + //统计每个电站的安全隐患数 + @GetMapping("/countByProject") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "详情", notes = "传入riskHazardsScreening") + public R countByProject(@RequestParam Map param) { + LambdaQueryWrapper wrapper=ParamUtil.conditionRiskHazardsScreening(param); + List> counts=riskHazardsScreeningService.countMap(wrapper); + return R.data(counts); + } + + //分类统计安全隐患数 + @GetMapping("/countByType") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "详情", notes = "传入riskHazardsScreening") + public R countByType(@RequestParam Map param) { + LambdaQueryWrapper wrapper=ParamUtil.conditionRiskHazardsScreening(param); + List> counts=riskHazardsScreeningService.countByType(wrapper); + return R.data(counts); + } + + + //全域隐患总数 + @GetMapping("/count") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "详情", notes = "传入riskHazardsScreening") + public R count() { + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + int counts=riskHazardsScreeningService.count(wrapper); + return R.data(counts); + } + +} + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskMatrixController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskMatrixController.java new file mode 100644 index 0000000..7ebf82f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskMatrixController.java @@ -0,0 +1,164 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskMatrixYService; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskInfo; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixX; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixY; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskInfoService; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskMatrixXService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskInfoQueryVo; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixXQueryVo; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixYQueryVo; +import lombok.RequiredArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 风险矩阵X表 前端控制器 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/riskmatrix") +public class RiskMatrixController { + @Autowired + IRiskMatrixXService riskMatrixXService; + + @Autowired + IRiskMatrixYService riskMatrixYService; + + @Autowired + IRiskInfoService riskInfoService; + + /** + * 分页查询 + */ + @GetMapping("/riskMatrixXPage/{page}/{size}") + public R riskMatrixXPage(@PathVariable Long page, + @PathVariable Long size, + RiskMatrixXQueryVo riskMatrixXQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = riskMatrixXService.selectPage(pageParam, riskMatrixXQueryVo); + return R.data(resultParams); + } + + /** + * 新增风险矩阵X数据 + */ + @PostMapping("/saveRiskMatrixX") + public R saveRiskMatrixX(@RequestBody RiskMatrixX riskMatrixX) { + riskMatrixXService.save(riskMatrixX); + return R.success("新增成功"); + } + + + /** + * 更新风险矩阵X数据 + */ + @PutMapping("/updateRiskMatrixX") + public R updateRiskMatrixX(@RequestBody RiskMatrixX riskMatrixX) { + riskMatrixXService.updateById(riskMatrixX); + return R.success("修改成功"); + } + + + /** + * 删除风险矩阵X数据 + */ + @DeleteMapping("/removeRiskMatrixX/{id}") + public R removeRiskMatrixX(@PathVariable Long id) { + riskMatrixXService.removeById(id); + return R.success("删除成功"); + } + + /** + * 分页查询 + */ + @GetMapping("/riskMatrixYPage/{page}/{size}") + public R riskMatrixYPage(@PathVariable Long page, + @PathVariable Long size, + RiskMatrixYQueryVo riskMatrixYQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = riskMatrixYService.selectPage(pageParam, riskMatrixYQueryVo); + return R.data(resultParams); + } + + /** + * 新增风险矩阵Y数据 + */ + @PostMapping("/saveRiskMatrixY") + public R saveRiskMatrixY(@RequestBody RiskMatrixY riskMatrixY) { + riskMatrixYService.save(riskMatrixY); + return R.success("新增成功"); + } + + + /** + * 更新风险矩阵Y数据 + */ + @PutMapping("/updateRiskMatrixY") + public R updateRiskMatrixY(@RequestBody RiskMatrixY riskMatrixY) { + riskMatrixYService.updateById(riskMatrixY); + return R.success("修改成功"); + } + + + /** + * 删除风险矩阵Y数据 + */ + @DeleteMapping("/removeRiskMatrixY/{id}") + public R removeRiskMatrixY(@PathVariable Long id) { + riskMatrixYService.removeById(id); + return R.success("删除成功"); + } + + /** + * 分页查询 + */ + @GetMapping("/riskInfoPage/{page}/{size}") + public R riskInfoPage(@PathVariable Long page, + @PathVariable Long size, + RiskInfoQueryVo riskInfoQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = riskInfoService.selectPage(pageParam, riskInfoQueryVo); + return R.data(resultParams); + } + + /** + * 新增风险信息数据 + */ + @PostMapping("/saveRiskInfo") + public R saveRiskInfo(@RequestBody RiskInfo riskInfo) { + riskInfoService.save(riskInfo); + return R.success("新增成功"); + } + + + /** + * 更新风险信息数据 + */ + @PutMapping("/updateRiskInfo") + public R updateRiskInfo(@RequestBody RiskInfo riskInfo) { + riskInfoService.updateById(riskInfo); + return R.success("修改成功"); + } + + + /** + * 删除风险信息数据 + */ + @DeleteMapping("/removeRiskInfo/{id}") + public R removeRiskInfo(@PathVariable Long id) { + riskInfoService.removeById(id); + return R.success("删除成功"); + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskPointInfoController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskPointInfoController.java new file mode 100644 index 0000000..cc23b0a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/RiskPointInfoController.java @@ -0,0 +1,69 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskPointInfoService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskPointInfoQueryVo; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 风险点信息表 前端控制器 + *

+ * + * @author zhaiqm + * @since 2023-09-14 + */ +@RestController +@RequestMapping("/riskpointinfo") +public class RiskPointInfoController { + + @Autowired + IRiskPointInfoService riskPointInfoService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + RiskPointInfoQueryVo riskPointInfoQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = riskPointInfoService.selectPage(pageParam, riskPointInfoQueryVo); + return R.data(resultParams); + } + + /** + * 新增风险点信息 + */ + @PostMapping("/save") + public R save(@RequestBody RiskPointInfo riskPointInfo) { + riskPointInfoService.save(riskPointInfo); + return R.success("新增成功"); + } + + + /** + * 更新风险点信息 + */ + @PutMapping("/update") + public R update(@RequestBody RiskPointInfo riskPointInfo) { + riskPointInfoService.updateById(riskPointInfo); + return R.success("修改成功"); + } + + + /** + * 删除风险点信息 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + riskPointInfoService.removeById(id); + return R.success("删除成功"); + } +} + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/WorkAreaController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/WorkAreaController.java new file mode 100644 index 0000000..c2774f3 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/controller/WorkAreaController.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.safeproduct.riskhazards.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.service.WorkAreaService; +import com.hnac.hzims.safeproduct.riskhazards.entity.WorkArea; +import com.hnac.hzims.safeproduct.riskhazards.vo.WorkAreaQueryVo; +import lombok.RequiredArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/workarea") +public class WorkAreaController { + + @Autowired + WorkAreaService workAreaService; + + /** + * 分页查询 + */ + @GetMapping("/listPage/{page}/{size}") + public R listPage(@PathVariable Long page, + @PathVariable Long size, + WorkAreaQueryVo workAreaQueryVo) { + Page pageParam = new Page<>(page, size); + IPage resultParams = + workAreaService.selectPage(pageParam, + workAreaQueryVo); + return R.data(resultParams); + } + + /** + * 新增工作区域数据 + */ + @PostMapping("/save") + public R save(@RequestBody WorkArea workArea) { + workAreaService.saveWorkArea(workArea); + return R.success("新增成功"); + } + + + /** + * 更新工作区域数据 + */ + @PutMapping("/update") + public R update(@RequestBody WorkArea workArea) { + workAreaService.updateWorkArea(workArea); + return R.success("修改成功"); + } + + + /** + * 删除工作区域数据 + */ + @DeleteMapping("/remove/{id}") + public R remove(@PathVariable Long id) { + workAreaService.removeById(id); + return R.success("删除成功"); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/ControlLevelMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/ControlLevelMapper.java new file mode 100644 index 0000000..f6b4a86 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/ControlLevelMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.ControlLevel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 管控级别定义表 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-13 + */ +public interface ControlLevelMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/DangerSourceInfoMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/DangerSourceInfoMapper.java new file mode 100644 index 0000000..2b86550 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/DangerSourceInfoMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 危险源信息 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-15 + */ +public interface DangerSourceInfoMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/HiddenDangerMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/HiddenDangerMapper.java new file mode 100644 index 0000000..9a75971 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/HiddenDangerMapper.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.riskhazards.entity.HiddenDanger; + +public interface HiddenDangerMapper extends BaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.java new file mode 100644 index 0000000..d2a233e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +public interface RiskHazardsScreeningMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.xml new file mode 100644 index 0000000..6490f6b --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskHazardsScreeningMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.java new file mode 100644 index 0000000..e6b668f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 风险信息表 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface RiskInfoMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.xml new file mode 100644 index 0000000..6e53f6e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.java new file mode 100644 index 0000000..050fd0f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixX; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 风险矩阵X表 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface RiskMatrixXMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.xml new file mode 100644 index 0000000..4963cef --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixXMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.java new file mode 100644 index 0000000..9595ec3 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixY; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 风险矩阵Y表 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface RiskMatrixYMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.xml new file mode 100644 index 0000000..b23893a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskMatrixYMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskPointInfoMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskPointInfoMapper.java new file mode 100644 index 0000000..b4bb9aa --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/RiskPointInfoMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 风险点信息表 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-14 + */ +public interface RiskPointInfoMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardNecessaryMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardNecessaryMapper.java new file mode 100644 index 0000000..b3d73ce --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardNecessaryMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.management.entity.SafeStandardNecessary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全标准必要条件 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-16 + */ +public interface SafeStandardNecessaryMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardResultMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardResultMapper.java new file mode 100644 index 0000000..199f49a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/SafeStandardResultMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.hnac.hzims.safeproduct.management.entity.SafeStandardResult; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全标准必要条件结果 Mapper 接口 + *

+ * + * @author zhaiqm + * @since 2023-09-16 + */ +public interface SafeStandardResultMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/WorkAreaMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/WorkAreaMapper.java new file mode 100644 index 0000000..4c93dd9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/WorkAreaMapper.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.safeproduct.riskhazards.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.riskhazards.entity.WorkArea; + +public interface WorkAreaMapper extends BaseMapper { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/ControlLevelMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/ControlLevelMapper.xml new file mode 100644 index 0000000..69696e0 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/ControlLevelMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/DangerSourceInfoMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/DangerSourceInfoMapper.xml new file mode 100644 index 0000000..b3395a5 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/DangerSourceInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/RiskPointInfoMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/RiskPointInfoMapper.xml new file mode 100644 index 0000000..d767114 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/RiskPointInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardNecessaryMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardNecessaryMapper.xml new file mode 100644 index 0000000..554ef75 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardNecessaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardResultMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardResultMapper.xml new file mode 100644 index 0000000..cd32c32 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/mapper/xml/SafeStandardResultMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/HiddenDangerService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/HiddenDangerService.java new file mode 100644 index 0000000..969eb0a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/HiddenDangerService.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.riskhazards.vo.HiddenDangerQueryVo; + +public interface HiddenDangerService extends IService { + + + /** + * 分页查询 + * @param pageParam + * @param hiddenDangerQueryVo + * @return + */ + IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IControlLevelService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IControlLevelService.java new file mode 100644 index 0000000..4507143 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IControlLevelService.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.ControlLevel; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.ControlLevelQueryVo; + +/** + *

+ * 管控级别定义表 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-13 + */ +public interface IControlLevelService extends IService { + + /** + * 分页查询管控级别 + * @param pageParam + * @param controlLevelQueryVo + * @return + */ + IPage selectPage(Page pageParam, ControlLevelQueryVo controlLevelQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IDangerSourceInfoService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IDangerSourceInfoService.java new file mode 100644 index 0000000..4b5ddf2 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IDangerSourceInfoService.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.DangerSourceInfoQueryVo; + +/** + *

+ * 危险源信息 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-15 + */ +public interface IDangerSourceInfoService extends IService { + + /** + * 分页查询危险源信息 + * @param pageParam + * @param dangerSourceInfoQueryVo + * @return + */ + IPage selectPage(Page pageParam, DangerSourceInfoQueryVo dangerSourceInfoQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskHazardsScreeningService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskHazardsScreeningService.java new file mode 100644 index 0000000..ac2b118 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskHazardsScreeningService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; +import java.util.Map; + +public interface IRiskHazardsScreeningService extends BaseService { + List> countMap(LambdaQueryWrapper wrapper); + + List> countByType(LambdaQueryWrapper wrapper); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskInfoService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskInfoService.java new file mode 100644 index 0000000..cfd327a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskInfoService.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskInfoQueryVo; + +/** + *

+ * 风险信息表 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface IRiskInfoService extends IService { + IPage selectPage(Page pageParam, RiskInfoQueryVo riskInfoQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixXService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixXService.java new file mode 100644 index 0000000..cf99c9c --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixXService.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixX; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixXQueryVo; + +/** + *

+ * 风险矩阵X表 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface IRiskMatrixXService extends IService { + + IPage selectPage(Page pageParam, RiskMatrixXQueryVo riskMatrixXQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixYService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixYService.java new file mode 100644 index 0000000..e012848 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskMatrixYService.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixY; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixYQueryVo; + +/** + *

+ * 风险矩阵Y表 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +public interface IRiskMatrixYService extends IService { + IPage selectPage(Page pageParam, RiskMatrixYQueryVo riskMatrixYQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskPointInfoService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskPointInfoService.java new file mode 100644 index 0000000..f02db6d --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/IRiskPointInfoService.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskPointInfoQueryVo; + +/** + *

+ * 风险点信息表 服务类 + *

+ * + * @author zhaiqm + * @since 2023-09-14 + */ +public interface IRiskPointInfoService extends IService { + + /** + * 分页查询风险点信息 + * @param pageParam + * @param riskPointInfoQueryVo + * @return + */ + IPage selectPage(Page pageParam, RiskPointInfoQueryVo riskPointInfoQueryVo); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/WorkAreaService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/WorkAreaService.java new file mode 100644 index 0000000..d14c442 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/WorkAreaService.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.riskhazards.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.riskhazards.entity.WorkArea; +import com.hnac.hzims.safeproduct.riskhazards.vo.WorkAreaQueryVo; + +public interface WorkAreaService extends IService { + + /** + * 分页查询 + * @param pageParam + * @param workAreaQueryVo + * @return + */ + IPage selectPage(Page pageParam, WorkAreaQueryVo workAreaQueryVo); + + void saveWorkArea(WorkArea workArea); + + void updateWorkArea(WorkArea workArea); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/ControlLevelServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/ControlLevelServiceImpl.java new file mode 100644 index 0000000..5530e6a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/ControlLevelServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.entity.ControlLevel; +import com.hnac.hzims.safeproduct.riskhazards.mapper.ControlLevelMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IControlLevelService; +import com.hnac.hzims.safeproduct.riskhazards.vo.ControlLevelQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 管控级别定义表 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-13 + */ +@Service +public class ControlLevelServiceImpl extends ServiceImpl implements IControlLevelService { + + @Override + public IPage selectPage(Page pageParam, ControlLevelQueryVo controlLevelQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage controlLevelIPage = baseMapper.selectPage(pageParam, queryWrapper); + return controlLevelIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/DangerSourceInfoServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/DangerSourceInfoServiceImpl.java new file mode 100644 index 0000000..f5c565e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/DangerSourceInfoServiceImpl.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.hnac.hzims.safeproduct.riskhazards.entity.DangerSourceInfo; +import com.hnac.hzims.safeproduct.riskhazards.mapper.DangerSourceInfoMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IDangerSourceInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.vo.DangerSourceInfoQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 危险源信息 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-15 + */ +@Service +public class DangerSourceInfoServiceImpl extends ServiceImpl implements IDangerSourceInfoService { + + @Override + public IPage selectPage(Page pageParam, DangerSourceInfoQueryVo dangerSourceInfoQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage dangerSourceInfoIPage = baseMapper.selectPage(pageParam, queryWrapper); + return dangerSourceInfoIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/HiddenDangerServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/HiddenDangerServiceImpl.java new file mode 100644 index 0000000..03af83e --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/HiddenDangerServiceImpl.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.entity.HiddenDanger; +import com.hnac.hzims.safeproduct.riskhazards.mapper.HiddenDangerMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.HiddenDangerService; +import com.hnac.hzims.safeproduct.riskhazards.vo.HiddenDangerQueryVo; +import org.springframework.stereotype.Service; + +@Service +public class HiddenDangerServiceImpl extends ServiceImpl implements HiddenDangerService { + @Override + public IPage selectPage(Page pageParam, HiddenDangerQueryVo hiddenDangerQueryVo) { + String dangerBehavior = hiddenDangerQueryVo.getDangerBehavior(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(dangerBehavior)) { + queryWrapper.like(HiddenDanger::getDangerBehavior,dangerBehavior); + } + IPage hiddenDangerIPage = baseMapper.selectPage(pageParam, queryWrapper); + + return hiddenDangerIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskHazardsScreeningServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskHazardsScreeningServiceImpl.java new file mode 100644 index 0000000..0b3b514 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskHazardsScreeningServiceImpl.java @@ -0,0 +1,110 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import com.hnac.hzims.safeproduct.riskhazards.mapper.RiskHazardsScreeningMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskHazardsScreeningService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.system.cache.DictCache; +import org.springframework.stereotype.Service; + +import java.util.*; + +@Service +public class RiskHazardsScreeningServiceImpl extends BaseServiceImpl implements IRiskHazardsScreeningService { + @Override + public List> countMap(LambdaQueryWrapper wrapper) { + List list= this.list(wrapper); + if (list == null || list.isEmpty()){ + return null; + } + return countList(list); + } + + @Override + public List> countByType(LambdaQueryWrapper wrapper) { + List list= this.list(wrapper); + if (list == null || list.isEmpty()){ + return null; + } + return countType(list); + } + + //根据电站统计 + List> countList(List list){ + Map map=new HashMap<>(); + Map nameMap=new HashMap<>(); + for(RiskHazardsScreening screening: list){ + String project=screening.getProject(); + nameMap.put(project,screening.getProjectName()); + + Integer count=map.get(project); + if(count == null){ + map.put(project,1); + }else{ + map.put(project,count+1); + } + } + + List> res=new ArrayList<>(); + for(Map.Entry entry:map.entrySet()){ + String key=entry.getKey(); + + Map resMap=new HashMap<>(); + resMap.put("code",key); + resMap.put("name",nameMap.get(key)); + resMap.put("count",String.valueOf(entry.getValue())); + res.add(resMap); + } + + // + return sortMapListByField(res,"count","desc"); + } + + //根据隐患分类统计 + List> countType(List list){ + Map map=new HashMap<>(); + for(RiskHazardsScreening screening: list){ + String casualtyAccident=screening.getCasualtyAccident(); + Integer count=map.get(casualtyAccident); + if(count == null){ + map.put(casualtyAccident,1); + }else{ + map.put(casualtyAccident,count+1); + } + } + + List> res=new ArrayList<>(); + for(Map.Entry entry:map.entrySet()){ + String key=entry.getKey(); + + Map resMap=new HashMap<>(); + resMap.put("code",key); + resMap.put("name", DictCache.getValue("casualty_accident",key)); + resMap.put("count",String.valueOf(entry.getValue())); + res.add(resMap); + } + + // + return sortMapListByField(res,"count","desc"); + + } + + private static List> sortMapListByField(List> list, String field, String sortTyp) { + if (CollectionUtils.isNotEmpty(list)) { + + // 方法2 也ok噢 + if (StringUtils.equals(sortTyp, "desc")) { + Collections.sort(list, (m1, m2)-> Integer.valueOf(m2.get(field)).compareTo(Integer.valueOf(m1.get(field)))); // lamuda排序 + } else { + Collections.sort(list, Comparator.comparing(m -> Integer.valueOf(m.get(field)))); // lamuda排序 + } + } + + return list; + } + + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskInfoServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskInfoServiceImpl.java new file mode 100644 index 0000000..3dfa0b8 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskInfoServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskInfoService; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskInfo; +import com.hnac.hzims.safeproduct.riskhazards.mapper.RiskInfoMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskInfoQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 风险信息表 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Service +public class RiskInfoServiceImpl extends ServiceImpl implements IRiskInfoService { + + @Override + public IPage selectPage(Page pageParam, RiskInfoQueryVo riskMatrixXQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage riskInfoIPage = baseMapper.selectPage(pageParam, queryWrapper); + return riskInfoIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixXServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixXServiceImpl.java new file mode 100644 index 0000000..2f3cbfd --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixXServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixX; +import com.hnac.hzims.safeproduct.riskhazards.mapper.RiskMatrixXMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskMatrixXService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixXQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 风险矩阵X表 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Service +public class RiskMatrixXServiceImpl extends ServiceImpl implements IRiskMatrixXService { + + @Override + public IPage selectPage(Page pageParam, RiskMatrixXQueryVo riskMatrixXQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage riskMatrixXIPage = baseMapper.selectPage(pageParam, queryWrapper); + return riskMatrixXIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixYServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixYServiceImpl.java new file mode 100644 index 0000000..875fe95 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskMatrixYServiceImpl.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskMatrixY; +import com.hnac.hzims.safeproduct.riskhazards.mapper.RiskMatrixYMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskMatrixYService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskMatrixYQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 风险矩阵Y表 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-01 + */ +@Service +public class RiskMatrixYServiceImpl extends ServiceImpl implements IRiskMatrixYService { + + @Override + public IPage selectPage(Page pageParam, RiskMatrixYQueryVo riskMatrixYQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage riskMatrixYIPage = baseMapper.selectPage(pageParam, queryWrapper); + return riskMatrixYIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskPointInfoServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskPointInfoServiceImpl.java new file mode 100644 index 0000000..7ee1c78 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/RiskPointInfoServiceImpl.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskPointInfo; +import com.hnac.hzims.safeproduct.riskhazards.mapper.RiskPointInfoMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.IRiskPointInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskPointInfoQueryVo; +import org.springframework.stereotype.Service; + +/** + *

+ * 风险点信息表 服务实现类 + *

+ * + * @author zhaiqm + * @since 2023-09-14 + */ +@Service +public class RiskPointInfoServiceImpl extends ServiceImpl implements IRiskPointInfoService { + + @Override + public IPage selectPage(Page pageParam, RiskPointInfoQueryVo riskPointInfoQueryVo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + IPage riskPointInfoIPage = baseMapper.selectPage(pageParam, queryWrapper); + return riskPointInfoIPage; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/WorkAreaServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/WorkAreaServiceImpl.java new file mode 100644 index 0000000..ec19ff1 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/service/impl/WorkAreaServiceImpl.java @@ -0,0 +1,93 @@ +package com.hnac.hzims.safeproduct.riskhazards.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.riskhazards.mapper.WorkAreaMapper; +import com.hnac.hzims.safeproduct.riskhazards.service.WorkAreaService; +import com.hnac.hzims.safeproduct.riskhazards.entity.WorkArea; +import com.hnac.hzims.safeproduct.riskhazards.vo.WorkAreaQueryVo; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.cache.SysCache; +import org.springblade.system.entity.Dept; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class WorkAreaServiceImpl extends ServiceImpl implements WorkAreaService { + + @Override + public IPage selectPage(Page pageParam, WorkAreaQueryVo workAreaQueryVo) { + String areaName = workAreaQueryVo.getAreaName(); + Long directOpId = workAreaQueryVo.getDirectOpId(); + Long leadOpId = workAreaQueryVo.getLeadOpId(); + Long departId = workAreaQueryVo.getDepartId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(areaName)) { + queryWrapper.like(WorkArea::getAreaName,areaName); + } + if (ObjectUtil.isNotEmpty(directOpId)) { + queryWrapper.eq(WorkArea::getDirectOpId, directOpId); + } + if (ObjectUtil.isNotEmpty(leadOpId)) { + queryWrapper.eq(WorkArea::getLeadOpId, leadOpId); + } + if (ObjectUtil.isNotEmpty(departId)) { + queryWrapper.eq(WorkArea::getDepartId, departId); + } + IPage workAreaIPage = baseMapper.selectPage(pageParam, queryWrapper); + + //翻译 todo zhaiqm 暂时没有redis 先屏蔽缓存调用 +// List records = workAreaIPage.getRecords(); +// records.stream().forEach(workArea -> { +// User directOp = UserCache.getUser(workArea.getDirectOpId()); +// String directOpName = directOp.getName(); +// User leadOp = UserCache.getUser(workArea.getLeadOpId()); +// String leadOpName = leadOp.getName(); +// Dept dept = SysCache.getDept(workArea.getDepartId()); +// String deptName = dept.getDeptName(); +// workArea.setDirectOpName(directOpName); +// workArea.setLeadOpName(leadOpName); +// workArea.setDepartName(deptName); +// }); + + return workAreaIPage; + } + + @Override + public void saveWorkArea(WorkArea workArea) { + //todo zhaiqm checkOpAndDept(workArea); + this.save(workArea); + } + + @Override + public void updateWorkArea(WorkArea workArea) { + // todo zhaiqm checkOpAndDept(workArea); + this.updateById(workArea); + } + + /** + * 校验员工id、部门id是否存在 + * @param workArea + */ + private void checkOpAndDept(WorkArea workArea) { + Long directOpId = workArea.getDirectOpId(); + Long leadOpId = workArea.getLeadOpId(); + Long departId = workArea.getDepartId(); + User user = UserCache.getUser(directOpId); + User user1 = UserCache.getUser(leadOpId); + if (user == null || user1 == null) { + throw new ServiceException("员工不存在,保存失败"); + } + Dept dept = SysCache.getDept(departId); + if (dept == null) { + throw new ServiceException("部门不存在,保存失败"); + } + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/util/ParamUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/util/ParamUtil.java new file mode 100644 index 0000000..0e61dd8 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/riskhazards/util/ParamUtil.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.safeproduct.riskhazards.util; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; + +import java.util.List; +import java.util.Map; + +public class ParamUtil { + public static LambdaQueryWrapper conditionRiskHazardsScreening(Map param){ + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + if(param.get("projects")!=null) {//多个工程编码 + List projects=(List)param.get("projects"); + wrapper.in(RiskHazardsScreening::getProject,projects); + } + if(param.get("project")!=null) {//单个工程编码 + String project= String.valueOf(param.get("project")); + wrapper.eq(RiskHazardsScreening::getProject,project); + } + if(param.get("start")!=null && param.get("end")!=null) {//单个工程编码 + String start= String.valueOf(param.get("start")); + String end= String.valueOf(param.get("end")); + wrapper.ge(RiskHazardsScreening::getCreateTime,start); + wrapper.le(RiskHazardsScreening::getCreateTime,end); + } + + if(param.get("corrective")!=null) {//是否整改 + String corrective= String.valueOf(param.get("corrective")); + wrapper.eq(RiskHazardsScreening::getCorrective,corrective); + } + + return wrapper; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IAccidentService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IAccidentService.java index f794fce..54dd862 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IAccidentService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IAccidentService.java @@ -1,11 +1,15 @@ package com.hnac.hzims.safeproduct.service; +import com.hnac.hzims.safeproduct.dto.AccidentDTO; import com.hnac.hzims.safeproduct.entity.AccidentEntity; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerAccidentMonthCountVO; import org.springblade.core.mp.base.BaseService; +import java.util.List; + /** * @author hx */ public interface IAccidentService extends BaseService { - + List getAccidentMonthTrend(AccidentDTO req); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java deleted file mode 100644 index 1676f9a..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IDangerSourceService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.hnac.hzims.safeproduct.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.safeproduct.dto.DangerSourceDTO; -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.vo.DangerSourceVO; -import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; -import com.hnac.hzims.safeproduct.vo.SourceVO; -import org.springblade.core.mp.base.BaseService; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.system.vo.CreateTableVO; -import org.springframework.web.multipart.MultipartFile; - -import java.util.List; - -/** - * @author xiashandong - * @created 2020/9/1 16:00 - **/ -public interface IDangerSourceService extends BaseService { - - R doSave(DangerSourceDTO req); - - R doUpdate(DangerSourceDTO req); - - R detail(Long id); - - R> pageCondition(DangerSourceEntity req, Query query); - - void importExcel(MultipartFile file); - - /** - * 危险等级统计数 - * @return - */ - List getLevelCount(); - - List listByTenantId(String tenantId); - - List getSafeCreateTable(List tableNames); - - List safes(String safeInfos); -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/AccidentServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/AccidentServiceImpl.java index ba5d942..a0ef96e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/AccidentServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/AccidentServiceImpl.java @@ -1,13 +1,25 @@ package com.hnac.hzims.safeproduct.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzims.safeproduct.dto.AccidentDTO; import com.hnac.hzims.safeproduct.entity.AccidentEntity; import com.hnac.hzims.safeproduct.mapper.AccidentMapper; import com.hnac.hzims.safeproduct.service.IAccidentService; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerAccidentMonthCountVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Optional; + /** * @author hx */ @@ -15,5 +27,27 @@ import org.springframework.stereotype.Service; @AllArgsConstructor @Slf4j public class AccidentServiceImpl extends BaseServiceImpl implements IAccidentService { + private final IStationClient stationClient; + + @Override + public List getAccidentMonthTrend(AccidentDTO req) { + if(Func.isNotEmpty(req.getStationCode())) { + R stationByCode = stationClient.getStationByCode(req.getStationCode()); + Long deptId = Optional.ofNullable(stationByCode).filter(r -> r.isSuccess() && ObjectUtil.isNotEmpty(r.getData())) + .map(R::getData).map(StationEntity::getRefDept).orElse(null); + req.setDeptId(deptId); + } + QueryWrapper queryWrapper = Wrappers.query(); + if(Func.isNotEmpty(req.getDeptId())) { + queryWrapper.eq("create_dept",req.getDeptId()); + } + if(Func.isNotEmpty(req.getStartTime())) { + queryWrapper.ge("create_time",req.getStartTime()); + } + if(Func.isNotEmpty(req.getEndTime())) { + queryWrapper.le("create_time",req.getEndTime()); + } + return this.baseMapper.getAccidentMonthTrend(queryWrapper); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java deleted file mode 100644 index ce55832..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.hnac.hzims.safeproduct.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.equipment.entity.EmInfoEntity; -import com.hnac.hzims.equipment.feign.IEmInfoClient; -import com.hnac.hzims.safeproduct.constants.DictConstants; -import com.hnac.hzims.safeproduct.dto.DangerSourceDTO; -import com.hnac.hzims.safeproduct.dto.DangerSourcePositionDTO; -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.entity.DangerSourceLevelRecordEntity; -import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; -import com.hnac.hzims.safeproduct.enums.DangerSourceLevelEnum; -import com.hnac.hzims.safeproduct.excel.DangerSourceSaveExcel; -import com.hnac.hzims.safeproduct.mapper.DangerSourceLevelRecordMapper; -import com.hnac.hzims.safeproduct.mapper.DangerSourceMapper; -import com.hnac.hzims.safeproduct.mapper.DangerSourcePositionMapper; -import com.hnac.hzims.safeproduct.service.IDangerSourceService; -import com.hnac.hzims.safeproduct.utils.ExcelToolListener; -import com.hnac.hzims.safeproduct.utils.TableJsonUtils; -import com.hnac.hzims.safeproduct.vo.DangerSourcePositionVO; -import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; -import com.hnac.hzims.safeproduct.vo.DangerSourceVO; -import com.hnac.hzims.safeproduct.vo.SourceVO; -import com.hnac.hzims.safeproduct.wrapper.DangerSourcePostionWrapper; -import com.hnac.hzims.safeproduct.wrapper.DangerSourceWrapper; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.ArrayUtils; -import org.springblade.core.excel.support.ExcelException; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.cache.DictCache; -import org.springblade.system.vo.CreateTableVO; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; -import org.springframework.web.multipart.MultipartFile; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * @author xiashandong - * @created 2020/9/1 16:00 - **/ -@Service -@AllArgsConstructor -@Slf4j -public class DangerSourceServiceImpl extends BaseServiceImpl implements IDangerSourceService { - - private final DangerSourceMapper dangerSourceMapper; - private final DangerSourcePositionMapper dangerSourcePositionMapper; - private final DangerSourceLevelRecordMapper dangerSourceLevelRecordMapper; - private final IEmInfoClient emInfoClient; - - private final JdbcTemplate jdbcTemplate; - - @Override - public R doSave(DangerSourceDTO req) { - //设备ID唯一性校验 -// Wrapper queryWrapper = new QueryWrapper() {{ -// eq("eq_id", req.getEqId()); -// }}; -// if (super.getBaseMapper().selectCount(queryWrapper) > 0) { -// //throw new RuntimeException(String.format("设备ID[%s]已经设置过危险等级了!", req.getEqId())); -// return R.fail(400,String.format("设备ID[%s]已经设置过危险等级了!", req.getEqId())); -// } - - //新增危险源记录 - if (!super.save(req)) { - throw new RuntimeException("数据库insert失败!"); - } - - //新增危险源位置记录 - if (null != req.getPosition()) { - req.getPosition().setSourceId(req.getId()); - if (dangerSourcePositionMapper.insert(req.getPosition()) == 0) { - throw new RuntimeException("数据库insert失败!"); - } - } - - //记录危险源等级变更 - DangerSourceLevelRecordEntity levelRecordEntity = new DangerSourceLevelRecordEntity() {{ - setSourceId(req.getId()); - setOrgiLevel(-1); - setNewLevel(req.getLevel()); - setType(0); - setFlowId(""); - setUpdateTime(new Date()); - setRemark("初始化危险等级"); - }}; - if (dangerSourceLevelRecordMapper.insert(levelRecordEntity) == 0) { - throw new RuntimeException("数据库insert失败!"); - } - - return R.data(req.getId()); - } - - @Override - public R doUpdate(DangerSourceDTO req) { - //先查询做存在性校验 - DangerSourceEntity orginDangerSource = dangerSourceMapper.selectById(req.getId()); - if (null == orginDangerSource) { - throw new RuntimeException("记录不存在!"); - } - - //更新危险源 - //等级变更需要走工作流 - //req.setLevel(orginDangerSource.getLevel()); - if (!super.updateById(req)) { - throw new RuntimeException("数据库update失败!"); - } - //添加或更新危险源位置信息 - if (null != req.getPosition()) { - QueryWrapper queryWrapper = new QueryWrapper() {{ - eq("source_id", req.getId()); - }}; - - int line; - req.getPosition().setSourceId(req.getId()); - //不存在位置信息则新增位置信息 - if (null == dangerSourcePositionMapper.selectOne(queryWrapper)) { - line = dangerSourcePositionMapper.insert(req.getPosition()); - } else {//否则修改位置信息 - line = dangerSourcePositionMapper.update(req.getPosition(), queryWrapper); - } - - if (line == 0) { - throw new RuntimeException("数据库操作失败!"); - } - - } - - return R.data(req.getId()); - } - - @Override - public R detail(Long id) { - DangerSourceEntity dangerSource = dangerSourceMapper.selectById(id); - if (null == dangerSource) { - throw new RuntimeException("记录不存在!"); - } - - //查询危险源位置信息 - DangerSourcePositionEntity dangerSourcePosition = dangerSourcePositionMapper.selectOne(new QueryWrapper() {{ - eq("source_id", id); - }}); - - DangerSourceVO detail = DangerSourceWrapper.build().entityVO(dangerSource); - DangerSourcePositionVO position = DangerSourcePostionWrapper.build().entityVO(dangerSourcePosition); - detail.setPosition(position); - return R.data(detail); - } - - @Override - public R> pageCondition(DangerSourceEntity req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(DangerSourceEntity::getCreateTime); - if (req.getType() != null) { - eq(DangerSourceEntity::getType, req.getType()); - } - if (null != req.getEqId()) { - eq(DangerSourceEntity::getEqId, req.getEqId()); - } - if (null != req.getLevel()) { - eq(DangerSourceEntity::getLevel, req.getLevel()); - } - if (StringUtil.isNotBlank(req.getName())) { - like(DangerSourceEntity::getName, req.getName()); - } - if (StringUtil.isNotBlank(req.getDangerEle())) { - like(DangerSourceEntity::getDangerEle, req.getDangerEle()); - } - if (StringUtil.isNotBlank(req.getApplyType())) { - eq(DangerSourceEntity::getApplyType, req.getApplyType()); - } - }}; - IPage page = super.page(Condition.getPage(query), queryWrapper); - page.setRecords(DangerSourceWrapper.build().listVO(page.getRecords())); - return R.data(page); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void importExcel(MultipartFile file) { - String filename = file.getOriginalFilename(); - ExcelToolListener excelToolListener = new ExcelToolListener(); - if (StringUtils.isEmpty(filename)) { - throw new ExcelException("请上传文件!"); - } else if (!StringUtils.endsWithIgnoreCase(filename, ".xls") && !StringUtils.endsWithIgnoreCase(filename, ".xlsx")) { - throw new ExcelException("请上传正确的excel文件!"); - } else { - try { - InputStream inputStream = new BufferedInputStream(file.getInputStream()); - com.hnac.hzims.safeproduct.utils.ExcelUtil.asyncReadModel(inputStream, excelToolListener, DangerSourceSaveExcel.class,0,1); - } catch (IOException e) { - e.printStackTrace(); - } - } - /**完善内容**/ - List dataList = excelToolListener.getDataList(); - AtomicInteger index = new AtomicInteger(1); - dataList.forEach(data->{ - JSONObject object = JSONObject.parseObject(JSON.toJSONString(data)); - DangerSourceDTO dangerSourceDTO = BeanUtil.copy(data,DangerSourceDTO.class); - if(Func.isEmpty(object.getString("applyTypeName")) || Func.isEmpty(object.getString("typeName")) || Func.isEmpty(object.getString("levelName")) - || Func.isEmpty(object.getString("name")) || Func.isEmpty(object.getString("dangerEle")) || Func.isEmpty(object.getString("cause")) - || Func.isEmpty(object.getString("measures"))){ - throw new ServiceException("第"+index.get()+"行填入数据不全,请检查修改后再导入"); - } - /**完善应用类型**/ - String appType = DictCache.getKey(DictConstants.SAFE_DANGER_SOURCE_APPLY_TYPE,object.getString("applyTypeName")); - if(StringUtil.isEmpty(appType)){ - throw new ServiceException("第"+index.get()+"行填入应用类型查询不到相关数据,请检查修改后重新导入"); - } - dangerSourceDTO.setApplyType(appType); - /**完善危险源类型**/ - String type = DictCache.getKey(DictConstants.DANGER_TYPE,object.getString("typeName")); - if(StringUtil.isEmpty(type)){ - throw new ServiceException("第"+index.get()+"行填入危险源类型查询不到相关数据,请检查修改后重新导入"); - } - dangerSourceDTO.setType(Integer.valueOf(type)); - /**完善风险等级**/ - String level = DictCache.getKey(DictConstants.RISK_LEVEL,object.getString("levelName")); - if(StringUtil.isEmpty(level)){ - throw new ServiceException("第"+index.get()+"行填入风险等级查询不到相关数据,请检查修改后重新导入"); - } - /**完善设备**/ - if(Func.isNotEmpty(object.getString("equName"))){ - String equName = object.getString("equName"); - R emInfoR = emInfoClient.getEmInfoByName(equName); - log.info("设备查询结果为:{}",JSONObject.toJSONString(emInfoR)); - if(!emInfoR.isSuccess() || Func.isEmpty(emInfoR.getData())){ - throw new ServiceException("第"+index.get()+"行填入设备信息查询不到相关数据,请检查修改后重新导入"); - } - dangerSourceDTO.setEqId(emInfoR.getData().getId()); - } - dangerSourceDTO.setLevel(Integer.valueOf(level)); - /**完善危险源位置对象**/ - DangerSourcePositionDTO positionDTO = BeanUtil.copy(object,DangerSourcePositionDTO.class); - dangerSourceDTO.setPosition(positionDTO); - this.doSave(dangerSourceDTO); - index.getAndIncrement(); - }); - } - - /** - * 危险等级统计数 - * - * @return - */ - @Override - public List getLevelCount() { - List re = dangerSourceMapper.getLevelCount(); - if (Func.isNotEmpty(re)) { - for (DangerSourceReportVO vo : re) { - vo.setName(DangerSourceLevelEnum.getName(vo.getLevel())); - } - } - return re; - } - - @Override - public List getSafeCreateTable(List tableNames) { - if(CollectionUtil.isEmpty(tableNames)){ - return null; - } - // 获取数据库名称 - String databaseName = this.baseMapper.getCurDataBaseName(); - - List list = new ArrayList<>(); - // 遍历处理表名 - tableNames.forEach(table -> { - CreateTableVO item = new CreateTableVO(); - // 获取表结构sql语句 - String show_table_sql = "show create table `" + databaseName + "`." + table; - Map result = jdbcTemplate.queryForMap(show_table_sql); - if (MapUtils.isEmpty(result)) { - return; - } - String createTableSql = result.get("Create Table").toString(); - // 表名 - item.setTableName((String) result.get("Table")); - // 建表语句 - item.setCreateSql(TableJsonUtils.createTableSqlProcess(createTableSql)); - list.add(item); - }); - return list; - } - - @Override - public List safes(String safeInfos) { - if(StringUtil.isEmpty(safeInfos)){ - return new ArrayList<>(); - } - List sources = this.listByIds(Arrays.asList(safeInfos.split(","))); - //未查到数据返回空集合 - if (CollectionUtils.isEmpty(sources)) { - return new ArrayList<>(); - } - //查到数据则将数据排序后再返回 - return sources.stream().sorted(Comparator.comparing(DangerSourceEntity::getId)).collect(Collectors.toList()); - } - - @Override - public List listByTenantId(String tenantId) { - return this.baseMapper.listByTenantId(tenantId); - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/controller/RiskDangerStatisticController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/controller/RiskDangerStatisticController.java new file mode 100644 index 0000000..1a8dbea --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/controller/RiskDangerStatisticController.java @@ -0,0 +1,66 @@ +package com.hnac.hzims.safeproduct.statistic.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.google.common.collect.Lists; +import com.hnac.hzims.safeproduct.hazard.vo.RiskHazardExcelVO; +import com.hnac.hzims.safeproduct.risk.service.HazardTaskService; +import com.hnac.hzims.safeproduct.statistic.schedule.MainPageStatisticSchedule; +import com.hnac.hzims.safeproduct.statistic.schedule.RedisKeyConstants; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerStatisticVO; +import com.hnac.hzims.safeproduct.statistic.vo.RiskInnerVO; +import com.hnac.hzims.safeproduct.statistic.vo.StationRiskStatisticVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.YearMonth; +import java.util.List; + +/** + * @ClassName RiskDangerStatisticController + * @description: + * @author: hx + * @create: 2023-09-20 09:38 + * @Version 4.0 + **/ +@RestController +@RequestMapping("/riskDanger/statistic") +@Api(value = "风险隐患统计",tags = "首页") +@AllArgsConstructor +public class RiskDangerStatisticController extends BladeController { + + private final RedisTemplate redisTemplate; + + private final HazardTaskService taskService; + + @GetMapping("/getRiskDangerOverview") + @ApiOperation("风险隐患统计总览") + @ApiOperationSupport(order = 1) + public R getRiskDangerOverview() { + RiskDangerStatisticVO riskDangerStatisticVO = (RiskDangerStatisticVO) redisTemplate.opsForValue().get(RedisKeyConstants.RISK_DANGER_OVERVIEW_KEY + ":" + YearMonth.now().format(MainPageStatisticSchedule.formatter)); + return R.data(riskDangerStatisticVO); + } + + @GetMapping("/stationRiskInner") + @ApiOperation("电站风险/隐患统计") + @ApiOperationSupport(order = 2) + public R stationRiskInner(@ApiParam("站点编号") String stationCode) { + return R.data(taskService.stationRiskInner(stationCode)); + } + + @GetMapping("/getStationRiskDangerTrend/{stationCode}") + @ApiOperation("风险隐患统计趋势") + @ApiOperationSupport(order = 3) + public R getStationRiskDangerTrend(@PathVariable @ApiParam("站点编号") String stationCode) { + List result = (List) redisTemplate.opsForHash().get(RedisKeyConstants.STATION_RISK_DANGER_TREND_KEY, stationCode); + return R.data(result); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/MainPageStatisticSchedule.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/MainPageStatisticSchedule.java new file mode 100644 index 0000000..3a280fc --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/MainPageStatisticSchedule.java @@ -0,0 +1,265 @@ +package com.hnac.hzims.safeproduct.statistic.schedule; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzims.safeproduct.dto.AccidentDTO; +import com.hnac.hzims.safeproduct.dto.InnerDangerDTO; +import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; +import com.hnac.hzims.safeproduct.flow.service.IInnerDangerFlowService; +import com.hnac.hzims.safeproduct.hiddenDanger.dto.HDTaskDTO; +import com.hnac.hzims.safeproduct.hiddenDanger.service.IHiddenDangerTaskService; +import com.hnac.hzims.safeproduct.risk.constants.HazardRiskConstants; +import com.hnac.hzims.safeproduct.risk.entity.HazardEstimate; +import com.hnac.hzims.safeproduct.risk.entity.HazardTask; +import com.hnac.hzims.safeproduct.risk.service.HazardEstimateService; +import com.hnac.hzims.safeproduct.risk.service.HazardTaskService; +import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo; +import com.hnac.hzims.safeproduct.statistic.vo.DangerRiskScatterVO; +import com.hnac.hzims.safeproduct.service.IAccidentService; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerAccidentMonthCountVO; +import com.hnac.hzims.safeproduct.statistic.vo.RiskDangerStatisticVO; +import com.hnac.hzims.safeproduct.statistic.vo.StationRiskStatisticVO; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import com.xxl.job.core.log.XxlJobLogger; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +import static com.hnac.hzims.safeproduct.statistic.schedule.XxlJobConstants.RISK_DANGER_OVERVIEW; +import static com.hnac.hzims.safeproduct.statistic.schedule.XxlJobConstants.STATION_RISK_DANGER_TREND; + +/** + * @ClassName MainPageStatisticSchedule + * @description: 霍山集控-风险隐患区域定时任务 + * @author: hx + * @create: 2023-09-20 10:38 + * @Version 4.0 + **/ +@Component +@AllArgsConstructor +@Slf4j +public class MainPageStatisticSchedule { + + private final IHiddenDangerTaskService hdTaskService; + + private final HazardTaskService taskService; + + private final HazardEstimateService estimateService; + + private final IInnerDangerFlowService innerDangerService; + + private final IStationClient stationClient; + + private final RedisTemplate redisTemplate; + + private final IAccidentService accidentService; + + public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); + + + @XxlJob(RISK_DANGER_OVERVIEW) + public ReturnT riskDangerOverview(String month) { + if(StringUtil.isEmpty(month)){ + month = YearMonth.now().format(formatter); + } + RiskDangerStatisticVO statistic = new RiskDangerStatisticVO(); + // 风险站点分类 + statistic.setStationRiskStatistics(this.stationRiskLevel()); + // 本月风险评价数 + statistic.setRiskCheckMonthCount(this.monthRiskCount(month)); + // 填充隐患排查数 + statistic.setDangerCheckMonthCount(this.getDangerCheckMonthCount(month)); + // 填充今日新增隐患数 + statistic.setDangerAddDailyCount(this.getDangerAddDailyCount()); + //填充各级隐患数 + statistic.setRiskScatterCurrentMonth(this.getRiskScatterCurrentMonth(month)); + + if(ObjectUtil.isNotEmpty(statistic)) { + XxlJobLogger.log("====="+month+"月份存入redis的数据为:"+JSON.toJSONString(statistic)+"====="); + redisTemplate.opsForValue().set(RedisKeyConstants.RISK_DANGER_OVERVIEW_KEY+":"+month,statistic); + } + return ReturnT.SUCCESS; + } + + private List getRiskScatterCurrentMonth(String month) { + ArrayList res = new ArrayList<>(); + List listByDate = innerDangerService.getListByDate(month); + Map> listMap = listByDate.stream().filter(s->ObjectUtil.isNotEmpty(s.getHiddenDangerLevel())).collect(Collectors.groupingBy(InnerDangerEntity::getHiddenDangerLevel)); + listMap.forEach((type, list) -> { + if (type.equals(1)) { + DangerRiskScatterVO dangerRiskScatterVO = new DangerRiskScatterVO(); + dangerRiskScatterVO.setYearAndMonth(month); + dangerRiskScatterVO.setHiddenDangerCount(list.size()); + dangerRiskScatterVO.setHiddenDangerLevel("低风险"); + res.add(dangerRiskScatterVO); + } else if (type.equals(2)) { + DangerRiskScatterVO dangerRiskScatterVO = new DangerRiskScatterVO(); + dangerRiskScatterVO.setYearAndMonth(month); + dangerRiskScatterVO.setHiddenDangerCount(list.size()); + dangerRiskScatterVO.setHiddenDangerLevel("一般风险"); + res.add(dangerRiskScatterVO); + } else if (type.equals(3)) { + DangerRiskScatterVO dangerRiskScatterVO = new DangerRiskScatterVO(); + dangerRiskScatterVO.setYearAndMonth(month); + dangerRiskScatterVO.setHiddenDangerCount(list.size()); + dangerRiskScatterVO.setHiddenDangerLevel("较大风险"); + res.add(dangerRiskScatterVO); + } else if (type.equals(4)) { + DangerRiskScatterVO dangerRiskScatterVO = new DangerRiskScatterVO(); + dangerRiskScatterVO.setYearAndMonth(month); + dangerRiskScatterVO.setHiddenDangerCount(list.size()); + dangerRiskScatterVO.setHiddenDangerLevel("重大风险"); + res.add(dangerRiskScatterVO); + } + }); + return res; + } + + @XxlJob(STATION_RISK_DANGER_TREND) + public ReturnT stationRiskDangerTrend(String stationCode) { + List stationList = StringUtil.isNotBlank(stationCode) ? Lists.newArrayList(stationCode) : + Optional.of(stationClient.getListAll()).filter(r -> r.isSuccess() && CollectionUtil.isNotEmpty(r.getData())).map(R::getData) + .map(list -> list.stream().map(StationEntity::getCode).collect(Collectors.toList())).orElse(Lists.newArrayList()); + if(CollectionUtil.isEmpty(stationList)) { + XxlJobLogger.log("====未查询到相关站点===="); + } + stationList.forEach(code -> { + // 填充隐患趋势 + List dangerAccidentMonthCounts = this.getStationRiskStatistic(code); + if(CollectionUtil.isNotEmpty(dangerAccidentMonthCounts)) { + XxlJobLogger.log("====="+code+"站点存入redis的数据为:"+JSON.toJSONString(dangerAccidentMonthCounts)+"====="); + redisTemplate.opsForHash().put(RedisKeyConstants.STATION_RISK_DANGER_TREND_KEY,code,dangerAccidentMonthCounts); + } + }); + return ReturnT.SUCCESS; + } + + /** + * 风险等级站点统计 + * @return + */ + private List stationRiskLevel() { + // 查询站点最近的风险评价 + List staions = taskService.stationRiskLevel(); + return HazardRiskConstants.HAZARD_LEVELS.stream().map(hazard_level->{ + StationRiskStatisticVO statistic = new StationRiskStatisticVO(); + statistic.setRiskLevel(hazard_level); + if(CollectionUtil.isNotEmpty(staions)){ + statistic.setStations(staions.stream().filter(staion->staion.getLevel().equals(hazard_level)).map(StationRiskLevelVo::getStationName).collect(Collectors.toList())); + } + return statistic; + }).collect(Collectors.toList()); + } + + /** + * 月份风险评价数 + * @return + */ + private Integer monthRiskCount(String month) { + return estimateService.count(Wrappers.lambdaQuery() + .like(HazardEstimate::getCreateTime,month) + .isNotNull(HazardEstimate::getRDValue) + ); + } + + /** + * 获取月份下的隐患排查数 + * @param yearMonth 月份 + * @return 隐患排查数量 + */ + private int getDangerCheckMonthCount(String yearMonth) { + HDTaskDTO req = new HDTaskDTO(); + req.setYearMonth(yearMonth); + return hdTaskService.list(req).size(); + } + + private int getDangerAddDailyCount() { + String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + InnerDangerDTO req = new InnerDangerDTO(); + req.setDate(date); + req.setJudgeRes(1); + return innerDangerService.getList(req).size(); + } + + private List getStationRiskStatistic(String stationCode) { + HDTaskDTO taskDTO = new HDTaskDTO(); + taskDTO.setStationCode(stationCode); + YearMonth lastYearMonth = YearMonth.now().minusMonths(11); + LocalDateTime taskStartTime = LocalDateTime.of(lastYearMonth.getYear(),lastYearMonth.getMonth(),1,0,0,0); + LocalDateTime taskEndTime = LocalDateTime.now(); + taskDTO.setTaskStartTime(taskStartTime); + taskDTO.setTaskEndTime(taskEndTime); + // 风险辨识评价数量 + List estimates = this.stationEstimates(stationCode); + // 隐患数 + List data = hdTaskService.getMonthTaskCount(taskDTO); + AccidentDTO accidentDTO = new AccidentDTO(); + accidentDTO.setStationCode(stationCode); + accidentDTO.setStartTime(taskStartTime); + accidentDTO.setEndTime(taskEndTime); + List accidentList = accidentService.getAccidentMonthTrend(accidentDTO); + List last12Months = MainPageStatisticSchedule.getLast12Months(); + return last12Months.stream().map(month -> { + RiskDangerAccidentMonthCountVO accident = new RiskDangerAccidentMonthCountVO(); + accident.setYearAndMonth(month); + // 风险辨识数 + accident.setRiskCount((int) estimates.stream().filter(estimate-> DateUtil.format(estimate.getCreateTime(),"yyyy-MM").equals(month)).count()); + // 隐患数 + accident.setDangerCount(data.stream().filter(m -> month.equals(m.getYearAndMonth())).findAny().map(RiskDangerAccidentMonthCountVO::getDangerCount).orElse(0)); + accident.setAccidentCount(accidentList.stream().filter(m -> month.equals(m.getYearAndMonth())).findAny().map(RiskDangerAccidentMonthCountVO::getAccidentCount).orElse(0)); + return accident; + }).sorted(Comparator.comparing(RiskDangerAccidentMonthCountVO::getYearAndMonth)).collect(Collectors.toList()); + } + + /** + * 站点评价记录 + * @param code + * @return + */ + private List stationEstimates(String code) { + // 查询任务 + List tasks = taskService.list(Wrappers.lambdaQuery() + .eq(HazardTask::getStationCode,code) + .like(HazardTask::getCreateTime,DateUtil.format(new Date(),"yyyy")) + ); + if(CollectionUtil.isEmpty(tasks)){ + return new ArrayList<>(); + } + return estimateService.list(Wrappers.lambdaQuery() + .like(HazardEstimate::getCreateTime,DateUtil.format(new Date(),"yyyy")) + .in(HazardEstimate::getTaskId,tasks.stream().map(HazardTask::getId).collect(Collectors.toList())) + .isNotNull(HazardEstimate::getRDValue)); + } + + /** + * 获取过去一年的月份 + * @return 过去一年的月份 + */ + public static List getLast12Months() { + List result = Lists.newArrayList(); + YearMonth month = YearMonth.now(); + for (int i = 0; i < 12; i++) { + result.add(month.format(formatter)); + month = month.minusMonths(1); + } + return result; + } + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/RedisKeyConstants.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/RedisKeyConstants.java new file mode 100644 index 0000000..c085123 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/RedisKeyConstants.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.safeproduct.statistic.schedule; + +public interface RedisKeyConstants { + + /**获取霍山集控首页总览数据key**/ + String RISK_DANGER_OVERVIEW_KEY = "200000:safeProduct:mainPage:overview"; + + /**获取站点风险/隐患/事故趋势数据**/ + String STATION_RISK_DANGER_TREND_KEY = "200000:safeProduct:mainPage:trend"; + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/XxlJobConstants.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/XxlJobConstants.java new file mode 100644 index 0000000..6d60484 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/statistic/schedule/XxlJobConstants.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.safeproduct.statistic.schedule; + +public interface XxlJobConstants { + + /**获取霍山集控首页总览数据**/ + String RISK_DANGER_OVERVIEW = "riskDangerOverview"; + + /**获取站点风险/隐患/事故趋势数据**/ + String STATION_RISK_DANGER_TREND = "stationRiskDangerTrend"; + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceLevelRecordVO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceLevelRecordVO.java index 18fcc6b..245edb9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceLevelRecordVO.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceLevelRecordVO.java @@ -1,7 +1,7 @@ package com.hnac.hzims.safeproduct.vo; import com.hnac.hzims.safeproduct.entity.DangerSourceLevelRecordEntity; -import com.hnac.hzims.safeproduct.enums.DangerSourceLevelEnum; +import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourcePositionVO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourcePositionVO.java deleted file mode 100644 index 2be6933..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourcePositionVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.safeproduct.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; - -/** - * 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class DangerSourcePositionVO extends DangerSourcePositionEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceVO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceVO.java deleted file mode 100644 index db7e6f6..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.hnac.hzims.safeproduct.vo; - -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.enums.DangerSourceLevelEnum; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * @author xiashandong - * @created 2020/9/1 15:46 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class DangerSourceVO extends DangerSourceEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "危险等级Name") - private String levelName; - - @ApiModelProperty(value = "危险等级Name") - private String applyTypeName; - - @ApiModelProperty("创建人名称") - private String createUserName; - - @ApiModelProperty("修改人名称") - private String updateUserName; - - private DangerSourcePositionVO position; - - public String getLevelName() { - return DangerSourceLevelEnum.getName(super.getLevel()); - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/controller/WorkAreaController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/controller/WorkAreaController.java deleted file mode 100644 index b8de9d9..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/controller/WorkAreaController.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hnac.hzims.safeproduct.workarea.entity.WorkArea; -import com.hnac.hzims.safeproduct.workarea.service.WorkAreaService; -import com.hnac.hzims.safeproduct.workarea.vo.WorkAreaQueryVo; -import lombok.RequiredArgsConstructor; -import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@RequiredArgsConstructor -@RestController -@RequestMapping("/workarea") -public class WorkAreaController { - - @Autowired - WorkAreaService workAreaService; - - /** - * 分页查询 - */ - @GetMapping("/listPage/{page}/{size}") - public R listPage(@PathVariable Long page, - @PathVariable Long size, - WorkAreaQueryVo workAreaQueryVo) { - Page pageParam = new Page<>(page, size); - IPage resultParams = - workAreaService.selectPage(pageParam, - workAreaQueryVo); - return R.data(resultParams); - } - - /** - * 新增工作区域数据 - */ - @PostMapping("/save") - public R save(@RequestBody WorkArea workArea) { - workAreaService.saveWorkArea(workArea); - return R.success("新增成功"); - } - - - /** - * 更新工作区域数据 - */ - @PutMapping("/update") - public R update(@RequestBody WorkArea workArea) { - workAreaService.updateWorkArea(workArea); - return R.success("修改成功"); - } - - - /** - * 删除工作区域数据 - */ - @DeleteMapping("/remove/{id}") - public R remove(@PathVariable Long id) { - workAreaService.removeById(id); - return R.success("删除成功"); - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/mapper/WorkAreaMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/mapper/WorkAreaMapper.java deleted file mode 100644 index f3e3dba..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/mapper/WorkAreaMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.safeproduct.workarea.entity.WorkArea; - -public interface WorkAreaMapper extends BaseMapper { -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/WorkAreaService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/WorkAreaService.java deleted file mode 100644 index 645db2d..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/WorkAreaService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.safeproduct.workarea.entity.WorkArea; -import com.hnac.hzims.safeproduct.workarea.vo.WorkAreaQueryVo; - -public interface WorkAreaService extends IService { - - /** - * 分页查询 - * @param pageParam - * @param workAreaQueryVo - * @return - */ - IPage selectPage(Page pageParam, WorkAreaQueryVo workAreaQueryVo); - - void saveWorkArea(WorkArea workArea); - - void updateWorkArea(WorkArea workArea); -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/impl/WorkAreaServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/impl/WorkAreaServiceImpl.java deleted file mode 100644 index 52f07e5..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/workarea/service/impl/WorkAreaServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.hnac.hzims.safeproduct.workarea.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzims.safeproduct.workarea.entity.WorkArea; -import com.hnac.hzims.safeproduct.workarea.mapper.WorkAreaMapper; -import com.hnac.hzims.safeproduct.workarea.service.WorkAreaService; -import com.hnac.hzims.safeproduct.workarea.vo.WorkAreaQueryVo; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.system.cache.SysCache; -import org.springblade.system.entity.Dept; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -public class WorkAreaServiceImpl extends ServiceImpl implements WorkAreaService { - - @Override - public IPage selectPage(Page pageParam, WorkAreaQueryVo workAreaQueryVo) { - String areaName = workAreaQueryVo.getAreaName(); - Long directOpId = workAreaQueryVo.getDirectOpId(); - Long leadOpId = workAreaQueryVo.getLeadOpId(); - Long departId = workAreaQueryVo.getDepartId(); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotBlank(areaName)) { - queryWrapper.like(WorkArea::getAreaName,areaName); - } - if (ObjectUtil.isNotEmpty(directOpId)) { - queryWrapper.eq(WorkArea::getDirectOpId, directOpId); - } - if (ObjectUtil.isNotEmpty(leadOpId)) { - queryWrapper.eq(WorkArea::getLeadOpId, leadOpId); - } - if (ObjectUtil.isNotEmpty(departId)) { - queryWrapper.eq(WorkArea::getDepartId, departId); - } - IPage workAreaIPage = baseMapper.selectPage(pageParam, queryWrapper); - - //翻译 - List records = workAreaIPage.getRecords(); - records.stream().forEach(workArea -> { - User directOp = UserCache.getUser(workArea.getDirectOpId()); - String directOpName = directOp.getName(); - User leadOp = UserCache.getUser(workArea.getLeadOpId()); - String leadOpName = leadOp.getName(); - Dept dept = SysCache.getDept(workArea.getDepartId()); - String deptName = dept.getDeptName(); - workArea.setDirectOpName(directOpName); - workArea.setLeadOpName(leadOpName); - workArea.setDepartName(deptName); - }); - - return workAreaIPage; - } - - @Override - public void saveWorkArea(WorkArea workArea) { - checkOpAndDept(workArea); - this.save(workArea); - } - - @Override - public void updateWorkArea(WorkArea workArea) { - checkOpAndDept(workArea); - this.updateById(workArea); - } - - /** - * 校验员工id、部门id是否存在 - * @param workArea - */ - private void checkOpAndDept(WorkArea workArea) { - Long directOpId = workArea.getDirectOpId(); - Long leadOpId = workArea.getLeadOpId(); - Long departId = workArea.getDepartId(); - User user = UserCache.getUser(directOpId); - User user1 = UserCache.getUser(leadOpId); - if (user == null || user1 == null) { - throw new ServiceException("员工不存在,保存失败"); - } - Dept dept = SysCache.getDept(departId); - if (dept == null) { - throw new ServiceException("部门不存在,保存失败"); - } - } -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourcePostionWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourcePostionWrapper.java deleted file mode 100644 index 1056471..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourcePostionWrapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.safeproduct.wrapper; - -import com.hnac.hzims.safeproduct.entity.DangerSourcePositionEntity; -import com.hnac.hzims.safeproduct.vo.DangerSourcePositionVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; - -/** - * @author xiashandong - * @created 2020/9/1 15:45 - **/ -public class DangerSourcePostionWrapper extends BaseEntityWrapper { - - public static DangerSourcePostionWrapper build() { - return new DangerSourcePostionWrapper(); - } - - @Override - public DangerSourcePositionVO entityVO(DangerSourcePositionEntity entity) { - DangerSourcePositionVO vo = BeanUtil.copy(entity, DangerSourcePositionVO.class); - return vo; - } - -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourceWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourceWrapper.java deleted file mode 100644 index 6b5c776..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/DangerSourceWrapper.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hnac.hzims.safeproduct.wrapper; - -import com.hnac.hzims.safeproduct.constants.DictConstants; -import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; -import com.hnac.hzims.safeproduct.vo.DangerSourceVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.cache.DictCache; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -import java.util.Optional; - -/** - * @author xiashandong - * @created 2020/9/1 15:45 - **/ -public class DangerSourceWrapper extends BaseEntityWrapper { - - public static DangerSourceWrapper build() { - return new DangerSourceWrapper(); - } - - @Override - public DangerSourceVO entityVO(DangerSourceEntity entity) { - DangerSourceVO vo = BeanUtil.copy(entity, DangerSourceVO.class); - User createUser = UserCache.getUser(entity.getCreateUser()); - User updateUser = UserCache.getUser(entity.getUpdateUser()); - vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null)); - vo.setUpdateUserName(Optional.ofNullable(updateUser).map(User::getName).orElse(null)); - vo.setApplyTypeName(DictCache.getValue(DictConstants.SAFE_DANGER_SOURCE_APPLY_TYPE, entity.getApplyType())); - return vo; - } - -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/RiskHazardsScreeningWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/RiskHazardsScreeningWrapper.java new file mode 100644 index 0000000..3bdb225 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/wrapper/RiskHazardsScreeningWrapper.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.wrapper; + +import com.hnac.hzims.safeproduct.riskhazards.entity.RiskHazardsScreening; +import com.hnac.hzims.safeproduct.riskhazards.vo.RiskHazardsScreeningVo; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.system.cache.DictCache; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; + +import java.util.Optional; + +public class RiskHazardsScreeningWrapper extends BaseEntityWrapper { + + + public static RiskHazardsScreeningWrapper build() { + return new RiskHazardsScreeningWrapper(); + } + + @Override + public RiskHazardsScreeningVo entityVO(RiskHazardsScreening entity) { + RiskHazardsScreeningVo vo = BeanUtil.copy(entity, RiskHazardsScreeningVo.class); + User createUser = UserCache.getUser(entity.getCreateUser()); + vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null)); + String val=DictCache.getValue("casualty_accident",entity.getCasualtyAccident()); + vo.setCasualtyAccidentName(val); + return vo; + } + +} \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql b/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql index 8468d76..054a765 100644 --- a/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql +++ b/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql @@ -363,4 +363,32 @@ CREATE TABLE `hzims_device` ( `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='特种设备表' ROW_FORMAT=Dynamic; \ No newline at end of file +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='特种设备表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_hazard_library` ( + `ID` bigint(20) NOT NULL, + `STATION_TYPE` TINYINT(4) NOT NULL COMMENT '站点类型', + `STATION_TYPE_NAME` varchar(25) NOT NULL COMMENT '站点类型名称', + `NAME` varchar(255) NOT NULL COMMENT '危险源名称', + `POSITION` varchar(255) COMMENT '所在部位', + `DANGER_ELE` varchar(255) NOT NULL COMMENT '危险因素', + `CAUSE` text NOT NULL COMMENT '可能导致的事故', + `MEASURES` text COMMENT '措施', + `LEVEL` tinyint(4) NOT NULL COMMENT '风险等级', + `TYPE` tinyint(4) NOT NULL COMMENT '危险源类型', + `STATUS` tinyint(4) DEFAULT NULL COMMENT '业务状态', + `TENANT_ID` varchar(12) NOT NULL COMMENT '租户ID', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建单位', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '修改人', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '修改时间', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='危险源库'; + +alter table `hzims_safe_danger_source` add column `ref_dept` bigint(20) NOT NULL comment '所属机构'; +alter table `hzims_safe_danger_source` add column `ref_dept_name` varchar(100) comment '所属机构名称'; +alter table `hzims_safe_danger_source` add column `library_id` bigint(20) comment '危险源库ID'; +alter table `hzims_safe_danger_source` add column `em_code` varchar(50) comment '设备编号'; +alter table `hzims_safe_danger_source` add column `em_name` varchar(100) comment '设备名称'; \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9997f99..911dbde 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ 5.0.1.RELEASE + 5.0.3-SNAPSHOT 5.1.0.RELEASE @@ -62,7 +63,7 @@ org.springblade blade-flow-api - ${bladex.project.version} + ${bladex.flow.version} org.springblade