From 137d008bd9b7d932160436a3a560b24512f6d1db Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期一, 13 一月 2025 14:54:13 +0800 Subject: [PATCH] DNC平移航宇救生 初始化 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocRelative.java | 40 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonCode.java | 43 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/UcenterCode.java | 67 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/SM3Util.java | 133 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceCharactersMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java | 148 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/ComponentExt.java | 70 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ProcessStreamRequest.java | 12 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupMapper.java | 43 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java | 45 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/UserDepartExt.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java | 58 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/PartsInfoController.java | 56 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java | 81 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/FileOperateMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComparisonFilesResponse.java | 11 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceCharactersServiceImpl.java | 38 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java | 1520 +++ lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java | 41 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/NcTxtFilePathInfo.java | 40 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ISynchronizedFlagService.java | 21 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/MultilevelDictionaryRequest.java | 14 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java | 46 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentUser.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java | 25 lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java | 9 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java | 47 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessInfoService.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java | 102 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java | 60 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/MultilevelDictionaryRequest.java | 14 lxzn-module-activiti/pom.xml | 49 lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml | 56 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java | 40 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java | 55 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsInfo.java | 65 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IFileOperateService.java | 20 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java | 42 lxzn-module-system/lxzn-system-start/pom.xml | 18 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ButtonCode.java | 58 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/MenuCode.java | 58 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java | 19 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java | 549 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java | 106 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java | 23 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionStreamMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileZipUtil.java | 95 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java | 174 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/DocVersionUtil.java | 48 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java | 117 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsPermission.java | 34 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java | 46 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DocumentCode.java | 75 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MdcPassLogMapper.xml | 9 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCast.java | 15 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java | 7 lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java | 301 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java | 65 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentMapper.java | 53 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocFileController.java | 119 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/TelnetUtil.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java | 40 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessInfo.java | 43 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DepartmentMapper.xml | 86 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java | 79 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocClassificationMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupDepartMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/SingleDictionaryRequest.java | 13 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java | 60 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocClassification.java | 38 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml | 53 lxzn-module-dnc/pom.xml | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileOperateServiceImpl.java | 38 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java | 54 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentPermissionService.java | 63 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java | 25 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ComponentInfoController.java | 68 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCatch.java | 77 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java | 72 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocFileService.java | 52 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentExt.java | 23 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java | 209 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java | 50 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java | 119 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/SynchronizedFlagServiceImpl.java | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentInfo.java | 70 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DeviceCharactersRequest.java | 21 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentPermissionMapper.java | 25 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java | 18 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceCharactersService.java | 19 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonGenericTree.java | 142 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java | 802 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResultCode.java | 18 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsDepartment.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java | 71 lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java | 3541 +++++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java | 16 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java | 54 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml | 182 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DeviceGroupExt.java | 47 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocFileMapper.java | 15 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java | 25 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessInfoMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java | 13 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceCharactersController.java | 92 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentPermission.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DepartmentTreeWrapper.java | 54 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java | 154 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java | 31 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java | 102 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java | 11 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPermissionServiceImpl.java | 104 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoQueryRequest.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java | 61 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentInfoMapper.java | 41 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java | 47 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessStreamController.java | 80 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiDefinitionCode.java | 53 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocInfoService.java | 232 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java | 67 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java | 289 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupPermissionService.java | 53 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/date/DateUtil.java | 145 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java | 37 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocClassificationServiceImpl.java | 44 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductPermissionMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java | 106 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupDepart.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java | 158 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceGroupTreeWrapper.java | 117 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryPageResponseResult.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupPermission.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/AuthCode.java | 62 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileUtilS.java | 1011 ++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/SynchronizedFlagMapper.java | 14 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocInfoController.java | 197 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java | 82 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceInfoMapper.xml | 23 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProductInfoCode.java | 64 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java | 148 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java | 151 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentPermissionMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java | 74 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/FileClient.java | 237 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java | 102 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartApproveUserMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceGroupCode.java | 59 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionMapper.java | 23 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml | 31 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java | 255 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessInfoServiceImpl.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductPermission.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupPermissionMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java | 11 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/Department.java | 43 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductDepartment.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/SynchronizedFlag.java | 23 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java | 21 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroup.java | 44 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComponentInfoCode.java | 65 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocInfoMapper.java | 69 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/CommonConstant.java | 526 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java | 159 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartApproveUser.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceTreeWrapper.java | 94 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SingleDictionaryRequest.java | 13 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsPermissionMapper.java | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DevicePermissionMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/CustomException.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsPermissionService.java | 63 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ObjectCode.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ButtonRequest.java | 13 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionStreamServiceImpl.java | 143 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupPermissionMapper.java | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionServiceImpl.java | 70 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java | 60 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DataResponseResult.java | 20 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocClassificationService.java | 21 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/RoleCode.java | 56 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java | 12 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductPermissionMapper.java | 26 lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java | 1274 ++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocFileMapper.xml | 10 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsInfoMapper.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java | 36 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupMapper.xml | 112 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResponseResult.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/Response.java | 9 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentUserMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/ValidateUtil.java | 39 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocFileQueryRequest.java | 19 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java | 530 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductPermissionService.java | 53 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoUploadRequest.java | 12 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java | 45 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DepartmentRequest.java | 14 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductInfo.java | 43 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceInfoMapper.java | 16 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/FileOperate.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductInfoMapper.java | 16 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml | 136 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java | 94 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/SyslogClient.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/NcLogInfoRequest.java | 30 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java | 112 lxzn-module-system/lxzn-system-start/src/main/resources/processes/assign_nc_to_device.bpmn | 61 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermission.java | 29 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPermissionServiceImpl.java | 112 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java | 68 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentDepartment.java | 34 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java | 59 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsPermissionMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileNumUtil.java | 97 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DepartmentCode.java | 61 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryListResponseResult.java | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermissionStream.java | 40 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/SysLogMessageDto.java | 44 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocFile.java | 49 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java | 58 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 892 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ComponentTreeWrapper.java | 93 lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java | 212 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SysLogTypeObjectDto.java | 54 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceCode.java | 61 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java | 31 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessController.java | 61 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupDepartMapper.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java | 50 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonJsonTree.java | 68 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionService.java | 53 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceInfoService.java | 149 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java | 580 + lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java | 273 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml | 21 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml | 123 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java | 351 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionStreamService.java | 107 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java | 62 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java | 211 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java | 278 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java | 7 /dev/null | 8 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java | 31 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceInfo.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java | 226 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocClassificationController.java | 36 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java | 62 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java | 488 + lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java | 15 277 files changed, 27,284 insertions(+), 14 deletions(-) diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java index 87c7bf5..10a77f0 100644 --- a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java @@ -103,6 +103,47 @@ .groupName("MDC"); } + /** + * swagger2鐨勯厤缃枃浠讹紝杩欓噷鍙互閰嶇疆swagger2鐨勪竴浜涘熀鏈殑鍐呭锛屾瘮濡傛壂鎻忕殑鍖呯瓑绛� 锛圖NC锛� + * + * @return Docket + */ + @Bean(value = "defaultApiDnc") + public Docket defaultApi3() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //姝ゅ寘璺緞涓嬬殑绫伙紝鎵嶇敓鎴愭帴鍙f枃妗� + .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.dnc")) + //鍔犱簡ApiOperation娉ㄨВ鐨勭被锛屾墠鐢熸垚鎺ュ彛鏂囨。 + .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build() + .securitySchemes(Collections.singletonList(securityScheme())) + .securityContexts(securityContexts()) + .globalOperationParameters(setHeaderToken()) + .groupName("DNC"); + } + + @Bean(value = "defaultApiAct") + public Docket activitiApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //姝ゅ寘璺緞涓嬬殑绫伙紝鎵嶇敓鎴愭帴鍙f枃妗� + .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.activiti")) + //鍔犱簡ApiOperation娉ㄨВ鐨勭被锛屾墠鐢熸垚鎺ュ彛鏂囨。 + .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build() + .securitySchemes(Collections.singletonList(securityScheme())) + .securityContexts(securityContexts()) + .globalOperationParameters(setHeaderToken()) + .groupName("Activiti妯″潡"); + } + /*** * oauth2閰嶇疆 * 闇�瑕佸鍔爏wagger鎺堟潈鍥炶皟鍦板潃 diff --git a/lxzn-module-activiti/pom.xml b/lxzn-module-activiti/pom.xml new file mode 100644 index 0000000..f837685 --- /dev/null +++ b/lxzn-module-activiti/pom.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>lxzn-boot-parent</artifactId> + <groupId>org.jeecgframework.boot</groupId> + <version>3.4.3</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>lxzn-module-activiti</artifactId> + + <dependencies> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-boot-base-core</artifactId> + </dependency> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-system-biz</artifactId> + </dependency> + + <!--activiti 娴佺▼寮曟搸--> + <dependency> + <groupId>org.activiti</groupId> + <artifactId>activiti-spring-boot-starter-basic</artifactId> + <version>6.0.0</version> + <exclusions> + <exclusion> + <groupId>org.mybatis</groupId> + <artifactId>mybatis</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.mail</groupId> + <artifactId>javax.mail</artifactId> + </exclusion> + </exclusions> + </dependency> + <!--activiti 娴佺▼寮曟搸--> + + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>5.3.8</version> + </dependency> + </dependencies> + +</project> diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java new file mode 100644 index 0000000..aa5c5e4 --- /dev/null +++ b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java @@ -0,0 +1,212 @@ +package org.activiti.engine.impl; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +import org.activiti.engine.ActivitiException; +import org.activiti.engine.ActivitiIllegalArgumentException; +import org.activiti.engine.ManagementService; +import org.activiti.engine.impl.context.Context; +import org.activiti.engine.impl.db.ListQueryParameterObject; +import org.activiti.engine.impl.interceptor.Command; +import org.activiti.engine.impl.interceptor.CommandContext; +import org.activiti.engine.impl.interceptor.CommandExecutor; +import org.activiti.engine.query.Query; +import org.activiti.engine.query.QueryProperty; + +import java.io.Serializable; +import java.util.List; + +public abstract class AbstractQuery<T extends Query<?, ?>, U> extends ListQueryParameterObject implements Command<Object>, Query<T, U>, Serializable { + private static final long serialVersionUID = 1L; + public static final String SORTORDER_ASC = "asc"; + public static final String SORTORDER_DESC = "desc"; + protected transient CommandExecutor commandExecutor; + protected transient CommandContext commandContext; + protected String databaseType; + protected String orderBy; + protected ResultType resultType; + protected QueryProperty orderProperty; + protected NullHandlingOnOrder nullHandlingOnOrder; + + protected AbstractQuery() { + this.parameter = this; + } + + protected AbstractQuery(CommandExecutor commandExecutor) { + this.commandExecutor = commandExecutor; + } + + public AbstractQuery(CommandContext commandContext) { + this.commandContext = commandContext; + } + + public AbstractQuery(ManagementService managementService) { + this(((ManagementServiceImpl)managementService).getCommandExecutor()); + } + + public AbstractQuery<T, U> setCommandExecutor(CommandExecutor commandExecutor) { + this.commandExecutor = commandExecutor; + return this; + } + + public T orderBy(QueryProperty property) { + this.orderProperty = property; + return (T) this; + } + + public T orderBy(QueryProperty property, NullHandlingOnOrder nullHandlingOnOrder) { + this.orderBy(property); + this.nullHandlingOnOrder = nullHandlingOnOrder; + return (T) this; + } + + public T asc() { + return this.direction(Direction.ASCENDING); + } + + public T desc() { + return this.direction(Direction.DESCENDING); + } + + public T direction(Direction direction) { + if (this.orderProperty == null) { + throw new ActivitiIllegalArgumentException("You should call any of the orderBy methods first before specifying a direction"); + } else { + this.addOrder(this.orderProperty.getName(), direction.getName(), this.nullHandlingOnOrder); + this.orderProperty = null; + this.nullHandlingOnOrder = null; + return (T) this; + } + } + + protected void checkQueryOk() { + if (this.orderProperty != null) { + throw new ActivitiIllegalArgumentException("Invalid query: call asc() or desc() after using orderByXX()"); + } + } + + public U singleResult() { + this.resultType = ResultType.SINGLE_RESULT; + return this.commandExecutor != null ? (U) this.commandExecutor.execute(this) : this.executeSingleResult(Context.getCommandContext()); + } + + public List<U> list() { + this.resultType = ResultType.LIST; + return this.commandExecutor != null ? (List)this.commandExecutor.execute(this) : this.executeList(Context.getCommandContext(), (Page)null); + } + + public List<U> listPage(int firstResult, int maxResults) { + this.firstResult = firstResult; + this.maxResults = maxResults; + this.resultType = ResultType.LIST_PAGE; + return this.commandExecutor != null ? (List)this.commandExecutor.execute(this) : this.executeList(Context.getCommandContext(), new Page(firstResult, maxResults)); + } + + public long count() { + this.resultType = ResultType.COUNT; + return this.commandExecutor != null ? (Long)this.commandExecutor.execute(this) : this.executeCount(Context.getCommandContext()); + } + + public Object execute(CommandContext commandContext) { + if (this.resultType == ResultType.LIST) { + return this.executeList(commandContext, (Page)null); + } else if (this.resultType == ResultType.SINGLE_RESULT) { + return this.executeSingleResult(commandContext); + } else { + return this.resultType == ResultType.LIST_PAGE ? this.executeList(commandContext, (Page)null) : this.executeCount(commandContext); + } + } + + public abstract long executeCount(CommandContext var1); + + public abstract List<U> executeList(CommandContext var1, Page var2); + + public U executeSingleResult(CommandContext commandContext) { + List<U> results = this.executeList(commandContext, (Page)null); + if (results.size() == 1) { + return results.get(0); + } else if (results.size() > 1) { + throw new ActivitiException("Query return " + results.size() + " results instead of max 1"); + } else { + return null; + } + } + + protected void addOrder(String column, String sortOrder, NullHandlingOnOrder nullHandlingOnOrder) { + if (this.orderBy == null) { + this.orderBy = ""; + } else { + this.orderBy = this.orderBy + ", "; + } + + String defaultOrderByClause = column + " " + sortOrder; + if (nullHandlingOnOrder != null) { + if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_FIRST)) { + if (!"h2".equals(this.databaseType) && !"hsql".equals(this.databaseType) && !"postgres".equals(this.databaseType) && !"oracle".equals(this.databaseType)) { + if ("mysql".equals(this.databaseType)) { + this.orderBy = this.orderBy + "isnull(" + column + ") desc," + defaultOrderByClause; + } else if (!"db2".equals(this.databaseType) && !"mssql".equals(this.databaseType)) { + this.orderBy = this.orderBy + defaultOrderByClause; + } else { + this.orderBy = this.orderBy + "case when " + column + " is null then 0 else 1 end," + defaultOrderByClause; + } + } else { + this.orderBy = this.orderBy + defaultOrderByClause + " NULLS FIRST"; + } + } else if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_LAST)) { + if (!"h2".equals(this.databaseType) && !"hsql".equals(this.databaseType) && !"postgres".equals(this.databaseType) && !"oracle".equals(this.databaseType)) { + if ("mysql".equals(this.databaseType)) { + this.orderBy = this.orderBy + "isnull(" + column + ") asc," + defaultOrderByClause; + } else if (!"db2".equals(this.databaseType) && !"mssql".equals(this.databaseType)) { + this.orderBy = this.orderBy + defaultOrderByClause; + } else { + this.orderBy = this.orderBy + "case when " + column + " is null then 1 else 0 end," + defaultOrderByClause; + } + } else { + this.orderBy = this.orderBy + column + " " + sortOrder + " NULLS LAST"; + } + } + } else { + this.orderBy = this.orderBy + defaultOrderByClause; + } + + } + + public String getOrderBy() { + return this.orderBy == null ? super.getOrderBy() : this.orderBy; + } + + public String getOrderByColumns() { + return this.getOrderBy(); + } + + public String getDatabaseType() { + return this.databaseType; + } + + public void setDatabaseType(String databaseType) { + this.databaseType = databaseType; + } + + public static enum NullHandlingOnOrder { + NULLS_FIRST, + NULLS_LAST; + + private NullHandlingOnOrder() { + } + } + + private static enum ResultType { + LIST, + LIST_PAGE, + SINGLE_RESULT, + COUNT; + + private ResultType() { + } + } +} + diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java new file mode 100644 index 0000000..c676ee7 --- /dev/null +++ b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java @@ -0,0 +1,3541 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package org.activiti.engine.impl.cfg; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.activiti.dmn.api.DmnRepositoryService; +import org.activiti.dmn.api.DmnRuleService; +import org.activiti.engine.*; +import org.activiti.engine.cfg.ProcessEngineConfigurator; +import org.activiti.engine.compatibility.Activiti5CompatibilityHandler; +import org.activiti.engine.compatibility.Activiti5CompatibilityHandlerFactory; +import org.activiti.engine.compatibility.DefaultActiviti5CompatibilityHandlerFactory; +import org.activiti.engine.delegate.event.ActivitiEventDispatcher; +import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.activiti.engine.delegate.event.ActivitiEventType; +import org.activiti.engine.delegate.event.impl.ActivitiEventDispatcherImpl; +import org.activiti.engine.form.AbstractFormType; +import org.activiti.engine.impl.*; +import org.activiti.engine.impl.agenda.DefaultActivitiEngineAgendaFactory; +import org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor; +import org.activiti.engine.impl.asyncexecutor.DefaultJobManager; +import org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnableFactory; +import org.activiti.engine.impl.asyncexecutor.JobManager; +import org.activiti.engine.impl.bpmn.data.ItemInstance; +import org.activiti.engine.impl.bpmn.deployer.*; +import org.activiti.engine.impl.bpmn.listener.ListenerNotificationHelper; +import org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers; +import org.activiti.engine.impl.bpmn.parser.BpmnParser; +import org.activiti.engine.impl.bpmn.parser.factory.*; +import org.activiti.engine.impl.bpmn.parser.handler.*; +import org.activiti.engine.impl.bpmn.webservice.MessageInstance; +import org.activiti.engine.impl.calendar.*; +import org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContextFactory; +import org.activiti.engine.impl.cmd.ValidateExecutionRelatedEntityCountCfgCmd; +import org.activiti.engine.impl.context.Context; +import org.activiti.engine.impl.db.DbIdGenerator; +import org.activiti.engine.impl.db.DbSqlSessionFactory; +import org.activiti.engine.impl.db.IbatisVariableTypeHandler; +import org.activiti.engine.impl.delegate.invocation.DefaultDelegateInterceptor; +import org.activiti.engine.impl.el.ExpressionManager; +import org.activiti.engine.impl.event.CompensationEventHandler; +import org.activiti.engine.impl.event.EventHandler; +import org.activiti.engine.impl.event.MessageEventHandler; +import org.activiti.engine.impl.event.SignalEventHandler; +import org.activiti.engine.impl.event.logger.EventLogger; +import org.activiti.engine.impl.form.*; +import org.activiti.engine.impl.history.DefaultHistoryManager; +import org.activiti.engine.impl.history.HistoryLevel; +import org.activiti.engine.impl.history.HistoryManager; +import org.activiti.engine.impl.interceptor.*; +import org.activiti.engine.impl.jobexecutor.*; +import org.activiti.engine.impl.persistence.GenericManagerFactory; +import org.activiti.engine.impl.persistence.cache.EntityCache; +import org.activiti.engine.impl.persistence.cache.EntityCacheImpl; +import org.activiti.engine.impl.persistence.deploy.*; +import org.activiti.engine.impl.persistence.entity.*; +import org.activiti.engine.impl.persistence.entity.data.*; +import org.activiti.engine.impl.persistence.entity.data.impl.*; +import org.activiti.engine.impl.scripting.*; +import org.activiti.engine.impl.util.DefaultClockImpl; +import org.activiti.engine.impl.util.IoUtil; +import org.activiti.engine.impl.util.ProcessInstanceHelper; +import org.activiti.engine.impl.util.ReflectUtil; +import org.activiti.engine.impl.variable.*; +import org.activiti.engine.parse.BpmnParseHandler; +import org.activiti.engine.runtime.Clock; +import org.activiti.form.api.FormRepositoryService; +import org.activiti.image.impl.DefaultProcessDiagramGenerator; +import org.activiti.validation.ProcessValidator; +import org.activiti.validation.ProcessValidatorFactory; +import org.apache.ibatis.builder.xml.XMLConfigBuilder; +import org.apache.ibatis.builder.xml.XMLMapperBuilder; +import org.apache.ibatis.datasource.pooled.PooledDataSource; +import org.apache.ibatis.mapping.Environment; +import org.apache.ibatis.session.Configuration; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory; +import org.apache.ibatis.transaction.TransactionFactory; +import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; +import org.apache.ibatis.transaction.managed.ManagedTransactionFactory; +import org.apache.ibatis.type.JdbcType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.naming.InitialContext; +import javax.sql.DataSource; +import javax.xml.namespace.QName; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.URL; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.util.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfiguration { + private static Logger log = LoggerFactory.getLogger(ProcessEngineConfigurationImpl.class); + public static final String DB_SCHEMA_UPDATE_CREATE = "create"; + public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create"; + public static final String DEFAULT_WS_SYNC_FACTORY = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; + public static final String DEFAULT_MYBATIS_MAPPING_FILE = "org/activiti/db/mapping/mappings.xml"; + public static final int DEFAULT_GENERIC_MAX_LENGTH_STRING = 4000; + public static final int DEFAULT_ORACLE_MAX_LENGTH_STRING = 2000; + protected RepositoryService repositoryService = new RepositoryServiceImpl(); + protected RuntimeService runtimeService = new RuntimeServiceImpl(); + protected HistoryService historyService = new HistoryServiceImpl(this); + protected IdentityService identityService = new IdentityServiceImpl(); + protected TaskService taskService = new TaskServiceImpl(this); + protected FormService formService = new FormServiceImpl(); + protected ManagementService managementService = new ManagementServiceImpl(); + protected DynamicBpmnService dynamicBpmnService = new DynamicBpmnServiceImpl(this); + protected boolean formEngineInitialized; + protected FormRepositoryService formEngineRepositoryService; + protected org.activiti.form.api.FormService formEngineFormService; + protected boolean dmnEngineInitialized; + protected DmnRepositoryService dmnEngineRepositoryService; + protected DmnRuleService dmnEngineRuleService; + protected CommandConfig defaultCommandConfig; + protected CommandConfig schemaCommandConfig; + protected CommandInterceptor commandInvoker; + protected List<CommandInterceptor> customPreCommandInterceptors; + protected List<CommandInterceptor> customPostCommandInterceptors; + protected List<CommandInterceptor> commandInterceptors; + protected CommandExecutor commandExecutor; + protected AttachmentDataManager attachmentDataManager; + protected ByteArrayDataManager byteArrayDataManager; + protected CommentDataManager commentDataManager; + protected DeploymentDataManager deploymentDataManager; + protected EventLogEntryDataManager eventLogEntryDataManager; + protected EventSubscriptionDataManager eventSubscriptionDataManager; + protected ExecutionDataManager executionDataManager; + protected GroupDataManager groupDataManager; + protected HistoricActivityInstanceDataManager historicActivityInstanceDataManager; + protected HistoricDetailDataManager historicDetailDataManager; + protected HistoricIdentityLinkDataManager historicIdentityLinkDataManager; + protected HistoricProcessInstanceDataManager historicProcessInstanceDataManager; + protected HistoricTaskInstanceDataManager historicTaskInstanceDataManager; + protected HistoricVariableInstanceDataManager historicVariableInstanceDataManager; + protected IdentityInfoDataManager identityInfoDataManager; + protected IdentityLinkDataManager identityLinkDataManager; + protected JobDataManager jobDataManager; + protected TimerJobDataManager timerJobDataManager; + protected SuspendedJobDataManager suspendedJobDataManager; + protected DeadLetterJobDataManager deadLetterJobDataManager; + protected MembershipDataManager membershipDataManager; + protected ModelDataManager modelDataManager; + protected ProcessDefinitionDataManager processDefinitionDataManager; + protected ProcessDefinitionInfoDataManager processDefinitionInfoDataManager; + protected PropertyDataManager propertyDataManager; + protected ResourceDataManager resourceDataManager; + protected TaskDataManager taskDataManager; + protected UserDataManager userDataManager; + protected VariableInstanceDataManager variableInstanceDataManager; + protected AttachmentEntityManager attachmentEntityManager; + protected ByteArrayEntityManager byteArrayEntityManager; + protected CommentEntityManager commentEntityManager; + protected DeploymentEntityManager deploymentEntityManager; + protected EventLogEntryEntityManager eventLogEntryEntityManager; + protected EventSubscriptionEntityManager eventSubscriptionEntityManager; + protected ExecutionEntityManager executionEntityManager; + protected GroupEntityManager groupEntityManager; + protected HistoricActivityInstanceEntityManager historicActivityInstanceEntityManager; + protected HistoricDetailEntityManager historicDetailEntityManager; + protected HistoricIdentityLinkEntityManager historicIdentityLinkEntityManager; + protected HistoricProcessInstanceEntityManager historicProcessInstanceEntityManager; + protected HistoricTaskInstanceEntityManager historicTaskInstanceEntityManager; + protected HistoricVariableInstanceEntityManager historicVariableInstanceEntityManager; + protected IdentityInfoEntityManager identityInfoEntityManager; + protected IdentityLinkEntityManager identityLinkEntityManager; + protected JobEntityManager jobEntityManager; + protected TimerJobEntityManager timerJobEntityManager; + protected SuspendedJobEntityManager suspendedJobEntityManager; + protected DeadLetterJobEntityManager deadLetterJobEntityManager; + protected MembershipEntityManager membershipEntityManager; + protected ModelEntityManager modelEntityManager; + protected ProcessDefinitionEntityManager processDefinitionEntityManager; + protected ProcessDefinitionInfoEntityManager processDefinitionInfoEntityManager; + protected PropertyEntityManager propertyEntityManager; + protected ResourceEntityManager resourceEntityManager; + protected TableDataManager tableDataManager; + protected TaskEntityManager taskEntityManager; + protected UserEntityManager userEntityManager; + protected VariableInstanceEntityManager variableInstanceEntityManager; + protected HistoryManager historyManager; + protected JobManager jobManager; + protected List<SessionFactory> customSessionFactories; + protected DbSqlSessionFactory dbSqlSessionFactory; + protected Map<Class<?>, SessionFactory> sessionFactories; + protected boolean enableConfiguratorServiceLoader = true; + protected List<ProcessEngineConfigurator> configurators; + protected List<ProcessEngineConfigurator> allConfigurators; + protected BpmnDeployer bpmnDeployer; + protected BpmnParser bpmnParser; + protected ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory; + protected TimerManager timerManager; + protected EventSubscriptionManager eventSubscriptionManager; + protected BpmnDeploymentHelper bpmnDeploymentHelper; + protected CachingAndArtifactsManager cachingAndArtifactsManager; + protected ProcessDefinitionDiagramHelper processDefinitionDiagramHelper; + protected List<Deployer> customPreDeployers; + protected List<Deployer> customPostDeployers; + protected List<Deployer> deployers; + protected DeploymentManager deploymentManager; + protected int processDefinitionCacheLimit = -1; + protected DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache; + protected int processDefinitionInfoCacheLimit = -1; + protected ProcessDefinitionInfoCache processDefinitionInfoCache; + protected int knowledgeBaseCacheLimit = -1; + protected DeploymentCache<Object> knowledgeBaseCache; + protected List<JobHandler> customJobHandlers; + protected Map<String, JobHandler> jobHandlers; + protected ProcessInstanceHelper processInstanceHelper; + protected ListenerNotificationHelper listenerNotificationHelper; + protected int asyncExecutorNumberOfRetries = 3; + protected int asyncExecutorCorePoolSize = 2; + protected int asyncExecutorMaxPoolSize = 10; + protected long asyncExecutorThreadKeepAliveTime = 5000L; + protected int asyncExecutorThreadPoolQueueSize = 100; + protected BlockingQueue<Runnable> asyncExecutorThreadPoolQueue; + protected long asyncExecutorSecondsToWaitOnShutdown = 60L; + protected int asyncExecutorMaxTimerJobsPerAcquisition = 1; + protected int asyncExecutorMaxAsyncJobsDuePerAcquisition = 1; + protected int asyncExecutorDefaultTimerJobAcquireWaitTime = 10000; + protected int asyncExecutorDefaultAsyncJobAcquireWaitTime = 10000; + protected int asyncExecutorDefaultQueueSizeFullWaitTime = 0; + protected String asyncExecutorLockOwner; + protected int asyncExecutorTimerLockTimeInMillis = 300000; + protected int asyncExecutorAsyncJobLockTimeInMillis = 300000; + protected int asyncExecutorResetExpiredJobsInterval = 60000; + protected int asyncExecutorResetExpiredJobsPageSize = 3; + protected boolean asyncExecutorMessageQueueMode; + protected ExecuteAsyncRunnableFactory asyncExecutorExecuteAsyncRunnableFactory; + protected SqlSessionFactory sqlSessionFactory; + protected TransactionFactory transactionFactory; + protected Set<Class<?>> customMybatisMappers; + protected Set<String> customMybatisXMLMappers; + protected IdGenerator idGenerator; + protected DataSource idGeneratorDataSource; + protected String idGeneratorDataSourceJndiName; + protected List<BpmnParseHandler> preBpmnParseHandlers; + protected List<BpmnParseHandler> postBpmnParseHandlers; + protected List<BpmnParseHandler> customDefaultBpmnParseHandlers; + protected ActivityBehaviorFactory activityBehaviorFactory; + protected ListenerFactory listenerFactory; + protected BpmnParseFactory bpmnParseFactory; + protected ProcessValidator processValidator; + protected List<FormEngine> customFormEngines; + protected Map<String, FormEngine> formEngines; + protected List<AbstractFormType> customFormTypes; + protected FormTypes formTypes; + protected List<VariableType> customPreVariableTypes; + protected List<VariableType> customPostVariableTypes; + protected VariableTypes variableTypes; + protected boolean serializableVariableTypeTrackDeserializedObjects = true; + protected ExpressionManager expressionManager; + protected List<String> customScriptingEngineClasses; + protected ScriptingEngines scriptingEngines; + protected List<ResolverFactory> resolverFactories; + protected BusinessCalendarManager businessCalendarManager; + protected int executionQueryLimit = 20000; + protected int taskQueryLimit = 20000; + protected int historicTaskQueryLimit = 20000; + protected int historicProcessInstancesQueryLimit = 20000; + protected String wsSyncFactoryClassName = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; + protected ConcurrentMap<QName, URL> wsOverridenEndpointAddresses = new ConcurrentHashMap(); + protected CommandContextFactory commandContextFactory; + protected TransactionContextFactory transactionContextFactory; + protected Map<Object, Object> beans; + protected DelegateInterceptor delegateInterceptor; + protected Map<String, EventHandler> eventHandlers; + protected List<EventHandler> customEventHandlers; + protected FailedJobCommandFactory failedJobCommandFactory; + protected boolean enableSafeBpmnXml; + protected int batchSizeProcessInstances = 25; + protected int batchSizeTasks = 25; + protected boolean enableEventDispatcher = true; + protected ActivitiEventDispatcher eventDispatcher; + protected List<ActivitiEventListener> eventListeners; + protected Map<String, List<ActivitiEventListener>> typedEventListeners; + protected boolean enableDatabaseEventLogging; + protected DelegateExpressionFieldInjectionMode delegateExpressionFieldInjectionMode; + protected int maxLengthStringVariableType; + protected boolean isBulkInsertEnabled; + protected int maxNrOfStatementsInBulkInsert; + public int DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER; + protected ObjectMapper objectMapper; + protected boolean usingRelationalDatabase; + protected boolean enableVerboseExecutionTreeLogging; + protected PerformanceSettings performanceSettings; + protected boolean isActiviti5CompatibilityEnabled; + protected Activiti5CompatibilityHandlerFactory activiti5CompatibilityHandlerFactory; + protected Activiti5CompatibilityHandler activiti5CompatibilityHandler; + protected Object activiti5ActivityBehaviorFactory; + protected Object activiti5ListenerFactory; + protected List<Object> activiti5PreBpmnParseHandlers; + protected List<Object> activiti5PostBpmnParseHandlers; + protected List<Object> activiti5CustomDefaultBpmnParseHandlers; + protected Set<Class<?>> activiti5CustomMybatisMappers; + protected Set<String> activiti5CustomMybatisXMLMappers; + protected static Properties databaseTypeMappings = getDefaultDatabaseTypeMappings(); + + public static final String DATABASE_TYPE_DM = "dm"; + public static final String DATABASE_TYPE_H2 = "h2"; + public static final String DATABASE_TYPE_HSQL = "hsql"; + public static final String DATABASE_TYPE_MYSQL = "mysql"; + public static final String DATABASE_TYPE_ORACLE = "oracle"; + public static final String DATABASE_TYPE_POSTGRES = "postgres"; + public static final String DATABASE_TYPE_MSSQL = "mssql"; + public static final String DATABASE_TYPE_DB2 = "db2"; + + public ProcessEngineConfigurationImpl() { + this.delegateExpressionFieldInjectionMode = DelegateExpressionFieldInjectionMode.MIXED; + this.maxLengthStringVariableType = -1; + this.isBulkInsertEnabled = true; + this.maxNrOfStatementsInBulkInsert = 100; + this.DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER = 70; + this.objectMapper = new ObjectMapper(); + this.usingRelationalDatabase = true; + this.performanceSettings = new PerformanceSettings(); + } + + public ProcessEngine buildProcessEngine() { + this.init(); + ProcessEngineImpl processEngine = new ProcessEngineImpl(this); + if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { + Context.setProcessEngineConfiguration(processEngine.getProcessEngineConfiguration()); + this.activiti5CompatibilityHandler.getRawProcessEngine(); + } + + this.postProcessEngineInitialisation(); + return processEngine; + } + + public void init() { + this.initConfigurators(); + this.configuratorsBeforeInit(); + this.initProcessDiagramGenerator(); + this.initHistoryLevel(); + this.initExpressionManager(); + if (this.usingRelationalDatabase) { + this.initDataSource(); + } + + this.initAgendaFactory(); + this.initHelpers(); + this.initVariableTypes(); + this.initBeans(); + this.initFormEngines(); + this.initFormTypes(); + this.initScriptingEngines(); + this.initClock(); + this.initBusinessCalendarManager(); + this.initCommandContextFactory(); + this.initTransactionContextFactory(); + this.initCommandExecutors(); + this.initServices(); + this.initIdGenerator(); + this.initBehaviorFactory(); + this.initListenerFactory(); + this.initBpmnParser(); + this.initProcessDefinitionCache(); + this.initProcessDefinitionInfoCache(); + this.initKnowledgeBaseCache(); + this.initJobHandlers(); + this.initJobManager(); + this.initAsyncExecutor(); + this.initTransactionFactory(); + if (this.usingRelationalDatabase) { + this.initSqlSessionFactory(); + } + + this.initSessionFactories(); + this.initDataManagers(); + this.initEntityManagers(); + this.initHistoryManager(); + this.initJpa(); + this.initDeployers(); + this.initDelegateInterceptor(); + this.initEventHandlers(); + this.initFailedJobCommandFactory(); + this.initEventDispatcher(); + this.initProcessValidator(); + this.initDatabaseEventLogging(); + this.initActiviti5CompatibilityHandler(); + this.configuratorsAfterInit(); + } + + public void initFailedJobCommandFactory() { + if (this.failedJobCommandFactory == null) { + this.failedJobCommandFactory = new DefaultFailedJobCommandFactory(); + } + + } + + public void initCommandExecutors() { + this.initDefaultCommandConfig(); + this.initSchemaCommandConfig(); + this.initCommandInvoker(); + this.initCommandInterceptors(); + this.initCommandExecutor(); + } + + public void initDefaultCommandConfig() { + if (this.defaultCommandConfig == null) { + this.defaultCommandConfig = new CommandConfig(); + } + + } + + public void initSchemaCommandConfig() { + if (this.schemaCommandConfig == null) { + this.schemaCommandConfig = (new CommandConfig()).transactionNotSupported(); + } + + } + + public void initCommandInvoker() { + if (this.commandInvoker == null) { + if (this.enableVerboseExecutionTreeLogging) { + this.commandInvoker = new DebugCommandInvoker(); + } else { + this.commandInvoker = new CommandInvoker(); + } + } + + } + + public void initCommandInterceptors() { + if (this.commandInterceptors == null) { + this.commandInterceptors = new ArrayList(); + if (this.customPreCommandInterceptors != null) { + this.commandInterceptors.addAll(this.customPreCommandInterceptors); + } + + this.commandInterceptors.addAll(this.getDefaultCommandInterceptors()); + if (this.customPostCommandInterceptors != null) { + this.commandInterceptors.addAll(this.customPostCommandInterceptors); + } + + this.commandInterceptors.add(this.commandInvoker); + } + + } + + public Collection<? extends CommandInterceptor> getDefaultCommandInterceptors() { + List<CommandInterceptor> interceptors = new ArrayList(); + interceptors.add(new LogInterceptor()); + CommandInterceptor transactionInterceptor = this.createTransactionInterceptor(); + if (transactionInterceptor != null) { + interceptors.add(transactionInterceptor); + } + + if (this.commandContextFactory != null) { + interceptors.add(new CommandContextInterceptor(this.commandContextFactory, this)); + } + + if (this.transactionContextFactory != null) { + interceptors.add(new TransactionContextInterceptor(this.transactionContextFactory)); + } + + return interceptors; + } + + public void initCommandExecutor() { + if (this.commandExecutor == null) { + CommandInterceptor first = this.initInterceptorChain(this.commandInterceptors); + this.commandExecutor = new CommandExecutorImpl(this.getDefaultCommandConfig(), first); + } + + } + + public CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { + if (chain != null && !chain.isEmpty()) { + for(int i = 0; i < chain.size() - 1; ++i) { + ((CommandInterceptor)chain.get(i)).setNext((CommandInterceptor)chain.get(i + 1)); + } + + return (CommandInterceptor)chain.get(0); + } else { + throw new ActivitiException("invalid command interceptor chain configuration: " + chain); + } + } + + public abstract CommandInterceptor createTransactionInterceptor(); + + public void initServices() { + this.initService(this.repositoryService); + this.initService(this.runtimeService); + this.initService(this.historyService); + this.initService(this.identityService); + this.initService(this.taskService); + this.initService(this.formService); + this.initService(this.managementService); + this.initService(this.dynamicBpmnService); + } + + public void initService(Object service) { + if (service instanceof ServiceImpl) { + ((ServiceImpl)service).setCommandExecutor(this.commandExecutor); + } + + } + + public void initDataSource() { + if (this.dataSource == null) { + if (this.dataSourceJndiName != null) { + try { + this.dataSource = (DataSource)(new InitialContext()).lookup(this.dataSourceJndiName); + } catch (Exception var2) { + Exception e = var2; + throw new ActivitiException("couldn't lookup datasource from " + this.dataSourceJndiName + ": " + e.getMessage(), e); + } + } else if (this.jdbcUrl != null) { + if (this.jdbcDriver == null || this.jdbcUsername == null) { + throw new ActivitiException("DataSource or JDBC properties have to be specified in a process engine configuration"); + } + + log.debug("initializing datasource to db: {}", this.jdbcUrl); + PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), this.jdbcDriver, this.jdbcUrl, this.jdbcUsername, this.jdbcPassword); + if (this.jdbcMaxActiveConnections > 0) { + pooledDataSource.setPoolMaximumActiveConnections(this.jdbcMaxActiveConnections); + } + + if (this.jdbcMaxIdleConnections > 0) { + pooledDataSource.setPoolMaximumIdleConnections(this.jdbcMaxIdleConnections); + } + + if (this.jdbcMaxCheckoutTime > 0) { + pooledDataSource.setPoolMaximumCheckoutTime(this.jdbcMaxCheckoutTime); + } + + if (this.jdbcMaxWaitTime > 0) { + pooledDataSource.setPoolTimeToWait(this.jdbcMaxWaitTime); + } + + if (this.jdbcPingEnabled) { + pooledDataSource.setPoolPingEnabled(true); + if (this.jdbcPingQuery != null) { + pooledDataSource.setPoolPingQuery(this.jdbcPingQuery); + } + + pooledDataSource.setPoolPingConnectionsNotUsedFor(this.jdbcPingConnectionNotUsedFor); + } + + if (this.jdbcDefaultTransactionIsolationLevel > 0) { + pooledDataSource.setDefaultTransactionIsolationLevel(this.jdbcDefaultTransactionIsolationLevel); + } + + this.dataSource = pooledDataSource; + } + + if (this.dataSource instanceof PooledDataSource) { + ((PooledDataSource)this.dataSource).forceCloseAll(); + } + } + + if (this.databaseType == null) { + this.initDatabaseType(); + } + + } + + public static Properties getDefaultDatabaseTypeMappings() { + Properties databaseTypeMappings = new Properties(); + databaseTypeMappings.setProperty("dm", DATABASE_TYPE_DM); + databaseTypeMappings.setProperty("DM DBMS",DATABASE_TYPE_ORACLE); + databaseTypeMappings.setProperty("H2", "h2"); + databaseTypeMappings.setProperty("HSQL Database Engine", "hsql"); + databaseTypeMappings.setProperty("MySQL", "mysql"); + databaseTypeMappings.setProperty("Oracle", "oracle"); + databaseTypeMappings.setProperty("PostgreSQL", "postgres"); + databaseTypeMappings.setProperty("Microsoft SQL Server", "mssql"); + databaseTypeMappings.setProperty("db2", "db2"); + databaseTypeMappings.setProperty("DB2", "db2"); + databaseTypeMappings.setProperty("DB2/NT", "db2"); + databaseTypeMappings.setProperty("DB2/NT64", "db2"); + databaseTypeMappings.setProperty("DB2 UDP", "db2"); + databaseTypeMappings.setProperty("DB2/LINUX", "db2"); + databaseTypeMappings.setProperty("DB2/LINUX390", "db2"); + databaseTypeMappings.setProperty("DB2/LINUXX8664", "db2"); + databaseTypeMappings.setProperty("DB2/LINUXZ64", "db2"); + databaseTypeMappings.setProperty("DB2/LINUXPPC64", "db2"); + databaseTypeMappings.setProperty("DB2/LINUXPPC64LE", "db2"); + databaseTypeMappings.setProperty("DB2/400 SQL", "db2"); + databaseTypeMappings.setProperty("DB2/6000", "db2"); + databaseTypeMappings.setProperty("DB2 UDB iSeries", "db2"); + databaseTypeMappings.setProperty("DB2/AIX64", "db2"); + databaseTypeMappings.setProperty("DB2/HPUX", "db2"); + databaseTypeMappings.setProperty("DB2/HP64", "db2"); + databaseTypeMappings.setProperty("DB2/SUN", "db2"); + databaseTypeMappings.setProperty("DB2/SUN64", "db2"); + databaseTypeMappings.setProperty("DB2/PTX", "db2"); + databaseTypeMappings.setProperty("DB2/2", "db2"); + databaseTypeMappings.setProperty("DB2 UDB AS400", "db2"); + return databaseTypeMappings; + } + + public void initDatabaseType() { + Connection connection = null; + + try { + connection = this.dataSource.getConnection(); + DatabaseMetaData databaseMetaData = connection.getMetaData(); + String databaseProductName = databaseMetaData.getDatabaseProductName(); + log.debug("database product name: '{}'", databaseProductName); + this.databaseType = databaseTypeMappings.getProperty(databaseProductName); + if (this.databaseType == null) { + throw new ActivitiException("couldn't deduct database type from database product name '" + databaseProductName + "'"); + } + + log.debug("using database type: {}", this.databaseType); + if ("mssql".equals(this.databaseType)) { + this.maxNrOfStatementsInBulkInsert = this.DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER; + } + } catch (SQLException var12) { + SQLException e = var12; + log.error("Exception while initializing Database connection", e); + } finally { + try { + if (connection != null) { + connection.close(); + } + } catch (SQLException var11) { + SQLException e = var11; + log.error("Exception while closing the Database connection", e); + } + + } + + } + + public void initTransactionFactory() { + if (this.transactionFactory == null) { + if (this.transactionsExternallyManaged) { + this.transactionFactory = new ManagedTransactionFactory(); + } else { + this.transactionFactory = new JdbcTransactionFactory(); + } + } + + } + + public void initSqlSessionFactory() { + if (this.sqlSessionFactory == null) { + InputStream inputStream = null; + + try { + inputStream = this.getMyBatisXmlConfigurationStream(); + Environment environment = new Environment("default", this.transactionFactory, this.dataSource); + Reader reader = new InputStreamReader(inputStream); + Properties properties = new Properties(); + properties.put("prefix", this.databaseTablePrefix); + String wildcardEscapeClause = ""; + if (this.databaseWildcardEscapeCharacter != null && this.databaseWildcardEscapeCharacter.length() != 0) { + wildcardEscapeClause = " escape '" + this.databaseWildcardEscapeCharacter + "'"; + } + + properties.put("wildcardEscapeClause", wildcardEscapeClause); + properties.put("limitBefore", ""); + properties.put("limitAfter", ""); + properties.put("limitBetween", ""); + properties.put("limitOuterJoinBetween", ""); + properties.put("limitBeforeNativeQuery", ""); + properties.put("orderBy", "order by ${orderByColumns}"); + properties.put("blobType", "BLOB"); + properties.put("boolValue", "TRUE"); + if (this.databaseType != null) { + properties.load(this.getResourceAsStream("org/activiti/db/properties/" + this.databaseType + ".properties")); + } + + Configuration configuration = this.initMybatisConfiguration(environment, reader, properties); + this.sqlSessionFactory = new DefaultSqlSessionFactory(configuration); + } catch (Exception var10) { + Exception e = var10; + throw new ActivitiException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e); + } finally { + IoUtil.closeSilently(inputStream); + } + } + + } + + public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) { + XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties); + Configuration configuration = parser.getConfiguration(); + if (this.databaseType != null) { + configuration.setDatabaseId(this.databaseType); + } + + configuration.setEnvironment(environment); + this.initMybatisTypeHandlers(configuration); + this.initCustomMybatisMappers(configuration); + configuration = this.parseMybatisConfiguration(configuration, parser); + return configuration; + } + + public void initMybatisTypeHandlers(Configuration configuration) { + configuration.getTypeHandlerRegistry().register(VariableType.class, JdbcType.VARCHAR, new IbatisVariableTypeHandler()); + } + + public void initCustomMybatisMappers(Configuration configuration) { + if (this.getCustomMybatisMappers() != null) { + Iterator var2 = this.getCustomMybatisMappers().iterator(); + + while(var2.hasNext()) { + Class<?> clazz = (Class)var2.next(); + configuration.addMapper(clazz); + } + } + + } + + public Configuration parseMybatisConfiguration(Configuration configuration, XMLConfigBuilder parser) { + return this.parseCustomMybatisXMLMappers(parser.parse()); + } + + public Configuration parseCustomMybatisXMLMappers(Configuration configuration) { + if (this.getCustomMybatisXMLMappers() != null) { + Iterator var2 = this.getCustomMybatisXMLMappers().iterator(); + + while(var2.hasNext()) { + String resource = (String)var2.next(); + XMLMapperBuilder mapperParser = new XMLMapperBuilder(this.getResourceAsStream(resource), configuration, resource, configuration.getSqlFragments()); + mapperParser.parse(); + } + } + + return configuration; + } + + protected InputStream getResourceAsStream(String resource) { + return ReflectUtil.getResourceAsStream(resource); + } + + public InputStream getMyBatisXmlConfigurationStream() { + return this.getResourceAsStream("org/activiti/db/mapping/mappings.xml"); + } + + public Set<Class<?>> getCustomMybatisMappers() { + return this.customMybatisMappers; + } + + public void setCustomMybatisMappers(Set<Class<?>> customMybatisMappers) { + this.customMybatisMappers = customMybatisMappers; + } + + public Set<String> getCustomMybatisXMLMappers() { + return this.customMybatisXMLMappers; + } + + public void setCustomMybatisXMLMappers(Set<String> customMybatisXMLMappers) { + this.customMybatisXMLMappers = customMybatisXMLMappers; + } + + public void initDataManagers() { + if (this.attachmentDataManager == null) { + this.attachmentDataManager = new MybatisAttachmentDataManager(this); + } + + if (this.byteArrayDataManager == null) { + this.byteArrayDataManager = new MybatisByteArrayDataManager(this); + } + + if (this.commentDataManager == null) { + this.commentDataManager = new MybatisCommentDataManager(this); + } + + if (this.deploymentDataManager == null) { + this.deploymentDataManager = new MybatisDeploymentDataManager(this); + } + + if (this.eventLogEntryDataManager == null) { + this.eventLogEntryDataManager = new MybatisEventLogEntryDataManager(this); + } + + if (this.eventSubscriptionDataManager == null) { + this.eventSubscriptionDataManager = new MybatisEventSubscriptionDataManager(this); + } + + if (this.executionDataManager == null) { + this.executionDataManager = new MybatisExecutionDataManager(this); + } + + if (this.groupDataManager == null) { + this.groupDataManager = new MybatisGroupDataManager(this); + } + + if (this.historicActivityInstanceDataManager == null) { + this.historicActivityInstanceDataManager = new MybatisHistoricActivityInstanceDataManager(this); + } + + if (this.historicDetailDataManager == null) { + this.historicDetailDataManager = new MybatisHistoricDetailDataManager(this); + } + + if (this.historicIdentityLinkDataManager == null) { + this.historicIdentityLinkDataManager = new MybatisHistoricIdentityLinkDataManager(this); + } + + if (this.historicProcessInstanceDataManager == null) { + this.historicProcessInstanceDataManager = new MybatisHistoricProcessInstanceDataManager(this); + } + + if (this.historicTaskInstanceDataManager == null) { + this.historicTaskInstanceDataManager = new MybatisHistoricTaskInstanceDataManager(this); + } + + if (this.historicVariableInstanceDataManager == null) { + this.historicVariableInstanceDataManager = new MybatisHistoricVariableInstanceDataManager(this); + } + + if (this.identityInfoDataManager == null) { + this.identityInfoDataManager = new MybatisIdentityInfoDataManager(this); + } + + if (this.identityLinkDataManager == null) { + this.identityLinkDataManager = new MybatisIdentityLinkDataManager(this); + } + + if (this.jobDataManager == null) { + this.jobDataManager = new MybatisJobDataManager(this); + } + + if (this.timerJobDataManager == null) { + this.timerJobDataManager = new MybatisTimerJobDataManager(this); + } + + if (this.suspendedJobDataManager == null) { + this.suspendedJobDataManager = new MybatisSuspendedJobDataManager(this); + } + + if (this.deadLetterJobDataManager == null) { + this.deadLetterJobDataManager = new MybatisDeadLetterJobDataManager(this); + } + + if (this.membershipDataManager == null) { + this.membershipDataManager = new MybatisMembershipDataManager(this); + } + + if (this.modelDataManager == null) { + this.modelDataManager = new MybatisModelDataManager(this); + } + + if (this.processDefinitionDataManager == null) { + this.processDefinitionDataManager = new MybatisProcessDefinitionDataManager(this); + } + + if (this.processDefinitionInfoDataManager == null) { + this.processDefinitionInfoDataManager = new MybatisProcessDefinitionInfoDataManager(this); + } + + if (this.propertyDataManager == null) { + this.propertyDataManager = new MybatisPropertyDataManager(this); + } + + if (this.resourceDataManager == null) { + this.resourceDataManager = new MybatisResourceDataManager(this); + } + + if (this.taskDataManager == null) { + this.taskDataManager = new MybatisTaskDataManager(this); + } + + if (this.userDataManager == null) { + this.userDataManager = new MybatisUserDataManager(this); + } + + if (this.variableInstanceDataManager == null) { + this.variableInstanceDataManager = new MybatisVariableInstanceDataManager(this); + } + + } + + public void initEntityManagers() { + if (this.attachmentEntityManager == null) { + this.attachmentEntityManager = new AttachmentEntityManagerImpl(this, this.attachmentDataManager); + } + + if (this.byteArrayEntityManager == null) { + this.byteArrayEntityManager = new ByteArrayEntityManagerImpl(this, this.byteArrayDataManager); + } + + if (this.commentEntityManager == null) { + this.commentEntityManager = new CommentEntityManagerImpl(this, this.commentDataManager); + } + + if (this.deploymentEntityManager == null) { + this.deploymentEntityManager = new DeploymentEntityManagerImpl(this, this.deploymentDataManager); + } + + if (this.eventLogEntryEntityManager == null) { + this.eventLogEntryEntityManager = new EventLogEntryEntityManagerImpl(this, this.eventLogEntryDataManager); + } + + if (this.eventSubscriptionEntityManager == null) { + this.eventSubscriptionEntityManager = new EventSubscriptionEntityManagerImpl(this, this.eventSubscriptionDataManager); + } + + if (this.executionEntityManager == null) { + this.executionEntityManager = new ExecutionEntityManagerImpl(this, this.executionDataManager); + } + + if (this.groupEntityManager == null) { + this.groupEntityManager = new GroupEntityManagerImpl(this, this.groupDataManager); + } + + if (this.historicActivityInstanceEntityManager == null) { + this.historicActivityInstanceEntityManager = new HistoricActivityInstanceEntityManagerImpl(this, this.historicActivityInstanceDataManager); + } + + if (this.historicDetailEntityManager == null) { + this.historicDetailEntityManager = new HistoricDetailEntityManagerImpl(this, this.historicDetailDataManager); + } + + if (this.historicIdentityLinkEntityManager == null) { + this.historicIdentityLinkEntityManager = new HistoricIdentityLinkEntityManagerImpl(this, this.historicIdentityLinkDataManager); + } + + if (this.historicProcessInstanceEntityManager == null) { + this.historicProcessInstanceEntityManager = new HistoricProcessInstanceEntityManagerImpl(this, this.historicProcessInstanceDataManager); + } + + if (this.historicTaskInstanceEntityManager == null) { + this.historicTaskInstanceEntityManager = new HistoricTaskInstanceEntityManagerImpl(this, this.historicTaskInstanceDataManager); + } + + if (this.historicVariableInstanceEntityManager == null) { + this.historicVariableInstanceEntityManager = new HistoricVariableInstanceEntityManagerImpl(this, this.historicVariableInstanceDataManager); + } + + if (this.identityInfoEntityManager == null) { + this.identityInfoEntityManager = new IdentityInfoEntityManagerImpl(this, this.identityInfoDataManager); + } + + if (this.identityLinkEntityManager == null) { + this.identityLinkEntityManager = new IdentityLinkEntityManagerImpl(this, this.identityLinkDataManager); + } + + if (this.jobEntityManager == null) { + this.jobEntityManager = new JobEntityManagerImpl(this, this.jobDataManager); + } + + if (this.timerJobEntityManager == null) { + this.timerJobEntityManager = new TimerJobEntityManagerImpl(this, this.timerJobDataManager); + } + + if (this.suspendedJobEntityManager == null) { + this.suspendedJobEntityManager = new SuspendedJobEntityManagerImpl(this, this.suspendedJobDataManager); + } + + if (this.deadLetterJobEntityManager == null) { + this.deadLetterJobEntityManager = new DeadLetterJobEntityManagerImpl(this, this.deadLetterJobDataManager); + } + + if (this.membershipEntityManager == null) { + this.membershipEntityManager = new MembershipEntityManagerImpl(this, this.membershipDataManager); + } + + if (this.modelEntityManager == null) { + this.modelEntityManager = new ModelEntityManagerImpl(this, this.modelDataManager); + } + + if (this.processDefinitionEntityManager == null) { + this.processDefinitionEntityManager = new ProcessDefinitionEntityManagerImpl(this, this.processDefinitionDataManager); + } + + if (this.processDefinitionInfoEntityManager == null) { + this.processDefinitionInfoEntityManager = new ProcessDefinitionInfoEntityManagerImpl(this, this.processDefinitionInfoDataManager); + } + + if (this.propertyEntityManager == null) { + this.propertyEntityManager = new PropertyEntityManagerImpl(this, this.propertyDataManager); + } + + if (this.resourceEntityManager == null) { + this.resourceEntityManager = new ResourceEntityManagerImpl(this, this.resourceDataManager); + } + + if (this.tableDataManager == null) { + this.tableDataManager = new TableDataManagerImpl(this); + } + + if (this.taskEntityManager == null) { + this.taskEntityManager = new TaskEntityManagerImpl(this, this.taskDataManager); + } + + if (this.userEntityManager == null) { + this.userEntityManager = new UserEntityManagerImpl(this, this.userDataManager); + } + + if (this.variableInstanceEntityManager == null) { + this.variableInstanceEntityManager = new VariableInstanceEntityManagerImpl(this, this.variableInstanceDataManager); + } + + } + + public void initHistoryManager() { + if (this.historyManager == null) { + this.historyManager = new DefaultHistoryManager(this, this.historyLevel); + } + + } + + public void initJobManager() { + if (this.jobManager == null) { + this.jobManager = new DefaultJobManager(this); + } + + this.jobManager.setProcessEngineConfiguration(this); + } + + public void initSessionFactories() { + if (this.sessionFactories == null) { + this.sessionFactories = new HashMap(); + if (this.usingRelationalDatabase) { + this.initDbSqlSessionFactory(); + } + + this.addSessionFactory(new GenericManagerFactory(EntityCache.class, EntityCacheImpl.class)); + } + + if (this.customSessionFactories != null) { + Iterator var1 = this.customSessionFactories.iterator(); + + while(var1.hasNext()) { + SessionFactory sessionFactory = (SessionFactory)var1.next(); + this.addSessionFactory(sessionFactory); + } + } + + } + + public void initDbSqlSessionFactory() { + if (this.dbSqlSessionFactory == null) { + this.dbSqlSessionFactory = this.createDbSqlSessionFactory(); + } + + this.dbSqlSessionFactory.setDatabaseType(this.databaseType); + this.dbSqlSessionFactory.setIdGenerator(this.idGenerator); + this.dbSqlSessionFactory.setSqlSessionFactory(this.sqlSessionFactory); + this.dbSqlSessionFactory.setDbIdentityUsed(this.isDbIdentityUsed); + this.dbSqlSessionFactory.setDbHistoryUsed(this.isDbHistoryUsed); + this.dbSqlSessionFactory.setDatabaseTablePrefix(this.databaseTablePrefix); + this.dbSqlSessionFactory.setTablePrefixIsSchema(this.tablePrefixIsSchema); + this.dbSqlSessionFactory.setDatabaseCatalog(this.databaseCatalog); + this.dbSqlSessionFactory.setDatabaseSchema(this.databaseSchema); + this.dbSqlSessionFactory.setBulkInsertEnabled(this.isBulkInsertEnabled, this.databaseType); + this.dbSqlSessionFactory.setMaxNrOfStatementsInBulkInsert(this.maxNrOfStatementsInBulkInsert); + this.addSessionFactory(this.dbSqlSessionFactory); + } + + public DbSqlSessionFactory createDbSqlSessionFactory() { + return new DbSqlSessionFactory(); + } + + public void addSessionFactory(SessionFactory sessionFactory) { + this.sessionFactories.put(sessionFactory.getSessionType(), sessionFactory); + } + + public void initConfigurators() { + this.allConfigurators = new ArrayList(); + if (this.configurators != null) { + Iterator var1 = this.configurators.iterator(); + + while(var1.hasNext()) { + ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); + this.allConfigurators.add(configurator); + } + } + + if (this.enableConfiguratorServiceLoader) { + ClassLoader classLoader = this.getClassLoader(); + if (classLoader == null) { + classLoader = ReflectUtil.getClassLoader(); + } + + ServiceLoader<ProcessEngineConfigurator> configuratorServiceLoader = ServiceLoader.load(ProcessEngineConfigurator.class, classLoader); + int nrOfServiceLoadedConfigurators = 0; + + Iterator var4; + ProcessEngineConfigurator configurator; + for(var4 = configuratorServiceLoader.iterator(); var4.hasNext(); ++nrOfServiceLoadedConfigurators) { + configurator = (ProcessEngineConfigurator)var4.next(); + this.allConfigurators.add(configurator); + } + + if (nrOfServiceLoadedConfigurators > 0) { + log.info("Found {} auto-discoverable Process Engine Configurator{}", nrOfServiceLoadedConfigurators++, nrOfServiceLoadedConfigurators > 1 ? "s" : ""); + } + + if (!this.allConfigurators.isEmpty()) { + Collections.sort(this.allConfigurators, new Comparator<ProcessEngineConfigurator>() { + public int compare(ProcessEngineConfigurator configurator1, ProcessEngineConfigurator configurator2) { + int priority1 = configurator1.getPriority(); + int priority2 = configurator2.getPriority(); + if (priority1 < priority2) { + return -1; + } else { + return priority1 > priority2 ? 1 : 0; + } + } + }); + log.info("Found {} Process Engine Configurators in total:", this.allConfigurators.size()); + var4 = this.allConfigurators.iterator(); + + while(var4.hasNext()) { + configurator = (ProcessEngineConfigurator)var4.next(); + log.info("{} (priority:{})", configurator.getClass(), configurator.getPriority()); + } + } + } + + } + + public void configuratorsBeforeInit() { + Iterator var1 = this.allConfigurators.iterator(); + + while(var1.hasNext()) { + ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); + log.info("Executing beforeInit() of {} (priority:{})", configurator.getClass(), configurator.getPriority()); + configurator.beforeInit(this); + } + + } + + public void configuratorsAfterInit() { + Iterator var1 = this.allConfigurators.iterator(); + + while(var1.hasNext()) { + ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); + log.info("Executing configure() of {} (priority:{})", configurator.getClass(), configurator.getPriority()); + configurator.configure(this); + } + + } + + public void initProcessDefinitionCache() { + if (this.processDefinitionCache == null) { + if (this.processDefinitionCacheLimit <= 0) { + this.processDefinitionCache = new DefaultDeploymentCache(); + } else { + this.processDefinitionCache = new DefaultDeploymentCache(this.processDefinitionCacheLimit); + } + } + + } + + public void initProcessDefinitionInfoCache() { + if (this.processDefinitionInfoCache == null) { + if (this.processDefinitionInfoCacheLimit <= 0) { + this.processDefinitionInfoCache = new ProcessDefinitionInfoCache(this.commandExecutor); + } else { + this.processDefinitionInfoCache = new ProcessDefinitionInfoCache(this.commandExecutor, this.processDefinitionInfoCacheLimit); + } + } + + } + + public void initKnowledgeBaseCache() { + if (this.knowledgeBaseCache == null) { + if (this.knowledgeBaseCacheLimit <= 0) { + this.knowledgeBaseCache = new DefaultDeploymentCache(); + } else { + this.knowledgeBaseCache = new DefaultDeploymentCache(this.knowledgeBaseCacheLimit); + } + } + + } + + public void initDeployers() { + if (this.deployers == null) { + this.deployers = new ArrayList(); + if (this.customPreDeployers != null) { + this.deployers.addAll(this.customPreDeployers); + } + + this.deployers.addAll(this.getDefaultDeployers()); + if (this.customPostDeployers != null) { + this.deployers.addAll(this.customPostDeployers); + } + } + + if (this.deploymentManager == null) { + this.deploymentManager = new DeploymentManager(); + this.deploymentManager.setDeployers(this.deployers); + this.deploymentManager.setProcessDefinitionCache(this.processDefinitionCache); + this.deploymentManager.setProcessDefinitionInfoCache(this.processDefinitionInfoCache); + this.deploymentManager.setKnowledgeBaseCache(this.knowledgeBaseCache); + this.deploymentManager.setProcessEngineConfiguration(this); + this.deploymentManager.setProcessDefinitionEntityManager(this.processDefinitionEntityManager); + this.deploymentManager.setDeploymentEntityManager(this.deploymentEntityManager); + } + + } + + public void initBpmnDeployerDependencies() { + if (this.parsedDeploymentBuilderFactory == null) { + this.parsedDeploymentBuilderFactory = new ParsedDeploymentBuilderFactory(); + } + + if (this.parsedDeploymentBuilderFactory.getBpmnParser() == null) { + this.parsedDeploymentBuilderFactory.setBpmnParser(this.bpmnParser); + } + + if (this.timerManager == null) { + this.timerManager = new TimerManager(); + } + + if (this.eventSubscriptionManager == null) { + this.eventSubscriptionManager = new EventSubscriptionManager(); + } + + if (this.bpmnDeploymentHelper == null) { + this.bpmnDeploymentHelper = new BpmnDeploymentHelper(); + } + + if (this.bpmnDeploymentHelper.getTimerManager() == null) { + this.bpmnDeploymentHelper.setTimerManager(this.timerManager); + } + + if (this.bpmnDeploymentHelper.getEventSubscriptionManager() == null) { + this.bpmnDeploymentHelper.setEventSubscriptionManager(this.eventSubscriptionManager); + } + + if (this.cachingAndArtifactsManager == null) { + this.cachingAndArtifactsManager = new CachingAndArtifactsManager(); + } + + if (this.processDefinitionDiagramHelper == null) { + this.processDefinitionDiagramHelper = new ProcessDefinitionDiagramHelper(); + } + + } + + public Collection<? extends Deployer> getDefaultDeployers() { + List<Deployer> defaultDeployers = new ArrayList(); + if (this.bpmnDeployer == null) { + this.bpmnDeployer = new BpmnDeployer(); + } + + this.initBpmnDeployerDependencies(); + this.bpmnDeployer.setIdGenerator(this.idGenerator); + this.bpmnDeployer.setParsedDeploymentBuilderFactory(this.parsedDeploymentBuilderFactory); + this.bpmnDeployer.setBpmnDeploymentHelper(this.bpmnDeploymentHelper); + this.bpmnDeployer.setCachingAndArtifactsManager(this.cachingAndArtifactsManager); + this.bpmnDeployer.setProcessDefinitionDiagramHelper(this.processDefinitionDiagramHelper); + defaultDeployers.add(this.bpmnDeployer); + return defaultDeployers; + } + + public void initListenerFactory() { + if (this.listenerFactory == null) { + DefaultListenerFactory defaultListenerFactory = new DefaultListenerFactory(); + defaultListenerFactory.setExpressionManager(this.expressionManager); + this.listenerFactory = defaultListenerFactory; + } else if (this.listenerFactory instanceof AbstractBehaviorFactory && ((AbstractBehaviorFactory)this.listenerFactory).getExpressionManager() == null) { + ((AbstractBehaviorFactory)this.listenerFactory).setExpressionManager(this.expressionManager); + } + + } + + public void initBehaviorFactory() { + if (this.activityBehaviorFactory == null) { + DefaultActivityBehaviorFactory defaultActivityBehaviorFactory = new DefaultActivityBehaviorFactory(); + defaultActivityBehaviorFactory.setExpressionManager(this.expressionManager); + this.activityBehaviorFactory = defaultActivityBehaviorFactory; + } else if (this.activityBehaviorFactory instanceof AbstractBehaviorFactory && ((AbstractBehaviorFactory)this.activityBehaviorFactory).getExpressionManager() == null) { + ((AbstractBehaviorFactory)this.activityBehaviorFactory).setExpressionManager(this.expressionManager); + } + + } + + public void initBpmnParser() { + if (this.bpmnParser == null) { + this.bpmnParser = new BpmnParser(); + } + + if (this.bpmnParseFactory == null) { + this.bpmnParseFactory = new DefaultBpmnParseFactory(); + } + + this.bpmnParser.setBpmnParseFactory(this.bpmnParseFactory); + this.bpmnParser.setActivityBehaviorFactory(this.activityBehaviorFactory); + this.bpmnParser.setListenerFactory(this.listenerFactory); + List<BpmnParseHandler> parseHandlers = new ArrayList(); + if (this.getPreBpmnParseHandlers() != null) { + parseHandlers.addAll(this.getPreBpmnParseHandlers()); + } + + parseHandlers.addAll(this.getDefaultBpmnParseHandlers()); + if (this.getPostBpmnParseHandlers() != null) { + parseHandlers.addAll(this.getPostBpmnParseHandlers()); + } + + BpmnParseHandlers bpmnParseHandlers = new BpmnParseHandlers(); + bpmnParseHandlers.addHandlers(parseHandlers); + this.bpmnParser.setBpmnParserHandlers(bpmnParseHandlers); + } + + public List<BpmnParseHandler> getDefaultBpmnParseHandlers() { + List<BpmnParseHandler> bpmnParserHandlers = new ArrayList(); + bpmnParserHandlers.add(new BoundaryEventParseHandler()); + bpmnParserHandlers.add(new BusinessRuleParseHandler()); + bpmnParserHandlers.add(new CallActivityParseHandler()); + bpmnParserHandlers.add(new CancelEventDefinitionParseHandler()); + bpmnParserHandlers.add(new CompensateEventDefinitionParseHandler()); + bpmnParserHandlers.add(new EndEventParseHandler()); + bpmnParserHandlers.add(new ErrorEventDefinitionParseHandler()); + bpmnParserHandlers.add(new EventBasedGatewayParseHandler()); + bpmnParserHandlers.add(new ExclusiveGatewayParseHandler()); + bpmnParserHandlers.add(new InclusiveGatewayParseHandler()); + bpmnParserHandlers.add(new IntermediateCatchEventParseHandler()); + bpmnParserHandlers.add(new IntermediateThrowEventParseHandler()); + bpmnParserHandlers.add(new ManualTaskParseHandler()); + bpmnParserHandlers.add(new MessageEventDefinitionParseHandler()); + bpmnParserHandlers.add(new ParallelGatewayParseHandler()); + bpmnParserHandlers.add(new ProcessParseHandler()); + bpmnParserHandlers.add(new ReceiveTaskParseHandler()); + bpmnParserHandlers.add(new ScriptTaskParseHandler()); + bpmnParserHandlers.add(new SendTaskParseHandler()); + bpmnParserHandlers.add(new SequenceFlowParseHandler()); + bpmnParserHandlers.add(new ServiceTaskParseHandler()); + bpmnParserHandlers.add(new SignalEventDefinitionParseHandler()); + bpmnParserHandlers.add(new StartEventParseHandler()); + bpmnParserHandlers.add(new SubProcessParseHandler()); + bpmnParserHandlers.add(new EventSubProcessParseHandler()); + bpmnParserHandlers.add(new AdhocSubProcessParseHandler()); + bpmnParserHandlers.add(new TaskParseHandler()); + bpmnParserHandlers.add(new TimerEventDefinitionParseHandler()); + bpmnParserHandlers.add(new TransactionParseHandler()); + bpmnParserHandlers.add(new UserTaskParseHandler()); + if (this.customDefaultBpmnParseHandlers != null) { + Map<Class<?>, BpmnParseHandler> customParseHandlerMap = new HashMap(); + Iterator var3 = this.customDefaultBpmnParseHandlers.iterator(); + + BpmnParseHandler defaultBpmnParseHandler; + while(var3.hasNext()) { + defaultBpmnParseHandler = (BpmnParseHandler)var3.next(); + Iterator var5 = defaultBpmnParseHandler.getHandledTypes().iterator(); + + while(var5.hasNext()) { + Class<?> handledType = (Class)var5.next(); + customParseHandlerMap.put(handledType, defaultBpmnParseHandler); + } + } + + for(int i = 0; i < bpmnParserHandlers.size(); ++i) { + defaultBpmnParseHandler = (BpmnParseHandler)bpmnParserHandlers.get(i); + if (defaultBpmnParseHandler.getHandledTypes().size() != 1) { + StringBuilder supportedTypes = new StringBuilder(); + Iterator var12 = defaultBpmnParseHandler.getHandledTypes().iterator(); + + while(var12.hasNext()) { + Class<?> type = (Class)var12.next(); + supportedTypes.append(" ").append(type.getCanonicalName()).append(" "); + } + + throw new ActivitiException("The default BPMN parse handlers should only support one type, but " + defaultBpmnParseHandler.getClass() + " supports " + supportedTypes.toString() + ". This is likely a programmatic error"); + } + + Class<?> handledType = (Class)defaultBpmnParseHandler.getHandledTypes().iterator().next(); + if (customParseHandlerMap.containsKey(handledType)) { + BpmnParseHandler newBpmnParseHandler = (BpmnParseHandler)customParseHandlerMap.get(handledType); + log.info("Replacing default BpmnParseHandler " + defaultBpmnParseHandler.getClass().getName() + " with " + newBpmnParseHandler.getClass().getName()); + bpmnParserHandlers.set(i, newBpmnParseHandler); + } + } + } + + return bpmnParserHandlers; + } + + public void initClock() { + if (this.clock == null) { + this.clock = new DefaultClockImpl(); + } + + } + + public void initProcessDiagramGenerator() { + if (this.processDiagramGenerator == null) { + this.processDiagramGenerator = new DefaultProcessDiagramGenerator(); + } + + } + + public void initAgendaFactory() { + if (this.engineAgendaFactory == null) { + this.engineAgendaFactory = new DefaultActivitiEngineAgendaFactory(); + } + + } + + public void initJobHandlers() { + this.jobHandlers = new HashMap(); + AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler(); + this.jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler); + TriggerTimerEventJobHandler triggerTimerEventJobHandler = new TriggerTimerEventJobHandler(); + this.jobHandlers.put(triggerTimerEventJobHandler.getType(), triggerTimerEventJobHandler); + TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler(); + this.jobHandlers.put(timerStartEvent.getType(), timerStartEvent); + TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler(); + this.jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler); + TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler(); + this.jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler); + ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler(); + this.jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler); + if (this.getCustomJobHandlers() != null) { + Iterator var7 = this.getCustomJobHandlers().iterator(); + + while(var7.hasNext()) { + JobHandler customJobHandler = (JobHandler)var7.next(); + this.jobHandlers.put(customJobHandler.getType(), customJobHandler); + } + } + + } + + public void initAsyncExecutor() { + if (this.asyncExecutor == null) { + DefaultAsyncJobExecutor defaultAsyncExecutor = new DefaultAsyncJobExecutor(); + defaultAsyncExecutor.setMessageQueueMode(this.asyncExecutorMessageQueueMode); + defaultAsyncExecutor.setCorePoolSize(this.asyncExecutorCorePoolSize); + defaultAsyncExecutor.setMaxPoolSize(this.asyncExecutorMaxPoolSize); + defaultAsyncExecutor.setKeepAliveTime(this.asyncExecutorThreadKeepAliveTime); + if (this.asyncExecutorThreadPoolQueue != null) { + defaultAsyncExecutor.setThreadPoolQueue(this.asyncExecutorThreadPoolQueue); + } + + defaultAsyncExecutor.setQueueSize(this.asyncExecutorThreadPoolQueueSize); + defaultAsyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(this.asyncExecutorDefaultTimerJobAcquireWaitTime); + defaultAsyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(this.asyncExecutorDefaultAsyncJobAcquireWaitTime); + defaultAsyncExecutor.setDefaultQueueSizeFullWaitTimeInMillis(this.asyncExecutorDefaultQueueSizeFullWaitTime); + defaultAsyncExecutor.setTimerLockTimeInMillis(this.asyncExecutorTimerLockTimeInMillis); + defaultAsyncExecutor.setAsyncJobLockTimeInMillis(this.asyncExecutorAsyncJobLockTimeInMillis); + if (this.asyncExecutorLockOwner != null) { + defaultAsyncExecutor.setLockOwner(this.asyncExecutorLockOwner); + } + + defaultAsyncExecutor.setResetExpiredJobsInterval(this.asyncExecutorResetExpiredJobsInterval); + defaultAsyncExecutor.setResetExpiredJobsPageSize(this.asyncExecutorResetExpiredJobsPageSize); + defaultAsyncExecutor.setSecondsToWaitOnShutdown(this.asyncExecutorSecondsToWaitOnShutdown); + this.asyncExecutor = defaultAsyncExecutor; + } + + this.asyncExecutor.setProcessEngineConfiguration(this); + this.asyncExecutor.setAutoActivate(this.asyncExecutorActivate); + } + + public void initHistoryLevel() { + if (this.historyLevel == null) { + this.historyLevel = HistoryLevel.getHistoryLevelForKey(this.getHistory()); + } + + } + + public void initIdGenerator() { + if (this.idGenerator == null) { + CommandExecutor idGeneratorCommandExecutor = null; + StandaloneProcessEngineConfiguration processEngineConfiguration; + if (this.idGeneratorDataSource != null) { + processEngineConfiguration = new StandaloneProcessEngineConfiguration(); + processEngineConfiguration.setDataSource(this.idGeneratorDataSource); + processEngineConfiguration.setDatabaseSchemaUpdate("false"); + processEngineConfiguration.init(); + idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutor(); + } else if (this.idGeneratorDataSourceJndiName != null) { + processEngineConfiguration = new StandaloneProcessEngineConfiguration(); + processEngineConfiguration.setDataSourceJndiName(this.idGeneratorDataSourceJndiName); + processEngineConfiguration.setDatabaseSchemaUpdate("false"); + processEngineConfiguration.init(); + idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutor(); + } else { + idGeneratorCommandExecutor = this.getCommandExecutor(); + } + + DbIdGenerator dbIdGenerator = new DbIdGenerator(); + dbIdGenerator.setIdBlockSize(this.idBlockSize); + dbIdGenerator.setCommandExecutor(idGeneratorCommandExecutor); + dbIdGenerator.setCommandConfig(this.getDefaultCommandConfig().transactionRequiresNew()); + this.idGenerator = dbIdGenerator; + } + + } + + public void initCommandContextFactory() { + if (this.commandContextFactory == null) { + this.commandContextFactory = new CommandContextFactory(); + } + + this.commandContextFactory.setProcessEngineConfiguration(this); + } + + public void initTransactionContextFactory() { + if (this.transactionContextFactory == null) { + this.transactionContextFactory = new StandaloneMybatisTransactionContextFactory(); + } + + } + + public void initHelpers() { + if (this.processInstanceHelper == null) { + this.processInstanceHelper = new ProcessInstanceHelper(); + } + + if (this.listenerNotificationHelper == null) { + this.listenerNotificationHelper = new ListenerNotificationHelper(); + } + + } + + public void initVariableTypes() { + if (this.variableTypes == null) { + this.variableTypes = new DefaultVariableTypes(); + Iterator var1; + VariableType customVariableType; + if (this.customPreVariableTypes != null) { + var1 = this.customPreVariableTypes.iterator(); + + while(var1.hasNext()) { + customVariableType = (VariableType)var1.next(); + this.variableTypes.addType(customVariableType); + } + } + + this.variableTypes.addType(new NullType()); + this.variableTypes.addType(new StringType(this.getMaxLengthString())); + this.variableTypes.addType(new LongStringType(this.getMaxLengthString() + 1)); + this.variableTypes.addType(new BooleanType()); + this.variableTypes.addType(new ShortType()); + this.variableTypes.addType(new IntegerType()); + this.variableTypes.addType(new LongType()); + this.variableTypes.addType(new DateType()); + this.variableTypes.addType(new JodaDateType()); + this.variableTypes.addType(new JodaDateTimeType()); + this.variableTypes.addType(new DoubleType()); + this.variableTypes.addType(new UUIDType()); + this.variableTypes.addType(new JsonType(this.getMaxLengthString(), this.objectMapper)); + this.variableTypes.addType(new LongJsonType(this.getMaxLengthString() + 1, this.objectMapper)); + this.variableTypes.addType(new ByteArrayType()); + this.variableTypes.addType(new SerializableType(this.serializableVariableTypeTrackDeserializedObjects)); + this.variableTypes.addType(new CustomObjectType("item", ItemInstance.class)); + this.variableTypes.addType(new CustomObjectType("message", MessageInstance.class)); + if (this.customPostVariableTypes != null) { + var1 = this.customPostVariableTypes.iterator(); + + while(var1.hasNext()) { + customVariableType = (VariableType)var1.next(); + this.variableTypes.addType(customVariableType); + } + } + } + + } + + public int getMaxLengthString() { + if (this.maxLengthStringVariableType == -1) { + return "oracle".equalsIgnoreCase(this.databaseType) ? 2000 : 4000; + } else { + return this.maxLengthStringVariableType; + } + } + + public void initFormEngines() { + if (this.formEngines == null) { + this.formEngines = new HashMap(); + FormEngine defaultFormEngine = new JuelFormEngine(); + this.formEngines.put("", defaultFormEngine); + this.formEngines.put(defaultFormEngine.getName(), defaultFormEngine); + } + + if (this.customFormEngines != null) { + Iterator var3 = this.customFormEngines.iterator(); + + while(var3.hasNext()) { + FormEngine formEngine = (FormEngine)var3.next(); + this.formEngines.put(formEngine.getName(), formEngine); + } + } + + } + + public void initFormTypes() { + if (this.formTypes == null) { + this.formTypes = new FormTypes(); + this.formTypes.addFormType(new StringFormType()); + this.formTypes.addFormType(new LongFormType()); + this.formTypes.addFormType(new DateFormType("dd/MM/yyyy")); + this.formTypes.addFormType(new BooleanFormType()); + this.formTypes.addFormType(new DoubleFormType()); + } + + if (this.customFormTypes != null) { + Iterator var1 = this.customFormTypes.iterator(); + + while(var1.hasNext()) { + AbstractFormType customFormType = (AbstractFormType)var1.next(); + this.formTypes.addFormType(customFormType); + } + } + + } + + public void initScriptingEngines() { + if (this.resolverFactories == null) { + this.resolverFactories = new ArrayList(); + this.resolverFactories.add(new VariableScopeResolverFactory()); + this.resolverFactories.add(new BeansResolverFactory()); + } + + if (this.scriptingEngines == null) { + this.scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(this, this.resolverFactories)); + } + + } + + public void initExpressionManager() { + if (this.expressionManager == null) { + this.expressionManager = new ExpressionManager(this.beans); + } + + } + + public void initBusinessCalendarManager() { + if (this.businessCalendarManager == null) { + MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager(); + mapBusinessCalendarManager.addBusinessCalendar(DurationBusinessCalendar.NAME, new DurationBusinessCalendar(this.clock)); + mapBusinessCalendarManager.addBusinessCalendar("dueDate", new DueDateBusinessCalendar(this.clock)); + mapBusinessCalendarManager.addBusinessCalendar(CycleBusinessCalendar.NAME, new CycleBusinessCalendar(this.clock)); + this.businessCalendarManager = mapBusinessCalendarManager; + } + + } + + public void initDelegateInterceptor() { + if (this.delegateInterceptor == null) { + this.delegateInterceptor = new DefaultDelegateInterceptor(); + } + + } + + public void initEventHandlers() { + if (this.eventHandlers == null) { + this.eventHandlers = new HashMap(); + SignalEventHandler signalEventHandler = new SignalEventHandler(); + this.eventHandlers.put(signalEventHandler.getEventHandlerType(), signalEventHandler); + CompensationEventHandler compensationEventHandler = new CompensationEventHandler(); + this.eventHandlers.put(compensationEventHandler.getEventHandlerType(), compensationEventHandler); + MessageEventHandler messageEventHandler = new MessageEventHandler(); + this.eventHandlers.put(messageEventHandler.getEventHandlerType(), messageEventHandler); + } + + if (this.customEventHandlers != null) { + Iterator var4 = this.customEventHandlers.iterator(); + + while(var4.hasNext()) { + EventHandler eventHandler = (EventHandler)var4.next(); + this.eventHandlers.put(eventHandler.getEventHandlerType(), eventHandler); + } + } + + } + + public void initJpa() { + if (this.jpaPersistenceUnitName != null) { + this.jpaEntityManagerFactory =JpaHelper.createEntityManagerFactory(this.jpaPersistenceUnitName); + } + + if (this.jpaEntityManagerFactory != null) { + this.sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(this.jpaEntityManagerFactory, this.jpaHandleTransaction, this.jpaCloseEntityManager)); + VariableType jpaType = this.variableTypes.getVariableType("jpa-entity"); + if (jpaType == null) { + int serializableIndex = this.variableTypes.getTypeIndex("serializable"); + if (serializableIndex > -1) { + this.variableTypes.addType(new JPAEntityVariableType(), serializableIndex); + } else { + this.variableTypes.addType(new JPAEntityVariableType()); + } + } + + jpaType = this.variableTypes.getVariableType("jpa-entity-list"); + if (jpaType == null) { + this.variableTypes.addType(new JPAEntityListVariableType(), this.variableTypes.getTypeIndex("jpa-entity")); + } + } + + } + + public void initBeans() { + if (this.beans == null) { + this.beans = new HashMap(); + } + + } + + public void initEventDispatcher() { + if (this.eventDispatcher == null) { + this.eventDispatcher = new ActivitiEventDispatcherImpl(); + } + + this.eventDispatcher.setEnabled(this.enableEventDispatcher); + Iterator var1; + if (this.eventListeners != null) { + var1 = this.eventListeners.iterator(); + + while(var1.hasNext()) { + ActivitiEventListener listenerToAdd = (ActivitiEventListener)var1.next(); + this.eventDispatcher.addEventListener(listenerToAdd); + } + } + + if (this.typedEventListeners != null) { + var1 = this.typedEventListeners.entrySet().iterator(); + + while(var1.hasNext()) { + Map.Entry<String, List<ActivitiEventListener>> listenersToAdd = (Map.Entry)var1.next(); + ActivitiEventType[] types = ActivitiEventType.getTypesFromString((String)listenersToAdd.getKey()); + Iterator var4 = ((List)listenersToAdd.getValue()).iterator(); + + while(var4.hasNext()) { + ActivitiEventListener listenerToAdd = (ActivitiEventListener)var4.next(); + this.eventDispatcher.addEventListener(listenerToAdd, types); + } + } + } + + } + + public void initProcessValidator() { + if (this.processValidator == null) { + this.processValidator = (new ProcessValidatorFactory()).createDefaultProcessValidator(); + } + + } + + public void initDatabaseEventLogging() { + if (this.enableDatabaseEventLogging) { + this.getEventDispatcher().addEventListener(new EventLogger(this.clock, this.objectMapper)); + } + + } + + public void initActiviti5CompatibilityHandler() { + if (!this.isActiviti5CompatibilityEnabled || this.activiti5CompatibilityHandler == null) { + if (this.activiti5CompatibilityHandlerFactory == null) { + this.activiti5CompatibilityHandlerFactory = new DefaultActiviti5CompatibilityHandlerFactory(); + } + + this.activiti5CompatibilityHandler = this.activiti5CompatibilityHandlerFactory.createActiviti5CompatibilityHandler(); + if (this.activiti5CompatibilityHandler != null) { + log.info("Found compatibility handler instance : " + this.activiti5CompatibilityHandler.getClass()); + } + } + + } + + protected void postProcessEngineInitialisation() { + if (this.performanceSettings.isValidateExecutionRelationshipCountConfigOnBoot()) { + this.commandExecutor.execute(new ValidateExecutionRelatedEntityCountCfgCmd()); + } + + } + + public CommandConfig getDefaultCommandConfig() { + return this.defaultCommandConfig; + } + + public void setDefaultCommandConfig(CommandConfig defaultCommandConfig) { + this.defaultCommandConfig = defaultCommandConfig; + } + + public CommandConfig getSchemaCommandConfig() { + return this.schemaCommandConfig; + } + + public void setSchemaCommandConfig(CommandConfig schemaCommandConfig) { + this.schemaCommandConfig = schemaCommandConfig; + } + + public CommandInterceptor getCommandInvoker() { + return this.commandInvoker; + } + + public void setCommandInvoker(CommandInterceptor commandInvoker) { + this.commandInvoker = commandInvoker; + } + + public List<CommandInterceptor> getCustomPreCommandInterceptors() { + return this.customPreCommandInterceptors; + } + + public ProcessEngineConfigurationImpl setCustomPreCommandInterceptors(List<CommandInterceptor> customPreCommandInterceptors) { + this.customPreCommandInterceptors = customPreCommandInterceptors; + return this; + } + + public List<CommandInterceptor> getCustomPostCommandInterceptors() { + return this.customPostCommandInterceptors; + } + + public ProcessEngineConfigurationImpl setCustomPostCommandInterceptors(List<CommandInterceptor> customPostCommandInterceptors) { + this.customPostCommandInterceptors = customPostCommandInterceptors; + return this; + } + + public List<CommandInterceptor> getCommandInterceptors() { + return this.commandInterceptors; + } + + public ProcessEngineConfigurationImpl setCommandInterceptors(List<CommandInterceptor> commandInterceptors) { + this.commandInterceptors = commandInterceptors; + return this; + } + + public CommandExecutor getCommandExecutor() { + return this.commandExecutor; + } + + public ProcessEngineConfigurationImpl setCommandExecutor(CommandExecutor commandExecutor) { + this.commandExecutor = commandExecutor; + return this; + } + + public RepositoryService getRepositoryService() { + return this.repositoryService; + } + + public ProcessEngineConfigurationImpl setRepositoryService(RepositoryService repositoryService) { + this.repositoryService = repositoryService; + return this; + } + + public RuntimeService getRuntimeService() { + return this.runtimeService; + } + + public ProcessEngineConfigurationImpl setRuntimeService(RuntimeService runtimeService) { + this.runtimeService = runtimeService; + return this; + } + + public HistoryService getHistoryService() { + return this.historyService; + } + + public ProcessEngineConfigurationImpl setHistoryService(HistoryService historyService) { + this.historyService = historyService; + return this; + } + + public IdentityService getIdentityService() { + return this.identityService; + } + + public ProcessEngineConfigurationImpl setIdentityService(IdentityService identityService) { + this.identityService = identityService; + return this; + } + + public TaskService getTaskService() { + return this.taskService; + } + + public ProcessEngineConfigurationImpl setTaskService(TaskService taskService) { + this.taskService = taskService; + return this; + } + + public FormService getFormService() { + return this.formService; + } + + public ProcessEngineConfigurationImpl setFormService(FormService formService) { + this.formService = formService; + return this; + } + + public ManagementService getManagementService() { + return this.managementService; + } + + public ProcessEngineConfigurationImpl setManagementService(ManagementService managementService) { + this.managementService = managementService; + return this; + } + + public DynamicBpmnService getDynamicBpmnService() { + return this.dynamicBpmnService; + } + + public ProcessEngineConfigurationImpl setDynamicBpmnService(DynamicBpmnService dynamicBpmnService) { + this.dynamicBpmnService = dynamicBpmnService; + return this; + } + + public ProcessEngineConfigurationImpl getProcessEngineConfiguration() { + return this; + } + + public boolean isFormEngineInitialized() { + return this.formEngineInitialized; + } + + public ProcessEngineConfigurationImpl setFormEngineInitialized(boolean formEngineInitialized) { + this.formEngineInitialized = formEngineInitialized; + return this; + } + + public FormRepositoryService getFormEngineRepositoryService() { + return this.formEngineRepositoryService; + } + + public ProcessEngineConfigurationImpl setFormEngineRepositoryService(FormRepositoryService formEngineRepositoryService) { + this.formEngineRepositoryService = formEngineRepositoryService; + return this; + } + + public org.activiti.form.api.FormService getFormEngineFormService() { + return this.formEngineFormService; + } + + public ProcessEngineConfigurationImpl setFormEngineFormService(org.activiti.form.api.FormService formEngineFormService) { + this.formEngineFormService = formEngineFormService; + return this; + } + + public boolean isDmnEngineInitialized() { + return this.dmnEngineInitialized; + } + + public ProcessEngineConfigurationImpl setDmnEngineInitialized(boolean dmnEngineInitialized) { + this.dmnEngineInitialized = dmnEngineInitialized; + return this; + } + + public DmnRepositoryService getDmnEngineRepositoryService() { + return this.dmnEngineRepositoryService; + } + + public ProcessEngineConfigurationImpl setDmnEngineRepositoryService(DmnRepositoryService dmnEngineRepositoryService) { + this.dmnEngineRepositoryService = dmnEngineRepositoryService; + return this; + } + + public DmnRuleService getDmnEngineRuleService() { + return this.dmnEngineRuleService; + } + + public ProcessEngineConfigurationImpl setDmnEngineRuleService(DmnRuleService dmnEngineRuleService) { + this.dmnEngineRuleService = dmnEngineRuleService; + return this; + } + + public Map<Class<?>, SessionFactory> getSessionFactories() { + return this.sessionFactories; + } + + public ProcessEngineConfigurationImpl setSessionFactories(Map<Class<?>, SessionFactory> sessionFactories) { + this.sessionFactories = sessionFactories; + return this; + } + + public List<ProcessEngineConfigurator> getConfigurators() { + return this.configurators; + } + + public ProcessEngineConfigurationImpl addConfigurator(ProcessEngineConfigurator configurator) { + if (this.configurators == null) { + this.configurators = new ArrayList(); + } + + this.configurators.add(configurator); + return this; + } + + public ProcessEngineConfigurationImpl setConfigurators(List<ProcessEngineConfigurator> configurators) { + this.configurators = configurators; + return this; + } + + public void setEnableConfiguratorServiceLoader(boolean enableConfiguratorServiceLoader) { + this.enableConfiguratorServiceLoader = enableConfiguratorServiceLoader; + } + + public List<ProcessEngineConfigurator> getAllConfigurators() { + return this.allConfigurators; + } + + public BpmnDeployer getBpmnDeployer() { + return this.bpmnDeployer; + } + + public ProcessEngineConfigurationImpl setBpmnDeployer(BpmnDeployer bpmnDeployer) { + this.bpmnDeployer = bpmnDeployer; + return this; + } + + public BpmnParser getBpmnParser() { + return this.bpmnParser; + } + + public ProcessEngineConfigurationImpl setBpmnParser(BpmnParser bpmnParser) { + this.bpmnParser = bpmnParser; + return this; + } + + public ParsedDeploymentBuilderFactory getParsedDeploymentBuilderFactory() { + return this.parsedDeploymentBuilderFactory; + } + + public ProcessEngineConfigurationImpl setParsedDeploymentBuilderFactory(ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory) { + this.parsedDeploymentBuilderFactory = parsedDeploymentBuilderFactory; + return this; + } + + public TimerManager getTimerManager() { + return this.timerManager; + } + + public void setTimerManager(TimerManager timerManager) { + this.timerManager = timerManager; + } + + public EventSubscriptionManager getEventSubscriptionManager() { + return this.eventSubscriptionManager; + } + + public void setEventSubscriptionManager(EventSubscriptionManager eventSubscriptionManager) { + this.eventSubscriptionManager = eventSubscriptionManager; + } + + public BpmnDeploymentHelper getBpmnDeploymentHelper() { + return this.bpmnDeploymentHelper; + } + + public ProcessEngineConfigurationImpl setBpmnDeploymentHelper(BpmnDeploymentHelper bpmnDeploymentHelper) { + this.bpmnDeploymentHelper = bpmnDeploymentHelper; + return this; + } + + public CachingAndArtifactsManager getCachingAndArtifactsManager() { + return this.cachingAndArtifactsManager; + } + + public void setCachingAndArtifactsManager(CachingAndArtifactsManager cachingAndArtifactsManager) { + this.cachingAndArtifactsManager = cachingAndArtifactsManager; + } + + public ProcessDefinitionDiagramHelper getProcessDefinitionDiagramHelper() { + return this.processDefinitionDiagramHelper; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionDiagramHelper(ProcessDefinitionDiagramHelper processDefinitionDiagramHelper) { + this.processDefinitionDiagramHelper = processDefinitionDiagramHelper; + return this; + } + + public List<Deployer> getDeployers() { + return this.deployers; + } + + public ProcessEngineConfigurationImpl setDeployers(List<Deployer> deployers) { + this.deployers = deployers; + return this; + } + + public IdGenerator getIdGenerator() { + return this.idGenerator; + } + + public ProcessEngineConfigurationImpl setIdGenerator(IdGenerator idGenerator) { + this.idGenerator = idGenerator; + return this; + } + + public String getWsSyncFactoryClassName() { + return this.wsSyncFactoryClassName; + } + + public ProcessEngineConfigurationImpl setWsSyncFactoryClassName(String wsSyncFactoryClassName) { + this.wsSyncFactoryClassName = wsSyncFactoryClassName; + return this; + } + + public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) { + this.wsOverridenEndpointAddresses.put(endpointName, address); + return this; + } + + public ProcessEngineConfiguration removeWsEndpointAddress(QName endpointName) { + this.wsOverridenEndpointAddresses.remove(endpointName); + return this; + } + + public ConcurrentMap<QName, URL> getWsOverridenEndpointAddresses() { + return this.wsOverridenEndpointAddresses; + } + + public ProcessEngineConfiguration setWsOverridenEndpointAddresses(ConcurrentMap<QName, URL> wsOverridenEndpointAddress) { + this.wsOverridenEndpointAddresses.putAll(wsOverridenEndpointAddress); + return this; + } + + public Map<String, FormEngine> getFormEngines() { + return this.formEngines; + } + + public ProcessEngineConfigurationImpl setFormEngines(Map<String, FormEngine> formEngines) { + this.formEngines = formEngines; + return this; + } + + public FormTypes getFormTypes() { + return this.formTypes; + } + + public ProcessEngineConfigurationImpl setFormTypes(FormTypes formTypes) { + this.formTypes = formTypes; + return this; + } + + public ScriptingEngines getScriptingEngines() { + return this.scriptingEngines; + } + + public ProcessEngineConfigurationImpl setScriptingEngines(ScriptingEngines scriptingEngines) { + this.scriptingEngines = scriptingEngines; + return this; + } + + public VariableTypes getVariableTypes() { + return this.variableTypes; + } + + public ProcessEngineConfigurationImpl setVariableTypes(VariableTypes variableTypes) { + this.variableTypes = variableTypes; + return this; + } + + public boolean isSerializableVariableTypeTrackDeserializedObjects() { + return this.serializableVariableTypeTrackDeserializedObjects; + } + + public void setSerializableVariableTypeTrackDeserializedObjects(boolean serializableVariableTypeTrackDeserializedObjects) { + this.serializableVariableTypeTrackDeserializedObjects = serializableVariableTypeTrackDeserializedObjects; + } + + public ExpressionManager getExpressionManager() { + return this.expressionManager; + } + + public ProcessEngineConfigurationImpl setExpressionManager(ExpressionManager expressionManager) { + this.expressionManager = expressionManager; + return this; + } + + public BusinessCalendarManager getBusinessCalendarManager() { + return this.businessCalendarManager; + } + + public ProcessEngineConfigurationImpl setBusinessCalendarManager(BusinessCalendarManager businessCalendarManager) { + this.businessCalendarManager = businessCalendarManager; + return this; + } + + public int getExecutionQueryLimit() { + return this.executionQueryLimit; + } + + public ProcessEngineConfigurationImpl setExecutionQueryLimit(int executionQueryLimit) { + this.executionQueryLimit = executionQueryLimit; + return this; + } + + public int getTaskQueryLimit() { + return this.taskQueryLimit; + } + + public ProcessEngineConfigurationImpl setTaskQueryLimit(int taskQueryLimit) { + this.taskQueryLimit = taskQueryLimit; + return this; + } + + public int getHistoricTaskQueryLimit() { + return this.historicTaskQueryLimit; + } + + public ProcessEngineConfigurationImpl setHistoricTaskQueryLimit(int historicTaskQueryLimit) { + this.historicTaskQueryLimit = historicTaskQueryLimit; + return this; + } + + public int getHistoricProcessInstancesQueryLimit() { + return this.historicProcessInstancesQueryLimit; + } + + public ProcessEngineConfigurationImpl setHistoricProcessInstancesQueryLimit(int historicProcessInstancesQueryLimit) { + this.historicProcessInstancesQueryLimit = historicProcessInstancesQueryLimit; + return this; + } + + public CommandContextFactory getCommandContextFactory() { + return this.commandContextFactory; + } + + public ProcessEngineConfigurationImpl setCommandContextFactory(CommandContextFactory commandContextFactory) { + this.commandContextFactory = commandContextFactory; + return this; + } + + public TransactionContextFactory getTransactionContextFactory() { + return this.transactionContextFactory; + } + + public ProcessEngineConfigurationImpl setTransactionContextFactory(TransactionContextFactory transactionContextFactory) { + this.transactionContextFactory = transactionContextFactory; + return this; + } + + public List<Deployer> getCustomPreDeployers() { + return this.customPreDeployers; + } + + public ProcessEngineConfigurationImpl setCustomPreDeployers(List<Deployer> customPreDeployers) { + this.customPreDeployers = customPreDeployers; + return this; + } + + public List<Deployer> getCustomPostDeployers() { + return this.customPostDeployers; + } + + public ProcessEngineConfigurationImpl setCustomPostDeployers(List<Deployer> customPostDeployers) { + this.customPostDeployers = customPostDeployers; + return this; + } + + public Map<String, JobHandler> getJobHandlers() { + return this.jobHandlers; + } + + public ProcessEngineConfigurationImpl setJobHandlers(Map<String, JobHandler> jobHandlers) { + this.jobHandlers = jobHandlers; + return this; + } + + public ProcessInstanceHelper getProcessInstanceHelper() { + return this.processInstanceHelper; + } + + public ProcessEngineConfigurationImpl setProcessInstanceHelper(ProcessInstanceHelper processInstanceHelper) { + this.processInstanceHelper = processInstanceHelper; + return this; + } + + public ListenerNotificationHelper getListenerNotificationHelper() { + return this.listenerNotificationHelper; + } + + public ProcessEngineConfigurationImpl setListenerNotificationHelper(ListenerNotificationHelper listenerNotificationHelper) { + this.listenerNotificationHelper = listenerNotificationHelper; + return this; + } + + public SqlSessionFactory getSqlSessionFactory() { + return this.sqlSessionFactory; + } + + public ProcessEngineConfigurationImpl setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { + this.sqlSessionFactory = sqlSessionFactory; + return this; + } + + public DbSqlSessionFactory getDbSqlSessionFactory() { + return this.dbSqlSessionFactory; + } + + public ProcessEngineConfigurationImpl setDbSqlSessionFactory(DbSqlSessionFactory dbSqlSessionFactory) { + this.dbSqlSessionFactory = dbSqlSessionFactory; + return this; + } + + public TransactionFactory getTransactionFactory() { + return this.transactionFactory; + } + + public ProcessEngineConfigurationImpl setTransactionFactory(TransactionFactory transactionFactory) { + this.transactionFactory = transactionFactory; + return this; + } + + public List<SessionFactory> getCustomSessionFactories() { + return this.customSessionFactories; + } + + public ProcessEngineConfigurationImpl setCustomSessionFactories(List<SessionFactory> customSessionFactories) { + this.customSessionFactories = customSessionFactories; + return this; + } + + public List<JobHandler> getCustomJobHandlers() { + return this.customJobHandlers; + } + + public ProcessEngineConfigurationImpl setCustomJobHandlers(List<JobHandler> customJobHandlers) { + this.customJobHandlers = customJobHandlers; + return this; + } + + public List<FormEngine> getCustomFormEngines() { + return this.customFormEngines; + } + + public ProcessEngineConfigurationImpl setCustomFormEngines(List<FormEngine> customFormEngines) { + this.customFormEngines = customFormEngines; + return this; + } + + public List<AbstractFormType> getCustomFormTypes() { + return this.customFormTypes; + } + + public ProcessEngineConfigurationImpl setCustomFormTypes(List<AbstractFormType> customFormTypes) { + this.customFormTypes = customFormTypes; + return this; + } + + public List<String> getCustomScriptingEngineClasses() { + return this.customScriptingEngineClasses; + } + + public ProcessEngineConfigurationImpl setCustomScriptingEngineClasses(List<String> customScriptingEngineClasses) { + this.customScriptingEngineClasses = customScriptingEngineClasses; + return this; + } + + public List<VariableType> getCustomPreVariableTypes() { + return this.customPreVariableTypes; + } + + public ProcessEngineConfigurationImpl setCustomPreVariableTypes(List<VariableType> customPreVariableTypes) { + this.customPreVariableTypes = customPreVariableTypes; + return this; + } + + public List<VariableType> getCustomPostVariableTypes() { + return this.customPostVariableTypes; + } + + public ProcessEngineConfigurationImpl setCustomPostVariableTypes(List<VariableType> customPostVariableTypes) { + this.customPostVariableTypes = customPostVariableTypes; + return this; + } + + public List<BpmnParseHandler> getPreBpmnParseHandlers() { + return this.preBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setPreBpmnParseHandlers(List<BpmnParseHandler> preBpmnParseHandlers) { + this.preBpmnParseHandlers = preBpmnParseHandlers; + return this; + } + + public List<BpmnParseHandler> getCustomDefaultBpmnParseHandlers() { + return this.customDefaultBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setCustomDefaultBpmnParseHandlers(List<BpmnParseHandler> customDefaultBpmnParseHandlers) { + this.customDefaultBpmnParseHandlers = customDefaultBpmnParseHandlers; + return this; + } + + public List<BpmnParseHandler> getPostBpmnParseHandlers() { + return this.postBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setPostBpmnParseHandlers(List<BpmnParseHandler> postBpmnParseHandlers) { + this.postBpmnParseHandlers = postBpmnParseHandlers; + return this; + } + + public ActivityBehaviorFactory getActivityBehaviorFactory() { + return this.activityBehaviorFactory; + } + + public ProcessEngineConfigurationImpl setActivityBehaviorFactory(ActivityBehaviorFactory activityBehaviorFactory) { + this.activityBehaviorFactory = activityBehaviorFactory; + return this; + } + + public ListenerFactory getListenerFactory() { + return this.listenerFactory; + } + + public ProcessEngineConfigurationImpl setListenerFactory(ListenerFactory listenerFactory) { + this.listenerFactory = listenerFactory; + return this; + } + + public BpmnParseFactory getBpmnParseFactory() { + return this.bpmnParseFactory; + } + + public ProcessEngineConfigurationImpl setBpmnParseFactory(BpmnParseFactory bpmnParseFactory) { + this.bpmnParseFactory = bpmnParseFactory; + return this; + } + + public Map<Object, Object> getBeans() { + return this.beans; + } + + public ProcessEngineConfigurationImpl setBeans(Map<Object, Object> beans) { + this.beans = beans; + return this; + } + + public List<ResolverFactory> getResolverFactories() { + return this.resolverFactories; + } + + public ProcessEngineConfigurationImpl setResolverFactories(List<ResolverFactory> resolverFactories) { + this.resolverFactories = resolverFactories; + return this; + } + + public DeploymentManager getDeploymentManager() { + return this.deploymentManager; + } + + public ProcessEngineConfigurationImpl setDeploymentManager(DeploymentManager deploymentManager) { + this.deploymentManager = deploymentManager; + return this; + } + + public ProcessEngineConfigurationImpl setDelegateInterceptor(DelegateInterceptor delegateInterceptor) { + this.delegateInterceptor = delegateInterceptor; + return this; + } + + public DelegateInterceptor getDelegateInterceptor() { + return this.delegateInterceptor; + } + + public EventHandler getEventHandler(String eventType) { + return (EventHandler)this.eventHandlers.get(eventType); + } + + public ProcessEngineConfigurationImpl setEventHandlers(Map<String, EventHandler> eventHandlers) { + this.eventHandlers = eventHandlers; + return this; + } + + public Map<String, EventHandler> getEventHandlers() { + return this.eventHandlers; + } + + public List<EventHandler> getCustomEventHandlers() { + return this.customEventHandlers; + } + + public ProcessEngineConfigurationImpl setCustomEventHandlers(List<EventHandler> customEventHandlers) { + this.customEventHandlers = customEventHandlers; + return this; + } + + public FailedJobCommandFactory getFailedJobCommandFactory() { + return this.failedJobCommandFactory; + } + + public ProcessEngineConfigurationImpl setFailedJobCommandFactory(FailedJobCommandFactory failedJobCommandFactory) { + this.failedJobCommandFactory = failedJobCommandFactory; + return this; + } + + public DataSource getIdGeneratorDataSource() { + return this.idGeneratorDataSource; + } + + public ProcessEngineConfigurationImpl setIdGeneratorDataSource(DataSource idGeneratorDataSource) { + this.idGeneratorDataSource = idGeneratorDataSource; + return this; + } + + public String getIdGeneratorDataSourceJndiName() { + return this.idGeneratorDataSourceJndiName; + } + + public ProcessEngineConfigurationImpl setIdGeneratorDataSourceJndiName(String idGeneratorDataSourceJndiName) { + this.idGeneratorDataSourceJndiName = idGeneratorDataSourceJndiName; + return this; + } + + public int getBatchSizeProcessInstances() { + return this.batchSizeProcessInstances; + } + + public ProcessEngineConfigurationImpl setBatchSizeProcessInstances(int batchSizeProcessInstances) { + this.batchSizeProcessInstances = batchSizeProcessInstances; + return this; + } + + public int getBatchSizeTasks() { + return this.batchSizeTasks; + } + + public ProcessEngineConfigurationImpl setBatchSizeTasks(int batchSizeTasks) { + this.batchSizeTasks = batchSizeTasks; + return this; + } + + public int getProcessDefinitionCacheLimit() { + return this.processDefinitionCacheLimit; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionCacheLimit(int processDefinitionCacheLimit) { + this.processDefinitionCacheLimit = processDefinitionCacheLimit; + return this; + } + + public DeploymentCache<ProcessDefinitionCacheEntry> getProcessDefinitionCache() { + return this.processDefinitionCache; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionCache(DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache) { + this.processDefinitionCache = processDefinitionCache; + return this; + } + + public int getKnowledgeBaseCacheLimit() { + return this.knowledgeBaseCacheLimit; + } + + public ProcessEngineConfigurationImpl setKnowledgeBaseCacheLimit(int knowledgeBaseCacheLimit) { + this.knowledgeBaseCacheLimit = knowledgeBaseCacheLimit; + return this; + } + + public DeploymentCache<Object> getKnowledgeBaseCache() { + return this.knowledgeBaseCache; + } + + public ProcessEngineConfigurationImpl setKnowledgeBaseCache(DeploymentCache<Object> knowledgeBaseCache) { + this.knowledgeBaseCache = knowledgeBaseCache; + return this; + } + + public boolean isEnableSafeBpmnXml() { + return this.enableSafeBpmnXml; + } + + public ProcessEngineConfigurationImpl setEnableSafeBpmnXml(boolean enableSafeBpmnXml) { + this.enableSafeBpmnXml = enableSafeBpmnXml; + return this; + } + + public ActivitiEventDispatcher getEventDispatcher() { + return this.eventDispatcher; + } + + public ProcessEngineConfigurationImpl setEventDispatcher(ActivitiEventDispatcher eventDispatcher) { + this.eventDispatcher = eventDispatcher; + return this; + } + + public ProcessEngineConfigurationImpl setEnableEventDispatcher(boolean enableEventDispatcher) { + this.enableEventDispatcher = enableEventDispatcher; + return this; + } + + public Map<String, List<ActivitiEventListener>> getTypedEventListeners() { + return this.typedEventListeners; + } + + public ProcessEngineConfigurationImpl setTypedEventListeners(Map<String, List<ActivitiEventListener>> typedListeners) { + this.typedEventListeners = typedListeners; + return this; + } + + public List<ActivitiEventListener> getEventListeners() { + return this.eventListeners; + } + + public ProcessEngineConfigurationImpl setEventListeners(List<ActivitiEventListener> eventListeners) { + this.eventListeners = eventListeners; + return this; + } + + public ProcessValidator getProcessValidator() { + return this.processValidator; + } + + public ProcessEngineConfigurationImpl setProcessValidator(ProcessValidator processValidator) { + this.processValidator = processValidator; + return this; + } + + public boolean isEnableEventDispatcher() { + return this.enableEventDispatcher; + } + + public boolean isEnableDatabaseEventLogging() { + return this.enableDatabaseEventLogging; + } + + public ProcessEngineConfigurationImpl setEnableDatabaseEventLogging(boolean enableDatabaseEventLogging) { + this.enableDatabaseEventLogging = enableDatabaseEventLogging; + return this; + } + + public int getMaxLengthStringVariableType() { + return this.maxLengthStringVariableType; + } + + public ProcessEngineConfigurationImpl setMaxLengthStringVariableType(int maxLengthStringVariableType) { + this.maxLengthStringVariableType = maxLengthStringVariableType; + return this; + } + + public boolean isBulkInsertEnabled() { + return this.isBulkInsertEnabled; + } + + public ProcessEngineConfigurationImpl setBulkInsertEnabled(boolean isBulkInsertEnabled) { + this.isBulkInsertEnabled = isBulkInsertEnabled; + return this; + } + + public int getMaxNrOfStatementsInBulkInsert() { + return this.maxNrOfStatementsInBulkInsert; + } + + public ProcessEngineConfigurationImpl setMaxNrOfStatementsInBulkInsert(int maxNrOfStatementsInBulkInsert) { + this.maxNrOfStatementsInBulkInsert = maxNrOfStatementsInBulkInsert; + return this; + } + + public boolean isUsingRelationalDatabase() { + return this.usingRelationalDatabase; + } + + public ProcessEngineConfigurationImpl setUsingRelationalDatabase(boolean usingRelationalDatabase) { + this.usingRelationalDatabase = usingRelationalDatabase; + return this; + } + + public boolean isEnableVerboseExecutionTreeLogging() { + return this.enableVerboseExecutionTreeLogging; + } + + public ProcessEngineConfigurationImpl setEnableVerboseExecutionTreeLogging(boolean enableVerboseExecutionTreeLogging) { + this.enableVerboseExecutionTreeLogging = enableVerboseExecutionTreeLogging; + return this; + } + + public ProcessEngineConfigurationImpl setEnableEagerExecutionTreeFetching(boolean enableEagerExecutionTreeFetching) { + this.performanceSettings.setEnableEagerExecutionTreeFetching(enableEagerExecutionTreeFetching); + return this; + } + + public ProcessEngineConfigurationImpl setEnableExecutionRelationshipCounts(boolean enableExecutionRelationshipCounts) { + this.performanceSettings.setEnableExecutionRelationshipCounts(enableExecutionRelationshipCounts); + return this; + } + + public PerformanceSettings getPerformanceSettings() { + return this.performanceSettings; + } + + public void setPerformanceSettings(PerformanceSettings performanceSettings) { + this.performanceSettings = performanceSettings; + } + + public ProcessEngineConfigurationImpl setEnableLocalization(boolean enableLocalization) { + this.performanceSettings.setEnableLocalization(enableLocalization); + return this; + } + + public AttachmentDataManager getAttachmentDataManager() { + return this.attachmentDataManager; + } + + public ProcessEngineConfigurationImpl setAttachmentDataManager(AttachmentDataManager attachmentDataManager) { + this.attachmentDataManager = attachmentDataManager; + return this; + } + + public ByteArrayDataManager getByteArrayDataManager() { + return this.byteArrayDataManager; + } + + public ProcessEngineConfigurationImpl setByteArrayDataManager(ByteArrayDataManager byteArrayDataManager) { + this.byteArrayDataManager = byteArrayDataManager; + return this; + } + + public CommentDataManager getCommentDataManager() { + return this.commentDataManager; + } + + public ProcessEngineConfigurationImpl setCommentDataManager(CommentDataManager commentDataManager) { + this.commentDataManager = commentDataManager; + return this; + } + + public DeploymentDataManager getDeploymentDataManager() { + return this.deploymentDataManager; + } + + public ProcessEngineConfigurationImpl setDeploymentDataManager(DeploymentDataManager deploymentDataManager) { + this.deploymentDataManager = deploymentDataManager; + return this; + } + + public EventLogEntryDataManager getEventLogEntryDataManager() { + return this.eventLogEntryDataManager; + } + + public ProcessEngineConfigurationImpl setEventLogEntryDataManager(EventLogEntryDataManager eventLogEntryDataManager) { + this.eventLogEntryDataManager = eventLogEntryDataManager; + return this; + } + + public EventSubscriptionDataManager getEventSubscriptionDataManager() { + return this.eventSubscriptionDataManager; + } + + public ProcessEngineConfigurationImpl setEventSubscriptionDataManager(EventSubscriptionDataManager eventSubscriptionDataManager) { + this.eventSubscriptionDataManager = eventSubscriptionDataManager; + return this; + } + + public ExecutionDataManager getExecutionDataManager() { + return this.executionDataManager; + } + + public ProcessEngineConfigurationImpl setExecutionDataManager(ExecutionDataManager executionDataManager) { + this.executionDataManager = executionDataManager; + return this; + } + + public GroupDataManager getGroupDataManager() { + return this.groupDataManager; + } + + public ProcessEngineConfigurationImpl setGroupDataManager(GroupDataManager groupDataManager) { + this.groupDataManager = groupDataManager; + return this; + } + + public HistoricActivityInstanceDataManager getHistoricActivityInstanceDataManager() { + return this.historicActivityInstanceDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricActivityInstanceDataManager(HistoricActivityInstanceDataManager historicActivityInstanceDataManager) { + this.historicActivityInstanceDataManager = historicActivityInstanceDataManager; + return this; + } + + public HistoricDetailDataManager getHistoricDetailDataManager() { + return this.historicDetailDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricDetailDataManager(HistoricDetailDataManager historicDetailDataManager) { + this.historicDetailDataManager = historicDetailDataManager; + return this; + } + + public HistoricIdentityLinkDataManager getHistoricIdentityLinkDataManager() { + return this.historicIdentityLinkDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricIdentityLinkDataManager(HistoricIdentityLinkDataManager historicIdentityLinkDataManager) { + this.historicIdentityLinkDataManager = historicIdentityLinkDataManager; + return this; + } + + public HistoricProcessInstanceDataManager getHistoricProcessInstanceDataManager() { + return this.historicProcessInstanceDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricProcessInstanceDataManager(HistoricProcessInstanceDataManager historicProcessInstanceDataManager) { + this.historicProcessInstanceDataManager = historicProcessInstanceDataManager; + return this; + } + + public HistoricTaskInstanceDataManager getHistoricTaskInstanceDataManager() { + return this.historicTaskInstanceDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricTaskInstanceDataManager(HistoricTaskInstanceDataManager historicTaskInstanceDataManager) { + this.historicTaskInstanceDataManager = historicTaskInstanceDataManager; + return this; + } + + public HistoricVariableInstanceDataManager getHistoricVariableInstanceDataManager() { + return this.historicVariableInstanceDataManager; + } + + public ProcessEngineConfigurationImpl setHistoricVariableInstanceDataManager(HistoricVariableInstanceDataManager historicVariableInstanceDataManager) { + this.historicVariableInstanceDataManager = historicVariableInstanceDataManager; + return this; + } + + public IdentityInfoDataManager getIdentityInfoDataManager() { + return this.identityInfoDataManager; + } + + public ProcessEngineConfigurationImpl setIdentityInfoDataManager(IdentityInfoDataManager identityInfoDataManager) { + this.identityInfoDataManager = identityInfoDataManager; + return this; + } + + public IdentityLinkDataManager getIdentityLinkDataManager() { + return this.identityLinkDataManager; + } + + public ProcessEngineConfigurationImpl setIdentityLinkDataManager(IdentityLinkDataManager identityLinkDataManager) { + this.identityLinkDataManager = identityLinkDataManager; + return this; + } + + public JobDataManager getJobDataManager() { + return this.jobDataManager; + } + + public ProcessEngineConfigurationImpl setJobDataManager(JobDataManager jobDataManager) { + this.jobDataManager = jobDataManager; + return this; + } + + public TimerJobDataManager getTimerJobDataManager() { + return this.timerJobDataManager; + } + + public ProcessEngineConfigurationImpl setTimerJobDataManager(TimerJobDataManager timerJobDataManager) { + this.timerJobDataManager = timerJobDataManager; + return this; + } + + public SuspendedJobDataManager getSuspendedJobDataManager() { + return this.suspendedJobDataManager; + } + + public ProcessEngineConfigurationImpl setSuspendedJobDataManager(SuspendedJobDataManager suspendedJobDataManager) { + this.suspendedJobDataManager = suspendedJobDataManager; + return this; + } + + public DeadLetterJobDataManager getDeadLetterJobDataManager() { + return this.deadLetterJobDataManager; + } + + public ProcessEngineConfigurationImpl setDeadLetterJobDataManager(DeadLetterJobDataManager deadLetterJobDataManager) { + this.deadLetterJobDataManager = deadLetterJobDataManager; + return this; + } + + public MembershipDataManager getMembershipDataManager() { + return this.membershipDataManager; + } + + public ProcessEngineConfigurationImpl setMembershipDataManager(MembershipDataManager membershipDataManager) { + this.membershipDataManager = membershipDataManager; + return this; + } + + public ModelDataManager getModelDataManager() { + return this.modelDataManager; + } + + public ProcessEngineConfigurationImpl setModelDataManager(ModelDataManager modelDataManager) { + this.modelDataManager = modelDataManager; + return this; + } + + public ProcessDefinitionDataManager getProcessDefinitionDataManager() { + return this.processDefinitionDataManager; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionDataManager(ProcessDefinitionDataManager processDefinitionDataManager) { + this.processDefinitionDataManager = processDefinitionDataManager; + return this; + } + + public ProcessDefinitionInfoDataManager getProcessDefinitionInfoDataManager() { + return this.processDefinitionInfoDataManager; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionInfoDataManager(ProcessDefinitionInfoDataManager processDefinitionInfoDataManager) { + this.processDefinitionInfoDataManager = processDefinitionInfoDataManager; + return this; + } + + public PropertyDataManager getPropertyDataManager() { + return this.propertyDataManager; + } + + public ProcessEngineConfigurationImpl setPropertyDataManager(PropertyDataManager propertyDataManager) { + this.propertyDataManager = propertyDataManager; + return this; + } + + public ResourceDataManager getResourceDataManager() { + return this.resourceDataManager; + } + + public ProcessEngineConfigurationImpl setResourceDataManager(ResourceDataManager resourceDataManager) { + this.resourceDataManager = resourceDataManager; + return this; + } + + public TaskDataManager getTaskDataManager() { + return this.taskDataManager; + } + + public ProcessEngineConfigurationImpl setTaskDataManager(TaskDataManager taskDataManager) { + this.taskDataManager = taskDataManager; + return this; + } + + public UserDataManager getUserDataManager() { + return this.userDataManager; + } + + public ProcessEngineConfigurationImpl setUserDataManager(UserDataManager userDataManager) { + this.userDataManager = userDataManager; + return this; + } + + public VariableInstanceDataManager getVariableInstanceDataManager() { + return this.variableInstanceDataManager; + } + + public ProcessEngineConfigurationImpl setVariableInstanceDataManager(VariableInstanceDataManager variableInstanceDataManager) { + this.variableInstanceDataManager = variableInstanceDataManager; + return this; + } + + public boolean isEnableConfiguratorServiceLoader() { + return this.enableConfiguratorServiceLoader; + } + + public AttachmentEntityManager getAttachmentEntityManager() { + return this.attachmentEntityManager; + } + + public ProcessEngineConfigurationImpl setAttachmentEntityManager(AttachmentEntityManager attachmentEntityManager) { + this.attachmentEntityManager = attachmentEntityManager; + return this; + } + + public ByteArrayEntityManager getByteArrayEntityManager() { + return this.byteArrayEntityManager; + } + + public ProcessEngineConfigurationImpl setByteArrayEntityManager(ByteArrayEntityManager byteArrayEntityManager) { + this.byteArrayEntityManager = byteArrayEntityManager; + return this; + } + + public CommentEntityManager getCommentEntityManager() { + return this.commentEntityManager; + } + + public ProcessEngineConfigurationImpl setCommentEntityManager(CommentEntityManager commentEntityManager) { + this.commentEntityManager = commentEntityManager; + return this; + } + + public DeploymentEntityManager getDeploymentEntityManager() { + return this.deploymentEntityManager; + } + + public ProcessEngineConfigurationImpl setDeploymentEntityManager(DeploymentEntityManager deploymentEntityManager) { + this.deploymentEntityManager = deploymentEntityManager; + return this; + } + + public EventLogEntryEntityManager getEventLogEntryEntityManager() { + return this.eventLogEntryEntityManager; + } + + public ProcessEngineConfigurationImpl setEventLogEntryEntityManager(EventLogEntryEntityManager eventLogEntryEntityManager) { + this.eventLogEntryEntityManager = eventLogEntryEntityManager; + return this; + } + + public EventSubscriptionEntityManager getEventSubscriptionEntityManager() { + return this.eventSubscriptionEntityManager; + } + + public ProcessEngineConfigurationImpl setEventSubscriptionEntityManager(EventSubscriptionEntityManager eventSubscriptionEntityManager) { + this.eventSubscriptionEntityManager = eventSubscriptionEntityManager; + return this; + } + + public ExecutionEntityManager getExecutionEntityManager() { + return this.executionEntityManager; + } + + public ProcessEngineConfigurationImpl setExecutionEntityManager(ExecutionEntityManager executionEntityManager) { + this.executionEntityManager = executionEntityManager; + return this; + } + + public GroupEntityManager getGroupEntityManager() { + return this.groupEntityManager; + } + + public ProcessEngineConfigurationImpl setGroupEntityManager(GroupEntityManager groupEntityManager) { + this.groupEntityManager = groupEntityManager; + return this; + } + + public HistoricActivityInstanceEntityManager getHistoricActivityInstanceEntityManager() { + return this.historicActivityInstanceEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricActivityInstanceEntityManager(HistoricActivityInstanceEntityManager historicActivityInstanceEntityManager) { + this.historicActivityInstanceEntityManager = historicActivityInstanceEntityManager; + return this; + } + + public HistoricDetailEntityManager getHistoricDetailEntityManager() { + return this.historicDetailEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricDetailEntityManager(HistoricDetailEntityManager historicDetailEntityManager) { + this.historicDetailEntityManager = historicDetailEntityManager; + return this; + } + + public HistoricIdentityLinkEntityManager getHistoricIdentityLinkEntityManager() { + return this.historicIdentityLinkEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricIdentityLinkEntityManager(HistoricIdentityLinkEntityManager historicIdentityLinkEntityManager) { + this.historicIdentityLinkEntityManager = historicIdentityLinkEntityManager; + return this; + } + + public HistoricProcessInstanceEntityManager getHistoricProcessInstanceEntityManager() { + return this.historicProcessInstanceEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricProcessInstanceEntityManager(HistoricProcessInstanceEntityManager historicProcessInstanceEntityManager) { + this.historicProcessInstanceEntityManager = historicProcessInstanceEntityManager; + return this; + } + + public HistoricTaskInstanceEntityManager getHistoricTaskInstanceEntityManager() { + return this.historicTaskInstanceEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricTaskInstanceEntityManager(HistoricTaskInstanceEntityManager historicTaskInstanceEntityManager) { + this.historicTaskInstanceEntityManager = historicTaskInstanceEntityManager; + return this; + } + + public HistoricVariableInstanceEntityManager getHistoricVariableInstanceEntityManager() { + return this.historicVariableInstanceEntityManager; + } + + public ProcessEngineConfigurationImpl setHistoricVariableInstanceEntityManager(HistoricVariableInstanceEntityManager historicVariableInstanceEntityManager) { + this.historicVariableInstanceEntityManager = historicVariableInstanceEntityManager; + return this; + } + + public IdentityInfoEntityManager getIdentityInfoEntityManager() { + return this.identityInfoEntityManager; + } + + public ProcessEngineConfigurationImpl setIdentityInfoEntityManager(IdentityInfoEntityManager identityInfoEntityManager) { + this.identityInfoEntityManager = identityInfoEntityManager; + return this; + } + + public IdentityLinkEntityManager getIdentityLinkEntityManager() { + return this.identityLinkEntityManager; + } + + public ProcessEngineConfigurationImpl setIdentityLinkEntityManager(IdentityLinkEntityManager identityLinkEntityManager) { + this.identityLinkEntityManager = identityLinkEntityManager; + return this; + } + + public JobEntityManager getJobEntityManager() { + return this.jobEntityManager; + } + + public ProcessEngineConfigurationImpl setJobEntityManager(JobEntityManager jobEntityManager) { + this.jobEntityManager = jobEntityManager; + return this; + } + + public TimerJobEntityManager getTimerJobEntityManager() { + return this.timerJobEntityManager; + } + + public ProcessEngineConfigurationImpl setTimerJobEntityManager(TimerJobEntityManager timerJobEntityManager) { + this.timerJobEntityManager = timerJobEntityManager; + return this; + } + + public SuspendedJobEntityManager getSuspendedJobEntityManager() { + return this.suspendedJobEntityManager; + } + + public ProcessEngineConfigurationImpl setSuspendedJobEntityManager(SuspendedJobEntityManager suspendedJobEntityManager) { + this.suspendedJobEntityManager = suspendedJobEntityManager; + return this; + } + + public DeadLetterJobEntityManager getDeadLetterJobEntityManager() { + return this.deadLetterJobEntityManager; + } + + public ProcessEngineConfigurationImpl setDeadLetterJobEntityManager(DeadLetterJobEntityManager deadLetterJobEntityManager) { + this.deadLetterJobEntityManager = deadLetterJobEntityManager; + return this; + } + + public MembershipEntityManager getMembershipEntityManager() { + return this.membershipEntityManager; + } + + public ProcessEngineConfigurationImpl setMembershipEntityManager(MembershipEntityManager membershipEntityManager) { + this.membershipEntityManager = membershipEntityManager; + return this; + } + + public ModelEntityManager getModelEntityManager() { + return this.modelEntityManager; + } + + public ProcessEngineConfigurationImpl setModelEntityManager(ModelEntityManager modelEntityManager) { + this.modelEntityManager = modelEntityManager; + return this; + } + + public ProcessDefinitionEntityManager getProcessDefinitionEntityManager() { + return this.processDefinitionEntityManager; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionEntityManager(ProcessDefinitionEntityManager processDefinitionEntityManager) { + this.processDefinitionEntityManager = processDefinitionEntityManager; + return this; + } + + public ProcessDefinitionInfoEntityManager getProcessDefinitionInfoEntityManager() { + return this.processDefinitionInfoEntityManager; + } + + public ProcessEngineConfigurationImpl setProcessDefinitionInfoEntityManager(ProcessDefinitionInfoEntityManager processDefinitionInfoEntityManager) { + this.processDefinitionInfoEntityManager = processDefinitionInfoEntityManager; + return this; + } + + public PropertyEntityManager getPropertyEntityManager() { + return this.propertyEntityManager; + } + + public ProcessEngineConfigurationImpl setPropertyEntityManager(PropertyEntityManager propertyEntityManager) { + this.propertyEntityManager = propertyEntityManager; + return this; + } + + public ResourceEntityManager getResourceEntityManager() { + return this.resourceEntityManager; + } + + public ProcessEngineConfigurationImpl setResourceEntityManager(ResourceEntityManager resourceEntityManager) { + this.resourceEntityManager = resourceEntityManager; + return this; + } + + public TaskEntityManager getTaskEntityManager() { + return this.taskEntityManager; + } + + public ProcessEngineConfigurationImpl setTaskEntityManager(TaskEntityManager taskEntityManager) { + this.taskEntityManager = taskEntityManager; + return this; + } + + public UserEntityManager getUserEntityManager() { + return this.userEntityManager; + } + + public ProcessEngineConfigurationImpl setUserEntityManager(UserEntityManager userEntityManager) { + this.userEntityManager = userEntityManager; + return this; + } + + public VariableInstanceEntityManager getVariableInstanceEntityManager() { + return this.variableInstanceEntityManager; + } + + public ProcessEngineConfigurationImpl setVariableInstanceEntityManager(VariableInstanceEntityManager variableInstanceEntityManager) { + this.variableInstanceEntityManager = variableInstanceEntityManager; + return this; + } + + public TableDataManager getTableDataManager() { + return this.tableDataManager; + } + + public ProcessEngineConfigurationImpl setTableDataManager(TableDataManager tableDataManager) { + this.tableDataManager = tableDataManager; + return this; + } + + public HistoryManager getHistoryManager() { + return this.historyManager; + } + + public ProcessEngineConfigurationImpl setHistoryManager(HistoryManager historyManager) { + this.historyManager = historyManager; + return this; + } + + public JobManager getJobManager() { + return this.jobManager; + } + + public ProcessEngineConfigurationImpl setJobManager(JobManager jobManager) { + this.jobManager = jobManager; + return this; + } + + public ProcessEngineConfigurationImpl setClock(Clock clock) { + if (this.clock == null) { + this.clock = clock; + } else { + this.clock.setCurrentCalendar(clock.getCurrentCalendar()); + } + + if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { + this.getActiviti5CompatibilityHandler().setClock(clock); + } + + return this; + } + + public void resetClock() { + if (this.clock != null) { + this.clock.reset(); + if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { + this.getActiviti5CompatibilityHandler().resetClock(); + } + } + + } + + public DelegateExpressionFieldInjectionMode getDelegateExpressionFieldInjectionMode() { + return this.delegateExpressionFieldInjectionMode; + } + + public ProcessEngineConfigurationImpl setDelegateExpressionFieldInjectionMode(DelegateExpressionFieldInjectionMode delegateExpressionFieldInjectionMode) { + this.delegateExpressionFieldInjectionMode = delegateExpressionFieldInjectionMode; + return this; + } + + public ObjectMapper getObjectMapper() { + return this.objectMapper; + } + + public ProcessEngineConfigurationImpl setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + return this; + } + + public boolean isActiviti5CompatibilityEnabled() { + return this.isActiviti5CompatibilityEnabled; + } + + public ProcessEngineConfigurationImpl setActiviti5CompatibilityEnabled(boolean isActiviti5CompatibilityEnabled) { + this.isActiviti5CompatibilityEnabled = isActiviti5CompatibilityEnabled; + return this; + } + + public Activiti5CompatibilityHandlerFactory getActiviti5CompatibilityHandlerFactory() { + return this.activiti5CompatibilityHandlerFactory; + } + + public ProcessEngineConfigurationImpl setActiviti5CompatibilityHandlerFactory(Activiti5CompatibilityHandlerFactory activiti5CompatibilityHandlerFactory) { + this.activiti5CompatibilityHandlerFactory = activiti5CompatibilityHandlerFactory; + return this; + } + + public Activiti5CompatibilityHandler getActiviti5CompatibilityHandler() { + return this.activiti5CompatibilityHandler; + } + + public ProcessEngineConfigurationImpl setActiviti5CompatibilityHandler(Activiti5CompatibilityHandler activiti5CompatibilityHandler) { + this.activiti5CompatibilityHandler = activiti5CompatibilityHandler; + return this; + } + + public Object getActiviti5ActivityBehaviorFactory() { + return this.activiti5ActivityBehaviorFactory; + } + + public ProcessEngineConfigurationImpl setActiviti5ActivityBehaviorFactory(Object activiti5ActivityBehaviorFactory) { + this.activiti5ActivityBehaviorFactory = activiti5ActivityBehaviorFactory; + return this; + } + + public Object getActiviti5ListenerFactory() { + return this.activiti5ListenerFactory; + } + + public ProcessEngineConfigurationImpl setActiviti5ListenerFactory(Object activiti5ListenerFactory) { + this.activiti5ListenerFactory = activiti5ListenerFactory; + return this; + } + + public List<Object> getActiviti5PreBpmnParseHandlers() { + return this.activiti5PreBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setActiviti5PreBpmnParseHandlers(List<Object> activiti5PreBpmnParseHandlers) { + this.activiti5PreBpmnParseHandlers = activiti5PreBpmnParseHandlers; + return this; + } + + public List<Object> getActiviti5PostBpmnParseHandlers() { + return this.activiti5PostBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setActiviti5PostBpmnParseHandlers(List<Object> activiti5PostBpmnParseHandlers) { + this.activiti5PostBpmnParseHandlers = activiti5PostBpmnParseHandlers; + return this; + } + + public List<Object> getActiviti5CustomDefaultBpmnParseHandlers() { + return this.activiti5CustomDefaultBpmnParseHandlers; + } + + public ProcessEngineConfigurationImpl setActiviti5CustomDefaultBpmnParseHandlers(List<Object> activiti5CustomDefaultBpmnParseHandlers) { + this.activiti5CustomDefaultBpmnParseHandlers = activiti5CustomDefaultBpmnParseHandlers; + return this; + } + + public Set<Class<?>> getActiviti5CustomMybatisMappers() { + return this.activiti5CustomMybatisMappers; + } + + public ProcessEngineConfigurationImpl setActiviti5CustomMybatisMappers(Set<Class<?>> activiti5CustomMybatisMappers) { + this.activiti5CustomMybatisMappers = activiti5CustomMybatisMappers; + return this; + } + + public Set<String> getActiviti5CustomMybatisXMLMappers() { + return this.activiti5CustomMybatisXMLMappers; + } + + public ProcessEngineConfigurationImpl setActiviti5CustomMybatisXMLMappers(Set<String> activiti5CustomMybatisXMLMappers) { + this.activiti5CustomMybatisXMLMappers = activiti5CustomMybatisXMLMappers; + return this; + } + + public int getAsyncExecutorCorePoolSize() { + return this.asyncExecutorCorePoolSize; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorCorePoolSize(int asyncExecutorCorePoolSize) { + this.asyncExecutorCorePoolSize = asyncExecutorCorePoolSize; + return this; + } + + public int getAsyncExecutorNumberOfRetries() { + return this.asyncExecutorNumberOfRetries; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorNumberOfRetries(int asyncExecutorNumberOfRetries) { + this.asyncExecutorNumberOfRetries = asyncExecutorNumberOfRetries; + return this; + } + + public int getAsyncExecutorMaxPoolSize() { + return this.asyncExecutorMaxPoolSize; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorMaxPoolSize(int asyncExecutorMaxPoolSize) { + this.asyncExecutorMaxPoolSize = asyncExecutorMaxPoolSize; + return this; + } + + public long getAsyncExecutorThreadKeepAliveTime() { + return this.asyncExecutorThreadKeepAliveTime; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorThreadKeepAliveTime(long asyncExecutorThreadKeepAliveTime) { + this.asyncExecutorThreadKeepAliveTime = asyncExecutorThreadKeepAliveTime; + return this; + } + + public int getAsyncExecutorThreadPoolQueueSize() { + return this.asyncExecutorThreadPoolQueueSize; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorThreadPoolQueueSize(int asyncExecutorThreadPoolQueueSize) { + this.asyncExecutorThreadPoolQueueSize = asyncExecutorThreadPoolQueueSize; + return this; + } + + public BlockingQueue<Runnable> getAsyncExecutorThreadPoolQueue() { + return this.asyncExecutorThreadPoolQueue; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorThreadPoolQueue(BlockingQueue<Runnable> asyncExecutorThreadPoolQueue) { + this.asyncExecutorThreadPoolQueue = asyncExecutorThreadPoolQueue; + return this; + } + + public long getAsyncExecutorSecondsToWaitOnShutdown() { + return this.asyncExecutorSecondsToWaitOnShutdown; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorSecondsToWaitOnShutdown(long asyncExecutorSecondsToWaitOnShutdown) { + this.asyncExecutorSecondsToWaitOnShutdown = asyncExecutorSecondsToWaitOnShutdown; + return this; + } + + public int getAsyncExecutorMaxTimerJobsPerAcquisition() { + return this.asyncExecutorMaxTimerJobsPerAcquisition; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorMaxTimerJobsPerAcquisition(int asyncExecutorMaxTimerJobsPerAcquisition) { + this.asyncExecutorMaxTimerJobsPerAcquisition = asyncExecutorMaxTimerJobsPerAcquisition; + return this; + } + + public int getAsyncExecutorMaxAsyncJobsDuePerAcquisition() { + return this.asyncExecutorMaxAsyncJobsDuePerAcquisition; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorMaxAsyncJobsDuePerAcquisition(int asyncExecutorMaxAsyncJobsDuePerAcquisition) { + this.asyncExecutorMaxAsyncJobsDuePerAcquisition = asyncExecutorMaxAsyncJobsDuePerAcquisition; + return this; + } + + public int getAsyncExecutorDefaultTimerJobAcquireWaitTime() { + return this.asyncExecutorDefaultTimerJobAcquireWaitTime; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorDefaultTimerJobAcquireWaitTime(int asyncExecutorDefaultTimerJobAcquireWaitTime) { + this.asyncExecutorDefaultTimerJobAcquireWaitTime = asyncExecutorDefaultTimerJobAcquireWaitTime; + return this; + } + + public int getAsyncExecutorDefaultAsyncJobAcquireWaitTime() { + return this.asyncExecutorDefaultAsyncJobAcquireWaitTime; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorDefaultAsyncJobAcquireWaitTime(int asyncExecutorDefaultAsyncJobAcquireWaitTime) { + this.asyncExecutorDefaultAsyncJobAcquireWaitTime = asyncExecutorDefaultAsyncJobAcquireWaitTime; + return this; + } + + public int getAsyncExecutorDefaultQueueSizeFullWaitTime() { + return this.asyncExecutorDefaultQueueSizeFullWaitTime; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorDefaultQueueSizeFullWaitTime(int asyncExecutorDefaultQueueSizeFullWaitTime) { + this.asyncExecutorDefaultQueueSizeFullWaitTime = asyncExecutorDefaultQueueSizeFullWaitTime; + return this; + } + + public String getAsyncExecutorLockOwner() { + return this.asyncExecutorLockOwner; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorLockOwner(String asyncExecutorLockOwner) { + this.asyncExecutorLockOwner = asyncExecutorLockOwner; + return this; + } + + public int getAsyncExecutorTimerLockTimeInMillis() { + return this.asyncExecutorTimerLockTimeInMillis; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorTimerLockTimeInMillis(int asyncExecutorTimerLockTimeInMillis) { + this.asyncExecutorTimerLockTimeInMillis = asyncExecutorTimerLockTimeInMillis; + return this; + } + + public int getAsyncExecutorAsyncJobLockTimeInMillis() { + return this.asyncExecutorAsyncJobLockTimeInMillis; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorAsyncJobLockTimeInMillis(int asyncExecutorAsyncJobLockTimeInMillis) { + this.asyncExecutorAsyncJobLockTimeInMillis = asyncExecutorAsyncJobLockTimeInMillis; + return this; + } + + public int getAsyncExecutorResetExpiredJobsInterval() { + return this.asyncExecutorResetExpiredJobsInterval; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorResetExpiredJobsInterval(int asyncExecutorResetExpiredJobsInterval) { + this.asyncExecutorResetExpiredJobsInterval = asyncExecutorResetExpiredJobsInterval; + return this; + } + + public ExecuteAsyncRunnableFactory getAsyncExecutorExecuteAsyncRunnableFactory() { + return this.asyncExecutorExecuteAsyncRunnableFactory; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory asyncExecutorExecuteAsyncRunnableFactory) { + this.asyncExecutorExecuteAsyncRunnableFactory = asyncExecutorExecuteAsyncRunnableFactory; + return this; + } + + public int getAsyncExecutorResetExpiredJobsPageSize() { + return this.asyncExecutorResetExpiredJobsPageSize; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorResetExpiredJobsPageSize(int asyncExecutorResetExpiredJobsPageSize) { + this.asyncExecutorResetExpiredJobsPageSize = asyncExecutorResetExpiredJobsPageSize; + return this; + } + + public boolean isAsyncExecutorIsMessageQueueMode() { + return this.asyncExecutorMessageQueueMode; + } + + public ProcessEngineConfigurationImpl setAsyncExecutorMessageQueueMode(boolean asyncExecutorMessageQueueMode) { + this.asyncExecutorMessageQueueMode = asyncExecutorMessageQueueMode; + return this; + } +} diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java new file mode 100644 index 0000000..b452e92 --- /dev/null +++ b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java @@ -0,0 +1,1274 @@ +package org.activiti.engine.impl.db; + +import org.activiti.engine.ActivitiException; +import org.activiti.engine.ActivitiOptimisticLockingException; +import org.activiti.engine.ActivitiWrongDbException; +import org.activiti.engine.impl.*; +import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.activiti.engine.impl.context.Context; +import org.activiti.engine.impl.db.upgrade.DbUpgradeStep; +import org.activiti.engine.impl.interceptor.Session; +import org.activiti.engine.impl.persistence.cache.CachedEntity; +import org.activiti.engine.impl.persistence.cache.EntityCache; +import org.activiti.engine.impl.persistence.entity.Entity; +import org.activiti.engine.impl.persistence.entity.ExecutionEntity; +import org.activiti.engine.impl.persistence.entity.PropertyEntity; +import org.activiti.engine.impl.util.IoUtil; +import org.activiti.engine.impl.util.ReflectUtil; +import org.apache.ibatis.session.SqlSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DbSqlSession implements Session { + private static final Logger log = LoggerFactory.getLogger(DbSqlSession.class); + protected static final Pattern CLEAN_VERSION_REGEX = Pattern.compile("\\d\\.\\d*"); + protected static final String LAST_V5_VERSION = "5.99.0.0"; + protected static final List<ActivitiVersion> ACTIVITI_VERSIONS = new ArrayList(); + protected SqlSession sqlSession; + protected DbSqlSessionFactory dbSqlSessionFactory; + protected EntityCache entityCache; + protected Map<Class<? extends Entity>, Map<String, Entity>> insertedObjects = new HashMap(); + protected Map<Class<? extends Entity>, Map<String, Entity>> deletedObjects = new HashMap(); + protected Map<Class<? extends Entity>, List<BulkDeleteOperation>> bulkDeleteOperations = new HashMap(); + protected List<Entity> updatedObjects = new ArrayList(); + protected String connectionMetadataDefaultCatalog; + protected String connectionMetadataDefaultSchema; + public static String[] JDBC_METADATA_TABLE_TYPES; + + public DbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, EntityCache entityCache) { + this.dbSqlSessionFactory = dbSqlSessionFactory; + this.sqlSession = dbSqlSessionFactory.getSqlSessionFactory().openSession(); + this.entityCache = entityCache; + this.connectionMetadataDefaultCatalog = dbSqlSessionFactory.getDatabaseCatalog(); + this.connectionMetadataDefaultSchema = dbSqlSessionFactory.getDatabaseSchema(); + } + + public DbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, EntityCache entityCache, Connection connection, String catalog, String schema) { + this.dbSqlSessionFactory = dbSqlSessionFactory; + this.sqlSession = dbSqlSessionFactory.getSqlSessionFactory().openSession(connection); + this.entityCache = entityCache; + this.connectionMetadataDefaultCatalog = catalog; + this.connectionMetadataDefaultSchema = schema; + } + + public void insert(Entity entity) { + if (entity.getId() == null) { + String id = this.dbSqlSessionFactory.getIdGenerator().getNextId(); + entity.setId(id); + } + + Class<? extends Entity> clazz = entity.getClass(); + if (!this.insertedObjects.containsKey(clazz)) { + this.insertedObjects.put(clazz, new LinkedHashMap()); + } + + ((Map)this.insertedObjects.get(clazz)).put(entity.getId(), entity); + this.entityCache.put(entity, false); + entity.setInserted(true); + } + + public void update(Entity entity) { + this.entityCache.put(entity, false); + entity.setUpdated(true); + } + + public int update(String statement, Object parameters) { + String updateStatement = this.dbSqlSessionFactory.mapStatement(statement); + return this.getSqlSession().update(updateStatement, parameters); + } + + public void delete(String statement, Object parameter, Class<? extends Entity> entityClass) { + if (!this.bulkDeleteOperations.containsKey(entityClass)) { + this.bulkDeleteOperations.put(entityClass, new ArrayList(1)); + } + + ((List)this.bulkDeleteOperations.get(entityClass)).add(new BulkDeleteOperation(this.dbSqlSessionFactory.mapStatement(statement), parameter)); + } + + public void delete(Entity entity) { + Class<? extends Entity> clazz = entity.getClass(); + if (!this.deletedObjects.containsKey(clazz)) { + this.deletedObjects.put(clazz, new LinkedHashMap()); + } + + ((Map)this.deletedObjects.get(clazz)).put(entity.getId(), entity); + entity.setDeleted(true); + } + + public List selectList(String statement) { + return this.selectList(statement, (Object)null, 0, Integer.MAX_VALUE); + } + + public List selectList(String statement, Object parameter) { + return this.selectList(statement, parameter, 0, Integer.MAX_VALUE); + } + + public List selectList(String statement, Object parameter, boolean useCache) { + return this.selectList(statement, parameter, 0, Integer.MAX_VALUE, useCache); + } + + public List selectList(String statement, Object parameter, Page page) { + return this.selectList(statement, parameter, page, true); + } + + public List selectList(String statement, Object parameter, Page page, boolean useCache) { + return page != null ? this.selectList(statement, parameter, page.getFirstResult(), page.getMaxResults(), useCache) : this.selectList(statement, parameter, 0, Integer.MAX_VALUE, useCache); + } + + public List selectList(String statement, ListQueryParameterObject parameter, Page page) { + return this.selectList(statement, parameter, page, true); + } + + public List selectList(String statement, ListQueryParameterObject parameter, Page page, boolean useCache) { + ListQueryParameterObject parameterToUse = parameter; + if (parameterToUse == null) { + parameterToUse = new ListQueryParameterObject(); + } + + if (page != null) { + parameterToUse.setFirstResult(page.getFirstResult()); + parameterToUse.setMaxResults(page.getMaxResults()); + } + + return this.selectList(statement, parameterToUse, useCache); + } + + public List selectList(String statement, Object parameter, int firstResult, int maxResults) { + return this.selectList(statement, parameter, firstResult, maxResults, true); + } + + public List selectList(String statement, Object parameter, int firstResult, int maxResults, boolean useCache) { + return this.selectList(statement, new ListQueryParameterObject(parameter, firstResult, maxResults), useCache); + } + + public List selectList(String statement, ListQueryParameterObject parameter) { + return this.selectList(statement, parameter, true); + } + + public List selectList(String statement, ListQueryParameterObject parameter, boolean useCache) { + return this.selectListWithRawParameter(statement, parameter, parameter.getFirstResult(), parameter.getMaxResults(), useCache); + } + + public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults) { + return this.selectListWithRawParameter(statement, parameter, firstResult, maxResults, true); + } + + public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults, boolean useCache) { + statement = this.dbSqlSessionFactory.mapStatement(statement); + if (firstResult != -1 && maxResults != -1) { + List loadedObjects = this.sqlSession.selectList(statement, parameter); + return useCache ? this.cacheLoadOrStore(loadedObjects) : loadedObjects; + } else { + return Collections.EMPTY_LIST; + } + } + + public List selectListWithRawParameterWithoutFilter(String statement, Object parameter, int firstResult, int maxResults) { + statement = this.dbSqlSessionFactory.mapStatement(statement); + return firstResult != -1 && maxResults != -1 ? this.sqlSession.selectList(statement, parameter) : Collections.EMPTY_LIST; + } + + public Object selectOne(String statement, Object parameter) { + statement = this.dbSqlSessionFactory.mapStatement(statement); + Object result = this.sqlSession.selectOne(statement, parameter); + if (result instanceof Entity) { + Entity loadedObject = (Entity)result; + result = this.cacheLoadOrStore(loadedObject); + } + + return result; + } + + public <T extends Entity> T selectById(Class<T> entityClass, String id) { + return this.selectById(entityClass, id, true); + } + + public <T extends Entity> T selectById(Class<T> entityClass, String id, boolean useCache) { + T entity = null; + if (useCache) { + entity = (T) this.entityCache.findInCache(entityClass, id); + if (entity != null) { + return entity; + } + } + + String selectStatement = this.dbSqlSessionFactory.getSelectStatement(entityClass); + selectStatement = this.dbSqlSessionFactory.mapStatement(selectStatement); + entity = (T) this.sqlSession.selectOne(selectStatement, id); + if (entity == null) { + return null; + } else { + this.entityCache.put(entity, true); + return entity; + } + } + + protected List cacheLoadOrStore(List<Object> loadedObjects) { + if (loadedObjects.isEmpty()) { + return loadedObjects; + } else if (!(loadedObjects.get(0) instanceof Entity)) { + return loadedObjects; + } else { + List<Entity> filteredObjects = new ArrayList(loadedObjects.size()); + Iterator var3 = loadedObjects.iterator(); + + while(var3.hasNext()) { + Object loadedObject = var3.next(); + Entity cachedEntity = this.cacheLoadOrStore((Entity)loadedObject); + filteredObjects.add(cachedEntity); + } + + return filteredObjects; + } + } + + protected Entity cacheLoadOrStore(Entity entity) { + Entity cachedEntity = (Entity)this.entityCache.findInCache(entity.getClass(), entity.getId()); + if (cachedEntity != null) { + return cachedEntity; + } else { + this.entityCache.put(entity, true); + return entity; + } + } + + public void flush() { + this.determineUpdatedObjects(); + this.removeUnnecessaryOperations(); + if (log.isDebugEnabled()) { + this.debugFlush(); + } + + this.flushInserts(); + this.flushUpdates(); + this.flushDeletes(); + } + + protected void removeUnnecessaryOperations() { + Iterator var1 = this.deletedObjects.keySet().iterator(); + + while(var1.hasNext()) { + Class<? extends Entity> entityClass = (Class)var1.next(); + Set<String> ids = new HashSet(); + Iterator<Entity> entitiesToDeleteIterator = ((Map)this.deletedObjects.get(entityClass)).values().iterator(); + + while(entitiesToDeleteIterator.hasNext()) { + Entity entityToDelete = (Entity)entitiesToDeleteIterator.next(); + if (!ids.contains(entityToDelete.getId())) { + ids.add(entityToDelete.getId()); + } else { + entitiesToDeleteIterator.remove(); + } + } + + Iterator var7 = ids.iterator(); + + while(var7.hasNext()) { + String id = (String)var7.next(); + if (this.insertedObjects.containsKey(entityClass) && ((Map)this.insertedObjects.get(entityClass)).containsKey(id)) { + ((Map)this.insertedObjects.get(entityClass)).remove(id); + ((Map)this.deletedObjects.get(entityClass)).remove(id); + } + } + } + + } + + public void determineUpdatedObjects() { + this.updatedObjects = new ArrayList(); + Map<Class<?>, Map<String, CachedEntity>> cachedObjects = this.entityCache.getAllCachedEntities(); + Iterator var2 = cachedObjects.keySet().iterator(); + + label34: + while(var2.hasNext()) { + Class<?> clazz = (Class)var2.next(); + Map<String, CachedEntity> classCache = (Map)cachedObjects.get(clazz); + Iterator var5 = classCache.values().iterator(); + + while(true) { + CachedEntity cachedObject; + Entity cachedEntity; + do { + do { + if (!var5.hasNext()) { + continue label34; + } + + cachedObject = (CachedEntity)var5.next(); + cachedEntity = cachedObject.getEntity(); + } while(this.isEntityInserted(cachedEntity)); + } while(!ExecutionEntity.class.isAssignableFrom(cachedEntity.getClass()) && this.isEntityToBeDeleted(cachedEntity)); + + if (cachedObject.hasChanged()) { + this.updatedObjects.add(cachedEntity); + } + } + } + + } + + protected void debugFlush() { + log.debug("Flushing dbSqlSession"); + int nrOfInserts = 0; + int nrOfUpdates = 0; + int nrOfDeletes = 0; + Iterator var4 = this.insertedObjects.values().iterator(); + + Map deletedObjectMap; + Iterator var6; + Entity deletedObject; + while(var4.hasNext()) { + deletedObjectMap = (Map)var4.next(); + + for(var6 = deletedObjectMap.values().iterator(); var6.hasNext(); ++nrOfInserts) { + deletedObject = (Entity)var6.next(); + log.debug(" insert {}", deletedObject); + } + } + + for(var4 = this.updatedObjects.iterator(); var4.hasNext(); ++nrOfUpdates) { + Entity updatedObject = (Entity)var4.next(); + log.debug(" update {}", updatedObject); + } + + var4 = this.deletedObjects.values().iterator(); + + while(var4.hasNext()) { + deletedObjectMap = (Map)var4.next(); + + for(var6 = deletedObjectMap.values().iterator(); var6.hasNext(); ++nrOfDeletes) { + deletedObject = (Entity)var6.next(); + log.debug(" delete {} with id {}", deletedObject, deletedObject.getId()); + } + } + + var4 = this.bulkDeleteOperations.values().iterator(); + + while(var4.hasNext()) { + Collection<BulkDeleteOperation> bulkDeleteOperationList = (Collection)var4.next(); + + for(var6 = bulkDeleteOperationList.iterator(); var6.hasNext(); ++nrOfDeletes) { + BulkDeleteOperation bulkDeleteOperation = (BulkDeleteOperation)var6.next(); + log.debug(" {}", bulkDeleteOperation); + } + } + + log.debug("flush summary: {} insert, {} update, {} delete.", new Object[]{nrOfInserts, nrOfUpdates, nrOfDeletes}); + log.debug("now executing flush..."); + } + + public boolean isEntityInserted(Entity entity) { + return this.insertedObjects.containsKey(entity.getClass()) && ((Map)this.insertedObjects.get(entity.getClass())).containsKey(entity.getId()); + } + + public boolean isEntityToBeDeleted(Entity entity) { + return this.deletedObjects.containsKey(entity.getClass()) && ((Map)this.deletedObjects.get(entity.getClass())).containsKey(entity.getId()); + } + + protected void flushInserts() { + if (this.insertedObjects.size() != 0) { + Iterator var1 = EntityDependencyOrder.INSERT_ORDER.iterator(); + + Class entityClass; + while(var1.hasNext()) { + entityClass = (Class)var1.next(); + if (this.insertedObjects.containsKey(entityClass)) { + this.flushInsertEntities(entityClass, ((Map)this.insertedObjects.get(entityClass)).values()); + this.insertedObjects.remove(entityClass); + } + } + + if (this.insertedObjects.size() > 0) { + var1 = this.insertedObjects.keySet().iterator(); + + while(var1.hasNext()) { + entityClass = (Class)var1.next(); + this.flushInsertEntities(entityClass, ((Map)this.insertedObjects.get(entityClass)).values()); + } + } + + this.insertedObjects.clear(); + } + } + + protected void flushInsertEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToInsert) { + if (entitiesToInsert.size() == 1) { + this.flushRegularInsert((Entity)entitiesToInsert.iterator().next(), entityClass); + } else if (Boolean.FALSE.equals(this.dbSqlSessionFactory.isBulkInsertable(entityClass))) { + Iterator var3 = entitiesToInsert.iterator(); + + while(var3.hasNext()) { + Entity entity = (Entity)var3.next(); + this.flushRegularInsert(entity, entityClass); + } + } else { + this.flushBulkInsert(entitiesToInsert, entityClass); + } + + } + + protected Collection<Entity> orderExecutionEntities(Map<String, Entity> executionEntities, boolean parentBeforeChildExecution) { + List<Entity> result = new ArrayList(executionEntities.size()); + Map<String, String> childToParentExecutionMapping = new HashMap(); + Map<String, List<ExecutionEntity>> parentToChildrenMapping = new HashMap(); + Collection<Entity> executionCollection = executionEntities.values(); + + Iterator executionIterator; + ExecutionEntity currentExecutionEntity; + String executionId; + String parentId; + for(executionIterator = executionCollection.iterator(); executionIterator.hasNext(); ((List)parentToChildrenMapping.get(parentId)).add(currentExecutionEntity)) { + currentExecutionEntity = (ExecutionEntity)executionIterator.next(); + parentId = currentExecutionEntity.getParentId(); + executionId = currentExecutionEntity.getSuperExecutionId(); + parentId = parentId != null ? parentId : executionId; + childToParentExecutionMapping.put(currentExecutionEntity.getId(), parentId); + if (!parentToChildrenMapping.containsKey(parentId)) { + parentToChildrenMapping.put(parentId, new ArrayList()); + } + } + + Set<String> handledExecutionIds = new HashSet(executionEntities.size()); + executionIterator = executionCollection.iterator(); + + while(true) { + do { + if (!executionIterator.hasNext()) { + return result; + } + + currentExecutionEntity = (ExecutionEntity)executionIterator.next(); + executionId = currentExecutionEntity.getId(); + } while(handledExecutionIds.contains(executionId)); + + parentId = (String)childToParentExecutionMapping.get(executionId); + if (parentId != null) { + while(parentId != null) { + String newParentId = (String)childToParentExecutionMapping.get(parentId); + if (newParentId == null) { + break; + } + + parentId = newParentId; + } + } + + if (parentId == null) { + parentId = executionId; + } + + if (executionEntities.containsKey(parentId) && !handledExecutionIds.contains(parentId)) { + handledExecutionIds.add(parentId); + if (parentBeforeChildExecution) { + result.add(executionEntities.get(parentId)); + } else { + result.add(0, executionEntities.get(parentId)); + } + } + + this.collectChildExecutionsForInsertion(result, parentToChildrenMapping, handledExecutionIds, parentId, parentBeforeChildExecution); + } + } + + protected void collectChildExecutionsForInsertion(List<Entity> result, Map<String, List<ExecutionEntity>> parentToChildrenMapping, Set<String> handledExecutionIds, String parentId, boolean parentBeforeChildExecution) { + List<ExecutionEntity> childExecutionEntities = (List)parentToChildrenMapping.get(parentId); + if (childExecutionEntities != null) { + ExecutionEntity childExecutionEntity; + for(Iterator var7 = childExecutionEntities.iterator(); var7.hasNext(); this.collectChildExecutionsForInsertion(result, parentToChildrenMapping, handledExecutionIds, childExecutionEntity.getId(), parentBeforeChildExecution)) { + childExecutionEntity = (ExecutionEntity)var7.next(); + handledExecutionIds.add(childExecutionEntity.getId()); + if (parentBeforeChildExecution) { + result.add(childExecutionEntity); + } else { + result.add(0, childExecutionEntity); + } + } + + } + } + + protected void flushRegularInsert(Entity entity, Class<? extends Entity> clazz) { + String insertStatement = this.dbSqlSessionFactory.getInsertStatement(entity); + insertStatement = this.dbSqlSessionFactory.mapStatement(insertStatement); + if (insertStatement == null) { + throw new ActivitiException("no insert statement for " + entity.getClass() + " in the ibatis mapping files"); + } else { + log.debug("inserting: {}", entity); + this.sqlSession.insert(insertStatement, entity); + if (entity instanceof HasRevision) { + this.incrementRevision(entity); + } + + } + } + + protected void flushBulkInsert(Collection<Entity> entities, Class<? extends Entity> clazz) { + String insertStatement = this.dbSqlSessionFactory.getBulkInsertStatement(clazz); + insertStatement = this.dbSqlSessionFactory.mapStatement(insertStatement); + if (insertStatement == null) { + throw new ActivitiException("no insert statement for " + ((Entity)entities.iterator().next()).getClass() + " in the ibatis mapping files"); + } else { + Iterator<Entity> entityIterator = entities.iterator(); + Boolean hasRevision = null; + + while(entityIterator.hasNext()) { + List<Entity> subList = new ArrayList(); + + for(int index = 0; entityIterator.hasNext() && index < this.dbSqlSessionFactory.getMaxNrOfStatementsInBulkInsert(); ++index) { + Entity entity = (Entity)entityIterator.next(); + subList.add(entity); + if (hasRevision == null) { + hasRevision = entity instanceof HasRevision; + } + } + + this.sqlSession.insert(insertStatement, subList); + } + + if (hasRevision != null && hasRevision) { + entityIterator = entities.iterator(); + + while(entityIterator.hasNext()) { + this.incrementRevision((Entity)entityIterator.next()); + } + } + + } + } + + protected void incrementRevision(Entity insertedObject) { + HasRevision revisionEntity = (HasRevision)insertedObject; + if (revisionEntity.getRevision() == 0) { + revisionEntity.setRevision(revisionEntity.getRevisionNext()); + } + + } + + protected void flushUpdates() { + Iterator var1 = this.updatedObjects.iterator(); + + while(var1.hasNext()) { + Entity updatedObject = (Entity)var1.next(); + String updateStatement = this.dbSqlSessionFactory.getUpdateStatement(updatedObject); + updateStatement = this.dbSqlSessionFactory.mapStatement(updateStatement); + if (updateStatement == null) { + throw new ActivitiException("no update statement for " + updatedObject.getClass() + " in the ibatis mapping files"); + } + + log.debug("updating: {}", updatedObject); + int updatedRecords = this.sqlSession.update(updateStatement, updatedObject); + if (updatedRecords == 0) { + throw new ActivitiOptimisticLockingException(updatedObject + " was updated by another transaction concurrently"); + } + + if (updatedObject instanceof HasRevision) { + ((HasRevision)updatedObject).setRevision(((HasRevision)updatedObject).getRevisionNext()); + } + } + + this.updatedObjects.clear(); + } + + protected void flushDeletes() { + if (this.deletedObjects.size() != 0 || this.bulkDeleteOperations.size() != 0) { + Iterator var1; + Class entityClass; + for(var1 = EntityDependencyOrder.DELETE_ORDER.iterator(); var1.hasNext(); this.flushBulkDeletes(entityClass)) { + entityClass = (Class)var1.next(); + if (this.deletedObjects.containsKey(entityClass)) { + this.flushDeleteEntities(entityClass, ((Map)this.deletedObjects.get(entityClass)).values()); + this.deletedObjects.remove(entityClass); + } + } + + if (this.deletedObjects.size() > 0) { + var1 = this.deletedObjects.keySet().iterator(); + + while(var1.hasNext()) { + entityClass = (Class)var1.next(); + this.flushDeleteEntities(entityClass, ((Map)this.deletedObjects.get(entityClass)).values()); + this.flushBulkDeletes(entityClass); + } + } + + this.deletedObjects.clear(); + } + } + + protected void flushBulkDeletes(Class<? extends Entity> entityClass) { + if (this.bulkDeleteOperations.containsKey(entityClass)) { + Iterator var2 = ((List)this.bulkDeleteOperations.get(entityClass)).iterator(); + + while(var2.hasNext()) { + BulkDeleteOperation bulkDeleteOperation = (BulkDeleteOperation)var2.next(); + bulkDeleteOperation.execute(this.sqlSession); + } + } + + } + + protected void flushDeleteEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToDelete) { + Iterator var3 = entitiesToDelete.iterator(); + + while(var3.hasNext()) { + Entity entity = (Entity)var3.next(); + String deleteStatement = this.dbSqlSessionFactory.getDeleteStatement(entity.getClass()); + deleteStatement = this.dbSqlSessionFactory.mapStatement(deleteStatement); + if (deleteStatement == null) { + throw new ActivitiException("no delete statement for " + entity.getClass() + " in the ibatis mapping files"); + } + + if (entity instanceof HasRevision) { + int nrOfRowsDeleted = this.sqlSession.delete(deleteStatement, entity); + if (nrOfRowsDeleted == 0) { + throw new ActivitiOptimisticLockingException(entity + " was updated by another transaction concurrently"); + } + } else { + this.sqlSession.delete(deleteStatement, entity); + } + } + + } + + public void close() { + this.sqlSession.close(); + } + + public void commit() { + this.sqlSession.commit(); + } + + public void rollback() { + this.sqlSession.rollback(); + } + + public void dbSchemaCheckVersion() { + try { + String dbVersion = this.getDbVersion(); + if (!"6.0.0.4".equals(dbVersion)) { + throw new ActivitiWrongDbException("6.0.0.4", dbVersion); + } + + String errorMessage = null; + if (!this.isEngineTablePresent()) { + errorMessage = this.addMissingComponent(errorMessage, "engine"); + } + + if (this.dbSqlSessionFactory.isDbHistoryUsed() && !this.isHistoryTablePresent()) { + errorMessage = this.addMissingComponent(errorMessage, "history"); + } + + if (this.dbSqlSessionFactory.isDbIdentityUsed() && !this.isIdentityTablePresent()) { + errorMessage = this.addMissingComponent(errorMessage, "identity"); + } + + if (errorMessage != null) { + throw new ActivitiException("Activiti database problem: " + errorMessage); + } + } catch (Exception var3) { + Exception e = var3; + if (this.isMissingTablesException(e)) { + throw new ActivitiException("no activiti tables in db. set <property name=\"databaseSchemaUpdate\" to value=\"true\" or value=\"create-drop\" (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation", e); + } + + if (e instanceof RuntimeException) { + throw (RuntimeException)e; + } + + throw new ActivitiException("couldn't get db schema version", e); + } + + log.debug("activiti db schema check successful"); + } + + protected String addMissingComponent(String missingComponents, String component) { + return missingComponents == null ? "Tables missing for component(s) " + component : missingComponents + ", " + component; + } + + protected String getDbVersion() { + String selectSchemaVersionStatement = this.dbSqlSessionFactory.mapStatement("selectDbSchemaVersion"); + return (String)this.sqlSession.selectOne(selectSchemaVersionStatement); + } + + public void dbSchemaCreate() { + if (this.isEngineTablePresent()) { + String dbVersion = this.getDbVersion(); + if (!"6.0.0.4".equals(dbVersion)) { + throw new ActivitiWrongDbException("6.0.0.4", dbVersion); + } + } else { + this.dbSchemaCreateEngine(); + } + + if (this.dbSqlSessionFactory.isDbHistoryUsed()) { + this.dbSchemaCreateHistory(); + } + + if (this.dbSqlSessionFactory.isDbIdentityUsed()) { + this.dbSchemaCreateIdentity(); + } + + } + + protected void dbSchemaCreateIdentity() { + this.executeMandatorySchemaResource("create", "identity"); + } + + protected void dbSchemaCreateHistory() { + this.executeMandatorySchemaResource("create", "history"); + } + + protected void dbSchemaCreateEngine() { + this.executeMandatorySchemaResource("create", "engine"); + } + + public void dbSchemaDrop() { + this.executeMandatorySchemaResource("drop", "engine"); + if (this.dbSqlSessionFactory.isDbHistoryUsed()) { + this.executeMandatorySchemaResource("drop", "history"); + } + + if (this.dbSqlSessionFactory.isDbIdentityUsed()) { + this.executeMandatorySchemaResource("drop", "identity"); + } + + } + + public void dbSchemaPrune() { + if (this.isHistoryTablePresent() && !this.dbSqlSessionFactory.isDbHistoryUsed()) { + this.executeMandatorySchemaResource("drop", "history"); + } + + if (this.isIdentityTablePresent() && this.dbSqlSessionFactory.isDbIdentityUsed()) { + this.executeMandatorySchemaResource("drop", "identity"); + } + + } + + public void executeMandatorySchemaResource(String operation, String component) { + this.executeSchemaResource(operation, component, this.getResourceForDbOperation(operation, operation, component), false); + } + + public String dbSchemaUpdate() { + String feedback = null; + boolean isUpgradeNeeded = false; + int matchingVersionIndex = -1; + if (this.isEngineTablePresent()) { + PropertyEntity dbVersionProperty = (PropertyEntity)this.selectById(PropertyEntity.class, "schema.version"); + String dbVersion = dbVersionProperty.getValue(); + matchingVersionIndex = this.findMatchingVersionIndex(dbVersion); + if (matchingVersionIndex < 0 && dbVersion != null && dbVersion.startsWith("5.")) { + matchingVersionIndex = this.findMatchingVersionIndex("5.99.0.0"); + } + + if (matchingVersionIndex < 0) { + throw new ActivitiException("Could not update Activiti database schema: unknown version from database: '" + dbVersion + "'"); + } + + isUpgradeNeeded = matchingVersionIndex != ACTIVITI_VERSIONS.size() - 1; + if (isUpgradeNeeded) { + dbVersionProperty.setValue("6.0.0.4"); + PropertyEntity dbHistoryProperty; + if ("5.0".equals(dbVersion)) { + dbHistoryProperty = (PropertyEntity)Context.getCommandContext().getPropertyEntityManager().create(); + dbHistoryProperty.setName("schema.history"); + dbHistoryProperty.setValue("create(5.0)"); + this.insert(dbHistoryProperty); + } else { + dbHistoryProperty = (PropertyEntity)this.selectById(PropertyEntity.class, "schema.history"); + } + + String dbHistoryValue = dbHistoryProperty.getValue() + " upgrade(" + dbVersion + "->" + "6.0.0.4" + ")"; + dbHistoryProperty.setValue(dbHistoryValue); + this.dbSchemaUpgrade("engine", matchingVersionIndex); + feedback = "upgraded Activiti from " + dbVersion + " to " + "6.0.0.4"; + } + } else { + this.dbSchemaCreateEngine(); + } + + if (this.isHistoryTablePresent()) { + if (isUpgradeNeeded) { + this.dbSchemaUpgrade("history", matchingVersionIndex); + } + } else if (this.dbSqlSessionFactory.isDbHistoryUsed()) { + this.dbSchemaCreateHistory(); + } + + if (this.isIdentityTablePresent()) { + if (isUpgradeNeeded) { + this.dbSchemaUpgrade("identity", matchingVersionIndex); + } + } else if (this.dbSqlSessionFactory.isDbIdentityUsed()) { + this.dbSchemaCreateIdentity(); + } + + return feedback; + } + + protected int findMatchingVersionIndex(String dbVersion) { + int index = 0; + int matchingVersionIndex = -1; + + while(matchingVersionIndex < 0 && index < ACTIVITI_VERSIONS.size()) { + if (((ActivitiVersion)ACTIVITI_VERSIONS.get(index)).matches(dbVersion)) { + matchingVersionIndex = index; + } else { + ++index; + } + } + + return matchingVersionIndex; + } + + public boolean isEngineTablePresent() { + return this.isTablePresent("ACT_RU_EXECUTION"); + } + + public boolean isHistoryTablePresent() { + return this.isTablePresent("ACT_HI_PROCINST"); + } + + public boolean isIdentityTablePresent() { + return this.isTablePresent("ACT_ID_USER"); + } + + public boolean isTablePresent(String tableName) { + if (!this.dbSqlSessionFactory.isTablePrefixIsSchema()) { + tableName = this.prependDatabaseTablePrefix(tableName); + } + + Connection connection = null; + + try { + connection = this.sqlSession.getConnection(); + DatabaseMetaData databaseMetaData = connection.getMetaData(); + ResultSet tables = null; + String catalog = this.connectionMetadataDefaultCatalog; + if (this.dbSqlSessionFactory.getDatabaseCatalog() != null && this.dbSqlSessionFactory.getDatabaseCatalog().length() > 0) { + catalog = this.dbSqlSessionFactory.getDatabaseCatalog(); + } + + String schema = this.connectionMetadataDefaultSchema; + if (this.dbSqlSessionFactory.getDatabaseSchema() != null && this.dbSqlSessionFactory.getDatabaseSchema().length() > 0) { + schema = this.dbSqlSessionFactory.getDatabaseSchema(); + } + + String databaseType = this.dbSqlSessionFactory.getDatabaseType(); + if ("postgres".equals(databaseType)) { + tableName = tableName.toLowerCase(); + } + + if (schema != null && "oracle".equals(databaseType)) { + schema = schema.toUpperCase(); + } + + if (catalog != null && catalog.length() == 0) { + catalog = null; + } + + boolean var8; + try { + tables = databaseMetaData.getTables(catalog, schema, tableName, JDBC_METADATA_TABLE_TYPES); + var8 = tables.next(); + } finally { + try { + tables.close(); + } catch (Exception var16) { + Exception e = var16; + log.error("Error closing meta data tables", e); + } + + } + + return var8; + } catch (Exception var18) { + Exception e = var18; + throw new ActivitiException("couldn't check if tables are already present using metadata: " + e.getMessage(), e); + } + } + + protected boolean isUpgradeNeeded(String versionInDatabase) { + if ("6.0.0.4".equals(versionInDatabase)) { + return false; + } else { + String cleanDbVersion = this.getCleanVersion(versionInDatabase); + String[] cleanDbVersionSplitted = cleanDbVersion.split("\\."); + int dbMajorVersion = Integer.valueOf(cleanDbVersionSplitted[0]); + int dbMinorVersion = Integer.valueOf(cleanDbVersionSplitted[1]); + String cleanEngineVersion = this.getCleanVersion("6.0.0.4"); + String[] cleanEngineVersionSplitted = cleanEngineVersion.split("\\."); + int engineMajorVersion = Integer.valueOf(cleanEngineVersionSplitted[0]); + int engineMinorVersion = Integer.valueOf(cleanEngineVersionSplitted[1]); + if (dbMajorVersion <= engineMajorVersion && (dbMajorVersion > engineMajorVersion || dbMinorVersion <= engineMinorVersion)) { + if (cleanDbVersion.compareTo(cleanEngineVersion) == 0) { + log.warn("Engine-version is the same, but not an exact match: {} vs. {}. Not performing database-upgrade.", versionInDatabase, "6.0.0.4"); + return false; + } else { + return true; + } + } else { + throw new ActivitiException("Version of activiti database (" + versionInDatabase + ") is more recent than the engine (" + "6.0.0.4" + ")"); + } + } + } + + protected String getCleanVersion(String versionString) { + Matcher matcher = CLEAN_VERSION_REGEX.matcher(versionString); + if (!matcher.find()) { + throw new ActivitiException("Illegal format for version: " + versionString); + } else { + String cleanString = matcher.group(); + + try { + Double.parseDouble(cleanString); + return cleanString; + } catch (NumberFormatException var5) { + throw new ActivitiException("Illegal format for version: " + versionString); + } + } + } + + protected String prependDatabaseTablePrefix(String tableName) { + return this.dbSqlSessionFactory.getDatabaseTablePrefix() + tableName; + } + + protected void dbSchemaUpgrade(String component, int currentDatabaseVersionsIndex) { + ActivitiVersion activitiVersion = (ActivitiVersion)ACTIVITI_VERSIONS.get(currentDatabaseVersionsIndex); + String dbVersion = activitiVersion.getMainVersion(); + log.info("upgrading activiti {} schema from {} to {}", new Object[]{component, dbVersion, "6.0.0.4"}); + + for(int i = currentDatabaseVersionsIndex + 1; i < ACTIVITI_VERSIONS.size(); ++i) { + String nextVersion = ((ActivitiVersion)ACTIVITI_VERSIONS.get(i)).getMainVersion(); + if (nextVersion.endsWith("-SNAPSHOT")) { + nextVersion = nextVersion.substring(0, nextVersion.length() - "-SNAPSHOT".length()); + } + + dbVersion = dbVersion.replace(".", ""); + nextVersion = nextVersion.replace(".", ""); + log.info("Upgrade needed: {} -> {}. Looking for schema update resource for component '{}'", new Object[]{dbVersion, nextVersion, component}); + this.executeSchemaResource("upgrade", component, this.getResourceForDbOperation("upgrade", "upgradestep." + dbVersion + ".to." + nextVersion, component), true); + dbVersion = nextVersion; + } + + } + + public String getResourceForDbOperation(String directory, String operation, String component) { + String databaseType = this.dbSqlSessionFactory.getDatabaseType(); + // 褰揹atabaseType 涓篸m鏃讹紝鍊熺敤oracle鐨剆ql鏂囦欢鏉ヤ唬鏇挎墽琛� + if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) { + databaseType = ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE; + } + return "org/activiti/db/" + directory + "/activiti." + databaseType + "." + operation + "." + component + ".sql"; + } + + public void executeSchemaResource(String operation, String component, String resourceName, boolean isOptional) { + InputStream inputStream = null; + + try { + inputStream = ReflectUtil.getResourceAsStream(resourceName); + if (inputStream == null) { + if (!isOptional) { + throw new ActivitiException("resource '" + resourceName + "' is not available"); + } + + log.info("no schema resource {} for {}", resourceName, operation); + } else { + this.executeSchemaResource(operation, component, resourceName, inputStream); + } + } finally { + IoUtil.closeSilently(inputStream); + } + + } + + private void executeSchemaResource(String operation, String component, String resourceName, InputStream inputStream) { + log.info("performing {} on {} with resource {}", new Object[]{operation, component, resourceName}); + String sqlStatement = null; + String exceptionSqlStatement = null; + + try { + Connection connection = this.sqlSession.getConnection(); + Exception exception = null; + byte[] bytes = IoUtil.readInputStream(inputStream, resourceName); + String ddlStatements = new String(bytes); + + try { + if (this.isMysql()) { + DatabaseMetaData databaseMetaData = connection.getMetaData(); + int majorVersion = databaseMetaData.getDatabaseMajorVersion(); + int minorVersion = databaseMetaData.getDatabaseMinorVersion(); + log.info("Found MySQL: majorVersion=" + majorVersion + " minorVersion=" + minorVersion); + if (majorVersion <= 5 && minorVersion < 6) { + ddlStatements = this.updateDdlForMySqlVersionLowerThan56(ddlStatements); + } + } + } catch (Exception var26) { + Exception e = var26; + log.info("Could not get database metadata", e); + } + + BufferedReader reader = new BufferedReader(new StringReader(ddlStatements)); + String line = this.readNextTrimmedLine(reader); + + for(boolean inOraclePlsqlBlock = false; line != null; line = this.readNextTrimmedLine(reader)) { + if (line.startsWith("# ")) { + log.debug(line.substring(2)); + } else if (line.startsWith("-- ")) { + log.debug(line.substring(3)); + } else { + Exception e; + if (line.startsWith("execute java ")) { + String upgradestepClassName = line.substring(13).trim(); + e = null; + + DbUpgradeStep dbUpgradeStep; + try { + dbUpgradeStep = (DbUpgradeStep)ReflectUtil.instantiate(upgradestepClassName); + } catch (ActivitiException var25) { + ActivitiException ex = var25; + throw new ActivitiException("database update java class '" + upgradestepClassName + "' can't be instantiated: " + ex.getMessage(), ex); + } + + try { + log.debug("executing upgrade step java class {}", upgradestepClassName); + dbUpgradeStep.execute(this); + } catch (Exception var24) { + Exception ex = var24; + throw new ActivitiException("error while executing database update java class '" + upgradestepClassName + "': " + ex.getMessage(), ex); + } + } else if (line.length() > 0) { + if (this.isOracle() && line.startsWith("begin")) { + inOraclePlsqlBlock = true; + sqlStatement = this.addSqlStatementPiece(sqlStatement, line); + } else if ((!line.endsWith(";") || inOraclePlsqlBlock) && (!line.startsWith("/") || !inOraclePlsqlBlock)) { + sqlStatement = this.addSqlStatementPiece(sqlStatement, line); + } else { + if (inOraclePlsqlBlock) { + inOraclePlsqlBlock = false; + } else { + sqlStatement = this.addSqlStatementPiece(sqlStatement, line.substring(0, line.length() - 1)); + } + + Statement jdbcStatement = connection.createStatement(); + + try { + log.debug("SQL: {}", sqlStatement); + jdbcStatement.execute(sqlStatement); + jdbcStatement.close(); + } catch (Exception var27) { + e = var27; + if (exception == null) { + exception = e; + } + + log.error("problem during schema {}, statement {}", new Object[]{operation, sqlStatement, e}); + } finally { + sqlStatement = null; + } + } + } + } + } + + if (exception != null) { + throw exception; + } else { + log.debug("activiti db schema {} for component {} successful", operation, component); + } + } catch (Exception var29) { + Exception e = var29; + throw new ActivitiException("couldn't " + operation + " db schema: " + exceptionSqlStatement, e); + } + } + + protected String updateDdlForMySqlVersionLowerThan56(String ddlStatements) { + return ddlStatements.replace("timestamp(3)", "timestamp").replace("datetime(3)", "datetime").replace("TIMESTAMP(3)", "TIMESTAMP").replace("DATETIME(3)", "DATETIME"); + } + + protected String addSqlStatementPiece(String sqlStatement, String line) { + return sqlStatement == null ? line : sqlStatement + " \n" + line; + } + + protected String readNextTrimmedLine(BufferedReader reader) throws IOException { + String line = reader.readLine(); + if (line != null) { + line = line.trim(); + } + + return line; + } + + protected boolean isMissingTablesException(Exception e) { + String exceptionMessage = e.getMessage(); + if (e.getMessage() != null) { + if (exceptionMessage.indexOf("Table") != -1 && exceptionMessage.indexOf("not found") != -1) { + return true; + } + + if ((exceptionMessage.indexOf("Table") != -1 || exceptionMessage.indexOf("table") != -1) && exceptionMessage.indexOf("doesn't exist") != -1) { + return true; + } + + if ((exceptionMessage.indexOf("relation") != -1 || exceptionMessage.indexOf("table") != -1) && exceptionMessage.indexOf("does not exist") != -1) { + return true; + } + } + + return false; + } + + public void performSchemaOperationsProcessEngineBuild() { + String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate(); + log.debug("Executing performSchemaOperationsProcessEngineBuild with setting " + databaseSchemaUpdate); + if ("drop-create".equals(databaseSchemaUpdate)) { + try { + this.dbSchemaDrop(); + } catch (RuntimeException var3) { + } + } + + if (!"create-drop".equals(databaseSchemaUpdate) && !"drop-create".equals(databaseSchemaUpdate) && !"create".equals(databaseSchemaUpdate)) { + if ("false".equals(databaseSchemaUpdate)) { + this.dbSchemaCheckVersion(); + } else if ("true".equals(databaseSchemaUpdate)) { + this.dbSchemaUpdate(); + } + } else { + this.dbSchemaCreate(); + } + + } + + public void performSchemaOperationsProcessEngineClose() { + String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate(); + if ("create-drop".equals(databaseSchemaUpdate)) { + this.dbSchemaDrop(); + } + + } + + public <T> T getCustomMapper(Class<T> type) { + return this.sqlSession.getMapper(type); + } + + public boolean isMysql() { + return this.dbSqlSessionFactory.getDatabaseType().equals("mysql"); + } + + public boolean isOracle() { + return this.dbSqlSessionFactory.getDatabaseType().equals("oracle"); + } + + public DeploymentQueryImpl createDeploymentQuery() { + return new DeploymentQueryImpl(); + } + + public ModelQueryImpl createModelQueryImpl() { + return new ModelQueryImpl(); + } + + public ProcessDefinitionQueryImpl createProcessDefinitionQuery() { + return new ProcessDefinitionQueryImpl(); + } + + public ProcessInstanceQueryImpl createProcessInstanceQuery() { + return new ProcessInstanceQueryImpl(); + } + + public ExecutionQueryImpl createExecutionQuery() { + return new ExecutionQueryImpl(); + } + + public TaskQueryImpl createTaskQuery() { + return new TaskQueryImpl(); + } + + public JobQueryImpl createJobQuery() { + return new JobQueryImpl(); + } + + public HistoricProcessInstanceQueryImpl createHistoricProcessInstanceQuery() { + return new HistoricProcessInstanceQueryImpl(); + } + + public HistoricActivityInstanceQueryImpl createHistoricActivityInstanceQuery() { + return new HistoricActivityInstanceQueryImpl(); + } + + public HistoricTaskInstanceQueryImpl createHistoricTaskInstanceQuery() { + return new HistoricTaskInstanceQueryImpl(); + } + + public HistoricDetailQueryImpl createHistoricDetailQuery() { + return new HistoricDetailQueryImpl(); + } + + public HistoricVariableInstanceQueryImpl createHistoricVariableInstanceQuery() { + return new HistoricVariableInstanceQueryImpl(); + } + + public UserQueryImpl createUserQuery() { + return new UserQueryImpl(); + } + + public GroupQueryImpl createGroupQuery() { + return new GroupQueryImpl(); + } + + public SqlSession getSqlSession() { + return this.sqlSession; + } + + public DbSqlSessionFactory getDbSqlSessionFactory() { + return this.dbSqlSessionFactory; + } + + static { + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.7")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.8")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.9")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.10")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.11")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.12", Arrays.asList("5.12.1", "5.12T"))); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.13")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.14")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.15")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.15.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.2-SNAPSHOT")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.2")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.3.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.4.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.2")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.18.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.18.0.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.2")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.21.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.22.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("5.99.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.0")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.1")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.2")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.3")); + ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.4")); + JDBC_METADATA_TABLE_TYPES = new String[]{"TABLE"}; + } +} diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java new file mode 100644 index 0000000..a71afda --- /dev/null +++ b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java @@ -0,0 +1,301 @@ +package org.activiti.engine.impl.db; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +import org.activiti.engine.ActivitiException; +import org.activiti.engine.impl.cfg.IdGenerator; +import org.activiti.engine.impl.interceptor.CommandContext; +import org.activiti.engine.impl.interceptor.Session; +import org.activiti.engine.impl.interceptor.SessionFactory; +import org.activiti.engine.impl.persistence.entity.Entity; +import org.activiti.engine.impl.persistence.entity.EventLogEntryEntityImpl; +import org.apache.ibatis.session.SqlSessionFactory; + +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class DbSqlSessionFactory implements SessionFactory { + protected static final Map<String, Map<String, String>> databaseSpecificStatements = new HashMap(); + protected static Map<Class<? extends Entity>, Boolean> bulkInsertableMap; + protected String databaseType; + protected String databaseTablePrefix = ""; + private boolean tablePrefixIsSchema; + protected String databaseCatalog; + protected String databaseSchema; + protected SqlSessionFactory sqlSessionFactory; + protected IdGenerator idGenerator; + protected Map<String, String> statementMappings; + protected Map<Class<?>, String> insertStatements = new ConcurrentHashMap(); + protected Map<Class<?>, String> bulkInsertStatements = new ConcurrentHashMap(); + protected Map<Class<?>, String> updateStatements = new ConcurrentHashMap(); + protected Map<Class<?>, String> deleteStatements = new ConcurrentHashMap(); + protected Map<Class<?>, String> bulkDeleteStatements = new ConcurrentHashMap(); + protected Map<Class<?>, String> selectStatements = new ConcurrentHashMap(); + protected boolean isDbIdentityUsed = true; + protected boolean isDbHistoryUsed = true; + protected int maxNrOfStatementsInBulkInsert = 100; + + public DbSqlSessionFactory() { + } + + public Class<?> getSessionType() { + return DbSqlSession.class; + } + + public Session openSession(CommandContext commandContext) { + DbSqlSession dbSqlSession = new DbSqlSession(this, commandContext.getEntityCache()); + SQLException e; + if (this.getDatabaseSchema() != null && this.getDatabaseSchema().length() > 0) { + try { + dbSqlSession.getSqlSession().getConnection().setSchema(this.getDatabaseSchema()); + } catch (SQLException var5) { + e = var5; + throw new ActivitiException("Could not set database schema on connection", e); + } + } + + if (this.getDatabaseCatalog() != null && this.getDatabaseCatalog().length() > 0) { + try { + dbSqlSession.getSqlSession().getConnection().setCatalog(this.getDatabaseCatalog()); + } catch (SQLException var4) { + e = var4; + throw new ActivitiException("Could not set database catalog on connection", e); + } + } + + return dbSqlSession; + } + + public String getInsertStatement(Entity object) { + return this.getStatement(object.getClass(), this.insertStatements, "insert"); + } + + public String getInsertStatement(Class<? extends Entity> clazz) { + return this.getStatement(clazz, this.insertStatements, "insert"); + } + + public String getBulkInsertStatement(Class clazz) { + return this.getStatement(clazz, this.bulkInsertStatements, "bulkInsert"); + } + + public String getUpdateStatement(Entity object) { + return this.getStatement(object.getClass(), this.updateStatements, "update"); + } + + public String getDeleteStatement(Class<?> entityClass) { + return this.getStatement(entityClass, this.deleteStatements, "delete"); + } + + public String getBulkDeleteStatement(Class<?> entityClass) { + return this.getStatement(entityClass, this.bulkDeleteStatements, "bulkDelete"); + } + + public String getSelectStatement(Class<?> entityClass) { + return this.getStatement(entityClass, this.selectStatements, "select"); + } + + private String getStatement(Class<?> entityClass, Map<Class<?>, String> cachedStatements, String prefix) { + String statement = (String)cachedStatements.get(entityClass); + if (statement != null) { + return statement; + } else { + statement = prefix + entityClass.getSimpleName(); + if (statement.endsWith("Impl")) { + statement = statement.substring(0, statement.length() - 10); + } else { + statement = statement.substring(0, statement.length() - 6); + } + + cachedStatements.put(entityClass, statement); + return statement; + } + } + + protected static void addDatabaseSpecificStatement(String databaseType, String activitiStatement, String ibatisStatement) { + Map<String, String> specificStatements = (Map)databaseSpecificStatements.get(databaseType); + if (specificStatements == null) { + specificStatements = new HashMap(); + databaseSpecificStatements.put(databaseType, specificStatements); + } + + ((Map)specificStatements).put(activitiStatement, ibatisStatement); + } + + public String mapStatement(String statement) { + if (this.statementMappings == null) { + return statement; + } else { + String mappedStatement = (String)this.statementMappings.get(statement); + return mappedStatement != null ? mappedStatement : statement; + } + } + + public void setDatabaseType(String databaseType) { + this.databaseType = databaseType; + this.statementMappings = (Map)databaseSpecificStatements.get(databaseType); + } + + public void setBulkInsertEnabled(boolean isBulkInsertEnabled, String databaseType) { + if (isBulkInsertEnabled) { + this.initBulkInsertEnabledMap(databaseType); + } + + } + + protected void initBulkInsertEnabledMap(String databaseType) { + bulkInsertableMap = new HashMap(); + Iterator var2 = EntityDependencyOrder.INSERT_ORDER.iterator(); + + while(var2.hasNext()) { + Class<? extends Entity> clazz = (Class)var2.next(); + bulkInsertableMap.put(clazz, Boolean.TRUE); + } + + if ("oracle".equals(databaseType) || "dm".equals(databaseType)) { + bulkInsertableMap.put(EventLogEntryEntityImpl.class, Boolean.FALSE); + } + + } + + public Boolean isBulkInsertable(Class<? extends Entity> entityClass) { + return bulkInsertableMap != null && bulkInsertableMap.containsKey(entityClass) && (Boolean)bulkInsertableMap.get(entityClass); + } + + public SqlSessionFactory getSqlSessionFactory() { + return this.sqlSessionFactory; + } + + public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { + this.sqlSessionFactory = sqlSessionFactory; + } + + public IdGenerator getIdGenerator() { + return this.idGenerator; + } + + public void setIdGenerator(IdGenerator idGenerator) { + this.idGenerator = idGenerator; + } + + public String getDatabaseType() { + return this.databaseType; + } + + public Map<String, String> getStatementMappings() { + return this.statementMappings; + } + + public void setStatementMappings(Map<String, String> statementMappings) { + this.statementMappings = statementMappings; + } + + public Map<Class<?>, String> getInsertStatements() { + return this.insertStatements; + } + + public void setInsertStatements(Map<Class<?>, String> insertStatements) { + this.insertStatements = insertStatements; + } + + public Map<Class<?>, String> getBulkInsertStatements() { + return this.bulkInsertStatements; + } + + public void setBulkInsertStatements(Map<Class<?>, String> bulkInsertStatements) { + this.bulkInsertStatements = bulkInsertStatements; + } + + public Map<Class<?>, String> getUpdateStatements() { + return this.updateStatements; + } + + public void setUpdateStatements(Map<Class<?>, String> updateStatements) { + this.updateStatements = updateStatements; + } + + public Map<Class<?>, String> getDeleteStatements() { + return this.deleteStatements; + } + + public void setDeleteStatements(Map<Class<?>, String> deleteStatements) { + this.deleteStatements = deleteStatements; + } + + public Map<Class<?>, String> getBulkDeleteStatements() { + return this.bulkDeleteStatements; + } + + public void setBulkDeleteStatements(Map<Class<?>, String> bulkDeleteStatements) { + this.bulkDeleteStatements = bulkDeleteStatements; + } + + public Map<Class<?>, String> getSelectStatements() { + return this.selectStatements; + } + + public void setSelectStatements(Map<Class<?>, String> selectStatements) { + this.selectStatements = selectStatements; + } + + public boolean isDbIdentityUsed() { + return this.isDbIdentityUsed; + } + + public void setDbIdentityUsed(boolean isDbIdentityUsed) { + this.isDbIdentityUsed = isDbIdentityUsed; + } + + public boolean isDbHistoryUsed() { + return this.isDbHistoryUsed; + } + + public void setDbHistoryUsed(boolean isDbHistoryUsed) { + this.isDbHistoryUsed = isDbHistoryUsed; + } + + public void setDatabaseTablePrefix(String databaseTablePrefix) { + this.databaseTablePrefix = databaseTablePrefix; + } + + public String getDatabaseTablePrefix() { + return this.databaseTablePrefix; + } + + public String getDatabaseCatalog() { + return this.databaseCatalog; + } + + public void setDatabaseCatalog(String databaseCatalog) { + this.databaseCatalog = databaseCatalog; + } + + public String getDatabaseSchema() { + return this.databaseSchema; + } + + public void setDatabaseSchema(String databaseSchema) { + this.databaseSchema = databaseSchema; + } + + public void setTablePrefixIsSchema(boolean tablePrefixIsSchema) { + this.tablePrefixIsSchema = tablePrefixIsSchema; + } + + public boolean isTablePrefixIsSchema() { + return this.tablePrefixIsSchema; + } + + public int getMaxNrOfStatementsInBulkInsert() { + return this.maxNrOfStatementsInBulkInsert; + } + + public void setMaxNrOfStatementsInBulkInsert(int maxNrOfStatementsInBulkInsert) { + this.maxNrOfStatementsInBulkInsert = maxNrOfStatementsInBulkInsert; + } +} diff --git a/lxzn-module-dnc/pom.xml b/lxzn-module-dnc/pom.xml index 6225e47..1e40853 100644 --- a/lxzn-module-dnc/pom.xml +++ b/lxzn-module-dnc/pom.xml @@ -20,6 +20,32 @@ <groupId>org.jeecgframework.boot</groupId> <artifactId>lxzn-system-biz</artifactId> </dependency> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-module-activiti</artifactId> + <version>3.4.3</version> + </dependency> + <dependency> + <groupId>org.graylog2</groupId> + <artifactId>syslog4j</artifactId> + <version>0.9.60</version> + </dependency> + <dependency> + <groupId>org.graylog2</groupId> + <artifactId>syslog4j</artifactId> + <version>0.9.60</version> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk15on</artifactId> + <version>1.68</version> + <scope>compile</scope> + </dependency> + <!-- MockMultipartFile --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + </dependency> </dependencies> -</project> \ No newline at end of file +</project> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java new file mode 100644 index 0000000..5699c5a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java @@ -0,0 +1,60 @@ +package org.jeecg.modules.activiti.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.activiti.entity.ActivitiDefinition; +import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; +import org.jeecg.modules.activiti.service.IActivitiDefinitionService; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@Api(tags = "DNC娴佺▼閰嶇疆") +@RestController +@RequestMapping("/nc/definition") +public class ActivitiDefinitionController { + @Autowired + private IActivitiDefinitionService definitionService; + + @AutoLog(value = "DNC娴佺▼閰嶇疆-娣诲姞閰嶇疆") + @ApiOperation(value = "DNC娴佺▼閰嶇疆-娣诲姞閰嶇疆", notes = "DNC娴佺▼閰嶇疆-娣诲姞閰嶇疆") + @PostMapping("/add") + public ResponseResult addDefinition(@RequestBody ActivitiDefinition definition) { + boolean b = definitionService.addDefinition(definition); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼閰嶇疆-淇敼閰嶇疆") + @ApiOperation(value = "DNC娴佺▼閰嶇疆-淇敼閰嶇疆", notes = "DNC娴佺▼閰嶇疆-淇敼閰嶇疆") + @PutMapping("/edit/{id}") + public ResponseResult editDefinition(@PathVariable("id") String id, @RequestBody ActivitiDefinition definition) { + boolean b = definitionService.editDefinition(id, definition); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") + @ApiOperation(value = "DNC娴佺▼閰嶇疆-鍒犻櫎閰嶇疆", notes = "DNC娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") + @DeleteMapping("/delete") + public ResponseResult deleteDefinition(@RequestParam("id") String id) { + boolean b = definitionService.deleteDefinition(id); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") + @ApiOperation(value = "DNC娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃", notes = "DNC娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") + @GetMapping("/find/page/{page}/{size}") + public QueryPageResponseResult<ActivitiDefinition> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, ActivitiDefinitionRequest request) { + return definitionService.findPageList(page, size, request); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java new file mode 100644 index 0000000..dff2503 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java @@ -0,0 +1,112 @@ +package org.jeecg.modules.activiti.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.activiti.entity.AssignFileStream; +import org.jeecg.modules.activiti.ext.ActTaskExt; +import org.jeecg.modules.activiti.ext.AssignFileStreamExt; +import org.jeecg.modules.activiti.request.ApproveBatchRequest; +import org.jeecg.modules.activiti.request.AssignFileRequest; +import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; +import org.jeecg.modules.activiti.service.IAssignFileStreamService; +import org.jeecg.modules.dnc.response.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "DNC娴佺▼鎿嶄綔") +@RestController +@RequestMapping("/nc/activit") +public class AssignFileStreamController { + @Autowired + private IAssignFileStreamService assignFileStreamService; + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey", notes = "DNC娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey") + @PostMapping("/assign/file/apply") + public ResponseResult applyAssignFile(@RequestBody AssignFileStream stream) { + ResponseResult b = assignFileStreamService.applyAssignFile(stream); + if(b.isSuccess()) { + return new ResponseResult(CommonCode.SUCCESS); + } + return b; + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟", notes = "DNC娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟") + @PostMapping("/assign/file/approve/{taskId}/{streamId}") + public ResponseResult approveAssignFile(@PathVariable("taskId") String taskId, @PathVariable("streamId") String streamId, + @RequestBody AssignFileStream stream) { + boolean b = assignFileStreamService.approveAssignFile(taskId, streamId, stream); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟", notes = "DNC娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟") + @GetMapping("/find/task/list") + public QueryListResponseResult<ActTaskExt> getUndoTaskList() { + List<ActTaskExt> list = assignFileStreamService.getUndoTaskList(); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�", notes = "DNC娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�") + @PostMapping("/assign/file/batch/apply") + public ResponseResult applyBatchAssignFile(@RequestBody AssignFileRequest assignFileRequest) { + boolean b = assignFileStreamService.applyBatchAssignFile(assignFileRequest); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鎵归噺瀹℃壒") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鎵归噺瀹℃壒", notes = "DNC娴佺▼鎿嶄綔-鎵归噺瀹℃壒") + @PostMapping("/assign/file/batch/approve") + public ResponseResult approveBatchAssignFile(@RequestBody ApproveBatchRequest approveBatchRequest) { + boolean b = assignFileStreamService.approveBatchAssignFile(approveBatchRequest); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇", notes = "DNC娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇") + @GetMapping("/find/page/{page}/{size}") + public QueryPageResponseResult<AssignFileStreamExt> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, AssignFileStreamQueryRequest request) { + return assignFileStreamService.findPageList(page, size, request); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�", notes = "DNC娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�") + @GetMapping("/find/page/{page}/{size}/{docId}") + public QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(@PathVariable("page") int page, @PathVariable("size") int size, @PathVariable("docId") String docId) { + return assignFileStreamService.findPageListByDocId(page, size, docId); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�", notes = "DNC娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�") + @GetMapping("/get/enable/flag") + public DataResponseResult<Boolean> getActiveEnable() { + Boolean b = assignFileStreamService.getActiveEnable(); + return new DataResponseResult<>(CommonCode.SUCCESS, b); + } + + @AutoLog(value = "DNC娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊") + @ApiOperation(value = "DNC娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊", notes = "DNC娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊") + @PostMapping("/transfer/doc") + public ResponseResult transferDocFile(String pnCode, String deviceNo) { + boolean b = assignFileStreamService.transferDocFile(pnCode, deviceNo); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java new file mode 100644 index 0000000..0a0ca7e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.activiti.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName("nc_activiti_definition_info") +@Api(value= "娴佺▼瀹氫箟") +public class ActivitiDefinition { + @TableId(value = "id") + private String id; + @TableField(value = "act_name") + private String actName; + @TableField(value = "depart_id") + private String departId; + @TableField(value = "approve_users") + private String approveUsers; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java new file mode 100644 index 0000000..28464e7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java @@ -0,0 +1,65 @@ +package org.jeecg.modules.activiti.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName("nc_assign_file_stream") +@Api(value= "娴佺▼鎿嶄綔") +public class AssignFileStream { + @TableId(value = "stream_id") + private String streamId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "parts_id") + private String partsId; + @TableField(value = "process_id") + private String processId; + @TableField(value = "doc_id") + private String docId; + @TableField(value = "file_id") + private String fileId; + @TableField(value = "device_id") + private String deviceId; + @TableField(value = "apply_user_id") + private String applyUserId; + @TableField(value = "apply_reason") + private String applyReason; + @TableField(value = "apply_time") + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date applyTime; + @TableField(value = "approve_user_id") + private String approveUserId; + @TableField(value = "approve_content") + private String approveContent; + @TableField(value = "approve_time") + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date approveTime; + @TableField(value = "status") + private Integer status; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java new file mode 100644 index 0000000..257b9b1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.activiti.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName("nc_to_equipment_lists") +public class ToEquipmentTask { + @TableId(value = "code") + private String code; + @TableField(value = "doc_id") + private String docId; + @TableField(value = "file_id") + private String fileId; + @TableField(value = "device_id") + private String deviceId; + @TableField(value = "device_no") + private String deviceNo; + @TableField(value = "depart_id") + private String departId; + @TableField(value = "file_name") + private String fileName; + @TableField(value = "file_encode_name") + private String fileEncodeName; + @TableField(value = "file_path") + private String filePath; + @TableField(value = "file_suffix") + private String fileSuffix; + @TableField(value = "doc_version") + private String docVersion; + @TableField(value = "file_size") + private Long fileSize; + @TableField(value = "sync_flag") + private Integer syncFlag; + @TableField(value = "sync_time") + private Date syncTime; + @TableField(value = "apply_user") + private String applyUser; + @TableField(value = "apply_time") + private Date applyTime; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java new file mode 100644 index 0000000..363032f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.activiti.ext; + +import lombok.Data; +import lombok.NoArgsConstructor; +import org.activiti.engine.task.Task; + +@Data +@NoArgsConstructor +public class ActTaskExt { + private String id; + private String name; + private String processInstanceId; + private String assignee; + private String executionId; + private String processDefinitionId; + private String businessKey; + private AssignFileStreamExt assignFileStream; + + public ActTaskExt instanceOfTask(Task task) { + this.id = task.getId(); + this.name = task.getName(); + this.processInstanceId = task.getProcessInstanceId(); + this.assignee = task.getAssignee(); + this.executionId = task.getExecutionId(); + this.processDefinitionId = task.getProcessDefinitionId(); + return this; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java new file mode 100644 index 0000000..15e1202 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.activiti.ext; + +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecg.modules.activiti.entity.AssignFileStream; + +@Data +@NoArgsConstructor +public class AssignFileStreamExt extends AssignFileStream { + private String productName; + private String componentName; + private String partsName; + private String docName; + private String version; + private String applyUser; + private String approveUser; + private String deviceName; + private String docSuffix; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java new file mode 100644 index 0000000..0514246 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.activiti.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.activiti.entity.ActivitiDefinition; + +public interface ActivitiDefinitionMapper extends BaseMapper<ActivitiDefinition> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java new file mode 100644 index 0000000..db8c5f2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.activiti.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.activiti.entity.AssignFileStream; +import org.jeecg.modules.activiti.ext.AssignFileStreamExt; + +public interface AssignFileStreamMapper extends BaseMapper<AssignFileStream> { + /** + * 鍏宠仈鐢ㄦ埛琛� 鑾峰彇鐢ㄦ埛鏄电О + * @param streamId + * @return + */ + AssignFileStreamExt getAssignFileStreamDetail(@Param("streamId") String streamId); + + /** + * 鍒嗛〉鏌ヨ宸插姙浠诲姟 + * @param page + * @param wrapper + * @return + */ + IPage<AssignFileStreamExt> findByPage(IPage<AssignFileStreamExt> page, @Param(Constants.WRAPPER) Wrapper<AssignFileStreamExt> wrapper); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java new file mode 100644 index 0000000..2645b80 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.activiti.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.activiti.entity.ToEquipmentTask; + +public interface ToEquipmentTaskMapper extends BaseMapper<ToEquipmentTask> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java new file mode 100644 index 0000000..09aa963 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.activiti.request; + +import lombok.Data; + +@Data +public class ActivitiDefinitionRequest { + private String actName; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java new file mode 100644 index 0000000..7edef40 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.activiti.request; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@NoArgsConstructor +public class ApproveBatchRequest implements Serializable { + private String approveContent; + private Integer status; + private List<TaskRequest> taskArr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java new file mode 100644 index 0000000..6882c12 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.activiti.request; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +public class AssignFileRequest implements Serializable { + private String processId; + private String fileId; + private String docId; + private String applyReason; + private String[] deviceIds; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java new file mode 100644 index 0000000..2f1fbf7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.activiti.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@ApiModel(value = "宸插姙浠诲姟鏌ヨ鏉′欢", description = "宸插姙浠诲姟鏌ヨ") +public class AssignFileStreamQueryRequest { + //鎺掑簭瀛楁 + @ApiModelProperty(value = "闄嶅簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String descStr; + @ApiModelProperty(value = "鍗囧簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java new file mode 100644 index 0000000..49b29ec --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.activiti.request; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +public class TaskRequest implements Serializable { + private String id; + private String businessKey; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java new file mode 100644 index 0000000..db6f2a4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java @@ -0,0 +1,60 @@ +package org.jeecg.modules.activiti.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.activiti.entity.ActivitiDefinition; +import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; + +import java.util.List; + +public interface IActivitiDefinitionService extends IService<ActivitiDefinition> { + /** + * 娣诲姞閰嶇疆 + * @param definition + * @return + */ + boolean addDefinition(ActivitiDefinition definition); + /** + * 缂栬緫閰嶇疆 + * @param definition + * @return + */ + boolean editDefinition(String id, ActivitiDefinition definition); + + /** + * 鍒犻櫎閰嶇疆 + * @param id + * @return + */ + boolean deleteDefinition(String id); + + /** + * 鑾峰彇閮ㄩ棬鐨勬祦绋嬪畾涔� + * @param departId + * @return + */ + ActivitiDefinition getByDepartId(String departId); + + /** + * 鍒嗛〉鏌ヨ + * @param page + * @param size + * @param request + * @return + */ + QueryPageResponseResult<ActivitiDefinition> findPageList(int page, int size, ActivitiDefinitionRequest request); + + /** + * 鑾峰彇澶氫釜閮ㄩ棬鐨勫鎵逛汉 鍘婚噸 + * @param departIds + * @return + */ + List<String> getByDepartIds(List<String> departIds); + + /** + * 鏍规嵁鐢ㄦ埛淇℃伅鑾峰彇瀹℃壒 + * @param userId + * @return + */ + List<ActivitiDefinition> findByUserId(String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java new file mode 100644 index 0000000..f63b024 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java @@ -0,0 +1,102 @@ +package org.jeecg.modules.activiti.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.activiti.entity.AssignFileStream; +import org.jeecg.modules.activiti.ext.ActTaskExt; +import org.jeecg.modules.activiti.ext.AssignFileStreamExt; +import org.jeecg.modules.activiti.request.ApproveBatchRequest; +import org.jeecg.modules.activiti.request.AssignFileRequest; +import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; + +import java.util.List; + +public interface IAssignFileStreamService extends IService<AssignFileStream> { + /** + * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey + * @param stream + * @return + */ + ResponseResult applyAssignFile(AssignFileStream stream); + + /**securedoc + * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey + * @param stream + * @return + */ + boolean applyAssignFileActive(AssignFileStream stream); + /** + * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey + * @param stream + * @return + */ + ResponseResult applyAssignFileNonActive(AssignFileStream stream); + + /** + * 鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟 + * @return + */ + List<ActTaskExt> getUndoTaskList(); + + /** + * 鍏宠仈鐢ㄦ埛琛� 鑾峰彇鐢ㄦ埛鏄电О + * @param streamId + * @return + */ + AssignFileStreamExt getAssignFileStreamDetail(String streamId); + + /** + * 瀹℃壒鏈嶅姟 + * @param taskId + * @param streamId + * @param stream + * @return + */ + boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream); + + /** + * 鎵归噺鎸囨淳鍒拌澶� + * @param assignFileRequest + * @return + */ + boolean applyBatchAssignFile(AssignFileRequest assignFileRequest); + + /** + * 鎵归噺瀹℃壒 + * @param approveBatchRequest + * @return + */ + boolean approveBatchAssignFile(ApproveBatchRequest approveBatchRequest); + + /** + * 宸插姙鍒楄〃鑾峰彇 + * @param page + * @param size + * @return + */ + QueryPageResponseResult<AssignFileStreamExt> findPageList(int page, int size, AssignFileStreamQueryRequest request); + + /** + * 鏌ヨ鏂囨。鐨勫鎵硅褰� + * @param page + * @param size + * @param docId + * @return + */ + QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(int page, int size, String docId); + + /** + * 鑾峰彇鍚敤娴佺▼鐨勬爣璁� + * @return + */ + Boolean getActiveEnable(); + + /** + * 鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊 + * @param pnCode + * @param deviceNo + * @return + */ + boolean transferDocFile(String pnCode, String deviceNo); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java new file mode 100644 index 0000000..b230900 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.activiti.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.activiti.entity.ToEquipmentTask; + +public interface IToEquipmentTaskService extends IService<ToEquipmentTask> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java new file mode 100644 index 0000000..14402bc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java @@ -0,0 +1,154 @@ +package org.jeecg.modules.activiti.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.activiti.entity.ActivitiDefinition; +import org.jeecg.modules.activiti.mapper.ActivitiDefinitionMapper; +import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; +import org.jeecg.modules.activiti.service.IActivitiDefinitionService; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DepartmentMapper; +import org.jeecg.modules.dnc.response.ActivitiDefinitionCode; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +@Service +public class ActivitiDefinitionServiceImpl extends ServiceImpl<ActivitiDefinitionMapper, ActivitiDefinition> implements IActivitiDefinitionService { + @Autowired + private DepartmentMapper departmentMapper; + @Autowired + private ISysUserService userService; + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDefinition(ActivitiDefinition definition) { + if(definition == null || !ValidateUtil.validateString(definition.getDepartId()) + || !ValidateUtil.validateString(definition.getActName()) || !ValidateUtil.validateString(definition.getApproveUsers())) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ActivitiDefinition en = getByDepartId(definition.getDepartId()); + if(en != null) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_IS_EXIST); + Department department = departmentMapper.selectById(definition.getDepartId()); + if(department == null) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_DEPART_NONE); + String[] userIds = definition.getApproveUsers().split(","); + if(userIds == null|| userIds.length < 1) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); + List<String> userIdList = new ArrayList<>(userIds.length); + Collections.addAll(userIdList, userIds); + Collection<SysUser> userList = userService.listByIds(userIdList); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); + return super.save(definition); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editDefinition(String id, ActivitiDefinition definition) { + if(!ValidateUtil.validateString(id) || definition == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ActivitiDefinition en = super.getById(id); + if(en == null) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_NOT_EXIST); + String[] userIds = definition.getApproveUsers().split(","); + if(userIds == null|| userIds.length < 1) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); + List<String> userIdList = new ArrayList<>(userIds.length); + Collections.addAll(userIdList, userIds); + Collection<SysUser> userList = userService.listByIds(userIdList); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); + definition.setId(id); + definition.setDepartId(null); + return super.updateById(definition); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDefinition(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ActivitiDefinition en = super.getById(id); + if(en == null) + ExceptionCast.cast(ActivitiDefinitionCode.DEF_NOT_EXIST); + return super.removeById(id); + } + + @Override + public ActivitiDefinition getByDepartId(String departId) { + if(!ValidateUtil.validateString(departId)) + return null; + List<ActivitiDefinition> list = super.lambdaQuery().eq(ActivitiDefinition::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public QueryPageResponseResult<ActivitiDefinition> findPageList(int page, int size, ActivitiDefinitionRequest request) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<ActivitiDefinition> pageData = new Page<>(page, size); + LambdaQueryChainWrapper<ActivitiDefinition> lambdaQuery = super.lambdaQuery(); + if(request != null) { + if(ValidateUtil.validateString(request.getActName())) { + lambdaQuery.like(ActivitiDefinition::getActName, request.getActName()); + } + + if(ValidateUtil.validateString(request.getAscStr())) { + String[] ascArr = request.getAscStr().split(","); +// ((Page<ActivitiDefinition>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(request.getDescStr())) { + String[] descStr = request.getDescStr().split(","); +// ((Page<ActivitiDefinition>) pageData).setDesc(descStr); + } + } + IPage<ActivitiDefinition> definitionIPage = lambdaQuery.page(pageData); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, definitionIPage); + + } + + @Override + public List<String> getByDepartIds(List<String> departIds) { + if(departIds == null || departIds.isEmpty()) + return null; + List<ActivitiDefinition> list = super.lambdaQuery().in(ActivitiDefinition::getDepartId, departIds).list(); + if(list == null || list.isEmpty()) + return null; + Map<String, String> userIdMap = new HashMap<>(); + list.forEach(item -> { + if(ValidateUtil.validateString(item.getApproveUsers())) { + String[] arr = item.getApproveUsers().split(","); + if(arr != null && arr.length > 0) { + for (String s : arr) { + userIdMap.put(s, s); + } + } + } + }); + if(userIdMap.isEmpty()) + return null; + List<String> userIds = new ArrayList<>(); + userIdMap.forEach((key, value) -> { + userIds.add(key); + }); + return userIds; + } + + @Override + public List<ActivitiDefinition> findByUserId(String userId) { + return super.lambdaQuery().like(ActivitiDefinition::getApproveUsers, userId).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java new file mode 100644 index 0000000..18c2067 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java @@ -0,0 +1,802 @@ +package org.jeecg.modules.activiti.service.impl; + +import cn.hutool.core.util.StrUtil; +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.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.activiti.engine.HistoryService; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.TaskService; +import org.activiti.engine.history.HistoricProcessInstance; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.activiti.entity.AssignFileStream; +import org.jeecg.modules.activiti.entity.ToEquipmentTask; +import org.jeecg.modules.activiti.ext.ActTaskExt; +import org.jeecg.modules.activiti.ext.AssignFileStreamExt; +import org.jeecg.modules.activiti.mapper.AssignFileStreamMapper; +import org.jeecg.modules.activiti.request.ApproveBatchRequest; +import org.jeecg.modules.activiti.request.AssignFileRequest; +import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; +import org.jeecg.modules.activiti.request.TaskRequest; +import org.jeecg.modules.activiti.service.IActivitiDefinitionService; +import org.jeecg.modules.activiti.service.IAssignFileStreamService; +import org.jeecg.modules.activiti.service.IToEquipmentTaskService; +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.ext.NcTxtFilePathInfo; +import org.jeecg.modules.dnc.response.*; +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.utils.date.DateUtil; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class AssignFileStreamServiceImpl extends ServiceImpl<AssignFileStreamMapper, AssignFileStream> implements IAssignFileStreamService { + private static final String PROCESS_KEY = "assign_nc_to_device"; + private static final String APPLY_VARIABLE = "apply_user"; + private static final String APPROVE_VARIABLE = "approve_users"; + private static final String SEND_CODE = "SEND"; + + @Value("${activiti.enable}") + private Boolean activeEnable; + + @Autowired + private RuntimeService runtimeService; + @Autowired + private TaskService taskService; + @Autowired + private IDocInfoService docInfoService; + @Autowired + private IProcessStreamService processStreamService; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IDepartmentService departmentService; + @Autowired + private HistoryService historyService; + @Autowired + private IDocClassificationService classificationService; + @Autowired + private IToEquipmentTaskService equipmentTaskService; + @Autowired + private IDeviceInfoService deviceInfoService; + @Autowired + private IDocFileService docFileService; + @Autowired + private IActivitiDefinitionService definitionService; + @Autowired + private IDocRelativeService docRelativeService; + @Autowired + private ISynchronizedFlagService synchronizedFlagService; + @Autowired + private IDeviceGroupService deviceGroupService; + @Autowired + private IDncPassLogService dncPassLogService; + @Autowired + private IDeviceCharactersService iDeviceCharactersService; + + @Autowired + private StringRedisTemplate redisTemplate; + + @Value("${securedoc.serverIp}") + private String serverIp; + @Value("${securedoc.serverPort}") + private int serverPort; + @Value("${securedoc.whether}") + private String whether; + @Value("${securedoc.localFilePath}") + private String localFilePath; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public ResponseResult applyAssignFile(AssignFileStream stream) { + synchronized (this){ + //鍒ゆ柇璁惧鐗规畩瀛楃 + String specialChar = getDeviceSpecialChar(stream.getDeviceId(),stream.getFileId()); + if (StrUtil.isNotEmpty(specialChar)){ + //鎶涘嚭鐗规畩瀛楃寮傚父 + return createSpecialCharErrorResponse(specialChar); + } + if(activeEnable) { + boolean b = applyAssignFileActive(stream); + if (b) { + return ResponseResult.SUCCESS(); + } else { + return ResponseResult.SUCCESS(); + } + + }else { + return applyAssignFileNonActive(stream); + } + } + } + + /** + * 鍒ゆ柇璁惧鐗规畩瀛楃 + * @param deviceId,fileId + * 璁惧ID锛屾枃浠禝D + */ + public String getDeviceSpecialChar(String deviceId, String fileId){ + DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); + if(deviceInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); +// DocFile docFile = docFileService.getById(fileId); + DocInfo docInfo = docInfoService.getOne(new QueryWrapper<DocInfo>().eq("publish_file_id",fileId)); + if(docInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + List<DeviceCharacters> deviceCharactersList=iDeviceCharactersService.list( + new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,deviceInfo.getDeviceNo())); + if (deviceCharactersList.isEmpty()){ + return ""; + }else { + List<String> specialCharList=deviceCharactersList.stream().map(DeviceCharacters::getCharacters).collect(Collectors.toList()); + if(!specialCharList.isEmpty()){ + //瀵规瘮鏂囦欢鍚嶆槸鍚﹀寘鍚壒娈婂瓧绗� + String fileName=docInfo.getDocName(); + for(String specialChar:specialCharList){ + if (fileName.contains(specialChar)){ + return specialChar; + } + } + }else { + return ""; + } + } + return ""; + } + + private ResponseResult createSpecialCharErrorResponse(String specialChar) { + return new ResponseResult(new ResultCode() { + @Override + public boolean success() { + return false; + } + @Override + public int code() { + return 88881; + } + @Override + public String message() { + return "鏂囦欢鍚嶇О瀛樺湪璁惧鐗规畩瀛楃" + specialChar; + } + }); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean applyAssignFileActive(AssignFileStream stream) { + //鏍¢獙寮�濮� + if(stream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(stream.getProcessId()) || !ValidateUtil.validateString(stream.getDocId()) + || !ValidateUtil.validateString(stream.getFileId())) + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); + if(!ValidateUtil.validateString(stream.getDeviceId())) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 5, stream.getProcessId()); + if(docInfo == null || docInfo.getDocStatus() == 3) + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); + DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); + if(deviceInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + if(deviceInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + DocFile docFile = docFileService.getById(stream.getFileId()); + DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); + if(deviceDoc != null) { + /*// 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(), docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); + boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(),4,stream.getDeviceId()); + if (!doc) { + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); + } + } + }*/ + } + deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); + if(deviceDoc != null) { + // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� + /* List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(), docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); + boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(),4,stream.getDeviceId()); + if (!doc) { + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); + } + } + }*/ + } + + ProcessStream processStream = processStreamService.getById(stream.getProcessId()); + if(processStream == null) + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); + stream.setProductId(processStream.getProductId()); + stream.setComponentId(processStream.getComponentId()); + stream.setPartsId(processStream.getPartsId()); + List<PermissionStream> permissionStreams = null; + if(ValidateUtil.validateString(processStream.getPartsId())) { + //杩涘叆闆朵欢 + permissionStreams = permissionStreamService.getByPartsId(stream.getProductId(), stream.getComponentId(), stream.getPartsId()); + }else if(ValidateUtil.validateString(processStream.getComponentId())) { + //杩涘叆閮ㄤ欢鐨勫鐞� + permissionStreams = permissionStreamService.getByComponentId(stream.getProductId(), stream.getComponentId()); + } + if(permissionStreams == null || permissionStreams.isEmpty()) + ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); + List<String> departIds = new ArrayList<>(); + Map<String, Department> map = departmentService.getMapByUserId(userId); + permissionStreams.forEach(item -> { + if(map.containsKey(item.getDepartId())) { + departIds.add(item.getDepartId()); + } + }); + if(departIds.isEmpty()) + ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); + //鑾峰彇閮ㄩ棬瀹℃壒浜� + List<String> userIdList = definitionService.getByDepartIds(departIds); + if(userIdList == null || userIdList.isEmpty()) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + //鏍¢獙缁撴潫 + String streamId = IdWorker.getIdStr(); + stream.setStreamId(streamId); + stream.setApplyUserId(userId); + stream.setApplyTime(DateUtil.getNow()); + stream.setStatus(1); + //淇濆瓨娴佺▼涓氬姟瀵硅薄 + boolean b = super.save(stream); + if(!b) + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); + //淇濆瓨娴佺▼浠诲姟 + String approveUsers = String.join(",", userIdList); + Map<String, Object> avariableMap = new HashMap<>(); + avariableMap.put(APPLY_VARIABLE, userId); + avariableMap.put(APPROVE_VARIABLE, approveUsers); + //鍚姩娴佺▼ + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, streamId, avariableMap); + if(processInstance == null) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + //鏌ヨ褰撳墠娴佺▼鐢ㄦ埛娴佺▼浠诲姟 + Task task = taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(userId) + .processInstanceId(processInstance.getId()).singleResult(); + if(task == null) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); + //瀹屾垚娴佺▼浠诲姟 + taskService.complete(task.getId()); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public ResponseResult applyAssignFileNonActive(AssignFileStream stream) { + if(stream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(stream.getProcessId()) || !ValidateUtil.validateString(stream.getDocId()) + || !ValidateUtil.validateString(stream.getFileId())) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(stream.getDeviceId())) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 5, stream.getProcessId()); + if(docInfo == null || docInfo.getDocStatus() == 3) + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); + + DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); + if(deviceInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + DocFile docFile = docFileService.getById(stream.getFileId()); + if(docFile == null) + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); + if(deviceDoc != null) { + // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(), docFile.getFileSuffix()); + } + } + + /*deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); + if(deviceDoc != null) { + // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(), docFile.getFileSuffix()); + } + }*/ + ProcessStream processStream = processStreamService.getById(stream.getProcessId()); + if(processStream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + stream.setProductId(processStream.getProductId()); + stream.setComponentId(processStream.getComponentId()); + stream.setPartsId(processStream.getPartsId()); + List<PermissionStream> permissionStreams = null; + if(ValidateUtil.validateString(processStream.getPartsId())) { + //杩涘叆闆朵欢 + permissionStreams = permissionStreamService.getByPartsId(stream.getProductId(), stream.getComponentId(), stream.getPartsId()); + }else if(ValidateUtil.validateString(processStream.getComponentId())) { + //杩涘叆閮ㄤ欢鐨勫鐞� + permissionStreams = permissionStreamService.getByComponentId(stream.getProductId(), stream.getComponentId()); + } + if(permissionStreams == null || permissionStreams.isEmpty()) + ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); + List<String> departIds = new ArrayList<>(); + Map<String, Department> map = departmentService.getMapByUserId(userId); + permissionStreams.forEach(item -> { + if(map.containsKey(item.getDepartId())) { + departIds.add(item.getDepartId()); + } + }); + if(departIds.isEmpty()) + ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); + //deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); + /*if(deviceDoc != null) + ExceptionCast.cast(ActivitiCode.ACT_DEVICE_DOC_ERROR);*/ + //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� + if(deviceDoc == null) { + DocClassification classification = classificationService.getByCode(SEND_CODE); + if(classification == null) + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + + DocRelative docRelative = new DocRelative(); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setClassificationId(classification.getClassificationId()); + docRelative.setAttributionType(4); + docRelative.setAttributionId(stream.getDeviceId()); + boolean b = docRelativeService.save(docRelative); + if(!b) { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + } + + } + + //TODO + //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileEncodeName(), + docFile.getFileName(),docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(),docFile.getFileSuffix()); + + } + } else { + return new ResponseResult(CommonCode.FAIL); + } + String size = FileUtilS.fileSizeNC(docFile.getFilePath(),docFile.getFileEncodeName()); + if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar") ) { + //澶勭悊鏂囦欢 璁板綍骞朵笂鎶� + //1銆� 鍒ゆ柇绔彛鏄惁鑳藉璁块棶 鏂囦欢璺緞鍔� + /*boolean btelnetPort = TelnetUtil.telnetPort(serverIp,serverPort,10); + if (!btelnetPort) { + ExceptionCast.cast(ActivitiCode.ACT_DEVICE_DOC_FILELABLE); + }*/ + DncPassLog passInfoTxt = new DncPassLog(); + + String path = StringUtils.join(strings.toArray(), "/"); + Date dateFirst = DateUtil.getNow(); + passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); + /*鏌ヨ鏈�鍚庝竴鏉¤褰�*/ + //浼戠湢 500姣 + DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); + Integer fileTxt = 0, fileNc =0; + if (dncPassLog !=null) { + fileTxt = dncPassLog.getSequenceNumber() + 1; + fileNc = fileTxt + 1; + } else { + fileTxt = 1; + fileNc = fileTxt + 1; + } + //澶勭悊鏂囦欢鍚嶇О 鏂囦欢璺緞 + String sequence = String.format("%06d",fileTxt); + String sequenceNc = String.format("%06d",fileNc); + passInfoTxt.setSequenceNumber(fileTxt); + passInfoTxt.setSequenceOrder(sequence); + passInfoTxt.setCreateTime(dateFirst); + System.out.println(DateUtil.format(dateFirst,DateUtil.STR_DATE_TIME)); + passInfoTxt.setPassType("02"); + dncPassLogService.save(passInfoTxt); + + DncPassLog passInfoNc = new DncPassLog(); + passInfoNc.setSequenceNumber(fileNc); + passInfoNc.setSequenceOrder(sequenceNc); + passInfoNc.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); + passInfoNc.setPassType("02"); + passInfoNc.setPassName(docFile.getFileName()); + try { + Thread.sleep(1000); + Date date = new Date(); + passInfoNc.setCreateTime(date); + System.out.println(DateUtil.format(date,DateUtil.STR_DATE_TIME)); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + dncPassLogService.save(passInfoNc); + + NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); + ncTxt.setEquipmentId(deviceInfo.getDeviceNo()); + ncTxt.setFileNcName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc); + ncTxt.setFileTxtName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence); + ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" ); + ncTxt.setOrigFileName(docFile.getFileName()); + ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); + ncTxt.setFileAddOrDelete(1); + String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; +// String loFilePath = localFilePath + "\\" + ncTxt.getFileTxtName() + ".nc"; + try { + String allList = new String(); + allList=(ncTxt.getFileTxtName()+"\n"); + allList+=(ncTxt.getFileNcName()+"\n"); + allList+=(ncTxt.getOrigFileName()+"\n"); + allList+=(ncTxt.getOrigFileSuffix()+"\n"); + allList+=(ncTxt.getFilePath()+"\n"); + allList+=(ncTxt.getEquipmentId()+"\n"); + allList+=(ncTxt.getFileAddOrDelete().toString()+"\n"); + // 鏂囦欢澶у皬瀛楄妭 绗簩琛� 宸ユ帶缃戣繘琛屾枃浠跺垎鏋� + allList+= (size+"\n"); + + FileUtilS.fileWriterSql(loFilePath,allList); + //鏂囦欢瑙f瀽閲嶆柊瑙勫垝 + //娣诲姞鏂囦欢鍚嶅瓧锛岀涓�琛岋紝 + + +/* + boolean copyFileNc = FileUtilS.copyFileNcIntegration(path + "/"+ deviceInfo.getDeviceNo() +"/send/" + + docFile.getFileName(), + localFilePath + "\\" + ncTxt.getFileNcName(), + docFile.getFileSuffix()); +*/ + boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ deviceInfo.getDeviceNo() +"/send/" + + docFile.getFileName(), + localFilePath + ncTxt.getFileNcName(), +// localFilePath + "\\" + ncTxt.getFileNcName(), + docFile.getFileSuffix(),"NC"); + if (!copyFileNc) { + FileUtilS.deleteNcFile(loFilePath); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + synchronizedFlagService.updateFlag(2); + return new ResponseResult(CommonCode.SUCCESS); + } + + @Override + public List<ActTaskExt> getUndoTaskList() { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + return null; + List<Task> list = taskService.createTaskQuery().taskCandidateOrAssigned(userId).list(); + if(list == null || list.isEmpty()) + return null; + List<ActTaskExt> extList = new ArrayList<>(); + list.forEach(item -> { + ActTaskExt ext = new ActTaskExt(); + ext.instanceOfTask(item); + + HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId( + item.getProcessInstanceId()).singleResult(); + if(historicProcessInstance == null || !ValidateUtil.validateString(historicProcessInstance.getBusinessKey())) { + ExceptionCast.cast(ActivitiCode.ACT_PROC_INST_ERROR); + } + ext.setBusinessKey(historicProcessInstance.getBusinessKey()); + AssignFileStreamExt streamDetail = getAssignFileStreamDetail(historicProcessInstance.getBusinessKey()); + if(streamDetail == null) + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_DETAIL_ERROR); + ext.setAssignFileStream(streamDetail); + extList.add(ext); + }); + return extList; + } + + @Override + public AssignFileStreamExt getAssignFileStreamDetail(String streamId) { + if(!ValidateUtil.validateString(streamId)) + return null; + return super.getBaseMapper().getAssignFileStreamDetail(streamId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream) { + if(!ValidateUtil.validateString(taskId) || !ValidateUtil.validateString(streamId) || stream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + if(!ValidateUtil.validateInteger(stream.getStatus())) + ExceptionCast.cast(ActivitiCode.ACT_STATUS_ERROR); + AssignFileStream en = super.getById(streamId); + if(en == null) + ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_DETAIL_ERROR); + Task task = taskService.createTaskQuery().taskId(taskId).taskCandidateOrAssigned(userId).singleResult(); + if(task == null) + ExceptionCast.cast(ActivitiCode.ACT_TASK_ERROR); + if(!ValidateUtil.validateString(task.getAssignee())) { + //鎷惧彇浠诲姟 + taskService.claim(task.getId(), userId); + //瀹屾垚浠诲姟 + taskService.complete(task.getId()); + }else { + //瀹屾垚浠诲姟 + taskService.complete(task.getId()); + } + //鏇存柊瀵硅薄灏佽 + AssignFileStream up = new AssignFileStream(); + up.setApproveContent(stream.getApproveContent()); + up.setStatus(stream.getStatus()); + up.setApproveUserId(userId); + up.setApproveTime(DateUtil.getNow()); + up.setStreamId(streamId); + boolean b = super.updateById(up); + if(!b) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + if(up.getStatus() == 2) { + //鍚屾剰鎿嶄綔 + DocInfo docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 5, en.getProcessId()); + if(docInfo == null || docInfo.getDocStatus() == 3) + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); + DeviceInfo deviceInfo = deviceInfoService.getById(en.getDeviceId()); + if(deviceInfo == null) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + DocFile docFile = docFileService.getById(en.getFileId()); + if(docFile == null) + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),4, en.getDeviceId()); + if(deviceDoc != null) { + // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(), docFile.getFileSuffix()); + /* //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); + boolean doc = docRelativeService.deleteCopyDocByAttrNext(deviceDoc.getDocId(),4,stream.getDeviceId()); + if (!doc) { + ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); + }*/ + + } + } else { + //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� + DocClassification classification = classificationService.getByCode(SEND_CODE); + if(classification == null) + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + + DocRelative docRelative = new DocRelative(); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setClassificationId(classification.getClassificationId()); + docRelative.setAttributionType(4); + docRelative.setAttributionId(en.getDeviceId()); + b = docRelativeService.save(docRelative); + } + if(!b) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + if (deviceInfo != null) { + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileEncodeName(), + docFile.getFileName(),docFile.getFileSuffix()); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(),docFile.getFileSuffix()); + + } + } + + } + return synchronizedFlagService.updateFlag(1); + }else if(up.getStatus() == 3) { + //鎷掔粷鎿嶄綔 浠�涔堜篃涓嶅仛 + return true; + }else { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean applyBatchAssignFile(AssignFileRequest assignFileRequest) { + if(assignFileRequest == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + String[] deviceIds = assignFileRequest.getDeviceIds(); + if(deviceIds == null || deviceIds.length < 1) + ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); + AssignFileStream stream; + for(String id : deviceIds) { + stream = new AssignFileStream(); + stream.setProcessId(assignFileRequest.getProcessId()); + stream.setDocId(assignFileRequest.getDocId()); + stream.setFileId(assignFileRequest.getFileId()); + stream.setApplyReason(assignFileRequest.getApplyReason()); + stream.setDeviceId(id); + ResponseResult b = applyAssignFile(stream); + if(!b.isSuccess()) + ExceptionCast.cast(ActivitiCode.ACT_APPLY_ERROR); + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean approveBatchAssignFile(ApproveBatchRequest approveBatchRequest) { + if(approveBatchRequest == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<TaskRequest> list = approveBatchRequest.getTaskArr(); + if(list == null || list.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + list.forEach(item -> { + AssignFileStream stream = new AssignFileStream(); + stream.setApproveContent(approveBatchRequest.getApproveContent()); + stream.setStatus(approveBatchRequest.getStatus()); + boolean b = approveAssignFile(item.getId(), item.getBusinessKey(), stream); + if(!b) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + }); + return synchronizedFlagService.updateFlag(1); + } + + @Override + public QueryPageResponseResult<AssignFileStreamExt> findPageList(int page, int size, AssignFileStreamQueryRequest request) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + LambdaQueryWrapper<AssignFileStreamExt> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(AssignFileStreamExt::getApproveUserId, userId); + lambdaQueryWrapper.orderByDesc(AssignFileStreamExt::getApproveTime); + IPage<AssignFileStreamExt> pageData = new Page<>(page, size); + if(request != null) { + if(ValidateUtil.validateString(request.getAscStr())) { + String[] ascArr = request.getAscStr().split(","); +// ((Page<AssignFileStreamExt>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(request.getDescStr())) { + String[] descStr = request.getDescStr().split(","); +// ((Page<AssignFileStreamExt>) pageData).setDesc(descStr); + } + } + IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, lambdaQueryWrapper); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, streamExtIPage); + } + + @Override + public QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(int page, int size, String docId) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + if(!ValidateUtil.validateString(docId)) + ExceptionCast.cast(ActivitiCode.ACT_DOC_ID_NONE); + QueryWrapper<AssignFileStreamExt> queryWrapper = Wrappers.query(); + queryWrapper.eq("a.doc_id", docId); + queryWrapper.orderByDesc("approve_time"); + IPage<AssignFileStreamExt> pageData = new Page<>(page, size); + IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, queryWrapper); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, streamExtIPage); + } + + @Override + public Boolean getActiveEnable() { + if(activeEnable != null) { + return activeEnable; + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean transferDocFile(String pnCode, String deviceNo) { + List<ProcessStream> streams = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo); + DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); + if(deviceInfo == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + //鍒犻櫎鍘熸潵璁惧涓嬬殑鎵�鏈夋枃妗� + docRelativeService.deleteByDocAttr(4, deviceInfo.getDeviceId()); + List<DocInfo> docInfoList = docInfoService.getByProcessIds(streams); + if(docInfoList == null || docInfoList.isEmpty()) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + for(DocInfo docInfo : docInfoList) { + DocFile docFile = docFileService.getById(docInfo.getPublishFileId()); + if(docFile == null) + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� + DocClassification classification = classificationService.getByCode(SEND_CODE); + if(classification == null) + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + DocRelative docRelative = new DocRelative(); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setClassificationId(classification.getClassificationId()); + docRelative.setAttributionType(4); + docRelative.setAttributionId(deviceInfo.getDeviceId()); + boolean b = docRelativeService.save(docRelative); + if(!b) + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� + ToEquipmentTask equipmentTask = new ToEquipmentTask(); + //涓嶈兘鐩存帴浠巇oc涓嬁fileId 鍜寁ersion 鍙兘浼氬瓨鍦ㄦ枌鏇� + //equipmentTask.setFileId(docInfo.getPublishFileId()); + //equipmentTask.setDocVersion(docInfo.getPublishVersion()); + equipmentTask.setDocId(docInfo.getDocId()); + equipmentTask.setSyncFlag(1); + equipmentTask.setDeviceNo(deviceInfo.getDeviceNo()); + equipmentTask.setDeviceId(deviceInfo.getDeviceId()); + equipmentTask.setDepartId(deviceInfo.getDepartId()); + //鏂囦欢鐩稿叧淇℃伅 + equipmentTask.setFileId(docFile.getFileId()); + equipmentTask.setDocVersion(docFile.getDocVersion()); + equipmentTask.setFileName(docInfo.getDocName()); + equipmentTask.setFileEncodeName(docFile.getFileEncodeName()); + equipmentTask.setFilePath(docFile.getFilePath()); + equipmentTask.setFileSuffix(docFile.getFileSuffix()); + equipmentTask.setFileSize(docFile.getFileSize()); + b = equipmentTaskService.save(equipmentTask); + if(!b) { + ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); + } + } + return synchronizedFlagService.updateFlag(1); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java new file mode 100644 index 0000000..5e7ae9c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.activiti.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.activiti.entity.ToEquipmentTask; +import org.jeecg.modules.activiti.mapper.ToEquipmentTaskMapper; +import org.jeecg.modules.activiti.service.IToEquipmentTaskService; +import org.springframework.stereotype.Service; + +@Service +public class ToEquipmentTaskServiceImpl extends ServiceImpl<ToEquipmentTaskMapper, ToEquipmentTask> implements IToEquipmentTaskService { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ComponentInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ComponentInfoController.java new file mode 100644 index 0000000..8a65316 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ComponentInfoController.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.jeecg.modules.dnc.entity.PermissionStream; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IComponentInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@Api(tags = "閮ㄤ欢绠$悊") +@RestController +@RequestMapping("/nc/component") +public class ComponentInfoController { + @Autowired + private IComponentInfoService componentInfoService; + + + @AutoLog(value = "閮ㄤ欢绠$悊-鏂板") + @ApiOperation(value = "閮ㄤ欢绠$悊-鏂板", notes = "閮ㄤ欢绠$悊-鏂板") + @PostMapping("/add") + public ResponseResult addComponentInfo(@RequestBody ComponentInfo componentInfo) { + boolean b = componentInfoService.addComponentInfo(componentInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "閮ㄤ欢绠$悊-淇敼") + @ApiOperation(value = "閮ㄤ欢绠$悊-淇敼", notes = "閮ㄤ欢绠$悊-淇敼") + @PutMapping("/edit/{id}") + public ResponseResult editComponentInfo(@PathVariable("id") String id,@RequestBody ComponentInfo componentInfo) { + boolean b = componentInfoService.editComponentInfo(id,componentInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "閮ㄤ欢绠$悊-鍒犻櫎") + @ApiOperation(value = "閮ㄤ欢绠$悊-淇敼", notes = "閮ㄤ欢绠$悊-鍒犻櫎") + @DeleteMapping("/delete") + public ResponseResult deleteComponentInfo(@RequestParam("id") String id) { + boolean b = componentInfoService.deleteComponentInfo(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "妫�鏌n鐮佺殑鏈夋晥鎬�") + @ApiOperation(value = "妫�鏌n鐮佺殑鏈夋晥鎬�", notes = "妫�鏌n鐮佺殑鏈夋晥鎬�") + @GetMapping("/valid/pnCode") + public ResponseResult validateComponentOrPartsPnCode(String pnCode) { + PermissionStream b = componentInfoService.validateComponentOrPartsPnCode(pnCode); + if(b != null) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceCharactersController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceCharactersController.java new file mode 100644 index 0000000..26fc326 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceCharactersController.java @@ -0,0 +1,92 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.dnc.entity.DeviceCharacters; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.request.DeviceCharactersRequest; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IDeviceCharactersService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @Description: 璁惧鐗规畩瀛楃 + * @Author: + * @Date: 2024-12-31 + * @Version: V1.0 + */ + +@Slf4j +@Api(tags = "璁惧鐗规畩瀛楃") +@RestController +@RequestMapping("/nc/device/characters") +public class DeviceCharactersController extends JeecgController<DeviceCharacters, IDeviceCharactersService> { + + @Autowired + private IDeviceCharactersService iDeviceCharactersService; + + /** + * 璁惧鐗规畩瀛楃鍒嗛〉鏌ヨ + * @param page + * @param size + * @param deviceCharactersRequest + * @return + */ + @AutoLog(value = "璁惧鐗规畩瀛楃-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "璁惧鐗规畩瀛楃-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鐗规畩瀛楃-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping("/find/page/{page}/{size}") + public QueryPageResponseResult<DeviceCharacters> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, DeviceCharactersRequest deviceCharactersRequest) { + return iDeviceCharactersService.findByPageList(page, size, deviceCharactersRequest); + } + + /** + * 鏂板璁惧鐗规畩瀛楃 + * @param deviceCharacters + */ + @AutoLog(value = "璁惧鐗规畩瀛楃-鏂板璁惧鐗规畩瀛楃") + @ApiOperation(value = "璁惧鐗规畩瀛楃-鏂板璁惧鐗规畩瀛楃", notes = "璁惧鐗规畩瀛楃-鏂板璁惧鐗规畩瀛楃") + @PostMapping("/add") + public ResponseResult addPartsInfo(@RequestBody DeviceCharacters deviceCharacters) { + boolean b = iDeviceCharactersService.save(deviceCharacters); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 缂栬緫璁惧鐗规畩瀛楃 + * @param deviceCharacters + */ + @AutoLog(value = "璁惧鐗规畩瀛楃-缂栬緫璁惧鐗规畩瀛楃") + @ApiOperation(value = "璁惧鐗规畩瀛楃-缂栬緫璁惧鐗规畩瀛楃", notes = "璁惧鐗规畩瀛楃-缂栬緫璁惧鐗规畩瀛楃") + @PutMapping("/edit/{id}") + public ResponseResult editDefinition(@PathVariable("id") String id,@RequestBody DeviceCharacters deviceCharacters) { + boolean b = iDeviceCharactersService.updateById(deviceCharacters); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 鍒犻櫎璁惧鐗规畩瀛楃 + * id + */ + @AutoLog(value = "璁惧鐗规畩瀛楃-鍒犻櫎璁惧鐗规畩瀛楃") + @ApiOperation(value = "璁惧鐗规畩瀛楃-鍒犻櫎璁惧鐗规畩瀛楃", notes = "璁惧鐗规畩瀛楃-鍒犻櫎璁惧鐗规畩瀛楃") + @DeleteMapping("/delete") + public ResponseResult deleteDefinition(@RequestParam("id") String id) { + boolean b = iDeviceCharactersService.removeById(id); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java new file mode 100644 index 0000000..9d6c1cd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java @@ -0,0 +1,106 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.DeviceGroup; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IDeviceGroupService; +import org.jeecg.modules.dnc.ucenter.Department; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "璁惧鍒嗙粍琛�") +@RestController +@RequestMapping("/nc/device/group") +public class DeviceGroupController extends JeecgController<DeviceGroup, IDeviceGroupService> { + + @Autowired + private IDeviceGroupService deviceGroupService; + + @AutoLog(value = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍") + @ApiOperation(value = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍") + @PostMapping("/add") + public ResponseResult addDeviceGroup(@RequestBody DeviceGroup deviceGroup) { + boolean b = deviceGroupService.addDeviceGroup(deviceGroup); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍") + @ApiOperation(value = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍") + @PutMapping("/edit/{id}") + public ResponseResult editDeviceGroup(@PathVariable("id") String id, @RequestBody DeviceGroup deviceGroup) { + boolean b = deviceGroupService.editDeviceGroup(id, deviceGroup); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍") + @ApiOperation(value = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍") + @DeleteMapping("/delete") + public ResponseResult deleteDeviceGroup(@RequestParam("id") String id) { + boolean b = deviceGroupService.deleteDeviceGroup(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + + @AutoLog(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬") + @ApiOperation(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬", notes = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬") + @GetMapping("/get/perm/depart/{groupId}") + public QueryListResponseResult<Department> getDepartPermsList(@PathVariable("groupId") String groupId) { + List<Department> list = deviceGroupService.getDepartPermsList(groupId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬") + @ApiOperation(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬", notes = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬") + @GetMapping("/get/non/perm/depart/{groupId}") + public QueryListResponseResult<Department> getDepartNonPermsList(@PathVariable("groupId") String groupId) { + List<Department> list = deviceGroupService.getDepartNonPermsList(groupId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") + @ApiOperation(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�", notes = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") + @PostMapping("/assign/add/depart/{groupId}/{relativeFlag}") + public ResponseResult assignAddDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { + boolean b = deviceGroupService.assignAddDepartment(groupId, relativeFlag, departmentIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") + @ApiOperation(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺", notes = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") + @PostMapping("/assign/remove/depart/{groupId}/{relativeFlag}") + public ResponseResult assignRemoveDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { + boolean b = deviceGroupService.assignRemoveDepartment(groupId, relativeFlag, departmentIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java new file mode 100644 index 0000000..1722137 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java @@ -0,0 +1,159 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.response.*; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.service.IDeviceInfoService; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "璁惧琛�") +@RestController +@RequestMapping("/nc/device") +public class DeviceInfoController extends JeecgController<DeviceInfo, IDeviceInfoService> { + @Autowired + private IDeviceInfoService deviceInfoService; + + @AutoLog(value = "璁惧琛�-鏂板璁惧") + @ApiOperation(value = "璁惧琛�-鏂板璁惧", notes = "璁惧琛�-鏂板璁惧") + @PostMapping("/add") + public ResponseResult addDeviceInfo(@RequestBody DeviceInfo deviceInfo) { + boolean b = deviceInfoService.addDeviceInfo(deviceInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧琛�-缂栬緫璁惧淇℃伅") + @ApiOperation(value = "璁惧琛�-缂栬緫璁惧淇℃伅", notes = "璁惧琛�-缂栬緫璁惧淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editDeviceInfo(@PathVariable("id") String id, @RequestBody DeviceInfo deviceInfo) { + boolean b = deviceInfoService.editDeviceInfo(id, deviceInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧琛�-鍒犻櫎璁惧") + @ApiOperation(value = "璁惧琛�-鍒犻櫎璁惧", notes = "璁惧琛�-鍒犻櫎璁惧") + @DeleteMapping("/delete") + public ResponseResult deleteDeviceInfo(@RequestParam("id") String id) { + boolean b = deviceInfoService.deleteDeviceInfo(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧琛�-鏍规嵁鐢ㄦ埛鏉冮檺鑾峰彇鏍�") + @ApiOperation(value = "璁惧琛�-鏍规嵁鐢ㄦ埛鏉冮檺鑾峰彇鏍�", notes = "璁惧琛�-鏍规嵁鐢ㄦ埛鏉冮檺鑾峰彇鏍�") + @GetMapping("/load/tree") + public QueryListResponseResult<CommonGenericTree> loadTree() { + List<CommonGenericTree> list = deviceInfoService.loadTree(); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛") + @ApiOperation(value = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛", notes = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛") + @GetMapping("/get/perm/user/{nodeType}/{paramId}") + public QueryListResponseResult<UserDepartExt> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<UserDepartExt> list = deviceInfoService.getUserPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧琛�-鑾峰彇鑺傜偣鏈垎閰嶇殑鐢ㄦ埛") + @ApiOperation(value = "璁惧琛�-鑾峰彇鑺傜偣鏈垎閰嶇殑鐢ㄦ埛", notes = "璁惧琛�-鑾峰彇鑺傜偣鏈垎閰嶇殑鐢ㄦ埛") + @GetMapping("/get/non/perm/user/{nodeType}/{paramId}") + public QueryListResponseResult<SysUser> getUserNonPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<SysUser> list = deviceInfoService.getUserNonPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + /** + * 妫�鏌ョ敤鎴锋槸鍚︽湁璇ヨ澶囩殑鏉冮檺 + * @param nodeType 1 璁惧鍒嗙粍 2 璁惧 + * @param paramId + * @return + */ + @AutoLog(value = "璁惧琛�-妫�鏌ョ敤鎴锋槸鍚︽湁璇ヨ澶囩殑鏉冮檺 1 璁惧鍒嗙粍 2 璁惧") + @ApiOperation(value = "璁惧琛�-妫�鏌ョ敤鎴锋槸鍚︽湁璇ヨ澶囩殑鏉冮檺 1 璁惧鍒嗙粍 2 璁惧", notes = "璁惧琛�-妫�鏌ョ敤鎴锋槸鍚︽湁璇ヨ澶囩殑鏉冮檺 1 璁惧鍒嗙粍 2 璁惧") + @GetMapping("/check/{nodeType}/{paramId}") + public ResponseResult checkDevicePerm(@PathVariable("nodeType") Integer nodeType,@PathVariable("paramId") String paramId) { + boolean b = deviceInfoService.checkDevicePerm(nodeType, paramId); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.UNAUTHORISE); + } + + @AutoLog(value = "璁惧琛�-澧炲姞璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @ApiOperation(value = "璁惧琛�-澧炲姞璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺", notes = "璁惧琛�-澧炲姞璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @PostMapping("/assign/add/user/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignAddUser(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { + boolean b = deviceInfoService.assignAddUser(nodeType, paramId, relativeFlag, userIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧琛�-鍒犻櫎璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @ApiOperation(value = "璁惧琛�-鍒犻櫎璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺", notes = "璁惧琛�-鍒犻櫎璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @PostMapping("/assign/remove/user/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignRemoveUser(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { + boolean b = deviceInfoService.assignRemoveUser(nodeType, paramId, relativeFlag, userIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧琛�-鍏ㄩ儴璁惧鍒楄〃") + @ApiOperation(value = "璁惧琛�-鍏ㄩ儴璁惧鍒楄〃", notes = "璁惧琛�-鍏ㄩ儴璁惧鍒楄〃") + @GetMapping("/list/all") + public QueryListResponseResult<DeviceInfo> findListAll() { + List<DeviceInfo> list = deviceInfoService.list(); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧琛�-鎸囨淳鍒拌澶� 璁惧鏍�") + @ApiOperation(value = "璁惧琛�-鎸囨淳鍒拌澶� 璁惧鏍�", notes = "璁惧琛�-鎸囨淳鍒拌澶� 璁惧鏍�") + @GetMapping("/load/depart/tree/{nodeType}/{paramId}") + public QueryListResponseResult<CommonGenericTree> loadDepartTree(@PathVariable("nodeType") Integer nodeType,@PathVariable("paramId") String paramId) { + List<CommonGenericTree> list = deviceInfoService.loadDepartTree(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "璁惧琛�-鑾峰彇鍞竴 璁惧缂栧彿") + @ApiOperation(value = "璁惧琛�-鑾峰彇鍞竴 璁惧缂栧彿", notes = "璁惧琛�-鑾峰彇鍞竴 璁惧缂栧彿") + @GetMapping("/valid/device") + public ResponseResult validateDeviceNo(String deviceNo) { + DeviceInfo byDeviceNo = deviceInfoService.getByDeviceNo(deviceNo); + if(byDeviceNo == null) { + return new ResponseResult(DeviceCode.DEVICE_NOT_EXIST); + } + return new ResponseResult(CommonCode.SUCCESS); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocClassificationController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocClassificationController.java new file mode 100644 index 0000000..3300a4d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocClassificationController.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.DocClassification; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IDocClassificationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@Api(tags = "鏂囨。鍒嗙被琛�") +@RestController +@RequestMapping("/nc/doc/classification") +public class DocClassificationController extends JeecgController<DocClassification, IDocClassificationService> { + @Autowired + private IDocClassificationService docClassificationService; + + @AutoLog(value = "鏂囨。鍒嗙被琛�-娣诲姞鏂囨。鍒嗙被") + @ApiOperation(value = "鏂囨。鍒嗙被琛�-娣诲姞鏂囨。鍒嗙被", notes = "鏂囨。鍒嗙被琛�-娣诲姞鏂囨。鍒嗙被") + @PostMapping("/add") + public ResponseResult addDocClassification(@RequestBody DocClassification docClassification) { + boolean b = docClassificationService.addDocClassification(docClassification); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocFileController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocFileController.java new file mode 100644 index 0000000..cf3da58 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocFileController.java @@ -0,0 +1,119 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.util.StrUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.DocFile; +import org.jeecg.modules.dnc.response.*; +import org.jeecg.modules.dnc.service.IDocFileService; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "鏂囦欢琛�") +@RestController +@RequestMapping("/nc/file") +public class DocFileController extends JeecgController<DocFile, IDocFileService> { + @Autowired + private IDocFileService docFileService; + + @AutoLog(value = "鏂囦欢琛�-鏍规嵁docId鑾峰彇鏂囦欢鍒楄〃") + @ApiOperation(value = "鏂囦欢琛�-鏍规嵁docId鑾峰彇鏂囦欢鍒楄〃", notes = "鏂囦欢琛�-鏍规嵁docId鑾峰彇鏂囦欢鍒楄〃") + @GetMapping("/find/list") + public QueryListResponseResult<DocFile> findListByDocId(@RequestParam("docId") String docId) { + List<DocFile> list = docFileService.findListByDocId(docId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "鏂囦欢琛�-鎸囧畾鏂囨。鐗堟湰") + @ApiOperation(value = "鏂囦欢琛�-鎸囧畾鏂囨。鐗堟湰", notes = "鏂囦欢琛�-鎸囧畾鏂囨。鐗堟湰") + @PutMapping("/assign/version/{fileId}") + public ResponseResult assignFileVersion(@PathVariable("fileId") String fileId) { + boolean b = docFileService.assignFileVersion(fileId); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "鏂囦欢琛�-閫氳繃id鏌ヨ鏂囦欢") + @ApiOperation(value = "鏂囦欢琛�-閫氳繃id鏌ヨ鏂囦欢", notes = "鏂囦欢琛�-閫氳繃id鏌ヨ鏂囦欢") + @GetMapping("/get/{fileId}") + public DataResponseResult<DocFile> getFileById(@PathVariable("fileId") String fileId) { + DocFile file = docFileService.getById(fileId); + if(file == null) + return new DataResponseResult(CommonCode.FAIL, null); + return new DataResponseResult(CommonCode.SUCCESS, file); + } + + @AutoLog(value = "鏂囦欢琛�-棰勮鏂囦欢") + @ApiOperation(value = "鏂囦欢琛�-棰勮鏂囦欢", notes = "鏂囦欢琛�-棰勮鏂囦欢") + @GetMapping("/preview/{id}") + public QueryListResponseResult previewDocFile(@PathVariable("id") String id) { + DocFile docFile = docFileService.getById(id); + if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) || + /*!StrUtil.isEmpty(docFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(docFile.getFileEncodeName())) + return new QueryListResponseResult(CommonCode.FAIL, null); + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + List<String> list = FileUtilS.readFile(fileEncodeName, filePath); + if(list == null || list.isEmpty()) + return new QueryListResponseResult(CommonCode.FAIL, null); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "鏂囦欢琛�-鏂囨。鏂囦欢棰勮") + @ApiOperation(value = "鏂囦欢琛�-鏂囨。鏂囦欢棰勮", notes = "鏂囦欢琛�-鏂囨。鏂囦欢棰勮") + @GetMapping("/preview/pdf/{id}") + public ResponseResult previewPdfDocFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) { + DocFile docFile = docFileService.getById(id); + if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) || + /*!StrUtil.isEmpty(docFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(docFile.getFileEncodeName())) + return new ResponseResult(CommonCode.FAIL); + String fileName; + if(StrUtil.isEmpty(docFile.getFileSuffix())) { + fileName = docFile.getFileName() + "." + docFile.getFileSuffix(); + }else { + fileName = docFile.getFileName(); + } + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); + return null; + } + + @AutoLog(value = "鏂囦欢琛�-瀵规瘮鏂囦欢") + @ApiOperation(value = "鏂囦欢琛�-瀵规瘮鏂囦欢", notes = "鏂囦欢琛�-瀵规瘮鏂囦欢") + @GetMapping("/comparison/{firstFileId}/{secondFileId}") + public DataResponseResult<ComparisonFilesResponse> comparisonFileDiff(@PathVariable("firstFileId") String firstFileId, @PathVariable("secondFileId") String secondFileId) { + DocFile firstFile = docFileService.getById(firstFileId); + if(firstFile == null || !StrUtil.isEmpty(firstFile.getFilePath()) || !StrUtil.isEmpty(firstFile.getFileName()) || + /*!StrUtil.isEmpty(firstFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(firstFile.getFileEncodeName())) + return new DataResponseResult(CommonCode.FAIL, null); + DocFile secondFile = docFileService.getById(secondFileId); + if(secondFile == null || !StrUtil.isEmpty(secondFile.getFilePath()) || !StrUtil.isEmpty(secondFile.getFileName()) || + /*!StrUtil.isEmpty(secondFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(secondFile.getFileEncodeName())) + return new DataResponseResult(CommonCode.FAIL, null); + ComparisonFilesResponse comp = new ComparisonFilesResponse(); + List<String> firstList = FileUtilS.readFile(firstFile.getFileEncodeName(), firstFile.getFilePath()); + if(firstList == null || firstList.isEmpty()) + return new DataResponseResult(CommonCode.FAIL, null); + comp.setFirst(firstList); + List<String> secondList = FileUtilS.readFile(secondFile.getFileEncodeName(), secondFile.getFilePath()); + if(secondList == null || secondList.isEmpty()) + return new DataResponseResult(CommonCode.FAIL, null); + comp.setSecond(secondList); + return new DataResponseResult(CommonCode.SUCCESS, comp); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocInfoController.java new file mode 100644 index 0000000..d79d6de --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocInfoController.java @@ -0,0 +1,197 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.util.StrUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.DocFile; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.request.DocInfoQueryRequest; +import org.jeecg.modules.dnc.request.DocInfoUploadRequest; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IDocInfoService; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Slf4j +@Api(tags = "鏂囨。琛�") +@RestController +@RequestMapping("/nc/doc") +public class DocInfoController extends JeecgController<DocInfo, IDocInfoService> { + @Autowired + private IDocInfoService docInfoService; + + @AutoLog(value = "鏂囨。琛�-瀵煎叆鏂囨。杩涘彛") + @ApiOperation(value = "鏂囨。琛�-瀵煎叆鏂囨。杩涘彛", notes = "鏂囨。琛�-瀵煎叆鏂囨。杩涘彛") + @PostMapping("/add") + public ResponseResult addDocInfo(@RequestParam("file") MultipartFile file, DocInfoUploadRequest docInfo) { + boolean b = docInfoService.addDocInfo(file, docInfo); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + + @AutoLog(value = "鏂囨。琛�-缂栬緫鏂囨。鍩烘湰淇℃伅") + @ApiOperation(value = "鏂囨。琛�-缂栬緫鏂囨。鍩烘湰淇℃伅", notes = "鏂囨。琛�-缂栬緫鏂囨。鍩烘湰淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editDocInfo(@PathVariable("id") String id, @RequestBody DocInfo docInfo) { + boolean b = docInfoService.editDocInfo(id, docInfo); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鍒犻櫎鏂囨。淇℃伅") + @ApiOperation(value = "鏂囨。琛�-鍒犻櫎鏂囨。淇℃伅", notes = "鏂囨。琛�-鍒犻櫎鏂囨。淇℃伅") + @DeleteMapping("/delete") + public ResponseResult deleteDocInfo(@RequestParam("id") String id) { + boolean b = docInfoService.deleteDocInfo(id); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鍏ュ簱鎿嶄綔 鏂囨。瀵瑰簲鏂囦欢鍗囩増") + @ApiOperation(value = "鏂囨。琛�-鍏ュ簱鎿嶄綔 鏂囨。瀵瑰簲鏂囦欢鍗囩増", notes = "鏂囨。琛�-鍏ュ簱鎿嶄綔 鏂囨。瀵瑰簲鏂囦欢鍗囩増") + @PostMapping("/push/{id}") + public ResponseResult pushDocFile(@PathVariable("id") String id, @RequestParam("file") MultipartFile file) { + boolean b = docInfoService.pushDocFile(id, file); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鍑哄簱") + @ApiOperation(value = "鏂囨。琛�-鍑哄簱", notes = "鏂囨。琛�-鍑哄簱") + @GetMapping("/pull/{id}") + public ResponseResult pullDocFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) { + return docInfoService.pullDocFile(request, response, id); + } + + @AutoLog(value = "鏂囨。琛�-鍙栨秷鍑哄簱") + @ApiOperation(value = "鏂囨。琛�-鍙栨秷鍑哄簱", notes = "鏂囨。琛�-鍙栨秷鍑哄簱") + @PutMapping("/cancel/pull/{id}") + public ResponseResult cancelPullDocInfo(@PathVariable("id") String id) { + boolean b = docInfoService.cancelPullDocInfo(id); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鏂囨。鍙戝竷") + @ApiOperation(value = "鏂囨。琛�-鏂囨。鍙戝竷", notes = "鏂囨。琛�-鏂囨。鍙戝竷") + @PutMapping("/publish/{id}") + public ResponseResult publishDocInfo(@PathVariable("id") String id) { + boolean b = docInfoService.publishDocInfo(id); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鏂囨。閲嶅彂甯�") + @ApiOperation(value = "鏂囨。琛�-鏂囨。閲嶅彂甯�", notes = "鏂囨。琛�-鏂囨。閲嶅彂甯�") + @PutMapping("/republish/{id}") + public ResponseResult republishDocInfo(@PathVariable("id") String id) { + boolean b = docInfoService.republishDocInfo(id); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鏂囨。褰掓。") + @ApiOperation(value = "鏂囨。琛�-鏂囨。褰掓。", notes = "鏂囨。琛�-鏂囨。褰掓。") + @PutMapping("/pigeonhole/{id}") + public ResponseResult pigeonholeDocInfo(@PathVariable("id") String id) { + boolean b = docInfoService.pigeonholeDocInfo(id); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囨。琛�-鍒嗛〉鏌ヨ鎺ュ彛") + @ApiOperation(value = "鏂囨。琛�-鍒嗛〉鏌ヨ鎺ュ彛", notes = "鏂囨。琛�-鍒嗛〉鏌ヨ鎺ュ彛") + @GetMapping("/find/page/{page}/{size}") + public QueryPageResponseResult<DocInfo> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, DocInfoQueryRequest docQuery) { + return docInfoService.findPageList(page, size, docQuery); + } + + @AutoLog(value = "鏂囨。琛�-鏌ヨ璁惧鍙戦�佺洰褰曠殑鏂囨。鐘舵��") + @ApiOperation(value = "鏂囨。琛�-鏌ヨ璁惧鍙戦�佺洰褰曠殑鏂囨。鐘舵��", notes = "鏂囨。琛�-鏌ヨ璁惧鍙戦�佺洰褰曠殑鏂囨。鐘舵��") + @GetMapping("/find/page/device/{page}/{size}") + public QueryPageResponseResult<DocInfo> findPageListByDevice(@PathVariable("page") int page, @PathVariable("size") int size, DocInfoQueryRequest docQuery) { + return docInfoService.findPageListByDevice(page, size, docQuery); + } + + @AutoLog(value = "鏂囨。琛�-鏂囨。鏂囦欢棰勮") + @ApiOperation(value = "鏂囨。琛�-鏂囨。鏂囦欢棰勮", notes = "鏂囨。琛�-鏂囨。鏂囦欢棰勮") + @GetMapping("/preview/{id}") + public QueryListResponseResult previewDocFile(@PathVariable("id") String id) { + DocFile docFile = docInfoService.previewDocFile(id); + if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) +// || !StrUtil.isEmpty(docFile.getFileSuffix()) + || !StrUtil.isEmpty(docFile.getFileEncodeName())) + return new QueryListResponseResult(CommonCode.FAIL, null); + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + List<String> list = FileUtilS.readFile(fileEncodeName, filePath); + if(list == null || list.isEmpty()) + return new QueryListResponseResult(CommonCode.FAIL, null); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "鏂囨。琛�-鏂囨。鏂囦欢棰勮pdf") + @ApiOperation(value = "鏂囨。琛�-鏂囨。鏂囦欢棰勮pdf", notes = "鏂囨。琛�-鏂囨。鏂囦欢棰勮pdf") + @GetMapping("/preview/pdf/{id}") + public ResponseResult previewPdfDocFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) { + DocFile docFile = docInfoService.previewDocFile(id); + if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) || + /*!StrUtil.isEmpty(docFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(docFile.getFileEncodeName())) + return new ResponseResult(CommonCode.FAIL); + String fileName; + if(StrUtil.isEmpty(docFile.getFileSuffix())) { + fileName = docFile.getFileName() + "." + docFile.getFileSuffix(); + }else { + fileName = docFile.getFileName(); + } + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); + return null; + } + + @AutoLog(value = "鏂囦欢琛�-鏌ヨ鍙寚娲剧殑鏂囨。淇℃伅鍒楄〃") + @ApiOperation(value = "鏂囦欢琛�-鏌ヨ鍙寚娲剧殑鏂囨。淇℃伅鍒楄〃", notes = "鏂囦欢琛�-鏌ヨ鍙寚娲剧殑鏂囨。淇℃伅鍒楄〃") + @GetMapping("/find/list") + public QueryListResponseResult<DocInfo> findList(DocInfoQueryRequest docQuery) { + return docInfoService.findList(docQuery); + } + + @AutoLog(value = "鏂囦欢琛�-鎵归噺鍒犻櫎鏂囨。鎺ュ彛") + @ApiOperation(value = "鏂囦欢琛�-鎵归噺鍒犻櫎鏂囨。鎺ュ彛", notes = "鏂囦欢琛�-鎵归噺鍒犻櫎鏂囨。鎺ュ彛") + @PostMapping("/batch/remove") + public ResponseResult batchRemoveDocInfo(@RequestBody String[] docIds) { + boolean b = docInfoService.batchRemoveDocInfo(docIds); + if(!b) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.SUCCESS); + } + + @AutoLog(value = "鏂囦欢琛�-鏂囨。涓嬭浇") + @ApiOperation(value = "鏂囦欢琛�-鏂囨。涓嬭浇", notes = "鏂囦欢琛�-鏂囨。涓嬭浇") + @GetMapping("/download/{id}") + public ResponseResult downloadDocFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) { + return docInfoService.downloadDocFile(request, response, id); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java new file mode 100644 index 0000000..91181e2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.entity.DocRelative; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IDocRelativeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "璁惧鍏宠仈鏂囨。琛�") +@RestController +@RequestMapping("/doc/relative") +public class DocRelativeController extends JeecgController<DocRelative, IDocRelativeService> { + @Autowired + private IDocRelativeService relativeService; + + @AutoLog(value = "璁惧鍏宠仈鏂囨。琛�-鍒犻櫎璁惧涓嬬殑鏂囨。鎺ュ彛") + @ApiOperation(value = "璁惧鍏宠仈鏂囨。琛�-鍒犻櫎璁惧涓嬬殑鏂囨。鎺ュ彛", notes = "璁惧鍏宠仈鏂囨。琛�-鍒犻櫎璁惧涓嬬殑鏂囨。鎺ュ彛") + @DeleteMapping("/delete/device/{docId}/{deviceId}") + public ResponseResult deleteDocByDeviceId(@PathVariable("docId") String docId, @PathVariable("deviceId") String deviceId) { + boolean b = relativeService.deleteDocByAttr(docId, 4, deviceId); + if(b) + return new ResponseResult(CommonCode.SUCCESS); + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "璁惧鍏宠仈鏂囨。琛�-鏌ヨ鏂囨。涓嬬殑鎵�鏈夊叧鑱旇澶囦俊鎭�") + @ApiOperation(value = "璁惧鍏宠仈鏂囨。琛�-鏌ヨ鏂囨。涓嬬殑鎵�鏈夊叧鑱旇澶囦俊鎭�", notes = "璁惧鍏宠仈鏂囨。琛�-鏌ヨ鏂囨。涓嬬殑鎵�鏈夊叧鑱旇澶囦俊鎭�") + @GetMapping("/get/device/{docId}") + public QueryListResponseResult<DeviceInfo> findDeviceByDocId(@PathVariable("docId") String docId) { + List<DeviceInfo> list = relativeService.findDeviceByDocId(docId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java new file mode 100644 index 0000000..678a805 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.dnc.entity.NcLogInfo; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.service.INcLogInfoService; +import org.jeecg.modules.dnc.request.NcLogInfoRequest; +import org.springframework.beans.factory.annotation.Autowired; +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 org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Description: DNC鏃ュ織绠$悊 + * @Author: + * @Date: 2024-12-17 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "DNC鏃ュ織绠$悊琛�") +@RestController +@RequestMapping("/doc/ncloginfo") +public class NcLogInfoController { + @Autowired + private INcLogInfoService iNcLogInfoService; + + /** + * 鏃ュ織鏌ヨ + * @param page + * @param size + * @param ncLogInfoRequest + * @return + */ + @AutoLog(value = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ") + @ApiOperation(value = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ", notes = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ") + @GetMapping("/find/page/{page}/{size}") + public QueryPageResponseResult<NcLogInfo> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, NcLogInfoRequest ncLogInfoRequest) { + return iNcLogInfoService.findByPageList(page, size, ncLogInfoRequest); + } + + /** + * 瀵煎嚭 + * @param ncLogInfoRequest + * @return + */ + @AutoLog(value = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織") + @ApiOperation(value = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織", notes = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織") + @GetMapping("/exportXls") + public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response,NcLogInfoRequest ncLogInfoRequest){ + return iNcLogInfoService.exportLogList(ncLogInfoRequest); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/PartsInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/PartsInfoController.java new file mode 100644 index 0000000..a7ba140 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/PartsInfoController.java @@ -0,0 +1,56 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.PartsInfo; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IPartsInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@Api(tags = "闆朵欢淇℃伅琛�") +@RestController +@RequestMapping("/nc/parts") +public class PartsInfoController extends JeecgController<PartsInfo, IPartsInfoService> { + + @Autowired + private IPartsInfoService partsInfoService; + + @AutoLog(value = "闆朵欢淇℃伅琛�-娣诲姞闆朵欢淇℃伅") + @ApiOperation(value = "闆朵欢淇℃伅琛�-娣诲姞闆朵欢淇℃伅", notes = "闆朵欢淇℃伅琛�-娣诲姞闆朵欢淇℃伅") + @PostMapping("/add") + public ResponseResult addPartsInfo(@RequestBody PartsInfo partsInfo) { + boolean b = partsInfoService.addPartsInfo(partsInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "闆朵欢淇℃伅琛�-缂栬緫闆朵欢淇℃伅") + @ApiOperation(value = "闆朵欢淇℃伅琛�-缂栬緫闆朵欢淇℃伅", notes = "闆朵欢淇℃伅琛�-缂栬緫闆朵欢淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editPartsInfo(@PathVariable("id") String id, @RequestBody PartsInfo partsInfo) { + boolean b = partsInfoService.editPartsInfo(id, partsInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "闆朵欢淇℃伅琛�-鍒犻櫎闆朵欢") + @ApiOperation(value = "闆朵欢淇℃伅琛�-鍒犻櫎闆朵欢", notes = "闆朵欢淇℃伅琛�-鍒犻櫎闆朵欢") + @DeleteMapping("/delete") + public ResponseResult deletePartsInfo(@RequestParam("id") String id) { + boolean b = partsInfoService.deletePartsInfo(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessController.java new file mode 100644 index 0000000..030c875 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessController.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.util.StrUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.ProcessInfo; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IProcessInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "鏂板缓宸ュ簭琛�") +@RestController +@RequestMapping("/nc/process") +public class ProcessController extends JeecgController<ProcessInfo, IProcessInfoService> { + @Autowired + private IProcessInfoService processInfoService; + + @AutoLog(value = "鏂板缓宸ュ簭琛�-鏂板鎴栫紪杈戝伐搴忓熀鏈俊鎭�") + @ApiOperation(value = "鏂板缓宸ュ簭琛�-鏂板鎴栫紪杈戝伐搴忓熀鏈俊鎭�", notes = "鏂板缓宸ュ簭琛�-鏂板鎴栫紪杈戝伐搴忓熀鏈俊鎭�") + @PostMapping("/addOrEdit") + public ResponseResult addOrEdit(@RequestBody ProcessInfo processInfo) { + boolean b = processInfoService.addOrEdit(processInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "鏂板缓宸ュ簭琛�-鏍规嵁宸ュ簭鍚嶇О妯$硦鏌ヨ") + @ApiOperation(value = "鏂板缓宸ュ簭琛�-鏍规嵁宸ュ簭鍚嶇О妯$硦鏌ヨ", notes = "鏂板缓宸ュ簭琛�-鏍规嵁宸ュ簭鍚嶇О妯$硦鏌ヨ") + @GetMapping("/find/list") + public QueryListResponseResult<ProcessInfo> findByProcessName(@RequestParam(value = "processName", required = false) String processName) { + if(!StrUtil.isEmpty(processName)) + return new QueryListResponseResult(CommonCode.SUCCESS, Collections.emptyList()); + List<ProcessInfo> list = processInfoService.findByProcessName(processName); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + + @AutoLog(value = "鏂板缓宸ュ簭琛�-宸ュ簭鍒楄〃") + @ApiOperation(value = "鏂板缓宸ュ簭琛�-宸ュ簭鍒楄〃", notes = "鏂板缓宸ュ簭琛�-宸ュ簭鍒楄〃") + @GetMapping("/find/all") + public QueryListResponseResult<ProcessInfo> findAll() { + List<ProcessInfo> list = processInfoService.list(); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessStreamController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessStreamController.java new file mode 100644 index 0000000..0cc49fb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessStreamController.java @@ -0,0 +1,80 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.ProcessStream; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.request.ProcessStreamRequest; +import org.jeecg.modules.dnc.service.IProcessStreamService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "鍏ㄩ儴宸ュ簭琛�") +@RestController +@RequestMapping("/nc/stream/process") +public class ProcessStreamController extends JeecgController<ProcessStream, IProcessStreamService> { + @Autowired + private IProcessStreamService processStreamService; + + @AutoLog(value = "鍏ㄩ儴宸ュ簭琛�-娣诲姞宸ュ簭") + @ApiOperation(value = "鍏ㄩ儴宸ュ簭琛�-娣诲姞宸ュ簭", notes = "鍏ㄩ儴宸ュ簭琛�-娣诲姞宸ュ簭") + @PostMapping("/add") + public ResponseResult addProcessStream(@RequestBody ProcessStream stream) { + boolean b = processStreamService.addProcessStream(stream); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "鍏ㄩ儴宸ュ簭琛�-缂栬緫宸ュ簭淇℃伅") + @ApiOperation(value = "鍏ㄩ儴宸ュ簭琛�-缂栬緫宸ュ簭淇℃伅", notes = "鍏ㄩ儴宸ュ簭琛�-缂栬緫宸ュ簭淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editProcessStream(@PathVariable("id") String id, @RequestBody ProcessStream stream) { + boolean b = processStreamService.editProcessStream(id, stream); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "鍏ㄩ儴宸ュ簭琛�-鍒犻櫎宸ュ簭淇℃伅 閫昏緫鍒犻櫎") + @ApiOperation(value = "鍏ㄩ儴宸ュ簭琛�-鍒犻櫎宸ュ簭淇℃伅 閫昏緫鍒犻櫎", notes = "鍏ㄩ儴宸ュ簭琛�-鍒犻櫎宸ュ簭淇℃伅 閫昏緫鍒犻櫎") + @DeleteMapping("/delete") + public ResponseResult deleteProcessStream(@RequestParam("id") String id) { + boolean b = processStreamService.deleteProcessStream(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "鍏ㄩ儴宸ュ簭琛�-鏌ヨ閮ㄤ欢/闆朵欢鑺傜偣涓嬬殑宸ュ簭鍒楄〃") + @ApiOperation(value = "鍏ㄩ儴宸ュ簭琛�-鏌ヨ閮ㄤ欢/闆朵欢鑺傜偣涓嬬殑宸ュ簭鍒楄〃", notes = "鍏ㄩ儴宸ュ簭琛�-鏌ヨ閮ㄤ欢/闆朵欢鑺傜偣涓嬬殑宸ュ簭鍒楄〃") + @GetMapping("/find/list") + public QueryListResponseResult<ProcessStream> findByNodeParams(ProcessStreamRequest request) { + List<ProcessStream> list = processStreamService.findByNodeParams(request); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "鍏ㄩ儴宸ュ簭琛�-妫�鏌N鐮佸搴旂殑璁惧鏄惁瀛樺湪鍙姞宸ュ伐搴�") + @ApiOperation(value = "鍏ㄩ儴宸ュ簭琛�-妫�鏌N鐮佸搴旂殑璁惧鏄惁瀛樺湪鍙姞宸ュ伐搴�", notes = "鍏ㄩ儴宸ュ簭琛�-妫�鏌N鐮佸搴旂殑璁惧鏄惁瀛樺湪鍙姞宸ュ伐搴�") + @GetMapping("/valid/process") + public ResponseResult validateDeviceProcessInfo(String pnCode, String deviceNo) { + List<ProcessStream> list = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo); + if(list == null || list.isEmpty()) + return new ResponseResult(CommonCode.FAIL); + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java new file mode 100644 index 0000000..674fc8c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java @@ -0,0 +1,255 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.util.StrUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.entity.ProductInfo; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IProductInfoService; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.List; +@Slf4j +@Api(tags = "浜у搧琛�") +@RestController +@RequestMapping("/nc/product") +public class ProductInfoController extends JeecgController<ProductInfo, IProductInfoService> { + + @Autowired + private IProductInfoService productInfoService; + + @AutoLog(value = "浜у搧琛�-鏂板浜у搧淇℃伅") + @ApiOperation(value = "浜у搧琛�-鏂板浜у搧淇℃伅", notes = "浜у搧琛�-鏂板浜у搧淇℃伅") + @PostMapping("/add") + public ResponseResult addProductInfo(@RequestBody ProductInfo productInfo) { + boolean b = productInfoService.addProductInfo(productInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "浜у搧琛�-缂栬緫浜у搧淇℃伅") + @ApiOperation(value = "浜у搧琛�-缂栬緫浜у搧淇℃伅", notes = "浜у搧琛�-缂栬緫浜у搧淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editProductInfo(@PathVariable("id") String id,@RequestBody ProductInfo productInfo) { + boolean b = productInfoService.editProductInfo(id, productInfo); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇浜у搧缁撴瀯鏍戞帴鍙�") + @ApiOperation(value = "浜у搧琛�-鑾峰彇浜у搧缁撴瀯鏍戞帴鍙�", notes = "浜у搧琛�-鑾峰彇浜у搧缁撴瀯鏍戞帴鍙�") + @GetMapping("/load/tree") + public QueryListResponseResult<CommonGenericTree> loadProductTree() { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!StrUtil.isEmpty(userId)) + return new QueryListResponseResult<>(CommonCode.SUCCESS, Collections.emptyList()); + List<CommonGenericTree> list = productInfoService.loadProductTree(userId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇浜у搧鏍戠殑绗竴绾у拰绗簩绾�") + @ApiOperation(value = "浜у搧琛�-鑾峰彇浜у搧鏍戠殑绗竴绾у拰绗簩绾�", notes = "浜у搧琛�-鑾峰彇浜у搧鏍戠殑绗竴绾у拰绗簩绾�") + @GetMapping("/load/tree/base") + public QueryListResponseResult<CommonGenericTree> loadBaseTree() { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!StrUtil.isEmpty(userId)) + return new QueryListResponseResult<>(CommonCode.SUCCESS, Collections.emptyList()); + List<CommonGenericTree> list = productInfoService.loadBaseTree(userId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "浜у搧琛�-鍔犺浇浜у搧鏍戝瓙鑺傜偣鏁版嵁") + @ApiOperation(value = "浜у搧琛�-鍔犺浇浜у搧鏍戝瓙鑺傜偣鏁版嵁", notes = "浜у搧琛�-鍔犺浇浜у搧鏍戝瓙鑺傜偣鏁版嵁") + @GetMapping("/load/tree/child/{nodeType}/{paramId}") + public QueryListResponseResult<CommonGenericTree> loadTree(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!StrUtil.isEmpty(userId)) + return new QueryListResponseResult<>(CommonCode.SUCCESS, Collections.emptyList()); + List<CommonGenericTree> list = productInfoService.loadTree(userId, nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } + + + @AutoLog(value = "浜у搧琛�-鍒犻櫎浜у搧") + @ApiOperation(value = "浜у搧琛�-鍒犻櫎浜у搧", notes = "浜у搧琛�-鍒犻櫎浜у搧") + @DeleteMapping("/delete") + public ResponseResult deleteProductInfo(@RequestParam("id") String id) { + boolean b = productInfoService.deleteProductInfo(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "浜у搧琛�-妫�鏌ヤ骇鍝佹爲鑺傜偣鐨勬煡鐪嬫潈闄�") + @ApiOperation(value = "浜у搧琛�-妫�鏌ヤ骇鍝佹爲鑺傜偣鐨勬煡鐪嬫潈闄�", notes = "浜у搧琛�-妫�鏌ヤ骇鍝佹爲鑺傜偣鐨勬煡鐪嬫潈闄�") + @GetMapping("/check/{nodeType}/{paramId}") + public ResponseResult checkProductPerm(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + boolean b = productInfoService.checkProductPerm(nodeType, paramId); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.UNAUTHORISE); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑鐢ㄦ埛") + @ApiOperation(value = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑鐢ㄦ埛", notes = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑鐢ㄦ埛") + @GetMapping("/get/perm/user/{nodeType}/{paramId}") + public QueryListResponseResult<UserDepartExt> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<UserDepartExt> list = productInfoService.getUserPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑鐢ㄦ埛") + @ApiOperation(value = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑鐢ㄦ埛", notes = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑鐢ㄦ埛") + @GetMapping("/get/non/perm/user/{nodeType}/{paramId}") + public QueryListResponseResult<SysUser> getUserNonPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<SysUser> list = productInfoService.getUserNonPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑閮ㄩ棬") + @ApiOperation(value = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑閮ㄩ棬", notes = "浜у搧琛�-鑾峰彇宸插垎閰嶇殑閮ㄩ棬") + @GetMapping("/get/perm/depart/{nodeType}/{paramId}") + public QueryListResponseResult<Department> getDepartPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<Department> list = productInfoService.getDepartPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + @AutoLog(value = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑閮ㄩ棬") + @ApiOperation(value = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑閮ㄩ棬", notes = "浜у搧琛�-鑾峰彇鏈垎閰嶇殑閮ㄩ棬") + @GetMapping("/get/non/perm/depart/{nodeType}/{paramId}") + public QueryListResponseResult<Department> getDepartNonPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { + List<Department> list = productInfoService.getDepartNonPermsList(nodeType, paramId); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, list); + } + + /** + * 鎸囨淳浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param userIds 娣诲姞鐢ㄦ埛ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + @AutoLog(value = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @ApiOperation(value = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺", notes = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @PostMapping("/assign/add/user/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignAddUser(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { + boolean b = productInfoService.assignAddUser(nodeType, paramId, relativeFlag, userIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 绉婚櫎浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param userIds 绉婚櫎鐢ㄦ埛ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + @AutoLog(value = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @ApiOperation(value = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺", notes = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺") + @PostMapping("/assign/remove/user/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignRemoveUser(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { + boolean b = productInfoService.assignRemoveUser(nodeType, paramId, relativeFlag, userIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 鎸囨淳浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param departmentIds 娣诲姞閮ㄩ棬ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + @AutoLog(value = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺") + @ApiOperation(value = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺", notes = "浜у搧琛�-鎸囨淳浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺") + @PostMapping("/assign/add/department/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignAddDepartment(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { + boolean b = productInfoService.assignAddDepartment(nodeType, paramId, relativeFlag, departmentIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 绉婚櫎浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param departmentIds 绉婚櫎閮ㄩ棬ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + @AutoLog(value = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺") + @ApiOperation(value = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺", notes = "浜у搧琛�-绉婚櫎浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺") + @PostMapping("/assign/remove/department/{nodeType}/{paramId}/{relativeFlag}") + public ResponseResult assignRemoveDepartment(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { + boolean b = productInfoService.assignRemoveDepartment(nodeType, paramId, relativeFlag, departmentIds); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + /** + * 鎼滅储鎺ュ彛 + * @param queryParam + * @return + */ + @AutoLog(value = "浜у搧琛�-鎼滅储鎺ュ彛") + @ApiOperation(value = "浜у搧琛�-鎼滅储鎺ュ彛", notes = "浜у搧琛�-鎼滅储鎺ュ彛") + @GetMapping("/search") + public QueryListResponseResult<CommonGenericTree> searchProductTree(String queryParam) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!StrUtil.isEmpty(userId)) + return new QueryListResponseResult<>(CommonCode.SUCCESS, Collections.emptyList()); + List<CommonGenericTree> list = productInfoService.searchProductTree(userId, queryParam); + if(list == null) + list = Collections.emptyList(); + return new QueryListResponseResult<>(CommonCode.SUCCESS, list); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java new file mode 100644 index 0000000..4192f04 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.service.IUserPermButtonService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.List; + +@Slf4j +@Api(tags = "鐢ㄦ埛鎸夐挳鏉冮檺") +@RestController +@RequestMapping("/nc/user") +public class UserPermButtonController { + @Autowired + private IUserPermButtonService userPermButtonService; + + + /** + * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 + * @param param + * @param flag + * @param objectId + * @param relativeParam + * @param relativeObjectId + * @return + */ + @AutoLog(value = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃") + @ApiOperation(value = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃", notes = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃") + @GetMapping("/get/button/perms") + public QueryListResponseResult<String> getCurrentUserButtonPerms(@RequestParam("param") String param, + @RequestParam("flag") Integer flag, + @RequestParam(value = "objectId", required = false) String objectId, + @RequestParam(value = "relativeParam", required = false) String relativeParam, + @RequestParam(value = "relativeObjectId", required = false) String relativeObjectId) { + List<String> perms = userPermButtonService.getCurrentUserButtonPerms(param, flag, objectId, relativeParam, relativeObjectId); + if(perms == null) + perms = Collections.emptyList(); + return new QueryListResponseResult(CommonCode.SUCCESS, perms); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/ComponentExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/ComponentExt.java new file mode 100644 index 0000000..4c70f07 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/ComponentExt.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.dnc.dto; + +import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.springframework.beans.BeanUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Slf4j +public class ComponentExt extends ComponentInfo { + private ComponentExt parent; + private List<ComponentExt> children; + + @JsonIgnore + private String userId; + + public boolean hasChild() { + boolean b = true; + if(this.getChildren() == null || this.getChildren().size() < 1) { + b = false; + } + return b; + } + + public List<ComponentInfo> getAllChildren(List<ComponentInfo> list) { + if(this.hasChild()) { + List<ComponentExt> extList = this.getChildren(); + for(ComponentExt ext : extList) { + list = ext.getAllChildren(list); + } + ComponentInfo en = new ComponentInfo(); + BeanUtils.copyProperties(this, en); + list.add(en); + }else { + ComponentInfo en = new ComponentInfo(); + BeanUtils.copyProperties(this, en); + list.add(en); + } + return list; + } + + public static List<ComponentExt> convertToExtList(List<ComponentInfo> componentInfoList){ + List<ComponentExt> extList = new ArrayList<>(); + ComponentExt ext; + Map<String, ComponentExt> componentExtMap = new HashMap<>(); + for(ComponentInfo info : componentInfoList){ + ext = new ComponentExt(); + BeanUtils.copyProperties(info, ext); + extList.add(ext); + componentExtMap.put(ext.getComponentId(), ext); + } + for(ComponentExt e : extList){ + if(StrUtil.isEmpty(e.getParentId()) && componentExtMap.containsKey(e.getParentId())){ + e.setParent(componentExtMap.get(e.getParentId())); + } + } + return extList; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartApproveUser.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartApproveUser.java new file mode 100644 index 0000000..28555bb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartApproveUser.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.dto; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName("sys_depart_approve_user") +public class DepartApproveUser { + @TableId(value = "approve_id") + private String approveId; + @TableField(value = "depart_id") + private String departId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentExt.java new file mode 100644 index 0000000..e4fac53 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentExt.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.dnc.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.jeecg.modules.dnc.ucenter.Department; + +import java.util.List; + +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class DepartmentExt extends Department { + private List<DepartmentExt> childList; + + public boolean hasChild() { + boolean b = true; + if(this.getChildList() == null || this.getChildList().size() < 1) { + b = false; + } + return b; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentUser.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentUser.java new file mode 100644 index 0000000..48c8415 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DepartmentUser.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.dto; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_depart_user") +public class DepartmentUser { + @TableId + private String departUserId; + private String departId; + private String userId; + //宀椾綅绫诲瀷 + private Integer positionType; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DeviceGroupExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DeviceGroupExt.java new file mode 100644 index 0000000..8c050ed --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/DeviceGroupExt.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.dnc.dto; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.jeecg.modules.dnc.entity.DeviceGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.springframework.beans.BeanUtils; + +import java.util.List; + +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class DeviceGroupExt extends DeviceGroup { + private DeviceGroupExt parent; + private List<DeviceGroupExt> children; + + @JsonIgnore + private String userId; + + public boolean hasChild() { + boolean b = true; + if(this.getChildren() == null || this.getChildren().size() < 1) { + b = false; + } + return b; + } + + public List<DeviceGroup> getAllChildren(List<DeviceGroup> groups) { + if(this.hasChild()) { + List<DeviceGroupExt> extList = this.getChildren(); + for(DeviceGroupExt ext : extList) { + groups = ext.getAllChildren(groups); + } + DeviceGroup group = new DeviceGroup(); + BeanUtils.copyProperties(this, group); + groups.add(group); + }else { + DeviceGroup group = new DeviceGroup(); + BeanUtils.copyProperties(this, group); + groups.add(group); + } + return groups; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/MultilevelDictionaryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/MultilevelDictionaryRequest.java new file mode 100644 index 0000000..2863903 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/MultilevelDictionaryRequest.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.dnc.dto; + +import lombok.Data; + +@Data +public class MultilevelDictionaryRequest { + private String typeCode; + private String dicCode; + private String dicName; + private String id; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SingleDictionaryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SingleDictionaryRequest.java new file mode 100644 index 0000000..fdb0b33 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SingleDictionaryRequest.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.dnc.dto; + +import lombok.Data; + +@Data +public class SingleDictionaryRequest { + private String typeCode; + private String dicCode; + private String dicName; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SysLogTypeObjectDto.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SysLogTypeObjectDto.java new file mode 100644 index 0000000..a3711a7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/SysLogTypeObjectDto.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.dnc.dto; + +import lombok.Data; + +/** + * @author clown + * * @date 2023/12/19 + */ +@Data +public class SysLogTypeObjectDto { + + private String systemName="DNC"; + /*鏃堕棿*/ + private String dateTime; + /*鍦扮偣*/ + private String location="鎴愬彂宸ヤ笟鍥�"; + /*绫诲瀷 Info/error*/ + private String types; + /*鏂囦欢搴忓彿*/ + private String fileNum; + /*鏂囦欢鍚�*/ + private String fileName; + /*鏂囦欢澶у皬*/ + private String fileSize; + /*涓氬姟绯荤粺ip*/ + private String address; + /*鏂囦欢鎽樿*/ + private String abstract1; + /*婧愬湴鍧�*/ + private String sourceAddress ; + /*鐩殑鍦板潃*/ + private String destination; + /*缁撴灉*/ + private String result; + + + @Override + public String toString() { + return "{" + + "systemName=" + systemName + + ",datetime=" + dateTime + + ",location=" + location + + ",types=" + types + + ",fileNum=" + fileNum + + ",fileName=" + fileName + + ",fileSize=" + fileSize + + ",address=" + address + + ",abstract=" + abstract1 + + ",sourceAddress=" + sourceAddress + + ",destination=" + destination + + ",result=" + result + + "}"; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java new file mode 100644 index 0000000..e73db26 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java @@ -0,0 +1,55 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelTarget; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_button") +@ExcelTarget("button") +public class Button implements Serializable { + @TableId + private String buttonId; + @Excel(name = "鎸夐挳鏉冮檺") + private String buttonPerm; + @Excel(name = "鎸夐挳鍚嶇О") + private String buttonName; + private String buttonIcon; + private Integer priority; + private Integer buttonType; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + + @TableField(exist = false) + private String buttonAlias; + + @TableField(exist = false) + private String buttonUrl; + + @TableField(exist = false) + private String permCode; + + @TableField(exist = false) + private Boolean checked = false; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java new file mode 100644 index 0000000..693fd4e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_button_permission") +public class ButtonPermission { + @TableId + private String permId; + private String roleId; + private String buttonId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentDepartment.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentDepartment.java new file mode 100644 index 0000000..ef34b5b --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentDepartment.java @@ -0,0 +1,34 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_component_department") +public class ComponentDepartment { + @TableId(value = "component_depart_id") + private String componentDepartId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + + public ComponentDepartment(String componentId, String departId){ + this.componentId = componentId; + this.departId = departId; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentInfo.java new file mode 100644 index 0000000..c1362bb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentInfo.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; +/** + * @Description: 閮ㄤ欢 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_component_info") +@ApiModel(value = "閮ㄤ欢绠$悊") +public class ComponentInfo { + @TableId(value = "component_id") + private String componentId; + @TableField(value = "parent_id") + private String parentId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "component_name") + private String componentName; + @TableField(value = "materiel_code") + private String materielCode; + @TableField(value = "materiel_desp") + private String materielDesp; + @TableField(value = "component_model") + private String componentModel; + @TableField(value = "component_scale") + private String componentScale; + @TableField(value = "component_weight") + private BigDecimal componentWeight; + @TableField(value = "rank_level") + private Integer rankLevel; + @TableField(value = "assemble_type") + private Integer assembleType; + @TableField(value = "produce_type") + private Integer produceType; + @TableField(value = "process_type") + private Integer processType; + @TableField(value = "structure_type") + private Integer structureType; + @TableField(value = "component_code") + private String componentCode; + @TableField(value = "component_status") + private Integer componentStatus; + @TableField(value = "description") + private String description; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentPermission.java new file mode 100644 index 0000000..ae488a8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ComponentPermission.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_component_permission") +public class ComponentPermission { + @TableId(value = "component_perm_id") + private String componentPermId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + + public ComponentPermission(String componentId, String userId){ + this.componentId = componentId; + this.userId = userId; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java new file mode 100644 index 0000000..b050344 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java @@ -0,0 +1,46 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 璁惧鐗规畩瀛楃 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_device_characters") +@ApiModel(value = "璁惧鐗规畩瀛楃") +public class DeviceCharacters { + @TableId(value = "id") + private String id; + @TableField(value = "device_no") + private String deviceNo; + @TableField(value = "depart_id") + private String departId; + @TableField(value = "control_system") + private String controlSystem; + @TableField(value = "characters") + private String characters; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroup.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroup.java new file mode 100644 index 0000000..8f0bd80 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroup.java @@ -0,0 +1,44 @@ +package org.jeecg.modules.dnc.entity; + + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_device_group") +@ApiModel(value = "璁惧鍒嗙粍琛�") +public class DeviceGroup { + @TableId(value = "group_id") + private String groupId; + @TableField(value = "group_name") + private String groupName; + @TableField(value = "parent_id") + private String parentId; + @TableField(value = "rank_level") + private Integer rankLevel; + @TableField(value = "description") + private String description; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupDepart.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupDepart.java new file mode 100644 index 0000000..e1bf81a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupDepart.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_device_group_department") +public class DeviceGroupDepart { + @TableId(value = "group_depart_id") + private String groupDepartId; + @TableField(value = "group_id") + private String groupId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupPermission.java new file mode 100644 index 0000000..8ab9ad4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceGroupPermission.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_device_group_permission") +public class DeviceGroupPermission { + @TableId(value = "group_perm_id") + private String groupPermId; + @TableField(value = "group_id") + private String groupId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceInfo.java new file mode 100644 index 0000000..f9e3a59 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceInfo.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +/** + * @Description: 璁惧 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_device_info") +@Api(tags = "璁惧琛�") +public class DeviceInfo { + @TableId(value = "device_id") + private String deviceId; + @TableField(value = "group_id") + private String groupId; + @TableField(value = "device_no") + private String deviceNo; + @TableField(value = "device_name") + private String deviceName; + @TableField(value = "control_system") + private String controlSystem; + @TableField(value = "device_model") + private String deviceModel; + @TableField(value = "link_ip") + private String linkIp; + @TableField(value = "link_port") + private Integer linkPort; + @TableField(value = "depart_id") + private String departId; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + @TableField(exist = false) + private String groupName; + @TableField(exist = false) + private String departName; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermission.java new file mode 100644 index 0000000..f174c21 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermission.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_device_permission") +public class DevicePermission { + @TableId(value = "device_perm_id") + private String devicePermId; + @TableField(value = "device_id") + private String deviceId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermissionStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermissionStream.java new file mode 100644 index 0000000..62fc06e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DevicePermissionStream.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_device_permission_stream") +public class DevicePermissionStream { + @TableId(value = "perm_id") + private String permId; + @TableField(value = "group_id") + private String groupId; + @TableField(value = "device_id") + private String deviceId; + @TableField(value = "user_id") + private String userId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java new file mode 100644 index 0000000..625a104 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author clown + * * @date 2023/11/29 + */ +@Data +@NoArgsConstructor +@TableName(value = "dnc_pass_log") +public class DncPassLog { + @TableId + private String id; + //鍚嶇О + private String passName; + //搴忓彿 + private String sequenceOrder; + //鏃堕棿 + private String dayTime; + //绫诲瀷 + private String passType; + // 鏂囦欢鍚嶇О + private String passLogFileName; + //椤哄簭鍙� + private Integer sequenceNumber; + + private Date createTime; + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocClassification.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocClassification.java new file mode 100644 index 0000000..7d8a0d8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocClassification.java @@ -0,0 +1,38 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_doc_classification") +public class DocClassification { + @TableId(value = "classification_id") + private String classificationId; + @TableField(value = "classification_name") + private String classificationName; + @TableField(value = "classification_code") + private String classificationCode; + @TableField(value = "description") + private String description; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocFile.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocFile.java new file mode 100644 index 0000000..70c61ba --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocFile.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +/** + * @Description: 瀵煎叆鏂囦欢 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_doc_file") +public class DocFile { + @TableId(value = "file_id") + private String fileId; + @TableField(value = "file_name") + private String fileName; + @TableField(value = "file_encode_name") + private String fileEncodeName; + @TableField(value = "file_path") + private String filePath; + @TableField(value = "file_suffix") + private String fileSuffix; + @TableField(value = "doc_version") + private String docVersion; + @TableField(value = "doc_id") + private String docId; + @TableField(value = "file_size") + private Long fileSize; + + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java new file mode 100644 index 0000000..faa318f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +/** + * @Description: 鏂囨。 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_doc_info") +public class DocInfo { + @TableId(value = "doc_id") + private String docId; + + @TableField(value = "doc_name") + private String docName; + @TableField(value = "doc_alias") + private String docAlias; + @TableField(value = "doc_code") + private String docCode; + @TableField(value = "doc_suffix") + private String docSuffix; + @TableField(value = "doc_status") + private Integer docStatus; + @TableField(value = "publish_file_id") + private String publishFileId; + @TableField(value = "publish_version") + private String publishVersion; + @TableField(value = "description") + private String description; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + + @TableField(exist = false) + private String docClassCode; + @TableField(exist = false) + private Integer pullStatus; + @TableField(exist = false) + private String pullUser; + @TableField(exist = false) + private Integer attributionType; + @TableField(exist = false) + private String attributionId; + @TableField(exist = false) + private String classificationId; + //鍚屾鐘舵�� 1 鏈悓姝� 2 宸插悓姝� + @TableField(exist = false) + private Integer syncStatus; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocRelative.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocRelative.java new file mode 100644 index 0000000..7118a96 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocRelative.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_doc_relative") +public class DocRelative { + @TableId(value = "id") + private String id; + @TableField(value = "doc_id") + private String docId; + @TableField(value = "classification_id") + private String classificationId; + @TableField(value = "attribution_type") + private Integer attributionType; + @TableField(value = "attribution_id") + private String attributionId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/FileOperate.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/FileOperate.java new file mode 100644 index 0000000..23daf78 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/FileOperate.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.entity; + + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_file_operate") +public class FileOperate { + @TableId(value = "operate_id") + private String operateId; + @TableField(value = "doc_id") + private String docId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java new file mode 100644 index 0000000..b957c54 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_menu") +public class Menu implements Serializable { + @TableId + private String menuId; + private String permCode; + private String menuName; + private String parentId; + private String iconCls; + private String menuUrl; + private Integer priority; + private Integer rankLevel; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java new file mode 100644 index 0000000..344e289 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_menu_button") +public class MenuButton implements Serializable { + @TableId + private String menuButtonId; + private String menuId; + private String buttonId; + private String buttonAlias; + private String buttonUrl; + private String permCode; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java new file mode 100644 index 0000000..2f55cca --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java @@ -0,0 +1,74 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * * @Description: 鏃ュ織琛� + * @author clown + * * @date 2023/12/4 + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_log_info") +public class NcLogInfo implements Serializable { + @TableId + private String id; + /*妯″潡*/ + @Excel(name = "妯″潡",width = 15) + private String moduleInfo; + /** + * 鏃ュ織鍐呭 + */ + @Excel(name = "鏃ュ織鍐呭",width = 15) + private String logContent; + /*鍔熻兘*/ + /** + * 鎿嶄綔绫诲瀷锛� 2娣诲姞锛�3淇敼锛�4鍒犻櫎 7 鍏朵粬锛� + */ + private Integer operateType; + + /** + * 鎿嶄綔绫诲瀷锛� 2娣诲姞锛�3淇敼锛�4鍒犻櫎 7 鍏朵粬锛� + */ + @Excel(name = "鎿嶄綔绫诲瀷",width = 15) + + private transient String operateTypeStr; + + /** + * IP + */ + @Excel(name = "IP",width = 15) + private String ip; + /** + * 璐﹀彿 + */ + @Excel(name = "璐﹀彿",width = 15) + private String userName; + /*濮撳悕*/ + private String nickName; + /** + * 澶囨敞/浠呬慨鏀逛娇鐢ㄥ偍瀛樹慨鏀瑰墠鐨勬暟鎹� + */ + private String remark; + + @Excel(name = "鎿嶄綔鏃堕棿", width = 20,format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + + @Excel(name = "鎿嶄綔浜�",width = 15) + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java new file mode 100644 index 0000000..6780ded --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_object_button") +public class ObjectButton implements Serializable { + @TableId + private String objectButtonId; + private String objectId; + private String buttonId; + private String buttonAlias; + private String buttonUrl; + private String permCode; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java new file mode 100644 index 0000000..079f6a4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_object_button_permission") +public class ObjectButtonPermission { + @TableId + private String permId; + private String roleId; + private String objectId; + private String buttonId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsDepartment.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsDepartment.java new file mode 100644 index 0000000..e433d73 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsDepartment.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_parts_department") +public class PartsDepartment { + @TableId(value = "parts_depart_id") + private String partsDepartId; + @TableField(value = "parts_id") + private String partsId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + + public PartsDepartment(String partsId, String departId){ + this.partsId = partsId; + this.departId = departId; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsInfo.java new file mode 100644 index 0000000..2cd51e1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsInfo.java @@ -0,0 +1,65 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; +/** + * @Description: 闆朵欢 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_parts_info") +public class PartsInfo { + @TableId(value = "parts_id") + private String partsId; + @TableField(value = "parts_name") + private String partsName; + @TableField(value = "product_id") + private String productId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "materiel_code") + private String materielCode; + @TableField(value = "materiel_desp") + private String materielDesp; + @TableField(value = "parts_model") + private String partsModel; + @TableField(value = "parts_scale") + private String partsScale; + @TableField(value = "parts_weight") + private BigDecimal partsWeight; + @TableField(value = "assemble_type") + private Integer assembleType; + @TableField(value = "produce_type") + private Integer produceType; + @TableField(value = "process_type") + private Integer processType; + @TableField(value = "structure_type") + private Integer structureType; + @TableField(value = "parts_code") + private String partsCode; + @TableField(value = "parts_status") + private Integer partsStatus; + @TableField(value = "description") + private String description; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsPermission.java new file mode 100644 index 0000000..bf868c8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PartsPermission.java @@ -0,0 +1,34 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +@Data +@NoArgsConstructor +@TableName(value = "nc_parts_permission") +public class PartsPermission { + @TableId(value = "parts_perm_id") + private String partsPermId; + @TableField(value = "parts_id") + private String partsId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + + public PartsPermission(String partsId, String userId){ + this.partsId = partsId; + this.userId = userId; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java new file mode 100644 index 0000000..01a498e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_permission_stream") +public class PermissionStream { + @TableId(value = "stream_id") + private String streamId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "parts_id") + private String partsId; + @TableField(value = "user_id") + private String userId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessInfo.java new file mode 100644 index 0000000..ebf43fe --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessInfo.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.dnc.entity; + + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +/** + * @Description: 宸ュ簭 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_process_info") +public class ProcessInfo { + @TableId(value = "process_id") + private String processId; + @TableField(value = "process_name") + private String processName; + + + @TableField(value = "description") + private String description; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java new file mode 100644 index 0000000..fe17a8f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_process_stream") +public class ProcessStream { + @TableId(value = "process_id") + private String processId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "component_id") + private String componentId; + @TableField(value = "parts_id") + private String partsId; + @TableField(value = "process_name") + private String processName; + @TableField(value = "process_code") + private String processCode; + @TableField(value = "craft_no") + private String craftNo; + @TableField(value = "craft_version") + private String craftVersion; + @TableField(value = "process_type") + private Integer processType; + @TableField(value = "processing_equipment_model") + private String processingEquipmentModel; + @TableField(value = "processing_equipment_code") + private String processingEquipmentCode; + @TableField(value = "assemble_step") + private String assembleStep; + @TableField(value = "assemble_name") + private String assembleName; + @TableField(value = "description") + private String description; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductDepartment.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductDepartment.java new file mode 100644 index 0000000..80abc0f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductDepartment.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_product_department") +public class ProductDepartment { + @TableId(value = "product_depart_id") + private String productDepartId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductInfo.java new file mode 100644 index 0000000..220b3bd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductInfo.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.dnc.entity; + + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +/** + * @Description: 浜у搧 + * @author clown + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_product_info") +public class ProductInfo { + @TableId(value = "product_id") + private String productId; + @TableField(value = "product_no") + private String productNo; + @TableField(value = "product_model") + private String productModel; + @TableField(value = "product_name") + private String productName; + @TableField(value = "product_status") + private Integer productStatus; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @TableField(value = "update_time", fill = FieldFill.UPDATE) + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + @TableField(value = "create_user",fill = FieldFill.INSERT) + private String createUser; + @TableField(value = "update_user", fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductPermission.java new file mode 100644 index 0000000..cdca862 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductPermission.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_product_permission") +public class ProductPermission { + @TableId(value = "product_perm_id") + private String productPermId; + @TableField(value = "product_id") + private String productId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/SynchronizedFlag.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/SynchronizedFlag.java new file mode 100644 index 0000000..58ec114 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/SynchronizedFlag.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 鍚屾浠诲姟鐘舵�佽〃 閫氱煡鍚屾绋嬪簭闇�瑕佸紑濮嬪悓姝ヤ换鍔� + * @Author: zhangherong + * @Date: Created in 2020/9/20 0:14 + * @Version: 1.0 + * @Modified By: + */ +@Data +@NoArgsConstructor +@TableName(value = "nc_synchronized_flag") +public class SynchronizedFlag { + //0 闇�瑕佸悓姝ヤ换鍔¤〃 1 涓嶉渶瑕佸悓姝ヤ换鍔¤〃 + @TableId(value = "upload_flag", type = IdType.NONE) + private Integer uploadFlag; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/CustomException.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/CustomException.java new file mode 100644 index 0000000..ce03059 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/CustomException.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.dnc.exception; +import org.jeecg.modules.dnc.response.ResultCode; + +/** + * 鑷畾涔夊紓甯哥被鍨� + * @author Administrator + * @version 1.0 + * @create 2018-09-14 17:28 + **/ +public class CustomException extends RuntimeException { + + //閿欒浠g爜 + ResultCode resultCode; + + public CustomException(ResultCode resultCode){ + super(resultCode.message()); + this.resultCode = resultCode; + } + public ResultCode getResultCode(){ + return resultCode; + } + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCast.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCast.java new file mode 100644 index 0000000..51fec98 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCast.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.dnc.exception; + +import org.jeecg.modules.dnc.response.ResultCode; + +/** + * @author Administrator + * @version 1.0 + * @create 2018-09-14 17:31 + **/ +public class ExceptionCast { + + public static void cast(ResultCode resultCode){ + throw new CustomException(resultCode); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCatch.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCatch.java new file mode 100644 index 0000000..fe7f99e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/exception/ExceptionCatch.java @@ -0,0 +1,77 @@ +package org.jeecg.modules.dnc.exception; + +import com.google.common.collect.ImmutableMap; +import org.jeecg.modules.dnc.response.AuthCode; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.response.ResultCode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.HttpClientErrorException; + +import java.nio.file.AccessDeniedException; + +/** + * 缁熶竴寮傚父鎹曡幏绫� + * @author Administrator + * @version 1.0 + * @create 2018-09-14 17:32 + **/ +@ControllerAdvice//鎺у埗鍣ㄥ寮� +public class ExceptionCatch { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionCatch.class); + + //瀹氫箟map锛岄厤缃紓甯哥被鍨嬫墍瀵瑰簲鐨勯敊璇唬鐮� + private static ImmutableMap<Class<? extends Throwable>,ResultCode> EXCEPTIONS; + //瀹氫箟map鐨刡uilder瀵硅薄锛屽幓鏋勫缓ImmutableMap + protected static ImmutableMap.Builder<Class<? extends Throwable>,ResultCode> builder = ImmutableMap.builder(); + + //鎹曡幏CustomException姝ょ被寮傚父 + @ExceptionHandler(CustomException.class) + @ResponseBody + public ResponseResult customException(CustomException customException){ + //璁板綍鏃ュ織 + LOGGER.error("catch exception:{}",customException.getMessage()); + ResultCode resultCode = customException.getResultCode(); + return new ResponseResult(resultCode); + } + //鎹曡幏Exception姝ょ被寮傚父 + @ExceptionHandler(Exception.class) + @ResponseBody + public ResponseResult exception(Exception exception){ + //璁板綍鏃ュ織 + LOGGER.error("catch exception:{}",exception.getMessage()); + //exception.printStackTrace(); + if(EXCEPTIONS == null){ + EXCEPTIONS = builder.build();//EXCEPTIONS鏋勫缓鎴愬姛 + } + //浠嶦XCEPTIONS涓壘寮傚父绫诲瀷鎵�瀵瑰簲鐨勯敊璇唬鐮侊紝濡傛灉鎵惧埌浜嗗皢閿欒浠g爜鍝嶅簲缁欑敤鎴凤紝濡傛灉鎵句笉鍒扮粰鐢ㄦ埛鍝嶅簲99999寮傚父 + ResultCode resultCode = EXCEPTIONS.get(exception.getClass()); + if(resultCode !=null){ + return new ResponseResult(resultCode); + }else{ + if(exception.getMessage().startsWith("401")) { + return new ResponseResult(AuthCode.AUTH_CREDENTIAL_ERROR); + }else if(exception.getMessage().startsWith("400")) { + return new ResponseResult(AuthCode.AUTH_CREDENTIAL_ERROR); + } + //杩斿洖99999寮傚父 + return new ResponseResult(CommonCode.SERVER_ERROR); + } + + + } + + static { + //瀹氫箟寮傚父绫诲瀷鎵�瀵瑰簲鐨勯敊璇唬鐮� + builder.put(HttpMessageNotReadableException.class,CommonCode.INVALID_PARAM); + builder.put(AccessDeniedException.class, CommonCode.UNAUTHORISE); + builder.put(HttpClientErrorException.BadRequest.class, AuthCode.AUTH_CREDENTIAL_ERROR); + + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java new file mode 100644 index 0000000..c88dbb8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.dnc.ext; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.jeecg.modules.dnc.entity.Menu; + +import java.util.List; + +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class MenuExt extends Menu { + private List<MenuExt> childList; + + public boolean hasChild() { + boolean b = true; + if(this.getChildList() == null || this.getChildList().size() < 1) { + b = false; + } + return b; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/NcTxtFilePathInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/NcTxtFilePathInfo.java new file mode 100644 index 0000000..1d81bc4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/NcTxtFilePathInfo.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.dnc.ext; + +import lombok.Data; + +/** + * @author clown + * * @date 2023/12/14 + */ +@Data +public class NcTxtFilePathInfo { + /*txt 鏂囦欢鍚嶇О*/ + private String fileTxtName; + /*NC鏂囦欢鍚嶇О*/ + private String fileNcName; + /*鍘熸枃浠跺悕绉�*/ + private String origFileName; + /*鍚庣紑*/ + private String origFileSuffix; + /*鏂囦欢淇濆瓨璺緞*/ + private String filePath; + /*璁惧缂栧彿*/ + private String equipmentId; + /*绫诲瀷 1 鏂板 2 鍒犻櫎*/ + private Integer fileAddOrDelete; + /*鏂囦欢澶у皬*/ + private String fileSize; + + @Override + public String toString() { + return "{" + + "fileTxtName:'" + fileTxtName + '\'' + + ", fileNcName:'" + fileNcName + '\'' + + ", origFileName:'" + origFileName + '\'' + + ", origFileSuffix:'" + origFileSuffix + '\'' + + ", filePath:'" + filePath + '\'' + + ", equipmentId:'" + equipmentId + '\'' + + ", fileAddOrDelete:" + fileAddOrDelete + + '}'; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java new file mode 100644 index 0000000..43b49d1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.Button; + +import java.util.List; + +public interface ButtonMapper extends BaseMapper<Button> { + + /** + * 鑾峰彇绯荤粺鎸夐挳鐨勬潈闄� + * @return + */ + List<Button> getButtonPerms(@Param("userId") String userId); + + /** + * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勮彍鍗曟搷浣滄潈闄� + * @param userId + * @return + */ + List<Button> getMenuButtonPerms(@Param("userId") String userId, @Param("menuUrl") String menuUrl); + + /** + * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勫璞℃搷浣滄潈闄� + * @param userId + * @return + */ + List<Button> getObjectButtonPerms(@Param("userId") String userId, @Param("objectPerm") String objectPerm); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java new file mode 100644 index 0000000..326bd26 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ButtonPermission; + +public interface ButtonPermissionMapper extends BaseMapper<ButtonPermission> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java new file mode 100644 index 0000000..9f1803d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ComponentDepartment; +import org.jeecg.modules.dnc.ucenter.Department; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ComponentDepartmentMapper extends BaseMapper<ComponentDepartment> { + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param componentId + * @return + */ + List<Department> getDepartPermsByComponentId(@Param("componentId") String componentId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬 + * @param componentId + * @return + */ + List<Department> getDepartNonPermsByComponentId(@Param("componentId") String componentId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentInfoMapper.java new file mode 100644 index 0000000..482ab76 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentInfoMapper.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import org.jeecg.modules.dnc.dto.ComponentExt; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.ComponentInfo; + +import java.util.List; + +public interface ComponentInfoMapper extends BaseMapper<ComponentInfo> { + /** + * 鑾峰彇鎵�鏈夌殑閮ㄤ欢鐖跺瓙鍏崇郴 + * @return + */ + List<ComponentExt> findExtAll(); + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇閮ㄤ欢淇℃伅 + * @param userId + * @return + */ + List<ComponentExt> getByUserPerms(@Param("userId") String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇閮ㄤ欢淇℃伅 鍚戜笂鏌ヨ鐖� + * @param userId + * @return + */ + List<ComponentExt> getByUserPermsAs(@Param("userId") String userId); + /** + * 鏍规嵁鐖惰妭鐐规煡璇㈡墍鏈夊瓙鑺傜偣鏁版嵁 + * @return + */ + List<ComponentExt> findByParentId(@Param("parentId") String parentId); + /** + * 鏍规嵁鐢ㄦ埛id鍙婄埗鑺傜偣id鑾峰彇閮ㄤ欢淇℃伅 + * @return + */ + List<ComponentExt> getByParentIdAndUserPerms(@Param("parentId") String parentId, @Param("userId") String userId); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentPermissionMapper.java new file mode 100644 index 0000000..ec53e80 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentPermissionMapper.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ComponentPermission; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ComponentPermissionMapper extends BaseMapper<ComponentPermission> { + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param componentId + * @return + */ + List<UserDepartExt> getUserPermsByComponentId(@Param("componentId") String componentId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param componentId + * @return + */ + List<SysUser> getUserNonPermsByComponentId(@Param("componentId") String componentId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartApproveUserMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartApproveUserMapper.java new file mode 100644 index 0000000..7833861 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartApproveUserMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.dto.DepartApproveUser; + +public interface DepartApproveUserMapper extends BaseMapper<DepartApproveUser> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentMapper.java new file mode 100644 index 0000000..0601b9c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentMapper.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.dto.DepartmentExt; +import org.jeecg.modules.dnc.ucenter.Department; + +import java.util.List; + +public interface DepartmentMapper extends BaseMapper<Department> { + /** + * 鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param userId + * @return + */ + List<Department> getUserNonPermDepart(@Param("userId") String userId); + + /** + * 鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param userId + * @return + */ + List<Department> getUserPermDepart(@Param("userId") String userId); + + /** + * 鑾峰彇閮ㄩ棬鍒楄〃 鐖跺瓙鍏崇郴 + * @return + */ + List<DepartmentExt> findExtAll(); + + /** + * 鏍规嵁鐖惰妭鐐规煡鎵惧瓙鑺傜偣 + * @param parentId + * @return + */ + List<DepartmentExt> findByParentId(@Param("parentId") String parentId); + + /** + * 鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜� + * @param departId + * @return + */ + List<SysUser> getUserNonApproveDepart(@Param("departId") String departId); + + /** + * 鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜� + * @param departId + * @return + */ + List<SysUser> getUserApproveDepart(@Param("departId") String departId); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentUserMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentUserMapper.java new file mode 100644 index 0000000..1fbd004 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DepartmentUserMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.dto.DepartmentUser; + +public interface DepartmentUserMapper extends BaseMapper<DepartmentUser> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceCharactersMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceCharactersMapper.java new file mode 100644 index 0000000..15dd2ff --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceCharactersMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceCharacters; + +public interface DeviceCharactersMapper extends BaseMapper<DeviceCharacters> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupDepartMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupDepartMapper.java new file mode 100644 index 0000000..9a29ac2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupDepartMapper.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceGroupDepart; +import org.jeecg.modules.dnc.ucenter.Department; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DeviceGroupDepartMapper extends BaseMapper<DeviceGroupDepart> { + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param groupId + * @return + */ + List<Department> getDepartPermsByGroupId(@Param("groupId") String groupId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param groupId + * @return + */ + List<Department> getDepartNonPermsByGroupId(@Param("groupId") String groupId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupMapper.java new file mode 100644 index 0000000..1a66d14 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupMapper.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceGroup; +import org.jeecg.modules.dnc.dto.DeviceGroupExt; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DeviceGroupMapper extends BaseMapper<DeviceGroup> { + /** + * 鑾峰彇鎵�鏈夊垎缁勪俊鎭� 鐖跺瓙鍏崇郴 + * @return + */ + List<DeviceGroupExt> findExtAll(); + + /** + * 鑾峰彇鎵�鏈夊垎缁勪俊鎭� 鐖跺瓙鍏崇郴 + * @return + */ + List<DeviceGroupExt> findExtByDeparts(@Param("departIds") List<String> departIds); + + /** + * 鏍规嵁鐖惰妭鐐硅幏鍙栧瓙鑺傜偣涓嬬殑鏁版嵁 + * @param parentId + * @return + */ + List<DeviceGroupExt> findByParentId(@Param("parentId") String parentId); + + /** + * 鑾峰彇鐢ㄦ埛鎺堟潈鍏宠仈鐨勮澶囧垎缁� + * @param userId + * @return + */ + List<DeviceGroupExt> getByUserPerms(@Param("userId") String userId); + + /** + * 鑾峰彇鐢ㄦ埛鎺堟潈鍏宠仈鐨勮澶囧垎缁� 鍚戜笂鏌ヨ鐖� + * @param userId + * @return + */ + List<DeviceGroupExt> getByUserPermsAs(@Param("userId") String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupPermissionMapper.java new file mode 100644 index 0000000..188452d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceGroupPermissionMapper.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceGroupPermission; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DeviceGroupPermissionMapper extends BaseMapper<DeviceGroupPermission> { + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param groupId + * @return + */ + List<UserDepartExt> getUserPermsByGroupId(@Param("groupId") String groupId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param groupId + * @return + */ + List<SysUser> getUserNonPermsByGroupId(@Param("groupId") String groupId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceInfoMapper.java new file mode 100644 index 0000000..b6099fc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceInfoMapper.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DeviceInfoMapper extends BaseMapper<DeviceInfo> { + /** + * 鑾峰彇鐢ㄦ埛涓嬬殑鎵�鏈夋潈闄愯澶� + * @param userId + * @return + */ + List<DeviceInfo> getDeviceByUserPermed(@Param("userId") String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionMapper.java new file mode 100644 index 0000000..1589d27 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionMapper.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.entity.DevicePermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; + +import java.util.List; + +public interface DevicePermissionMapper extends BaseMapper<DevicePermission> { + /** + * 鑾峰彇璁惧宸插垎閰嶇殑鐢ㄦ埛 + * @param deviceId + * @return + */ + List<UserDepartExt> getUserPermsByDeviceId(String deviceId); + /** + * 鑾峰彇璁惧鏈垎閰嶇殑鐢ㄦ埛 + * @param deviceId + * @return + */ + List<SysUser> getUserNonPermsByDeviceId(String deviceId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionStreamMapper.java new file mode 100644 index 0000000..bd5e80c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DevicePermissionStreamMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DevicePermissionStream; + +public interface DevicePermissionStreamMapper extends BaseMapper<DevicePermissionStream> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java new file mode 100644 index 0000000..8ab732a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.DncPassLog; + +/** + * @author clown + * * @date 2023/11/29 + */ +public interface DncPassLogMapper extends BaseMapper<DncPassLog> { + /** + * 鏌ヨ鏌愪竴澶╂渶鍚庝竴鏉¤褰� + * @param dayTime + * @return + */ + DncPassLog findDateTimeDay(@Param("dayTime")String dayTime); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocClassificationMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocClassificationMapper.java new file mode 100644 index 0000000..ecb82b8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocClassificationMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DocClassification; + +public interface DocClassificationMapper extends BaseMapper<DocClassification> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocFileMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocFileMapper.java new file mode 100644 index 0000000..88a9c7d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocFileMapper.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DocFile; +import org.apache.ibatis.annotations.Param; + +public interface DocFileMapper extends BaseMapper<DocFile> { + /** + * 鏍规嵁鏂囦欢鐨勭粦瀹氱被鍨嬪拰缁戝畾id鍒犻櫎鏂囨。涓嬬殑鎵�鏈夋枃浠朵俊鎭� + * @param attrType + * @param attrId + * @return + */ + int deleteByDocAttr(@Param("attrType") Integer attrType, @Param("attrId") String attrId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocInfoMapper.java new file mode 100644 index 0000000..66abe79 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocInfoMapper.java @@ -0,0 +1,69 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DocInfoMapper extends BaseMapper<DocInfo> { + + /** + * 鍏宠仈鎿嶄綔淇℃伅 鑾峰彇鏂囨。鍑哄簱鐘舵�� + * @param wrapper + * @return + */ + IPage<DocInfo> findDocExtList(IPage<DocInfo> page, @Param(Constants.WRAPPER) Wrapper<DocInfo> wrapper); + + /** + * 鍏宠仈鎿嶄綔淇℃伅 鑾峰彇鏂囨。鍑哄簱鐘舵�� 闈炲垎椤垫煡璇� + * @param wrapper + * @return + */ + List<DocInfo> findDocExtList(@Param(Constants.WRAPPER) Wrapper<DocInfo> wrapper); + + /** + * 鍏宠仈鎿嶄綔淇℃伅 鑾峰彇鏂囨。鍑哄簱鐘舵��,鍚屾鐘舵�� + * @param wrapper + * @return + */ + IPage<DocInfo> findDeviceDocExtList(IPage<DocInfo> page, @Param(Constants.WRAPPER) Wrapper<DocInfo> wrapper); + + + /** + * 鏍规嵁鏂囨。鍚嶇О/缁戝畾绫诲瀷鏌ユ壘鍞竴鐨勬枃妗d俊鎭� + * @param docName + * @param attrType + * @param attrId + * @return + */ + List<DocInfo> findByAttrAndDocName(@Param("docName") String docName, @Param("attrType") Integer attrType, @Param("attrId") String attrId); + + + /** + * 鏍规嵁鏂囨。鐨勭粦瀹氱被鍨嬪拰缁戝畾id鍒犻櫎鏂囨。涓嬬殑鎵�鏈夋枃浠朵俊鎭� + * @param attrType + * @param attrId + * @return + */ + int deleteByDocAttr(@Param("attrType") Integer attrType, @Param("attrId") String attrId); + + /** + * + * @param docId + * @param attrId + * @param attrType + * @return + */ + List<DocInfo> getByDocAttrAndDocId(@Param("docId") String docId, @Param("attrType") Integer attrType, @Param("attrId") String attrId); + + /** + * + * @param docId + * @return + */ + List<DocInfo> getByDocId(@Param("docId") String docId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java new file mode 100644 index 0000000..79ae672 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.entity.DocRelative; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DocRelativeMapper extends BaseMapper<DocRelative> { + /** + * 鑾峰彇鏂囨。鐨勫叧鑱旇澶� + * @param docId + * @return + */ + List<DeviceInfo> findDeviceByDocId(@Param("docId") String docId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/FileOperateMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/FileOperateMapper.java new file mode 100644 index 0000000..ea2d2c7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/FileOperateMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.FileOperate; + +public interface FileOperateMapper extends BaseMapper<FileOperate> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java new file mode 100644 index 0000000..4d58416 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.MenuButton; + +public interface MenuButtonMapper extends BaseMapper<MenuButton> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java new file mode 100644 index 0000000..1475067 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.Menu; +import org.jeecg.modules.dnc.ext.MenuExt; + +import java.util.List; + +public interface MenuMapper extends BaseMapper<Menu> { + + List<Menu> findByUserId(@Param(Constants.WRAPPER) Wrapper<Menu> wrapper); + + List<MenuExt> findByParentId(@Param("parentId") String parentId); + + List<MenuExt> findExtAll(); + + List<MenuExt> findExtAllBySingleSelect(); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java new file mode 100644 index 0000000..9202b4d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java @@ -0,0 +1,12 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.NcLogInfo; + +/** + * * @Description: 鏃ュ織琛� + * @author clown + * * @date 2023/12/4 + */ +public interface NcLogInfoMapper extends BaseMapper<NcLogInfo> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java new file mode 100644 index 0000000..99e85dd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ObjectButton; + +public interface ObjectButtonMapper extends BaseMapper<ObjectButton> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java new file mode 100644 index 0000000..939ce2d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ObjectButtonPermission; + +public interface ObjectButtonPermissionMapper extends BaseMapper<ObjectButtonPermission> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java new file mode 100644 index 0000000..635e016 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.PartsDepartment; +import org.jeecg.modules.dnc.ucenter.Department; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface PartsDepartmentMapper extends BaseMapper<PartsDepartment> { + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param partsId + * @return + */ + List<Department> getDepartPermsByPartsId(@Param("partsId") String partsId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param partsId + * @return + */ + List<Department> getDepartNonPermsByProductId(@Param("partsId") String partsId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsInfoMapper.java new file mode 100644 index 0000000..63ade13 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsInfoMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.PartsInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface PartsInfoMapper extends BaseMapper<PartsInfo> { + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勯浂浠朵俊鎭� + * @param userId + * @return + */ + List<PartsInfo> getByUserPerms(@Param("userId") String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsPermissionMapper.java new file mode 100644 index 0000000..5acd1fd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsPermissionMapper.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.PartsPermission; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface PartsPermissionMapper extends BaseMapper<PartsPermission> { + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param partsId + * @return + */ + List<UserDepartExt> getUserPermsByProductId(@Param("partsId") String partsId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param partsId + * @return + */ + List<SysUser> getUserNonPermsByProductId(@Param("partsId") String partsId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java new file mode 100644 index 0000000..662c7f4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.PermissionStream; + +public interface PermissionStreamMapper extends BaseMapper<PermissionStream> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessInfoMapper.java new file mode 100644 index 0000000..39acb98 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessInfoMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProcessInfo; + +public interface ProcessInfoMapper extends BaseMapper<ProcessInfo> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java new file mode 100644 index 0000000..b89ef08 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProcessStream; + +public interface ProcessStreamMapper extends BaseMapper<ProcessStream> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java new file mode 100644 index 0000000..1317340 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProductDepartment; +import org.jeecg.modules.dnc.ucenter.Department; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ProductDepartmentMapper extends BaseMapper<ProductDepartment> { + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param productId + * @return + */ + List<Department> getDepartPermsByProductId(@Param("productId") String productId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param productId + * @return + */ + List<Department> getDepartNonPermsByProductId(@Param("productId") String productId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductInfoMapper.java new file mode 100644 index 0000000..d7e1d6b --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductInfoMapper.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProductInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ProductInfoMapper extends BaseMapper<ProductInfo> { + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鐢ㄦ埛鐨勪骇鍝佹暟鎹� + * @param userId + * @return + */ + List<ProductInfo> getByUserPerms(@Param("userId") String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductPermissionMapper.java new file mode 100644 index 0000000..df1bccb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductPermissionMapper.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProductPermission; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ProductPermissionMapper extends BaseMapper<ProductPermission> { + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param productId + * @return + */ + List<UserDepartExt> getUserPermsByProductId(@Param("productId") String productId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param productId + * @return + */ + List<SysUser> getUserNonPermsByProductId(@Param("productId") String productId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/SynchronizedFlagMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/SynchronizedFlagMapper.java new file mode 100644 index 0000000..6002573 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/SynchronizedFlagMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.SynchronizedFlag; + +/** + * @Description: TODO + * @Author: zhangherong + * @Date: Created in 2020/9/20 9:18 + * @Version: 1.0 + * @Modified By: + */ +public interface SynchronizedFlagMapper extends BaseMapper<SynchronizedFlag> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml new file mode 100644 index 0000000..3c68622 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" ?> + <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ButtonMapper"> + <select id="getButtonPerms" parameterType="String" resultType="org.jeecg.modules.dnc.entity.Button"> + select distinct b.button_id + , b.button_perm + , b.button_name + , b.button_icon + from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=1 and delete_flag=0) b + inner join sys_button_permission p on b.button_id=p.button_id + inner join sys_role r on p.role_id=r.id + inner join sys_user_role u + on u.role_id=r.id + where u.user_id=#{userId} + </select> + + + <select id="getMenuButtonPerms" parameterType="java.util.Map" resultType="org.jeecg.modules.dnc.entity.Button"> + select distinct b.button_id + , b.button_perm + , b.button_name + , b.button_icon + , mb.button_alias + , mb.button_url + , mb.perm_code + from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=2 and delete_flag=0) b + inner join sys_menu_button mb on b.button_id=mb.button_id + inner join (select menu_id from sys_menu where menu_url=#{menuUrl}) m on mb.menu_id=m.menu_id + inner join sys_menu_button_permission mbp on mb.menu_id=mbp.menu_id and mb.button_id=mbp.button_id + inner join sys_role r on mbp.role_id=r.id + inner join sys_user_role u + on u.role_id=r.id + where u.user_id=#{userId} + </select> + + <select id="getObjectButtonPerms" parameterType="java.util.Map" resultType="org.jeecg.modules.dnc.entity.Button"> + select distinct b.button_id + , b.button_perm + , b.button_name + , b.button_icon + , ob.button_alias + , ob.button_url + , ob.perm_code + from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=2 and delete_flag=0) b + inner join sys_object_button ob on b.button_id=ob.button_id + inner join (select object_id from sys_object where object_perm=#{objectPerm}) o on ob.object_id=o.object_id + inner join sys_object_button_permission obp on ob.object_id=obp.object_id and ob.button_id=obp.button_id + inner join sys_role r on obp.role_id=r.role_id + inner join sys_user_role u + on u.role_id=r.role_id + where u.user_id=#{userId} + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml new file mode 100644 index 0000000..2e30489 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> + <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ComponentDepartmentMapper"> + <select id="getDepartPermsByComponentId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + inner join + (select depart_id from nc_component_department where component_id=#{componentId}) p + on u.depart_id=p.depart_id + </select> + + <select id="getDepartNonPermsByComponentId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + where u.depart_id not in (select depart_id from nc_component_department where component_id=#{componentId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml new file mode 100644 index 0000000..86ba7b2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ComponentInfoMapper"> + + <!-- + 1銆乵ybatis鑷姩寮�鍚┘宄版爣璇嗚浆鎹� menu_name 鑷姩杞负menuName + 2銆佸疄浣撶被濡傛灉涓烘墿灞曠被鍨嬶紝闇�瑕佸姞鍏d鏍囩 鏍囪瘑id瀛楁绫� 涓嶇劧id瀵瑰簲鐨勫瓧娈垫棤娉曡祴鍊� + 3銆佸绾у叧鑱旇鍙ユ槸鍒嗗紑鏌ヨ鐨� 鏁版嵁閲忓ぇ鐨勬儏鍐典笅鎬ц兘浣庝笅 + 4銆佸鏋滅‘瀹氱骇鏍� 鍙互浣跨敤绾ц仈鏌ヨ涓�娆℃煡璇� 渚嬪瓙锛� + --> + <resultMap id="componentExtBaseMap" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <collection column="component_id" property="children" select="findByParentId"> + </collection> + </resultMap> + + <resultMap id="componentExtPermsMap" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <result column="user_id" property="userId" /> + <association property="parent" column="{id=parent_id}" select="findById"> + </association> + <collection column="{parentId=component_id, userId=user_id}" property="children" + javaType="ArrayList" ofType="org.jeecg.modules.dnc.dto.ComponentExt" select="getByParentIdAndUserPerms"> + <id column="component_id" property="componentId" /> + <result column="user_id" property="userId" /> + </collection> + </resultMap> + + <resultMap id="componentExtPermsMapAs" type="org.jeecg.modules.dnc.dto.ComponentExt"> + <id column="component_id" property="componentId" /> + <association property="parent" column="{id=parent_id}" select="findById"> + </association> + </resultMap> + + <select id="findExtAll" resultMap="componentExtBaseMap"> + select component_id + , parent_id + , product_id + , component_name + , materiel_code + , materiel_desp + , component_model + , component_scale + , component_weight + , rank_level + , assemble_type + , produce_type + , process_type + , structure_type + , component_code + , component_status + , description + from nc_component_info + where rank_level=1 and delete_flag = 0 + </select> + + <select id="findByParentId" resultMap="componentExtBaseMap"> + select component_id + , parent_id + , product_id + , component_name + , materiel_code + , materiel_desp + , component_model + , component_scale + , component_weight + , rank_level + , assemble_type + , produce_type + , process_type + , structure_type + , component_code + , component_status + , description + from nc_component_info + where delete_flag = 0 and parent_id=#{parentId} + </select> + + <select id="getByUserPerms" resultMap="componentExtPermsMap" parameterType="String"> + select comp.component_id + , comp.parent_id + , comp.product_id + , comp.component_name + , comp.materiel_code + , comp.materiel_desp + , comp.component_model + , comp.component_scale + , comp.component_weight + , comp.rank_level + , comp.assemble_type + , comp.produce_type + , comp.process_type + , comp.structure_type + , comp.component_code + , comp.component_status + , comp.description + , s.user_id + from nc_component_info comp + inner join + (select distinct component_id, user_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.component_id=s.component_id + where rank_level=1 and delete_flag = 0 + </select> + + <select id="getByUserPermsAs" resultMap="componentExtPermsMapAs" parameterType="String"> + select comp.component_id + , comp.parent_id + , comp.product_id + , comp.component_name + , comp.materiel_code + , comp.materiel_desp + , comp.component_model + , comp.component_scale + , comp.component_weight + , comp.rank_level + , comp.assemble_type + , comp.produce_type + , comp.process_type + , comp.structure_type + , comp.component_code + , comp.component_status + , comp.description + , comp.create_time + , comp.update_time + , comp.update_user + , comp.create_user + from nc_component_info comp + inner join + (select distinct component_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.component_id=s.component_id + where delete_flag = 0 + </select> + + <select id="getByParentIdAndUserPerms" resultMap="componentExtPermsMap" parameterType="java.util.Map"> + select comp.component_id + , comp.parent_id + , comp.product_id + , comp.component_name + , comp.materiel_code + , comp.materiel_desp + , comp.component_model + , comp.component_scale + , comp.component_weight + , comp.rank_level + , comp.assemble_type + , comp.produce_type + , comp.process_type + , comp.structure_type + , comp.component_code + , comp.component_status + , comp.description + , s.user_id + from nc_component_info comp + inner join + (select distinct component_id, user_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.component_id=s.component_id + where delete_flag = 0 and parent_id=#{parentId} + </select> + + + <select id="findById" parameterType="Map" resultMap="componentExtPermsMapAs"> + select comp.component_id + , comp.parent_id + , comp.product_id + , comp.component_name + , comp.materiel_code + , comp.materiel_desp + , comp.component_model + , comp.component_scale + , comp.component_weight + , comp.rank_level + , comp.assemble_type + , comp.produce_type + , comp.process_type + , comp.structure_type + , comp.component_code + , comp.component_status + , comp.description + from nc_component_info comp + where comp.component_id=#{id} and comp.delete_flag=0 + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentPermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentPermissionMapper.xml new file mode 100644 index 0000000..6692cfe --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentPermissionMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ComponentPermissionMapper"> + <select id="getUserPermsByComponentId" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt" parameterType="String"> + select u.user_id + , u.username + , u.nickname + , u.user_pic + , u.phone_no + , u.email + from sys_user u + inner join + (select user_id from nc_component_permission where component_id=#{componentId}) p + on u.user_id=p.user_id + </select> + + <select id="getUserNonPermsByComponentId" resultType="org.jeecg.modules.system.entity.SysUser" parameterType="String"> + select u.user_id + , u.username + , u.nickname + , u.user_pic + , u.phone_no + , u.email + from sys_user u + where u.user_id not in (select user_id from nc_component_permission where component_id=#{componentId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DepartmentMapper.xml new file mode 100644 index 0000000..df80d9b --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DepartmentMapper.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DepartmentMapper"> + <select id="getUserPermDepart" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select r.depart_id, r.depart_name, r.depart_code, r.description + from + (select depart_id, depart_name, depart_code, description from sys_department where delete_flag=0) r + inner join + (select depart_id from sys_depart_user where user_id=#{userId}) ur + on r.depart_id=ur.depart_id + </select> + + <select id="getUserNonPermDepart" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select r.depart_id, r.depart_name, r.depart_code, r.description + from (select depart_id, depart_name, depart_code, description from sys_department where delete_flag=0) r + where r.depart_id not in + (select depart_id from sys_depart_user where user_id=#{userId}) + </select> + + <resultMap id="deptExtBaseResult" type="org.jeecg.modules.dnc.dto.DepartmentExt"> + <id column="depart_id" property="departId" /> + <collection column="depart_id" property="childList" select="findByParentId"> + </collection> + </resultMap> + + <select id="findExtAll" resultMap="deptExtBaseResult"> + select + depart_id + , depart_name + , depart_code + , parent_id + , priority + , rank_level + , mgr_man + , description + from sys_department + where rank_level= 1 and delete_flag = 0 + </select> + + <select id="findByParentId" resultMap="deptExtBaseResult"> + select + depart_id + , depart_name + , depart_code + , parent_id + , priority + , rank_level + , mgr_man + , description + from sys_department + where delete_flag = 0 and parent_id=#{parentId} + </select> + + <select id="getUserApproveDepart" parameterType="String" resultType="org.jeecg.modules.system.entity.SysUser"> + select u.id + , u.username + , u.realname + , u.password + , u.user_type + , u.status + , u.avatar + , u.birthday + , u.sex + , u.phone + , u.email + from sys_user u + inner join (select user_id from sys_depart_approve_user where depart_id=#{departId}) d + on u.id=d.user_id + </select> + + <select id="getUserNonApproveDepart" parameterType="String" resultType="org.jeecg.modules.system.entity.SysUser"> + select u.id + , u.username + , u.realname + , u.password + , u.user_type + , u.status + , u.avatar + , u.birthday + , u.sex + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from sys_depart_approve_user where depart_id=#{departId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupDepartMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupDepartMapper.xml new file mode 100644 index 0000000..3ac4b8d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupDepartMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DeviceGroupDepartMapper"> + <select id="getDepartPermsByGroupId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + inner join + (select depart_id from nc_device_group_department where group_id=#{groupId}) p + on u.depart_id=p.depart_id + </select> + + <select id="getDepartNonPermsByGroupId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + where u.depart_id not in (select depart_id from nc_device_group_department where group_id=#{groupId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupMapper.xml new file mode 100644 index 0000000..b3ab01a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupMapper.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DeviceGroupMapper"> + <resultMap id="deviceGroupExtBaseResult" type="org.jeecg.modules.dnc.dto.DeviceGroupExt"> + <id column="group_id" property="groupId" /> + <collection column="group_id" property="children" select="findByParentId"> + </collection> + </resultMap> + <select id="findExtAll" resultMap="deviceGroupExtBaseResult"> + select group_id + , group_name + , parent_id + , rank_level + , description + from nc_device_group where rank_level=1 and delete_flag=0 + </select> + <select id="findExtByDeparts" resultMap="deviceGroupExtBaseResult" parameterType="List"> + select dg.group_id + , dg.group_name + , dg.parent_id + , dg.rank_level + , dg.description + from (select * from nc_device_group where rank_level=1 and delete_flag=0) dg + inner join nc_device_group_department dep + on dg.group_id=dep.group_id + where dep.depart_id in + <foreach collection="departIds" item="departId" index="index" open="(" close=")" separator=","> + #{departId} + </foreach> + </select> + + <select id="findByParentId" resultMap="deviceGroupExtBaseResult" parameterType="String"> + select group_id + , group_name + , parent_id + , rank_level + , description + from nc_device_group + where parent_id=#{parentId} and delete_flag=0 + </select> + + <resultMap id="deviceGroupExtPermsMap" type="org.jeecg.modules.dnc.dto.DeviceGroupExt"> + <id column="group_id" property="groupId" /> + <result column="user_id" property="userId" /> + <collection column="{parentId=group_id, userId=user_id}" property="children" + javaType="ArrayList" ofType="org.jeecg.modules.dnc.dto.DeviceGroupExt" select="getByParentIdAndUserPerms"> + <id column="group_id" property="groupId" /> + <result column="user_id" property="userId" /> + </collection> + </resultMap> + + <resultMap id="deviceGroupExtPermsMapAs" type="org.jeecg.modules.dnc.dto.DeviceGroupExt"> + <id column="group_id" property="groupId" /> + <association property="parent" column="{id=parent_id}" select="findById"> + </association> + </resultMap> + + <select id="getByUserPerms" resultMap="deviceGroupExtPermsMap" parameterType="String"> + select comp.group_id + , comp.group_name + , comp.parent_id + , comp.rank_level + , comp.description + , s.user_id + from nc_device_group comp + inner join + (select distinct group_id, user_id from nc_device_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.group_id=s.group_id + where rank_level=1 and delete_flag = 0 + </select> + + <select id="getByUserPermsAs" resultMap="deviceGroupExtPermsMapAs" parameterType="String"> + select comp.group_id + , comp.group_name + , comp.parent_id + , comp.rank_level + , comp.description + , comp.CREATE_TIME + , comp.UPDATE_TIME + , comp.CREATE_USER + , comp.UPDATE_USER + from nc_device_group comp + inner join + (select distinct group_id from nc_device_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.group_id=s.group_id + where delete_flag = 0 + </select> + + <select id="getByParentIdAndUserPerms" resultMap="deviceGroupExtPermsMap" parameterType="java.util.Map"> + select comp.group_id + , comp.group_name + , comp.parent_id + , comp.rank_level + , comp.description + , s.user_id + from nc_device_group comp + inner join + (select distinct group_id, user_id from nc_device_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on comp.group_id=s.group_id + where delete_flag = 0 and parent_id=#{parentId} + </select> + + <select id="findById" resultMap="deviceGroupExtPermsMapAs" parameterType="Map"> + select comp.group_id + , comp.group_name + , comp.parent_id + , comp.rank_level + , comp.description + from nc_device_group comp + where comp.delete_flag = 0 and comp.group_id=#{id} + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupPermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupPermissionMapper.xml new file mode 100644 index 0000000..74aad6f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceGroupPermissionMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DeviceGroupPermissionMapper"> + <select id="getUserPermsByGroupId" parameterType="String" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + inner join + (select user_id from nc_device_group_permission where group_id=#{groupId}) p + on u.id=p.user_id + </select> + + <select id="getUserNonPermsByGroupId" resultType="org.jeecg.modules.system.entity.SysUser" parameterType="String"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from nc_device_group_permission where group_id=#{groupId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceInfoMapper.xml new file mode 100644 index 0000000..0e54ee9 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceInfoMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DeviceInfoMapper"> + <select id="getDeviceByUserPermed" resultType="org.jeecg.modules.dnc.entity.DeviceInfo" parameterType="String"> + select d.device_id + , d.group_id + , d.device_no + , d.device_name + , d.control_system + , d.device_model + , d.link_ip + , d.link_port + , d.depart_id + , d.CREATE_TIME + , d.UPDATE_TIME + , d.CREATE_USER + , d.UPDATE_USER + from nc_device_info d + inner join (select device_id from nc_device_permission where user_id=#{userId}) dp + on d.device_id=dp.device_id + order by d.create_time asc + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DevicePermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DevicePermissionMapper.xml new file mode 100644 index 0000000..a341cce --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DevicePermissionMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DevicePermissionMapper"> + <select id="getUserPermsByDeviceId" parameterType="String" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + inner join + (select user_id from nc_device_permission where device_id=#{deviceId}) p + on u.id=p.user_id + </select> + + <select id="getUserNonPermsByDeviceId" resultType="org.jeecg.modules.system.entity.SysUser" parameterType="String"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from nc_device_permission where device_id=#{deviceId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocFileMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocFileMapper.xml new file mode 100644 index 0000000..77579fe --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocFileMapper.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DocFileMapper"> + <update id="deleteByDocAttr" parameterType="Map"> + update nc_doc_file + set delete_flag=1 + where doc_id in (select distinct doc_id from nc_doc_relative + where attribution_type = #{attrType} and attribution_id=#{attrId}) + </update> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml new file mode 100644 index 0000000..11283e2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DocInfoMapper"> + <select id="findDocExtList" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo"> + select + u.doc_id + ,r.classification_id + , CONCAT(u.doc_name, '.', u.doc_suffix) as doc_name + ,u.doc_alias + ,u.doc_code + ,u.doc_suffix + ,r.attribution_type + ,r.attribution_id + ,u.doc_status + ,u.publish_file_id + ,u.publish_version + ,u.description + ,u.CREATE_TIME + ,u.CREATE_USER + ,u.UPDATE_TIME + ,u.UPDATE_USER + ,(case when o.doc_id is null then 1 else 2 end) as pullStatus + ,s.realname as pullUser + from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0) r + inner join + (select * from nc_doc_info where delete_flag=0) u + on r.doc_id = u.doc_id + left join (select doc_id, create_user from nc_file_operate where delete_flag=0) o + on u.doc_id=o.doc_id + left join sys_user s + on o.create_user=s.id + ${ew.customSqlSegment} + </select> + + + <select id="findDeviceDocExtList" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo"> + select + u.doc_id + ,r.classification_id + , CONCAT(u.doc_name, '.', u.doc_suffix) as doc_name + ,u.doc_alias + ,u.doc_code + ,u.doc_suffix + ,r.attribution_type + ,r.attribution_id + ,u.doc_status + ,u.publish_file_id + ,u.publish_version + ,u.description + ,u.CREATE_TIME + ,u.CREATE_USER + ,u.UPDATE_TIME + ,u.UPDATE_USER + ,(case when o.doc_id is null then 1 else 2 end) as pullStatus + ,s.realname as pullUser + ,(case when t.sync_flag is null then 2 else t.sync_flag end) as syncStatus + from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0) r + inner join + (select * from nc_doc_info where delete_flag=0) u + on r.doc_id = u.doc_id + left join (select doc_id, create_user from nc_file_operate where delete_flag=0) o + on u.doc_id=o.doc_id + left join sys_user s + on o.create_user=s.id + left join (select distinct file_id, doc_id, device_id, sync_flag from nc_to_equipment_lists where delete_flag = 0) t + on u.doc_id=t.doc_id and u.publish_file_id=t.file_id and r.attribution_id=t.device_id + ${ew.customSqlSegment} + </select> + + <select id="findByAttrAndDocName" parameterType="Map" resultType="org.jeecg.modules.dnc.entity.DocInfo"> + select r.doc_id + ,r.attribution_id + ,r.attribution_type + ,r.classification_id + ,d.doc_name + ,d.doc_alias + ,d.doc_code + ,d.doc_suffix + ,d.doc_status + ,d.publish_file_id + ,d.publish_version + ,d.description + from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0 and attribution_type=#{attrType} and attribution_id=#{attrId}) r + inner join nc_doc_info d + on r.doc_id=d.doc_id + where d.delete_flag=0 and d.doc_name=#{docName} + </select> + + <select id="getByDocAttrAndDocId" parameterType="Map" resultType="org.jeecg.modules.dnc.entity.DocInfo"> + select r.doc_id + ,r.attribution_id + ,r.attribution_type + ,r.classification_id + ,d.doc_name + ,d.doc_alias + ,d.doc_code + ,d.doc_suffix + ,d.doc_status + ,d.publish_file_id + ,d.publish_version + ,d.description + from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative + where delete_flag=0 and doc_id=#{docId} and attribution_type=#{attrType} and attribution_id=#{attrId}) r + inner join nc_doc_info d + on r.doc_id=d.doc_id + where d.delete_flag=0 + </select> + + <select id="getByDocId" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo"> + select r.doc_id + ,r.attribution_id + ,r.attribution_type + ,r.classification_id + ,d.doc_name + ,d.doc_alias + ,d.doc_code + ,d.doc_suffix + ,d.doc_status + ,d.publish_file_id + ,d.publish_version + ,d.description + from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative + where delete_flag=0 and doc_id=#{docId}) r + inner join nc_doc_info d + on r.doc_id=d.doc_id + where d.delete_flag=0 + </select> + + + <update id="deleteByDocAttr" parameterType="Map"> + update nc_doc_info + set delete_flag=1 + where doc_id in (select distinct doc_id from nc_doc_relative + where attribution_type = #{attrType} and attribution_id=#{attrId}) + </update> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml new file mode 100644 index 0000000..d281d41 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DocRelativeMapper"> + <select id="findDeviceByDocId" resultType="org.jeecg.modules.dnc.entity.DeviceInfo" parameterType="String"> + select d.device_id + , d.group_id + , d.device_no + , d.device_name + , d.control_system + , d.device_model + , d.link_ip + , d.link_port + , d.depart_id + , g.group_name + , s.depart_name + from nc_device_info d + inner join (select distinct attribution_id from nc_doc_relative where doc_id=#{docId} and delete_flag=0 and attribution_type=4) dp + on d.device_id=dp.attribution_id + inner join nc_device_group g + on d.group_id=g.group_id + inner join sys_department s + on d.depart_id=s.depart_id + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MdcPassLogMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MdcPassLogMapper.xml new file mode 100644 index 0000000..3c74dd4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MdcPassLogMapper.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.DncPassLogMapper"> + <select id="findDateTimeDay" resultType="org.jeecg.modules.dnc.entity.DncPassLog" parameterType="String"> + select top 1 * + from dnc_pass_log u + where day_time = #{dayTime} order by create_time desc + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml new file mode 100644 index 0000000..67a7489 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.MenuMapper"> + <select id="findByUserId" parameterType="String" resultType="org.jeecg.modules.dnc.entity.Menu"> + select m.menu_id + , m.perm_code + , m.menu_name + , m.parent_id + , m.menu_url + , m.icon_cls + , m.priority + , m.rank_level + from sys_menu m left join sys_menu_permission p on m.menu_id=p.menu_id + left join sys_role r on p.role_id=r.id + left join sys_user_role u + on u.role_id=r.role_id + ${ew.customSqlSegment} + </select> + + <!-- + 1銆乵ybatis鑷姩寮�鍚┘宄版爣璇嗚浆鎹� menu_name 鑷姩杞负menuName + 2銆佸疄浣撶被濡傛灉涓烘墿灞曠被鍨嬶紝闇�瑕佸姞鍏d鏍囩 鏍囪瘑id瀛楁绫� 涓嶇劧id瀵瑰簲鐨勫瓧娈垫棤娉曡祴鍊� + 3銆佸绾у叧鑱旇鍙ユ槸鍒嗗紑鏌ヨ鐨� 鏁版嵁閲忓ぇ鐨勬儏鍐典笅鎬ц兘浣庝笅 + 4銆佸鏋滅‘瀹氱骇鏍� 鍙互浣跨敤绾ц仈鏌ヨ涓�娆℃煡璇� 渚嬪瓙锛� + --> + <resultMap id="menuExtBaseResult" type="org.jeecg.modules.dnc.ext.MenuExt"> + <id column="menu_id" property="menuId" /> + <collection column="menu_id" property="childList" select="findByParentId"> + </collection> + </resultMap> + + <resultMap id="menuExtSingleSelectResult" type="org.jeecg.modules.dnc.ext.MenuExt"> + <id column="menu_id_one" property="menuId" /> + <result column="perm_code_one" property="permCode" /> + <result column="menu_name_one" property="menuName" /> + <result column="parent_id_one" property="parentId" /> + <result column="menu_url_one" property="menuUrl" /> + <result column="icon_cls_one" property="iconCls" /> + <result column="priority_one" property="priority" /> + <result column="rank_level_one" property="rankLevel" /> + <collection property="childList" ofType="org.jeecg.modules.dnc.ext.MenuExt"> + <id column="menu_id_two" property="menuId" /> + <result column="perm_code_two" property="permCode" /> + <result column="menu_name_two" property="menuName" /> + <result column="parent_id_two" property="parentId" /> + <result column="menu_url_two" property="menuUrl" /> + <result column="icon_cls_two" property="iconCls" /> + <result column="priority_two" property="priority" /> + <result column="rank_level_two" property="rankLevel" /> + <collection property="childList" ofType="org.jeecg.modules.dnc.ext.MenuExt"> + <id column="menu_id_three" property="menuId" /> + <result column="perm_code_three" property="permCode" /> + <result column="menu_name_three" property="menuName" /> + <result column="parent_id_three" property="parentId" /> + <result column="menu_url_three" property="menuUrl" /> + <result column="icon_cls_three" property="iconCls" /> + <result column="priority_three" property="priority" /> + <result column="rank_level_three" property="rankLevel" /> + </collection> + </collection> + </resultMap> + + <select id="findExtAll" resultMap="menuExtBaseResult"> + select menu_id + , perm_code + , menu_name + , parent_id + , menu_url + , icon_cls + , priority + , rank_level + from sys_menu + where rank_level=1 + </select> + + <select id="findByParentId" resultMap="menuExtBaseResult"> + select menu_id + , perm_code + , menu_name + , parent_id + , menu_url + , icon_cls + , priority + , rank_level + from sys_menu + where parent_id=#{parentId} + </select> + + <select id="findExtAllBySingleSelect" resultMap="menuExtSingleSelectResult"> + select am.menu_id as menu_id_one + , am.perm_code as perm_code_one + , am.menu_name as menu_name_one + , am.parent_id as parent_id_one + , am.menu_url as menu_url_one + , am.icon_cls as icon_cls_one + , am.priority as priority_one + , am.rank_level as rank_level_one + + , bm.menu_id as menu_id_two + , bm.perm_code as perm_code_two + , bm.menu_name as menu_name_two + , bm.parent_id as parent_id_two + , bm.menu_url as menu_url_two + , bm.icon_cls as icon_cls_two + , bm.priority as priority_two + , bm.rank_level as rank_level_two + + , cm.menu_id as menu_id_three + , cm.perm_code as perm_code_three + , cm.menu_name as menu_name_three + , cm.parent_id as parent_id_three + , cm.menu_url as menu_url_three + , cm.icon_cls as icon_cls_three + , cm.priority as priority_three + , cm.rank_level as rank_level_three + from sys_menu am + left join (select * from sys_menu where delete_flag=0) bm + on bm.parent_id = am.menu_id + left join (select * from sys_menu where delete_flag=0) cm + on cm.parent_id = bm.menu_id + where am.rank_level=1 and am.delete_flag=0 + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml new file mode 100644 index 0000000..07b0e30 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.PartsDepartmentMapper"> + <select id="getDepartPermsByPartsId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + inner join + (select depart_id from nc_parts_department where parts_id=#{partsId}) p + on u.depart_id=p.depart_id + </select> + + <select id="getDepartNonPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + where u.depart_id not in (select depart_id from nc_parts_department where parts_id=#{partsId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml new file mode 100644 index 0000000..3dbc029 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.PartsInfoMapper"> + <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.PartsInfo" parameterType="String"> + select p.parts_id + , p.parts_name + , p.product_id + , p.component_id + , p.materiel_code + , p.materiel_desp + , p.parts_model + , p.parts_scale + , p.parts_weight + , p.assemble_type + , p.produce_type + , p.process_type + , p.structure_type + , p.parts_code + , p.parts_status + , p.description + , p.CREATE_TIME + , p.CREATE_USER + , p.UPDATE_TIME + , p.UPDATE_USER + from nc_parts_info p + inner join + (select distinct parts_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on p.parts_id = s.parts_id + where p.delete_flag = 0 + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsPermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsPermissionMapper.xml new file mode 100644 index 0000000..444b0ae --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsPermissionMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.PartsPermissionMapper"> + <select id="getUserPermsByProductId" parameterType="String" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + inner join + (select user_id from nc_parts_permission where parts_id=#{partsId}) p + on u.id=p.user_id + </select> + + <select id="getUserNonPermsByProductId" resultType="org.jeecg.modules.system.entity.SysUser" parameterType="String"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from nc_parts_permission where parts_id=#{partsId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml new file mode 100644 index 0000000..b4e9f99 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProductDepartmentMapper"> + <select id="getDepartPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + inner join + (select depart_id from nc_product_department where product_id=#{productId}) p + on u.depart_id=p.depart_id + </select> + + <select id="getDepartNonPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> + select u.depart_id + , u.depart_name + , u.depart_code + , u.parent_id + , u.rank_level + , u.priority + from sys_department u + where u.depart_id not in (select depart_id from nc_product_department where product_id=#{productId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml new file mode 100644 index 0000000..9c78e54 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProductInfoMapper"> + <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.ProductInfo" parameterType="String"> + select p.product_id + , p.product_no + , p.product_model + , p.product_name + , p.product_status + , p.CREATE_TIME + , p.UPDATE_TIME + , p.create_user + , p.update_user + from nc_product_info p + inner join + (select distinct product_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s + on p.product_id = s.product_id + where p.delete_flag = 0 + order by p.create_time asc + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductPermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductPermissionMapper.xml new file mode 100644 index 0000000..89175c4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductPermissionMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProductPermissionMapper"> + <select id="getUserPermsByProductId" parameterType="String" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + inner join + (select user_id from nc_product_permission where product_id=#{productId}) p + on u.id=p.user_id + </select> + + <select id="getUserNonPermsByProductId" resultType="org.jeecg.modules.system.entity.SysUser" parameterType="String"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from nc_product_permission where product_id=#{productId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ButtonRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ButtonRequest.java new file mode 100644 index 0000000..2a36130 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ButtonRequest.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; + +@Data +public class ButtonRequest { + private String buttonPerm; + private String buttonName; + private Integer buttonType; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DepartmentRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DepartmentRequest.java new file mode 100644 index 0000000..cfc6d37 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DepartmentRequest.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.dnc.request; + + +import lombok.Data; + +@Data +public class DepartmentRequest { + private String departName; + private String departCode; + private String id; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DeviceCharactersRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DeviceCharactersRequest.java new file mode 100644 index 0000000..17c559a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DeviceCharactersRequest.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.dnc.request; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +@Data +public class DeviceCharactersRequest { + + private String deviceNo; + + private String departId; + + private String controlSystem; + + private String characters; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String startTime; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String endTime; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocFileQueryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocFileQueryRequest.java new file mode 100644 index 0000000..b0d0435 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocFileQueryRequest.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.dnc.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@ApiModel(value = "鏂囦欢鏌ヨ鍙傛暟", description = "鏂囦欢鏌ヨ鍙傛暟") +public class DocFileQueryRequest { + @ApiModelProperty(value = "鏂囨。id", notes="鏂囨。id", example = "12344444", required = true) + private String docId; + //鎺掑簭瀛楁 + @ApiModelProperty(value = "闄嶅簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String descStr; + @ApiModelProperty(value = "鍗囧簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoQueryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoQueryRequest.java new file mode 100644 index 0000000..5040b66 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoQueryRequest.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@ApiModel(value = "鏂囨。鏌ヨ鍙傛暟", description = "鏂囨。鏌ヨ鍙傛暟") +public class DocInfoQueryRequest { + @ApiModelProperty(value = "缁戝畾绫诲瀷 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 4 璁惧 5 宸ュ簭", example = "1", required = true) + private Integer attributionType; + @ApiModelProperty(value = "缁戝畾绫诲瀷瀵瑰簲鐨刬d 1 浜у搧id 2 閮ㄤ欢id 3 闆朵欢id 4 璁惧id 5 宸ュ簭id", example = "234324234", required = true) + private String attributionId; + @ApiModelProperty(value = "鏂囨。鍒嗙被 NC=NC鏂囨。 OTHER=鍏朵粬鏂囨。 SEND=璁惧鍙戦�佹枃妗� REC=璁惧鎺ュ彈鏂囨。", example = "NC", required = true) + private String docClassCode; + //鎺掑簭瀛楁 + @ApiModelProperty(value = "闄嶅簭鎺掑垪 鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String descStr; + @ApiModelProperty(value = "鍗囧簭鎺掑垪 鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") + private String ascStr; + @ApiModelProperty(value = "NC鏂囦欢鍚嶇О") + private String docName; + @ApiModelProperty(value = "涓婁紶鏃堕棿寮�濮�") + private String startTime; + @ApiModelProperty(value = "涓婁紶鏃堕棿缁撴潫") + private String endTime; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoUploadRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoUploadRequest.java new file mode 100644 index 0000000..a9299d5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/DocInfoUploadRequest.java @@ -0,0 +1,12 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class DocInfoUploadRequest { + private String attributionId; + private Integer attributionType; + private String docClassCode; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/MultilevelDictionaryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/MultilevelDictionaryRequest.java new file mode 100644 index 0000000..d3acbf7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/MultilevelDictionaryRequest.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; + +@Data +public class MultilevelDictionaryRequest { + private String typeCode; + private String dicCode; + private String dicName; + private String id; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/NcLogInfoRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/NcLogInfoRequest.java new file mode 100644 index 0000000..7788ead --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/NcLogInfoRequest.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * @author clown + * * @date 2023/12/4 + */ +@Data +public class NcLogInfoRequest { + /** + * 鏃ュ織鍐呭 + */ + private String logContent; + /** + * 鎿嶄綔绫诲瀷锛�1鏌ヨ锛�2娣诲姞锛�3淇敼锛�4鍒犻櫎,5瀵煎叆锛�6瀵煎嚭 7 鍏朵粬锛� + */ + private Integer operateType; + /** + * 璐﹀彿 + */ + private String username; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String startTime; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String endTime; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ProcessStreamRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ProcessStreamRequest.java new file mode 100644 index 0000000..0620bf6 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/ProcessStreamRequest.java @@ -0,0 +1,12 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class ProcessStreamRequest { + private String productId; + private String componentId; + private String partsId; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/SingleDictionaryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/SingleDictionaryRequest.java new file mode 100644 index 0000000..12243b1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/SingleDictionaryRequest.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.dnc.request; + +import lombok.Data; + +@Data +public class SingleDictionaryRequest { + private String typeCode; + private String dicCode; + private String dicName; + //鎺掑簭瀛楁 + private String descStr; + private String ascStr; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java new file mode 100644 index 0000000..62e9fef --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java @@ -0,0 +1,67 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ActivitiCode implements ResultCode { + ACT_APPLY_USER_NONE(false,21001,"鐢宠浜轰笉鑳戒负绌猴紒"), + ACT_APPROVE_USERS_NONE(false,21002,"璇峰厛鎸囧畾閮ㄩ棬瀹℃壒浜猴紒"), + ACT_BUSINESS_SAVE_ERROR(false,21003,"鍚姩娴佺▼澶辫触锛岀敵璇风殑涓氬姟鏁版嵁瀛樺湪闂锛�"), + ACT_ASSIGN_DEVICE_NONE(false,21004,"鎸囨淳鐨勮澶囦笉瀛樺湪锛�"), + ACT_NODE_DEPART_NONE(false,21005,"璇峰厛鎸囧畾鑺傜偣鎵�灞為儴闂紒"), + ACT_USER_NOT_PERM(false,21006,"鐢ㄦ埛娌℃湁鎸囨淳璇ユ枃浠剁殑鏉冮檺锛�"), + ACT_APPLY_ERROR(false,21007,"鍚姩娴佺▼澶辫触锛�"), + ACT_PROC_INST_ERROR(false, 21008, "鑾峰彇娴佺▼瀹炰緥澶辫触锛�"), + ACT_BUSINESS_DETAIL_ERROR(false, 21009, "鑾峰彇瀹℃壒鏁版嵁澶辫触锛�"), + ACT_STATUS_ERROR(false, 21010, "瀹℃壒鐘舵�侀潪娉�"), + ACT_TASK_ERROR(false, 21011, "鑾峰彇浠诲姟澶辫触锛岃浠诲姟宸茶瀹℃壒锛�"), + ACT_APPROVE_ERROR(false, 21012, "瀹℃壒澶辫触锛�"), + ACT_FILE_ERROR(false, 21013, "鎸囨淳鐨勬枃浠朵笉瀛樺湪锛�"), + ACT_DOC_ID_NONE(false, 21014, "鏂囨。缂栧彿涓嶅瓨鍦紒"), + ACT_DOC_ERROR(false,21015,"鍚姩娴佺▼澶辫触锛屾枃妗d俊鎭敊璇紒"), + ACT_DEVICE_DOC_ERROR(false,21016,"鍚姩娴佺▼澶辫触锛岃澶囧凡瀛樺湪璇ユ枃妗o紒"), + ACT_DOC_ERROR_DELEVE(false,21017,"鍚姩娴佺▼澶辫触锛岄噸澶嶆暟鎹垹闄ゅけ璐ワ紒"), + ACT_DEVICE_DOC_FILELABLE(false,21016,"瀵嗘爣绯荤粺寮傚父,锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ActivitiCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ActivitiCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ActivitiCode> builder = ImmutableMap.builder(); + for (ActivitiCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiDefinitionCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiDefinitionCode.java new file mode 100644 index 0000000..434ea72 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiDefinitionCode.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ActivitiDefinitionCode implements ResultCode { + DEF_IS_EXIST(false,21101,"璇ラ儴闂ㄥ凡閰嶇疆锛�"), + DEF_NOT_EXIST(false,21102,"閰嶇疆涓嶅瓨鍦紒"), + DEF_DEPART_NONE(false,21103,"鎸囧畾鐨勯儴闂ㄤ笉瀛樺湪锛�"), + DEF_USER_NONE(false,21104,"鎸囧畾鐨勭敤鎴蜂笉瀛樺湪锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ActivitiDefinitionCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ActivitiDefinitionCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ActivitiDefinitionCode> builder = ImmutableMap.builder(); + for (ActivitiDefinitionCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/AuthCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/AuthCode.java new file mode 100644 index 0000000..b739acf --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/AuthCode.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +/** + * Created by admin on 2018/3/5. + */ +@ToString +public enum AuthCode implements ResultCode { + AUTH_USERNAME_NONE(false,23001,"璇疯緭鍏ヨ处鍙凤紒"), + AUTH_PASSWORD_NONE(false,23002,"璇疯緭鍏ュ瘑鐮侊紒"), + AUTH_VERIFY_CODE_NONE(false,23003,"璇疯緭鍏ラ獙璇佺爜锛�"), + AUTH_ACCOUNT_NOT_EXIST(false,23004,"璐﹀彿涓嶅瓨鍦紒"), + AUTH_CREDENTIAL_ERROR(false,23005,"璐﹀彿鎴栧瘑鐮侀敊璇紒"), + AUTH_LOGIN_ERROR(false,23006,"鐧婚檰杩囩▼鍑虹幇寮傚父璇峰皾璇曢噸鏂版搷浣滐紒"), + AUTH_LOGIN_APPLY_TOKEN_FAIL(false,23007,"鐢宠浠ょ墝澶辫触锛�"), + AUTH_LOGIN_TOKEN_SAVE_FAIL(false,23008,"瀛樺偍浠ょ墝澶辫触锛�"), + AUTH_LOGOUT_FAIL(false,23009,"閫�鍑哄け璐ワ紒"), + AUTH_USER_NONE_PERMISSION(false,23010,"鐢ㄦ埛娌℃湁浠讳綍鍔熻兘鐨勬潈闄愶紝鏃犳硶鐧婚檰锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private AuthCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, AuthCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, AuthCode> builder = ImmutableMap.builder(); + for (AuthCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ButtonCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ButtonCode.java new file mode 100644 index 0000000..edb2a4e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ButtonCode.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ButtonCode implements ResultCode { + BTN_PERM_CODE_NONE(false,23401,"璇疯緭鍏ユ潈闄愮爜锛�"), + BTN_NAME_NONE(false,23402,"璇疯緭鍏ュ悕绉帮紒"), + BTN_PERM_CODE_EXIST(false,23403,"鏉冮檺鐮佸凡瀛樺湪锛�"), + BTN_TYPE_NONE(false,23404,"璇烽�夋嫨鎸夐挳绫诲瀷锛�"), + BTN_ID_NONE(false, 23405, "鎸夐挳ID涓嶈兘涓虹┖锛�"), + BTN_NOT_EXIST(false, 23406, "鎸夐挳涓嶅瓨鍦紒"), + BTN_ROLE_EXIST(false, 23407, "鎸夐挳鏈夊叧鑱旂殑瑙掕壊淇℃伅锛�"), + BTN_MENU_EXIST(false, 23408, "鎸夐挳鏈夊叧鑱旂殑鑿滃崟淇℃伅锛�"), + BTN_OBJ_EXIST(false, 23409, "鎸夐挳鏈夊叧鑱旂殑瀵硅薄淇℃伅锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ButtonCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ButtonCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ButtonCode> builder = ImmutableMap.builder(); + for (ButtonCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonCode.java new file mode 100644 index 0000000..70efd3f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonCode.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.dnc.response; + +import lombok.ToString; + +@ToString +public enum CommonCode implements ResultCode { + SUCCESS(true,10000,"鎿嶄綔鎴愬姛锛�"), + UNAUTHENTICATED(false,10001,"姝ゆ搷浣滈渶瑕佺櫥闄嗙郴缁燂紒"), + UNAUTHORISE(false,10002,"鏉冮檺涓嶈冻锛屾棤鏉冩搷浣滐紒"), + INVALID_PARAM(false,10003,"闈炴硶鍙傛暟锛�"), + INVALID_PAGE(false, 10004, "閿欒鐨勫垎椤靛弬鏁帮紒"), + FAIL(false,11111,"鎿嶄綔澶辫触锛�"), + LICENSE_DEVICE_POINT_LARGE(false, 88886, "璁惧鐐逛綅宸茶秴鍑洪檺鍒�"), + LICENSE_WILL_EXPIRED(false, 88887, "license搴忓彿鍗冲皢杩囨湡锛岃鑱旂郴绠$悊鍛橈紒"), + LICENSE_ERROR(false, 88888, "license搴忓彿鏃犳晥锛�"), + LICENSE_EXPIRED(false, 88889, "license搴忓彿杩囨湡锛�"), + SERVER_ERROR(false,99999,"鎶辨瓑锛岀郴缁熺箒蹇欙紝璇风◢鍚庨噸璇曪紒"); + + //鎿嶄綔鏄惁鎴愬姛 + boolean success; + //鎿嶄綔浠g爜 + int code; + //鎻愮ず淇℃伅 + String message; + private CommonCode(boolean success,int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + + @Override + public boolean success() { + return success; + } + @Override + public int code() { + return code; + } + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonGenericTree.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonGenericTree.java new file mode 100644 index 0000000..689e077 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonGenericTree.java @@ -0,0 +1,142 @@ +package org.jeecg.modules.dnc.response; + +import cn.hutool.core.util.StrUtil; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +@Data +@NoArgsConstructor +public class CommonGenericTree<T> { + private String id; // 瑕佹樉绀虹殑鑺傜偣鐨処D + private String label; // 瑕佹樉绀虹殑瀛愯妭鐐圭殑鍚嶇О + private String iconClass; // 鑺傜偣鐨勫浘鏍� + private String parentId; // 鐖惰妭鐐圭殑ID + private List<CommonGenericTree> children; // 瀛╁瓙鑺傜偣鐨凩ist + private String rField; //缁戝畾鎵╁睍榧犳�� + /** + * 鑺傜偣鍒嗙被 + * 浜у搧鏍戝瀷 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * 璁惧鏍戝舰 1 璁惧鍒嗙粍 2 璁惧 + */ + private Integer type; + private T entity; + /** + * 鏄惁涓哄瓙鑺傜偣 + */ + private Boolean leaf = false; + + // 娣诲姞瀛愯妭鐐圭殑鏂规硶 + public CommonGenericTree<T> addChildren(CommonGenericTree node) { + if (this.children == null) { + this.children = new ArrayList<CommonGenericTree>(); + } + this.children.add(node); + return node; + } + + public boolean hasChildren() { + boolean bu = true; + if(getChildren() == null || getChildren().isEmpty()) { + bu = false; + return bu; + } + return bu; + } + + /** + * 鑾峰彇鏍戠殑鎵�鏈夊彾瀛愯妭鐐� + * @param tree + * @return + */ + public static Map<String, CommonGenericTree> getLeafNode(Map<String, CommonGenericTree> map, CommonGenericTree tree) { + if(tree == null) + return map; + if(tree.hasChildren()) { + List<CommonGenericTree> childrenNodes = tree.getChildren(); + for(CommonGenericTree child : childrenNodes) { + map = getLeafNode(map, child); + } + map.put(tree.getId(), tree); + }else { + map.put(tree.getId(), tree); + } + return map; + } + + public static Map<String, CommonGenericTree> getAllParentNode(Map<String, CommonGenericTree> map, Map<String, CommonGenericTree> allNode, CommonGenericTree childNode) { + if(childNode == null || allNode == null || allNode.isEmpty()) + return map; + String parentId = childNode.getParentId(); + if(StrUtil.isEmpty(parentId)) { + CommonGenericTree parent; + if(allNode.containsKey(parentId)) { + parent = allNode.get(childNode.getParentId()); + map.put(childNode.getId(), childNode); + map = getAllParentNode(map, allNode, parent); + }else { + map.put(childNode.getId(), childNode); + } + + }else { + map.put(childNode.getId(), childNode); + } + return map; + } + + public static CommonGenericTree copyToNewTree(CommonGenericTree oldNode, CommonGenericTree newNode, Map<String, CommonGenericTree> map) { + if(oldNode == null || map == null || map.isEmpty()) + return newNode; + if(oldNode.hasChildren()) { + List<CommonGenericTree> childrenNodes = oldNode.getChildren(); + CommonGenericTree newChild; + for(CommonGenericTree child : childrenNodes) { + if(map.containsKey(child.getId())) { + newChild = new CommonGenericTree(); + newChild.copyNoneChild(child); + newNode.addChildren(newChild); + copyToNewTree(child, newChild, map); + } + } + } + return newNode; + + } + + public static List<CommonGenericTree> convertMapToList(Map<String, CommonGenericTree> map) { + if(map == null || map.isEmpty()) + return Collections.emptyList(); + List<CommonGenericTree> tree = new ArrayList<>(); + CommonGenericTree node; + CommonGenericTree parent; + for(Map.Entry<String, CommonGenericTree> en : map.entrySet()) { + node = en.getValue(); + if(node != null) { + if(node.getParentId() == null) { + tree.add(en.getValue()); + }else { + if(map.containsKey(node.getParentId())) { + parent = map.get(node.getParentId()); + parent.addChildren(node); + } + } + } + } + return tree; + } + + public CommonGenericTree copyNoneChild(CommonGenericTree oldNode) { + this.id = oldNode.getId(); + this.label = oldNode.getLabel(); + this.type = oldNode.getType(); + this.iconClass = oldNode.getIconClass(); + this.entity = (T)oldNode.getEntity(); + this.rField = oldNode.getRField(); + this.parentId = oldNode.getParentId(); + return this; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonJsonTree.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonJsonTree.java new file mode 100644 index 0000000..71d69f3 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/CommonJsonTree.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by Administrator on 2019/9/6. + */ +@Data +@NoArgsConstructor +public class CommonJsonTree { + private String id; // 瑕佹樉绀虹殑鑺傜偣鐨処D + private String label; // 瑕佹樉绀虹殑瀛愯妭鐐圭殑鍚嶇О + private String iconClass; // 鑺傜偣鐨勫浘鏍� + private String parentId; // 鐖惰妭鐐圭殑ID + private List<CommonJsonTree> children; // 瀛╁瓙鑺傜偣鐨凩ist + private String rField; //缁戝畾鎵╁睍榧犳�� + private boolean checked = false; //鏄惁閫変腑 + private boolean disabled = false; //鏄惁琚鐢� + /** + * 鑺傜偣鍒嗙被 + * 浜у搧鏍戝瀷 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * 璁惧鏍戝舰 1 璁惧鍒嗙粍 2 璁惧 + */ + private Integer type; + + // 娣诲姞瀛愯妭鐐圭殑鏂规硶 + public CommonJsonTree addChildren(CommonJsonTree node) { + if (this.children == null) { + this.children = new ArrayList<CommonJsonTree>(); + } + this.children.add(node); + return node; + } + + public boolean hasChildren() { + boolean bu = true; + if(getChildren() == null || getChildren().isEmpty()) { + bu = false; + return bu; + } + return bu; + } + + /** + * 鑾峰彇鏍戠殑鎵�鏈夊彾瀛愯妭鐐� + * @param tree + * @return + */ + public static Map<String, CommonJsonTree> getLeafNode(Map<String, CommonJsonTree> map, CommonJsonTree tree) { + if(tree == null) + return map; + if(tree.hasChildren()) { + List<CommonJsonTree> childrenNodes = tree.getChildren(); + for(CommonJsonTree child : childrenNodes) { + map = getLeafNode(map, child); + } + map.put(tree.getId(), tree); + }else { + map.put(tree.getId(), tree); + } + return map; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComparisonFilesResponse.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComparisonFilesResponse.java new file mode 100644 index 0000000..7e005e5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComparisonFilesResponse.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; + +import java.util.List; + +@Data +public class ComparisonFilesResponse { + private List<String> first; + private List<String> second; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComponentInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComponentInfoCode.java new file mode 100644 index 0000000..416e805 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ComponentInfoCode.java @@ -0,0 +1,65 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ComponentInfoCode implements ResultCode { + COMPONENT_PARENT_NOT_EXIST(false, 25101, "鎸囧畾鐨勭埗鑺傜偣涓嶅瓨鍦紒"), + COMPONENT_NAME_NONE(false, 25102, "璇疯緭鍏ラ儴浠跺悕绉帮紒"), + COMPONENT_PRODUCT_NONE(false, 25103, "璇烽�夋嫨浜у搧锛�"), + COMPONENT_NOT_EXIST(false, 25104, "閮ㄤ欢涓嶅瓨鍦紒"), + COMPONENT_USER_NOT_PERM(false, 25105, "娌℃湁璇ラ儴浠剁殑鏉冮檺锛�"), + COMPONENT_DELETE_ERROR(false, 25106, "鍒犻櫎澶辫触锛�"), + COMPONENT_DELETE_PERM_NONE(false, 25107, "娌℃湁鍒犻櫎鏉冮檺锛�"), + COMPONENT_CHILD_EXIST(false, 25108, "閮ㄤ欢瀛樺湪瀛愰儴浠讹紒"), + COMPONENT_PARTS_EXIST(false, 25109, "閮ㄤ欢鏈夊叧鑱旂殑闆朵欢淇℃伅锛�"), + COMPONENT_PROCESS_EXIST(false, 25110, "閮ㄤ欢鏈夊叧鑱旂殑宸ュ簭淇℃伅锛�"), + COMPONENT_CODE_NONE(false, 25111, "璇疯緭鍏ラ儴浠朵唬鍙凤紒"), + COMPONENT_IS_EXIST(false, 25112, "閮ㄤ欢宸插瓨鍦紒"), + COMPONENT_PN_NOT_VALID(false, 25113, "PN鐮佷笉鍚堟硶锛�"), + COMPONENT_PN_NOT_EXIST(false, 25114, "涓嶅瓨鍦ㄨPN鐮佸搴旂殑閮ㄤ欢鎴栭浂浠讹紒"), + COMPONENT_PN_NOT_ONLY(false, 25115, "PN鐮佷笉鍞竴锛�"), + COMPONENT_USER_NONE(false,25016,"閮ㄤ欢鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ComponentInfoCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ComponentInfoCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ComponentInfoCode> builder = ImmutableMap.builder(); + for (ComponentInfoCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DataResponseResult.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DataResponseResult.java new file mode 100644 index 0000000..12fe05a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DataResponseResult.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * 杩斿洖鍗曚釜瀵硅薄缁撴灉 + * @param <T> + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class DataResponseResult<T> extends ResponseResult { + private T data; + public DataResponseResult(ResultCode resultCode, T t) { + super(resultCode); + this.data = t; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DepartmentCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DepartmentCode.java new file mode 100644 index 0000000..24fcbe7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DepartmentCode.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum DepartmentCode implements ResultCode { + DEPART_CODE_NONE(false,23501,"璇疯緭鍏ラ儴闂ㄧ紪鐮侊紒"), + DEPART_NAME_NONE(false,23502,"璇疯緭鍏ラ儴闂ㄥ悕绉帮紒"), + DEPART_IS_EXIST(false,23503,"璇ラ儴闂ㄥ凡瀛樺湪锛�"), + DEPART_NOT_EXIST(false,23504,"鎸囧畾鐨勯儴闂ㄤ笉瀛樺湪锛�"), + DEPART_PARENT_NOT_EXIST(false,23505,"鎸囧畾鐨勭埗鑺傜偣涓嶅瓨鍦紒"), + DEPART_SUN_EXIST(false,23506,"瀛樺湪瀛愯妭鐐瑰瓨鍦紒"), + DEPART_APPROVE_USER_ERROR(false,23507,"鎸囧畾鐨勭敤鎴蜂俊鎭潪娉曪紒"), + DEPART_USER_EXIST(false,23508,"閮ㄩ棬鏈夊叧鑱旂殑鐢ㄦ埛淇℃伅锛�"), + DEPART_PRODUCT_EXIST(false,23509,"閮ㄩ棬鏈夊叧鑱旂殑浜у搧鏍戜俊鎭紒"), + DEPART_DEVICE_EXIST(false,23510,"閮ㄩ棬鏈夊叧鑱旂殑璁惧鏍戜俊鎭紒"), + DEPART_ACT_EXIST(false,23511,"閮ㄩ棬鏈夊叧鑱旂殑娴佺▼瀹氫箟淇℃伅锛�"); + + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private DepartmentCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, DepartmentCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, DepartmentCode> builder = ImmutableMap.builder(); + for (DepartmentCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceCode.java new file mode 100644 index 0000000..66d5418 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceCode.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum DeviceCode implements ResultCode { + DEVICE_NAME_NONE(false,25301,"璇疯緭鍏ヨ澶囧悕绉帮紒"), + DEVICE_DEPART_NONE(false,25302,"璇烽�夋嫨鎵�灞為儴闂紒"), + DEVICE_GROUP_NONE(false,25303,"璇烽�夋嫨鎵�灞炲垎缁勶紒"), + DEVICE_NOT_EXIST(false,25304,"璁惧涓嶅瓨鍦紒"), + DEVICE_USER_NOT_PERM(false,25005,"娌℃湁璇ヨ澶囨潈闄愶紒"), + DEVICE_SAVE_ERROR(false,25006,"淇濆瓨璁惧淇℃伅澶辫触锛�"), + DEVICE_USER_PERM_NONE(false,25007,"鑷冲皯闇�瑕佹寚瀹氫竴涓敤鎴凤紒"), + DEVICE_DEPART_PERM_NONE(false,25008,"鑷冲皯闇�瑕佹寚瀹氫竴涓儴闂紒"), + DEVICE_USER_PERM_ERROR(false, 25009, "鏉冮檺鍒嗛厤淇濆瓨澶辫触锛�"), + DEVICE_NO_NONE(false,25310,"璇疯緭鍏ヨ澶囩紪鍙凤紒"), + DEVICE_IS_EXIST(false,25311,"璁惧宸插瓨鍦紒"), + DEVICE_USER_NONE(false, 25512, "璁惧鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�");; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private DeviceCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, DeviceCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, DeviceCode> builder = ImmutableMap.builder(); + for (DeviceCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceGroupCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceGroupCode.java new file mode 100644 index 0000000..ba778a7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DeviceGroupCode.java @@ -0,0 +1,59 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum DeviceGroupCode implements ResultCode { + DEVICE_GROUP_NAME(false,25501,"璇疯緭鍏ュ垎缁勫悕绉帮紒"), + DEVICE_GROUP_EXIST(false, 25502, "鍒嗙粍宸插瓨鍦紒"), + DEVICE_GROUP_PARENT_NOT_EXIST(false, 25503, "鎸囧畾鐨勭埗鍒嗙粍涓嶅瓨鍦紒"), + DEVICE_GROUP_NOT_EXIST(false, 25504, "鍒嗙粍涓嶅瓨鍦紒"), + DEVICE_GROUP_SAVE_ERROR(false, 25505, "鍒嗙粍淇濆瓨澶辫触锛�"), + DEVICE_GROUP_NOT_PERM(false, 25506, "娌℃湁璇ュ垎缁勭殑璁块棶鏉冮檺锛�"), + DEVICE_GROUP_PERM_ERROR(false, 25507, "鏉冮檺鍒嗛厤澶辫触"), + DEVICE_GROUP_CHILD_EXIST(false, 25508, "瀛樺湪瀛愬垎缁�"), + DEVICE_GROUP_DEVICE_EXIST(false, 25509, "鍒嗙粍鏈夊叧鑱旂殑璁惧淇℃伅"), + DEVICE_GROUP_USER_NONE(false, 25510, "鍒嗙粍鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private DeviceGroupCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, DeviceGroupCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, DeviceGroupCode> builder = ImmutableMap.builder(); + for (DeviceGroupCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DocumentCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DocumentCode.java new file mode 100644 index 0000000..5b7ef8e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DocumentCode.java @@ -0,0 +1,75 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum DocumentCode implements ResultCode { + DOCUMENT_NAME_NONE(false,25301,"璇疯緭鍏ユ枃妗e悕绉帮紒"), + DOC_CLASS_CODE_NONE(false,25302,"璇疯緭鍏ユ枃妗e垎绫荤紪鐮侊紒"), + DOC_CLASS_NAME_NONE(false,25303,"璇疯緭鍏ユ枃妗e垎绫诲悕绉帮紒"), + DOC_CLASS_EXIST(false,25304,"璇ユ枃妗e垎绫诲凡瀛樺湪锛�"), + DOC_ATTRIBUTE_ERROR(false, 25305, "鏂囨。鎸囧畾鐩爣涓嶆槑纭紒"), + DOC_CLASS_ERROR(false, 25306, "鏂囨。鍒嗙被涓嶅瓨鍦紒"), + DOC_SUFFIX_ERROR(false, 25307, "鏂囦欢鍚庣紑閿欒锛�"), + DOC_FILE_DOC_ID_NONE(false, 25308, "鎸囧畾鐨勬枃妗g紪鍙蜂笉瀛樺湪锛�"), + DOC_FILE_SIZE_NONE(false, 25309, "鏂囦欢涓嶈兘涓虹┖锛�"), + DOC_FILE_PATH_NONE(false, 25310, "淇濆瓨璺緞涓嶈兘涓虹┖锛�"), + DOC_NOT_EXIST(false, 25311, "鏂囨。涓嶅瓨鍦紒"), + DOC_HAS_FILES(false, 25312, "鏂囨。涓嬫湁鍏宠仈鐨勬枃浠朵笉鑳藉垹闄わ紒"), + DOC_PUBLISH_FILE_NONE(false, 25313, "璇峰厛鎸囧畾鏈夋晥鐗堟湰锛�"), + DOC_PUBLISH_FILE_NOT_EXIST(false, 25314, "鎸囧畾鐗堟湰鐨勬枃浠朵笉瀛樺湪锛�"), + DOC_IS_OPERATING(false, 25315, "鏂囨。姝e湪鍑哄簱涓紒"), + DOC_OPERATE_FAIL(false, 25316, "鏂囨。鍑哄簱澶辫触锛�"), + DOC_OPERATE_PUSH_FAIL(false, 25317, "璇峰厛鍑哄簱鍐嶅叆搴撴垨闈炴湰浜烘搷浣滄棤娉曞叆搴擄紒"), + DOC_PUBLISH_ERROR(false, 25318, "璇ユ枃妗f棤娉曞彂甯冿紒"), + DOC_REPUBLISH_ERROR(false, 25319, "璇ユ枃妗f棤娉曢噸鍙戝竷锛�"), + DOC_PIGEONHOLE_ERROR(false, 25320, "璇ユ枃妗f棤娉曞綊妗o紒"), + DOC_CANCEL_PULL_ERROR(false, 25321, "鍙栨秷鍑哄簱澶辫触锛屾枃妗f湭鍑哄簱鎴栭潪鏈汉鎿嶄綔锛�"), + DOC_FILE_ERROR(false, 25322, "鏂囨。鐗堟湰涓嶅瓨鍦紒"), + DOC_UPLOAD_ERROR(false, 25323, "鏂囨。瀵煎叆澶辫触锛�"), + DOC_DEL_ERROR(false, 25324, "璇ユ枃妗f棤娉曞垹闄わ紒"), + DOC_IS_EXIST(false, 25325, "璇ユ枃妗e凡瀛樺湪锛�"), + DOC_DEVICE_EXIST(false, 25326, "璇ユ枃妗f湁璁惧鍏宠仈淇℃伅锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private DocumentCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, DocumentCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, DocumentCode> builder = ImmutableMap.builder(); + for (DocumentCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/MenuCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/MenuCode.java new file mode 100644 index 0000000..1930241 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/MenuCode.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum MenuCode implements ResultCode { + MENU_PERM_CODE_NONE(false,23101,"璇疯緭鍏ユ潈闄愮爜锛�"), + MENU_NAME_NONE(false,23102,"璇疯緭鍏ュ悕绉帮紒"), + MENU_URL_NONE(false,23103,"璇疯緭鍏ヨ彍鍗曡烦杞湴鍧�锛�"), + MENU_PERM_CODE_EXIST(false,23104,"鏉冮檺鐮佸凡瀛樺湪锛�"), + MENU_PARENT_NOT_EXIST(false,23105,"鎸囧畾鐨勭埗鑿滃崟涓嶅瓨鍦紒"), + MENU_ID_NONE(false,23106,"璇烽�夋嫨鑿滃崟锛�"), + MENU_NOT_EXIST(false,23107,"鑿滃崟涓嶅瓨鍦紒"), + MENU_SUN_CODE_EXIST(false,23108,"鑿滃崟鏈夊叧鑱旂殑瀛愯彍鍗曪紒"), + MENU_ROLE_EXIST(false,23109,"鑿滃崟鏈夊叧鑱旂殑瑙掕壊鏁版嵁锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private MenuCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, MenuCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, MenuCode> builder = ImmutableMap.builder(); + for (MenuCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ObjectCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ObjectCode.java new file mode 100644 index 0000000..56740cb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ObjectCode.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ObjectCode implements ResultCode { + OBJ_PERM_CODE_NONE(false,23301,"璇疯緭鍏ユ潈闄愮爜锛�"), + OBJ_NAME_NONE(false,23302,"璇疯緭鍏ュ悕绉帮紒"), + OBJ_PERM_CODE_EXIST(false,23303,"鏉冮檺鐮佸凡瀛樺湪锛�"), + OBJ_ID_NONE(false, 23304, "璇烽�夋嫨瀵硅薄"), + OBJ_NOT_EXIST(false,23305,"瀵硅薄涓嶅瓨鍦紝鏃犳硶鎸囧畾鎸夐挳锛�"), + OBJ_ID_NOT_EXIST(false,23306,"瀵硅薄涓嶅瓨鍦紒"), + OBJ_ROLE_EXIST(false,23307,"瀵硅薄鏈夊叧鑱旂殑瑙掕壊淇℃伅锛�"); + + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ObjectCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ObjectCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ObjectCode> builder = ImmutableMap.builder(); + for (ObjectCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java new file mode 100644 index 0000000..905032a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java @@ -0,0 +1,59 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum PartsInfoCode implements ResultCode { + PARTS_NAME_NONE(false,25201,"璇疯緭鍏ラ浂浠跺悕绉帮紒"), + PARTS_PRODUCT_NONE(false,25202,"璇疯緭閫夋嫨浜у搧锛�"), + PARTS_COMPONENT_NONE(false,25203,"璇疯緭閫夋嫨閮ㄤ欢锛�"), + PARTS_NOT_EXIST(false,25204,"闆朵欢涓嶅瓨鍦紒"), + PARTS_USER_NOT_PERM(false,25205,"娌℃湁璇ラ浂浠剁殑鏉冮檺锛�"), + PARTS_DELETE_ERROR(false,25206,"鍒犻櫎闆朵欢澶辫触锛�"), + PARTS_PROCESS_EXIST(false,25207,"闆朵欢鏈夊叧鑱旂殑宸ュ簭淇℃伅锛�"), + PARTS_CODE_NONE(false,25208,"璇疯緭鍏ラ浂浠朵唬鍙凤紒"), + PARTS_IS_EXIST(false,25209,"闆朵欢宸插瓨鍦紒"), + PARTS_USER_NONE(false,25210,"闆朵欢鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private PartsInfoCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, PartsInfoCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, PartsInfoCode> builder = ImmutableMap.builder(); + for (PartsInfoCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java new file mode 100644 index 0000000..e8323e5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ProcessInfoCode implements ResultCode { + PROCESS_NAME_NONE(false,25401,"璇疯緭鍏ュ伐搴忓悕绉帮紒"), + PROCESS_PRODUCT_NONE(false,25402,"鏃犳晥鐨勪骇鍝侊紒"), + PROCESS_COMPONENT_NONE(false,25403,"鏃犳晥鐨勯儴浠讹紒"), + PROCESS_PARTS_NONE(false,25404,"鏃犳晥鐨勯浂浠讹紒"), + PROCESS_NOT_EXIST(false,25405,"鏃犳晥鐨勯浂浠讹紒"), + PROCESS_HAS_DOC(false,25406,"宸ュ簭涓嬫湁鍏宠仈鐨勬枃妗o紝鏃犳硶鍒犻櫎锛�"), + PROCESS_CODE_NONE(false,25407,"璇疯緭鍏ュ伐搴忓彿锛�"), + PROCESS_IS_EXIST(false,25408,"璇ュ伐搴忓凡瀛樺湪锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ProcessInfoCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ProcessInfoCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ProcessInfoCode> builder = ImmutableMap.builder(); + for (ProcessInfoCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProductInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProductInfoCode.java new file mode 100644 index 0000000..be905d9 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProductInfoCode.java @@ -0,0 +1,64 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum ProductInfoCode implements ResultCode { + PRODUCT_NAME_NONE(false,25001,"璇疯緭鍏ヤ骇鍝佸悕绉帮紒"), + PRODUCT_NOT_EXIST(false,25002,"浜у搧涓嶅瓨鍦紒"), + PRODUCT_USER_NOT_PERM(false,25003,"娌℃湁璇ヤ骇鍝佹潈闄愶紒"), + PRODUCT_USER_PERM_NONE(false,25004,"鑷冲皯闇�瑕佹寚瀹氫竴涓敤鎴凤紒"), + PRODUCT_DEPART_PERM_NONE(false,25005,"鑷冲皯闇�瑕佹寚瀹氫竴涓儴闂紒"), + PRODUCT_DELETE_PERM_NONE(false, 25006, "鏃犳硶鍒犻櫎瀛愯妭鐐癸紒"), + PRODUCT_SAVE_ERROR(false, 25007, "浜у搧淇濆瓨澶辫触锛�"), + PRODUCT_USER_PERM_ERROR(false, 25008, "鏉冮檺鍒嗛厤鐢ㄦ埛鎿嶄綔澶辫触锛�"), + PRODUCT_DEPART_PERM_ERROR(false, 25009, "鏉冮檺鍒嗛厤閮ㄩ棬鎿嶄綔澶辫触锛�"), + PRODUCT_COMPONENT_EXIST(false, 25010, "浜у搧鏈夊叧鑱旂殑閮ㄤ欢鏁版嵁锛�"), + PRODUCT_PARTS_EXIST(false, 25011, "浜у搧鏈夊叧鑱旂殑闆朵欢鏁版嵁锛�"), + PRODUCT_PROCESS_EXIST(false, 25012, "浜у搧鏈夊叧鑱旂殑宸ュ簭鏁版嵁锛�"), + PRODUCT_NO_NONE(false,25013,"璇疯緭鍏ヤ骇鍝佷唬鍙凤紒"), + PRODUCT_IS_EXIST(false,25014,"浜у搧宸插瓨鍦紒"), + PRODUCT_USER_NONE(false,25015,"浜у搧鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private ProductInfoCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, ProductInfoCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, ProductInfoCode> builder = ImmutableMap.builder(); + for (ProductInfoCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryListResponseResult.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryListResponseResult.java new file mode 100644 index 0000000..ffcb014 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryListResponseResult.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * 鍒嗛〉鍝嶅簲缁撴灉 + * @param <T> + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class QueryListResponseResult<T> extends ResponseResult { + + private List<T> list; + + private int total; + + public QueryListResponseResult(ResultCode resultCode,List list){ + super(resultCode); + this.list = list; + this.total = list == null ? 0 : list.size(); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryPageResponseResult.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryPageResponseResult.java new file mode 100644 index 0000000..78e8eed --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/QueryPageResponseResult.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.response; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class QueryPageResponseResult<T> extends ResponseResult { + private IPage<T> page; + + public QueryPageResponseResult(ResultCode resultCode,IPage page){ + super(resultCode); + this.page = page; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/Response.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/Response.java new file mode 100644 index 0000000..51a1c8a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/Response.java @@ -0,0 +1,9 @@ +package org.jeecg.modules.dnc.response; + +/** + * 鍝嶅簲绫诲叕鍛婃帴鍙� + */ +public interface Response { + public static final boolean SUCCESS = true; + public static final int SUCCESS_CODE = 10000; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResponseResult.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResponseResult.java new file mode 100644 index 0000000..d428e46 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResponseResult.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 鍏敤杩斿洖缁撴瀯 + */ +@Data +@NoArgsConstructor +public class ResponseResult implements Response { + + //鎿嶄綔鏄惁鎴愬姛 + boolean success = SUCCESS; + + //鎿嶄綔浠g爜 + int code = SUCCESS_CODE; + + //鎻愮ず淇℃伅 + String message; + + public ResponseResult(ResultCode resultCode){ + this.success = resultCode.success(); + this.code = resultCode.code(); + this.message = resultCode.message(); + } + + public static ResponseResult SUCCESS(){ + return new ResponseResult(CommonCode.SUCCESS); + } + public static ResponseResult FAIL(){ + return new ResponseResult(CommonCode.FAIL); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResultCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResultCode.java new file mode 100644 index 0000000..23e427a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ResultCode.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.dnc.response; + +/** + * 10000-- 閫氱敤閿欒浠g爜 + * 22000-- 濯掕祫閿欒浠g爜 + * 23000-- 鐢ㄦ埛涓績閿欒浠g爜 + * 24000-- cms閿欒浠g爜 + * 25000-- 鏂囦欢绯荤粺 + */ +public interface ResultCode { + //鎿嶄綔鏄惁鎴愬姛,true涓烘垚鍔燂紝false鎿嶄綔澶辫触 + boolean success(); + //鎿嶄綔浠g爜 + int code(); + //鎻愮ず淇℃伅 + String message(); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/RoleCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/RoleCode.java new file mode 100644 index 0000000..831d118 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/RoleCode.java @@ -0,0 +1,56 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +@ToString +public enum RoleCode implements ResultCode { + ROLE_CODE_NONE(false,23201,"璇疯緭鍏ヨ鑹茬紪鐮侊紒"), + ROLE_NAME_NONE(false,23202,"璇疯緭鍏ヨ鑹插悕绉帮紒"), + ROLE_CODE_EXIST(false,23203,"璇ヨ鑹茬紪鐮佸凡瀛樺湪锛�"), + ROLE_ID_NONE(false,23204,"瑙掕壊id涓嶈兘涓虹┖锛�"), + ROLE_NOT_EXIST(false,23205,"瑙掕壊涓嶅瓨鍦紒"), + ROLE_MENU_NONE(false,23206,"鑷冲皯闇�瑕佸垎閰嶄竴涓彍鍗曪紒"), + ROLE_USER_EXIST(false,23207,"瑙掕壊鏈夊叧鑱旂殑鐢ㄦ埛鏁版嵁锛�"),; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private RoleCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, RoleCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, RoleCode> builder = ImmutableMap.builder(); + for (RoleCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/SysLogMessageDto.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/SysLogMessageDto.java new file mode 100644 index 0000000..aba8561 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/SysLogMessageDto.java @@ -0,0 +1,44 @@ +package org.jeecg.modules.dnc.response; + +import lombok.Data; + +/** + * @author clown + * * @date 2023/12/17 + * + * private static final String message="charset=utf-8 logType=閫氱煡 instanceName=瀹炰緥1 taskName=浠诲姟2" + + * " logLevel=鍛婅 objectName=瀵硅薄1 desc=鏄庣粏1 result=鎴愬姛 date=2023-10-30 00:21:00"; + */ +@Data +public class SysLogMessageDto { + private String systemName; + private String datetime; + private String location ; + private String types ; + private String fileNum; + private String fileName; + private String fileSize; + private String address; + private String abstract1; + private String sourceAddress; + private String destination; + private String result; + + @Override + public String toString() { + return "{" + + "systemName=" + systemName + + ", datetime=" + datetime + + ", location=" + location + + ", types=" + types + + ", fileNum=" + fileNum + + ", fileName=" + fileName + + ", fileSize=" + fileSize + + ", address=" + address + + ", abstract=" + abstract1 + + ", sourceAddress=" + sourceAddress + + ", destination=" + destination + + ", result=" + result + + '}'; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/UcenterCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/UcenterCode.java new file mode 100644 index 0000000..21a7096 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/UcenterCode.java @@ -0,0 +1,67 @@ +package org.jeecg.modules.dnc.response; + +import com.google.common.collect.ImmutableMap; +import io.swagger.annotations.ApiModelProperty; +import lombok.ToString; + +/** + * Created by admin on 2018/3/5. + */ +@ToString +public enum UcenterCode implements ResultCode { + UCENTER_USERNAME_NONE(false,23001,"璇疯緭鍏ヨ处鍙凤紒"), + UCENTER_PASSWORD_NONE(false,23002,"璇疯緭鍏ュ瘑鐮侊紒"), + UCENTER_VERIFY_CODE_NONE(false,23003,"璇疯緭鍏ラ獙璇佺爜锛�"), + UCENTER_ACCOUNT_NOT_EXIST(false,23004,"璐﹀彿涓嶅瓨鍦紒"), + UCENTER_CREDENTIAL_ERROR(false,23005,"璐﹀彿鎴栧瘑鐮侀敊璇紒"), + UCENTER_LOGIN_ERROR(false,23006,"鐧婚檰杩囩▼鍑虹幇寮傚父璇峰皾璇曢噸鏂版搷浣滐紒"), + UCENTER_PASSWORD_ERROR(false, 23007, "鍘熷瘑鐮侀敊璇紒"), + UCENTER_USER_ID_NONE(false, 23008, "鐢ㄦ埛ID涓嶈兘涓虹┖锛�"), + UCENTER_USER_NOT_EXIST(false, 23009, "鐢ㄦ埛涓嶅瓨鍦紒"), + UCENTER_USER_EXIST(false, 23010, "鐢ㄦ埛宸插瓨鍦紒"), + UCENTER_ROLE_NONE(false, 23011, "鎸囧畾鐨勮鑹蹭笉鍚堟硶锛�"), + UCENTER_DEPART_NONE(false, 23012, "鎸囧畾鐨勯儴闂ㄤ笉鍚堟硶锛�"), + UCENTER_ACT_EXIST(false, 23013, "鐢ㄦ埛鏈夊叧鑱旂殑娴佺▼瀹℃壒浜猴紒"), + UCENTER_PRODUCT_EXIST(false, 23014, "鐢ㄦ埛鏈夊叧鑱旂殑浜у搧鏍戞潈闄愶紒"), + UCENTER_DEVICE_EXIST(false, 23015, "鐢ㄦ埛鏈夊叧鑱旂殑璁惧鏍戞潈闄愶紒"); + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) + boolean success; + + //鎿嶄綔浠g爜 + @ApiModelProperty(value = "鎿嶄綔浠g爜", example = "22001", required = true) + int code; + //鎻愮ず淇℃伅 + @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) + String message; + private UcenterCode(boolean success, int code, String message){ + this.success = success; + this.code = code; + this.message = message; + } + private static final ImmutableMap<Integer, UcenterCode> CACHE; + + static { + final ImmutableMap.Builder<Integer, UcenterCode> builder = ImmutableMap.builder(); + for (UcenterCode commonCode : values()) { + builder.put(commonCode.code(), commonCode); + } + CACHE = builder.build(); + } + + @Override + public boolean success() { + return success; + } + + @Override + public int code() { + return code; + } + + @Override + public String message() { + return message; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java new file mode 100644 index 0000000..2bc212b --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ButtonPermission; + +import java.util.List; +import java.util.Map; + +public interface IButtonPermissionService extends IService<ButtonPermission> { + /** + * 鏍规嵁瑙掕壊id鍒犻櫎绯荤粺鎸夐挳鏉冮檺 + * @param roleId + * @return + */ + boolean deleteByRoleId(String roleId); + + /** + * 鑾峰彇瑙掕壊鍒嗛厤鐨勭郴缁熸寜閽� + * @param roleId + * @return + */ + Map<String, ButtonPermission> getMapByRoleId(String roleId); + + /** + * 鑾峰彇鎸夐挳鐨勬墍鏈夋潈闄� + * @param buttonId + * @return + */ + List<ButtonPermission> findByButtonId(String buttonId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java new file mode 100644 index 0000000..2c26484 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java @@ -0,0 +1,94 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.entity.Button; +import org.jeecg.modules.dnc.request.ButtonRequest; + +import java.util.List; + +public interface IButtonService extends IService<Button> { + /** + * 鏂板鎸夐挳瀵硅薄 + * @param button + * @return + */ + boolean addButton(Button button); + + /** + * 鏍规嵁鏉冮檺鐮佹煡鎵炬寜閽� + * @param permCode + * @return + */ + Button getByPermCode(String permCode); + + /** + * 鏍规嵁鎸夐挳绫诲瀷鏌ヨ鎸夐挳鍒楄〃 + * @param buttonType + * @return + */ + List<Button> findByButtonType(Integer buttonType); + + /** + * 鍒嗛〉鏌ヨ鎸夐挳 + * @param page + * @param size + * @param buttonRequest + * @return + */ + QueryPageResponseResult<Button> findByPageList(int page, int size, ButtonRequest buttonRequest); + /** + * 鑾峰彇绯荤粺鎸夐挳鐨勬潈闄� + * @return + */ + List<Button> getButtonPerms(String userId); + + /** + * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勮彍鍗曟搷浣滄潈闄� + * @param userId + * @return + */ + List<Button> getMenuButtonPerms(String userId, String menuUrl); + + /** + * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勫璞℃搷浣滄潈闄� + * @param userId + * @return + */ + List<Button> getObjectButtonPerms(String userId, String objectPerm); + + /** + * 缂栬緫 鎸夐挳 + * @param id + * @param button + * @return + */ + boolean editButton(String id,Button button); + + /** + * 鍒犻櫎鎸夐挳 + * @param id + * @return + */ + boolean deleteButtonById(String id); + + /** + * 鏌ヨ瑙掕壊鍒嗛厤鍜屾湭鍒嗛厤鐨勭郴缁熸寜閽� + * @param roleId + * @return + */ + List<Button> findPermsByRoleId(String roleId); + + /** + * 鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽� + * @param menuId + * @return + */ + List<Button> findByMenuId(String menuId); + /** + * 鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽� + * @param objectId + * @return + */ + List<Button> findByObjectId(String objectId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java new file mode 100644 index 0000000..2f43aab --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ComponentDepartment; +import org.jeecg.modules.dnc.ucenter.Department; +import org.springframework.stereotype.Service; + +import java.util.List; +public interface IComponentDepartmentService extends IService<ComponentDepartment> { + /** + * 鏍规嵁閮ㄤ欢id鍒犻櫎閮ㄩ棬鏉冮檺 + * @param componentId + * @return + */ + boolean deleteByComponentId(String componentId); + + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param componentId + * @return + */ + List<Department> getDepartPermsByComponentId(String componentId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬 + * @param componentId + * @return + */ + List<Department> getDepartNonPermsByComponentId(String componentId); + + /** + * 鑾峰彇鍞竴鐨勯儴闂ㄦ潈闄� + * @param componentId + * @param departId + * @return + */ + ComponentDepartment getByComponentIdAndDepartId(String componentId, String departId); + + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺 + * @param componentDepartments + * @return + */ + boolean removeByCollection(List<ComponentDepartment> componentDepartments); + + /** + * 鏌ヨ涓�缁勯儴闂ㄦ潈闄� + * @param componentIds + * @param ids + * @return + */ + List<ComponentDepartment> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> ids); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java new file mode 100644 index 0000000..a6f2e04 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java @@ -0,0 +1,148 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.dto.ComponentExt; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.jeecg.modules.dnc.entity.PermissionStream; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.system.entity.SysUser; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +public interface IComponentInfoService extends IService<ComponentInfo> { + + /** + * 鏂板 + * @param componentInfo + * @return + */ + boolean addComponentInfo(ComponentInfo componentInfo); + + /** + * 缂栬緫 + * @param id + * @param componentInfo + * @return + */ + boolean editComponentInfo(String id ,ComponentInfo componentInfo); + + /** + * 鑾峰彇鎵�鏈夌殑閮ㄤ欢鐖跺瓙鍏崇郴 + * @return + */ + List<ComponentExt> findExtAll(); + + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇閮ㄤ欢淇℃伅 + * @param userId + * @return + */ + List<ComponentExt> getByUserPerms(String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鍜屾煡璇㈡潯浠惰幏鍙栭儴浠朵俊鎭� + * @param userId + * @param queryParam + * @return + */ + List<ComponentInfo> getByUserPerms(String userId, String queryParam); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇閮ㄤ欢淇℃伅 鍚戜笂鏌ヨ鐖� + * @param userId + * @return + */ + List<ComponentExt> getByUserPermsAs(String userId); + + /** + * 鏍规嵁浜у搧id鑾峰彇 + * @param productId + * @return + */ + List<ComponentInfo> getByProductId(String productId); + + /** + * 鏍规嵁浜у搧id鍒犻櫎閮ㄤ欢 + * @param componentInfoList + * @return + */ + boolean deleteCollections(List<ComponentInfo> componentInfoList); + + /** + * 鏍规嵁閮ㄤ欢 + * @param id + * @return + */ + boolean deleteComponentInfo(String id); + + /** + * 鑾峰彇鑺傜偣涓嬬殑鎵�鏈夊瓙鑺傜偣 + * @param componentId + * @return + */ + List<ComponentInfo> getByParentId(String componentId); + + /** + * 鍒嗛厤鐢ㄦ埛鏉冮檺 + * @param componentInfo + * @param userList + * @return + */ + boolean assignAddUser(ComponentInfo componentInfo, Collection<SysUser> userList); + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param componentInfo + * @param userList + * @return + */ + boolean assignRemoveUser(ComponentInfo componentInfo, Collection<SysUser> userList); + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param componentInfo + * @param departmentList + * @return + */ + boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList); + + /** + * 绉婚櫎閮ㄩ棬鏉冮檺 + * @param componentInfo + * @param departmentList + * @return + */ + boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList); + + /** + * 鑾峰彇鍞竴 閮ㄤ欢缂栧彿 + * @param code + * @return + */ + ComponentInfo getByCode(String code); + + /** + * 妫�鏌n鐮佺殑鏈夋晥鎬� + * @param pnCode + * @return + */ + PermissionStream validateComponentOrPartsPnCode(String pnCode); + + /** + * 鏍规嵁浜у搧id鍜岀敤鎴穒d鑾峰彇閮ㄩ棬鍒楄〃 + * @param paramId + * @param userId + * @return + */ + List<ComponentInfo> getByProductIdAndUserId(String paramId, String userId); + + /** + * 鏍规嵁鐖禝d鍜岀敤鎴穒d鑾峰彇閮ㄩ棬鍒楄〃 + * @param parentId + * @param userId + * @return + */ + List<ComponentInfo> getByParentIdAndUserId(String parentId, String userId); +} + + diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentPermissionService.java new file mode 100644 index 0000000..8fdd0d2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentPermissionService.java @@ -0,0 +1,63 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ComponentPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IComponentPermissionService extends IService<ComponentPermission> { + + /** + * 鏍规嵁閮ㄤ欢缂栧彿鍜屼汉鍛樼紪鍙锋煡鎵鹃儴浠舵潈闄� + * @param componentId + * @param userId + * @return + */ + ComponentPermission getByComponentIdAndUserId(String componentId, String userId); + + + /** + * 鏍规嵁閮ㄤ欢id鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param componentId + * @return + */ + boolean deleteByComponentId(String componentId); + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param componentId + * @return + */ + List<UserDepartExt> getUserPermsByComponentId(String componentId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param componentId + * @return + */ + List<SysUser> getUserNonPermsByComponentId(String componentId); + + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param permissionList + * @return + */ + boolean removeByCollection(List<ComponentPermission> permissionList); + + /** + * 鑾峰彇閮ㄤ欢鐢ㄦ埛鏉冮檺 + * @param componentId + * @return + */ + List<ComponentPermission> getByComponentId(String componentId); + + /** + * 鑾峰彇涓�缁勯儴浠跺拰鐢ㄦ埛鐨勬潈闄愭暟鎹� + * @param componentIds + * @param userIds + * @return + */ + List<ComponentPermission> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java new file mode 100644 index 0000000..2f09e2e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.dto.DepartApproveUser; + +import java.util.List; +import java.util.Map; + +public interface IDepartApproveUserService extends IService<DepartApproveUser> { + + /** + * 鏍规嵁閮ㄩ棬id鏌ユ壘瀹℃壒鍊欓�変汉 + * @param departIds + * @return + */ + List<String> getByDepartIds(List<String> departIds); + + /** + * 鑾峰彇閮ㄩ棬鍘熸湁鐨勫鎵逛汉 + * @param departId + * @return + */ + Map<String, DepartApproveUser> getByDepartId(String departId); + + /** + * 鍒犻櫎閮ㄩ棬鐨勫鎵逛汉 + * @param departId + * @return + */ + boolean deleteByDepartId(String departId); + + /** + * 鏌ユ壘鍞竴 + * @param departId + * @param userId + * @return + */ + DepartApproveUser getByDepartIdAndUserId(String departId, String userId); + + /** + * 绉婚櫎涓�缁勬潈闄� + * @param list + * @return + */ + boolean removeByCollection(List<DepartApproveUser> list); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java new file mode 100644 index 0000000..353b914 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java @@ -0,0 +1,119 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.response.CommonJsonTree; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.request.DepartmentRequest; + +import java.util.List; +import java.util.Map; + +public interface IDepartmentService extends IService<Department> { + /** + * 娣诲姞閮ㄩ棬淇℃伅 + * @param department + * @return + */ + boolean addDepartment(Department department); + + /** + * 淇敼閮ㄩ棬 + * @param id + * @param department + * @return + */ + boolean editDepartment(String id,Department department); + + /** + * 鏍规嵁閮ㄩ棬缂栧彿鏌ユ壘閮ㄩ棬 + * @param departCode + * @param departId null 琛ㄧず鍙牴鎹甦epartCode鏌ワ紝 闈瀗ull 琛ㄧず鎺掗櫎璇epartId + * @return + */ + Department getByDepartCode(String departCode, String departId); + + /** + * 鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param userId + * @return + */ + List<Department> getUserNonPermDepart(String userId); + + /** + * 鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param userId + * @return + */ + List<Department> getUserPermDepart(String userId); + + /** + * 鍒嗛〉鏌ヨ + * @param page + * @param size + * @param requestParams + * @return + */ + QueryPageResponseResult<Department> findPageList(int page, int size, DepartmentRequest requestParams); + + /** + * 鍒犻櫎 閮ㄩ棬 + * @param id + * @return + */ + boolean deleteDepartmentById(String id); + + + /** + * 鏍规嵁鐖禝D 鏌ヨ鏁版嵁 + * @param parentId + * @return + */ + List<Department> findSunLint(String parentId); + + /** + * 鑾峰彇鎵�鏈夊垪琛紝鎸夊眰绾� + * @return + */ + List<CommonJsonTree> loadTree(); + + /** + * 鑾峰彇鐢ㄦ埛鎵�鍦ㄧ殑閮ㄩ棬 + * @param userId + * @return + */ + Map<String, Department> getMapByUserId(String userId); + + /** + * 鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜� + * @param departId + * @return + */ + List<SysUser> getUserNonApproveDepart(String departId); + + /** + * 鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜� + * @param departId + * @return + */ + List<SysUser> getUserApproveDepart(String departId); + + /** + * 澧炲姞閮ㄩ棬瀹℃壒浜� + * @param departId + * @param relativeFlag + * @param userIds + * @return + */ + boolean assignAddApproveUser(String departId, Integer relativeFlag, String[] userIds); + + /** + * 绉婚櫎閮ㄩ棬瀹℃壒浜� + * @param departId + * @param relativeFlag + * @param userIds + * @return + */ + boolean assignRemoveApproveUser(String departId, Integer relativeFlag, String[] userIds); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java new file mode 100644 index 0000000..ea4a49f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java @@ -0,0 +1,37 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.dto.DepartmentUser; + +import java.util.List; + +public interface IDepartmentUserService extends IService<DepartmentUser> { + /** + * 鏍规嵁鐢ㄦ埛id鍒犻櫎鐢ㄦ埛鎵�鍦ㄧ殑閮ㄩ棬淇℃伅 + * @param userId + * @return + */ + boolean deleteByUserId(String userId); + + /** + * 绉婚櫎涓�缁勬暟鎹� + * @param departmentUserList + * @return + */ + boolean removeByCollection(List<DepartmentUser> departmentUserList); + + /** + * 鏌ヨ鍞竴 + * @param userId + * @param departId + * @return + */ + DepartmentUser getByUserIdAndDepartId(String userId, String departId); + + /** + * 鑾峰彇閮ㄩ棬涓嬬殑鐢ㄦ埛淇℃伅 + * @param departId + * @return + */ + List<DepartmentUser> findByDepartId(String departId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceCharactersService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceCharactersService.java new file mode 100644 index 0000000..7d4a3f8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceCharactersService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DeviceCharacters; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.request.DeviceCharactersRequest; + +public interface IDeviceCharactersService extends IService<DeviceCharacters> { + + /** + * 鍒嗛〉鏌ヨ + * @param page + * @param size + * @param deviceCharactersRequest + * @return + */ + QueryPageResponseResult<DeviceCharacters> findByPageList(int page, int size, DeviceCharactersRequest deviceCharactersRequest); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java new file mode 100644 index 0000000..557b7f3 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java @@ -0,0 +1,45 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DeviceGroupDepart; +import org.jeecg.modules.dnc.ucenter.Department; + +import java.util.List; + +public interface IDeviceGroupDepartService extends IService<DeviceGroupDepart> { + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param groupId + * @return + */ + List<Department> getDepartPermsByGroupId(String groupId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param groupId + * @return + */ + List<Department> getDepartNonPermsByGroupId(String groupId); + + /** + * 鏍规嵁鍒嗙粍鍜岄儴闂ㄦ煡璇㈠敮涓�鐨勬潈闄愭暟鎹� + * @param groupId + * @param departId + * @return + */ + DeviceGroupDepart getDepartByGroupAndDepartId(String groupId, String departId); + + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺 + * @param departList + * @return + */ + boolean removeByCollection(List<DeviceGroupDepart> departList); + + /** + * 鏍规嵁groupId鍒犻櫎鏉冮檺 + * @param groupId + * @return + */ + boolean deleteByGroupId(String groupId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupPermissionService.java new file mode 100644 index 0000000..cd4cfb7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupPermissionService.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DeviceGroupPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IDeviceGroupPermissionService extends IService<DeviceGroupPermission> { + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param groupId + * @return + */ + List<UserDepartExt> getUserPermsByGroupId(String groupId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param groupId + * @return + */ + List<SysUser> getUserNonPermsByGroupId(String groupId); + + /** + * 鏍规嵁鐢ㄦ埛鍜屽垎缁勮幏鍙栧垎缁勬潈闄� + * @param userId + * @param groupId + * @return + */ + DeviceGroupPermission getByUserIdAndGroupId(String userId, String groupId); + + /** + * 鍒犻櫎涓�缁勫璞� + * @param permissions + * @return + */ + boolean removeByCollection(List<DeviceGroupPermission> permissions); + + /** + * 鏍规嵁groupId鍒犻櫎鏉冮檺 + * @param groupId + * @return + */ + boolean deleteByGroupId(String groupId); + + /** + * 鑾峰彇鍒嗙粍鐨勭敤鎴锋潈闄� + * @return + */ + List<DeviceGroupPermission> getByGroupId(String groupId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java new file mode 100644 index 0000000..ed34326 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java @@ -0,0 +1,151 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.dto.DeviceGroupExt; +import org.jeecg.modules.dnc.entity.DeviceGroup; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Collection; +import java.util.List; + +public interface IDeviceGroupService extends IService<DeviceGroup> { + /** + * 鏂板璁惧鍒嗙粍 + * @param deviceGroup + * @return + */ + boolean addDeviceGroup(DeviceGroup deviceGroup); + + /** + * 鎸夊悕绉版煡璇㈡暟鎹� + * @param groupName + * @return + */ + DeviceGroup findByGroupName(String groupName); + + /** + * 缂栬緫璁惧鍒嗙粍 + * @param id + * @param deviceGroup + * @return + */ + boolean editDeviceGroup(String id, DeviceGroup deviceGroup); + /** + * 鏌ヨ鎵�鏈夌埗鑺傜偣鍚嶇О + * @param parentId + * @param stringList + * @return + */ + List<String> findListParentTree(String parentId,List<String> stringList); + /** + * 鍒犻櫎璁惧鍒嗙粍 + * @param id + * @return + */ + boolean deleteDeviceGroup(String id); + + /** + * 鑾峰彇璁惧鐖跺瓙鐖跺瓙缁撴瀯鏁版嵁 + * @return + */ + List<DeviceGroupExt> findExtAll(); + + /** + * 鑾峰彇鐢ㄦ埛鎺堟潈鍏宠仈鐨勮澶囧垎缁� + * @param userId + * @return + */ + List<DeviceGroupExt> getByUserPerms(String userId); + + /** + * 鑾峰彇鐢ㄦ埛鎺堟潈鍏宠仈鐨勮澶囧垎缁� 鍚戜笂鏌ヨ鐖� + * @param userId + * @return + */ + List<DeviceGroupExt> getByUserPermsAs(String userId); + /** + * 鏌ヨ鎵�鏈夌埗鑺傜偣鍜屾湰鑺傜偣鍚嶇О + * @param groupId + * @return + */ + List<String> findListParentTreeAll(String groupId); + /** + * 鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� + * @param groupId + * @return + */ + List<DeviceGroup> getChildrenByParentId(String groupId); + + + /** + * 鍒嗛厤璁惧鐢ㄦ埛 + * @param deviceGroup + * @param userList + * @return + */ + boolean assignAddUser(DeviceGroup deviceGroup, Collection<SysUser> userList); + + /** + * 鍒犻櫎璁惧鐢ㄦ埛 + * @param deviceGroup + * @param userList + * @return + */ + boolean assignRemoveUser(DeviceGroup deviceGroup, Collection<SysUser> userList); + + /** + * 鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬 + * @param groupId + * @return + */ + List<Department> getDepartPermsList(String groupId); + + /** + * 鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬 + * @param groupId + * @return + */ + List<Department> getDepartNonPermsList(String groupId); + + /** + * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� + * @param groupId + * @param relativeFlag + * @param departmentIds + * @return + */ + boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds); + + /** + * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 + * @param groupId + * @param relativeFlag + * @param departmentIds + * @return + */ + boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds); + + /** + * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� + * @param deviceGroup + * @param departmentList + * @return + */ + boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList); + + /** + * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 + * @param deviceGroup + * @param departmentList + * @return + */ + boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList); + + /** + * + * @param departIds + * @return + */ + List<DeviceGroupExt> findExtByDeparts(List<String> departIds); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceInfoService.java new file mode 100644 index 0000000..79ddf8a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceInfoService.java @@ -0,0 +1,149 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Collection; +import java.util.List; + +public interface IDeviceInfoService extends IService<DeviceInfo> { + + /** + * 鏂板璁惧 + * @param deviceInfo + * @return + */ + boolean addDeviceInfo(DeviceInfo deviceInfo); + /** + * 缂栬緫璁惧淇℃伅 + * @param id + * @param deviceInfo + * @return + */ + boolean editDeviceInfo(String id, DeviceInfo deviceInfo); + + /** + * 鍒犻櫎璁惧 + * @param id + * @return + */ + boolean deleteDeviceInfo(String id); + + /** + * 鏍规嵁鐢ㄦ埛鏉冮檺鑾峰彇鏍� + * @return + */ + List<CommonGenericTree> loadTree(); + + /** + * 鑾峰彇鐢ㄦ埛涓嬬殑鎵�鏈夋潈闄愯澶� + * @param userId + * @return + */ + List<DeviceInfo> getDeviceByUserPermed(String userId); + + /** + * 妫�鏌ョ敤鎴锋槸鍚︽湁璇ヨ澶囩殑鏉冮檺 + * @param nodeType 1 璁惧鍒嗙粍 2 璁惧 + * @param paramId + * @return + */ + boolean checkDevicePerm(Integer nodeType, String paramId); + + /** + * 鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛 + * @param nodeType + * @param paramId + * @return + */ + List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId); + /** + * 鑾峰彇鑺傜偣鏈垎閰嶇殑鐢ㄦ埛 + * @param nodeType + * @param paramId + * @return + */ + List<SysUser> getUserNonPermsList(Integer nodeType, String paramId); + + /** + * 澧炲姞璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType + * @param paramId + * @param relativeFlag + * @param userIds + * @return + */ + boolean assignAddUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds); + + /** + * 鍒嗛厤璁惧鐢ㄦ埛 + * @param deviceInfo + * @param userList + * @return + */ + boolean assignAddUser(DeviceInfo deviceInfo, Collection<SysUser> userList); + + /** + * 鍒犻櫎璁惧鐢ㄦ埛 + * @param deviceInfo + * @param userList + * @return + */ + boolean assignRemoveUser(DeviceInfo deviceInfo, Collection<SysUser> userList); + + /** + * 鏍规嵁涓�缁刧roupId 鏌ユ壘璁惧 + * @param groupIdList + * @return + */ + List<DeviceInfo> getByGroupIdList(List<String> groupIdList); + + /** + * 鏌ユ壘鍒嗙粍涓嬬殑鎵�鏈夎澶� + * @param groupId + * @return + */ + List<DeviceInfo> getByGroupId(String groupId); + + /** + * 鍒犻櫎璁惧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType + * @param paramId + * @param relativeFlag + * @param userIds + * @return + */ + boolean assignRemoveUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds); + + /** + * 鎸囨淳鍒拌澶� 璁惧鏍� + * @param nodeType + * @return + */ + List<CommonGenericTree> loadDepartTree(Integer nodeType, String paramId); + + /** + * 鑾峰彇閮ㄩ棬涓嬬殑鎵�鏈夎澶� + * @param departIds + * @return + */ + List<DeviceInfo> findByDepartIds(List<String> departIds); + + /** + * 鑾峰彇鍞竴 璁惧缂栧彿 + * @param deviceNo + * @return + */ + DeviceInfo getByDeviceNo(String deviceNo); + + /** + * 鏌ラ獙鐐逛綅鎺у埗鎯呭喌 + * 1銆佸簭鍒楀彿姝g‘瑙f瀽D鍊紅rue 鍚﹀垯false + * 2銆佸綋鍓嶆坊鍔犵殑璁惧鏁板皬浜庣瓑浜嶥鍊紅rue 鍚﹀垯false + * @return + */ + boolean checkDeviceControlPoint(); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionService.java new file mode 100644 index 0000000..da5158c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionService.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DevicePermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IDevicePermissionService extends IService<DevicePermission> { + + /** + * 鑾峰彇鐢ㄦ埛鏄惁鏈夎璁惧鐨勬潈闄� + * @param userId + * @param deviceId + * @return + */ + DevicePermission getByUserIdAndDeviceId(String userId, String deviceId); + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param deviceId + * @return + */ + List<UserDepartExt> getUserPermsByDeviceId(String deviceId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param deviceId + * @return + */ + List<SysUser> getUserNonPermsByDeviceId(String deviceId); + + /** + * 鍒犻櫎涓�缁勬潈闄� + * @param devicePermissions + * @return + */ + boolean removeByCollection(List<DevicePermission> devicePermissions); + + /** + * 鍒犻櫎璁惧鐨勭敤鎴锋潈闄� + * @param deviceId + * @return + */ + boolean deleteByDeviceId(String deviceId); + + /** + * 鑾峰彇璁惧鐢ㄦ埛鏉冮檺 + * @return + */ + List<DevicePermission> getByDeviceId(String deviceId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionStreamService.java new file mode 100644 index 0000000..294dbf8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDevicePermissionStreamService.java @@ -0,0 +1,107 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DevicePermissionStream; + +import java.util.List; + +public interface IDevicePermissionStreamService extends IService<DevicePermissionStream> { + /** + * 鏍规嵁鍒嗙粍缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param groupId + * @param userId + * @return + */ + DevicePermissionStream getByGroupIdAndUserId(String groupId, String userId); + /** + * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param groupId + * @param deviceId + * @param userId + * @return + **/ + DevicePermissionStream getByDeviceIdAndUserId(String groupId, String deviceId, String userId); + + + /** + * 鏍规嵁鍒嗙粍id鏌ユ壘閮ㄩ棬鏉冮檺 + * @param groupId + * @return + */ + List<DevicePermissionStream> getDepartPermByGroupId(String groupId); + /** + * 鏍规嵁鍒嗙粍id璁惧鏌ユ壘閮ㄩ棬鏉冮檺 + * @param groupId + * @param deviceId + * @return + */ + List<DevicePermissionStream> getDepartPermByDeviceId(String groupId, String deviceId); + + /** + * 鍒犻櫎涓�缁勬潈闄愯褰� + * @param permissionStreams + * @return + */ + boolean removeByCollection(List<DevicePermissionStream> permissionStreams); + + + /** + * 鏍规嵁鍒嗙粍缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param groupId + * @param departId + * @return + */ + DevicePermissionStream getByGroupIdAndDepartId(String groupId, String departId); + /** + * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param groupId + * @param deviceId + * @param departId + * @return + **/ + DevicePermissionStream getByDeviceIdAndDepartId(String groupId, String deviceId, String departId); + + /** + * 鑾峰彇閮ㄩ棬鍏宠仈鐨勬潈闄愭暟鎹� + * @param departId + * @return + */ + List<DevicePermissionStream> findByDepartId(String departId); + + /** + * 鑾峰彇鐢ㄦ埛鐨勬潈闄愭暟鎹� + * @param userId + * @return + */ + List<DevicePermissionStream> findByUserId(String userId); + + /** + * 鍒犻櫎鍒嗙粍鐨勭敤鎴锋潈闄� + * @param groupId + * @return + */ + boolean deleteUserByGroupId(String groupId); + + /** + * 鍒犻櫎鍒嗙粍鐨勯儴闂ㄦ潈闄� + * @param groupId + * @return + */ + boolean deleteDepartByGroupId(String groupId); + + /** + * 鍒犻櫎璁惧鐨勭敤鎴锋潈闄� + * @param deviceId + * @return + */ + boolean deleteUserByDeviceId(String groupId, String deviceId); + + + + /** + * 鍒犻櫎璁惧鐨勯儴闂ㄦ潈闄� + * @param deviceId + * @return + */ + boolean deleteDepartByDeviceId(String groupId, String deviceId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java new file mode 100644 index 0000000..b0d76b4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DncPassLog; + +/** + * @author clown + * * @date 2023/11/29 + */ +public interface IDncPassLogService extends IService<DncPassLog> { + + /** + * 鏌ヨ鏌愪竴澶╃殑鏁版嵁 + * @param dateDay + * @return + */ + DncPassLog findDayTime(String dateDay); + + /** + * 鍙戦�佹枃浠� + */ + void fileClientTxtOrNc(); + + /** + * 鍒犻櫎鍥哄畾璺緞涓嬭秴鏃舵枃浠� + * @return + */ + void deleteNcSendFile(); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocClassificationService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocClassificationService.java new file mode 100644 index 0000000..c832391 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocClassificationService.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DocClassification; + +public interface IDocClassificationService extends IService<DocClassification> { + /** + * 娣诲姞鏂囨。鍒嗙被 + * @param docClassification + * @return + */ + boolean addDocClassification(DocClassification docClassification); + + + /** + * 鏍规嵁鏂囨。鍒嗙被缂栫爜鑾峰彇鏂囨。 + * @param code + * @return + */ + DocClassification getByCode(String code); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocFileService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocFileService.java new file mode 100644 index 0000000..635b412 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocFileService.java @@ -0,0 +1,52 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DocFile; + +import java.util.List; + +public interface IDocFileService extends IService<DocFile> { + + /** + * 鏂板docFile + * @param docFile + * @return + */ + boolean addDocFile(DocFile docFile); + + /** + * 鑾峰彇鏂囨。鐨勬渶鏂扮増鏈� + * @param docId + * @return + */ + DocFile getDocFileNearest(String docId); + + /** + * 鏍规嵁docId鑾峰彇鏂囦欢鍒楄〃 + * @param docId + * @return + */ + List<DocFile> findListByDocId(String docId); + + /** + * 鎸囧畾鏂囨。鐗堟湰 + * @param fileId + * @return + */ + boolean assignFileVersion(String fileId); + + /** + * 鏍规嵁鏂囦欢鐨勭粦瀹氱被鍨嬪拰缁戝畾id鍒犻櫎鏂囨。涓嬬殑鎵�鏈夋枃浠朵俊鎭� + * @param type + * @param id + * @return + */ + boolean deleteByDocAttr(Integer type, String id); + + /** + * 鏍规嵁鏂囨。id鍒犻櫎鏂囨。 + * @param docId + * @return + */ + boolean deleteByDocId(String docId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocInfoService.java new file mode 100644 index 0000000..1f9eb45 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocInfoService.java @@ -0,0 +1,232 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DocFile; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.entity.ProcessStream; +import org.jeecg.modules.dnc.response.QueryListResponseResult; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.request.DocInfoQueryRequest; +import org.jeecg.modules.dnc.request.DocInfoUploadRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.List; + +public interface IDocInfoService extends IService<DocInfo> { + + /** + * 瀵煎叆鏂囨。杩涘彛 + * @param file + * @param docInfo + * @return + */ + boolean addDocInfo(MultipartFile file, DocInfoUploadRequest docInfo); + + /** + * 缂栬緫鏂囨。鍩烘湰淇℃伅 + * @param id + * @param docInfo + * @return + */ + boolean editDocInfo(String id, DocInfo docInfo); + + /** + * 鍒犻櫎鏂囨。淇℃伅 + * @param id + * @return + */ + boolean deleteDocInfo(String id); + /** + * 鐩戞帶鏂囦欢瀵煎叆 + * @param pathFile + * @return + */ + boolean addDocInfoRec(String pathFile,File fileRec); + + boolean addDocInfoRecService(String equipmentId,File fileRec,String fileNameSuffix,String fileNameNew,String filePath ); + /** + * 鍏ュ簱鎿嶄綔 鏂囨。瀵瑰簲鏂囦欢鍗囩増 + * @param id + * @return + */ + boolean pushDocFile(String id, MultipartFile file); + + /** + * 鏂囨。鍑哄簱妫�鏌� + * @param id + * @return + */ + DocFile checkDocInfo(String id); + + /** + * 鏂囨。鍙戝竷 + * @param id + * @return + */ + boolean publishDocInfo(String id); + /** + * 鏂囨。閲嶅彂甯� + * @param id + * @return + */ + boolean republishDocInfo(String id); + /** + * 鏂囨。褰掓。 + * @param id + * @return + */ + boolean pigeonholeDocInfo(String id); + + /** + * 鍙栨秷鍑哄簱 + * @param id + * @return + */ + boolean cancelPullDocInfo(String id); + + /** + * 鍒嗛〉鏌ヨ鎺ュ彛 + * @param page + * @param size + * @param docQuery + * @return + */ + QueryPageResponseResult<DocInfo> findPageList(int page, int size, DocInfoQueryRequest docQuery); + + /** + * + * @param docId + * @param attributeId + * @param attrType + * @return + */ + DocInfo getByDocAttrAndDocId(String docId, Integer attrType, String attributeId); + + /** + * 鏂囨。棰勮 + * @param id + * @return + */ + DocFile previewDocFile(String id); + + /** + * 鍒犻櫎浜у搧涓嬬殑鎵�鏈夋枃妗� + * @param productId + * @return + */ + boolean deleteByProductId(String productId); + + /** + * 鍒犻櫎閮ㄤ欢涓嬬殑鎵�鏈夋枃妗� + * @param componentId + * @return + */ + boolean deleteByComponentId(String componentId); + + /** + * 鍒犻櫎闆朵欢涓嬬殑鎵�鏈夋枃妗� + * @param partsId + * @return + */ + boolean deleteByPartsId(String partsId); + + /** + * 鍒犻櫎璁惧涓嬬殑鎵�鏈夋枃妗� + * @param deviceId + * @return + */ + boolean deleteByDeviceId(String deviceId); + + /** + * 鍒犻櫎宸ュ簭涓嬬殑鎵�鏈夋枃妗� + * @param processId + * @return + */ + boolean deleteByProcessId(String processId); + + /** + * 鍒犻櫎鏂囨。淇℃伅 + * @param attrType + * @param attrId + * @return + */ + boolean deleteByDocAttr(Integer attrType, String attrId); + + /** + * 鍑哄簱 + * @param request + * @param response + * @param id + * @return + */ + ResponseResult pullDocFile(HttpServletRequest request, HttpServletResponse response, String id); + + /** + * 鏍规嵁鏂囨。鍚嶇О/缁戝畾绫诲瀷鏌ユ壘鍞竴鐨勬枃妗d俊鎭� + * @param docName + * @param attrType + * @param attrId + * @return + */ + DocInfo findByAttrAndDocName(String docName, Integer attrType, String attrId); + + /** + * 鏍¢獙鏂囨。鍚嶇О鏄惁瀛樺湪閲嶅 + * @param docName + * @param attrType + * @param attrId + * @param docId + * @return + */ + DocInfo findByAttrAndDocNameNotThis(String docName, Integer attrType, String attrId, String docId); + + /** + * + * @param docId + * @return + */ + List<DocInfo> getByDocId(String docId); + + /** + * 鏌ヨ璁惧鍙戦�佺洰褰曠殑鏂囨。鐘舵�� + * @param page + * @param size + * @param docQuery + * @return + */ + QueryPageResponseResult<DocInfo> findPageListByDevice(int page, int size, DocInfoQueryRequest docQuery); + + /** + * 鏌ヨ鍙寚娲剧殑鏂囨。淇℃伅鍒楄〃 + * @param docQuery + * @return + */ + QueryListResponseResult<DocInfo> findList(DocInfoQueryRequest docQuery); + + /** + * 鑾峰彇涓�缁勫伐搴忎笅鐨勬枃妗d俊鎭垪琛� + * @param streams + * @return + */ + List<DocInfo> getByProcessIds(List<ProcessStream> streams); + + /** + * 鎵归噺鍒犻櫎鏂囨。鎺ュ彛 + * @param docIds + * @return + */ + boolean batchRemoveDocInfo(String[] docIds); + + /** + * 鏂囨。涓嬭浇 + * @param request + * @param response + * @param id + * @return + */ + ResponseResult downloadDocFile(HttpServletRequest request, HttpServletResponse response, String id); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java new file mode 100644 index 0000000..0d1c7e2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.entity.DocRelative; + +import java.util.List; + +public interface IDocRelativeService extends IService<DocRelative> { + + /** + * 鍒犻櫎鏂囨。淇℃伅 + * @param attrType + * @param attrId + * @return + */ + boolean deleteByDocAttr(Integer attrType, String attrId); + + /** + * 鍒犻櫎鏂囨。 + * @param id + * @return + */ + boolean deleteByDocId(String id); + + /** + * 鍒犻櫎璁惧涓嬬殑鏂囨。鎺ュ彛 + * @param docId + * @param attrType + * @param attrId + * @return + */ + boolean deleteDocByAttr(String docId, Integer attrType, String attrId); + + /** + * 鍒犻櫎璁惧涓嬬殑鏂囨。鎺ュ彛 + * @param docId + * @param attrType + * @param attrId + * @return + */ + boolean deleteCopyDocByAttrNext(String docId, Integer attrType, String attrId); + + /** + * 鏌ヨ鏂囨。涓嬬殑鎵�鏈夊叧鑱旇澶囦俊鎭� + * @param docId + * @return + */ + List<DeviceInfo> findDeviceByDocId(String docId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IFileOperateService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IFileOperateService.java new file mode 100644 index 0000000..2ec807a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IFileOperateService.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.FileOperate; + +public interface IFileOperateService extends IService<FileOperate> { + /** + * 鏍规嵁鏂囨。缂栧彿锛屾煡鎵炬搷浣滀俊鎭� + * @param docId + * @return + */ + FileOperate getByDocId(String docId); + + /** + * 鏍规嵁鏂囨。缂栧彿鍒犻櫎鎿嶄綔璁板綍 + * @param docId + * @return + */ + boolean deleteByDocId(String docId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java new file mode 100644 index 0000000..810433e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.MenuButton; + +import java.util.List; +import java.util.Map; + +public interface IMenuButtonService extends IService<MenuButton> { + + /** + * 鏍规嵁鑿滃崟id鍒犻櫎淇℃伅 + * @param menuId + * @return + */ + boolean deleteByMenuId(String menuId); + + /** + * 鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� + * @param menuId + * @return + */ + Map<String, MenuButton> getMapByMenuId(String menuId); + + /** + * 鑾峰彇鎸夐挳鍏宠仈鐨勮彍鍗曟暟鎹� + * @param buttonId + * @return + */ + List<MenuButton> findByButtonId(String buttonId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java new file mode 100644 index 0000000..4f7a6dc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java @@ -0,0 +1,45 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.NcLogInfo; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.request.NcLogInfoRequest; +import org.springframework.web.servlet.ModelAndView; + +/** + * @author clown + * * @date 2023/12/4 + */ +public interface INcLogInfoService extends IService<NcLogInfo> { + /** + * 鍒嗛〉鏌ヨ + * @param page + * @param size + * @param requestParams + * @return + */ + QueryPageResponseResult<NcLogInfo> findByPageList(int page, int size, NcLogInfoRequest requestParams); + + /** + * 淇濆瓨鏁版嵁 + * @param logInfo + * @return + */ + boolean saveLogNcInfos(NcLogInfo logInfo); + + /** + * 淇濆瓨鏁版嵁 + * @param moduleInfo + * @param operateType + * @param logContent + * @return + */ + boolean saveLogInfo(String moduleInfo,Integer operateType, String logContent); + + /** + * 瀵煎嚭鏌ヨList + * @param requestParams + * @return + */ + ModelAndView exportLogList(NcLogInfoRequest requestParams); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java new file mode 100644 index 0000000..85dd572 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ObjectButtonPermission; + +import java.util.List; +import java.util.Map; + +public interface IObjectButtonPermissionService extends IService<ObjectButtonPermission> { + /** + * 鏍规嵁瑙掕壊id鍒犻櫎瀵硅薄鎸夐挳鎿嶄綔鏉冮檺 + * @param roleId + * @return + */ + boolean deleteByRoleId(String roleId); + + /** + * 鑾峰彇瑙掕壊鍒嗛厤鐨勮彍鍗曟寜閽� + * @param roleId + * @return + */ + Map<String, ObjectButtonPermission> getMapByRoleId(String roleId); + + /** + * 鑾峰彇瀵硅薄鐨勫叧鑱旀暟鎹� + * @param objId + * @return + */ + List<ObjectButtonPermission> findByObjectId(String objId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java new file mode 100644 index 0000000..96ae679 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ObjectButton; + +import java.util.List; +import java.util.Map; + +public interface IObjectButtonService extends IService<ObjectButton> { + /** + * 鏍规嵁瀵硅薄id鍒犻櫎淇℃伅 + * @param objectId + * @return + */ + boolean deleteByObjectId(String objectId); + + /** + * 鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� + * @param objectId + * @return + */ + Map<String, ObjectButton> getMapByObjectId(String objectId); + + /** + * 鑾峰彇鎸夐挳鍏宠仈鐨勫璞℃暟鎹� + * @param id + * @return + */ + List<ObjectButton> findByButtonId(String id); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java new file mode 100644 index 0000000..513373d --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PartsDepartment; +import org.jeecg.modules.dnc.ucenter.Department; + +import java.util.List; + +public interface IPartsDepartmentService extends IService<PartsDepartment> { + /** + * 鏍规嵁闆朵欢id鍒犻櫎閮ㄩ棬鏉冮檺 + * @param partsId + * @return + */ + boolean deleteByPartsId(String partsId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param partsId + * @return + */ + List<Department> getDepartPermsByPartsId(String partsId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param partsId + * @return + */ + List<Department> getDepartNonPermsByProductId(String partsId); + + /** + * 鏌ヨ閮ㄩ棬鏉冮檺 + * @param partsId + * @param departId + * @return + */ + PartsDepartment getByPartsIdAndDepartId(String partsId, String departId); + + /** + * 绉婚櫎閮ㄩ棬鏉冮檺 + * @param partsDepartments + * @return + */ + boolean removeByCollection(List<PartsDepartment> partsDepartments); + + /** + * 鏌ヨ涓�缁勯儴闂ㄦ潈闄� + * @param partsIds + * @param ids + * @return + */ + List<PartsDepartment> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> ids); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java new file mode 100644 index 0000000..d2f4f2c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java @@ -0,0 +1,117 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PartsInfo; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Collection; +import java.util.List; + +public interface IPartsInfoService extends IService<PartsInfo> { + /** + * 娣诲姞闆朵欢淇℃伅 + * @param partsInfo + * @return + */ + boolean addPartsInfo(PartsInfo partsInfo); + + /** + * 缂栬緫闆朵欢淇℃伅 + * @param id + * @param partsInfo + * @return + */ + boolean editPartsInfo(String id, PartsInfo partsInfo); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勯浂浠朵俊鎭� + * @param userId + * @return + */ + List<PartsInfo> getByUserPerms(String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勯浂浠朵俊鎭� + * @param userId + * @param componentId + * @return + */ + List<PartsInfo> getByUserPerms(String userId, String componentId, String queryParam); + + /** + * 鏍规嵁浜у搧id鑾峰彇 + * @param productId + * @return + */ + List<PartsInfo> getByProductId(String productId); + + /** + * 鏍规嵁浜у搧id 鍜岄儴浠秈d鑾峰彇 + * @param productId + * @param componentId + * @return + */ + List<PartsInfo> getByComponentId(String productId, String componentId); + + /** + * 鏍规嵁浜у搧id鍒犻櫎涓嬮潰鐨勬墍鏈夊瓙鑺傜偣 + * @param partsInfoList + * @return + */ + boolean deleteCollection(List<PartsInfo> partsInfoList); + + /** + * 鍒犻櫎闆朵欢 + * @param partsId + * @return + */ + boolean deletePartsInfo(String partsId); + + + /** + * 鍒嗛厤鐢ㄦ埛鏉冮檺 + * @param partsInfo + * @param userList + * @return + */ + boolean assignAddUser(PartsInfo partsInfo, Collection<SysUser> userList); + + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param partsInfo + * @param userList + * @return + */ + boolean assignRemoveUser(PartsInfo partsInfo, Collection<SysUser> userList); + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param partsInfo + * @param departmentList + * @return + */ + boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList); + + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param partsInfo + * @param departmentList + * @return + */ + boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList); + + /** + * 鏍规嵁涓�缁勯儴浠舵煡鎵鹃浂浠� + * @param productId + * @param componentIds + * @return + */ + List<PartsInfo> getByComponentIdList(String productId, List<String> componentIds); + + /** + * 鑾峰彇鍞竴 闆朵欢缂栧彿 + * @param partsCode + * @return + */ + PartsInfo getByCode(String partsCode); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsPermissionService.java new file mode 100644 index 0000000..29755f4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsPermissionService.java @@ -0,0 +1,63 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PartsPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IPartsPermissionService extends IService<PartsPermission> { + + /** + * 鏍规嵁闆朵欢id 鍜寀serId 鏌ユ壘鏉冮檺 + * @param partsId + * @param userId + * @return + */ + PartsPermission getByPartsIdAndUserId(String partsId, String userId); + + /** + * 鏍规嵁闆朵欢id鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param partsId + * @return + */ + boolean deleteByPartsId(String partsId); + + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param partsId + * @return + */ + List<UserDepartExt> getUserPermsByProductId(String partsId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param partsId + * @return + */ + List<SysUser> getUserNonPermsByProductId(String partsId); + + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param permissionList + * @return + */ + boolean removeByCollection(List<PartsPermission> permissionList); + + /** + * 鑾峰彇褰撳墠闆朵欢鐨勬墍鏈夌敤鎴锋潈闄� + * @param partsId + * @return + */ + List<PartsPermission> getByPartsId(String partsId); + + /** + * 鏌ヨ涓�缁勬潈闄� + * @param partsIds + * @param ids + * @return + */ + List<PartsPermission> getByPartsIdsAndUserIds(List<String> partsIds, List<String> ids); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java new file mode 100644 index 0000000..0ec693c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java @@ -0,0 +1,174 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PermissionStream; + +import java.util.List; + +public interface IPermissionStreamService extends IService<PermissionStream> { + /** + * 鏍规嵁浜у搧缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param productId + * @param userId + * @return + */ + PermissionStream getByProductIdAndUserId(String productId, String userId); + /** + * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param productId + * @param componentId + * @param userId + * @return + */ + PermissionStream getByComponentIdAndUserId(String productId, String componentId, String userId); + + /** + * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param productId + * @param componentId + * @param userId + * @param partsId + * @return + */ + PermissionStream getByPartsIdAndUserId(String productId, String componentId, String partsId, String userId); + + /** + * 鏍规嵁浜у搧缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 + * @param productId + * @return + */ + List<PermissionStream> getByProductId(String productId); + /** + * 鏍规嵁閮ㄤ欢缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 + * @param productId + * @param componentId + * @return + */ + List<PermissionStream> getByComponentId(String productId, String componentId); + + /** + * 鏍规嵁闆朵欢缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 + * @param productId + * @param componentId + * @param partsId + * @return + */ + List<PermissionStream> getByPartsId(String productId, String componentId, String partsId); + + /** + * 鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param productId + * @return + */ + boolean deleteUserPermsByProductId(String productId); + /** + * 鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param productId + * @return + */ + boolean deleteUserPermsByComponentId(String productId, String componentId); + /** + * 鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param productId + * @return + */ + boolean deleteUserPermsByPartsId(String productId, String componentId, String partsId); + + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺 + * @param productId + * @return + */ + boolean deleteDepartPermsByProductId(String productId); + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺 + * @param productId + * @return + */ + boolean deleteDepartPermsByComponentId(String productId, String componentId); + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺 + * @param productId + * @return + */ + boolean deleteDepartPermsByPartsId(String productId, String componentId, String partsId); + + /** + * 绉婚櫎鏉冮檺鏁版嵁 + * @param permissionStreamList + * @return + */ + boolean removeByCollection(List<PermissionStream> permissionStreamList); + + /** + * 鏌ヨ浜у搧鐨勫敮涓�閮ㄩ棬鏉冮檺 + * @param productId + * @param departId + * @return + */ + PermissionStream getByProductIdAndDepartId(String productId, String departId); + + /** + * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param productId + * @param componentId + * @param departId + * @return + */ + PermissionStream getByComponentIdAndDepartId(String productId, String componentId, String departId); + + /** + * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� + * @param productId + * @param componentId + * @param departId + * @param partsId + * @return + */ + PermissionStream getByPartsIdAndDepartId(String productId, String componentId, String partsId, String departId); + + /** + * 鑾峰彇閮ㄩ棬鍏宠仈鐨勬潈闄愪俊鎭� + * @param departId + * @return + */ + List<PermissionStream> findByDepartId(String departId); + + /** + * 鑾峰彇鐢ㄦ埛鐨勫叧鑱旀潈闄愭暟鎹� + * @param userId + * @return + */ + List<PermissionStream> findByUserId(String userId); + + /** + * 鏌ヨ閮ㄤ欢涓嬬殑鏉冮檺淇℃伅 + * @param componentIds + * @param userIds + * @return + */ + List<PermissionStream> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds); + + /** + * 鏌ヨ閮ㄤ欢涓嬬殑鏉冮檺淇℃伅 + * @param componentIds + * @param departIds + * @return + */ + List<PermissionStream> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> departIds); + /** + * 鏌ヨ闆朵欢涓嬬殑鏉冮檺淇℃伅 + * @param partsIds + * @param userIds + * @return + */ + List<PermissionStream> getByPartsIdsAndUserIds(List<String> partsIds, List<String> userIds); + + /** + * 鏌ヨ闆朵欢涓嬬殑鏉冮檺淇℃伅 + * @param partsIds + * @param departIds + * @return + */ + List<PermissionStream> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> departIds); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessInfoService.java new file mode 100644 index 0000000..45006e6 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessInfoService.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ProcessInfo; + +import java.util.List; + +public interface IProcessInfoService extends IService<ProcessInfo> { + /** + * 鏂板鎴栫紪杈戝伐搴忓熀鏈俊鎭� + * @param processInfo + * @return + */ + boolean addOrEdit(ProcessInfo processInfo); + + /** + * 鏍规嵁鍚嶇О鑾峰彇宸ュ簭鍩烘湰淇℃伅 + * @param processName + * @return + */ + ProcessInfo getByName(String processName); + /** + * 鏍规嵁宸ュ簭鍚嶇О妯$硦鏌ヨ + * @param processName + * @return + */ + List<ProcessInfo> findByProcessName(String processName); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java new file mode 100644 index 0000000..cd8f86a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java @@ -0,0 +1,82 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ProcessStream; +import org.jeecg.modules.dnc.request.ProcessStreamRequest; + +import java.util.List; + +public interface IProcessStreamService extends IService<ProcessStream> { + /** + * 娣诲姞宸ュ簭 + * @param stream + * @return + */ + boolean addProcessStream(ProcessStream stream); + + /** + * 缂栬緫宸ュ簭淇℃伅 + * @param id + * @param stream + * @return + */ + boolean editProcessStream(String id, ProcessStream stream); + + /** + * 鍒犻櫎宸ュ簭淇℃伅 閫昏緫鍒犻櫎 + * @param id + * @return + */ + boolean deleteProcessStream(String id); + + /** + * 鏌ヨ閮ㄤ欢/闆朵欢鑺傜偣涓嬬殑宸ュ簭鍒楄〃 + * @param request + * @return + */ + List<ProcessStream> findByNodeParams(ProcessStreamRequest request); + + /** + * 鑾峰彇浜у搧鍏宠仈鐨勫伐搴忎俊鎭紙鍖呭惈閮ㄤ欢/闆朵欢锛� + * @param productId + * @return + */ + List<ProcessStream> findByProductId(String productId); + + /** + * 鑾峰彇閮ㄤ欢鍏宠仈鐨勫伐搴忎俊鎭紙鍖呭惈闆朵欢锛� + * @param componentId + * @return + */ + List<ProcessStream> findByComponentId(String componentId); + + /** + * 鑾峰彇闆朵欢鍏宠仈鐨勫伐搴忎俊鎭� + * @param partsId + * @return + */ + List<ProcessStream> findByPartsId(String partsId); + + /** + * 鑾峰彇闆朵欢涓嬬殑宸ュ簭鍙� + * @param processNo + * @param partsId + * @return + */ + ProcessStream findByProcessNoAndPartsId(String processNo, String partsId); + /** + * 鑾峰彇閮ㄤ欢涓嬬殑宸ュ簭鍙� + * @param processNo + * @param componentId + * @return + */ + ProcessStream findByProcessNoAndComponentId(String processNo, String componentId); + + /** + * 妫�鏌N鐮佸搴旂殑璁惧鏄惁瀛樺湪鍙姞宸ュ伐搴� + * @param pnCode + * @param deviceNo + * @return + */ + List<ProcessStream> validateDeviceProcessInfo(String pnCode, String deviceNo); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java new file mode 100644 index 0000000..4f34d77 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java @@ -0,0 +1,46 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ProductDepartment; +import org.jeecg.modules.dnc.ucenter.Department; + +import java.util.List; + +public interface IProductDepartmentService extends IService<ProductDepartment> { + + /** + * 鏍规嵁浜у搧id鍒犻櫎閮ㄩ棬鏉冮檺 + * @param productId + * @return + */ + boolean deleteByProductId(String productId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param productId + * @return + */ + List<Department> getDepartPermsByProductId(String productId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬鍒楄〃 + * @param productId + * @return + */ + List<Department> getDepartNonPermsByProductId(String productId); + + /** + * 鍒犻櫎閮ㄩ棬鏉冮檺鏁版嵁 + * @param productDepartmentList + * @return + */ + boolean removeByCollection(List<ProductDepartment> productDepartmentList); + + /** + * 鏌ヨ鍞竴鐨勯儴闂ㄦ潈闄� + * @param productId + * @param departId + * @return + */ + ProductDepartment getByProductIdAndDepartId(String productId, String departId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java new file mode 100644 index 0000000..9e026c2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java @@ -0,0 +1,211 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ProductInfo; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Collection; +import java.util.List; + +public interface IProductInfoService extends IService<ProductInfo> { + /** + * 鏂板浜у搧淇℃伅 + * @param deviceGroup + * @return + */ + boolean addProductInfo(ProductInfo deviceGroup); + + /** + * 缂栬緫浜у搧淇℃伅 + * @param id + * @param productInfo + * @return + */ + boolean editProductInfo(String id ,ProductInfo productInfo); + + /** + * 鑾峰彇浜у搧缁撴瀯鏍戞帴鍙� + * @return + */ + List<CommonGenericTree> loadProductTree(String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鐢ㄦ埛鐨勪骇鍝佹暟鎹� + * @param userId + * @return + */ + List<ProductInfo> getByUserPerms(String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鍜屾煡璇㈡潯浠惰幏鍙栫敤鎴风殑浜у搧鏁版嵁 + * @param userId + * @param queryParam + * @return + */ + List<ProductInfo> getByUserPerms(String userId, String queryParam); + + /** + * 鍒犻櫎浜у搧 + * @param id + * @return + */ + boolean deleteProductInfo(String id); + + /** + * 妫�鏌ヤ骇鍝佹爲鑺傜偣鐨勬煡鐪嬫潈闄� + * @param nodeType + * @param paramId + * @return + */ + boolean checkProductPerm(Integer nodeType, String paramId); + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param nodeType + * @param paramId + * @return + */ + List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param nodeType + * @param paramId + * @return + */ + List<SysUser> getUserNonPermsList(Integer nodeType, String paramId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param nodeType + * @param paramId + * @return + */ + List<Department> getDepartPermsList(Integer nodeType, String paramId); + + /** + * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬 + * @param nodeType + * @param paramId + * @return + */ + List<Department> getDepartNonPermsList(Integer nodeType, String paramId); + + /** + * 鎸囨淳浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param userIds 娣诲姞鐢ㄦ埛ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + boolean assignAddUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds); + + /** + * 绉婚櫎浜у搧鏍戣妭鐐圭殑鐢ㄦ埛鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param userIds 绉婚櫎鐢ㄦ埛ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + boolean assignRemoveUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds); + + /** + * 鎸囨淳浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param departmentIds 娣诲姞閮ㄩ棬ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + boolean assignAddDepartment(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds); + + /** + * 绉婚櫎浜у搧鏍戣妭鐐圭殑閮ㄩ棬鏉冮檺 + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param departmentIds 绉婚櫎閮ㄩ棬ids + * @param relativeFlag 1 鏄� 2 鍚� + * @return + */ + boolean assignRemoveDepartment(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds); + + + /** + * 缁欎骇鍝佹爲鑺傜偣娣诲姞鐢ㄦ埛鏉冮檺 + * @param productInfo + * @param userList + * @return + */ + boolean assignAddUser(ProductInfo productInfo, Collection<SysUser> userList); + + /** + * 绉婚櫎浜у搧鏍戣妭鐐规坊鍔犵敤鎴锋潈闄� + * @param productInfo + * @param userList + * @return + */ + boolean assignRemoveUser(ProductInfo productInfo, Collection<SysUser> userList); + + + /** + * 缁欎骇鍝佹爲鑺傜偣娣诲姞閮ㄩ棬鏉冮檺 + * @param productInfo + * @param departmentList + * @return + */ + boolean assignAddDepartment(ProductInfo productInfo, Collection<Department> departmentList); + + + /** + * 绉婚櫎浜у搧鏍戣妭鐐规坊鍔犻儴闂ㄦ潈闄� + * @param productInfo + * @param departmentList + * @return + */ + boolean assignRemoveDepartment(ProductInfo productInfo, Collection<Department> departmentList); + + /** + * 鑾峰彇鑺傜偣鐨勯儴闂ㄦ潈闄� + * @param nodeType + * @param paramId + * @return + */ + List<String> getDepartIdsByParams(Integer nodeType, String paramId); + + /** + * 鑾峰彇鍞竴浜у搧缂栧彿 + * @param productNo + * @return + */ + ProductInfo getByProductNo(String productNo); + + /** + * 鑾峰彇浜у搧鏍戠殑绗竴绾у拰绗簩绾� + * @param userId + * @return + */ + List<CommonGenericTree> loadBaseTree(String userId); + + /** + * 鍔犺浇浜у搧鏍戝瓙鑺傜偣鏁版嵁 + * @param userId + * @param nodeType + * @param paramId + * @return + */ + List<CommonGenericTree> loadTree(String userId, Integer nodeType, String paramId); + + /** + * 鎼滅储鎺ュ彛 + * @param userId + * @param queryParam + * @return + */ + List<CommonGenericTree> searchProductTree(String userId, String queryParam); +} + diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductPermissionService.java new file mode 100644 index 0000000..2d0a17c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductPermissionService.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ProductPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IProductPermissionService extends IService<ProductPermission> { + /** + * 鏍规嵁浜у搧id鍜寀serid鑾峰彇鏉冮檺淇℃伅 + * @param productId + * @param userId + * @return + */ + ProductPermission getByProductIdAndUserId(String productId, String userId); + + /** + * 鏍规嵁浜у搧id鍒犻櫎鐢ㄦ埛鏉冮檺 + * @param productId + * @return + */ + boolean deleteByProductId(String productId); + + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param productId + * @return + */ + List<UserDepartExt> getUserPermsByProductId(String productId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛鍒楄〃 + * @param productId + * @return + */ + List<SysUser> getUserNonPermsByProductId(String productId); + + /** + * 绉婚櫎鏉冮檺鏁版嵁 + * @param permissionList + * @return + */ + boolean removeByCollection(List<ProductPermission> permissionList); + + /** + * 鑾峰彇浜у搧鐨勬墍鏈夌敤鎴锋潈闄� + * @return + */ + List<ProductPermission> getByProductId(String productId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ISynchronizedFlagService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ISynchronizedFlagService.java new file mode 100644 index 0000000..fe9fb09 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ISynchronizedFlagService.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.SynchronizedFlag; + +/** + * @Description: TODO + * @Author: zhangherong + * @Date: Created in 2020/9/20 9:18 + * @Version: 1.0 + * @Modified By: + */ +public interface ISynchronizedFlagService extends IService<SynchronizedFlag> { + + /** + * 鏇存柊 瀛楁 + * @param flag + * @return + */ + boolean updateFlag(Integer flag); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java new file mode 100644 index 0000000..4425c62 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.dnc.service; + +import java.util.List; + +public interface IUserPermButtonService { + /** + * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 + * @param param + * @param objectId + * @param userId + * @return + */ + Boolean checkObjectValid(String param, String objectId, String userId); + + /** + * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 + * @param param + * @param flag + * @param objectId + * @param relativeParam + * @param relativeObjectId + * @return + */ + List<String> getCurrentUserButtonPerms(String param, Integer flag, String objectId, String relativeParam, String relativeObjectId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java new file mode 100644 index 0000000..89f82e9 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ButtonPermissionMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.entity.ButtonPermission; +import org.jeecg.modules.dnc.response.RoleCode; +import org.jeecg.modules.dnc.service.IButtonPermissionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class ButtonPermissionServiceImpl extends ServiceImpl<ButtonPermissionMapper, ButtonPermission> implements IButtonPermissionService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByRoleId(String roleId) { + if(!ValidateUtil.validateString(roleId)) + ExceptionCast.cast(RoleCode.ROLE_ID_NONE); + LambdaQueryWrapper<ButtonPermission> lambdaUpdate = Wrappers.lambdaQuery(); + lambdaUpdate.eq(ButtonPermission::getRoleId, roleId); + return super.remove(lambdaUpdate); + } + + @Override + public Map<String, ButtonPermission> getMapByRoleId(String roleId) { + if(!ValidateUtil.validateString(roleId)) + return null; + Map<String, ButtonPermission> map = new HashMap<>(); + List<ButtonPermission> list = super.lambdaQuery().eq(ButtonPermission::getRoleId, roleId).list(); + if(list == null || list.isEmpty()) + return null; + list.forEach(item -> { + map.put(item.getButtonId(), item); + }); + return map; + } + + @Override + public List<ButtonPermission> findByButtonId(String buttonId) { + return super.lambdaQuery().eq(ButtonPermission::getButtonId, buttonId).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java new file mode 100644 index 0000000..c44da4c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java @@ -0,0 +1,209 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ObjectButton; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ButtonMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.service.IButtonPermissionService; +import org.jeecg.modules.dnc.service.IButtonService; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.entity.Button; +import org.jeecg.modules.dnc.entity.ButtonPermission; +import org.jeecg.modules.dnc.entity.MenuButton; +import org.jeecg.modules.dnc.service.IMenuButtonService; +import org.jeecg.modules.dnc.request.ButtonRequest; +import org.jeecg.modules.dnc.response.ButtonCode; +import org.jeecg.modules.dnc.service.IObjectButtonService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Service +public class ButtonServiceImpl extends ServiceImpl<ButtonMapper, Button> implements IButtonService { + @Autowired + private IButtonPermissionService buttonPermissionService; + @Autowired + private IMenuButtonService menuButtonService; + @Autowired + private IObjectButtonService objectButtonService; + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addButton(Button button) { + if(button == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(button.getButtonPerm())) + ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_NONE); + if(!ValidateUtil.validateString(button.getButtonName())) + ExceptionCast.cast(ButtonCode.BTN_NAME_NONE); + if(!ValidateUtil.validateInteger(button.getButtonType())) + ExceptionCast.cast(ButtonCode.BTN_TYPE_NONE); + Button en = getByPermCode(button.getButtonPerm()); + if(en != null) + ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_EXIST); + return super.save(button); + } + + @Override + public Button getByPermCode(String permCode){ + if(!ValidateUtil.validateString(permCode)) + return null; + List<Button> list = super.lambdaQuery().eq(Button::getButtonPerm, permCode).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<Button> findByButtonType(Integer buttonType) { + if(!ValidateUtil.validateInteger(buttonType)) + return null; + return super.lambdaQuery().eq(Button::getButtonType, buttonType).list(); + } + + @Override + public QueryPageResponseResult<Button> findByPageList(int page, int size, ButtonRequest buttonRequest) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<Button> pageData = new Page<>(page, size); + LambdaQueryChainWrapper<Button> lambdaQuery = super.lambdaQuery(); + if(buttonRequest != null) { + if(ValidateUtil.validateString(buttonRequest.getButtonName())) { + lambdaQuery.like(Button::getButtonName, buttonRequest.getButtonName()); + } + if(ValidateUtil.validateString(buttonRequest.getButtonPerm())) { + lambdaQuery.like(Button::getButtonPerm, buttonRequest.getButtonPerm()); + } + if(ValidateUtil.validateInteger(buttonRequest.getButtonType())) { + lambdaQuery.eq(Button::getButtonType, buttonRequest.getButtonType()); + } + if(ValidateUtil.validateString(buttonRequest.getAscStr())) { + String[] ascArr = buttonRequest.getAscStr().split(","); +// ((Page<Button>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(buttonRequest.getDescStr())) { + String[] descStr = buttonRequest.getDescStr().split(","); +// ((Page<Button>) pageData).setDesc(descStr); + } + } + IPage<Button> userIPage = lambdaQuery.page(pageData); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); + } + + @Override + public List<Button> getButtonPerms(String userId) { + return this.getBaseMapper().getButtonPerms(userId); + } + + @Override + public List<Button> getMenuButtonPerms(String userId, String menuUrl) { + return this.getBaseMapper().getMenuButtonPerms(userId, menuUrl); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public List<Button> getObjectButtonPerms(String userId, String objectPerm) { + return this.getBaseMapper().getObjectButtonPerms(userId, objectPerm); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editButton(String id, Button button) { + if(!ValidateUtil.validateString(id) || button == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + button.setButtonId(id); + Button en = getByPermCode(button.getButtonPerm()); + if(en != null && !en.getButtonId().equals(button.getButtonId())) { + ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_EXIST); + } + return super.updateById(button); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteButtonById(String id) { + if(!ValidateUtil.validateString(id)) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + Button button = super.getById(id); + if(button == null) + ExceptionCast.cast(ButtonCode.BTN_NOT_EXIST); + List<ButtonPermission> buttonPermissionList = buttonPermissionService.findByButtonId(id); + if(buttonPermissionList != null && !buttonPermissionList.isEmpty()) + ExceptionCast.cast(ButtonCode.BTN_ROLE_EXIST); + List<MenuButton> menuButtonList = menuButtonService.findByButtonId(id); + if(menuButtonList != null && !menuButtonList.isEmpty()) + ExceptionCast.cast(ButtonCode.BTN_MENU_EXIST); + List<ObjectButton> objectButtonList = objectButtonService.findByButtonId(id); + if(objectButtonList != null && !objectButtonList.isEmpty()) + ExceptionCast.cast(ButtonCode.BTN_OBJ_EXIST); + return super.removeById(id); + } + + @Override + public List<Button> findPermsByRoleId(String roleId) { + if(!ValidateUtil.validateString(roleId)) + return null; + List<Button> list = findByButtonType(1); + if(list == null || list.isEmpty()) + return null; + Map<String, ButtonPermission> map = buttonPermissionService.getMapByRoleId(roleId); + if(map == null || map.isEmpty()) + return list; + list.forEach(item -> { + if(map.containsKey(item.getButtonId())) { + item.setChecked(true); + } + }); + return list; + } + + @Override + public List<Button> findByMenuId(String menuId) { + if(!ValidateUtil.validateString(menuId)) + return null; + List<Button> list = findByButtonType(2); + if(list == null || list.isEmpty()) + return null; + Map<String, MenuButton> map = menuButtonService.getMapByMenuId(menuId); + if(map == null || map.isEmpty()) + return list; + list.forEach(item -> { + if(map.containsKey(item.getButtonId())) { + item.setChecked(true); + item.setButtonAlias(map.get(item.getButtonId()).getButtonAlias()); + item.setPermCode(map.get(item.getButtonId()).getPermCode()); + } + }); + return list; + } + + @Override + public List<Button> findByObjectId(String objectId) { + if(!ValidateUtil.validateString(objectId)) + return null; + List<Button> list = findByButtonType(2); + if(list == null || list.isEmpty()) + return null; + Map<String, ObjectButton> map = objectButtonService.getMapByObjectId(objectId); + if(map == null || map.isEmpty()) + return list; + list.forEach(item -> { + if(map.containsKey(item.getButtonId())) { + item.setChecked(true); + item.setButtonAlias(map.get(item.getButtonId()).getButtonAlias()); + item.setPermCode(map.get(item.getButtonId()).getPermCode()); + } + }); + return list; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java new file mode 100644 index 0000000..62b1ccd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java @@ -0,0 +1,102 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ComponentDepartment; +import org.jeecg.modules.dnc.mapper.ComponentDepartmentMapper; +import org.jeecg.modules.dnc.service.IComponentDepartmentService; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.apache.commons.collections4.ListUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + +@Service +public class ComponentDepartmentServiceImpl extends ServiceImpl<ComponentDepartmentMapper, ComponentDepartment> implements IComponentDepartmentService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByComponentId(String componentId) { + if(!ValidateUtil.validateString(componentId)) + return false; + LambdaQueryWrapper<ComponentDepartment> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ComponentDepartment::getComponentId, componentId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<Department> getDepartPermsByComponentId(String componentId) { + return super.getBaseMapper().getDepartPermsByComponentId(componentId); + } + + @Override + public List<Department> getDepartNonPermsByComponentId(String componentId) { + return super.getBaseMapper().getDepartNonPermsByComponentId(componentId); + } + + @Override + public ComponentDepartment getByComponentIdAndDepartId(String componentId, String departId) { + if(!ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(departId)) + return null; + List<ComponentDepartment> list = super.lambdaQuery().eq(ComponentDepartment::getComponentId, componentId).eq(ComponentDepartment::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<ComponentDepartment> componentDepartments) { + if(componentDepartments == null || componentDepartments.isEmpty()) + return false; + if(componentDepartments.size() == 1) { + return super.removeById(componentDepartments.get(0).getComponentDepartId()); + } + List<String> ids = new ArrayList<>(); + componentDepartments.forEach(item -> { + ids.add(item.getComponentDepartId()); + }); + if(ids.size() > 1000){ + List<List<String>> idsArr = ListUtils.partition(ids, 1000); + for(List<String> arr : idsArr){ + super.removeByIds(arr); + } + return true; + }else { + return super.removeByIds(ids); + } + } + + @Override + public List<ComponentDepartment> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> departIds) { + if(componentIds == null || componentIds.isEmpty() || departIds == null || departIds.isEmpty()) + return null; + List<ComponentDepartment> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> departListArr; + if(componentIds.size() > 1000){ + compListArr = ListUtils.partition(componentIds, 100); + }else { + compListArr = ListUtils.partition(componentIds, 1000); + } + if(departIds.size() > 1000){ + departListArr = ListUtils.partition(departIds, 100); + }else { + departListArr = ListUtils.partition(departIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<ComponentDepartment> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(ComponentDepartment::getComponentId, compList); + queryWrapper.in(ComponentDepartment::getDepartId, departList); + List<ComponentDepartment> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java new file mode 100644 index 0000000..3856ff5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java @@ -0,0 +1,549 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.dto.ComponentExt; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; +import org.jeecg.modules.dnc.mapper.ProductInfoMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ComponentInfoCode; +import org.jeecg.modules.dnc.response.ProductInfoCode; +import org.jeecg.modules.dnc.response.UcenterCode; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +@Service +public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService { + @Autowired + private IComponentPermissionService componentPermissionService; + @Autowired + public ProductInfoMapper productInfoMapper; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IComponentDepartmentService componentDepartmentService; + @Autowired + @Lazy + private IPartsInfoService partsInfoService; + @Autowired + private IProcessStreamService processStreamService; + @Autowired + private IDocInfoService docInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addComponentInfo(ComponentInfo componentInfo) { + if(componentInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(componentInfo.getComponentName())) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NAME_NONE); + if(!ValidateUtil.validateString(componentInfo.getProductId())) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PRODUCT_NONE); + if(!ValidateUtil.validateString(componentInfo.getComponentCode())) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_CODE_NONE); + ComponentInfo en = getByCode(componentInfo.getComponentCode()); + if(en != null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_IS_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + + List<PermissionStream> oldPermissionList; + ProductInfo productInfo = productInfoMapper.selectById(componentInfo.getProductId()); + if(productInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PRODUCT_NONE); + if (ValidateUtil.validateString(componentInfo.getParentId())) { + en = super.getById(componentInfo.getParentId()); + if(en == null) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST); + } + oldPermissionList = permissionStreamService.getByComponentId(en.getProductId(), en.getComponentId()); + componentInfo.setRankLevel(en.getRankLevel() + 1); + } else { + oldPermissionList = permissionStreamService.getByProductId(productInfo.getProductId()); + componentInfo.setParentId(null); + componentInfo.setRankLevel(1); + } + + componentInfo.setComponentStatus(1); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("閮ㄤ欢鍚嶇О锛�"+componentInfo.getComponentName()+"锛岄儴浠朵唬鍙凤細"+componentInfo.getComponentCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(componentInfo); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //閮ㄩ棬鏉冮檺 + List<ComponentDepartment> componentDepartmentList = new ArrayList<>(); + List<PermissionStream> componentDepartPermList = new ArrayList<>(); + if(oldPermissionList != null && !oldPermissionList.isEmpty()) { + oldPermissionList.forEach(item -> { + ComponentDepartment componentDepartment = new ComponentDepartment(); + componentDepartment.setComponentId(componentInfo.getComponentId()); + componentDepartment.setDepartId(item.getDepartId()); + componentDepartmentList.add(componentDepartment); + PermissionStream permissionStream = new PermissionStream(); + permissionStream.setProductId(componentInfo.getProductId()); + permissionStream.setComponentId(componentInfo.getComponentId()); + permissionStream.setDepartId(item.getDepartId()); + componentDepartPermList.add(permissionStream); + }); + } + if(!componentDepartmentList.isEmpty()) { + b = componentDepartmentService.saveBatch(componentDepartmentList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!componentDepartPermList.isEmpty()) { + b = permissionStreamService.saveBatch(componentDepartPermList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + ComponentPermission permission = new ComponentPermission(); + permission.setComponentId(componentInfo.getComponentId()); + permission.setUserId(userId); + b = componentPermissionService.save(permission); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞榛樿宸ュ簭 + ProcessStream processStream = new ProcessStream(); + processStream.setProductId(componentInfo.getProductId()); + processStream.setComponentId(componentInfo.getComponentId()); + processStream.setProcessCode("1"); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfogx = new NcLogInfo(); + //妯″潡 + ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfogx.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfogx.setLogContent("閮ㄤ欢鍚嶇О锛�"+componentInfo.getComponentName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfogx); + b = processStreamService.save(processStream); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏉冮檺 + PermissionStream stream = new PermissionStream(); + stream.setUserId(userId); + stream.setProductId(componentInfo.getProductId()); + stream.setComponentId(componentInfo.getComponentId()); + return permissionStreamService.save(stream); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editComponentInfo(String id, ComponentInfo componentInfo) { + if(!ValidateUtil.validateString(id) || componentInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + ComponentInfo en = super.getById(id); + if(en == null) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + } + componentInfo.setComponentId(id); + //璁剧疆涓虹┖ 鍒欎笉浼氭洿鏂� + componentInfo.setParentId(null); + componentInfo.setComponentStatus(null); + componentInfo.setRankLevel(null); + componentInfo.setProductId(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("淇敼閮ㄤ欢鍚嶇О锛�"+productInfoMapper.selectById(en.getProductId()).getProductName()+"瀛愰泦閮ㄤ欢"); + //淇敼淇濆瓨澶囨敞 + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.updateById(componentInfo); + if(!b) + return false; + ComponentPermission permission = componentPermissionService.getByComponentIdAndUserId(id, userId); + if(permission == null) { + permission = new ComponentPermission(); + permission.setComponentId(id); + permission.setUserId(userId); + b = componentPermissionService.save(permission); + if(!b) + return false; + } + PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(en.getProductId(), id, userId); + if(stream == null) { + stream = new PermissionStream(); + stream.setUserId(userId); + stream.setProductId(en.getProductId()); + stream.setComponentId(id); + return permissionStreamService.save(stream); + } + return b; + } + + @Override + public List<ComponentExt> findExtAll() { + return super.getBaseMapper().findExtAll(); + } + + @Override + public List<ComponentExt> getByUserPerms(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPerms(userId); + } + + @Override + public List<ComponentInfo> getByUserPerms(String userId, String queryParam) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + //鍘婚櫎鏉冮檺 TODO + LambdaQueryWrapper<ComponentInfo> queryWrapper = Wrappers.lambdaQuery(); + if(ValidateUtil.validateString(queryParam)) { + queryWrapper.and(wrapper->wrapper.like(ComponentInfo::getComponentCode, queryParam) + .or() + .like(ComponentInfo::getComponentName, queryParam)); + } + return super.list(queryWrapper); + } + + @Override + public List<ComponentExt> getByUserPermsAs(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPermsAs(userId); + } + + @Override + public List<ComponentInfo> getByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return null; + return super.lambdaQuery().eq(ComponentInfo::getProductId, productId).list(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteCollections(List<ComponentInfo> componentInfoList) { + componentInfoList.forEach(item -> { + boolean b = componentPermissionService.deleteByComponentId(item.getComponentId()); + if(!b) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); + b = componentDepartmentService.deleteByComponentId(item.getComponentId()); + if(!b) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); + b = permissionStreamService.deleteUserPermsByComponentId(item.getProductId(), item.getComponentId()); + if(!b) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); + b = permissionStreamService.deleteDepartPermsByComponentId(item.getProductId(), item.getComponentId()); + if(!b) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); + b = super.removeById(item.getComponentId()); + if(!b) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); + }); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteComponentInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_ERROR); + ComponentInfo componentInfo = super.getById(id); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_ERROR); + List<ComponentInfo> childrenList = getByParentId(id); + if(childrenList != null && !childrenList.isEmpty()) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_CHILD_EXIST); + } + //楠岃瘉浜у搧涓嬫槸鍚︽湁闆朵欢 + List<PartsInfo> partsInfoList = partsInfoService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARTS_EXIST); + } + List<ProcessStream> processStreamList = processStreamService.findByComponentId(id); + if(processStreamList != null && !processStreamList.isEmpty()) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PROCESS_EXIST); + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("閮ㄤ欢鍚嶇О锛�"+componentInfo.getComponentName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = docInfoService.deleteByComponentId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = componentPermissionService.deleteByComponentId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = componentDepartmentService.deleteByComponentId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteUserPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteDepartPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return super.removeById(id); + } + + @Override + public List<ComponentInfo> getByParentId(String componentId) { + List<ComponentExt> componentExtList = super.getBaseMapper().findByParentId(componentId); + if(componentExtList == null || componentExtList.isEmpty()) + return null; + List<ComponentInfo> list = new ArrayList<>(); + componentExtList.forEach(item -> { + item.getAllChildren(list); + }); + return list; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(ComponentInfo componentInfo, Collection<SysUser> userList) { + if(componentInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ComponentPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId()); + if(en == null) { + en = new ComponentPermission(); + en.setUserId(item.getId()); + en.setComponentId(componentInfo.getComponentId()); + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setUserId(item.getId()); + stream.setProductId(componentInfo.getProductId()); + stream.setComponentId(componentInfo.getComponentId()); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = componentPermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(ComponentInfo componentInfo, Collection<SysUser> userList) { + if(componentInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ComponentPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId()); + if(en != null) { + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //鏍¢獙閮ㄤ欢鐢ㄦ埛鏉冮檺娓呯┖鎿嶄綔 + List<ComponentPermission> existList = componentPermissionService.getByComponentId(componentInfo.getComponentId()); + if(existList.size() <= permissionList.size()) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_USER_NONE); + if(!permissionList.isEmpty()) { + boolean b = componentPermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { + if(componentInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ComponentDepartment> componentDepartments = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); + if(en == null) { + en = new ComponentDepartment(); + en.setDepartId(item.getDepartId()); + en.setComponentId(componentInfo.getComponentId()); + componentDepartments.add(en); + } + PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setDepartId(item.getDepartId()); + stream.setProductId(componentInfo.getProductId()); + stream.setComponentId(componentInfo.getComponentId()); + permissionStreamList.add(stream); + } + }); + if(!componentDepartments.isEmpty()) { + boolean b = componentDepartmentService.saveBatch(componentDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { + if(componentInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ComponentDepartment> componentDepartments = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); + if(en != null) { + componentDepartments.add(en); + } + PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + if(!componentDepartments.isEmpty()) { + boolean b = componentDepartmentService.removeByCollection(componentDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + public ComponentInfo getByCode(String code) { + if(ValidateUtil.validateString(code)) { + List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getComponentCode, code).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + return null; + } + + @Override + public PermissionStream validateComponentOrPartsPnCode(String pnCode) { + if(!ValidateUtil.validateString(pnCode)) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_VALID); + } + PermissionStream stream = new PermissionStream(); + List<ComponentInfo> componentInfos = super.lambdaQuery().eq(ComponentInfo::getComponentCode, pnCode).list(); + if(componentInfos == null || componentInfos.isEmpty()) { + List<PartsInfo> list = partsInfoService.lambdaQuery().eq(PartsInfo::getPartsCode, pnCode).list(); + if(list == null || list.isEmpty()) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_EXIST); + }else if(list.size() != 1) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_ONLY); + }else { + PartsInfo partsInfo = list.get(0); + stream.setProductId(partsInfo.getProductId()); + stream.setComponentId(partsInfo.getComponentId()); + stream.setPartsId(partsInfo.getPartsId()); + return stream; + } + }else if(componentInfos.size() != 1){ + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_ONLY); + }else { + List<PartsInfo> list = partsInfoService.lambdaQuery().eq(PartsInfo::getPartsCode, pnCode).list(); + if(list != null && list.size() > 0) { + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_ONLY); + } + ComponentInfo componentInfo = componentInfos.get(0); + stream.setProductId(componentInfo.getProductId()); + stream.setComponentId(componentInfo.getComponentId()); + return stream; + } + return null; + } + + @Override + public List<ComponentInfo> getByProductIdAndUserId(String productId, String userId) { + //鍘婚櫎鏉冮檺 TODO + //return super.getBaseMapper().selectByProductIdAndUserId(productId, userId); + LambdaQueryWrapper<ComponentInfo> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.eq(ComponentInfo::getProductId, productId); + queryWrapper.eq(ComponentInfo::getRankLevel, 1); + queryWrapper.orderByAsc(ComponentInfo::getCreateTime); + return super.list(queryWrapper); + } + + @Override + public List<ComponentInfo> getByParentIdAndUserId(String parentId, String userId) { + //鍘婚櫎鏉冮檺 TODO + //return super.getBaseMapper().selectByParentIdAndUserId(parentId, userId); + LambdaQueryWrapper<ComponentInfo> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.eq(ComponentInfo::getParentId, parentId); + queryWrapper.orderByAsc(ComponentInfo::getCreateTime); + return super.list(queryWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPermissionServiceImpl.java new file mode 100644 index 0000000..fd6b0d0 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPermissionServiceImpl.java @@ -0,0 +1,104 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ComponentPermission; +import org.jeecg.modules.dnc.mapper.ComponentPermissionMapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.service.IComponentPermissionService; +import org.apache.commons.collections4.ListUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +public class ComponentPermissionServiceImpl extends ServiceImpl<ComponentPermissionMapper, ComponentPermission> implements IComponentPermissionService { + @Override + public ComponentPermission getByComponentIdAndUserId(String componentId, String userId) { + if(!ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(userId)) + return null; + List<ComponentPermission> permissions = super.lambdaQuery().eq(ComponentPermission::getComponentId, componentId).eq(ComponentPermission::getUserId, userId).list(); + if(permissions == null || permissions.isEmpty()) + return null; + return permissions.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByComponentId(String componentId) { + if(!ValidateUtil.validateString(componentId)) + return false; + LambdaQueryWrapper<ComponentPermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ComponentPermission::getComponentId, componentId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<UserDepartExt> getUserPermsByComponentId(String componentId) { + return super.getBaseMapper().getUserPermsByComponentId(componentId); + } + + @Override + public List<SysUser> getUserNonPermsByComponentId(String componentId) { + return super.getBaseMapper().getUserNonPermsByComponentId(componentId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<ComponentPermission> permissionList) { + if(permissionList == null || permissionList.isEmpty()) + return false; + if(permissionList.size() == 1) + return super.removeById(permissionList.get(0).getComponentPermId()); + List<String> ids = new ArrayList<>(); + permissionList.forEach(item -> { + ids.add(item.getComponentPermId()); + }); + return super.removeByIds(ids); + } + + @Override + public List<ComponentPermission> getByComponentId(String componentId) { + List<ComponentPermission> list = super.lambdaQuery().eq(ComponentPermission::getComponentId, componentId).list(); + if(list == null) + list = Collections.emptyList(); + return list; + } + + @Override + public List<ComponentPermission> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds) { + if(componentIds == null || componentIds.isEmpty() || userIds == null || userIds.isEmpty()) + return null; + List<ComponentPermission> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> userListArr; + if(componentIds.size() > 1000){ + compListArr = ListUtils.partition(componentIds, 100); + }else { + compListArr = ListUtils.partition(componentIds, 1000); + } + if(userIds.size() > 1000){ + userListArr = ListUtils.partition(userIds, 100); + }else { + userListArr = ListUtils.partition(userIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> userList : userListArr){ + LambdaQueryWrapper<ComponentPermission> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(ComponentPermission::getComponentId, compList); + queryWrapper.in(ComponentPermission::getUserId, userList); + List<ComponentPermission> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java new file mode 100644 index 0000000..9bb7210 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java @@ -0,0 +1,81 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.dto.DepartApproveUser; +import org.jeecg.modules.dnc.mapper.DepartApproveUserMapper; +import org.jeecg.modules.dnc.service.IDepartApproveUserService; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class DepartApproveUserServiceImpl extends ServiceImpl<DepartApproveUserMapper, DepartApproveUser> implements IDepartApproveUserService { + @Override + public List<String> getByDepartIds(List<String> departIds) { + if(departIds == null || departIds.isEmpty()) + return null; + List<DepartApproveUser> list = super.lambdaQuery().in(DepartApproveUser::getDepartId, departIds).list(); + if(list == null || list.isEmpty()) + return null; + List<String> userIds = new ArrayList<>(); + list.forEach(item -> { + userIds.add(item.getUserId()); + }); + return userIds; + } + + @Override + public Map<String, DepartApproveUser> getByDepartId(String departId) { + if(!ValidateUtil.validateString(departId)) + return null; + List<DepartApproveUser> list = super.lambdaQuery().eq(DepartApproveUser::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + Map<String, DepartApproveUser> map = new HashMap<>(); + list.forEach(item ->{ + map.put(item.getUserId(), item); + }); + return map; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDepartId(String departId) { + if(!ValidateUtil.validateString(departId)) + return false; + LambdaQueryWrapper<DepartApproveUser> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DepartApproveUser::getDepartId, departId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public DepartApproveUser getByDepartIdAndUserId(String departId, String userId) { + if(!ValidateUtil.validateString(departId) || !ValidateUtil.validateString(userId)) + return null; + List<DepartApproveUser> list = super.lambdaQuery().eq(DepartApproveUser::getDepartId, departId).eq(DepartApproveUser::getUserId, userId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DepartApproveUser> list) { + if(list == null || list.isEmpty()) + return false; + if(list.size() == 1) + return super.removeById(list.get(0).getApproveId()); + List<String> ids = new ArrayList<>(); + list.forEach(item -> { + ids.add(item.getApproveId()); + }); + return super.removeByIds(ids); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java new file mode 100644 index 0000000..1f6bdf9 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java @@ -0,0 +1,278 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.activiti.entity.ActivitiDefinition; +import org.jeecg.modules.activiti.service.IActivitiDefinitionService; +import org.jeecg.modules.dnc.dto.DepartApproveUser; +import org.jeecg.modules.dnc.dto.DepartmentExt; +import org.jeecg.modules.dnc.dto.DepartmentUser; +import org.jeecg.modules.dnc.entity.DevicePermissionStream; +import org.jeecg.modules.dnc.entity.PermissionStream; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DepartmentMapper; +import org.jeecg.modules.dnc.request.DepartmentRequest; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.CommonJsonTree; +import org.jeecg.modules.dnc.response.DepartmentCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.service.support.DepartmentTreeWrapper; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +@Service +public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService { + @Autowired + private ISysUserService userService; + @Autowired + private IDepartApproveUserService departApproveUserService; + @Autowired + private IDepartmentUserService departmentUserService; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IDevicePermissionStreamService devicePermissionStreamService; + @Autowired + private IActivitiDefinitionService activitiDefinitionService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDepartment(Department department) { + if(department == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(department.getDepartCode())) + ExceptionCast.cast(DepartmentCode.DEPART_CODE_NONE); + if(!ValidateUtil.validateString(department.getDepartName())) + ExceptionCast.cast(DepartmentCode.DEPART_NAME_NONE); + Department en = this.getByDepartCode(department.getDepartCode(), null); + if(en != null) + ExceptionCast.cast(DepartmentCode.DEPART_IS_EXIST); + if(ValidateUtil.validateString(department.getParentId())) { + Department parent = super.getById(department.getParentId()); + if(parent == null) + ExceptionCast.cast(DepartmentCode.DEPART_PARENT_NOT_EXIST); + department.setRankLevel(parent.getRankLevel() + 1); + }else { + department.setParentId(null); + department.setRankLevel(1); + } + return super.save(department); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editDepartment(String id, Department department) { + if(!ValidateUtil.validateString(id) || department == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Department en = super.getById(id); + if (en == null) + ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); + department.setDepartId(id); + department.setDepartCode(null); + if(ValidateUtil.validateString(department.getParentId())) { + if (!department.getParentId().equals(en.getParentId())) { + Department parent = super.getById(department.getParentId()); + if(parent == null) + ExceptionCast.cast(DepartmentCode.DEPART_PARENT_NOT_EXIST); + department.setRankLevel(parent.getRankLevel() + 1); + } + }else { + department.setRankLevel(1); + } + return super.updateById(department); + } + + @Override + public Department getByDepartCode(String departCode, String departId) { + if(!ValidateUtil.validateString(departCode)) + return null; + LambdaQueryChainWrapper<Department> lambdaQueryChain = super.lambdaQuery(); + lambdaQueryChain.eq(Department::getDepartCode, departCode); + if(ValidateUtil.validateString(departId)) { + lambdaQueryChain.ne(Department::getDepartId, departCode); + } + List<Department> departmentList = lambdaQueryChain.list(); + if(!ValidateUtil.validateString(departCode)) + return null; + if(departmentList == null || departmentList.isEmpty()) + return null; + return departmentList.get(0); + } + + @Override + public List<Department> getUserNonPermDepart(String userId) { + return super.getBaseMapper().getUserNonPermDepart(userId); + } + + @Override + public List<Department> getUserPermDepart(String userId) { + return super.getBaseMapper().getUserPermDepart(userId); + } + + @Override + public QueryPageResponseResult<Department> findPageList(int page, int size, DepartmentRequest requestParams) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<Department> pageData = new Page<>(page, size); + LambdaQueryChainWrapper<Department> lambdaQuery = super.lambdaQuery(); + if(requestParams != null) { + if(ValidateUtil.validateString(requestParams.getDepartName())) { + lambdaQuery.like(Department::getDepartName, requestParams.getDepartName()); + } + if(ValidateUtil.validateString(requestParams.getDepartCode())) { + lambdaQuery.like(Department::getDepartCode, requestParams.getDepartCode()); + } + if(ValidateUtil.validateString(requestParams.getId())) { + lambdaQuery.eq(Department::getParentId,requestParams.getId()); + } + if(ValidateUtil.validateString(requestParams.getAscStr())) { + String[] ascArr = requestParams.getAscStr().split(","); +// ((Page<Department>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(requestParams.getDescStr())) { + String[] descStr = requestParams.getDescStr().split(","); +// ((Page<Department>) pageData).setDesc(descStr); + } + } + IPage<Department> userIPage = lambdaQuery.page(pageData); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartmentById(String id) { + if(!ValidateUtil.validateString(id)) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + Department en = super.getById(id); + if (en == null) + ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); + List<Department> list = findSunLint(id); + if (list != null && list.size() > 0) { + ExceptionCast.cast(DepartmentCode.DEPART_SUN_EXIST); + } + List<DepartmentUser> departmentUserList = departmentUserService.findByDepartId(id); + if(departmentUserList != null && !departmentUserList.isEmpty()) + ExceptionCast.cast(DepartmentCode.DEPART_USER_EXIST); + List<PermissionStream> permissionStreamList = permissionStreamService.findByDepartId(id); + if(permissionStreamList != null && !permissionStreamList.isEmpty()) + ExceptionCast.cast(DepartmentCode.DEPART_PRODUCT_EXIST); + List<DevicePermissionStream> devicePermissionStreams = devicePermissionStreamService.findByDepartId(id); + if(devicePermissionStreams != null && !devicePermissionStreams.isEmpty()) + ExceptionCast.cast(DepartmentCode.DEPART_DEVICE_EXIST); + ActivitiDefinition activitiDefinition = activitiDefinitionService.getByDepartId(id); + if(activitiDefinition != null) + ExceptionCast.cast(DepartmentCode.DEPART_ACT_EXIST); + return super.removeById(id); + } + + @Override + public List<Department> findSunLint(String parentId) { + if(!ValidateUtil.validateString(parentId)) + return null; + List<Department> list = super.lambdaQuery().eq(Department::getParentId, parentId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + public List<CommonJsonTree> loadTree() { + List<DepartmentExt> multilevelExt = this.getBaseMapper().findExtAll(); + return DepartmentTreeWrapper.loadTree(multilevelExt); + } + + @Override + public Map<String, Department> getMapByUserId(String userId) { + if(!ValidateUtil.validateString(userId)) + return null; + List<Department> userPermDepart = getUserPermDepart(userId); + if(userPermDepart == null || userPermDepart.isEmpty()) + return null; + Map<String, Department> map = new HashMap<>(); + userPermDepart.forEach(item -> { + map.put(item.getDepartId(), item); + }); + return map; + } + + @Override + public List<SysUser> getUserNonApproveDepart(String departId) { + return super.getBaseMapper().getUserNonApproveDepart(departId); + } + + @Override + public List<SysUser> getUserApproveDepart(String departId) { + return super.getBaseMapper().getUserApproveDepart(departId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddApproveUser(String departId, Integer relativeFlag, String[] userIds) { + if(!ValidateUtil.validateString(departId) ||! ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); + Department en = super.getById(departId); + if(en == null) + ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); + List<String> userIdList = new ArrayList<>(userIds.length); + Collections.addAll(userIdList, userIds); + Collection<SysUser> userCollection = userService.listByIds(userIdList); + if(userCollection == null || userCollection.size() != userIds.length) + ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); + List<DepartApproveUser> permissionList = new ArrayList<>(); + userCollection.forEach(item -> { + DepartApproveUser approveUser = departApproveUserService.getByDepartIdAndUserId(en.getDepartId(), item.getId()); + if(approveUser == null) { + approveUser = new DepartApproveUser(); + approveUser.setUserId(item.getId()); + approveUser.setDepartId(en.getDepartId()); + permissionList.add(approveUser); + } + }); + if(!permissionList.isEmpty()) { + return departApproveUserService.saveBatch(permissionList); + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveApproveUser(String departId, Integer relativeFlag, String[] userIds) { + if(!ValidateUtil.validateString(departId) ||! ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); + Department en = super.getById(departId); + if(en == null) + ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); + List<String> userIdList = new ArrayList<>(userIds.length); + Collections.addAll(userIdList, userIds); + Collection<SysUser> userCollection = userService.listByIds(userIdList); + if(userCollection == null || userCollection.size() != userIds.length) + ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); + List<DepartApproveUser> permissionList = new ArrayList<>(); + userCollection.forEach(item -> { + DepartApproveUser approveUser = departApproveUserService.getByDepartIdAndUserId(en.getDepartId(), item.getId()); + if(approveUser != null) { + permissionList.add(approveUser); + } + }); + if(!permissionList.isEmpty()) { + return departApproveUserService.removeByCollection(permissionList); + } + return false; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java new file mode 100644 index 0000000..aaeefb1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.dto.DepartmentUser; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DepartmentUserMapper; +import org.jeecg.modules.dnc.response.UcenterCode; +import org.jeecg.modules.dnc.service.IDepartmentUserService; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class DepartmentUserServiceImpl extends ServiceImpl<DepartmentUserMapper, DepartmentUser> implements IDepartmentUserService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByUserId(String userId) { + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_USER_ID_NONE); + LambdaQueryWrapper<DepartmentUser> lambdaUpdate = Wrappers.lambdaQuery(); + lambdaUpdate.eq(DepartmentUser::getUserId, userId); + return super.remove(lambdaUpdate); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DepartmentUser> list) { + if(list == null || list.isEmpty()) + return false; + if(list.size() == 1) + return super.removeById(list.get(0).getDepartUserId()); + List<String> ids = new ArrayList<>(); + list.forEach(item -> { + ids.add(item.getDepartUserId()); + }); + return super.removeByIds(ids); + } + + @Override + public DepartmentUser getByUserIdAndDepartId(String userId, String departId) { + if(!ValidateUtil.validateString(userId) || !ValidateUtil.validateString(departId)) + return null; + List<DepartmentUser> list = super.lambdaQuery().eq(DepartmentUser::getUserId, userId).eq(DepartmentUser::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<DepartmentUser> findByDepartId(String departId) { + return super.lambdaQuery().eq(DepartmentUser::getDepartId, departId).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceCharactersServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceCharactersServiceImpl.java new file mode 100644 index 0000000..d967588 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceCharactersServiceImpl.java @@ -0,0 +1,38 @@ +package org.jeecg.modules.dnc.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DeviceCharacters; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DeviceCharactersMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.dnc.request.DeviceCharactersRequest; +import org.jeecg.modules.dnc.service.IDeviceCharactersService; +import org.springframework.stereotype.Service; + +@Service +public class DeviceCharactersServiceImpl extends ServiceImpl<DeviceCharactersMapper, DeviceCharacters> implements IDeviceCharactersService { + @Override + public QueryPageResponseResult<DeviceCharacters> findByPageList(int page, int size, DeviceCharactersRequest deviceCharactersRequest) { + + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<DeviceCharacters> pageData = new Page<>(page, size); + LambdaQueryChainWrapper<DeviceCharacters> lambdaQuery = super.lambdaQuery(); + if(deviceCharactersRequest != null) { + lambdaQuery.like(StrUtil.isNotEmpty(deviceCharactersRequest.getDeviceNo()),DeviceCharacters::getDeviceNo, deviceCharactersRequest.getDeviceNo()); + lambdaQuery.eq(StrUtil.isNotEmpty(deviceCharactersRequest.getDepartId()),DeviceCharacters::getDepartId, deviceCharactersRequest.getDepartId()); + lambdaQuery.like(StrUtil.isNotEmpty(deviceCharactersRequest.getControlSystem()),DeviceCharacters::getControlSystem, deviceCharactersRequest.getControlSystem()); + lambdaQuery.like(StrUtil.isNotEmpty(deviceCharactersRequest.getCharacters()),DeviceCharacters::getCharacters, deviceCharactersRequest.getCharacters()); + lambdaQuery.ge(StrUtil.isNotEmpty(deviceCharactersRequest.getStartTime()),DeviceCharacters::getCreateTime,deviceCharactersRequest.getStartTime()); + lambdaQuery.le(StrUtil.isNotEmpty(deviceCharactersRequest.getEndTime()),DeviceCharacters::getCreateTime,deviceCharactersRequest.getEndTime()); + } + IPage<DeviceCharacters> userIPage = lambdaQuery.page(pageData); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java new file mode 100644 index 0000000..91b3247 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java @@ -0,0 +1,60 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DeviceGroupDepart; +import org.jeecg.modules.dnc.mapper.DeviceGroupDepartMapper; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IDeviceGroupDepartService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class DeviceGroupDepartServiceImpl extends ServiceImpl<DeviceGroupDepartMapper, DeviceGroupDepart> implements IDeviceGroupDepartService { + @Override + public List<Department> getDepartPermsByGroupId(String groupId) { + return super.getBaseMapper().getDepartPermsByGroupId(groupId); + } + + @Override + public List<Department> getDepartNonPermsByGroupId(String groupId) { + return super.getBaseMapper().getDepartNonPermsByGroupId(groupId); + } + + @Override + public DeviceGroupDepart getDepartByGroupAndDepartId(String groupId, String departId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(departId)) + return null; + List<DeviceGroupDepart> list = super.lambdaQuery().eq(DeviceGroupDepart::getGroupId, groupId).eq(DeviceGroupDepart::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DeviceGroupDepart> departList) { + if(departList == null || departList.isEmpty()) + return false; + if(departList.size() == 1) + return super.removeById(departList.get(0).getGroupDepartId()); + List<String> ids = new ArrayList<>(); + departList.forEach(item -> { + ids.add(item.getGroupDepartId()); + }); + return super.removeByIds(ids); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByGroupId(String groupId) { + LambdaQueryWrapper<DeviceGroupDepart> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DeviceGroupDepart::getGroupId, groupId); + return super.remove(lambdaQueryWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java new file mode 100644 index 0000000..34577b1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupPermissionServiceImpl.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DeviceGroupPermission; +import org.jeecg.modules.dnc.mapper.DeviceGroupPermissionMapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.service.IDeviceGroupPermissionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +public class DeviceGroupPermissionServiceImpl extends ServiceImpl<DeviceGroupPermissionMapper, DeviceGroupPermission> implements IDeviceGroupPermissionService { + @Override + public List<UserDepartExt> getUserPermsByGroupId(String groupId) { + return super.getBaseMapper().getUserPermsByGroupId(groupId); + } + + @Override + public List<SysUser> getUserNonPermsByGroupId(String groupId) { + return super.getBaseMapper().getUserNonPermsByGroupId(groupId); + } + + @Override + public DeviceGroupPermission getByUserIdAndGroupId(String userId, String groupId) { + if(!ValidateUtil.validateString(userId) || !ValidateUtil.validateString(groupId)) + return null; + List<DeviceGroupPermission> list = super.lambdaQuery().eq(DeviceGroupPermission::getGroupId, groupId).eq(DeviceGroupPermission::getUserId, userId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DeviceGroupPermission> permissions) { + if(permissions == null || permissions.isEmpty()) + return false; + if(permissions.size() == 1){ + super.removeById(permissions.get(0).getGroupPermId()); + } + List<String> ids = new ArrayList<>(); + permissions.forEach(item -> { + ids.add(item.getGroupPermId()); + }); + return super.removeByIds(ids); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByGroupId(String groupId) { + LambdaQueryWrapper<DeviceGroupPermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DeviceGroupPermission::getGroupId, groupId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<DeviceGroupPermission> getByGroupId(String groupId) { + List<DeviceGroupPermission> list = super.lambdaQuery().eq(DeviceGroupPermission::getGroupId, groupId).list(); + if(list == null) + list = Collections.emptyList(); + return list; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java new file mode 100644 index 0000000..e518cdb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java @@ -0,0 +1,530 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.dto.DeviceGroupExt; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DeviceGroupMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.DeviceGroupCode; +import org.jeecg.modules.dnc.response.UcenterCode; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.apache.commons.lang3.StringUtils; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +@Service +public class DeviceGroupServiceImpl extends ServiceImpl<DeviceGroupMapper, DeviceGroup> implements IDeviceGroupService { + @Autowired + private IDeviceGroupPermissionService groupPermissionService; + @Autowired + private IDevicePermissionStreamService devicePermissionStreamService; + @Autowired + private IDeviceGroupDepartService deviceGroupDepartService; + @Autowired + private IDepartmentService departmentService; + @Autowired + @Lazy + private IDeviceInfoService deviceInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDeviceGroup(DeviceGroup deviceGroup) { + if(deviceGroup == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(deviceGroup.getGroupName())) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NAME); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + DeviceGroup en = findByGroupName(deviceGroup.getGroupName()); + if(en != null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_EXIST); + } + List<DevicePermissionStream> oldDepartPermList = null; + if (ValidateUtil.validateString(deviceGroup.getParentId())) { + en = super.getById(deviceGroup.getParentId()); + if(en == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PARENT_NOT_EXIST); + } + deviceGroup.setRankLevel(en.getRankLevel() + 1); + oldDepartPermList = devicePermissionStreamService.getDepartPermByGroupId(en.getGroupId()); + } else { + deviceGroup.setParentId(null); + deviceGroup.setRankLevel(1); + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+deviceGroup.getGroupName()+"锛屽垎缁勬弿杩帮細"+deviceGroup.getDescription()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(deviceGroup); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR); + } + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<DeviceGroupDepart> groupDepartList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + oldDepartPermList.forEach(item -> { + DeviceGroupDepart dp = new DeviceGroupDepart(); + dp.setDepartId(item.getDepartId()); + dp.setGroupId(deviceGroup.getGroupId()); + groupDepartList.add(dp); + DevicePermissionStream stream = new DevicePermissionStream(); + stream.setDepartId(item.getDepartId()); + stream.setGroupId(deviceGroup.getGroupId()); + permissionStreamList.add(stream); + }); + if(!groupDepartList.isEmpty()) { + b = deviceGroupDepartService.saveBatch(groupDepartList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!permissionStreamList.isEmpty()) { + b = devicePermissionStreamService.saveBatch(permissionStreamList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + } + DeviceGroupPermission permission = new DeviceGroupPermission(); + permission.setGroupId(deviceGroup.getGroupId()); + permission.setUserId(userId); + b = groupPermissionService.save(permission); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR); + } + DevicePermissionStream stream = new DevicePermissionStream(); + stream.setGroupId(deviceGroup.getGroupId()); + stream.setUserId(userId); + if (StringUtils.isNotBlank(deviceGroup.getParentId())) { + String path = null; + List<String> strings = findListParentTree(deviceGroup.getParentId(),null); + if (strings != null && !strings.isEmpty()) { + path = StringUtils.join(strings.toArray(), "/"); + } + FileUtilS.saveFileFromPath(path + "/" + deviceGroup.getGroupName()); + } else { + FileUtilS.saveFileFromPath(deviceGroup.getGroupName()); + } + return devicePermissionStreamService.save(stream); + } + + @Override + public DeviceGroup findByGroupName(String groupName) { + if(!ValidateUtil.validateString(groupName)) + return null; + List<DeviceGroup> list = super.lambdaQuery().eq(DeviceGroup::getGroupName, groupName).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editDeviceGroup(String id, DeviceGroup deviceGroup) { + if(!ValidateUtil.validateString(id) || deviceGroup == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceGroup en = super.getById(id); + if(en == null) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + deviceGroup.setGroupId(id); + deviceGroup.setParentId(null); + deviceGroup.setRankLevel(null); + if (StringUtils.isNotBlank(en.getParentId())) { + String path = null; + List<String> strings = findListParentTree(en.getParentId(),null); + if (strings != null && !strings.isEmpty()) { + path = StringUtils.join(strings.toArray(), "/"); + } + FileUtilS.updateFileFromPath( path + "/"+ deviceGroup.getGroupName(), + path + "/"+ en.getGroupName()); + } else { + FileUtilS.updateFileFromPath(deviceGroup.getGroupName(),en.getGroupName()); + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+deviceGroup.getGroupName()); + //淇敼淇濆瓨澶囨敞 + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.updateById(deviceGroup); + } + // 鏌ヨ鎵�浠ョ埗鑺傜偣 + @Override + public List<String> findListParentTree(String parentId,List<String> stringList){ + if (StringUtils.isEmpty(parentId)) { + return null; + } + if (stringList == null || stringList.isEmpty()) { + stringList = new ArrayList<>(); + } + boolean p = true; + if (p) { + DeviceGroup en = super.getById(parentId); + if (en != null) { + stringList.add(0,en.getGroupName()); + } + if (StringUtils.isNotBlank(en.getParentId())) { + parentId = en.getParentId(); + findListParentTree(parentId,stringList); + } else { + p = false; + return stringList; + } + } + return stringList; + } + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDeviceGroup(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceGroup en = super.getById(id); + if(en == null) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + List<DeviceGroup> childList = getChildrenByParentId(id); + if(childList != null && !childList.isEmpty()) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_CHILD_EXIST); + List<DeviceInfo> deviceInfoList = deviceInfoService.getByGroupId(en.getGroupId()); + if(deviceInfoList != null && !deviceInfoList.isEmpty()) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_DEVICE_EXIST); + boolean b = groupPermissionService.deleteByGroupId(en.getGroupId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deviceGroupDepartService.deleteByGroupId(en.getGroupId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = devicePermissionStreamService.deleteUserByGroupId(en.getGroupId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = devicePermissionStreamService.deleteDepartByGroupId(en.getGroupId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //鍒犻櫎瀵瑰簲鏂囦欢 + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+en.getGroupName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(en.getGroupId()); + } + + @Override + public List<DeviceGroupExt> findExtAll() { + return super.getBaseMapper().findExtAll(); + } + + @Override + public List<DeviceGroupExt> getByUserPerms(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPerms(userId); + } + + @Override + public List<DeviceGroupExt> getByUserPermsAs(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPermsAs(userId); + } + @Override + public List<String> findListParentTreeAll(String groupId) { + if ( StringUtils.isEmpty(groupId)) { + return null; + } + List<String> strings = new ArrayList<>(); + DeviceGroup en = super.getById(groupId); + if (en == null) { + return null; + } + strings.add(en.getGroupName()); + if (StringUtils.isEmpty(en.getParentId())) { + return strings; + } else { + return findListParentTree(en.getParentId(),strings); + } + } + @Override + public List<DeviceGroup> getChildrenByParentId(String groupId) { + if(!ValidateUtil.validateString(groupId)) + return null; + List<DeviceGroupExt> extList = super.getBaseMapper().findByParentId(groupId); + if(extList == null || extList.isEmpty()) + return null; + List<DeviceGroup> list = new ArrayList<>(); + extList.forEach(item -> { + item.getAllChildren(list); + }); + return list; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(DeviceGroup deviceGroup, Collection<SysUser> userList) { + if(deviceGroup == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DeviceGroupPermission> permissionList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + DeviceGroupPermission en = groupPermissionService.getByUserIdAndGroupId(item.getId(), deviceGroup.getGroupId()); + if(en == null) { + en = new DeviceGroupPermission(); + en.setUserId(item.getId()); + en.setGroupId(deviceGroup.getGroupId()); + permissionList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndUserId(deviceGroup.getGroupId(), item.getId()); + if(stream == null) { + stream = new DevicePermissionStream(); + stream.setUserId(item.getId()); + stream.setGroupId(deviceGroup.getGroupId()); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = groupPermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(DeviceGroup deviceGroup, Collection<SysUser> userList) { + if(deviceGroup == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DeviceGroupPermission> permissionList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + DeviceGroupPermission en = groupPermissionService.getByUserIdAndGroupId(item.getId(), deviceGroup.getGroupId()); + if(en != null) { + permissionList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndUserId(deviceGroup.getGroupId(), item.getId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //鏍¢獙娓呯┖璁惧鍒嗙粍鏉冮檺鎿嶄綔 + List<DeviceGroupPermission> existList = groupPermissionService.getByGroupId(deviceGroup.getGroupId()); + if(existList.size() <= permissionList.size()) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_USER_NONE); + if(!permissionList.isEmpty()) { + boolean b = groupPermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + return true; + } + + @Override + public List<Department> getDepartPermsList(String groupId) { + return deviceGroupDepartService.getDepartPermsByGroupId(groupId); + } + + @Override + public List<Department> getDepartNonPermsList(String groupId) { + return deviceGroupDepartService.getDepartNonPermsByGroupId(groupId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<String> ids = new ArrayList<>(departmentIds.length); + Collections.addAll(ids, departmentIds); + Collection<Department> departmentList = departmentService.listByIds(ids); + if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceGroup deviceGroup = super.getById(groupId); + if(deviceGroup == null) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b1 = assignAddDepartment(deviceGroup, departmentList); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + if(relativeFlag == 1) { + //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� + List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); + if(childrenList != null && !childrenList.isEmpty()) { + childrenList.forEach(item -> { + boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); + if(b) { + b = assignAddDepartment(item, departmentList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + }); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<String> ids = new ArrayList<>(departmentIds.length); + Collections.addAll(ids, departmentIds); + Collection<Department> departmentList = departmentService.listByIds(ids); + if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceGroup deviceGroup = super.getById(groupId); + if(deviceGroup == null) + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b1 = assignRemoveDepartment(deviceGroup, departmentList); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + if(relativeFlag == 1) { + //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� + List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); + if(childrenList != null && !childrenList.isEmpty()) { + childrenList.forEach(item -> { + boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); + if(b) { + b = assignRemoveDepartment(item, departmentList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + }); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) { + if(deviceGroup == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DeviceGroupDepart> deviceGroupDepartList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); + if(en == null) { + en = new DeviceGroupDepart(); + en.setDepartId(item.getDepartId()); + en.setGroupId(deviceGroup.getGroupId()); + deviceGroupDepartList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); + if(stream == null) { + stream = new DevicePermissionStream(); + stream.setDepartId(item.getDepartId()); + stream.setGroupId(deviceGroup.getGroupId()); + permissionStreamList.add(stream); + } + }); + if(!deviceGroupDepartList.isEmpty()) { + boolean b = deviceGroupDepartService.saveBatch(deviceGroupDepartList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) { + if(deviceGroup == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DeviceGroupDepart> departList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); + if(en != null) { + departList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + if(!departList.isEmpty()) { + boolean b = deviceGroupDepartService.removeByCollection(departList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + return true; + } + + @Override + public List<DeviceGroupExt> findExtByDeparts(List<String> departIds) { + return super.getBaseMapper().findExtByDeparts(departIds); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java new file mode 100644 index 0000000..60a0d52 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java @@ -0,0 +1,580 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.dto.DeviceGroupExt; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DeviceInfoMapper; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.service.support.DeviceTreeWrapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.dnc.response.DeviceCode; +import org.jeecg.modules.dnc.response.DeviceGroupCode; +import org.jeecg.modules.dnc.response.UcenterCode; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +@Service +public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements IDeviceInfoService { + + @Autowired + private IDevicePermissionService devicePermissionService; + @Autowired + @Lazy + private IDeviceGroupService deviceGroupService; + @Autowired + private IDeviceGroupPermissionService deviceGroupPermissionService; + @Autowired + private IDevicePermissionStreamService devicePermissionStreamService; + @Autowired + private ISysUserService userService; + @Autowired + @Lazy + private IDocInfoService docInfoService; + @Autowired + @Lazy + private IProductInfoService productInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDeviceInfo(DeviceInfo deviceInfo) { + if(!checkDeviceControlPoint()){ + ExceptionCast.cast(CommonCode.LICENSE_DEVICE_POINT_LARGE); + } + if(deviceInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(deviceInfo.getDeviceName())) + ExceptionCast.cast(DeviceCode.DEVICE_NAME_NONE); + if(!ValidateUtil.validateString(deviceInfo.getDepartId())) + ExceptionCast.cast(DeviceCode.DEVICE_DEPART_NONE); + if(!ValidateUtil.validateString(deviceInfo.getGroupId())) + ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE); + if(!ValidateUtil.validateString(deviceInfo.getDeviceNo())) + ExceptionCast.cast(DeviceCode.DEVICE_NO_NONE); + DeviceInfo en = getByDeviceNo(deviceInfo.getDeviceNo()); + if(en != null) + ExceptionCast.cast(DeviceCode.DEVICE_IS_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) { + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + } + DeviceGroup group = deviceGroupService.getById(deviceInfo.getGroupId()); + if(group == null) { + ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE); + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName()+"锛岃澶囩紪鍙凤細"+deviceInfo.getDeviceNo()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(deviceInfo); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR); + } + DevicePermission permission = new DevicePermission(); + permission.setDeviceId(deviceInfo.getDeviceId()); + permission.setUserId(userId); + b = devicePermissionService.save(permission); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR); + } + DevicePermissionStream departStream = new DevicePermissionStream(); + departStream.setGroupId(deviceInfo.getGroupId()); + departStream.setDeviceId(deviceInfo.getDeviceId()); + departStream.setDepartId(deviceInfo.getDepartId()); + b = devicePermissionStreamService.save(departStream); + if(!b) { + ExceptionCast.cast(CommonCode.FAIL); + } + DevicePermissionStream stream = new DevicePermissionStream(); + stream.setGroupId(deviceInfo.getGroupId()); + stream.setDeviceId(deviceInfo.getDeviceId()); + stream.setUserId(userId); + String path = null; + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + path = StringUtils.join(strings.toArray(), "/"); + FileUtilS.saveDeviceFromPath(path + "/" + deviceInfo.getDeviceNo()); + } + return devicePermissionStreamService.save(stream); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editDeviceInfo(String id, DeviceInfo deviceInfo) { + if(!ValidateUtil.validateString(id) || deviceInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + deviceInfo.setDeviceId(id); + deviceInfo.setGroupId(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName()); + //淇敼淇濆瓨澶囨敞 + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.updateById(deviceInfo); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDeviceInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + boolean b = docInfoService.deleteByDeviceId(en.getDeviceId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = devicePermissionService.deleteByDeviceId(en.getDeviceId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = devicePermissionStreamService.deleteUserByDeviceId(en.getGroupId(), en.getDeviceId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = devicePermissionStreamService.deleteDepartByDeviceId(en.getGroupId(), en.getDeviceId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+en.getDeviceName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(en.getDeviceId()); + } + + @Override + public List<CommonGenericTree> loadTree() { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + return null; + List<DeviceGroupExt> extAll = deviceGroupService.getByUserPermsAs(userId); + if(extAll == null || extAll.isEmpty()) + return null; + List<DeviceInfo> deviceInfoList = getDeviceByUserPermed(userId); + return DeviceTreeWrapper.loadTree(extAll, deviceInfoList); + } + + @Override + public List<DeviceInfo> getDeviceByUserPermed(String userId) { + return super.getBaseMapper().getDeviceByUserPermed(userId); + } + + @Override + public boolean checkDevicePerm(Integer nodeType, String paramId) { + if(!ValidateUtil.validateString(paramId) || !ValidateUtil.validateInteger(nodeType)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + if(nodeType == 1) { + DeviceGroup en = deviceGroupService.getById(paramId); + if(en == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + } + DeviceGroupPermission permission = deviceGroupPermissionService.getByUserIdAndGroupId(userId, en.getGroupId()); + if(permission == null) + return false; + return true; + }else if(nodeType == 2) { + DeviceInfo deviceInfo = super.getById(paramId); + if(deviceInfo == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + DevicePermission permission = devicePermissionService.getByUserIdAndDeviceId(userId, deviceInfo.getDeviceId()); + if(permission == null) + return false; + return true; + }else { + return false; + } + } + + @Override + public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return deviceGroupPermissionService.getUserPermsByGroupId(paramId); + }else if(nodeType == 2) { + return devicePermissionService.getUserPermsByDeviceId(paramId); + }else { + return null; + } + } + + @Override + public List<SysUser> getUserNonPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return deviceGroupPermissionService.getUserNonPermsByGroupId(paramId); + }else if(nodeType == 2) { + return devicePermissionService.getUserNonPermsByDeviceId(paramId); + }else { + return null; + } + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_NONE); + List<String> ids = new ArrayList<>(userIds.length); + Collections.addAll(ids, userIds); + Collection<SysUser> userList = userService.listByIds(ids); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(relativeFlag == 1 && nodeType == 1) { + //鍒嗛厤鍒嗙粍鏉冮檺鎵嶅彲鍚戜笅浼犻�掔敤鎴� + DeviceGroup deviceGroup = deviceGroupService.getById(paramId); + if(deviceGroup == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + } + boolean b1 = checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b1 = deviceGroupService.assignAddUser(deviceGroup, userList); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� + List<DeviceGroup> childrenList = deviceGroupService.getChildrenByParentId(deviceGroup.getGroupId()); + List<String> childrenIds = new ArrayList<>(); + if(childrenList != null && !childrenList.isEmpty()) { + childrenList.forEach(item -> { + childrenIds.add(item.getGroupId()); + boolean b = checkDevicePerm(1, item.getGroupId()); + if(b) { + b = deviceGroupService.assignAddUser(item, userList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + }); + } + List<DeviceInfo> deviceInfoList = null; + if(childrenIds.isEmpty()) { + deviceInfoList = getByGroupId(deviceGroup.getGroupId()); + }else { + childrenIds.add(deviceGroup.getGroupId()); + deviceInfoList = getByGroupIdList(childrenIds); + } + if(deviceInfoList != null && !deviceInfoList.isEmpty()) { + deviceInfoList.forEach(item -> { + boolean b = checkDevicePerm(2, item.getDeviceId()); + if(b) { + b = assignAddUser(item, userList); + if(!b) + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + }); + } + return true; + }else if(relativeFlag == 2) { + if(nodeType == 1) { + //鍒嗘壒鍒嗙粍鏉冮檺 + DeviceGroup deviceGroup = deviceGroupService.getById(paramId); + if(deviceGroup == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + } + boolean b = checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b = deviceGroupService.assignAddUser(deviceGroup, userList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + return true; + }else if(nodeType == 2) { + //鍒嗛厤璁惧鏉冮檺 + DeviceInfo deviceInfo = super.getById(paramId); + if(deviceInfo == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + boolean b = checkDevicePerm(2, deviceInfo.getDeviceId()); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + b = assignAddUser(deviceInfo, userList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + return true; + } + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(DeviceInfo deviceInfo, Collection<SysUser> userList) { + if(deviceInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DevicePermission> permissionList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + DevicePermission en = devicePermissionService.getByUserIdAndDeviceId(item.getId(), deviceInfo.getDeviceId()); + if(en == null) { + en = new DevicePermission(); + en.setUserId(item.getId()); + en.setDeviceId(deviceInfo.getDeviceId()); + permissionList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByDeviceIdAndUserId(deviceInfo.getGroupId(), deviceInfo.getDeviceId(), item.getId()); + if(stream == null) { + stream = new DevicePermissionStream(); + stream.setUserId(item.getId()); + stream.setGroupId(deviceInfo.getGroupId()); + stream.setDeviceId(deviceInfo.getDeviceId()); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = devicePermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(DeviceInfo deviceInfo, Collection<SysUser> userList) { + if(deviceInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<DevicePermission> permissionList = new ArrayList<>(); + List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + DevicePermission en = devicePermissionService.getByUserIdAndDeviceId(item.getId(), deviceInfo.getDeviceId()); + if(en != null) { + permissionList.add(en); + } + DevicePermissionStream stream = devicePermissionStreamService.getByDeviceIdAndUserId(deviceInfo.getGroupId(), deviceInfo.getDeviceId(), item.getId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //鏍¢獙娓呯┖鐢ㄦ埛鏉冮檺 + List<DevicePermission> existList = devicePermissionService.getByDeviceId(deviceInfo.getDeviceId()); + if(existList.size() <= permissionList.size()) + ExceptionCast.cast(DeviceCode.DEVICE_USER_NONE); + if(!permissionList.isEmpty()) { + boolean b = devicePermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = devicePermissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + } + return true; + } + + @Override + public List<DeviceInfo> getByGroupIdList(List<String> groupIdList) { + if(groupIdList == null || groupIdList.isEmpty()) + return null; + if(groupIdList.size() == 1) + return getByGroupId(groupIdList.get(0)); + return super.lambdaQuery().in(DeviceInfo::getGroupId, groupIdList).list(); + } + + @Override + public List<DeviceInfo> getByGroupId(String groupId) { + if(!ValidateUtil.validateString(groupId)) + return null; + return super.lambdaQuery().eq(DeviceInfo::getGroupId, groupId).list(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_NONE); + List<String> ids = new ArrayList<>(userIds.length); + Collections.addAll(ids, userIds); + Collection<SysUser> userList = userService.listByIds(ids); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(relativeFlag == 1 && nodeType == 1) { + //鍒嗛厤鍒嗙粍鏉冮檺鎵嶅彲鍚戜笅浼犻�掔敤鎴� + DeviceGroup deviceGroup = deviceGroupService.getById(paramId); + if(deviceGroup == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + } + boolean b1 = checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b1 = deviceGroupService.assignRemoveUser(deviceGroup, userList); + if(!b1) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� + List<DeviceGroup> childrenList = deviceGroupService.getChildrenByParentId(deviceGroup.getGroupId()); + List<String> childrenIds = new ArrayList<>(); + if(childrenList != null && !childrenList.isEmpty()) { + childrenList.forEach(item -> { + childrenIds.add(item.getGroupId()); + boolean b = checkDevicePerm(1, item.getGroupId()); + if(b) { + b = deviceGroupService.assignRemoveUser(item, userList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + } + }); + } + List<DeviceInfo> deviceInfoList = null; + if(childrenIds.isEmpty()) { + deviceInfoList = getByGroupId(deviceGroup.getGroupId()); + }else { + childrenIds.add(deviceGroup.getGroupId()); + deviceInfoList = getByGroupIdList(childrenIds); + } + if(deviceInfoList != null && !deviceInfoList.isEmpty()) { + deviceInfoList.forEach(item -> { + boolean b = checkDevicePerm(2, item.getDeviceId()); + if(b) { + b = assignRemoveUser(item, userList); + if(!b) + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + }); + } + return true; + }else if(relativeFlag == 2) { + if(nodeType == 1) { + //鍒嗘壒鍒嗙粍鏉冮檺 + DeviceGroup deviceGroup = deviceGroupService.getById(paramId); + if(deviceGroup == null) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); + } + boolean b = checkDevicePerm(1, deviceGroup.getGroupId()); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + b = deviceGroupService.assignRemoveUser(deviceGroup, userList); + if(!b) { + ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); + } + return true; + }else if(nodeType == 2) { + //鍒嗛厤璁惧鏉冮檺 + DeviceInfo deviceInfo = super.getById(paramId); + if(deviceInfo == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + boolean b = checkDevicePerm(2, deviceInfo.getDeviceId()); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + b = assignRemoveUser(deviceInfo, userList); + if(!b) { + ExceptionCast.cast(DeviceCode.DEVICE_USER_PERM_ERROR); + } + return true; + } + } + return false; + } + + @Override + public List<CommonGenericTree> loadDepartTree(Integer nodeType, String paramId) { + if(!ValidateUtil.validateString(paramId) || !ValidateUtil.validateInteger(nodeType)) + return null; + List<String> departIds = productInfoService.getDepartIdsByParams(nodeType, paramId); + if(departIds == null || departIds.isEmpty()) + return null; + List<DeviceGroupExt> deviceGroupExts = deviceGroupService.findExtByDeparts(departIds); + if(deviceGroupExts == null || deviceGroupExts.isEmpty()) + return null; + List<DeviceInfo> deviceInfoList = findByDepartIds(departIds); + if(deviceInfoList == null || deviceInfoList.isEmpty()) + return null; + return DeviceTreeWrapper.loadDepartTree(deviceGroupExts, deviceInfoList); + } + + @Override + public List<DeviceInfo> findByDepartIds(List<String> departIds) { + return super.lambdaQuery().in(DeviceInfo::getDepartId, departIds).list(); + } + + @Override + public DeviceInfo getByDeviceNo(String deviceNo) { + if(ValidateUtil.validateString(deviceNo)) { + List<DeviceInfo> list = super.lambdaQuery().eq(DeviceInfo::getDeviceNo, deviceNo).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + return null; + } + + @Override + public boolean checkDeviceControlPoint() { +// int num = Integer.valueOf(LicenseModel.getDncDeviceNumber()); +// int count = super.count(); +// if(count <= num){ + return true; +// } +// return false; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionServiceImpl.java new file mode 100644 index 0000000..cfb31e0 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionServiceImpl.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DevicePermission; +import org.jeecg.modules.dnc.mapper.DevicePermissionMapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.service.IDevicePermissionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +public class DevicePermissionServiceImpl extends ServiceImpl<DevicePermissionMapper, DevicePermission> implements IDevicePermissionService { + @Override + public DevicePermission getByUserIdAndDeviceId(String userId, String deviceId) { + if(!ValidateUtil.validateString(userId) || !ValidateUtil.validateString(deviceId)) + return null; + List<DevicePermission> list = super.lambdaQuery().eq(DevicePermission::getDeviceId, deviceId).eq(DevicePermission::getUserId, userId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<UserDepartExt> getUserPermsByDeviceId(String deviceId) { + return super.getBaseMapper().getUserPermsByDeviceId(deviceId); + } + + @Override + public List<SysUser> getUserNonPermsByDeviceId(String deviceId) { + return super.getBaseMapper().getUserNonPermsByDeviceId(deviceId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DevicePermission> devicePermissions) { + if(devicePermissions == null || devicePermissions.isEmpty()) + return false; + if(devicePermissions.size() == 1) + return super.removeById(devicePermissions.get(0).getDevicePermId()); + List<String> ids = new ArrayList<>(); + devicePermissions.forEach(item -> { + ids.add(item.getDevicePermId()); + }); + return super.removeByIds(ids); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDeviceId(String deviceId) { + LambdaQueryWrapper<DevicePermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DevicePermission::getDeviceId, deviceId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<DevicePermission> getByDeviceId(String deviceId) { + List<DevicePermission> list = super.lambdaQuery().eq(DevicePermission::getDeviceId, deviceId).list(); + if(list == null) + list = Collections.emptyList(); + return list; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionStreamServiceImpl.java new file mode 100644 index 0000000..f67f5a8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DevicePermissionStreamServiceImpl.java @@ -0,0 +1,143 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DevicePermissionStream; +import org.jeecg.modules.dnc.mapper.DevicePermissionStreamMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IDevicePermissionStreamService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class DevicePermissionStreamServiceImpl extends ServiceImpl<DevicePermissionStreamMapper, DevicePermissionStream> implements IDevicePermissionStreamService { + @Override + public DevicePermissionStream getByGroupIdAndUserId(String groupId, String userId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(userId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId). + eq(DevicePermissionStream::getUserId, userId).isNull(DevicePermissionStream::getDeviceId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public DevicePermissionStream getByDeviceIdAndUserId(String groupId, String deviceId, String userId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(userId) + || !ValidateUtil.validateString(deviceId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId). + eq(DevicePermissionStream::getUserId, userId).eq(DevicePermissionStream::getDeviceId, deviceId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<DevicePermissionStream> getDepartPermByGroupId(String groupId) { + if(!ValidateUtil.validateString(groupId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId). + isNull(DevicePermissionStream::getUserId).isNull(DevicePermissionStream::getDeviceId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + public List<DevicePermissionStream> getDepartPermByDeviceId(String groupId, String deviceId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(deviceId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId). + isNull(DevicePermissionStream::getUserId).eq(DevicePermissionStream::getDeviceId, deviceId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<DevicePermissionStream> permissionStreams) { + if(permissionStreams == null || permissionStreams.isEmpty()) + return false; + if(permissionStreams.size() == 1) + return super.removeById(permissionStreams.get(0).getPermId()); + List<String> ids = new ArrayList<>(); + permissionStreams.forEach(item -> { + ids.add(item.getPermId()); + }); + return super.removeByIds(ids); + } + + @Override + public DevicePermissionStream getByGroupIdAndDepartId(String groupId, String departId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(departId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId).eq(DevicePermissionStream::getDepartId, departId) + .isNull(DevicePermissionStream::getDeviceId).isNull(DevicePermissionStream::getUserId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public DevicePermissionStream getByDeviceIdAndDepartId(String groupId, String deviceId, String departId) { + if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(departId) + || !ValidateUtil.validateString(departId)) + return null; + List<DevicePermissionStream> list = super.lambdaQuery().eq(DevicePermissionStream::getGroupId, groupId).eq(DevicePermissionStream::getDepartId, departId) + .eq(DevicePermissionStream::getDeviceId, deviceId).isNull(DevicePermissionStream::getUserId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<DevicePermissionStream> findByDepartId(String departId) { + return super.lambdaQuery().eq(DevicePermissionStream::getDepartId, departId).list(); + } + + @Override + public List<DevicePermissionStream> findByUserId(String userId) { + return super.lambdaQuery().eq(DevicePermissionStream::getUserId, userId).list(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteUserByGroupId(String groupId) { + LambdaQueryWrapper<DevicePermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DevicePermissionStream::getGroupId, groupId).isNull(DevicePermissionStream::getDeviceId).isNull(DevicePermissionStream::getDepartId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartByGroupId(String groupId) { + LambdaQueryWrapper<DevicePermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DevicePermissionStream::getGroupId, groupId).isNull(DevicePermissionStream::getDeviceId).isNull(DevicePermissionStream::getUserId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteUserByDeviceId(String groupId, String deviceId) { + LambdaQueryWrapper<DevicePermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DevicePermissionStream::getGroupId, groupId).eq(DevicePermissionStream::getDeviceId, deviceId) + .isNull(DevicePermissionStream::getDepartId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartByDeviceId(String groupId, String deviceId) { + LambdaQueryWrapper<DevicePermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DevicePermissionStream::getGroupId, groupId).eq(DevicePermissionStream::getDeviceId, deviceId) + .isNull(DevicePermissionStream::getUserId); + return super.remove(lambdaQueryWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java new file mode 100644 index 0000000..c70aaea --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java @@ -0,0 +1,289 @@ +package org.jeecg.modules.dnc.service.impl; + +import cn.hutool.crypto.SmUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.system.vo.DictModel; +import org.jeecg.modules.dnc.dto.SysLogTypeObjectDto; +import org.jeecg.modules.dnc.entity.DncPassLog; +import org.jeecg.modules.dnc.mapper.DncPassLogMapper; +import org.jeecg.modules.dnc.response.SysLogMessageDto; +import org.jeecg.modules.dnc.utils.FileClient; +import org.jeecg.modules.dnc.utils.SyslogClient; +import org.jeecg.modules.dnc.utils.TelnetUtil; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.utils.date.DateUtil; +import org.jeecg.modules.system.service.ISysDictItemService; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.dnc.service.IDncPassLogService; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Duration; +import java.time.Instant; +import java.util.List; +import java.util.stream.Stream; + +/** + * @author clown + * * @date 2023/11/29 + */ +@Service +public class DncPassLogServiceImpl extends ServiceImpl<DncPassLogMapper, DncPassLog> implements IDncPassLogService { + + @Value("${securedoc.serverIp}") + private String serverIp; + @Value("${securedoc.serverPort}") + private String serverPort; + @Value("${securedoc.username}") + private String usernameService; + @Value("${securedoc.pwd}") + private String pwdService; + @Value("${securedoc.addressToken}") + private String addressToken; + @Value("${securedoc.addressUploadFile}") + private String addressUploadFile; + @Value("${securedoc.localFilePath}") + private String localFilePathC; + @Value("${securedoc.servicePath}") + private String servicePathS; + @Value("${securedoc.copyFilePath}") + private String newFilePathC; + @Value("${securedoc.logIp}") + private String logIp; + @Value("${securedoc.logPort}") + private String logPort; + @Autowired + private ISysDictService iSysDictService; + @Autowired + private ISysDictItemService iSysDictItemService; + + @Override + public DncPassLog findDayTime(String dateDay) { + if (!ValidateUtil.validateString(dateDay)) { + return null; + } + return super.baseMapper.findDateTimeDay(dateDay); + } + + @Override + @Scheduled(cron = "${fileCron}") + public void fileClientTxtOrNc() { + SysLogMessageDto message = new SysLogMessageDto(); + String host = "127.0.0.1"; + if (StringUtils.isNotBlank(serverIp)) { + host = serverIp; + } + String port = "8299"; + if (StringUtils.isNotBlank(serverPort)) { + port = serverPort; + } + String username = "admin"; + if (StringUtils.isNotBlank(usernameService)) { + username = usernameService; + } + String pwd = "123"; + if (StringUtils.isNotBlank(pwdService)) { + pwd = pwdService; + } + //鏂囦欢鏈湴鍦板潃锛屾牴鎹湴鍧�鎵惧埌鏂囦欢锛屽皢鏂囦欢瑙f瀽鎴愭枃浠舵祦 + String localFilePath = "/jar/test/a/"; +// String localFilePath = "E:\\test\\a\\"; + if (StringUtils.isNotBlank(localFilePathC)) { + localFilePath = localFilePathC; + } + //鏂囦欢涓婁紶鐩殑鍦板潃锛屽皢鏂囦欢涓婁紶鍒拌鍦板潃 + String servicePath = "/jar/test/b/"; +// String servicePath = "E:\\test\\b\\"; + if (StringUtils.isNotBlank(servicePathS)) { + servicePath = servicePathS; + } + boolean btelnetPort = TelnetUtil.telnetPort(serverIp,Integer.valueOf(serverPort),10); + if (!btelnetPort) { + System.out.println("鏈嶅姟鍣ㄨ繛鎺ワ細 " + serverIp + ":" + serverPort + " 寮傚父锛�" ); + return; + } + //绗竴姝ワ紝鑾峰彇token + String token = null; + try { + token = FileClient.getToken(host,port,username,pwd,addressToken); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + + //鑻ヨ幏鍙杢oken鎴愬姛锛屽啀杩涜涓婁紶鏂囦欢鎺ュ彛璋冪敤 + if (token !=null && !token.equals("")){ + try { + File f3 = new File(localFilePath); + File[] files = f3.listFiles(); + for (File fi : files){ + if (fi.isFile()){ + SysLogTypeObjectDto objectName = new SysLogTypeObjectDto(); + objectName.setDateTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_SMALL)); + objectName.setFileName(fi.getName()); + objectName.setFileSize(FileUtilS.changeFileFormatKb(String.valueOf(new File(localFilePath).length()))); + objectName.setSourceAddress(localFilePath); + objectName.setDestination(serverIp);//鏈嶅姟绔疘P + //椤哄簭鍙� + DncPassLog passLog = getById("num0001"); + if (passLog == null) { + passLog = new DncPassLog(); + passLog.setId("num0001"); + passLog.setSequenceNumber(1); + objectName.setFileNum(Integer.toString(1)); + save(passLog); + } else { + Integer number = passLog.getSequenceNumber()+1; + removeById("num0001"); + objectName.setFileNum(Integer.toString(number)); + + passLog = new DncPassLog(); + passLog.setId("num0001"); + passLog.setSequenceNumber(number); + save(passLog); + } + + InetAddress address = null; + try { + address = InetAddress.getLocalHost(); + String ip = address.getHostAddress(); + objectName.setSourceAddress("20.10.17.11");//瀹㈡埛绔疘P + objectName.setAddress(ip); + } catch (UnknownHostException e) { + objectName.setSourceAddress("127.0.0.1"); + objectName.setAddress("127.0.0.1"); + } + objectName.setDestination(host); + objectName.setResult("澶辫触"); + //鑾峰彇鏌愪釜鏂囦欢涓嬬殑鎵�鏈夋枃浠� + String loFilePath = localFilePath + fi.getName(); + String servicePathName =servicePath + fi.getName(); +// String loFilePath = localFilePath + "\\" + fi.getName(); +// String servicePathName =servicePath + "\\" + fi.getName(); + File file = new File(loFilePath); + if (file == null || !file.exists()){ + objectName.setAbstract1("sm3"); + } else { + String sm3 = SmUtil.sm3(file); + objectName.setAbstract1(sm3); + } + + String b = FileClient.uploadFile(host,port,token,fi.getName(),servicePathName,loFilePath,addressUploadFile); + //鏂囦欢澶囦唤鍒犻櫎 + if (b == null) { + try { + objectName.setResult("澶辫触"); + objectName.setTypes("error"); + SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); + }catch (Exception e) { + return; + } + } + else if ( b.equals("鎴愬姛")) { + //澶囦唤鏁版嵁 + boolean fCopy = FileUtilS.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(), + DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName()); + if (fCopy) { + FileUtilS.deleteNcFile(loFilePath); + } else { + FileUtilS.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(), + DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName()); + FileUtilS.deleteNcFile(loFilePath); + } + try { + objectName.setTypes("Info"); + objectName.setResult("鎴愬姛"); + SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); + }catch (Exception e) { + return; + } + } else { + try { + objectName.setResult("澶辫触"); + objectName.setTypes("error"); + SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); + }catch (Exception e) { + return; + } + } + } + } + + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + } + } + + /** + * 瀹氭椂浠诲姟鎵ц鍣ㄥ弬鏁� 姣忓ぉ鍑屾櫒1.30鎵ц + */ + @Override +// @Scheduled(cron = "0 30 1 * * ?") + public void deleteNcSendFile() { + Integer day; + //鍙栧瓧鍏告椂闂� + List<DictModel> singleDictionaries=iSysDictService.queryDictItemsByCode("DEL_TIME_SEND"); + if (singleDictionaries.size()!=1){ + return; + }else { + day= Integer.valueOf(singleDictionaries.get(0).getValue()); + } + Path ncDirectory = Paths.get("jar/NC"); + //澶╄浆绉� + long dayToSecond = day * 24 * 60 * 60; + if (Files.exists(ncDirectory) && Files.isDirectory(ncDirectory)) { + // 閫掑綊鏌ユ壘NC鐩綍涓嬫墍鏈夊悕涓簊end鐨勬枃浠跺す + try (Stream<Path> sendFolders = Files.walk(ncDirectory) + .filter(Files::isDirectory) + .filter(path -> path.getFileName().toString().equalsIgnoreCase("send"))) { + sendFolders.forEach(sendFolder -> { + try { + // 鑾峰彇褰撳墠鏃堕棿 + Instant now = Instant.now(); + // 閬嶅巻SEND鏂囦欢澶瑰唴鐨勬墍鏈夋枃浠� + Files.walk(sendFolder) + .filter(Files::isRegularFile) + .forEach(file -> { + try { + // 鑾峰彇鏂囦欢鐨勬渶鍚庝慨鏀规椂闂� + Instant lastModified = Files.getLastModifiedTime(file).toInstant(); + // 璁$畻鏃堕棿宸� + Duration duration = Duration.between(lastModified, now); + // 鍒ゆ柇鏄惁瓒呮椂锛堟椂闂村瓨鍦ㄥ瓧鍏镐腑锛宐ase_single_dictionary锛� + if (duration.getSeconds() > dayToSecond) { + try { + Files.delete(file); + System.out.println("宸插垹闄ゆ枃浠�: " + file); + } catch (IOException e) { + System.err.println("鍒犻櫎鏂囦欢 " + file + " 鏃跺嚭鐜伴敊璇�: " + e.getMessage()); + } + } + } catch (IOException e) { + System.err.println("鑾峰彇鏂囦欢 " + file + " 鐨勬渶鍚庝慨鏀规椂闂存椂鍑虹幇閿欒: " + e.getMessage()); + } + }); + } catch (IOException e) { + System.err.println("閬嶅巻 " + sendFolder + " 鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage()); + } + }); + } catch (IOException e) { + System.err.println("鏌ユ壘send鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage()); + } + } else { + System.err.println("jar鐨凬C鐩綍涓嶅瓨鍦ㄦ垨涓嶆槸鏈夋晥鐨勭洰褰�"); + } + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocClassificationServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocClassificationServiceImpl.java new file mode 100644 index 0000000..4a732b2 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocClassificationServiceImpl.java @@ -0,0 +1,44 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DocClassification; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DocClassificationMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.response.DocumentCode; +import org.jeecg.modules.dnc.service.IDocClassificationService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class DocClassificationServiceImpl extends ServiceImpl<DocClassificationMapper, DocClassification> implements IDocClassificationService { + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDocClassification(DocClassification docClassification) { + if(docClassification == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(docClassification.getClassificationCode())) + ExceptionCast.cast(DocumentCode.DOC_CLASS_CODE_NONE); + if(!ValidateUtil.validateString(docClassification.getClassificationName())) + ExceptionCast.cast(DocumentCode.DOC_CLASS_NAME_NONE); + DocClassification en = getByCode(docClassification.getClassificationCode()); + if(en != null) + ExceptionCast.cast(DocumentCode.DOC_CLASS_EXIST); + docClassification.setClassificationCode(docClassification.getClassificationCode().toUpperCase()); + return super.save(docClassification); + } + + @Override + public DocClassification getByCode(String code) { + if(!ValidateUtil.validateString(code)) + return null; + List<DocClassification> list = super.lambdaQuery().eq(DocClassification::getClassificationCode, code).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java new file mode 100644 index 0000000..0b248ab --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java @@ -0,0 +1,106 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.entity.DocFile; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DocFileMapper; +import org.jeecg.modules.dnc.mapper.DocInfoMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.utils.file.DocVersionUtil; +import org.jeecg.modules.dnc.response.DocumentCode; +import org.jeecg.modules.dnc.service.IDocFileService; +import org.jeecg.modules.dnc.service.IDocInfoService; +import org.jeecg.modules.dnc.service.IDocRelativeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class DocFileServiceImpl extends ServiceImpl<DocFileMapper, DocFile> implements IDocFileService { + @Autowired + private DocInfoMapper docInfoMapper; + @Autowired + @Lazy + private IDocRelativeService docRelativeService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDocFile(DocFile docFile) { + if(docFile == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(docFile.getDocId())) + ExceptionCast.cast(DocumentCode.DOC_FILE_DOC_ID_NONE); + if(!ValidateUtil.validateString(docFile.getFileName()) || !ValidateUtil.validateString(docFile.getFileEncodeName())) + ExceptionCast.cast(DocumentCode.DOCUMENT_NAME_NONE); + if(!ValidateUtil.validateLong(docFile.getFileSize())) + ExceptionCast.cast(DocumentCode.DOC_FILE_SIZE_NONE); + /*if(!ValidateUtil.validateString(docFile.getFileSuffix())) + ExceptionCast.cast(DocumentCode.DOC_SUFFIX_ERROR);*/ + if(!ValidateUtil.validateString(docFile.getFilePath())) + ExceptionCast.cast(DocumentCode.DOC_FILE_PATH_NONE); + DocFile nearestFile = getDocFileNearest(docFile.getDocId()); + if(nearestFile == null) { + docFile.setDocVersion(DocVersionUtil.generateNewVersion(null)); + }else { + docFile.setDocVersion(DocVersionUtil.generateNewVersion(nearestFile.getDocVersion())); + } + return super.save(docFile); + } + + @Override + public DocFile getDocFileNearest(String docId) { + if(!ValidateUtil.validateString(docId)) + return null; + LambdaQueryWrapper<DocFile> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocFile::getDocId, docId).orderByDesc(DocFile::getCreateTime).orderByDesc(DocFile::getFileId); + return super.getOne(lambdaQueryWrapper, false); + } + + @Override + public List<DocFile> findListByDocId(String docId) { + if(!ValidateUtil.validateString(docId)) + return null; + return super.lambdaQuery().eq(DocFile::getDocId, docId).orderByDesc(DocFile::getFileId).list(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignFileVersion(String fileId) { + if(!ValidateUtil.validateString(fileId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocFile docFile = super.getById(fileId); + if(docFile == null) { + ExceptionCast.cast(DocumentCode.DOC_FILE_ERROR); + } + List<DeviceInfo> deviceList = docRelativeService.findDeviceByDocId(docFile.getDocId()); + if(deviceList != null && !deviceList.isEmpty()) + ExceptionCast.cast(DocumentCode.DOC_DEVICE_EXIST); + DocInfo docInfo = new DocInfo(); + docInfo.setDocId(docFile.getDocId()); + docInfo.setPublishFileId(docFile.getFileId()); + docInfo.setPublishVersion(docFile.getDocVersion()); + return docInfoMapper.updateById(docInfo) >= 0; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocAttr(Integer type, String id) { + return super.getBaseMapper().deleteByDocAttr(type, id) >= 0; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocId(String docId) { + LambdaQueryWrapper<DocFile> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocFile::getDocId, docId); + return super.remove(lambdaQueryWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java new file mode 100644 index 0000000..75f17d0 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java @@ -0,0 +1,892 @@ +package org.jeecg.modules.dnc.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.FileUploadResult; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.DocInfoMapper; +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.utils.ValidateUtil; + + +import org.jeecg.modules.dnc.request.DocInfoQueryRequest; +import org.jeecg.modules.dnc.request.DocInfoUploadRequest; +import org.jeecg.modules.dnc.utils.file.FileUtilS; + +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.dnc.response.*; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +@Service +public class DocInfoServiceImpl extends ServiceImpl<DocInfoMapper, DocInfo> implements IDocInfoService { + @Autowired + private IDocClassificationService docClassificationService; + @Autowired + private IDocFileService docFileService; + @Autowired + private IFileOperateService fileOperateService; + @Autowired + @Lazy + private IDocRelativeService docRelativeService; + @Autowired + @Lazy + private IDeviceInfoService deviceInfoService; + @Autowired + private IDeviceGroupService deviceGroupService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + /*澶囦唤澶勭悊*/ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDocInfo(MultipartFile file, DocInfoUploadRequest uploadRequest) { + if(file == null || file.isEmpty() || uploadRequest == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(uploadRequest.getAttributionId()) || !ValidateUtil.validateInteger(uploadRequest.getAttributionType())) + ExceptionCast.cast(DocumentCode.DOC_ATTRIBUTE_ERROR); + if(!ValidateUtil.validateString(uploadRequest.getDocClassCode())) + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + DocClassification docClass = docClassificationService.getByCode(uploadRequest.getDocClassCode()); + if(docClass == null) + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + String fileName = FileUtilS.getFilenameNonSuffix(file.getOriginalFilename()); + String fileNameAll = file.getOriginalFilename(); + DocInfo en = findByAttrAndDocName(fileName, uploadRequest.getAttributionType(), uploadRequest.getAttributionId()); + //閽堝瀛樺湪鐨勫鐞� + if(en != null) + ExceptionCast.cast(DocumentCode.DOC_IS_EXIST); + FileUploadResult fileUploadResult = FileUtilS.uploadFile(file); + if(fileUploadResult == null) + ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); + DocInfo docInfo = new DocInfo(); + String docId = IdWorker.getIdStr(); + docInfo.setDocId(docId); + docInfo.setSyncStatus(2); + docInfo.setDocName(fileUploadResult.getFileName()); + docInfo.setDocSuffix(fileUploadResult.getFileSuffix()); + docInfo.setDocStatus(1); + DocRelative docRelative = new DocRelative(); + docRelative.setAttributionId(uploadRequest.getAttributionId()); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setAttributionType(uploadRequest.getAttributionType()); + docRelative.setClassificationId(docClass.getClassificationId()); + boolean b = docRelativeService.save(docRelative); + if(!b) + ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); + DocFile docFile = new DocFile(); + docFile.setDocId(docInfo.getDocId()); + docFile.setFileName(fileUploadResult.getFileName()); + docFile.setFileEncodeName(fileUploadResult.getFileEncodeName()); + docFile.setFilePath(fileUploadResult.getFilePath()); + docFile.setFileSize(fileUploadResult.getFileSize()); + docFile.setFileSuffix(fileUploadResult.getFileSuffix()); + b = docFileService.addDocFile(docFile); + if(!b) + ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); + docInfo.setPublishVersion(docFile.getDocVersion()); + docInfo.setPublishFileId(docFile.getFileId()); + //COPY + DeviceInfo deviceInfo= deviceInfoService.getById(uploadRequest.getAttributionId()); + if (deviceInfo != null) { + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + boolean copyFileNc = false; + if (strings != null && !strings.isEmpty()) { + String path = org.apache.commons.lang3.StringUtils.join(strings.toArray(), "/"); + copyFileNc = FileUtilS.copyFile(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName(), + path+ "/" + deviceInfo.getDeviceNo() ,fileNameAll); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(),docFile.getFileSuffix()); + + } + } else { + copyFileNc =FileUtilS.copyFile(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName(), + deviceInfo.getDeviceNo() ,fileNameAll); + if (!copyFileNc) { + ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); + } else { + FileUtilS.deleteZipFromToSend(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName() + "/"+ deviceInfo.getDeviceNo(), + docFile.getFileName(),docFile.getFileSuffix()); + + } + } + + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("瀵煎叆"+docClass.getClassificationName()+"锛屾枃妗e悕绉�:"+(docFile.getFileName()+"."+docFile.getFileSuffix())); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean saveBool = super.save(docInfo); + return saveBool; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDocInfoRec(String pathFile,File fileRec) { + if (StringUtils.isEmpty(pathFile)) { + return false; + } + MultipartFile file = FileUtilS.fileToMultipartFile(fileRec); + DocClassification docClass = docClassificationService.getByCode("REC"); + if(docClass == null) { + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + } + //鏍规嵁璁惧缂栧彿鏌ヨ鏁版嵁 + Integer recNum = pathFile.lastIndexOf("\\rec\\"); + if (recNum == -1) { + return false; + } + String recF = pathFile.substring(0,recNum);//灏嗚繑鍥瀌ef}ab + Integer equipmentId = recF.lastIndexOf("\\"); + String deviceNo = recF.substring(equipmentId+1,recF.length()); + if (StringUtils.isEmpty(deviceNo)) { + return false; + } + DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); + if (deviceInfo == null) { + return false; + } + String fileName = FileUtilS.getFilenameNonSuffix(file.getOriginalFilename()); + + FileUploadResult fileUploadResult = FileUtilS.uploadFile(file); + if(fileUploadResult == null) { + return false; + } + DocInfo en = findByAttrAndDocName(fileName, 4, deviceInfo.getDeviceId()); + if(en != null) { + return false; + } + + DocInfo docInfo = new DocInfo(); + String docId = IdWorker.getIdStr(); + docInfo.setDocId(docId); + docInfo.setDocName(fileUploadResult.getFileName()); + docInfo.setDocSuffix(fileUploadResult.getFileSuffix()); + docInfo.setDocStatus(1); + docInfo.setSyncStatus(2); + DocRelative docRelative = new DocRelative(); + docRelative.setAttributionId(deviceInfo.getDeviceId()); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setAttributionType(4); + docRelative.setClassificationId(docClass.getClassificationId()); + boolean b = docRelativeService.save(docRelative); + if(!b) { + ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); + } + DocFile docFile = new DocFile(); + docFile.setDocId(docInfo.getDocId()); + docFile.setFileName(fileUploadResult.getFileName()); + docFile.setFileEncodeName(fileUploadResult.getFileEncodeName()); + docFile.setFilePath(fileUploadResult.getFilePath()); + docFile.setFileSize(fileUploadResult.getFileSize()); + docFile.setFileSuffix(fileUploadResult.getFileSuffix()); + b = docFileService.addDocFile(docFile); + if(!b) { + return false; + } + docInfo.setPublishVersion(docFile.getDocVersion()); + docInfo.setPublishFileId(docFile.getFileId()); + boolean saveBool = super.save(docInfo); + return saveBool; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDocInfoRecService(String equipmentId,File fileRec,String fileNameSuffix,String fileNameNew,String filePath ) { + if (StringUtils.isEmpty(filePath)) { + return false; + } + MultipartFile file = FileUtilS.fileToMultipartFile(fileRec); + DocClassification docClass = docClassificationService.getByCode("REC"); + if(docClass == null) { + ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); + } + //鏍规嵁璁惧缂栧彿鏌ヨ鏁版嵁 + String deviceNo = equipmentId; + if (StringUtils.isEmpty(deviceNo)) { + return false; + } + DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); + if (deviceInfo == null) { + return false; + } + String fileName = FileUtilS.getFilenameNonSuffix(file.getOriginalFilename()); + + FileUploadResult fileUploadResult = FileUtilS.uploadFileUpdateFileName(file,fileNameNew,fileNameSuffix); + if(fileUploadResult == null) { + return false; + } + DocInfo en = findByAttrAndDocName(fileName, 4, deviceInfo.getDeviceId()); + if(en != null) { + return false; + } + + DocInfo docInfo = new DocInfo(); + String docId = IdWorker.getIdStr(); + docInfo.setDocId(docId); + docInfo.setDocName(fileUploadResult.getFileName()); + docInfo.setDocSuffix(fileUploadResult.getFileSuffix()); + docInfo.setDocStatus(1); + docInfo.setSyncStatus(2); + DocRelative docRelative = new DocRelative(); + docRelative.setAttributionId(deviceInfo.getDeviceId()); + docRelative.setDocId(docInfo.getDocId()); + docRelative.setAttributionType(4); + docRelative.setClassificationId(docClass.getClassificationId()); + boolean b = docRelativeService.save(docRelative); + if(!b) { + ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); + } + DocFile docFile = new DocFile(); + docFile.setDocId(docInfo.getDocId()); + docFile.setFileName(fileUploadResult.getFileName()); + docFile.setFileEncodeName(fileUploadResult.getFileEncodeName()); + docFile.setFilePath(fileUploadResult.getFilePath()); + docFile.setFileSize(fileUploadResult.getFileSize()); + docFile.setFileSuffix(fileUploadResult.getFileSuffix()); + b = docFileService.addDocFile(docFile); + if(!b) { + return false; + } + docInfo.setPublishVersion(docFile.getDocVersion()); + docInfo.setPublishFileId(docFile.getFileId()); + boolean saveBool = super.save(docInfo); + return saveBool; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editDocInfo(String id, DocInfo docInfo) { + if(!ValidateUtil.validateString(id) || docInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + DocInfo asDoc = findByAttrAndDocNameNotThis(docInfo.getDocName(), docInfo.getAttributionType(), docInfo.getAttributionId(), id); + if(asDoc != null) + ExceptionCast.cast(DocumentCode.DOC_IS_EXIST); + docInfo.setDocId(id); + docInfo.setDocStatus(null); + docInfo.setDocSuffix(null); + docInfo.setClassificationId(null); + docInfo.setPublishFileId(null); + docInfo.setPublishVersion(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+docInfo.getDocName()); + //淇敼淇濆瓨澶囨敞 + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.updateById(docInfo); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(en.getDocStatus() != 1) + ExceptionCast.cast(DocumentCode.DOC_DEL_ERROR); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate != null) + ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); + boolean b = docFileService.deleteByDocId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = docRelativeService.deleteByDocId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+en.getDocName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(id); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean pushDocFile(String id, MultipartFile file) { + if(file == null || file.isEmpty() || !ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate == null || !userId.equals(operate.getCreateUser())) + ExceptionCast.cast(DocumentCode.DOC_OPERATE_PUSH_FAIL); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + List<DeviceInfo> deviceList = docRelativeService.findDeviceByDocId(en.getDocId()); + if(deviceList != null && !deviceList.isEmpty()) + ExceptionCast.cast(DocumentCode.DOC_DEVICE_EXIST); + String suffix = FileUtilS.getFileSuffix(file.getOriginalFilename()); + if(ValidateUtil.validateString(en.getDocSuffix())) { + if(!en.getDocSuffix().equals(suffix)) { + ExceptionCast.cast(DocumentCode.DOC_SUFFIX_ERROR); + } + }else { + if(ValidateUtil.validateString(suffix)) { + ExceptionCast.cast(DocumentCode.DOC_SUFFIX_ERROR); + } + } + FileUploadResult fileUploadResult = FileUtilS.uploadFile(file); + DocFile docFile = new DocFile(); + docFile.setDocId(id); + docFile.setFileName(fileUploadResult.getFileName()); + docFile.setFileEncodeName(fileUploadResult.getFileEncodeName()); + docFile.setFilePath(fileUploadResult.getFilePath()); + docFile.setFileSize(fileUploadResult.getFileSize()); + docFile.setFileSuffix(fileUploadResult.getFileSuffix()); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍏ュ簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+docFile.getFileName()); + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = fileOperateService.deleteByDocId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b= docFileService.addDocFile(docFile); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + en.setPublishVersion(docFile.getDocVersion()); + en.setPublishFileId(docFile.getFileId()); + return super.updateById(en); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public DocFile checkDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(en.getDocStatus() != 1) + ExceptionCast.cast(DocumentCode.DOC_OPERATE_FAIL); + if(!ValidateUtil.validateString(en.getPublishFileId())) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate != null) + ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); + operate = new FileOperate(); + operate.setDocId(id); + boolean b = fileOperateService.save(operate); + if(!b) + ExceptionCast.cast(DocumentCode.DOC_OPERATE_FAIL); + DocFile fileInfo = docFileService.getById(en.getPublishFileId()); + if(fileInfo == null) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + return fileInfo; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean publishDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(en.getDocStatus() != 1) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_ERROR); + if(!ValidateUtil.validateString(en.getPublishFileId())) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); + DocFile pubFile = docFileService.getById(en.getPublishFileId()); + if(pubFile == null) + ExceptionCast.cast(DocumentCode.DOC_FILE_ERROR); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate != null) + ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); + DocFile old = docFileService.getDocFileNearest(en.getDocId()); + if(old == null) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + if(old.getDocVersion().contains(".")) { + DocFile docFile = new DocFile(); + BeanUtils.copyProperties(pubFile, docFile); + docFile.setFileId(null); + docFile.setDocVersion(old.getDocVersion().substring(0, 1)); + boolean b = docFileService.save(docFile); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 2).set(DocInfo::getPublishFileId, docFile.getFileId()) + .set(DocInfo::getPublishVersion, docFile.getDocVersion()).update(); + }else { + return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 2).set(DocInfo::getPublishFileId, old.getFileId()) + .set(DocInfo::getPublishVersion, old.getDocVersion()).update(); + } + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean republishDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(en.getDocStatus() != 2) + ExceptionCast.cast(DocumentCode.DOC_REPUBLISH_ERROR); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("閲嶆柊鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 1).update(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean pigeonholeDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(en.getDocStatus() == 3) + ExceptionCast.cast(DocumentCode.DOC_PIGEONHOLE_ERROR); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate != null) + ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("褰掓。"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 3).update(); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean cancelPullDocInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + FileOperate operate = fileOperateService.getByDocId(id); + if(operate == null || !userId.equals(operate.getCreateUser())) + ExceptionCast.cast(DocumentCode.DOC_CANCEL_PULL_ERROR); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍙栨秷鍑哄簱"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return fileOperateService.deleteByDocId(id); + } + + @Override + public QueryPageResponseResult<DocInfo> findPageList(int page, int size, DocInfoQueryRequest docQuery) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + if(docQuery == null || !ValidateUtil.validateString(docQuery.getAttributionId()) + || !ValidateUtil.validateInteger(docQuery.getAttributionType()) || + !ValidateUtil.validateString(docQuery.getDocClassCode())) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + DocClassification docClassification = docClassificationService.getByCode(docQuery.getDocClassCode()); + if(docClassification == null) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<DocInfo> pageData = new Page<>(page, size); + +// LambdaQueryWrapper<DocInfo> lambdaQuery = Wrappers.lambdaQuery(); +// lambdaQuery.eq(DocInfo::getAttributionType, docQuery.getAttributionType()).eq(DocInfo::getAttributionId, docQuery.getAttributionId()) +// .eq(DocInfo::getClassificationId, docClassification.getClassificationId()); + QueryWrapper<DocInfo> queryWrapper = Wrappers.query(); + queryWrapper.eq("r.attribution_type", docQuery.getAttributionType()).eq("r.attribution_id", docQuery.getAttributionId()) + .eq("r.classification_id", docClassification.getClassificationId()); + if (StringUtils.isNotEmpty(docQuery.getDocName())) { + int dotIndex = docQuery.getDocName().lastIndexOf("."); + if (dotIndex == -1) { + queryWrapper.like("u.doc_name", docQuery.getDocName()); + } else { + String[] docNameArr = docQuery.getDocName().split("\\."); + queryWrapper.like(StrUtil.isNotEmpty(docNameArr[0]), "u.doc_name", docNameArr[0]); + queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); + } + } + queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); + queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); + if(ValidateUtil.validateString(docQuery.getAscStr())) { + String[] ascArr = docQuery.getAscStr().split(","); +// ((Page<DocInfo>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(docQuery.getDescStr())) { + String[] descStr = docQuery.getDescStr().split(","); +// ((Page<DocInfo>) pageData).setDesc(descStr); + } + IPage<DocInfo> docInfoIPage = super.getBaseMapper().findDocExtList(pageData, queryWrapper); + return new QueryPageResponseResult<>(CommonCode.SUCCESS, docInfoIPage); + } + + @Override + public DocInfo getByDocAttrAndDocId(String docId, Integer attrType, String attributeId) { + if(!ValidateUtil.validateString(docId) || !ValidateUtil.validateString(attributeId) || !ValidateUtil.validateInteger(attrType)) + return null; + List<DocInfo> list = super.getBaseMapper().getByDocAttrAndDocId(docId, attrType, attributeId); + if(list == null || list.size() != 1) + return null; + return list.get(0); + } + + @Override + public DocFile previewDocFile(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + DocFile fileInfo = docFileService.getById(en.getPublishFileId()); + if(fileInfo == null) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + return fileInfo; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 1; + boolean b = docFileService.deleteByDocAttr(attrType, productId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, productId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return docRelativeService.deleteByDocAttr(attrType, productId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByComponentId(String componentId) { + if(!ValidateUtil.validateString(componentId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 2; + boolean b = docFileService.deleteByDocAttr(attrType, componentId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, componentId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return docRelativeService.deleteByDocAttr(attrType, componentId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByPartsId(String partsId) { + if(!ValidateUtil.validateString(partsId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 3; + boolean b = docFileService.deleteByDocAttr(attrType, partsId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, partsId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return docRelativeService.deleteByDocAttr(attrType, partsId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDeviceId(String deviceId) { + if(!ValidateUtil.validateString(deviceId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 4; + /*boolean b = docFileService.deleteByDocAttr(attrType, deviceId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, deviceId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL);*/ + return docRelativeService.deleteByDocAttr(attrType, deviceId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByProcessId(String processId) { + if(!ValidateUtil.validateString(processId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + Integer attrType = 4; + boolean b = docFileService.deleteByDocAttr(attrType, processId); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = deleteByDocAttr(attrType, processId); + if(!b) { + ExceptionCast.cast(CommonCode.FAIL); + } + return docRelativeService.deleteByDocAttr(attrType, processId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocAttr(Integer attrType, String attrId) { + int i = super.getBaseMapper().deleteByDocAttr(attrType, attrId); + if(i >= 0) { + return true; + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public ResponseResult pullDocFile(HttpServletRequest request, HttpServletResponse response, String id) { + DocFile docFile = checkDocInfo(id); + if(!ValidateUtil.validateString(docFile.getFilePath()) || !ValidateUtil.validateString(docFile.getFileName()) || + /*!ValidateUtil.validateString(docFile.getFileSuffix()) ||*/ !ValidateUtil.validateString(docFile.getFileEncodeName())) + return new ResponseResult(CommonCode.FAIL); + String fileName; + if(ValidateUtil.validateString(docFile.getFileSuffix())) { + fileName = docFile.getFileName() + "." + docFile.getFileSuffix(); + }else { + fileName = docFile.getFileName(); + } + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(7); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("鍑哄簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+fileName); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return null; + } + + @Override + public DocInfo findByAttrAndDocName(String docName, Integer attrType, String attrId) { + List<DocInfo> docInfoList = super.getBaseMapper().findByAttrAndDocName(docName, attrType, attrId); + if(docInfoList == null || docInfoList.isEmpty()) + return null; + return docInfoList.get(0); + } + + @Override + public DocInfo findByAttrAndDocNameNotThis(String docName, Integer attrType, String attrId, String docId) { + List<DocInfo> docInfoList = super.getBaseMapper().findByAttrAndDocName(docName, attrType, attrId); + if(docInfoList == null || docInfoList.isEmpty()) + return null; + for(DocInfo docInfo : docInfoList) { + if(!docId.equals(docInfo.getDocId())) { + return docInfo; + } + } + return null; + } + + @Override + public List<DocInfo> getByDocId(String docId) { + return super.getBaseMapper().getByDocId(docId); + } + + @Override + public QueryPageResponseResult<DocInfo> findPageListByDevice(int page, int size, DocInfoQueryRequest docQuery) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + if(docQuery == null || !ValidateUtil.validateString(docQuery.getAttributionId()) + || !ValidateUtil.validateInteger(docQuery.getAttributionType()) || + !ValidateUtil.validateString(docQuery.getDocClassCode())) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + DocClassification docClassification = docClassificationService.getByCode(docQuery.getDocClassCode()); + if(docClassification == null) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<DocInfo> pageData = new Page<>(page, size); + QueryWrapper<DocInfo> queryWrapper = Wrappers.query(); + queryWrapper.eq("r.attribution_type", docQuery.getAttributionType()) + .eq("r.attribution_id", docQuery.getAttributionId()) + .eq("r.classification_id", docClassification.getClassificationId()); + if (StringUtils.isNotEmpty(docQuery.getDocName())) { + int dotIndex = docQuery.getDocName().lastIndexOf("."); + if (dotIndex == -1) { + queryWrapper.like("u.doc_name", docQuery.getDocName()); + } else { + String[] docNameArr = docQuery.getDocName().split("\\."); + queryWrapper.like(StrUtil.isNotEmpty(docNameArr[0]), "u.doc_name", docNameArr[0]); + queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); + } + } + queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); + queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); + + if(ValidateUtil.validateString(docQuery.getAscStr())) { + String[] ascArr = docQuery.getAscStr().split(","); +// ((Page<DocInfo>) pageData).setAsc(ascArr); + } + if(ValidateUtil.validateString(docQuery.getDescStr())) { + String[] descStr = docQuery.getDescStr().split(","); +// ((Page<DocInfo>) pageData).setDesc(descStr); + } + IPage<DocInfo> docInfoIPage = super.getBaseMapper().findDeviceDocExtList(pageData, queryWrapper); + if (docInfoIPage != null && docInfoIPage.getRecords() != null && !docInfoIPage.getRecords().isEmpty()) { + for (DocInfo d : docInfoIPage.getRecords()) { + d.setSyncStatus(2); + } + } + return new QueryPageResponseResult<>(CommonCode.SUCCESS, docInfoIPage); + } + + @Override + public QueryListResponseResult<DocInfo> findList(DocInfoQueryRequest docQuery) { + if(docQuery == null || !ValidateUtil.validateString(docQuery.getAttributionId()) + || !ValidateUtil.validateInteger(docQuery.getAttributionType()) || + !ValidateUtil.validateString(docQuery.getDocClassCode())) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + DocClassification docClassification = docClassificationService.getByCode(docQuery.getDocClassCode()); + if(docClassification == null) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + + QueryWrapper<DocInfo> queryWrapper = Wrappers.query(); + queryWrapper.eq("r.attribution_type", docQuery.getAttributionType()).eq("r.attribution_id", docQuery.getAttributionId()) + .eq("r.classification_id", docClassification.getClassificationId()); + if (StringUtils.isNotEmpty(docQuery.getDocName())) { + int dotIndex = docQuery.getDocName().lastIndexOf("."); + if (dotIndex == -1) { + queryWrapper.like("u.doc_name", docQuery.getDocName()); + } else { + String[] docNameArr = docQuery.getDocName().split("\\."); + queryWrapper.like(StrUtil.isNotEmpty(docNameArr[0]), "u.doc_name", docNameArr[0]); + queryWrapper.eq(StrUtil.isNotEmpty(docNameArr[1]), "u.doc_suffix", docNameArr[1]); + } + } + queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); + queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); + List<DocInfo> docInfoIPage = super.getBaseMapper().findDocExtList(queryWrapper); + return new QueryListResponseResult<>(CommonCode.SUCCESS, docInfoIPage); + } + + @Override + public List<DocInfo> getByProcessIds(List<ProcessStream> streams) { + List<String> ids = new ArrayList<>(); + for(ProcessStream s : streams) { + ids.add(s.getProcessId()); + } + DocClassification docClassification = docClassificationService.getByCode("NC"); + if(docClassification == null) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + QueryWrapper<DocInfo> queryWrapper = Wrappers.query(); + queryWrapper.in("r.attribution_id", ids) + .eq("r.classification_id", docClassification.getClassificationId()) + .ne("u.doc_status", 3).isNotNull("u.publish_file_id"); + return super.getBaseMapper().findDocExtList(queryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean batchRemoveDocInfo(String[] docIds) { + if(docIds == null || docIds.length < 1) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + for(String docId : docIds) { + this.deleteDocInfo(docId); + } + return true; + } + + @Override + public ResponseResult downloadDocFile(HttpServletRequest request, HttpServletResponse response, String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DocInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); + if(!ValidateUtil.validateString(en.getPublishFileId())) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); + DocFile docFile = docFileService.getById(en.getPublishFileId()); + if(docFile == null) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + if(!ValidateUtil.validateString(docFile.getFilePath()) || !ValidateUtil.validateString(docFile.getFileName()) || + /*!ValidateUtil.validateString(docFile.getFileSuffix()) ||*/ !ValidateUtil.validateString(docFile.getFileEncodeName())) + return new ResponseResult(CommonCode.FAIL); + String fileName; + if(ValidateUtil.validateString(docFile.getFileSuffix())) { + fileName = docFile.getFileName() + "." + docFile.getFileSuffix(); + }else { + fileName = docFile.getFileName(); + } + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); + return null; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java new file mode 100644 index 0000000..2944228 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java @@ -0,0 +1,158 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.entity.DncPassLog; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.entity.DocRelative; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.ext.NcTxtFilePathInfo; +import org.jeecg.modules.dnc.mapper.DocInfoMapper; +import org.jeecg.modules.dnc.mapper.DocRelativeMapper; +import org.jeecg.modules.dnc.response.CommonCode; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.utils.date.DateUtil; + +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class DocRelativeServiceImpl extends ServiceImpl<DocRelativeMapper, DocRelative> implements IDocRelativeService { + + @Autowired + private DocInfoMapper docInfoMapper; + @Autowired + private IDeviceInfoService deviceInfoService; + @Autowired + private IDeviceGroupService deviceGroupService; + @Value("${securedoc.localFilePath}") + private String localFilePath; + @Autowired + private IDncPassLogService dncPassLogService; + + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocAttr(Integer attrType, String attrId) { + LambdaQueryWrapper<DocRelative> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocRelative::getAttributionType, attrType).eq(DocRelative::getAttributionId, attrId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocId(String id) { + LambdaQueryWrapper<DocRelative> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocRelative::getDocId, id); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDocByAttr(String docId, Integer attrType, String attrId) { + List<DocRelative> docRelatives = super.lambdaQuery().eq(DocRelative::getDocId, docId). + eq(DocRelative::getAttributionType, attrType). + eq(DocRelative::getAttributionId, attrId).list(); + boolean docRel = false; + DocRelative docRelative = new DocRelative(); + if (docRelatives != null && !docRelatives.isEmpty()) { + String classificationId = "1259647678577995778"; + docRelative = docRelatives.get(0); + if (classificationId.equals(docRelative.getClassificationId())) { + docRel = true; + } + } + LambdaQueryWrapper<DocRelative> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocRelative::getDocId, docId); + lambdaQueryWrapper.eq(DocRelative::getAttributionType, attrType); + lambdaQueryWrapper.eq(DocRelative::getAttributionId, attrId); + boolean b = super.remove(lambdaQueryWrapper); + + if (b && docRel) { + DocInfo info = docInfoMapper.selectById(docId); + DeviceInfo deviceInfo = deviceInfoService.getById(attrId); + List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); + if (strings != null && !strings.isEmpty()) { + String path = StringUtils.join(strings.toArray(), "/"); + boolean deleteFile = FileUtilS.deleteFilePathZip(path + "/"+ deviceInfo.getDeviceNo(), + info.getDocName(), info.getDocSuffix()); + if (!deleteFile) { + return false; + } + DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); + Integer fileTxt = 0, fileNc =0; + if (dncPassLog !=null) { + fileTxt = dncPassLog.getSequenceNumber() + 1; + fileNc = fileTxt + 1; + } else { + fileTxt = 1; + fileNc = fileTxt + 1; + } + String sequence = String.format("%06d",fileTxt); + DncPassLog passInfoNc = new DncPassLog(); + passInfoNc.setSequenceNumber(fileNc); + passInfoNc.setSequenceOrder(sequence); + passInfoNc.setDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); + passInfoNc.setPassType("02"); + passInfoNc.setPassName(info.getDocName()+"."+info.getDocSuffix()); + passInfoNc.setCreateTime(DateUtil.getNow()); + dncPassLogService.save(passInfoNc); + //澶勭悊鏂囦欢鍚嶇О 鏂囦欢璺緞 + + NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); + ncTxt.setEquipmentId(deviceInfo.getDeviceNo()); + ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" ); + ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)+sequence); + ncTxt.setOrigFileName(info.getDocName()); + ncTxt.setOrigFileSuffix(info.getDocSuffix()); + ncTxt.setFileAddOrDelete(2); + String loFilePath = localFilePath + "\\" + ncTxt.getFileTxtName() + ".nc"; + try { + /* ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(ncTxt);*/ + String allList = new String(); + allList=(ncTxt.getFileTxtName()+"\n"); + allList+=(ncTxt.getFileNcName()+"\n"); + allList+=(ncTxt.getOrigFileName()+"\n"); + allList+=(ncTxt.getOrigFileSuffix()+"\n"); + allList+=(ncTxt.getFilePath()+"\n"); + allList+=(ncTxt.getEquipmentId()+"\n"); + allList+=(ncTxt.getFileAddOrDelete().toString()); + FileUtilS.fileWriterSql(loFilePath,allList); + }catch (Exception e) { + return true; + } + } + } + return b; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteCopyDocByAttrNext(String docId, Integer attrType, String attrId) { + LambdaQueryWrapper<DocRelative> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(DocRelative::getDocId, docId); + lambdaQueryWrapper.eq(DocRelative::getAttributionType, attrType); + lambdaQueryWrapper.eq(DocRelative::getAttributionId, attrId); + boolean b = super.remove(lambdaQueryWrapper); + return b; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public List<DeviceInfo> findDeviceByDocId(String docId) { + if(!ValidateUtil.validateString(docId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + return super.getBaseMapper().findDeviceByDocId(docId); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileOperateServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileOperateServiceImpl.java new file mode 100644 index 0000000..21d68bd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileOperateServiceImpl.java @@ -0,0 +1,38 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.FileOperate; +import org.jeecg.modules.dnc.mapper.FileOperateMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IFileOperateService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class FileOperateServiceImpl extends ServiceImpl<FileOperateMapper, FileOperate> implements IFileOperateService { + @Override + public FileOperate getByDocId(String docId) { + if(!ValidateUtil.validateString(docId)) { + return null; + } + List<FileOperate> list = super.lambdaQuery().eq(FileOperate::getDocId, docId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByDocId(String docId) { + if(!ValidateUtil.validateString(docId)) { + return false; + } + LambdaQueryWrapper<FileOperate> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(FileOperate::getDocId, docId); + return super.remove(lambdaQueryWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java new file mode 100644 index 0000000..d108d35 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.MenuButton; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.MenuButtonMapper; +import org.jeecg.modules.dnc.response.MenuCode; +import org.jeecg.modules.dnc.service.IMenuButtonService; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class MenuButtonServiceImpl extends ServiceImpl<MenuButtonMapper, MenuButton> implements IMenuButtonService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByMenuId(String menuId) { + if(!ValidateUtil.validateString(menuId)) + ExceptionCast.cast(MenuCode.MENU_ID_NONE); + LambdaQueryWrapper<MenuButton> lambdaUpdate = Wrappers.lambdaQuery(); + lambdaUpdate.eq(MenuButton::getMenuId, menuId); + return super.remove(lambdaUpdate); + } + + @Override + public Map<String, MenuButton> getMapByMenuId(String menuId) { + if(!ValidateUtil.validateString(menuId)) + return null; + List<MenuButton> list = super.lambdaQuery().eq(MenuButton::getMenuId, menuId).list(); + if(list == null || list.isEmpty()) + return null; + Map<String, MenuButton> map = new HashMap<>(); + list.forEach(item -> { + map.put(item.getButtonId(), item); + }); + return map; + } + + @Override + public List<MenuButton> findByButtonId(String buttonId) { + return super.lambdaQuery().eq(MenuButton::getButtonId, buttonId).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java new file mode 100644 index 0000000..8bb459c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java @@ -0,0 +1,148 @@ +package org.jeecg.modules.dnc.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.IpUtils; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.dnc.entity.NcLogInfo; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.NcLogInfoMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.QueryPageResponseResult; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.modules.dnc.request.NcLogInfoRequest; +import org.jeecg.modules.dnc.service.INcLogInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @author clown + * * @date 2023/12/4 + */ +@Service +public class NcLogInfoServiceImpl extends ServiceImpl<NcLogInfoMapper, NcLogInfo> implements INcLogInfoService { + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysDictService iSysDictService; + + @Override + public QueryPageResponseResult<NcLogInfo> findByPageList(int page, int size, NcLogInfoRequest requestParams) { + if(page < 1 || size < 1) { + ExceptionCast.cast(CommonCode.INVALID_PAGE); + } + IPage<NcLogInfo> pageData = new Page<>(page, size); + QueryWrapper<NcLogInfo> queryWrapper=new QueryWrapper<>(); + if(requestParams != null) { + queryWrapper.eq(StrUtil.isNotEmpty(requestParams.getUsername()),"user_mame",requestParams.getOperateType()); + if(requestParams.getOperateType() != null) { + queryWrapper.eq("operate_type", requestParams.getOperateType()); + } + queryWrapper.like(StrUtil.isNotEmpty(requestParams.getLogContent()),"log_content",requestParams.getLogContent()); + queryWrapper.ge(StrUtil.isNotEmpty(requestParams.getStartTime()),"create_time",requestParams.getStartTime()); + queryWrapper.le(StrUtil.isNotEmpty(requestParams.getEndTime()),"create_time",requestParams.getEndTime()); + } + queryWrapper.orderByDesc("create_time"); + IPage<NcLogInfo> userIPage = this.page(pageData, queryWrapper); + /*if (userIPage != null && userIPage.getRecords() != null && !userIPage.getRecords().isEmpty()) { + for (NcLogInfo nc : userIPage.getRecords()) { + User user = userService.getById(nc.getCreateUser()); + if (user != null) { + nc.setNickname(user.getNickname()); + nc.setUsername(user.getUsername()); + } + } + }*/ + return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean saveLogNcInfos(NcLogInfo logInfo) { + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //璁剧疆IP鍦板潃 + logInfo.setIp(IpUtils.getIpAddr(request)); + super.save(logInfo); + SysUser user = userService.getById(logInfo.getCreateUser()); + if (user != null) { + logInfo.setNickName(user.getRealname()); + logInfo.setUserName(user.getUsername()); + } + super.saveOrUpdate(logInfo); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean saveLogInfo(String moduleInfo, Integer operateType, String logContent) { + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + NcLogInfo logInfo = new NcLogInfo(); + logInfo.setModuleInfo(moduleInfo); + logInfo.setOperateType(operateType); + logInfo.setLogContent(logContent); + //璁剧疆IP鍦板潃 + logInfo.setIp(IpUtils.getIpAddr(request)); + super.save(logInfo); + SysUser user = userService.getById(logInfo.getCreateUser()); + if (user != null) { + logInfo.setNickName(user.getRealname()); + logInfo.setUserName(user.getUsername()); + } + super.saveOrUpdate(logInfo); + return true; + } + + /** + * 瀵煎嚭鏌ヨList + * @param requestParams + * @return + */ + @Override + @Transactional + public ModelAndView exportLogList(NcLogInfoRequest requestParams){ + QueryWrapper<NcLogInfo> queryWrapper=new QueryWrapper<>(); + if(requestParams != null) { + queryWrapper.eq(StrUtil.isNotEmpty(requestParams.getUsername()),"user_mame",requestParams.getOperateType()); + if(requestParams.getOperateType() != null) { + queryWrapper.eq("operate_type", requestParams.getOperateType()); + } + queryWrapper.like(StrUtil.isNotEmpty(requestParams.getLogContent()),"log_content",requestParams.getLogContent()); + queryWrapper.ge(StrUtil.isNotEmpty(requestParams.getStartTime()),"create_time",requestParams.getStartTime()); + queryWrapper.le(StrUtil.isNotEmpty(requestParams.getEndTime()),"create_time",requestParams.getEndTime()); + } + queryWrapper.orderByDesc("create_time"); + List<NcLogInfo> ncLogInfoList=this.list(queryWrapper); + ncLogInfoList.forEach(item->{ + //缈昏瘧鐢ㄦ埛鍚嶃�佹搷浣滅被鍨� + item.setOperateTypeStr(iSysDictService.queryDictTextByKey("OPERATE_TYPE",item.getOperateType().toString())); + item.setCreateUser(userService.getById(item.getCreateUser()).getRealname()); + }); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "DNC鏃ュ織绠$悊"); + mv.addObject(NormalExcelConstants.CLASS, NcLogInfo.class); + ExportParams exportParams = new ExportParams("DNC鏃ュ織绠$悊" + "鎶ヨ〃", "瀵煎嚭浜�:" + userService.getById(userId).getRealname(), "DNC鏃ュ織绠$悊"); + mv.addObject(NormalExcelConstants.PARAMS, exportParams); + mv.addObject(NormalExcelConstants.DATA_LIST, ncLogInfoList); + return mv; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java new file mode 100644 index 0000000..448765b --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ObjectButtonPermission; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.service.IObjectButtonPermissionService; +import org.jeecg.modules.dnc.mapper.ObjectButtonPermissionMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.response.RoleCode; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class ObjectButtonPermissionServiceImpl extends ServiceImpl<ObjectButtonPermissionMapper, ObjectButtonPermission> implements IObjectButtonPermissionService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByRoleId(String roleId) { + if(!ValidateUtil.validateString(roleId)) + ExceptionCast.cast(RoleCode.ROLE_ID_NONE); + LambdaQueryWrapper<ObjectButtonPermission> lambdaUpdate = Wrappers.lambdaQuery(); + lambdaUpdate.eq(ObjectButtonPermission::getRoleId, roleId); + return super.remove(lambdaUpdate); + } + + @Override + public Map<String, ObjectButtonPermission> getMapByRoleId(String roleId) { + if(!ValidateUtil.validateString(roleId)) + return null; + List<ObjectButtonPermission> list = super.lambdaQuery().eq(ObjectButtonPermission::getRoleId, roleId).list(); + if(list == null || list.isEmpty()) + return null; + Map<String, ObjectButtonPermission> map = new HashMap<>(); + list.forEach(item -> { + map.put(item.getObjectId() + "_" + item.getButtonId(), item); + }); + return map; + } + + @Override + public List<ObjectButtonPermission> findByObjectId(String objId) { + return super.lambdaQuery().eq(ObjectButtonPermission::getObjectId, objId).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java new file mode 100644 index 0000000..c2d2f10 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ObjectButton; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.response.ObjectCode; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.mapper.ObjectButtonMapper; +import org.jeecg.modules.dnc.service.IObjectButtonService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class ObjectButtonServiceImpl extends ServiceImpl<ObjectButtonMapper, ObjectButton> implements IObjectButtonService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByObjectId(String objectId) { + if(!ValidateUtil.validateString(objectId)) + ExceptionCast.cast(ObjectCode.OBJ_ID_NONE); + LambdaQueryWrapper<ObjectButton> lambdaUpdate = Wrappers.lambdaQuery(); + lambdaUpdate.eq(ObjectButton::getObjectId, objectId); + return super.remove(lambdaUpdate); + } + + @Override + public Map<String, ObjectButton> getMapByObjectId(String objectId) { + if(!ValidateUtil.validateString(objectId)) + return null; + List<ObjectButton> list = super.lambdaQuery().eq(ObjectButton::getObjectId, objectId).list(); + if(list == null || list.isEmpty()) + return null; + Map<String, ObjectButton> map = new HashMap<>(); + list.forEach(item -> { + map.put(item.getButtonId(), item); + }); + return map; + } + + @Override + public List<ObjectButton> findByButtonId(String id) { + return super.lambdaQuery().eq(ObjectButton::getButtonId,id).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java new file mode 100644 index 0000000..42512b1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java @@ -0,0 +1,102 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.PartsDepartment; +import org.jeecg.modules.dnc.mapper.PartsDepartmentMapper; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IPartsDepartmentService; +import org.apache.commons.collections4.ListUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class PartsDepartmentServiceImpl extends ServiceImpl<PartsDepartmentMapper, PartsDepartment> implements IPartsDepartmentService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByPartsId(String partsId) { + if(!ValidateUtil.validateString(partsId)) + return false; + LambdaQueryWrapper<PartsDepartment> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PartsDepartment::getPartsId, partsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<Department> getDepartPermsByPartsId(String partsId) { + return super.getBaseMapper().getDepartPermsByPartsId(partsId); + } + + @Override + public List<Department> getDepartNonPermsByProductId(String partsId) { + return super.getBaseMapper().getDepartNonPermsByProductId(partsId); + } + + @Override + public PartsDepartment getByPartsIdAndDepartId(String partsId, String departId) { + if(!ValidateUtil.validateString(partsId) || !ValidateUtil.validateString(departId)) + return null; + List<PartsDepartment> list = super.lambdaQuery().eq(PartsDepartment::getPartsId, partsId).eq(PartsDepartment::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<PartsDepartment> partsDepartments) { + if(partsDepartments == null || partsDepartments.isEmpty()) + return false; + if(partsDepartments.size() == 1) + return super.removeById(partsDepartments.get(0).getPartsDepartId()); + List<String> ids = new ArrayList<>(); + partsDepartments.forEach(item -> { + ids.add(item.getPartsDepartId()); + }); + if(ids.size() > 1000){ + List<List<String>> idsArr = ListUtils.partition(ids, 1000); + for(List<String> arr : idsArr){ + super.removeByIds(arr); + } + return true; + }else { + return super.removeByIds(ids); + } + } + + @Override + public List<PartsDepartment> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> departIds) { + if(partsIds == null || partsIds.isEmpty() || departIds == null || departIds.isEmpty()) + return null; + List<PartsDepartment> total = new ArrayList<>(); + List<List<String>> partListArr; + List<List<String>> departListArr; + if(partsIds.size() > 1000){ + partListArr = ListUtils.partition(partsIds, 100); + }else { + partListArr = ListUtils.partition(partsIds, 1000); + } + if(departIds.size() > 1000){ + departListArr = ListUtils.partition(departIds, 100); + }else { + departListArr = ListUtils.partition(departIds, 1000); + } + for(List<String> partList : partListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<PartsDepartment> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PartsDepartment::getPartsId, partList); + queryWrapper.in(PartsDepartment::getDepartId, departList); + List<PartsDepartment> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java new file mode 100644 index 0000000..bd53894 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java @@ -0,0 +1,488 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; +import org.jeecg.modules.dnc.mapper.PartsInfoMapper; +import org.jeecg.modules.dnc.mapper.ProductInfoMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.PartsInfoCode; +import org.jeecg.modules.dnc.response.ProductInfoCode; +import org.jeecg.modules.dnc.response.UcenterCode; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; + +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.SysUser; +import org.apache.commons.collections4.ListUtils; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +@Service +public class PartsInfoServiceImpl extends ServiceImpl<PartsInfoMapper, PartsInfo> implements IPartsInfoService { + @Autowired + private ProductInfoMapper productInfoMapper; + @Autowired + private ComponentInfoMapper componentInfoMapper; + @Autowired + private IPartsPermissionService partsPermissionService; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IPartsDepartmentService partsDepartmentService; + @Autowired + @Lazy + private IProcessStreamService processStreamService; + @Autowired + private IDocInfoService docInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addPartsInfo(PartsInfo partsInfo) { + if(partsInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(partsInfo.getPartsName())) + ExceptionCast.cast(PartsInfoCode.PARTS_NAME_NONE); + if(!ValidateUtil.validateString(partsInfo.getProductId())) + ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); + if(!ValidateUtil.validateString(partsInfo.getComponentId())) + ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); + if(!ValidateUtil.validateString(partsInfo.getPartsCode())) + ExceptionCast.cast(PartsInfoCode.PARTS_CODE_NONE); + PartsInfo en = getByCode(partsInfo.getPartsCode()); + if(en != null) + ExceptionCast.cast(PartsInfoCode.PARTS_IS_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + ProductInfo productInfo = productInfoMapper.selectById(partsInfo.getProductId()); + if(productInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); + ComponentInfo componentInfo = componentInfoMapper.selectById(partsInfo.getComponentId()); + if(componentInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); + partsInfo.setPartsStatus(1); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"锛岄浂浠朵唬鍙凤細"+partsInfo.getPartsCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(partsInfo); + List<PermissionStream> oldDepartPermList = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<PartsDepartment> partsDepartmentList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + oldDepartPermList.forEach(item -> { + PartsDepartment pd = new PartsDepartment(); + pd.setDepartId(item.getDepartId()); + pd.setPartsId(partsInfo.getPartsId()); + partsDepartmentList.add(pd); + PermissionStream perm = new PermissionStream(); + perm.setDepartId(item.getDepartId()); + perm.setProductId(partsInfo.getProductId()); + perm.setComponentId(partsInfo.getComponentId()); + perm.setPartsId(partsInfo.getPartsId()); + permissionStreamList.add(perm); + }); + if(!partsDepartmentList.isEmpty()) { + b = partsDepartmentService.saveBatch(partsDepartmentList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!permissionStreamList.isEmpty()) { + b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + } + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + PartsPermission permission = new PartsPermission(); + permission.setPartsId(partsInfo.getPartsId()); + permission.setUserId(userId); + b = partsPermissionService.save(permission); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞榛樿宸ュ簭 + ProcessStream processStream = new ProcessStream(); + processStream.setProductId(partsInfo.getProductId()); + processStream.setComponentId(partsInfo.getComponentId()); + processStream.setPartsId(partsInfo.getPartsId()); + processStream.setProcessCode("1"); + b = processStreamService.save(processStream); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鐢ㄦ埛鏉冮檺 + PermissionStream stream = new PermissionStream(); + stream.setProductId(partsInfo.getProductId()); + stream.setComponentId(partsInfo.getComponentId()); + stream.setPartsId(partsInfo.getPartsId()); + stream.setUserId(userId); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfogx = new NcLogInfo(); + //妯″潡 + ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfogx.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfogx.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfogx); + return permissionStreamService.save(stream); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editPartsInfo(String id, PartsInfo partsInfo) { + if(!ValidateUtil.validateString(id) || partsInfo == null) + ExceptionCast.cast(CommonCode.SUCCESS); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + PartsInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + partsInfo.setPartsId(id); + partsInfo.setPartsStatus(null); + partsInfo.setProductId(null); + partsInfo.setComponentId(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //淇敼淇濆瓨澶囨敞 + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("淇敼閮ㄤ欢鍚嶇О锛�"+productInfoMapper.selectById(en.getProductId()).getProductName()+"瀛愰泦闆朵欢"); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.updateById(partsInfo); + if(!b) + return false; + PartsPermission permission = partsPermissionService.getByPartsIdAndUserId(id, userId); + if(permission == null) { + permission = new PartsPermission(); + permission.setPartsId(id); + permission.setUserId(userId); + b = partsPermissionService.save(permission); + if(!b) + return false; + } + PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(en.getProductId(), en.getComponentId(), id, userId); + if(stream == null) { + stream = new PermissionStream(); + stream.setProductId(en.getProductId()); + stream.setComponentId(en.getComponentId()); + stream.setPartsId(id); + stream.setUserId(userId); + return permissionStreamService.save(stream); + } + return b; + } + + @Override + public List<PartsInfo> getByUserPerms(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPerms(userId); + } + + @Override + public List<PartsInfo> getByUserPerms(String userId, String componentId, String queryParam) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + //鍘婚櫎鏉冮檺 TODO + //return super.getBaseMapper().getByUserPermsAndParams(userId, componentId, queryParam); + LambdaQueryWrapper<PartsInfo> queryWrapper = Wrappers.lambdaQuery(); + if(ValidateUtil.validateString(componentId)) { + queryWrapper.eq(PartsInfo::getComponentId, componentId); + } + if(ValidateUtil.validateString(queryParam)) { + queryWrapper.and(wrapper->wrapper.like(PartsInfo::getPartsCode, queryParam) + .or() + .like(PartsInfo::getPartsName, queryParam)); + } + queryWrapper.orderByAsc(PartsInfo::getCreateTime); + return super.list(queryWrapper); + } + + @Override + public List<PartsInfo> getByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return null; + return super.lambdaQuery().eq(PartsInfo::getProductId, productId).list(); + } + + @Override + public List<PartsInfo> getByComponentId(String productId, String componentId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) + return null; + return super.lambdaQuery().eq(PartsInfo::getProductId, productId).eq(PartsInfo::getComponentId, componentId).list(); + } + + @Override + public boolean deleteCollection(List<PartsInfo> partsInfoList) { + if(partsInfoList == null || partsInfoList.isEmpty()) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + partsInfoList.forEach(item -> { + boolean b = partsPermissionService.deleteByPartsId(item.getPartsId()); + if(!b) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + b = partsDepartmentService.deleteByPartsId(item.getPartsId()); + if(!b) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + b = permissionStreamService.deleteUserPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId()); + if(!b) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + b = permissionStreamService.deleteDepartPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId()); + if(!b) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + b = super.removeById(item.getPartsId()); + if(!b) + ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); + }); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deletePartsInfo(String partsId) { + if(!ValidateUtil.validateString(partsId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + PartsInfo partsInfo = super.getById(partsId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + List<ProcessStream> processStreams = processStreamService.findByPartsId(partsId); + if(processStreams != null && !processStreams.isEmpty()) + ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); + boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteUserPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteDepartPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = docInfoService.deleteByPartsId(partsInfo.getPartsId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(partsInfo.getPartsId()); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(PartsInfo partsInfo, Collection<SysUser> userList) { + if(partsInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<PartsPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId()); + if(en == null) { + en = new PartsPermission(); + en.setUserId(item.getId()); + en.setPartsId(partsInfo.getPartsId()); + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setUserId(item.getId()); + stream.setProductId(partsInfo.getProductId()); + stream.setComponentId(partsInfo.getComponentId()); + stream.setPartsId(partsInfo.getPartsId()); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = partsPermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(PartsInfo partsInfo, Collection<SysUser> userList) { + if(partsInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<PartsPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId()); + if(en != null) { + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //娓呯┖鐢ㄦ埛鏉冮檺鏍¢獙 + /*List<PartsPermission> exitsList = partsPermissionService.getByPartsId(partsInfo.getPartsId()); + if(exitsList.size() <= permissionList.size()) + ExceptionCast.cast(PartsInfoCode.PARTS_USER_NONE);*/ + if(!permissionList.isEmpty()) { + boolean b = partsPermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList) { + if(partsInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<PartsDepartment> partsDepartments = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); + if(en == null) { + en = new PartsDepartment(); + en.setDepartId(item.getDepartId()); + en.setPartsId(partsInfo.getPartsId()); + partsDepartments.add(en); + } + PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setDepartId(item.getDepartId()); + stream.setProductId(partsInfo.getProductId()); + stream.setComponentId(partsInfo.getComponentId()); + stream.setPartsId(partsInfo.getPartsId()); + permissionStreamList.add(stream); + } + }); + if(!partsDepartments.isEmpty()) { + boolean b = partsDepartmentService.saveBatch(partsDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList) { + if(partsInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<PartsDepartment> partsDepartments = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); + if(en != null) { + partsDepartments.add(en); + } + PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + if(!partsDepartments.isEmpty()) { + boolean b = partsDepartmentService.removeByCollection(partsDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + public List<PartsInfo> getByComponentIdList(String productId, List<String> componentIds) { + if(!ValidateUtil.validateString(productId) || componentIds == null || componentIds.isEmpty()) + return null; + List<PartsInfo> list = new ArrayList<>(); + if(componentIds.size() > 1000){ + List<List<String>> compListArr = ListUtils.partition(componentIds, 100); + for(List<String> compList : compListArr){ + List<PartsInfo> partsList = super.lambdaQuery().eq(PartsInfo::getProductId, productId).in(PartsInfo::getComponentId, compList).list(); + if(partsList != null && !partsList.isEmpty()){ + list.addAll(partsList); + } + } + }else { + list = super.lambdaQuery().eq(PartsInfo::getProductId, productId).in(PartsInfo::getComponentId, componentIds).list(); + } + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + public PartsInfo getByCode(String partsCode) { + if(ValidateUtil.validateString(partsCode)) { + List<PartsInfo> list = super.lambdaQuery().eq(PartsInfo::getPartsCode, partsCode).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + return null; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPermissionServiceImpl.java new file mode 100644 index 0000000..037ccd4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPermissionServiceImpl.java @@ -0,0 +1,112 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.PartsPermission; +import org.jeecg.modules.dnc.mapper.PartsPermissionMapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.service.IPartsPermissionService; +import org.apache.commons.collections4.ListUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +public class PartsPermissionServiceImpl extends ServiceImpl<PartsPermissionMapper, PartsPermission> implements IPartsPermissionService { + @Override + public PartsPermission getByPartsIdAndUserId(String partsId, String userId) { + if(!ValidateUtil.validateString(partsId) || !ValidateUtil.validateString(userId)) + return null; + List<PartsPermission> permissions = super.lambdaQuery().eq(PartsPermission::getPartsId, partsId).eq(PartsPermission::getUserId, userId).list(); + if(permissions == null || permissions.isEmpty()) + return null; + return permissions.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByPartsId(String partsId) { + if(!ValidateUtil.validateString(partsId)) + return false; + LambdaQueryWrapper<PartsPermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PartsPermission::getPartsId, partsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<UserDepartExt> getUserPermsByProductId(String partsId) { + return super.getBaseMapper().getUserPermsByProductId(partsId); + } + + @Override + public List<SysUser> getUserNonPermsByProductId(String partsId) { + return super.getBaseMapper().getUserNonPermsByProductId(partsId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<PartsPermission> permissionList) { + if(permissionList == null || permissionList.isEmpty()) + return false; + if(permissionList.size() == 1) + return super.removeById(permissionList.get(0).getPartsPermId()); + List<String> ids = new ArrayList<>(); + permissionList.forEach(item -> { + ids.add(item.getPartsPermId()); + }); + if(ids.size() > 1000){ + List<List<String>> idsArr = ListUtils.partition(ids, 1000); + for(List<String> arr : idsArr){ + super.removeByIds(arr); + } + return true; + }else { + return super.removeByIds(ids); + } + } + + @Override + public List<PartsPermission> getByPartsId(String partsId) { + List<PartsPermission> list = super.lambdaQuery().eq(PartsPermission::getPartsId, partsId).list(); + if(list == null) + list = Collections.emptyList(); + return list; + } + + @Override + public List<PartsPermission> getByPartsIdsAndUserIds(List<String> partsIds, List<String> userIds) { + if(partsIds == null || partsIds.isEmpty() || userIds == null || userIds.isEmpty()) + return null; + List<PartsPermission> total = new ArrayList<>(); + List<List<String>> partsListArr; + List<List<String>> userListArr; + if(partsIds.size() > 1000){ + partsListArr = ListUtils.partition(partsIds, 100); + }else { + partsListArr = ListUtils.partition(partsIds, 1000); + } + if(userIds.size() > 1000){ + userListArr = ListUtils.partition(userIds, 100); + }else { + userListArr = ListUtils.partition(userIds, 1000); + } + for(List<String> compList : partsListArr) { + for(List<String> userList : userListArr){ + LambdaQueryWrapper<PartsPermission> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PartsPermission::getPartsId, compList); + queryWrapper.in(PartsPermission::getUserId, userList); + List<PartsPermission> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java new file mode 100644 index 0000000..b7e0261 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java @@ -0,0 +1,351 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.PermissionStream; +import org.jeecg.modules.dnc.mapper.PermissionStreamMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IPermissionStreamService; +import org.apache.commons.collections4.ListUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class PermissionStreamServiceImpl extends ServiceImpl<PermissionStreamMapper, PermissionStream> implements IPermissionStreamService { + @Override + public PermissionStream getByProductIdAndUserId(String productId, String userId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + eq(PermissionStream::getUserId, userId).isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public PermissionStream getByComponentIdAndUserId(String productId, String componentId, String userId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) + || !ValidateUtil.validateString(componentId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) + .isNull(PermissionStream::getPartsId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public PermissionStream getByPartsIdAndUserId(String productId, String componentId, String partsId, String userId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) + || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(partsId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) + .eq(PermissionStream::getPartsId, partsId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<PermissionStream> getByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + isNull(PermissionStream::getUserId).isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + public List<PermissionStream> getByComponentId(String productId, String componentId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + isNull(PermissionStream::getUserId).eq(PermissionStream::getComponentId, componentId) + .isNull(PermissionStream::getPartsId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + public List<PermissionStream> getByPartsId(String productId, String componentId, String partsId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) + || !ValidateUtil.validateString(partsId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). + isNull(PermissionStream::getUserId).eq(PermissionStream::getComponentId, componentId) + .eq(PermissionStream::getPartsId, partsId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteUserPermsByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) + .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteUserPermsByComponentId(String productId, String componentId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) + .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteUserPermsByPartsId(String productId, String componentId, String partsId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) + || !ValidateUtil.validateString(partsId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) + .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartPermsByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) + .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartPermsByComponentId(String productId, String componentId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) + .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteDepartPermsByPartsId(String productId, String componentId, String partsId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) + || !ValidateUtil.validateString(partsId)) + return false; + LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) + .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<PermissionStream> permissionStreamList) { + if(permissionStreamList == null || permissionStreamList.isEmpty()) + return false; + if(permissionStreamList.size() == 1) { + return super.removeById(permissionStreamList.get(0).getStreamId()); + } + List<String> ids = new ArrayList<>(); + permissionStreamList.forEach(item -> { + ids.add(item.getStreamId()); + }); + return super.removeByIds(ids); + } + + @Override + public PermissionStream getByProductIdAndDepartId(String productId, String departId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) + .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId) + .isNull(PermissionStream::getUserId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public PermissionStream getByComponentIdAndDepartId(String productId, String componentId, String departId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) || !ValidateUtil.validateString(componentId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) + .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId) + .isNull(PermissionStream::getUserId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public PermissionStream getByPartsIdAndDepartId(String productId, String componentId, String partsId, String departId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) + || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(partsId)) + return null; + List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) + .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId) + .isNull(PermissionStream::getUserId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<PermissionStream> findByDepartId(String departId) { + return super.lambdaQuery().eq(PermissionStream::getDepartId, departId).list(); + } + + @Override + public List<PermissionStream> findByUserId(String userId) { + return super.lambdaQuery().eq(PermissionStream::getUserId, userId).list(); + } + + @Override + public List<PermissionStream> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds) { + if(componentIds == null || componentIds.isEmpty() || userIds == null || userIds.isEmpty()) + return null; + List<PermissionStream> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> userListArr; + if(componentIds.size() > 1000){ + compListArr = ListUtils.partition(componentIds, 100); + }else { + compListArr = ListUtils.partition(componentIds, 1000); + } + if(userIds.size() > 1000){ + userListArr = ListUtils.partition(userIds, 100); + }else { + userListArr = ListUtils.partition(userIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> userList : userListArr){ + LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStream::getComponentId, compList); + queryWrapper.in(PermissionStream::getUserId, userList); + queryWrapper.isNull(PermissionStream::getPartsId); + queryWrapper.isNull(PermissionStream::getDepartId); + List<PermissionStream> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + + @Override + public List<PermissionStream> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> departIds) { + if(componentIds == null || componentIds.isEmpty() || departIds == null || departIds.isEmpty()) + return null; + List<PermissionStream> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> departListArr; + if(componentIds.size() > 1000){ + compListArr = ListUtils.partition(componentIds, 100); + }else { + compListArr = ListUtils.partition(componentIds, 1000); + } + if(departIds.size() > 1000){ + departListArr = ListUtils.partition(departIds, 100); + }else { + departListArr = ListUtils.partition(departIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStream::getComponentId, compList); + queryWrapper.in(PermissionStream::getDepartId, departList); + queryWrapper.isNull(PermissionStream::getUserId); + queryWrapper.isNull(PermissionStream::getPartsId); + List<PermissionStream> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + + @Override + public List<PermissionStream> getByPartsIdsAndUserIds(List<String> partsIds, List<String> userIds) { + if(partsIds == null || partsIds.isEmpty() || userIds == null || userIds.isEmpty()) + return null; + List<PermissionStream> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> userListArr; + if(partsIds.size() > 1000){ + compListArr = ListUtils.partition(partsIds, 100); + }else { + compListArr = ListUtils.partition(partsIds, 1000); + } + if(userIds.size() > 1000){ + userListArr = ListUtils.partition(userIds, 100); + }else { + userListArr = ListUtils.partition(userIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> userList : userListArr){ + LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStream::getPartsId, compList);//闆朵欢 + queryWrapper.in(PermissionStream::getUserId, userList); + queryWrapper.isNull(PermissionStream::getDepartId); + List<PermissionStream> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + + @Override + public List<PermissionStream> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> departIds) { + if(partsIds == null || partsIds.isEmpty() || departIds == null || departIds.isEmpty()) + return null; + List<PermissionStream> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> departListArr; + if(partsIds.size() > 1000){ + compListArr = ListUtils.partition(partsIds, 100); + }else { + compListArr = ListUtils.partition(partsIds, 1000); + } + if(departIds.size() > 1000){ + departListArr = ListUtils.partition(departIds, 100); + }else { + departListArr = ListUtils.partition(departIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStream::getPartsId, compList); + queryWrapper.in(PermissionStream::getDepartId, departList); + queryWrapper.isNull(PermissionStream::getUserId); + List<PermissionStream> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessInfoServiceImpl.java new file mode 100644 index 0000000..6833ef5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessInfoServiceImpl.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ProcessInfo; +import org.jeecg.modules.dnc.mapper.ProcessInfoMapper; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IProcessInfoService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; + +@Service +public class ProcessInfoServiceImpl extends ServiceImpl<ProcessInfoMapper, ProcessInfo> implements IProcessInfoService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addOrEdit(ProcessInfo processInfo) { + if(processInfo == null) + return false; + if(!ValidateUtil.validateString(processInfo.getProcessName())) + return false; + processInfo.setProcessName(processInfo.getProcessName().toUpperCase()); + ProcessInfo en = getByName(processInfo.getProcessName()); + if(en != null) { + processInfo.setProcessId(en.getProcessId()); + return super.updateById(processInfo); + }else { + return super.save(processInfo); + } + } + + @Override + public ProcessInfo getByName(String processName) { + if(!ValidateUtil.validateString(processName)) + return null; + List<ProcessInfo> list = super.lambdaQuery().eq(ProcessInfo::getProcessName, processName.toUpperCase()).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<ProcessInfo> findByProcessName(String processName) { + if(!ValidateUtil.validateString(processName)) + return Collections.emptyList(); + return super.lambdaQuery().like(ProcessInfo::getProcessName, processName).list(); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java new file mode 100644 index 0000000..813f313 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java @@ -0,0 +1,226 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ProcessStreamMapper; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ComponentInfoCode; +import org.jeecg.modules.dnc.response.DeviceCode; +import org.jeecg.modules.dnc.response.ProcessInfoCode; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.utils.ValidateUtil; + + +import org.jeecg.modules.dnc.request.ProcessStreamRequest; +import org.jeecg.modules.dnc.entity.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; + +@Service +public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { + @Autowired + @Lazy + private IComponentInfoService componentInfoService; + @Autowired + private IProcessInfoService processInfoService; + @Autowired + private IPartsInfoService partsInfoService; + @Autowired + private IDocInfoService docInfoService; + @Autowired + @Lazy + private IDeviceInfoService deviceInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addProcessStream(ProcessStream stream) { + if(stream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(stream.getProductId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); + if(!ValidateUtil.validateString(stream.getComponentId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); + if(!ValidateUtil.validateString(stream.getProcessName())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); + if(!ValidateUtil.validateString(stream.getProcessCode())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_CODE_NONE); + if(ValidateUtil.validateString(stream.getPartsId())) { + PartsInfo partsInfo = partsInfoService.getById(stream.getPartsId()); + if(partsInfo == null) + ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE); + if(!stream.getProductId().equals(partsInfo.getProductId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); + if(!stream.getComponentId().equals(partsInfo.getComponentId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); + ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), partsInfo.getPartsId()); + if(en != null) { + ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); + } + }else { + ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId()); + if(componentInfo == null) + ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); + if(!stream.getProductId().equals(componentInfo.getProductId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); + stream.setPartsId(null); + ProcessStream en = findByProcessNoAndComponentId(stream.getProcessCode(), componentInfo.getComponentId()); + if(en != null) { + ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); + } + } + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("宸ュ簭鍚嶇О锛�"+stream.getProcessName()+"锛屽伐搴忓彿锛�"+stream.getProcessCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(stream); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + ProcessInfo processInfo = new ProcessInfo(); + processInfo.setProcessName(stream.getProcessName()); + processInfo.setDescription(stream.getDescription()); + return processInfoService.addOrEdit(processInfo); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editProcessStream(String id, ProcessStream stream) { + if(!ValidateUtil.validateString(id) || stream == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(stream.getProcessName())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); + ProcessStream en = super.getById(id); + if(en == null) + ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); + stream.setProcessId(id); + stream.setProductId(null); + stream.setComponentId(null); + stream.setPartsId(null); + stream.setProcessName(stream.getProcessName().toUpperCase()); + stream.setProcessCode(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("宸ュ簭鍙凤細"+en.getProcessCode()); + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.updateById(stream); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + ProcessInfo processInfo = new ProcessInfo(); + processInfo.setProcessName(stream.getProcessName()); + processInfo.setDescription(stream.getDescription()); + return processInfoService.addOrEdit(processInfo); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteProcessStream(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ProcessStream en = super.getById(id); + if(en == null) + ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); + boolean b = docInfoService.deleteByProcessId(en.getProcessId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("宸ュ簭鍙凤細"+en.getProcessCode()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(id); + } + + @Override + public List<ProcessStream> findByNodeParams(ProcessStreamRequest request) { + if(request == null || !ValidateUtil.validateString(request.getProductId()) || !ValidateUtil.validateString(request.getComponentId())) + return Collections.emptyList(); + LambdaQueryChainWrapper<ProcessStream> lambdaQuery = super.lambdaQuery().eq(ProcessStream::getProductId, request.getProductId()).eq(ProcessStream::getComponentId, request.getComponentId()); + if(ValidateUtil.validateString(request.getPartsId())) { + lambdaQuery.eq(ProcessStream::getPartsId, request.getPartsId()); + }else { + lambdaQuery.isNull(ProcessStream::getPartsId); + } + return lambdaQuery.list(); + } + + @Override + public List<ProcessStream> findByProductId(String productId) { + return super.lambdaQuery().eq(ProcessStream::getProductId, productId).list(); + } + + @Override + public List<ProcessStream> findByComponentId(String componentId) { + return super.lambdaQuery().eq(ProcessStream::getComponentId, componentId).list(); + } + + @Override + public List<ProcessStream> findByPartsId(String partsId) { + return super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).list(); + } + + @Override + public ProcessStream findByProcessNoAndPartsId(String processNo, String partsId) { + List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).eq(ProcessStream::getProcessCode, processNo).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public ProcessStream findByProcessNoAndComponentId(String processNo, String componentId) { + List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getComponentId, componentId).eq(ProcessStream::getProcessCode, processNo).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public List<ProcessStream> validateDeviceProcessInfo(String pnCode, String deviceNo) { + if(!ValidateUtil.validateString(pnCode) || !ValidateUtil.validateString(deviceNo)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); + if(deviceInfo == null) + ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); + PermissionStream stream = componentInfoService.validateComponentOrPartsPnCode(pnCode); + if(stream == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_EXIST); + LambdaQueryWrapper<ProcessStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ProcessStream::getProductId, stream.getProductId()); + lambdaQueryWrapper.eq(ProcessStream::getComponentId, stream.getComponentId()); + if(ValidateUtil.validateString(stream.getPartsId())) { + lambdaQueryWrapper.eq(ProcessStream::getPartsId, stream.getPartsId()); + } + lambdaQueryWrapper.like(ProcessStream::getProcessingEquipmentCode, deviceNo); + List<ProcessStream> list = super.list(lambdaQueryWrapper); + if(list == null || list.isEmpty()) + ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); + return list; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java new file mode 100644 index 0000000..5e7309f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ProductDepartment; +import org.jeecg.modules.dnc.mapper.ProductDepartmentMapper; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.service.IProductDepartmentService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class ProductDepartmentServiceImpl extends ServiceImpl<ProductDepartmentMapper, ProductDepartment> implements IProductDepartmentService { + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return false; + LambdaQueryWrapper<ProductDepartment> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ProductDepartment::getProductId, productId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<Department> getDepartPermsByProductId(String productId) { + return super.getBaseMapper().getDepartPermsByProductId(productId); + } + + @Override + public List<Department> getDepartNonPermsByProductId(String productId) { + return super.getBaseMapper().getDepartNonPermsByProductId(productId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<ProductDepartment> productDepartmentList) { + if(productDepartmentList == null || productDepartmentList.isEmpty()) + return false; + if(productDepartmentList.size() == 1) + return super.removeById(productDepartmentList.get(0).getProductDepartId()); + List<String> ids = new ArrayList<>(); + productDepartmentList.forEach(item -> { + ids.add(item.getProductDepartId()); + }); + return super.removeByIds(ids); + } + + @Override + public ProductDepartment getByProductIdAndDepartId(String productId, String departId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId)) + return null; + List<ProductDepartment> list = super.lambdaQuery().eq(ProductDepartment::getProductId, productId).eq(ProductDepartment::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java new file mode 100644 index 0000000..9d079ff --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java @@ -0,0 +1,1520 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.dto.ComponentExt; + +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ProductInfoMapper; + +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.service.support.ProductTreeWrapper; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; + +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; + +import org.jeecg.modules.dnc.response.ComponentInfoCode; +import org.jeecg.modules.dnc.response.PartsInfoCode; +import org.jeecg.modules.dnc.response.ProductInfoCode; +import org.jeecg.modules.dnc.response.UcenterCode; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +@Service +@Slf4j +public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper,ProductInfo> implements IProductInfoService { + @Autowired + @Lazy + private IComponentInfoService componentInfoService; + @Autowired + @Lazy + private IPartsInfoService partsInfoService; + @Autowired + private IProductPermissionService productPermissionService; + @Autowired + private IProductDepartmentService productDepartmentService; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IComponentDepartmentService componentDepartmentService; + @Autowired + private IComponentPermissionService componentPermissionService; + @Autowired + private IPartsDepartmentService partsDepartmentService; + @Autowired + private IPartsPermissionService partsPermissionService; + @Autowired + private IDepartmentService departmentService; + @Autowired + private ISysUserService userService; + @Autowired + @Lazy + private IProcessStreamService processStreamService; + @Autowired + private IDocInfoService docInfoService; + @Autowired + private INcLogInfoService iNcLogInfoService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addProductInfo(ProductInfo productInfo) { + if(productInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(productInfo.getProductName())) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NAME_NONE); + if(!ValidateUtil.validateString(productInfo.getProductNo())) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_NO_NONE); + } + ProductInfo en = getByProductNo(productInfo.getProductNo()); + if(en != null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_IS_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + productInfo.setProductStatus(1); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(2); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("浜у搧鍚嶇О锛�"+productInfo.getProductName()+"锛屼骇鍝佺紪鍙凤細"+productInfo.getProductNo()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.save(productInfo); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); + } + ProductPermission permission = new ProductPermission(); + permission.setProductId(productInfo.getProductId()); + permission.setUserId(userId); + b = productPermissionService.save(permission); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); + } + PermissionStream stream = new PermissionStream(); + stream.setProductId(productInfo.getProductId()); + stream.setUserId(userId); + return permissionStreamService.save(stream); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean editProductInfo(String id ,ProductInfo productInfo) { + if(!ValidateUtil.validateString(id) || productInfo == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + ProductInfo en = super.getById(id); + if(en == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + productInfo.setProductId(id); + productInfo.setProductStatus(null); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(3); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("浜у搧鍚嶇О锛�"+productInfo.getProductName()); + ncLogInfo.setRemark(JSONObject.toJSONString(en)); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + boolean b = super.updateById(productInfo); + if(!b) + return false; + ProductPermission permission = productPermissionService.getByProductIdAndUserId(id, userId); + if(permission == null) { + permission = new ProductPermission(); + permission.setProductId(id); + permission.setUserId(userId); + b = productPermissionService.save(permission); + if(!b) { + return false; + } + } + PermissionStream stream = permissionStreamService.getByProductIdAndUserId(id, userId); + if(stream == null) { + stream = new PermissionStream(); + stream.setProductId(id); + stream.setUserId(userId); + return permissionStreamService.save(stream); + } + return b; + } + + @Override + public List<CommonGenericTree> loadProductTree(String userId) { + List<ProductInfo> productInfoList = getByUserPerms(userId); + if(productInfoList == null || productInfoList.isEmpty()) + return Collections.emptyList(); + List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId); + if(componentInfoList == null) + componentInfoList = Collections.emptyList(); + List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId); + if(partsInfos == null) + partsInfos = Collections.emptyList(); + return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos); + } + + @Override + public List<ProductInfo> getByUserPerms(String userId) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPerms(userId); + } + + @Override + public List<ProductInfo> getByUserPerms(String userId, String queryParam) { + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + //鍘婚櫎鏉冮檺 TODO + LambdaQueryWrapper<ProductInfo> queryWrapper = Wrappers.lambdaQuery(); + if(ValidateUtil.validateString(queryParam)) { + queryWrapper.and(wrapper -> wrapper.like(ProductInfo::getProductNo, queryParam) + .or() + .like(ProductInfo::getProductName, queryParam)); + } + return super.list(queryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteProductInfo(String id) { + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ProductInfo productInfo = super.getById(id); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + //楠岃瘉浜у搧涓嬫槸鍚︽湁閮ㄤ欢 + List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); + if(componentInfoList != null && !componentInfoList.isEmpty()) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_COMPONENT_EXIST); + } + //楠岃瘉浜у搧涓嬫槸鍚︽湁闆朵欢 + List<PartsInfo> partsInfoList = partsInfoService.getByProductId(productInfo.getProductId()); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_PARTS_EXIST); + } + List<ProcessStream> processStreams = processStreamService.findByProductId(id); + if(processStreams != null && !processStreams.isEmpty()) + ExceptionCast.cast(ProductInfoCode.PRODUCT_PROCESS_EXIST); + boolean b = productPermissionService.deleteByProductId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = productDepartmentService.deleteByProductId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteUserPermsByProductId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamService.deleteDepartPermsByProductId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = docInfoService.deleteByProductId(id); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞鏃ュ織 + NcLogInfo ncLogInfo = new NcLogInfo(); + //妯″潡 + ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); + //绫诲瀷 + ncLogInfo.setOperateType(4); + //鏃ュ織鍐呭 + ncLogInfo.setLogContent("浜у搧鍚嶇О锛�"+productInfo.getProductName()); + iNcLogInfoService.saveLogNcInfos(ncLogInfo); + return super.removeById(id); + } + + @Override + public boolean checkProductPerm(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + if(nodeType == 1) { + ProductInfo productInfo = super.getById(paramId); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + PermissionStream permission = permissionStreamService.getByProductIdAndUserId(paramId, userId); + if(permission == null) + return false; + return true; + }else if(nodeType == 2) { + ComponentInfo componentInfo = componentInfoService.getById(paramId); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + PermissionStream permission = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), paramId, userId); + if(permission == null) + return false; + return true; + }else if(nodeType == 3) { + PartsInfo partsInfo = partsInfoService.getById(paramId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + PermissionStream permission = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), paramId, userId); + if(permission == null) + return false; + return true; + } + return false; + } + + @Override + public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return productPermissionService.getUserPermsByProductId(paramId); + }else if(nodeType == 2) { + return componentPermissionService.getUserPermsByComponentId(paramId); + }else if(nodeType == 3) { + return partsPermissionService.getUserPermsByProductId(paramId); + }else { + return null; + } + } + + @Override + public List<SysUser> getUserNonPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return productPermissionService.getUserNonPermsByProductId(paramId); + }else if(nodeType == 2) { + return componentPermissionService.getUserNonPermsByComponentId(paramId); + }else if(nodeType == 3) { + return partsPermissionService.getUserNonPermsByProductId(paramId); + }else { + return null; + } + } + + @Override + public List<Department> getDepartPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return productDepartmentService.getDepartPermsByProductId(paramId); + }else if(nodeType == 2) { + return componentDepartmentService.getDepartPermsByComponentId(paramId); + }else if(nodeType == 3) { + return partsDepartmentService.getDepartPermsByPartsId(paramId); + }else { + return null; + } + } + + @Override + public List<Department> getDepartNonPermsList(Integer nodeType, String paramId) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) + return null; + if(nodeType == 1) { + return productDepartmentService.getDepartNonPermsByProductId(paramId); + }else if(nodeType == 2) { + return componentDepartmentService.getDepartNonPermsByComponentId(paramId); + }else if(nodeType == 3) { + return partsDepartmentService.getDepartNonPermsByProductId(paramId); + }else { + return null; + } + } + + /** + * 1銆佸惊鐜彃鍏ヤ紭鍖� + * 2銆佹煡璇紭鍖� + * 3銆佸皝瑁呬紭鍖� TODO + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param relativeFlag 1 鏄� 2 鍚� + * @param userIds 娣诲姞鐢ㄦ埛ids + * @return + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds) { + //鍙傛暟鏍¢獙 + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); + List<String> ids = new ArrayList<>(userIds.length); + Collections.addAll(ids, userIds); + Collection<SysUser> userList = userService.listByIds(ids); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + //鑺傜偣绫诲瀷鍒ゅ畾 + if(nodeType == 3) { + //澶勭悊闆朵欢 + PartsInfo partsInfo = partsInfoService.getById(paramId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + boolean b = checkProductPerm(3, partsInfo.getPartsId()); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + return partsInfoService.assignAddUser(partsInfo, userList); + }else if(nodeType == 1) { + //澶勭悊浜у搧 + ProductInfo productInfo = super.getById(paramId); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + boolean b1 = checkProductPerm(1, productInfo.getProductId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = this.assignAddUser(productInfo, userList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + + List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); + if(componentInfoList == null || componentInfoList.isEmpty()){ + //娌℃湁鍙坊鍔犵殑闆堕儴浠舵潈闄� + return true; + } + + //鏈�缁堜繚瀛樻潈闄愭暟鎹垵濮嬪寲 + List<ComponentPermission> componentPermissionList = new ArrayList<>(); + List<PartsPermission> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + //澶勭悊瀛愰儴浠� + List<String> componentIds = new ArrayList<>(); + PermissionStream s; + + Map<String, ComponentPermission> componentPermissionMap = new HashMap<>(); + Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); + + //鍒濆鍖栧叏浣撴暟鎹� + String key; + ComponentPermission cp; + ComponentInfo cpInfo; + for(ComponentInfo c : componentInfoList){ + componentIds.add(c.getComponentId()); + componentInfoMap.put(c.getComponentId(), c); + for(SysUser u : userList){ + key = c.getComponentId() + "," + u.getId(); + cp = new ComponentPermission(c.getComponentId(), u.getId()); + componentPermissionMap.put(key, cp); + } + } + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<ComponentPermission> existList = componentPermissionService.getByComponentIdsAndUserIds(componentIds, ids); + if(existList != null && !existList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(ComponentPermission permission : existList){ + key = permission.getComponentId() + "," + permission.getUserId(); + if(componentPermissionMap.containsKey(key)){ + componentPermissionMap.remove(key); + } + } + } + for(Map.Entry<String, ComponentPermission> entry : componentPermissionMap.entrySet()){ + cp = entry.getValue(); + componentPermissionList.add(cp); + cpInfo = componentInfoMap.get(cp.getComponentId()); + s = new PermissionStream(); + s.setProductId(cpInfo.getProductId()); + s.setComponentId(cpInfo.getComponentId()); + s.setUserId(cp.getUserId()); + permissionStreamList.add(s); + } + + //澶勭悊瀛愰浂浠� + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productInfo.getProductId(), componentIds); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + Map<String, PartsPermission> partsPermissionHashMap = new HashMap<>(); + Map<String, PartsInfo> partsInfoMap = new HashMap<>(); + List<String> partsIds = new ArrayList<>(); + PartsPermission pp; + PartsInfo ptInfo; + for(PartsInfo p : partsInfoList){ + partsIds.add(p.getPartsId()); + partsInfoMap.put(p.getPartsId(), p); + for(SysUser u : userList){ + key = p.getPartsId() + "," + u.getId(); + pp = new PartsPermission(p.getPartsId(), u.getId()); + partsPermissionHashMap.put(key, pp); + } + } + + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<PartsPermission> existPartsList = partsPermissionService.getByPartsIdsAndUserIds(partsIds, ids); + if(existPartsList != null && !existPartsList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(PartsPermission permission : existPartsList){ + key = permission.getPartsId() + "," + permission.getUserId(); + if(partsPermissionHashMap.containsKey(key)){ + partsPermissionHashMap.remove(key); + } + } + } + + for(Map.Entry<String, PartsPermission> entry : partsPermissionHashMap.entrySet()){ + pp = entry.getValue(); + partsPermissionList.add(pp); + ptInfo = partsInfoMap.get(pp.getPartsId()); + s = new PermissionStream(); + s.setProductId(ptInfo.getProductId()); + s.setComponentId(ptInfo.getComponentId()); + s.setPartsId(ptInfo.getPartsId()); + s.setUserId(pp.getUserId()); + permissionStreamList.add(s); + } + } + + if(!componentPermissionList.isEmpty()){ + componentPermissionService.saveBatch(componentPermissionList); + } + if(!partsPermissionList.isEmpty()){ + partsPermissionService.saveBatch(partsPermissionList); + } + if(!permissionStreamList.isEmpty()){ + permissionStreamService.saveBatch(permissionStreamList); + } + } + return true; + }else if(nodeType == 2) { + //澶勭悊閮ㄤ欢 + ComponentInfo componentInfo = componentInfoService.getById(paramId); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); + if(!b1){ + //娌℃湁褰撳墠閮ㄤ欢鐨勬潈闄� + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + b1 = componentInfoService.assignAddUser(componentInfo, userList); + if(!b1){ + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if(relativeFlag == 1) { + //鏈�缁堜繚瀛樻潈闄愭暟鎹垵濮嬪寲 + List<ComponentPermission> componentPermissionList = new ArrayList<>(); + List<PartsPermission> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + + List<String> componentIds = new ArrayList<>(); + PermissionStream s; + String key; + //澶勭悊瀛愰儴浠� + List<ComponentInfo> childrenList = componentInfoService.getByParentId(componentInfo.getComponentId()); + if(childrenList != null && !childrenList.isEmpty()) { + Map<String, ComponentPermission> componentPermissionMap = new HashMap<>(); + Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); + + //鍒濆鍖栧叏浣撴暟鎹� + ComponentPermission cp; + ComponentInfo cpInfo; + for(ComponentInfo c : childrenList){ + componentIds.add(c.getComponentId()); + componentInfoMap.put(c.getComponentId(), c); + for(SysUser u : userList){ + key = c.getComponentId() + "," + u.getId(); + cp = new ComponentPermission(c.getComponentId(), u.getId()); + componentPermissionMap.put(key, cp); + } + } + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<ComponentPermission> existList = componentPermissionService.getByComponentIdsAndUserIds(componentIds, ids); + if(existList != null && !existList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(ComponentPermission permission : existList){ + key = permission.getComponentId() + "," + permission.getUserId(); + if(componentPermissionMap.containsKey(key)){ + componentPermissionMap.remove(key); + } + } + } + for(Map.Entry<String, ComponentPermission> entry : componentPermissionMap.entrySet()){ + cp = entry.getValue(); + componentPermissionList.add(cp); + cpInfo = componentInfoMap.get(cp.getComponentId()); + s = new PermissionStream(); + s.setProductId(cpInfo.getProductId()); + s.setComponentId(cpInfo.getComponentId()); + s.setUserId(cp.getUserId()); + permissionStreamList.add(s); + } + } + //澶勭悊闆朵欢 + componentIds.add(componentInfo.getComponentId()); + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(componentInfo.getProductId(), componentIds); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + Map<String, PartsPermission> partsPermissionHashMap = new HashMap<>(); + Map<String, PartsInfo> partsInfoMap = new HashMap<>(); + List<String> partsIds = new ArrayList<>(); + PartsPermission pp; + PartsInfo ptInfo; + for(PartsInfo p : partsInfoList){ + partsIds.add(p.getPartsId()); + partsInfoMap.put(p.getPartsId(), p); + for(SysUser u : userList){ + key = p.getPartsId() + "," + u.getId(); + pp = new PartsPermission(p.getPartsId(), u.getId()); + partsPermissionHashMap.put(key, pp); + } + } + + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<PartsPermission> existPartsList = partsPermissionService.getByPartsIdsAndUserIds(partsIds, ids); + if(existPartsList != null && !existPartsList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(PartsPermission permission : existPartsList){ + key = permission.getPartsId() + "," + permission.getUserId(); + if(partsPermissionHashMap.containsKey(key)){ + partsPermissionHashMap.remove(key); + } + } + } + + for(Map.Entry<String, PartsPermission> entry : partsPermissionHashMap.entrySet()){ + pp = entry.getValue(); + partsPermissionList.add(pp); + ptInfo = partsInfoMap.get(pp.getPartsId()); + s = new PermissionStream(); + s.setProductId(ptInfo.getProductId()); + s.setComponentId(ptInfo.getComponentId()); + s.setPartsId(ptInfo.getPartsId()); + s.setUserId(pp.getUserId()); + permissionStreamList.add(s); + } + } + if(!componentPermissionList.isEmpty()){ + componentPermissionService.saveBatch(componentPermissionList); + } + if(!partsPermissionList.isEmpty()){ + partsPermissionService.saveBatch(partsPermissionList); + } + if(!permissionStreamList.isEmpty()){ + permissionStreamService.saveBatch(permissionStreamList); + } + } + return true; + } + return false; + } + + /** + * 寰呬紭鍖� TODO + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param relativeFlag 1 鏄� 2 鍚� + * @param userIds 绉婚櫎鐢ㄦ埛ids + * @return + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(Integer nodeType, String paramId, Integer relativeFlag, String[] userIds) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(userIds == null || userIds.length < 1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); + List<String> ids = new ArrayList<>(userIds.length); + Collections.addAll(ids, userIds); + Collection<SysUser> userList = userService.listByIds(ids); + if(userList == null || userList.isEmpty() || userList.size() != userIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(nodeType == 3) { + //澶勭悊闆朵欢 + PartsInfo partsInfo = partsInfoService.getById(paramId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + boolean b = checkProductPerm(3, partsInfo.getPartsId()); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + return partsInfoService.assignRemoveUser(partsInfo, userList); + }else if(nodeType == 1) { + //澶勭悊浜у搧 + ProductInfo productInfo = super.getById(paramId); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + boolean b1 = checkProductPerm(1, productInfo.getProductId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = this.assignRemoveUser(productInfo, userList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + //澶勭悊浜у搧 涓嬬殑閮ㄤ欢 + List<String> componentIds = new ArrayList<>(); + //鎬昏闇�瑕佸垹闄ょ殑鏁版嵁淇℃伅 + List<ComponentPermission> componentPermissionList = new ArrayList<>(); + List<PartsPermission> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); + if(componentInfoList != null && !componentInfoList.isEmpty()) { + for(ComponentInfo componentInfo : componentInfoList){ + componentIds.add(componentInfo.getComponentId()); + } + componentPermissionList = componentPermissionService.getByComponentIdsAndUserIds(componentIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByComponentIdsAndUserIds(componentIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + //澶勭悊浜у搧 涓嬬殑闆朵欢 + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productInfo.getProductId(), componentIds); + List<String> partsIds = new ArrayList<>(); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + for(PartsInfo partsInfo : partsInfoList){ + partsIds.add(partsInfo.getPartsId()); + } + partsPermissionList = partsPermissionService.getByPartsIdsAndUserIds(partsIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndUserIds(partsIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + if(componentPermissionList != null && !componentPermissionList.isEmpty()){ + componentPermissionService.removeByCollection(componentPermissionList); + } + if(partsPermissionList != null && !partsPermissionList.isEmpty()){ + partsPermissionService.removeByCollection(partsPermissionList); + } + if(permissionStreamList != null && !permissionStreamList.isEmpty()){ + permissionStreamService.removeByCollection(permissionStreamList); + } + } + return true; + }else if(nodeType == 2) { + ComponentInfo componentInfo = componentInfoService.getById(paramId); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = componentInfoService.assignRemoveUser(componentInfo, userList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + List<String> componentIdList = new ArrayList<>(); + //鏈�缁堥渶瑕佸垹闄ょ殑鏁版嵁 + List<ComponentPermission> componentPermissionList = new ArrayList<>(); + List<PartsPermission> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<ComponentInfo> childrenList = componentInfoService.getByParentId(componentInfo.getComponentId()); + if(childrenList != null && !childrenList.isEmpty()) { + for(ComponentInfo component : childrenList){ + componentIdList.add(component.getComponentId()); + } + componentPermissionList = componentPermissionService.getByComponentIdsAndUserIds(componentIdList, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByComponentIdsAndUserIds(componentIdList, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + componentIdList.add(componentInfo.getComponentId()); + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(componentInfo.getProductId(), componentIdList); + List<String> partsIds = new ArrayList<>(); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + for(PartsInfo partsInfo : partsInfoList){ + partsIds.add(partsInfo.getPartsId()); + } + partsPermissionList = partsPermissionService.getByPartsIdsAndUserIds(partsIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndUserIds(partsIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + if(componentPermissionList != null && !componentPermissionList.isEmpty()){ + componentPermissionService.removeByCollection(componentPermissionList); + } + if(partsPermissionList != null && !partsPermissionList.isEmpty()){ + partsPermissionService.removeByCollection(partsPermissionList); + } + if(permissionStreamList != null && !permissionStreamList.isEmpty()){ + permissionStreamService.removeByCollection(permissionStreamList); + } + } + return true; + } + return false; + } + + /** + * 寰呬紭鍖� TODO + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param relativeFlag 1 鏄� 2 鍚� + * @param departmentIds 娣诲姞閮ㄩ棬ids + * @return + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepartment(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(departmentIds == null || departmentIds.length < 1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); + List<String> ids = new ArrayList<>(departmentIds.length); + Collections.addAll(ids, departmentIds); + Collection<Department> departList = departmentService.listByIds(ids); + if(departList == null || departList.isEmpty() || departList.size() != departmentIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(nodeType == 3) { + //澶勭悊闆朵欢 + PartsInfo partsInfo = partsInfoService.getById(paramId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + boolean b = checkProductPerm(3, partsInfo.getPartsId()); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + return partsInfoService.assignAddDepart(partsInfo, departList); + }else if(nodeType == 1) { + //澶勭悊浜у搧 + ProductInfo productInfo = super.getById(paramId); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + boolean b1 = checkProductPerm(1, productInfo.getProductId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = this.assignAddDepartment(productInfo, departList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + //澶勭悊浜у搧 涓嬬殑閮ㄤ欢 + List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); + //鏈�缁堜繚瀛樻潈闄愭暟鎹垵濮嬪寲 + List<ComponentDepartment> componentPermissionList = new ArrayList<>(); + List<PartsDepartment> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + //澶勭悊瀛愰儴浠� + List<String> componentIds = new ArrayList<>(); + PermissionStream s; + + Map<String, ComponentDepartment> componentPermissionMap = new HashMap<>(); + Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); + + //鍒濆鍖栧叏浣撴暟鎹� + String key; + ComponentDepartment cp; + ComponentInfo cpInfo; + for(ComponentInfo c : componentInfoList){ + componentIds.add(c.getComponentId()); + componentInfoMap.put(c.getComponentId(), c); + for(Department u : departList){ + key = c.getComponentId() + "," + u.getDepartId(); + cp = new ComponentDepartment(c.getComponentId(), u.getDepartId()); + componentPermissionMap.put(key, cp); + } + } + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<ComponentDepartment> existList = componentDepartmentService.getByComponentIdsAndDepartIds(componentIds, ids); + if(existList != null && !existList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(ComponentDepartment permission : existList){ + key = permission.getComponentId() + "," + permission.getDepartId(); + if(componentPermissionMap.containsKey(key)){ + componentPermissionMap.remove(key); + } + } + } + for(Map.Entry<String, ComponentDepartment> entry : componentPermissionMap.entrySet()){ + cp = entry.getValue(); + componentPermissionList.add(cp); + cpInfo = componentInfoMap.get(cp.getComponentId()); + s = new PermissionStream(); + s.setProductId(cpInfo.getProductId()); + s.setComponentId(cpInfo.getComponentId()); + s.setDepartId(cp.getDepartId()); + permissionStreamList.add(s); + } + + //澶勭悊瀛愰浂浠� + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productInfo.getProductId(), componentIds); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + Map<String, PartsDepartment> partsPermissionHashMap = new HashMap<>(); + Map<String, PartsInfo> partsInfoMap = new HashMap<>(); + List<String> partsIds = new ArrayList<>(); + PartsDepartment pp; + PartsInfo ptInfo; + for(PartsInfo p : partsInfoList){ + partsIds.add(p.getPartsId()); + partsInfoMap.put(p.getPartsId(), p); + for(Department u : departList){ + key = p.getPartsId() + "," + u.getDepartId(); + pp = new PartsDepartment(p.getPartsId(), u.getDepartId()); + partsPermissionHashMap.put(key, pp); + } + } + + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<PartsDepartment> existPartsList = partsDepartmentService.getByPartsIdsAndDepartIds(partsIds, ids); + if(existPartsList != null && !existPartsList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(PartsDepartment permission : existPartsList){ + key = permission.getPartsId() + "," + permission.getDepartId(); + if(partsPermissionHashMap.containsKey(key)){ + partsPermissionHashMap.remove(key); + } + } + } + + for(Map.Entry<String, PartsDepartment> entry : partsPermissionHashMap.entrySet()){ + pp = entry.getValue(); + partsPermissionList.add(pp); + ptInfo = partsInfoMap.get(pp.getPartsId()); + s = new PermissionStream(); + s.setProductId(ptInfo.getProductId()); + s.setComponentId(ptInfo.getComponentId()); + s.setPartsId(ptInfo.getPartsId()); + s.setDepartId(pp.getDepartId()); + permissionStreamList.add(s); + } + } + + if(!componentPermissionList.isEmpty()){ + componentDepartmentService.saveBatch(componentPermissionList); + } + if(!partsPermissionList.isEmpty()){ + partsDepartmentService.saveBatch(partsPermissionList); + } + if(!permissionStreamList.isEmpty()){ + permissionStreamService.saveBatch(permissionStreamList); + } + } + return true; + }else if(nodeType == 2) { + ComponentInfo componentInfo = componentInfoService.getById(paramId); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = componentInfoService.assignAddDepart(componentInfo, departList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + List<String> componentIdList = new ArrayList<>(); + List<ComponentInfo> childrenList = componentInfoService.getByParentId(componentInfo.getComponentId()); + + //鏈�缁堜繚瀛樻潈闄愭暟鎹垵濮嬪寲 + List<ComponentDepartment> componentPermissionList = new ArrayList<>(); + List<PartsDepartment> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + //澶勭悊瀛愰儴浠� + PermissionStream s; + + Map<String, ComponentDepartment> componentPermissionMap = new HashMap<>(); + Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); + + //鍒濆鍖栧叏浣撴暟鎹� + String key; + ComponentDepartment cp; + ComponentInfo cpInfo; + for(ComponentInfo c : childrenList){ + componentIdList.add(c.getComponentId()); + componentInfoMap.put(c.getComponentId(), c); + for(Department u : departList){ + key = c.getComponentId() + "," + u.getDepartId(); + cp = new ComponentDepartment(c.getComponentId(), u.getDepartId()); + componentPermissionMap.put(key, cp); + } + } + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<ComponentDepartment> existList = componentDepartmentService.getByComponentIdsAndDepartIds(componentIdList, ids); + if(existList != null && !existList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(ComponentDepartment permission : existList){ + key = permission.getComponentId() + "," + permission.getDepartId(); + if(componentPermissionMap.containsKey(key)){ + componentPermissionMap.remove(key); + } + } + } + for(Map.Entry<String, ComponentDepartment> entry : componentPermissionMap.entrySet()){ + cp = entry.getValue(); + componentPermissionList.add(cp); + cpInfo = componentInfoMap.get(cp.getComponentId()); + s = new PermissionStream(); + s.setProductId(cpInfo.getProductId()); + s.setComponentId(cpInfo.getComponentId()); + s.setDepartId(cp.getDepartId()); + permissionStreamList.add(s); + } + + //澶勭悊瀛愰浂浠� + componentIdList.add(componentInfo.getComponentId()); + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(componentInfo.getProductId(), componentIdList); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + Map<String, PartsDepartment> partsPermissionHashMap = new HashMap<>(); + Map<String, PartsInfo> partsInfoMap = new HashMap<>(); + List<String> partsIds = new ArrayList<>(); + PartsDepartment pp; + PartsInfo ptInfo; + for(PartsInfo p : partsInfoList){ + partsIds.add(p.getPartsId()); + partsInfoMap.put(p.getPartsId(), p); + for(Department u : departList){ + key = p.getPartsId() + "," + u.getDepartId(); + pp = new PartsDepartment(p.getPartsId(), u.getDepartId()); + partsPermissionHashMap.put(key, pp); + } + } + + //鏌ヨ宸插瓨鍦ㄧ殑鏉冮檺鏁版嵁 + List<PartsDepartment> existPartsList = partsDepartmentService.getByPartsIdsAndDepartIds(partsIds, ids); + if(existPartsList != null && !existPartsList.isEmpty()){ + //韪㈠嚭鏉冮檺鏁版嵁 + for(PartsDepartment permission : existPartsList){ + key = permission.getPartsId() + "," + permission.getDepartId(); + if(partsPermissionHashMap.containsKey(key)){ + partsPermissionHashMap.remove(key); + } + } + } + + for(Map.Entry<String, PartsDepartment> entry : partsPermissionHashMap.entrySet()){ + pp = entry.getValue(); + partsPermissionList.add(pp); + ptInfo = partsInfoMap.get(pp.getPartsId()); + s = new PermissionStream(); + s.setProductId(ptInfo.getProductId()); + s.setComponentId(ptInfo.getComponentId()); + s.setPartsId(ptInfo.getPartsId()); + s.setDepartId(pp.getDepartId()); + permissionStreamList.add(s); + } + } + + if(!componentPermissionList.isEmpty()){ + componentDepartmentService.saveBatch(componentPermissionList); + } + if(!partsPermissionList.isEmpty()){ + partsDepartmentService.saveBatch(partsPermissionList); + } + if(!permissionStreamList.isEmpty()){ + permissionStreamService.saveBatch(permissionStreamList); + } + } + return true; + } + return false; + } + + /** + * 寰呬紭鍖� TODO + * @param nodeType 1 浜у搧 2 閮ㄤ欢 3 闆朵欢 + * @param paramId 浜у搧鏍戣妭鐐筰d + * @param relativeFlag 1 鏄� 2 鍚� + * @param departmentIds 绉婚櫎閮ㄩ棬ids + * @return + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepartment(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds) { + if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId) || + !ValidateUtil.validateInteger(relativeFlag)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(departmentIds == null || departmentIds.length < 1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); + List<String> ids = new ArrayList<>(departmentIds.length); + Collections.addAll(ids, departmentIds); + Collection<Department> departList = departmentService.listByIds(ids); + if(departList == null || departList.isEmpty() || departList.size() != departmentIds.length) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(nodeType == 3) { + //澶勭悊闆朵欢 + PartsInfo partsInfo = partsInfoService.getById(paramId); + if(partsInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + boolean b = checkProductPerm(3, partsInfo.getPartsId()); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + return partsInfoService.assignRemoveDepart(partsInfo, departList); + }else if(nodeType == 1) { + //澶勭悊浜у搧 + ProductInfo productInfo = super.getById(paramId); + if(productInfo == null) + ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); + boolean b1 = checkProductPerm(1, productInfo.getProductId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = this.assignRemoveDepartment(productInfo, departList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + //澶勭悊浜у搧 涓嬬殑閮ㄤ欢 + List<String> componentIds = new ArrayList<>(); + //鎬昏闇�瑕佸垹闄ょ殑鏁版嵁淇℃伅 + List<ComponentDepartment> componentPermissionList = new ArrayList<>(); + List<PartsDepartment> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); + if(componentInfoList != null && !componentInfoList.isEmpty()) { + for(ComponentInfo componentInfo : componentInfoList){ + componentIds.add(componentInfo.getComponentId()); + } + componentPermissionList = componentDepartmentService.getByComponentIdsAndDepartIds(componentIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByComponentIdsAndDepartIds(componentIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + //澶勭悊浜у搧 涓嬬殑闆朵欢 + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productInfo.getProductId(), componentIds); + List<String> partsIds = new ArrayList<>(); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + for(PartsInfo partsInfo : partsInfoList){ + partsIds.add(partsInfo.getPartsId()); + } + partsPermissionList = partsDepartmentService.getByPartsIdsAndDepartIds(partsIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(partsIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + if(componentPermissionList != null && !componentPermissionList.isEmpty()){ + componentDepartmentService.removeByCollection(componentPermissionList); + } + if(partsPermissionList != null && !partsPermissionList.isEmpty()){ + partsDepartmentService.removeByCollection(partsPermissionList); + } + if(permissionStreamList != null && !permissionStreamList.isEmpty()){ + permissionStreamService.removeByCollection(permissionStreamList); + } + } + return true; + }else if(nodeType == 2) { + ComponentInfo componentInfo = componentInfoService.getById(paramId); + if(componentInfo == null) + ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); + boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + b1 = componentInfoService.assignRemoveDepart(componentInfo, departList); + if(!b1) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + if(relativeFlag == 1) { + List<String> componentIdList = new ArrayList<>(); + //鎬昏闇�瑕佸垹闄ょ殑鏁版嵁淇℃伅 + List<ComponentDepartment> componentPermissionList = new ArrayList<>(); + List<PartsDepartment> partsPermissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + + List<ComponentInfo> childrenList = componentInfoService.getByParentId(componentInfo.getComponentId()); + if(childrenList != null && !childrenList.isEmpty()) { + for(ComponentInfo cpn : childrenList){ + componentIdList.add(cpn.getComponentId()); + } + componentPermissionList = componentDepartmentService.getByComponentIdsAndDepartIds(componentIdList, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByComponentIdsAndDepartIds(componentIdList, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + //澶勭悊浜у搧 涓嬬殑闆朵欢 + componentIdList.add(componentInfo.getComponentId()); + List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(componentInfo.getProductId(), componentIdList); + List<String> partsIds = new ArrayList<>(); + if(partsInfoList != null && !partsInfoList.isEmpty()) { + for(PartsInfo partsInfo : partsInfoList){ + partsIds.add(partsInfo.getPartsId()); + } + partsPermissionList = partsDepartmentService.getByPartsIdsAndDepartIds(partsIds, ids); + List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(partsIds, ids); + if(existPermissionList != null && !existPermissionList.isEmpty()){ + permissionStreamList.addAll(existPermissionList); + } + } + + if(componentPermissionList != null && !componentPermissionList.isEmpty()){ + componentDepartmentService.removeByCollection(componentPermissionList); + } + if(partsPermissionList != null && !partsPermissionList.isEmpty()){ + partsDepartmentService.removeByCollection(partsPermissionList); + } + if(permissionStreamList != null && !permissionStreamList.isEmpty()){ + permissionStreamService.removeByCollection(permissionStreamList); + } + } + return true; + } + return false; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddUser(ProductInfo productInfo, Collection<SysUser> userList) { + if(productInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProductPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + if(en == null) { + en = new ProductPermission(); + en.setUserId(item.getId()); + en.setProductId(productInfo.getProductId()); + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setUserId(item.getId()); + stream.setProductId(productInfo.getProductId()); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = productPermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveUser(ProductInfo productInfo, Collection<SysUser> userList) { + if(productInfo == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProductPermission> permissionList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + if(en != null) { + permissionList.add(en); + } + PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //绉婚櫎鐢ㄦ埛鏉冮檺娓呯┖鏍¢獙 + List<ProductPermission> existList = productPermissionService.getByProductId(productInfo.getProductId()); + if(existList.size() <= permissionList.size()) + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_NONE); + if(!permissionList.isEmpty()) { + boolean b = productPermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignAddDepartment(ProductInfo productInfo, Collection<Department> departmentList) { + if(productInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProductDepartment> productDepartmentList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); + if(en == null) { + en = new ProductDepartment(); + en.setDepartId(item.getDepartId()); + en.setProductId(productInfo.getProductId()); + productDepartmentList.add(en); + } + PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); + if(stream == null) { + stream = new PermissionStream(); + stream.setDepartId(item.getDepartId()); + stream.setProductId(productInfo.getProductId()); + permissionStreamList.add(stream); + } + }); + if(!productDepartmentList.isEmpty()) { + boolean b = productDepartmentService.saveBatch(productDepartmentList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean assignRemoveDepartment(ProductInfo productInfo, Collection<Department> departmentList) { + if(productInfo == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProductDepartment> productDepartmentList = new ArrayList<>(); + List<PermissionStream> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); + if(en != null) { + productDepartmentList.add(en); + } + PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + if(!productDepartmentList.isEmpty()) { + boolean b = productDepartmentService.removeByCollection(productDepartmentList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamService.removeByCollection(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + @Override + public List<String> getDepartIdsByParams(Integer nodeType, String paramId) { + List<String> departIds = new ArrayList<>(); + if(nodeType == 2) { + ComponentInfo en = componentInfoService.getById(paramId); + if(en == null) + return null; + List<PermissionStream> permissionStreamList = permissionStreamService.getByComponentId(en.getProductId(), en.getComponentId()); + if(permissionStreamList == null || permissionStreamList.isEmpty()) + return null; + permissionStreamList.forEach(item -> { + departIds.add(item.getDepartId()); + }); + }else if(nodeType == 3) { + PartsInfo en = partsInfoService.getById(paramId); + if(en == null) + return null; + List<PermissionStream> permissionStreamList = permissionStreamService.getByPartsId(en.getProductId(), en.getComponentId(), en.getPartsId()); + if(permissionStreamList == null || permissionStreamList.isEmpty()) + return null; + permissionStreamList.forEach(item -> { + departIds.add(item.getDepartId()); + }); + }else { + return null; + } + return departIds; + } + + @Override + public ProductInfo getByProductNo(String productNo) { + if(ValidateUtil.validateString(productNo)) { + List<ProductInfo> list = super.lambdaQuery().eq(ProductInfo::getProductNo, productNo).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + return null; + } + + @Override + public List<CommonGenericTree> loadBaseTree(String userId) { + List<ProductInfo> productInfoList = getByUserPerms(userId); + if(productInfoList == null || productInfoList.isEmpty()) + return Collections.emptyList(); +// List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId); +// if(componentInfoList == null) +// componentInfoList = Collections.emptyList(); + return ProductTreeWrapper.loadTree(productInfoList); + } + + @Override + public List<CommonGenericTree> loadTree(String userId, Integer nodeType, String paramId) { + if(nodeType == 1) { + List<ComponentInfo> componentInfoList = componentInfoService.getByProductIdAndUserId(paramId, userId); + if(componentInfoList == null || componentInfoList.isEmpty()) + return Collections.emptyList(); + List<CommonGenericTree> list = new ArrayList<>(); + CommonGenericTree<ComponentInfo> node; + for(ComponentInfo c : componentInfoList) { + node = new CommonGenericTree(); + node.setId(c.getComponentId()); +// node.setLabel("[" + c.getComponentCode()+ "]" + c.getComponentName()); + node.setLabel(c.getComponentName()); + node.setParentId(c.getProductId()); + node.setIconClass(""); + node.setType(2); + node.setRField(c.getProductId()); + node.setEntity(c); + list.add(node); + } + return list; + }else if(nodeType == 2) { + List<ComponentInfo> componentInfoList = componentInfoService.getByParentIdAndUserId(paramId, userId); + List<CommonGenericTree> list = new ArrayList<>(); + CommonGenericTree<ComponentInfo> componentNode; + if(componentInfoList != null && !componentInfoList.isEmpty()) { + for(ComponentInfo c : componentInfoList) { + componentNode = new CommonGenericTree(); + componentNode.setId(c.getComponentId()); +// componentNode.setLabel("[" + c.getComponentCode()+ "]" + c.getComponentName()); + componentNode.setLabel(c.getComponentName()); + componentNode.setParentId(c.getParentId()); + componentNode.setIconClass(""); + componentNode.setType(2); + componentNode.setRField(c.getProductId()); + componentNode.setEntity(c); + list.add(componentNode); + } + } + List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, paramId, null); + if(partsInfos == null || partsInfos.isEmpty()) + return list; + CommonGenericTree<PartsInfo> partNode; + for(PartsInfo part : partsInfos) { + partNode = new CommonGenericTree(); + partNode.setId(part.getPartsId()); +// partNode.setLabel("[" + part.getPartsCode()+ "]" + part.getPartsName()); + partNode.setLabel(part.getPartsName()); + partNode.setParentId(part.getComponentId()); + partNode.setIconClass(""); + partNode.setType(3); + partNode.setRField(part.getComponentId()); + partNode.setEntity(part); + partNode.setLeaf(true); + list.add(partNode); + } + return list; + }else { + return Collections.emptyList(); + } + } + + @Override + public List<CommonGenericTree> searchProductTree(String userId, String queryParam) { + List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam); + List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam); + List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam); + + List<ComponentInfo> componentInfoList = new ArrayList<>(); + List<ProductInfo> productInfoList = new ArrayList<>(); + + Map<String, ProductInfo> productInfoMap = new HashMap<>(); + Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); + + ProductInfo product; + ComponentInfo component; + + if(productInfos != null && !productInfos.isEmpty()){ + for(ProductInfo p : productInfos){ + productInfoList.add(p); + productInfoMap.put(p.getProductId(), p); + } + } + + if(componentInfos != null && !componentInfos.isEmpty()){ + for(ComponentInfo c : componentInfos){ + componentInfoList.add(c); + componentInfoMap.put(c.getComponentId(), c); + } + } + + for(PartsInfo p : partsInfos) { + if(!productInfoMap.containsKey(p.getProductId())) { + product = super.getById(p.getProductId()); + if(product != null) { + productInfoMap.put(product.getProductId(), product); + productInfoList.add(product); + } + } + + if(!componentInfoMap.containsKey(p.getComponentId())) { + component = componentInfoService.getById(p.getComponentId()); + if(component != null) { + componentInfoMap.put(component.getComponentId(), component); + componentInfoList.add(component); + } + + } + } + + List<ComponentInfo> addList = new ArrayList<>(); + log.info("componentInfoList闆嗗悎澶у皬={}", componentInfoList.size()); + long start = System.currentTimeMillis(); + log.info("寮�濮嬪惊鐜墽琛屾椂闂�={}", start); + String pid; + for(ComponentInfo c : componentInfoList){ + int rankLevel = c.getRankLevel(); + component = c; + if(!productInfoMap.containsKey(c.getProductId())) { + product = super.getById(c.getProductId()); + if(product != null) { + productInfoMap.put(product.getProductId(), product); + productInfoList.add(product); + } + } + while((rankLevel - 1) > 0) { + pid = component.getParentId(); + if(componentInfoMap.containsKey(pid)) { + component = componentInfoMap.get(pid); + rankLevel = component.getRankLevel(); + continue; + } + component = componentInfoService.getById(pid); + if(component != null) { + log.info("addList娣诲姞浜嗘柊鐨勯儴浠秈d={}", component.getComponentId()); + componentInfoMap.put(component.getComponentId(), component); + addList.add(component); + rankLevel = component.getRankLevel(); + }else { + log.info("鏌ヨ涓嶅埌閮ㄤ欢id={}", pid); + break; + } + + } + } + long end = System.currentTimeMillis(); + log.info("寰幆鎵ц鎬昏�楁椂={}", (end - start)); + + if(!addList.isEmpty()){ + componentInfoList.addAll(addList); + } + + //杞崲鏁版嵁 + List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList); + + return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java new file mode 100644 index 0000000..675b356 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java @@ -0,0 +1,72 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.ProductPermission; +import org.jeecg.modules.dnc.mapper.ProductPermissionMapper; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.dnc.service.IProductPermissionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +public class ProductPermissionServiceImpl extends ServiceImpl<ProductPermissionMapper, ProductPermission> implements IProductPermissionService { + @Override + public ProductPermission getByProductIdAndUserId(String productId, String userId) { + if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId)) + return null; + List<ProductPermission> permissions = super.lambdaQuery().eq(ProductPermission::getProductId, productId).eq(ProductPermission::getUserId, userId).list(); + if(permissions == null || permissions.isEmpty()) + return null; + return permissions.get(0); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByProductId(String productId) { + if(!ValidateUtil.validateString(productId)) + return false; + LambdaQueryWrapper<ProductPermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ProductPermission::getProductId, productId); + return super.remove(lambdaQueryWrapper); + } + + @Override + public List<UserDepartExt> getUserPermsByProductId(String productId) { + return super.getBaseMapper().getUserPermsByProductId(productId); + } + + @Override + public List<SysUser> getUserNonPermsByProductId(String productId) { + return super.getBaseMapper().getUserNonPermsByProductId(productId); + } + + @Override + public boolean removeByCollection(List<ProductPermission> permissionList) { + if(permissionList == null || permissionList.isEmpty()) + return false; + if(permissionList.size() == 1) { + return super.removeById(permissionList.get(0).getProductPermId()); + } + List<String> ids = new ArrayList<>(); + permissionList.forEach(item -> { + ids.add(item.getProductPermId()); + }); + return super.removeByIds(ids); + } + + @Override + public List<ProductPermission> getByProductId(String productId) { + List<ProductPermission> list = super.lambdaQuery().eq(ProductPermission::getProductId, productId).list(); + if(list == null) + list = Collections.emptyList(); + return list; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/SynchronizedFlagServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/SynchronizedFlagServiceImpl.java new file mode 100644 index 0000000..82815ef --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/SynchronizedFlagServiceImpl.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.dnc.entity.SynchronizedFlag; +import org.jeecg.modules.dnc.mapper.SynchronizedFlagMapper; +import org.jeecg.modules.dnc.service.ISynchronizedFlagService; +import org.springframework.stereotype.Service; + +/** + * @Description: TODO + * @Author: zhangherong + * @Date: Created in 2020/9/20 9:19 + * @Version: 1.0 + * @Modified By: + */ +@Service +public class SynchronizedFlagServiceImpl extends ServiceImpl<SynchronizedFlagMapper, SynchronizedFlag> implements ISynchronizedFlagService { + @Override + public boolean updateFlag(Integer flag) { + UpdateWrapper<SynchronizedFlag> updateWrapper = Wrappers.update(); + updateWrapper.set("upload_flag", flag); + return super.update(updateWrapper); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java new file mode 100644 index 0000000..1298de4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java @@ -0,0 +1,273 @@ +package org.jeecg.modules.dnc.service.impl; + +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.ucenter.Department; +import org.jeecg.modules.dnc.utils.ValidateUtil; + +import org.jeecg.modules.dnc.entity.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Service +public class UserPermButtonServiceImpl implements IUserPermButtonService { + @Autowired + private IButtonService buttonService; + @Autowired + private IProductInfoService productInfoService; + @Autowired + private IComponentInfoService componentInfoService; + @Autowired + private IPartsInfoService partsInfoService; + @Autowired + private IDepartmentService departmentService; + @Autowired + private IPermissionStreamService permissionStreamService; + @Autowired + private IDeviceInfoService deviceInfoService; + @Autowired + private IDevicePermissionService devicePermissionService; + @Autowired + private IProcessStreamService processStreamService; + @Autowired + private IDeviceGroupService deviceGroupService; + @Autowired + private IDevicePermissionStreamService devicePermissionStreamService; + + /** + * 鍒ゅ畾浜у搧鏁拌妭鐐规潈闄� + * TODO 寰呭畬鍠� + * @param param + * @param objectId + * @param userId + * @return + */ + @Override + public Boolean checkObjectValid(String param, String objectId, String userId) { + if(!ValidateUtil.validateString(param) || !ValidateUtil.validateString(objectId)) + return null; + if("product".equals(param)) { + //鍙抽敭鏌愪釜浜у搧 + ProductInfo productInfo = productInfoService.getById(objectId); + if(productInfo == null) + return null; + //鏍¢獙鏄惁鏈夎浜у搧鐨勬潈闄� + boolean b = productInfoService.checkProductPerm(1, objectId); + if(!b) { + return null; + } + //鑾峰彇浜у搧鎵�鍦ㄩ儴闂� + List<PermissionStream> departPerms = permissionStreamService.getByProductId(productInfo.getProductId()); + if(departPerms == null || departPerms.isEmpty()) + return false; + //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� + Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); + if(departmentMap == null || departmentMap.isEmpty()) + return null; + for(PermissionStream stream : departPerms) { + if(departmentMap.containsKey(stream.getDepartId())) { + return true; + } + } + }else if("component".equals(param)) { + //鍙抽敭鏌愪釜閮ㄤ欢 + ComponentInfo componentInfo = componentInfoService.getById(objectId); + if(componentInfo == null) + return null; + //鏍¢獙鏄惁鏈夎閮ㄤ欢鐨勬潈闄� + boolean b = productInfoService.checkProductPerm(2, objectId); + if(!b) { + return null; + } + //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� + List<PermissionStream> departPerms = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + if(departPerms == null || departPerms.isEmpty()) + return false; + //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� + Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); + if(departmentMap == null || departmentMap.isEmpty()) + return null; + for(PermissionStream stream : departPerms) { + if(departmentMap.containsKey(stream.getDepartId())) { + return true; + } + } + }else if("parts".equals(param)) { + //鍙抽敭鏌愪釜闆朵欢 + PartsInfo partsInfo = partsInfoService.getById(objectId); + if(partsInfo == null) + return null; + //鏍¢獙鏄惁鏈夎闆朵欢鐨勬潈闄� + boolean b = productInfoService.checkProductPerm(3, objectId); + if(!b) { + return null; + } + //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� + List<PermissionStream> departPerms = permissionStreamService.getByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); + if(departPerms == null || departPerms.isEmpty()) + return false; + //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� + Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); + if(departmentMap == null || departmentMap.isEmpty()) + return null; + for(PermissionStream stream : departPerms) { + if(departmentMap.containsKey(stream.getDepartId())) { + return true; + } + } + }else if("device".equals(param)) { + //鍙抽敭璁惧 + DeviceInfo deviceInfo = deviceInfoService.getById(objectId); + if(deviceInfo == null) + return null; + //鏍¢獙鏄惁鏈夎闆朵欢鐨勬潈闄� + boolean b = deviceInfoService.checkDevicePerm(2, objectId); + if(!b) { + return null; + } + if(!ValidateUtil.validateString(deviceInfo.getDepartId())) + return false; + //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� + Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); + if(departmentMap == null || departmentMap.isEmpty()) + return null; + if(departmentMap.containsKey(deviceInfo.getDepartId())) { + return true; + } + } else if("device_group".equals(param)) { + //鍙抽敭璁惧 + DeviceGroup deviceGroup = deviceGroupService.getById(objectId); + if(deviceGroup == null) + return null; + //鏍¢獙鏄惁鏈夎鍒嗙粍鐨勬潈闄� + boolean b = deviceInfoService.checkDevicePerm(1, objectId); + if(!b) { + return null; + } + //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� + List<DevicePermissionStream> permissionStreams = devicePermissionStreamService.getDepartPermByGroupId(deviceGroup.getGroupId()); + if(permissionStreams == null || permissionStreams.isEmpty()) + return false; + //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� + Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); + if(departmentMap == null || departmentMap.isEmpty()) + return null; + for(DevicePermissionStream stream : permissionStreams) { + if(departmentMap.containsKey(stream.getDepartId())) { + return true; + } + } + } + return null; + } + + /** + * 鑾峰彇浜у搧鏁拌妭鐐规潈闄� + * TODO 寰呭畬鍠� + * @param param + * @param flag + * @param objectId + * @param relativeParam + * @param relativeObjectId + * @return + */ + @Override + public List<String> getCurrentUserButtonPerms(String param, Integer flag, String objectId, String relativeParam, String relativeObjectId) { + if(!ValidateUtil.validateString(param)) + return null; + if(!ValidateUtil.validateInteger(flag)) + return null; + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + return null; + List<String> permsList = new ArrayList<>(); + List<String> objectPermsList = new ArrayList<>(); + List<Button> buttonPerms = buttonService.getButtonPerms(userId); + if(buttonPerms != null && !buttonPerms.isEmpty()) { + buttonPerms.forEach(item -> { + permsList.add(item.getButtonPerm()); + objectPermsList.add(item.getButtonPerm()); + }); + } + if(flag == 1) { + List<Button> list = buttonService.getMenuButtonPerms(userId, param); + if(list == null || list.isEmpty()) + return permsList; + for(Button button : list) { + if(ValidateUtil.validateString(button.getPermCode())) { + permsList.add(button.getPermCode()); + } + } + }else if(flag == 2) { + List<Button> list = buttonService.getObjectButtonPerms(userId, param); + if(list == null || list.isEmpty()) + return permsList; + for(Button button : list) { + if(ValidateUtil.validateString(button.getPermCode())) { + objectPermsList.add(button.getPermCode()); + } + } + if("product".equals(param)) { + if(ValidateUtil.validateString(objectId)) { + Boolean checkValue = checkObjectValid(param, objectId, userId); + return getCurrentPerms(checkValue, permsList, objectPermsList); + }else { + //鍙抽敭浜у搧缁撴瀯鏍戠┖鐧藉尯 + return objectPermsList; + } + } else if("component".equals(param) || "parts".equals(param)) { + if(ValidateUtil.validateString(objectId)) { + Boolean checkValue = checkObjectValid(param, objectId, userId); + return getCurrentPerms(checkValue, permsList, objectPermsList); + }else { + //鍙抽敭浜у搧缁撴瀯鏍戠┖鐧藉尯 + return null; + } + }else if("process".equals(param) || "document".equals(param) || "file".equals(param)) { + if(!ValidateUtil.validateString(relativeParam) || !ValidateUtil.validateString(relativeObjectId)) { + return null; + } + Boolean checkValue = checkObjectValid(relativeParam, relativeObjectId, userId); + return getCurrentPerms(checkValue, permsList, objectPermsList); + }else if("device".equals(param)) { + if(ValidateUtil.validateString(objectId)) { + Boolean checkValue = checkObjectValid(param, objectId, userId); + return getCurrentPerms(checkValue, permsList, objectPermsList); + }else { + //鍙抽敭璁惧绌虹櫧鍖� + return null; + } + }else if("device_group".equals(param)) { + if(ValidateUtil.validateString(objectId)) { + //鍙抽敭璁惧鍒嗙粍 + Boolean checkValue = checkObjectValid(param, objectId, userId); + return getCurrentPerms(checkValue, permsList, objectPermsList); + }else { + //鍙抽敭璁惧鏍戠┖鐧藉尯 + return objectPermsList; + } + }else { + return null; + } + }else { + return null; + } + return permsList; + } + + private List<String> getCurrentPerms(Boolean b , List<String> permsList, List<String> objectPermsList) { + if(b == null) + return null; + if(b) { + return objectPermsList; + }else { + return permsList; + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ComponentTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ComponentTreeWrapper.java new file mode 100644 index 0000000..1193615 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ComponentTreeWrapper.java @@ -0,0 +1,93 @@ +package org.jeecg.modules.dnc.service.support; + +import org.jeecg.modules.dnc.dto.ComponentExt; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.springframework.beans.BeanUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ComponentTreeWrapper { + public static List<CommonGenericTree> loadTree(List<ComponentExt> componentInfoList) { + Map<String, CommonGenericTree> treeMap = new HashMap<>(); + for(ComponentExt ext : componentInfoList) { + treeMap = getBaseNodeMap(ext, treeMap); + } + return CommonGenericTree.convertMapToList(treeMap); + } + + private static CommonGenericTree loadChildrenNodes(ComponentExt info, CommonGenericTree node) { + if(info.hasChild()) { + List<ComponentExt> children = info.getChildren(); + CommonGenericTree<ComponentInfo> childNode; + ComponentInfo componentInfo; + for (ComponentExt ext : children) { + childNode = new CommonGenericTree(); + childNode.setId(ext.getComponentId()); + childNode.setLabel(ext.getComponentName()); + childNode.setParentId(info.getComponentId()); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + childNode.setIconClass(iconStr); + childNode.setType(2); + componentInfo = new ComponentInfo(); + BeanUtils.copyProperties(ext, componentInfo); + childNode.setEntity(componentInfo); + node.setRField(ext.getProductId()); + childNode = loadChildrenNodes(ext, childNode); + node.addChildren(childNode); + } + } + return node; + } + + private static Map<String,CommonGenericTree> getBaseNodeMap(ComponentExt ext, Map<String,CommonGenericTree> allNodeMap) { + CommonGenericTree<ComponentInfo> node; + ComponentInfo componentInfo; + if(ext.getRankLevel() == 1) { + node = new CommonGenericTree<ComponentInfo>(); + node.setId(ext.getComponentId()); + node.setLabel("[" + ext.getComponentCode()+ "]" + ext.getComponentName()); + node.setParentId(null); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node.setType(2); + node.setRField(ext.getProductId()); + componentInfo = new ComponentInfo(); + BeanUtils.copyProperties(ext, componentInfo); + node.setEntity(componentInfo); + allNodeMap.put(node.getId(), node); + }else { + node = new CommonGenericTree<ComponentInfo>(); + node.setId(ext.getComponentId()); + node.setLabel("[" + ext.getComponentCode()+ "]" + ext.getComponentName()); + node.setParentId(ext.getParentId()); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node.setType(2); + node.setRField(ext.getProductId()); + componentInfo = new ComponentInfo(); + BeanUtils.copyProperties(ext, componentInfo); + node.setEntity(componentInfo); + allNodeMap.put(node.getId(), node); + } + return allNodeMap; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DepartmentTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DepartmentTreeWrapper.java new file mode 100644 index 0000000..643f377 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DepartmentTreeWrapper.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.dnc.service.support; + + +import org.jeecg.modules.dnc.dto.DepartmentExt; +import org.jeecg.modules.dnc.response.CommonJsonTree; + +import java.util.ArrayList; +import java.util.List; + +public class DepartmentTreeWrapper { + public static List<CommonJsonTree> loadTree(List<DepartmentExt> componentInfoList) { + List<CommonJsonTree> tree = new ArrayList<CommonJsonTree>();// TreeNode闆嗗悎锛屽瓨鏀炬墍鏈夋爲瀵硅薄銆� + CommonJsonTree node; + for(DepartmentExt ext : componentInfoList) { + node = new CommonJsonTree(); + node.setId(ext.getDepartId()); + node.setLabel(ext.getDepartName()); + node.setParentId(null); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node = loadChildrenNodes(ext, node); + tree.add(node); + } + return tree; + } + + private static CommonJsonTree loadChildrenNodes(DepartmentExt info, CommonJsonTree node) { + if(info.hasChild()) { + List<DepartmentExt> children = info.getChildList(); + CommonJsonTree childNode; + for (DepartmentExt ext : children) { + childNode = new CommonJsonTree(); + childNode.setId(ext.getDepartId()); + childNode.setLabel(ext.getDepartName()); + childNode.setParentId(ext.getParentId()); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + childNode.setIconClass(iconStr); + childNode = loadChildrenNodes(ext, childNode); + node.addChildren(childNode); + } + } + return node; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceGroupTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceGroupTreeWrapper.java new file mode 100644 index 0000000..18f7c2c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceGroupTreeWrapper.java @@ -0,0 +1,117 @@ +package org.jeecg.modules.dnc.service.support; + +import org.jeecg.modules.dnc.dto.DeviceGroupExt; +import org.jeecg.modules.dnc.entity.DeviceGroup; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.springframework.beans.BeanUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeviceGroupTreeWrapper { + public static List<CommonGenericTree> loadTree(List<DeviceGroupExt> deviceGroupExtList) { + Map<String, CommonGenericTree> treeMap = new HashMap<>(); + for(DeviceGroupExt ext : deviceGroupExtList) { + treeMap = getBaseNodeMap(ext, treeMap); + } + return CommonGenericTree.convertMapToList(treeMap); + } + + public static List<CommonGenericTree> loadDepartTree(List<DeviceGroupExt> deviceGroupExtList) { + List<CommonGenericTree> tree = new ArrayList<CommonGenericTree>();// TreeNode闆嗗悎锛屽瓨鏀炬墍鏈夋爲瀵硅薄銆� + CommonGenericTree<DeviceGroup> node; + DeviceGroup deviceGroup; + for(DeviceGroupExt ext : deviceGroupExtList) { + node = new CommonGenericTree<DeviceGroup>(); + node.setId(ext.getGroupId()); + node.setLabel(ext.getGroupName()); + node.setParentId(null); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node.setType(1); + deviceGroup = new DeviceGroup(); + BeanUtils.copyProperties(ext, deviceGroup); + node.setEntity(deviceGroup); + node = loadChildrenNodes(ext, node); + tree.add(node); + } + return tree; + } + + private static CommonGenericTree loadChildrenNodes(DeviceGroupExt info, CommonGenericTree node) { + if(info.hasChild()) { + List<DeviceGroupExt> children = info.getChildren(); + CommonGenericTree<DeviceGroup> childNode; + DeviceGroup deviceGroup; + for (DeviceGroupExt ext : children) { + childNode = new CommonGenericTree(); + childNode.setId(ext.getGroupId()); + childNode.setLabel(ext.getGroupName()); + childNode.setParentId(ext.getParentId()); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + childNode.setIconClass(iconStr); + childNode.setType(1); + deviceGroup = new DeviceGroup(); + BeanUtils.copyProperties(ext, deviceGroup); + childNode.setEntity(deviceGroup); + childNode = loadChildrenNodes(ext, childNode); + node.addChildren(childNode); + } + } + return node; + } + + private static Map<String,CommonGenericTree> getBaseNodeMap(DeviceGroupExt ext, Map<String,CommonGenericTree> map) { + CommonGenericTree<DeviceGroup> node; + DeviceGroup deviceGroup; + if(ext.getRankLevel() == 1) { + node = new CommonGenericTree<DeviceGroup>(); + node.setId(ext.getGroupId()); + node.setLabel(ext.getGroupName()); + node.setParentId(null); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node.setType(1); + deviceGroup = new DeviceGroup(); + BeanUtils.copyProperties(ext, deviceGroup); + node.setEntity(deviceGroup); + map.put(node.getId(), node); + return map; + }else { + node = new CommonGenericTree<DeviceGroup>(); + node.setId(ext.getGroupId()); + node.setLabel(ext.getGroupName()); + node.setParentId(ext.getParentId()); + //璁剧疆鑿滃崟鑺傜偣鍥炬爣 Start + String iconStr = ""; + /*鍒ゆ柇鏄惁璁剧疆浜嗚彍鍗曞鑸浘鏍囨牱寮�*/ + if (!ext.hasChild()) {//瀵艰埅椤甸潰鐨勮彍鍗曡妭鐐� + iconStr = "";//榛樿鍥炬爣 + } + node.setIconClass(iconStr); + node.setType(1); + deviceGroup = new DeviceGroup(); + BeanUtils.copyProperties(ext, deviceGroup); + node.setEntity(deviceGroup); + map.put(node.getId(), node); + return getBaseNodeMap(ext.getParent(), map); + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceTreeWrapper.java new file mode 100644 index 0000000..ef6af3c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/DeviceTreeWrapper.java @@ -0,0 +1,94 @@ +package org.jeecg.modules.dnc.service.support; + +import org.jeecg.modules.dnc.entity.DeviceGroup; +import org.jeecg.modules.dnc.entity.DeviceInfo; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.dto.DeviceGroupExt; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeviceTreeWrapper { + public static List<CommonGenericTree> loadTree(List<DeviceGroupExt> groupExtList, List<DeviceInfo> deviceInfoList) { + List<CommonGenericTree> groupJsonTreeList = DeviceGroupTreeWrapper.loadTree(groupExtList); + if(deviceInfoList == null || deviceInfoList.isEmpty()) + return groupJsonTreeList; + Map<String, CommonGenericTree> groupTreeMap = new HashMap<>(); + CommonGenericTree<DeviceGroup> groupNode; + CommonGenericTree<DeviceInfo> deviceNode; + for(CommonGenericTree group : groupJsonTreeList) { + groupTreeMap = CommonGenericTree.getLeafNode(groupTreeMap, group); + } + for(DeviceInfo deviceInfo : deviceInfoList) { + deviceNode = new CommonGenericTree(); + deviceNode.setId(deviceInfo.getDeviceId()); + deviceNode.setLabel(deviceInfo.getDeviceName()); + deviceNode.setParentId(null); + deviceNode.setIconClass(""); + deviceNode.setType(2); + deviceNode.setRField(deviceInfo.getGroupId()); + deviceNode.setEntity(deviceInfo); + if(groupTreeMap.containsKey(deviceNode.getRField())) { + groupNode = groupTreeMap.get(deviceNode.getRField()); + deviceNode.setParentId(groupNode.getId()); + groupNode.addChildren(deviceNode); + } + } + return groupJsonTreeList; + } + + + public static List<CommonGenericTree> loadDepartTree(List<DeviceGroupExt> groupExtList, List<DeviceInfo> deviceInfoList) { + List<CommonGenericTree> groupJsonTreeList = DeviceGroupTreeWrapper.loadDepartTree(groupExtList); + if(deviceInfoList == null || deviceInfoList.isEmpty()) + return groupJsonTreeList; + Map<String, CommonGenericTree> groupTreeMap = new HashMap<>(); + CommonGenericTree<DeviceGroup> groupNode; + CommonGenericTree<DeviceInfo> deviceNode; + for(CommonGenericTree group : groupJsonTreeList) { + groupTreeMap = CommonGenericTree.getLeafNode(groupTreeMap, group); + } + for(DeviceInfo deviceInfo : deviceInfoList) { + deviceNode = new CommonGenericTree(); + deviceNode.setId(deviceInfo.getDeviceId()); + deviceNode.setLabel(deviceInfo.getDeviceName()); + deviceNode.setParentId(null); + deviceNode.setIconClass(""); + deviceNode.setType(2); + deviceNode.setRField(deviceInfo.getGroupId()); + deviceNode.setEntity(deviceInfo); + if(groupTreeMap.containsKey(deviceNode.getRField())) { + groupNode = groupTreeMap.get(deviceNode.getRField()); + deviceNode.setParentId(groupNode.getId()); + groupNode.addChildren(deviceNode); + } + } + return groupJsonTreeList; + } + + private static CommonGenericTree addToGroup(CommonGenericTree tree, DeviceInfo deviceInfo) { + Map<String, CommonGenericTree> groupTreeMap = new HashMap<>(); + groupTreeMap = CommonGenericTree.getLeafNode(groupTreeMap, tree); + if(groupTreeMap.containsKey(deviceInfo.getGroupId())) { + CommonGenericTree parent = groupTreeMap.get(deviceInfo.getGroupId()); + CommonGenericTree<DeviceInfo> childNode = new CommonGenericTree<>(); + childNode.setId(deviceInfo.getDeviceId()); + childNode.setLabel(deviceInfo.getDeviceName()); + childNode.setParentId(deviceInfo.getGroupId()); + childNode.setIconClass(""); + childNode.setType(2); + childNode.setEntity(deviceInfo); + parent.addChildren(childNode); + groupTreeMap.put(childNode.getId(), childNode); + Map<String, CommonGenericTree> hashMap = new HashMap<>(); + CommonGenericTree.getAllParentNode(hashMap, groupTreeMap, childNode); + CommonGenericTree newNode = new CommonGenericTree(); + newNode.copyNoneChild(tree); + CommonGenericTree.copyToNewTree(tree, newNode, hashMap); + return newNode; + }else { + return null; + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java new file mode 100644 index 0000000..9e03bdd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java @@ -0,0 +1,79 @@ +package org.jeecg.modules.dnc.service.support; + +import org.jeecg.modules.dnc.entity.PartsInfo; +import org.jeecg.modules.dnc.entity.ProductInfo; +import org.jeecg.modules.dnc.response.CommonGenericTree; +import org.jeecg.modules.dnc.entity.ComponentInfo; +import org.jeecg.modules.dnc.dto.ComponentExt; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProductTreeWrapper { + + public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList, List<ComponentExt> componentInfoList, List<PartsInfo> partsInfoList) { + List<CommonGenericTree> tree = new ArrayList<CommonGenericTree>();// TreeNode闆嗗悎锛屽瓨鏀炬墍鏈夋爲瀵硅薄銆� + Map<String, CommonGenericTree> productMap = new HashMap<>(); + Map<String, CommonGenericTree> componentMap = new HashMap<>(); + CommonGenericTree<ProductInfo> node; + CommonGenericTree<ComponentInfo> componentNode; + CommonGenericTree<PartsInfo> partsNode; + for(ProductInfo productInfo : productInfoList) { + node = new CommonGenericTree(); + node.setId(productInfo.getProductId()); + node.setLabel("[" + productInfo.getProductNo()+ "]" + productInfo.getProductName()); + node.setParentId(productInfo.getProductId()); + node.setIconClass(""); + node.setType(1); + node.setEntity(productInfo); + tree.add(node); + productMap.put(productInfo.getProductId(), node); + } + + List<CommonGenericTree> commonJsonTreeList = ComponentTreeWrapper.loadTree(componentInfoList); + for(CommonGenericTree compNode : commonJsonTreeList) { + componentMap = CommonGenericTree.getLeafNode(componentMap, compNode); + if(productMap.containsKey(compNode.getRField())) { + node = productMap.get(compNode.getRField()); + compNode.setParentId(node.getId()); + node.addChildren(compNode); + } + } + + for(PartsInfo parts : partsInfoList) { + partsNode = new CommonGenericTree(); + partsNode.setId(parts.getPartsId()); + partsNode.setLabel("[" + parts.getPartsCode()+ "]" + parts.getPartsName()); + partsNode.setParentId(null); + partsNode.setIconClass(""); + partsNode.setType(3); + partsNode.setRField(parts.getComponentId()); + partsNode.setEntity(parts); + if(componentMap.containsKey(partsNode.getRField())) { + componentNode = componentMap.get(partsNode.getRField()); + partsNode.setParentId(componentNode.getId()); + componentNode.addChildren(partsNode); + } + } + return tree; + } + + public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList) { + List<CommonGenericTree> tree = new ArrayList<CommonGenericTree>();// TreeNode闆嗗悎锛屽瓨鏀炬墍鏈夋爲瀵硅薄銆� + CommonGenericTree<ProductInfo> node; + for(ProductInfo productInfo : productInfoList) { + node = new CommonGenericTree(); + node.setId(productInfo.getProductId()); +// node.setLabel("[" + productInfo.getProductNo()+ "]" + productInfo.getProductName()); + node.setLabel(productInfo.getProductName()); + //node.setParentId(null); + node.setIconClass(""); + node.setType(1); + node.setEntity(productInfo); + tree.add(node); + } + return tree; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/Department.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/Department.java new file mode 100644 index 0000000..39b7520 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/Department.java @@ -0,0 +1,43 @@ +package org.jeecg.modules.dnc.ucenter; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "sys_department") +public class Department implements Serializable { + @TableId + private String departId; + private String departName; + private String departCode; + private String parentId; + private Integer priority; + private Integer rankLevel; + private String mgrMan; + private String description; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) + private String createUser; + @JsonIgnore + @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) + private String updateUser; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + + @TableField(exist = false) + private Integer positionType; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/UserDepartExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/UserDepartExt.java new file mode 100644 index 0000000..7d89657 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ucenter/UserDepartExt.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.dnc.ucenter; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +/** + * @Description: TODO + * @Author: zhangherong + * @Date: Created in 2020/7/31 10:15 + * @Version: 1.0 + * @Modified By: + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +public class UserDepartExt extends SysUser { + private List<Department> departs; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/FileClient.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/FileClient.java new file mode 100644 index 0000000..68eee35 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/FileClient.java @@ -0,0 +1,237 @@ +package org.jeecg.modules.dnc.utils; + +import cn.hutool.crypto.SmUtil; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.FileEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.protocol.HTTP; +import org.apache.http.util.EntityUtils; +import org.jeecg.modules.dnc.utils.file.SM3Util; +import org.jeecg.modules.dnc.dto.SysLogTypeObjectDto; + +import java.io.File; +import java.net.URLEncoder; + +/** + * @author clown + * * @date 2023/11/14 + */ +@Slf4j +public class FileClient { + + public static String getToken(String host, String port, String userName, String pwd,String addressToken) throws Exception, Throwable { + CloseableHttpClient client = null; + CloseableHttpResponse response = null; + try { + ObjectMapper objectMapper = new ObjectMapper(); + JSONObject jsonObject = new JSONObject(); + //鏋勯�犺姹傚弬鏁癮ppId鍜宲assword + jsonObject.put("appId", userName); + //灏嗗瘑鐮侀�氳繃SM3鍔犲瘑 + jsonObject.put("password", SM3Util.encrypt(pwd)); + String str = objectMapper.writeValueAsString(jsonObject); + StringEntity stringEntity = new StringEntity(str); + //鏋勯�爃ttp璇锋眰 + String url = "http" + "://" + host + ":" + port + "/" + addressToken; + HttpPost httpPost = new HttpPost(url); + //璁剧疆Content-Type + httpPost.setHeader(HTTP.CONTENT_TYPE, "application/json"); + //Content-length浼氬湪璇锋眰鑷姩鑷姩鍔犱笂 + //httpPost.setHeader(HTTP.CONTENT_LEN, stringEntity.getContentLength()+""); + //灏嗘瀯閫犲ソ鐨勫弬鏁版斁鍏ヨ姹備腑 + httpPost.setEntity(stringEntity); + //璁剧疆璇锋眰瓒呮椂鏃堕棿 + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(5000).setConnectionRequestTimeout(5000) + .setSocketTimeout(5000).build(); + httpPost.setConfig(requestConfig); + //鍙戣捣璇锋眰 + client = HttpClients.createDefault(); + response = client.execute(httpPost); + //瑙f瀽璇锋眰鐨剅esponse + if (response.getStatusLine().getStatusCode() == 200) { + HttpEntity entity = response.getEntity(); + String result = EntityUtils.toString(entity, "UTF-8"); + JSONObject jobject = JSONObject.parseObject(result); + int code = jobject.getIntValue("code"); + String token = jobject.getString("token"); + String message = jobject.getString("msg"); + if (200 != code) { + throw new Exception("appAuth Error,code[" + code + "],message[" + message + "]"); + } else { + //鑻ヨ姹傛垚鍔燂紝杩斿洖token + return token; + } + } else { + throw new Exception("appAuth Error:" + response.getStatusLine().toString()); + } + } catch (Throwable e) { + throw e; + } finally { + if (response != null) { + try { + response.close(); + } catch (Throwable t) { + } + } + if (client != null) { + try { + client.close(); + } catch (Throwable t) { + } + } + } + } + + + /* public static void main(String[] args) { + try { + String token = getToken("127.0.0.1","8299","admin","123"); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + }*/ + + /** + * + * @param host + * @param port + * @param token + * @param remoteFilePath + * @param localFilePath + * @param addressUploadFile + * @return + * @throws Exception + * @throws Throwable + */ + public static String uploadFile(String host, String port, String token, String fileName,String remoteFilePath, String localFilePath,String addressUploadFile) throws Exception, Throwable { + CloseableHttpClient client = null; + CloseableHttpResponse response = null; + SysLogTypeObjectDto objectName = new SysLogTypeObjectDto(); + objectName.setResult("澶辫触"); + try { + //鎷兼帴璇锋眰鐨剈rl + String url = "http" + "://" + host + ":" + port + "/" + addressUploadFile; + //鏋勯�犺姹� + HttpPost httpPost = new HttpPost(url); + //璁剧疆Content-Type涓烘枃浠舵祦鏍煎紡 + httpPost.setHeader(HTTP.CONTENT_TYPE, "application/octet-stream"); + //璁剧疆header鐨勮姹傚弬鏁� + httpPost.addHeader("Accept", "*/*"); + httpPost.addHeader("Accept-Encoding", "UTF-8"); + httpPost.setHeader("Token", token); + //FileName闇�瑕佺粡杩嘦RLEncoder鍔犵爜锛岄槻姝腑鏂囦贡鐮� + httpPost.setHeader("FileName", URLEncoder.encode(remoteFilePath, "UTF-8")); + /*鏂囦欢澶у皬*/ + httpPost.setHeader("WenjianqIcaoren", "寰愪笟妞�");//鏂囦欢璧疯崏浜� + httpPost.setHeader("Shenpiren", "寮犱笘璐�");//瀹℃壒浜� + httpPost.setHeader("Miji", URLEncoder.encode("鍐呴儴", "UTF-8")); + httpPost.addHeader("Baomiqixian","10,12,30"); + httpPost.addHeader("Qianfaren", URLEncoder.encode("寮犱笘璐�", "UTF-8"));//绛惧彂浜� + File file = new File(localFilePath); + if (file == null || !file.exists()){ + httpPost.addHeader("Wenjiansanliezhi", URLEncoder.encode("sm3", "UTF-8")); + } else { + String sm3 = SmUtil.sm3(file); + httpPost.addHeader("Wenjiansanliezhi", URLEncoder.encode(sm3, "UTF-8")); + } + + httpPost.addHeader("Beizhu", URLEncoder.encode("鏃�", "UTF-8")); + //灏嗗搴斾笂浼犵殑鏈湴鏂囦欢瑙f瀽鎴愭枃浠舵祦鏀惧叆body + httpPost.setEntity(new FileEntity(new File(localFilePath))); + //鏍规嵁鏂囦欢澶у皬璁剧疆瓒呮椂鏃堕棿 + int timeout = (int) ((new File(localFilePath).length() / (1000)) * 2 + 2000); + //璁剧疆瓒呮椂鏃堕棿 + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(5000).setConnectionRequestTimeout(5000) + .setSocketTimeout(timeout).build(); + httpPost.setConfig(requestConfig); + //璇锋眰鏋勯�犲畬鎴愶紝鍙戣捣璇锋眰 + client = HttpClients.createDefault(); + response = client.execute(httpPost); + //瑙f瀽response + if (response.getStatusLine().getStatusCode() == 200) { + HttpEntity entity = response.getEntity(); + System.out.println(entity); + String result = EntityUtils.toString(entity, "UTF-8"); + JSONObject jobject = JSONObject.parseObject(result); + int code = jobject.getIntValue("code"); + String message = jobject.getString("msg"); + if (200 != code) { + //throw new Exception("uploadFile Error,code[" + code + "],message[" + message + "]"); + log.error( "code: "+ code +" message: " + message); + if (response != null) { + try { + response.close(); + } catch (Throwable t) { + } + } + if (client != null) { + try { + client.close(); + } catch (Throwable t) { + } + } + return "澶辫触"; + } + return "鎴愬姛"; + } else { + //throw new Exception("uploadFile Error:" + response.getStatusLine().toString()); + log.error( "uploadFile Error:" + response.getStatusLine().toString()); + objectName.setResult(response.getStatusLine().toString()); + if (response != null) { + try { + response.close(); + } catch (Throwable t) { + } + } + if (client != null) { + try { + client.close(); + } catch (Throwable t) { + } + } + return "澶辫触"; + } + } catch (Throwable e) { + log.error( e.getMessage()); + if (response != null) { + try { + response.close(); + } catch (Throwable t) { + } + } + if (client != null) { + try { + client.close(); + } catch (Throwable t) { + } + } + return "澶辫触"; + } finally { + + if (response != null) { + try { + response.close(); + } catch (Throwable t) { + } + } + if (client != null) { + try { + client.close(); + } catch (Throwable t) { + } + } + return "鎴愬姛"; + } + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/SyslogClient.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/SyslogClient.java new file mode 100644 index 0000000..56db7dd --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/SyslogClient.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.dnc.utils; + +import org.graylog2.syslog4j.Syslog; +import org.graylog2.syslog4j.SyslogIF; + +import java.net.URLDecoder; + +/** + * @author clown + * * @date 2023/12/17 + */ +public class SyslogClient { + + private static final String message="charset=utf-8 logType=閫氱煡 instanceName=瀹炰緥1 taskName=浠诲姟2" + + " logLevel=鍛婅 objectName=瀵硅薄1 desc=鏄庣粏1 result=鎴愬姛 date=2023-10-30 00:21:00"; + + public static void send(String ip,Integer port){ + try { + // 鑾峰彇syslog鐨勬搷浣滅被锛屼娇鐢╱dp鍗忚銆俿yslog鏀寔"udp", "tcp"鍗忚 + SyslogIF syslog = Syslog.getInstance("udp"); + // 璁剧疆syslog鏈嶅姟鍣ㄧ鍦板潃鍜岀鍙� + syslog.getConfig().setHost(ip); + syslog.getConfig().setPort(port); + //鍙戦�佷俊鎭埌鏈嶅姟鍣紝2琛ㄧず鏃ュ織绾у埆 鑼冨洿涓�0~7鐨勬暟瀛楃紪鐮侊紝琛ㄧず浜嗕簨浠剁殑涓ラ噸绋嬪害銆�0鏈�楂橈紝7鏈�浣� + syslog.log(0, URLDecoder.decode(message, "utf-8")); + System.out.println("鍙戦�佹垚鍔�"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static Boolean sendClient(String ip,Integer port,String messageClient){ + try { + System.out.println(messageClient); + // 鑾峰彇syslog鐨勬搷浣滅被锛屼娇鐢╱dp鍗忚銆俿yslog鏀寔"udp", "tcp"鍗忚 + SyslogIF syslog = Syslog.getInstance("tcp"); + // 璁剧疆syslog鏈嶅姟鍣ㄧ鍦板潃鍜岀鍙� + syslog.getConfig().setHost(ip); + syslog.getConfig().setPort(port); + //鍙戦�佷俊鎭埌鏈嶅姟鍣紝2琛ㄧず鏃ュ織绾у埆 鑼冨洿涓�0~7鐨勬暟瀛楃紪鐮侊紝琛ㄧず浜嗕簨浠剁殑涓ラ噸绋嬪害銆�0鏈�楂橈紝7鏈�浣� + syslog.log(0, URLDecoder.decode(messageClient, "utf-8")); + System.out.println("鍙戦�佹垚鍔�"); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/TelnetUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/TelnetUtil.java new file mode 100644 index 0000000..01e6ed6 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/TelnetUtil.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.dnc.utils; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; + +/** + * @author clown + * * @date 2023/12/1 + */ +public class TelnetUtil { + public static boolean telnetPort(String hostname,int port ,int timeOut) { + Socket socket = new Socket(); + boolean isBool = false; + try { + socket.connect(new InetSocketAddress(hostname,port),timeOut); + isBool = socket.isConnected(); + return isBool; + } catch (IOException e) { + try { + socket.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + return isBool; + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/ValidateUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/ValidateUtil.java new file mode 100644 index 0000000..dd02113 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/ValidateUtil.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.dnc.utils; + +import org.apache.commons.lang3.StringUtils; + +public class ValidateUtil { + + /** + * 妫�鏌ユ暣鏁扮被鍨嬫槸鍚︿负姝f暣鏁� + * @param val + * @return + */ + public static boolean validateLong(Long val) { + if(val == null || val < 1) + return false; + return true; + } + + /** + * 妫�鏌ユ暣鏁扮被鍨嬫槸鍚︿负姝f暣鏁� + * @param val + * @return + */ + public static boolean validateInteger(Integer val) { + if(val == null || val < 1) + return false; + return true; + } + + /** + * 妫�鏌ュ瓧绗︿覆鏄惁涓虹┖ + * @param val + * @return + */ + public static boolean validateString(String val) { + if(StringUtils.isBlank(val)) + return false; + return true; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/date/DateUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/date/DateUtil.java new file mode 100644 index 0000000..3506a10 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/date/DateUtil.java @@ -0,0 +1,145 @@ +package org.jeecg.modules.dnc.utils.date; + +import lombok.extern.slf4j.Slf4j; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * Created by Administrator on 2015/8/28. + */ +@Slf4j +public class DateUtil { + public static final String STR_DATE = "yyyy-MM-dd"; + public static final String STR_DATE_STRING = "yyyy_MM_dd"; + public static final String STR_YEAR_MONTH = "yyyy-MM"; + public static final String STRDATE = "yyyyMMdd"; + public static final String STR_DATE_TIME = "yyyy-MM-dd HH:mm:ss.SSS"; + public static final String STR_DATE_TIME_SMALL = "yyyy-MM-dd HH:mm:ss"; + public static final String STR_DATE_TIME_MIN = "yyyy-MM-dd HH:mm"; + public static final String STR_DATE_TIME_HOUR = "yyyy-MM-dd HH"; + public static final String STR_DATE_TIME_FULL = "yyyyMMddHHmmssSSS"; + public static final String STR_YEARMONTH = "yyyyMM"; + public static final String STR_YEARMONTHDAY = "yyyyMMdd"; + public static final String STR_YEAR = "yyyy"; + + /** + * 鑾峰彇褰撳墠鏃堕棿 + * @return + */ + public static Date getNow() { + return new Date(System.currentTimeMillis()); + } + + /** + * <p> + * Description: 鍘绘帀鏃ユ湡鏃堕棿涓殑鏃堕棿閮ㄥ垎 + * </p> + * 濡�: 2013-11-11 18:56:33 ---> 2013-11-11 00:00:00 + * + * @param date 闇�瑕佷慨鏀圭殑鏃堕棿 + * @return 淇敼鍚庣殑鏃堕棿 + */ + public static Date removeTime(Date date) { + Date result = null; + try { + SimpleDateFormat df = new SimpleDateFormat(STR_DATE); + String dateStr = df.format(date); + result = df.parse(dateStr); + } catch (ParseException e) { + log.error(e.getMessage(), e.getStackTrace()); + return null; + } + return result; + } + + /** + * <p> + * Description: 鎸夋寚瀹氭牸寮忚幏鍙栨椂闂村瓧绗︿覆 + * </p> + * + * @param date 瑕佽浆鎹㈢殑鏃ユ湡 + * @param format 鏍煎紡,渚嬪:yyyy-MM-dd HH:mm:ss.SSS + * @return 杞崲鍚庣殑鏃堕棿瀛楃涓� + */ + public static String format(Date date, String format) { + SimpleDateFormat df = new SimpleDateFormat(format); + return df.format(date); + } + + /** + * 鑾峰彇鏃ユ湡鐨勫ぉ瀛楃涓� + * @param date + * @return + */ + public static String getDayStr(Date date) { + Calendar calendar = Calendar.getInstance(); // 寰楀埌鏃ュ巻 + calendar.setTime(date);// 鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘� + int day = calendar.get(Calendar.DATE);//鑾峰彇鏃� + String dayStr = day < 10 ? "0" + day : day + ""; + return dayStr; + } + + /** + * 鑾峰彇鏃ユ湡鐨勫勾浠藉瓧绗︿覆 + * @param date + * @return + */ + public static String getYearStr(Date date) { + Calendar calendar = Calendar.getInstance(); // 寰楀埌鏃ュ巻 + calendar.setTime(date);// 鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘� + String yearStr = calendar.get(Calendar.YEAR) + "";//鑾峰彇鏃� + return yearStr; + } + + /** + * 鑾峰彇鏃ユ湡鐨勬湀浠藉瓧绗︿覆 + * @param date + * @return + */ + public static String getMonthStr(Date date) { + Calendar calendar = Calendar.getInstance(); // 寰楀埌鏃ュ巻 + calendar.setTime(date);// 鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘� + int month = calendar.get(Calendar.MONTH);//鑾峰彇鏃� + String monthStr = month < 10 ? "0" + month : month + ""; + return monthStr; + } + + /** + * 鑾峰彇褰撳墠鏃堕棿 鍓嶅悗i澶� + * 绮剧‘鍒扮 + * @param i 涓烘鏁颁唬琛ㄥ姞i澶╋紝涓鸿礋鏁颁唬琛ㄥ噺i澶� + * @return + */ + public static Date addDay(Date date, int i){ + Calendar calendar = Calendar.getInstance(); // 寰楀埌鏃ュ巻 + calendar.setTime(date);// 鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘� + calendar.add(Calendar.DAY_OF_MONTH, i); // 璁剧疆澶╂暟鍔犲噺 + return calendar.getTime(); + } + + /** + * 鑾峰彇褰撳墠鏃堕棿 鍓嶅悗i绉� + * 绮剧‘鍒扮 + * @param i 涓烘鏁颁唬琛ㄥ姞i绉掞紝涓鸿礋鏁颁唬琛ㄥ噺i绉� + * @return + */ + public static Date addSeconds(Date date, int i){ + Calendar calendar = Calendar.getInstance(); // 寰楀埌鏃ュ巻 + calendar.setTime(date);// 鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘� + calendar.add(Calendar.SECOND, i); // 璁剧疆绉掓暟鍔犲噺 + return calendar.getTime(); + } + + public static Date toDate(String date, String format) { + SimpleDateFormat df = new SimpleDateFormat(format); + try { + return df.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/CommonConstant.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/CommonConstant.java new file mode 100644 index 0000000..e75c76c --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/CommonConstant.java @@ -0,0 +1,526 @@ +package org.jeecg.modules.dnc.utils.file; + +/** + * @Description: 閫氱敤甯搁噺 + * @author: jeecg-boot + */ +public interface CommonConstant { + + /** + * 姝e父鐘舵�� + */ + Integer STATUS_NORMAL = 0; + + /** + * 绂佺敤鐘舵�� + */ + Integer STATUS_DISABLE = -1; + + /** + * 鍒犻櫎鏍囧織 + */ + Integer DEL_FLAG_1 = 1; + + /** + * 鏈垹闄� + */ + Integer DEL_FLAG_0 = 0; + + /** + * 绯荤粺鏃ュ織绫诲瀷锛� 鐧诲綍 + */ + int LOG_TYPE_1 = 1; + + /** + * 绯荤粺鏃ュ織绫诲瀷锛� 鎿嶄綔 + */ + int LOG_TYPE_2 = 2; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏌ヨ + */ + int OPERATE_TYPE_1 = 1; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 娣诲姞 + */ + int OPERATE_TYPE_2 = 2; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏇存柊 + */ + int OPERATE_TYPE_3 = 3; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍒犻櫎 + */ + int OPERATE_TYPE_4 = 4; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍊掑叆 + */ + int OPERATE_TYPE_5 = 5; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 瀵煎嚭 + */ + int OPERATE_TYPE_6 = 6; + + + /** + * {@code 500 Server Error} (HTTP/1.0 - RFC 1945) + */ + Integer SC_INTERNAL_SERVER_ERROR_500 = 500; + /** + * {@code 200 OK} (HTTP/1.0 - RFC 1945) + */ + Integer SC_OK_200 = 200; + + /** + * 璁块棶鏉冮檺璁よ瘉鏈�氳繃 510 + */ + Integer SC_JEECG_NO_AUTHZ = 510; + + /** + * 鐧诲綍鐢ㄦ埛Shiro鏉冮檺缂撳瓨KEY鍓嶇紑 + */ + public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:"; + /** + * 鐧诲綍鐢ㄦ埛Token浠ょ墝缂撳瓨KEY鍓嶇紑 + */ + String PREFIX_USER_TOKEN = "prefix_user_token_"; +// /** Token缂撳瓨鏃堕棿锛�3600绉掑嵆涓�灏忔椂 */ +// int TOKEN_EXPIRE_TIME = 3600; + + /** + * 鐧诲綍浜岀淮鐮� + */ + String LOGIN_QRCODE_PRE = "QRCODELOGIN:"; + String LOGIN_QRCODE = "LQ:"; + /** + * 鐧诲綍浜岀淮鐮乼oken + */ + String LOGIN_QRCODE_TOKEN = "LQT:"; + + + /** + * 0锛氫竴绾ц彍鍗� + */ + Integer MENU_TYPE_0 = 0; + /** + * 1锛氬瓙鑿滃崟 + */ + Integer MENU_TYPE_1 = 1; + /** + * 2锛氭寜閽潈闄� + */ + Integer MENU_TYPE_2 = 2; + + /** + * 閫氬憡瀵硅薄绫诲瀷锛圲SER:鎸囧畾鐢ㄦ埛锛孉LL:鍏ㄤ綋鐢ㄦ埛锛� + */ + String MSG_TYPE_UESR = "USER"; + String MSG_TYPE_ALL = "ALL"; + + /** + * 鍙戝竷鐘舵�侊紙0鏈彂甯冿紝1宸插彂甯冿紝2宸叉挙閿�锛� + */ + String NO_SEND = "0"; + String HAS_SEND = "1"; + String HAS_CANCLE = "2"; + + /** + * 闃呰鐘舵�侊紙0鏈锛�1宸茶锛� + */ + String HAS_READ_FLAG = "1"; + String NO_READ_FLAG = "0"; + + /** + * 浼樺厛绾э紙L浣庯紝M涓紝H楂橈級 + */ + String PRIORITY_L = "L"; + String PRIORITY_M = "M"; + String PRIORITY_H = "H"; + + /** + * 鐭俊妯℃澘鏂瑰紡 0 .鐧诲綍妯℃澘銆�1.娉ㄥ唽妯℃澘銆�2.蹇樿瀵嗙爜妯℃澘 + */ + String SMS_TPL_TYPE_0 = "0"; + String SMS_TPL_TYPE_1 = "1"; + String SMS_TPL_TYPE_2 = "2"; + + /** + * 鐘舵��(0鏃犳晥1鏈夋晥) + */ + String STATUS_0 = "0"; + String STATUS_1 = "1"; + + /** + * 鏄惁榛樿(锛�0锛氭槸锛�1锛氬惁锛�) + */ + String DEFAULT_0 = "0"; + String DEFAULT_1 = "1"; + + + /** + * 渚涘簲鍟嗙被鍨嬶紙1锛氬閮ㄥ崟浣嶏紝2锛氬唴閮ㄥ崟浣嶏級) + */ + String SUPPLIERTYPE_1 = "1"; + String SUPPLIERTYPE_2 = "2"; + /** + * 鍚屾宸ヤ綔娴佸紩鎿�1鍚屾0涓嶅悓姝� + */ + Integer ACT_SYNC_1 = 1; + Integer ACT_SYNC_0 = 0; + + /** + * 娑堟伅绫诲瀷1:閫氱煡鍏憡2:绯荤粺娑堟伅 + */ + String MSG_CATEGORY_1 = "1"; + String MSG_CATEGORY_2 = "2"; + + /** + * 鏄惁閰嶇疆鑿滃崟鐨勬暟鎹潈闄� 1鏄�0鍚� + */ + Integer RULE_FLAG_0 = 0; + Integer RULE_FLAG_1 = 1; + + /** + * 鏄惁鐢ㄦ埛宸茶鍐荤粨 1姝e父(瑙e喕) 2鍐荤粨 + */ + Integer USER_UNFREEZE = 1; + Integer USER_FREEZE = 2; + + /** + * 瀛楀吀缈昏瘧鏂囨湰鍚庣紑 + */ + String DICT_TEXT_SUFFIX = "_dictText"; + + /** + * 琛ㄥ崟璁捐鍣ㄤ富琛ㄧ被鍨� + */ + Integer DESIGN_FORM_TYPE_MAIN = 1; + + /** + * 琛ㄥ崟璁捐鍣ㄥ瓙琛ㄨ〃绫诲瀷 + */ + Integer DESIGN_FORM_TYPE_SUB = 2; + + /** + * 琛ㄥ崟璁捐鍣║RL鎺堟潈閫氳繃 + */ + Integer DESIGN_FORM_URL_STATUS_PASSED = 1; + + /** + * 琛ㄥ崟璁捐鍣║RL鎺堟潈鏈�氳繃 + */ + Integer DESIGN_FORM_URL_STATUS_NOT_PASSED = 2; + + /** + * 琛ㄥ崟璁捐鍣ㄦ柊澧� Flag + */ + String DESIGN_FORM_URL_TYPE_ADD = "add"; + /** + * 琛ㄥ崟璁捐鍣ㄤ慨鏀� Flag + */ + String DESIGN_FORM_URL_TYPE_EDIT = "edit"; + /** + * 琛ㄥ崟璁捐鍣ㄨ鎯� Flag + */ + String DESIGN_FORM_URL_TYPE_DETAIL = "detail"; + /** + * 琛ㄥ崟璁捐鍣ㄥ鐢ㄦ暟鎹� Flag + */ + String DESIGN_FORM_URL_TYPE_REUSE = "reuse"; + /** + * 琛ㄥ崟璁捐鍣ㄧ紪杈� Flag 锛堝凡寮冪敤锛� + */ + String DESIGN_FORM_URL_TYPE_VIEW = "view"; + + /** + * online鍙傛暟鍊艰缃紙鏄細Y, 鍚︼細N锛� + */ + String ONLINE_PARAM_VAL_IS_TURE = "Y"; + String ONLINE_PARAM_VAL_IS_FALSE = "N"; + + /** + * 鏂囦欢涓婁紶绫诲瀷锛堟湰鍦帮細local锛孧inio锛歮inio锛岄樋閲屼簯锛歛lioss锛� + */ + String UPLOAD_TYPE_LOCAL = "local"; + String UPLOAD_TYPE_MINIO = "minio"; + String UPLOAD_TYPE_OSS = "alioss"; + + /** + * 鏂囨。涓婁紶鑷畾涔夋《鍚嶇О + */ + String UPLOAD_CUSTOM_BUCKET = "eoafile"; + /** + * 鏂囨。涓婁紶鑷畾涔夎矾寰� + */ + String UPLOAD_CUSTOM_PATH = "eoafile"; + /** + * 鏂囦欢澶栭摼鎺ユ湁鏁堝ぉ鏁� + */ + Integer UPLOAD_EFFECTIVE_DAYS = 1; + + /** + * 鍛樺伐韬唤 锛�1:鏅�氬憳宸� 2:涓婄骇锛� + */ + Integer USER_IDENTITY_1 = 1; + Integer USER_IDENTITY_2 = 2; + + /** + * sys_user 琛� username 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username"; + /** + * sys_user 琛� work_no 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no"; + /** + * sys_user 琛� phone 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone"; + /** + * 杈炬ⅵ鏁版嵁搴撳崌鎻愮ず銆傝繚鍙嶈〃[SYS_USER]鍞竴鎬х害鏉� + */ + String SQL_INDEX_UNIQ_SYS_USER = "鍞竴鎬х害鏉�"; + + /** + * sys_user 琛� email 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email"; + /** + * sys_quartz_job 琛� job_class_name 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name"; + /** + * sys_position 琛� code 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_CODE = "uniq_code"; + /** + * sys_role 琛� code 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code"; + /** + * sys_depart 琛� code 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code"; + /** + * sys_category 琛� code 鍞竴閿储寮� + */ + String SQL_INDEX_UNIQ_CATEGORY_CODE = "idx_sc_code"; + /** + * 鍦ㄧ嚎鑱婂ぉ 鏄惁涓洪粯璁ゅ垎缁� + */ + String IM_DEFAULT_GROUP = "1"; + /** + * 鍦ㄧ嚎鑱婂ぉ 鍥剧墖鏂囦欢淇濆瓨璺緞 + */ + String IM_UPLOAD_CUSTOM_PATH = "biz/user_imgs"; + /** + * 鍦ㄧ嚎鑱婂ぉ 鐢ㄦ埛鐘舵�� + */ + String IM_STATUS_ONLINE = "online"; + + /** + * 鍦ㄧ嚎鑱婂ぉ SOCKET娑堟伅绫诲瀷 + */ + String IM_SOCKET_TYPE = "chatMessage"; + + /** + * 鍦ㄧ嚎鑱婂ぉ 鏄惁寮�鍚粯璁ゆ坊鍔犲ソ鍙� 1鏄� 0鍚� + */ + String IM_DEFAULT_ADD_FRIEND = "1"; + + /** + * 鍦ㄧ嚎鑱婂ぉ 鐢ㄦ埛濂藉弸缂撳瓨鍓嶇紑 + */ + String IM_PREFIX_USER_FRIEND_CACHE = "sys:cache:im:im_prefix_user_friend_"; + + /** + * 鑰冨嫟琛ュ崱涓氬姟鐘舵�� 锛�1锛氬悓鎰� 2锛氫笉鍚屾剰锛� + */ + String SIGN_PATCH_BIZ_STATUS_1 = "1"; + String SIGN_PATCH_BIZ_STATUS_2 = "2"; + + /** + * 鍏枃鏂囨。涓婁紶鑷畾涔夎矾寰� + */ + String UPLOAD_CUSTOM_PATH_OFFICIAL = "officialdoc"; + /** + * 鍏枃鏂囨。涓嬭浇鑷畾涔夎矾寰� + */ + String DOWNLOAD_CUSTOM_PATH_OFFICIAL = "officaldown"; + + /** + * WPS瀛樺偍鍊肩被鍒�(1 code鏂囧彿 2 text锛圵PS妯℃澘杩樻槸鍏枃鍙戞枃妯℃澘锛�) + */ + String WPS_TYPE_1 = "1"; + String WPS_TYPE_2 = "2"; + + String YN_Y = "Y"; + String YN_N = "N"; + + + /**===============================================================================================*/ + /** + * ::闈炲父閲嶈:: + * 娉ㄦ剰锛氳繖鍥涗釜甯搁噺鍊煎鏋滀慨鏀癸紝闇�瑕佷笌 jeecg-boot-starter/jeecg-boot-common/org.jeecg.config.FeignConfig 绫讳腑鐨勫�间繚鎸佷竴鑷淬�� + */ + String X_ACCESS_TOKEN = "X-Access-Token"; + String X_SIGN = "X-Sign"; + String X_TIMESTAMP = "X-TIMESTAMP"; + /** + * 绉熸埛 璇锋眰澶� + */ + String TENANT_ID = "tenant-id"; + /** + * =============================================================================================== + */ + + String TOKEN_IS_INVALID_MSG = "Token澶辨晥锛岃閲嶆柊鐧诲綍!"; + String X_FORWARDED_SCHEME = "X-Forwarded-Scheme"; + + + /** + * 寰湇鍔¤鍙栭厤缃枃浠跺睘鎬� 鏈嶅姟鍦板潃 + */ + String CLOUD_SERVER_KEY = "spring.cloud.nacos.discovery.server-addr"; + + /** + * 绗笁鏂圭櫥褰� 楠岃瘉瀵嗙爜/鍒涘缓鐢ㄦ埛 閮介渶瑕佽缃竴涓搷浣滅爜 闃叉琚伓鎰忚皟鐢� + */ + String THIRD_LOGIN_CODE = "third_login_code"; + + /** + * 绗笁鏂笰PP鍚屾鏂瑰悜锛氭湰鍦� --> 绗笁鏂笰PP + */ + String THIRD_SYNC_TO_APP = "SYNC_TO_APP"; + /** + * 绗笁鏂笰PP鍚屾鏂瑰悜锛氱涓夋柟APP --> 鏈湴 + */ + String THIRD_SYNC_TO_LOCAL = "SYNC_TO_LOCAL"; + + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細0=鏈彂甯� + */ + String ANNOUNCEMENT_SEND_STATUS_0 = "0"; + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細1=宸插彂甯� + */ + String ANNOUNCEMENT_SEND_STATUS_1 = "1"; + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細2=宸叉挙閿� + */ + String ANNOUNCEMENT_SEND_STATUS_2 = "2"; + + /** + * ONLINE 鎶ヨ〃鏉冮檺鐢� 浠巖equest涓幏鍙栧湴鍧�鏍忓悗鐨勫弬鏁� + */ + String ONL_REP_URL_PARAM_STR = "onlRepUrlParamStr"; + + /** + * POST璇锋眰 + */ + String HTTP_POST = "POST"; + + /** + * PUT璇锋眰 + */ + String HTTP_PUT = "PUT"; + + /** + * PATCH璇锋眰 + */ + String HTTP_PATCH = "PATCH"; + + /** + * 鏈煡鐨� + */ + String UNKNOWN = "unknown"; + + /** + * 瀛楃涓瞙ttp + */ + String STR_HTTP = "http"; + + /** + * String 绫诲瀷鐨勭┖鍊� + */ + String STRING_NULL = "null"; + + /** + * 鍓嶇vue3鐗堟湰Header鍙傛暟鍚� + */ + String VERSION = "X-Version"; + + /** + * 瀛樺偍鍦ㄧ嚎绋嬪彉閲忛噷鐨勫姩鎬佽〃鍚� + */ + String DYNAMIC_TABLE_NAME = "DYNAMIC_TABLE_NAME"; + /** + * http:// http鍗忚 + */ + String HTTP_PROTOCOL = "http://"; + + /** + * https:// https鍗忚 + */ + String HTTPS_PROTOCOL = "https://"; + + /** + * 閮ㄩ棬琛ㄥ敮涓�key锛宨d + */ + String DEPART_KEY_ID = "id"; + /** + * 閮ㄩ棬琛ㄥ敮涓�key锛宱rgCode + */ + String DEPART_KEY_ORG_CODE = "orgCode"; + + /** + * 鍙戞秷鎭� 浼氫紶閫掍竴浜涗俊鎭埌map + */ + String NOTICE_MSG_SUMMARY = "NOTICE_MSG_SUMMARY"; + + /** + * 鍙戞秷鎭� 浼氫紶閫掍竴涓笟鍔D鍒癿ap + */ + String NOTICE_MSG_BUS_ID = "NOTICE_MSG_BUS_ID"; + + /** + * 閭娑堟伅涓湴鍧�鐧诲綍鏃跺湴鍧�鍚庢惡甯︾殑token,闇�瑕佹浛鎹㈡垚鐪熷疄鐨則oken鍊� + */ + String LOGIN_TOKEN = "{LOGIN_TOKEN}"; + + /** + * 妯℃澘娑堟伅涓� 璺宠浆鍦板潃鐨勫搴旂殑key + */ + String MSG_HREF_URL = "url"; + + /** + * sys_data_log琛ㄧ殑绫诲瀷 鐢ㄤ簬鍖哄埆璇勮鍖哄煙鐨勬棩蹇楁暟鎹� + */ + String DATA_LOG_TYPE_COMMENT = "comment"; + + /** + * sys_data_log琛ㄧ殑绫诲瀷 鑰佺殑鏁版嵁姣旇緝 绫诲瀷閮借缃负json + */ + String DATA_LOG_TYPE_JSON = "json"; + + /** + * 娑堟伅妯℃澘锛歮arkdown + */ + String MSG_TEMPLATE_TYPE_MD = "5"; + + /** + * 鐭俊楠岃瘉鐮乺edis-key鐨勫墠缂� + */ + String PHONE_REDIS_KEY_PRE = "phone_msg"; + + /** + * 瀹氭椂浠诲姟澶辫触鎺ユ敹瑙掕壊瀛楀吀缂栧彿 + */ + String JOB_SEND_MSG = "job_fail_send_msg_role"; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/DocVersionUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/DocVersionUtil.java new file mode 100644 index 0000000..91fcfa6 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/DocVersionUtil.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.dnc.utils.file; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +@Slf4j +public class DocVersionUtil { + private static final char[] HEX_DIGITS = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; + + /** + * 鐢熸垚鏂扮殑鐗堟湰鍙� + * @param oldVersion + * @return + */ + public static String generateNewVersion(String oldVersion) { + if(StringUtils.isBlank(oldVersion)) + return "a.1"; + if(oldVersion.contains(".")) { + String[] arr = oldVersion.split("\\."); + if(arr == null || arr.length != 2) + return null; + String node = arr[0]; + String num = arr[1]; + if(node.length() != 1) + return null; + int site = 1; + try { + site = Integer.valueOf(num); + }catch (NumberFormatException e) { + log.error(e.getMessage(), e.getStackTrace()); + return null; + } + return node + "." + (site + 1); + }else { + if(oldVersion.length() != 1) + return null; + char node = oldVersion.charAt(0); + int site = 1; + for(int i = 0; i < HEX_DIGITS.length; i++) { + if(HEX_DIGITS[i] == node) { + node = HEX_DIGITS[i + 1]; + return node + "." + site; + } + } + return null; + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileNumUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileNumUtil.java new file mode 100644 index 0000000..91de31a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileNumUtil.java @@ -0,0 +1,97 @@ +package org.jeecg.modules.dnc.utils.file; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.ResourceUtils; + +import java.io.*; + +/** + * @author clown + * * @date 2023/12/29 + */ +@Slf4j +public class FileNumUtil { + /** + * 鑾峰彇鏁版嵁鍐呭 + * @param path + * @return + */ + public static String readFileSum(String path){ + BufferedReader br = null; + try{ + File file = ResourceUtils.getFile(path); + if (!file.getParentFile().exists()){ + //鏂囦欢澶逛笉瀛樺湪 鐢熸垚 + file.getParentFile().mkdirs(); + } + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"UTF-8"); + br = new BufferedReader(reader); + return br.readLine(); + }catch (Exception e){ + log.error("鏁版嵁瑙f瀽澶辫触锛寋}", e); + return null; + }finally { + if(br != null){ + try { + br.close(); + } catch (IOException e) { + } + } + } + + } + + public static boolean updateFile(String newText,String filePath){ + try { + File file = new File(filePath); + FileInputStream fis = new FileInputStream(file); + byte[] data = new byte[(int) file.length()]; + fis.read(data); + fis.close(); + + String content = new String(data, "UTF-8"); + content = content.replaceAll("Old content", newText); // 鏇挎崲鏃у唴瀹逛负鏂板唴瀹� + + FileOutputStream fos = new FileOutputStream(file); + fos.write(content.getBytes("UTF-8")); + fos.close(); + } catch (IOException e) { + System.out.println("Error occurred: " + e.getMessage()); + } + return true; + } + + /** + * 鏂规硶涓�:浣跨敤 FileWriter 鍐欐枃浠� + * @param filePath 鏂囦欢鐩綍 + * @param content 寰呭啓鍏ュ唴瀹� + * @throws IOException + */ + public static void fileWriterSql( String content, String filePath) throws IOException { + OutputStreamWriter outputStreamWriter = null; + try { + File file = new File(filePath); + if (!file.exists()){ + file.createNewFile(); + } + FileOutputStream outputStream = new FileOutputStream(file); + if (outputStream != null){ + outputStreamWriter = new OutputStreamWriter(outputStream, "utf-8"); + outputStreamWriter.write(content); + outputStreamWriter.flush(); + } + } + catch (IOException e) { + e.getMessage(); + } + finally { + try { + if (outputStreamWriter != null){ + outputStreamWriter.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileUtilS.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileUtilS.java new file mode 100644 index 0000000..a776592 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileUtilS.java @@ -0,0 +1,1011 @@ +package org.jeecg.modules.dnc.utils.file; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.api.vo.FileUploadResult; +import org.jeecg.common.util.SHA256Util; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.utils.date.DateUtil; +import org.jeecg.modules.dnc.response.DocumentCode; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.nio.channels.FileChannel; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +@Slf4j +@Component +public class FileUtilS { + + private static String fileUploadFolder; + + @Value("${fileHomePath}") + public void setFileUploadFolder(String fileUploadFolder) { + FileUtilS.fileUploadFolder = fileUploadFolder; + } + + + private static String fileNcFolder; + + @Value("${fileNCPath}") + public void setFileNCFolder(String fileNcFolder) { + FileUtilS.fileNcFolder = fileNcFolder; + } + + private static String addOrDelete; + + @Value("${ncSend.addOrDelete}") + public void addOrDelete(String addOrDelete) { + FileUtilS.addOrDelete = addOrDelete; + } + + + /** + * 鏂规硶涓�:浣跨敤 FileWriter 鍐欐枃浠� + * @param filepath 鏂囦欢鐩綍 + * @param content 寰呭啓鍏ュ唴瀹� + * @throws IOException + */ + public static void fileWriterSql(String filepath, String content) throws IOException { + OutputStreamWriter outputStreamWriter = null; + try { + File file = new File(filepath); + if (!file.exists()){ + file.createNewFile(); + } + FileOutputStream outputStream = new FileOutputStream(file); + if (outputStream != null){ + outputStreamWriter = new OutputStreamWriter(outputStream, "utf-8"); + outputStreamWriter.write(content); + outputStreamWriter.flush(); + } + } + catch (IOException e) { + e.getMessage(); + } + finally { + try { + if (outputStreamWriter != null){ + outputStreamWriter.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static boolean copyNcFile(String lastFile,String filePath) { + String absolutePathSend = lastFile; + FileChannel in = null; + FileChannel out = null; + try{ + in = new FileInputStream(absolutePathSend).getChannel(); + File file = new File(filePath); + if (!file.getParentFile().exists()){ + //鏂囦欢澶逛笉瀛樺湪 鐢熸垚 + file.getParentFile().mkdirs(); + } + out = new FileOutputStream(filePath, true).getChannel(); + out.transferFrom(in, 0, in.size()); + try { + Thread.sleep(50); + } catch (InterruptedException e) { + e.printStackTrace(); + } + in.close(); + out.close(); + + } + catch (IOException e) { + e.printStackTrace(); + try { + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e1) { + e1.printStackTrace(); + } + return false; + }finally { + try { + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return true; + } + + /** + * 鏂板缓鏂囦欢澶� + * @param path + * @return + */ + + public static boolean saveFileFromPath(String path) { + if (StringUtils.isEmpty(path)) { + return false; + } + String absolutePath = fileNcFolder + "/" + path ; + try { + boolean b = new File(absolutePath).mkdirs(); + return b; + }catch (Exception e) { + return false; + } + } + + /** + * 鏂板缓鏂囦欢澶� + * @param path + * @return + */ + + public static boolean saveDeviceFromPath(String path) { + if (StringUtils.isEmpty(path)) { + return false; + } + String absolutePathSend = fileNcFolder + "/" + path + "/send" ; + String absolutePathRec = fileNcFolder + "/" + path + "/rec" ; + try { + boolean b = new File(absolutePathSend).mkdirs(); + boolean c = new File(absolutePathRec).mkdirs(); + return b; + }catch (Exception e) { + return false; + } + } + + + /** + * 淇敼鏂囦欢澶� + * @param path + * @return + */ + + public static boolean updateFileFromPath(String path,String lastPathName) { + if (StringUtils.isEmpty(path)) { + return false; + } + String absolutePathLast = fileNcFolder + "/" + lastPathName ; + String absolutePathNew = fileNcFolder + "/" + path ; + try { + boolean b = new File(absolutePathLast).renameTo(new File(absolutePathNew)); + return b; + }catch (Exception e) { + return false; + } + } + + public static boolean uploadFileSend(MultipartFile file,String path) { + if(file == null || file.isEmpty()) { + return false; + } + //缁濆璺緞 + String absolutePath = fileNcFolder + "/" + path + "/send/"; + String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + // 鐩爣鏂囦欢璺緞+鏂囦欢鍚� + String targetFile = absolutePath + file.getOriginalFilename() ; + File toFile = new File(targetFile); + if (!toFile.getParentFile().exists()) { + toFile.mkdirs(); + } + + try { + file.transferTo(toFile); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + /** + * file杞琈ultipartFile + * + * @param file file + * @return MultipartFile + */ + public static MultipartFile fileToMultipartFile(File file) { + MultipartFile result = null; + if (null != file) { + try (FileInputStream input = new FileInputStream(file)) { + result = new MockMultipartFile(file.getName().concat("temp"), file.getName(), "text/plain", input); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + public static boolean copyFileRec(String lastFile) { + String absolutePathSend = lastFile; + //瀛楃涓叉浛鎹� + String absolutePathSendNotFile = lastFile.replace("\\rec\\","\\bak_rec\\"); + String fileNameNoPath = (new File(lastFile)).getName(); + String suffix = getFileSuffix(fileNameNoPath); + Integer recNum = absolutePathSendNotFile.lastIndexOf(fileNameNoPath); + if (suffix == null) { + + absolutePathSendNotFile = absolutePathSendNotFile.substring(0,recNum) + fileNameNoPath+ "-" + + DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_FULL); + /* absolutePathSendNotFile = absolutePathSendNotFile.replace(fileNameNoPath, + fileNameNoPath + "-" +DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_FULL));*/ + } else { + String name = fileNameNoPath.replace("." + suffix,""); + absolutePathSendNotFile = absolutePathSendNotFile.substring(0,recNum) + name+ "-" + + DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_FULL) + "." + suffix; + } + try{ + FileChannel in = new FileInputStream(absolutePathSend).getChannel(); + File file = new File(absolutePathSendNotFile); + if (!file.getParentFile().exists()){ + //鏂囦欢澶逛笉瀛樺湪 鐢熸垚 + file.getParentFile().mkdirs(); + } + FileChannel out = new FileOutputStream(absolutePathSendNotFile, true).getChannel(); + out.transferFrom(in, 0, in.size()); + in.close(); + out.close(); + return true; + } + catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + public static boolean fileRecDelete(String lastFile) { + String absolutePathSend = lastFile; + Path path = Paths.get(lastFile); + try { + System.gc(); + Files.delete(path); + } catch (IOException e) { + e.printStackTrace(); + } + try{ + File file = new File(lastFile); + file.delete(); + return true; + } + catch (Exception e) { + e.printStackTrace(); + return false; + } + } + public static Boolean deleteFile(File file) { + //鍒ゆ柇鏂囦欢涓嶄负null鎴栨枃浠剁洰褰曞瓨鍦� + if (file == null || !file.exists()) { + System.out.println("鏂囦欢鍒犻櫎澶辫触,璇锋鏌ユ枃浠舵槸鍚﹀瓨鍦ㄤ互鍙婃枃浠惰矾寰勬槸鍚︽纭�"); + return false; + } + //鑾峰彇鐩綍涓嬪瓙鏂囦欢 + File[] files = file.listFiles(); + //閬嶅巻璇ョ洰褰曚笅鐨勬枃浠跺璞� + for (File f : files) { + //鍒ゆ柇瀛愮洰褰曟槸鍚﹀瓨鍦ㄥ瓙鐩綍,濡傛灉鏄枃浠跺垯鍒犻櫎 + if (f.isDirectory()) { + //閫掑綊鍒犻櫎鐩綍涓嬬殑鏂囦欢 + deleteFile(f); + } else { + //鏂囦欢鍒犻櫎 + f.delete(); + //鎵撳嵃鏂囦欢鍚� + System.out.println("鏂囦欢鍚嶏細" + f.getName()); + } + } + //鏂囦欢澶瑰垹闄� + file.delete(); + System.out.println("鐩綍鍚嶏細" + file.getName()); + return true; + } + + public static boolean copyFile(String lastFile ,String newFile, String fileName) { + String absolutePathSend = fileNcFolder + "/" + newFile + "/send/" + fileName; + String absolutePathSendNotFile = fileNcFolder + "/" + newFile + "/send/"; + String absolutePath = fileUploadFolder + "/" + lastFile; + try{ + File toFile = new File(absolutePathSendNotFile); + if("true".equals(addOrDelete)) { + deleteFile(toFile); + } + toFile.mkdirs(); + FileChannel in = new FileInputStream(absolutePath).getChannel(); + //鏌ヨ鏂囦欢鏄惁瀛樺湪 + File file = new File(absolutePathSend); + //鍒ゆ柇鏂囦欢鎴栨枃浠跺す鏄惁瀛樺湪 + boolean flag = file.exists(); + if(flag) { + //鏂囦欢瀛樺湪灏辫鍒犻櫎鏂囦欢 + System.gc(); + file.delete(); + } + String suffix = FileUtilS.getFileSuffix(fileName); + String newFileName = FileUtilS.getFilenameNonSuffix(fileName); + String zip = fileNcFolder + "/" + newFile + "/send/" + newFileName + "/"; + + FileChannel out = new FileOutputStream(absolutePathSend, true).getChannel(); + out.transferFrom(in, 0, in.size()); + if (suffix.equals("zip")) { + try { + FileZipUtil.unZipFiles(absolutePathSend,zip); + } catch (Exception e) { + e.printStackTrace(); + } + } + return true; + } + catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + + + /** + * 鍒犻櫎鏂囦欢 + * + * @param filePath + * @return + */ + public static boolean deleteFile(String filePath) { + boolean flag = false; + File file = new File(filePath); + if (!file.exists()) { + return flag; + } + if (!file.isDirectory()) { + return flag; + } + String[] tempList = file.list(); + File temp; + for (int i = 0; i < tempList.length; i++) { + if (filePath.endsWith(File.separator)) { + temp = new File(filePath + tempList[i]); + } else { + temp = new File(filePath + File.separator + tempList[i]); + } + if (temp.isFile()) { + temp.delete(); + } + if (temp.isDirectory()) { + // 鍏堝垹闄ゆ枃浠跺す閲岄潰鐨勬枃浠� + deleteFile(filePath + "/" + tempList[i]); + // 鍐嶅垹闄ょ┖鏂囦欢澶� + deleteFile(filePath + "/" + tempList[i]); + flag = true; + } + } + return flag; + } + + + /** + * 鍒犻櫎鏂囦欢 + * + * @param filePath + * @return + */ + public static boolean deleteNcFile(String filePath) { + boolean flag = false; + File file = new File(filePath); + if (!file.exists()) { + return flag; + } + boolean b = file.delete(); + if (!b) { + System.out.println("鏂囦欢鍒犻櫎澶辫触锛� " + filePath); + } + return true; + } + + /** + * 闆嗘垚鏁版嵁 + * @param lastFile + * @param newFile + * @param zipString + * @return + */ + public static boolean copyFileNcIntegration(String lastFile ,String newFile,String zipString) { + String lastFileReName = fileNcFolder + "/" + lastFile ; + if (StringUtils.isNotBlank(zipString)) { + lastFileReName = lastFileReName + "." + zipString; + newFile = newFile + "." + zipString; + } + FileChannel in = null; + FileChannel out = null; + try{ + in = new FileInputStream(lastFileReName).getChannel(); + out = new FileOutputStream(newFile, true).getChannel(); + out.transferFrom(in, 0, in.size()); + in.close(); + out.close(); + return true; + } + catch (IOException e) { + e.printStackTrace(); + return false; + } finally { + try { + in.close(); + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + } + + + + + /** + * 娴嬭瘯 鏇存崲鍚嶅瓧 + * @param lastFile + * @param newFile + * @param + * @return + */ + public static boolean copyFileUpName(String lastFile ,String newFile,String fixFileName,String ncFix) { + String lastFileReName = fileNcFolder + "/" + lastFile ; + if (StringUtils.isNotBlank(fixFileName)) { + lastFileReName = lastFileReName + "." + fixFileName; + newFile = newFile + "." + ncFix; + } + try { + long begintime = System.currentTimeMillis(); // 鑾峰彇鎷疯礉鏂囦欢鍓嶇殑绯荤粺鏃堕棿 + + Files.copy(Paths.get(lastFileReName), + Paths.get(newFile), + StandardCopyOption.REPLACE_EXISTING); + //鏂规硶浜� + /*// 鍒涘缓涓�涓甫缂撳啿鍖虹殑杈撳叆娴� + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(lastFileReName)); + // 鍒涘缓涓�涓甫缂撳啿鍖虹殑杈撳嚭娴� + BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(newFile)); + + // 瀹氫箟涓�涓瓧鑺傛暟缁勶紝浣滀负缂撳啿鍖� + byte[] buff = new byte[1024]; + long begintime = System.currentTimeMillis(); // 鑾峰彇鎷疯礉鏂囦欢鍓嶇殑绯荤粺鏃堕棿 + int len; + while ((len = bis.read(buff)) != -1) { + bos.write(buff, 0, len); // 浠庣涓�涓瓧鑺傚紑濮嬶紝鍚戞枃浠跺啓鍏en涓瓧鑺� + } + + + bis.close(); + bos.close(); */ + long endtime = System.currentTimeMillis(); // 鑾峰彇鏂囦欢鎷疯礉缁撴潫鏃剁殑绯荤粺鏃堕棿 + System.out.println("鎷疯礉鏂囦欢鎵�娑堣�楃殑鏃堕棿鏄細" + (endtime - begintime) + "姣"); + return true; + } + catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public static String fileSizeNC(String lastFile,String fileName){ + String absolutePathSend = fileUploadFolder + "/" + lastFile + "/" + fileName; + File file = new File(absolutePathSend); + if (!file.exists()) { + return "0"; + } + return String.valueOf(file.length()); + } + + /*浜у搧鏍戝埌璁惧鏍� NC*/ + public static boolean copyFileNc(String lastFile ,String newFile, String fileName,String newFileName,String zipString) { + String absolutePathSend = fileUploadFolder + "/" + lastFile + "/" + fileName; + //鍒ゆ柇鏂囦欢澶规槸鍚﹀瓨鍦� + File file = new File(fileNcFolder + "/" + newFile + "/send/"); + if (!file.exists()) { + file.mkdirs(); + } + String abNewFileReName = fileNcFolder + "/" + newFile + "/send/" + newFileName ; + if (StringUtils.isNotBlank(zipString)) { + abNewFileReName = abNewFileReName + "." + zipString; + } + String zip = fileNcFolder + "/" + newFile + "/send/" + newFileName + "/"; + try{ + FileChannel in = new FileInputStream(absolutePathSend).getChannel(); + FileChannel out = new FileOutputStream(abNewFileReName, true).getChannel(); + out.transferFrom(in, 0, in.size()); + if (zipString.equals("zip")) { + try { + FileZipUtil.unZipFiles(abNewFileReName,zip); + } catch (Exception e) { + e.printStackTrace(); + } + } + in.close(); + out.close(); + return true; + } + catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + + public static void compressFolder(File folder, String zipFilePath) throws IOException { + ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFilePath)); + compressFolder(folder, folder.getName(), zipOut); + zipOut.close(); + } + + private static void compressFolder(File folder, String parentFolder, ZipOutputStream zipOut) throws IOException { + if (folder.isFile()) { + String filePath = folder.getPath(); + String entryPath = filePath.substring(parentFolder.length() + 1); + ZipEntry zipEntry = new ZipEntry(entryPath); + zipOut.putNextEntry(zipEntry); + FileInputStream fileIn = new FileInputStream(filePath); + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = fileIn.read(buffer)) != -1) { + zipOut.write(buffer, 0, bytesRead); + } + fileIn.close(); + zipOut.closeEntry(); + } else { + for (File file : folder.listFiles()) { + compressFolder(file, parentFolder, zipOut); + } + } + } + /*浜у搧鏍戝埌璁惧鏍� NC*/ + public static boolean copyFileNcToBak(String newFile, String newFileName,String fixFileName) { + String stringDate = DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_STRING); + String absolutePathSend = null,abNewFileReName= null; + absolutePathSend = fileNcFolder + "/" + newFile + "/send/" + newFileName ; + abNewFileReName = fileNcFolder + "/" + newFile + "/send_bak/" + "/" +stringDate+ "/" + newFileName + "_" + DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_FULL) ; + if (StringUtils.isNotBlank(fixFileName) ) { + if(!fixFileName.equals("zip")) { + absolutePathSend = absolutePathSend + "." + fixFileName ; + abNewFileReName = abNewFileReName + "." + fixFileName ; + } else { + copyFileBakZip(new File(absolutePathSend),new File(abNewFileReName)); + return true; + } + } + File targetFile = new File(abNewFileReName); + if(!targetFile.getParentFile().exists()){ + targetFile.getParentFile().mkdirs(); + } + try{ + FileChannel in = new FileInputStream(absolutePathSend).getChannel(); + FileChannel out = new FileOutputStream(abNewFileReName, true).getChannel(); + out.transferFrom(in, 0, in.size()); + in.close(); + out.close(); + return true; + } + catch (IOException e) { + e.printStackTrace(); + return false; + } + + } + + public static Boolean deletePathNameFile(File file) { + //鍒ゆ柇鏂囦欢涓嶄负null鎴栨枃浠剁洰褰曞瓨鍦� + if (file == null || !file.exists()) { + System.out.println("鏂囦欢鍒犻櫎澶辫触,璇锋鏌ユ枃浠舵槸鍚﹀瓨鍦ㄤ互鍙婃枃浠惰矾寰勬槸鍚︽纭�"); + return false; + } + //鑾峰彇鐩綍涓嬪瓙鏂囦欢 + File[] files = file.listFiles(); + //閬嶅巻璇ョ洰褰曚笅鐨勬枃浠跺璞� + for (File f : files) { + //鍒ゆ柇瀛愮洰褰曟槸鍚﹀瓨鍦ㄥ瓙鐩綍,濡傛灉鏄枃浠跺垯鍒犻櫎 + if (f.isDirectory()) { + //閫掑綊鍒犻櫎鐩綍涓嬬殑鏂囦欢 + deletePathNameFile(f); + } else { + //鏂囦欢鍒犻櫎 + f.delete(); + //鎵撳嵃鏂囦欢鍚� + System.out.println("鏂囦欢鍚嶏細" + f.getName()); + } + } + //鏂囦欢澶瑰垹闄� + file.delete(); + return true; + } + + + public static Boolean deleteZipFromToSend(String newFile,String newFileName,String zipString) { + String abNewFileReName = fileNcFolder + "/" + newFile + "/send/" + newFileName ; + if (StringUtils.isNotBlank(zipString)) { + if (zipString.equals("zip")) { + abNewFileReName = abNewFileReName + "." + zipString; + return fileRecDelete(abNewFileReName); + } + } + return true; + } + + public static Boolean deleteFilePathZip(String newFile,String newFileName,String zipString) { + String abNewFileReName = fileNcFolder + "/" + newFile + "/send/" + newFileName ; + //鍒嗙被 + if (StringUtils.isNotBlank(zipString)) { + //鏈夐棶棰� + if (zipString.equals("zip")) { + String stringDate = DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_STRING); + String abNewFileReNameBak = fileNcFolder + "/" + newFile + "/send_bak/" + "/" +stringDate+ "/" + newFileName + "_" + + DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_FULL) ; + copyFileBakZip(new File(abNewFileReName),new File(abNewFileReNameBak)); + return deleteFile(new File(abNewFileReName)); + } + abNewFileReName = abNewFileReName + "." + zipString; + } + copyFileNcToBak(newFile,newFileName,zipString); + return fileRecDelete(abNewFileReName); + } + + public static void copyFileBakZip(File file, File target) { + target = new File(target, file.getName()); + if (!target.exists()) { + target.mkdirs(); + } + if (file.isDirectory()) { + File[] files = file.listFiles(); + for (File f : files) { + if (f.isDirectory()) { + copyFileBakZip(f, target); + } + else { + copyFileDeleteZip(f, target); + } + } + } else { + copyFileDeleteZip(file, target); + } + } + + public static void copyFileDeleteZip(File file, File directory) { + try { + FileInputStream input = new FileInputStream(file); + FileOutputStream output = new FileOutputStream(new File(directory, file.getName())); + byte[] buff = new byte[8192]; + int len = -1; + while ((len = input.read(buff)) > -1) { + output.write(buff); + } + input.close(); + output.close(); + } catch (Exception e) { + + } + } + + + //鏀瑰悕 + public static FileUploadResult uploadFileUpdateFileName(MultipartFile file,String fileName ,String suffix) { + if(file == null || file.isEmpty()) + return null; + Date currentDate = DateUtil.getNow(); + String monthStr = DateUtil.format(currentDate, DateUtil.STR_YEAR_MONTH); + //鐩稿璺緞 + String relativePath = "/" + monthStr + "/" + DateUtil.getDayStr(currentDate) + "/"; + //缁濆璺緞 + String absolutePath = fileUploadFolder + "/" + monthStr + "/" + DateUtil.getDayStr(currentDate) + "/"; + String fileNameNonSuffix = getFilenameNonSuffix(fileName); + if(fileNameNonSuffix == null) + return null; + String encodeFileName = SHA256Util.getSHA256Str(fileNameNonSuffix + System.currentTimeMillis()); + Long fileSize = file.getSize(); + boolean b = uploadFile(file, absolutePath, encodeFileName); + if(!b) + return null; + FileUploadResult dto = new FileUploadResult(); + dto.setFileName(fileNameNonSuffix); + dto.setFileEncodeName(encodeFileName); + dto.setFilePath(relativePath); + dto.setFileSize(fileSize); + dto.setFileSuffix(suffix); + return dto; + } + + public static boolean deleteFileNewRec(String filePath) { + boolean flag = false; + File file = new File(filePath); + if (!file.exists()) { + return flag; + } + boolean b = file.delete(); + if (!b) { + try { + System.gc(); + Path path = Paths.get(filePath); + Files.deleteIfExists(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + return true; + } + + + public static FileUploadResult uploadFile(MultipartFile file) { + if(file == null || file.isEmpty()) + return null; + String fileName = file.getOriginalFilename(); + String suffix = getFileSuffix(fileName); +// if(StringUtils.isBlank(suffix)) +// return null; + Date currentDate = DateUtil.getNow(); + String monthStr = DateUtil.format(currentDate, DateUtil.STR_YEAR_MONTH); + //鐩稿璺緞 + String relativePath = "/" + monthStr + "/" + DateUtil.getDayStr(currentDate) + "/"; + //缁濆璺緞 + String absolutePath = fileUploadFolder + "/" + monthStr + "/" + DateUtil.getDayStr(currentDate) + "/"; + String fileNameNonSuffix = getFilenameNonSuffix(fileName); + if(fileNameNonSuffix == null) + return null; + String encodeFileName = SHA256Util.getSHA256Str(fileNameNonSuffix + System.currentTimeMillis()); + Long fileSize = file.getSize(); + boolean b = uploadFile(file, absolutePath, encodeFileName); + if(!b) + return null; + FileUploadResult dto = new FileUploadResult(); + dto.setFileName(fileNameNonSuffix); + dto.setFileEncodeName(encodeFileName); + dto.setFilePath(relativePath); + dto.setFileSize(fileSize); + dto.setFileSuffix(suffix); + return dto; + } + + public static void downLoadFile(HttpServletResponse response, String fileName, String filePath, String toFileName) { + String absolutePath = fileUploadFolder + filePath; + File file = new File(absolutePath , fileName); + if(file.exists()) { + byte[] buffer = new byte[1024]; + FileInputStream fis = null; + BufferedInputStream bis = null; + try { + response.setHeader("Content-Type", "application/octet-stream;charset=utf-8"); // 鍛婅瘔娴忚鍣ㄨ緭鍑哄唴瀹逛负娴� + //response.setHeader("Content-Disposition", "attachment;fileName="+ new String(toFileName.getBytes("UTF-8"),"ISO-8859-1")); + response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(toFileName, "UTF-8")); + fis = new FileInputStream(file); + bis = new BufferedInputStream(fis); + OutputStream os = response.getOutputStream(); + int i = bis.read(buffer); + while (i != -1) { + os.write(buffer, 0, i); + i = bis.read(buffer); + } + }catch (Exception e) { + log.error(e.getMessage(), e.getStackTrace()); + }finally { + if(bis != null) { + try { + bis.close(); + } catch (IOException e) { + } + } + if(fis != null) { + try { + fis.close(); + } catch (IOException e) { + } + } + } + }else { + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + } + } + /** + * 涓婁紶鏂囦欢宸ュ叿绫� + * @param multipartFile + * @param path + * @param fileNewName 鏂扮殑鏂囦欢鍚� + * @return + */ + public static boolean uploadFile(MultipartFile multipartFile, String path, String fileNewName) { + File targetFile = new File(path, fileNewName); + if(!targetFile.getParentFile().exists()){ + targetFile.getParentFile().mkdirs(); + } + try { + multipartFile.transferTo(targetFile); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e.getStackTrace()); + return false; + } + } + + /** + /** + * 鑾峰彇鏂囦欢鍚庣紑 鏃犲悗缂�鏂囦欢杩斿洖NULL + * @param fileName + * @return + */ + public static String getFileSuffix(String fileName) { + if (fileName.contains(".")) { + String suffix = fileName.substring(fileName.lastIndexOf('.') + 1); + return suffix; + }else { + return null; + } + + } + + /** + * 鑾峰彇鏂囦欢鍚� 涓嶅甫鍚庣紑鍜岀偣鍙� + * @param fileName + * @return + */ + public static String getFilenameNonSuffix(String fileName) { + if (fileName.contains(".")) { + String filename = fileName.substring(0, fileName.lastIndexOf('.')); + return filename; + }else { + return fileName; + } + + } + + public static List<String> readFile(String fileEncodeName, String filePath) { + String absolutePath = fileUploadFolder + filePath; + File file = new File(absolutePath , fileEncodeName); + if(!file.exists() || file.isDirectory()) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + String charset = checkFileEncode(file); + if(charset == null) + ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NOT_EXIST); + List<String> readList = new ArrayList<>(); + String tempString = null; + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset)); + while ((tempString = reader.readLine()) != null) { + readList.add(tempString); + } + if(readList.isEmpty()) + return null; + return readList; + } catch (Exception e) { + log.error(e.getMessage(), e.getStackTrace()); + return null; + } finally { + if(reader != null) { + try { + reader.close(); + } catch (IOException e) { + log.error(e.getMessage(), e.getStackTrace()); + } + } + } + } + + private static String checkFileEncode(File file) { + String charset = "GBK"; + byte[] first3Bytes = new byte[3]; + BufferedInputStream bis = null; + try { + boolean checked = false; + bis = new BufferedInputStream(new FileInputStream(file)); + bis.mark(0); + int read = bis.read(first3Bytes, 0, 3); + if (read == -1) + return charset; + if(first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE ) { + charset = "UTF-16LE"; + checked = true; + }else if ( first3Bytes[0] == (byte) 0xFE && first3Bytes[1] == (byte) 0xFF ) { + charset = "UTF-16BE"; + checked = true; + }else if (first3Bytes[0] == (byte) 0xEF && first3Bytes[1] == (byte) 0xBB && first3Bytes[2] == (byte) 0xBF ) { + charset = "UTF-8"; + checked = true; + } + bis.reset(); + if (!checked) { + while ((read = bis.read()) != -1 ) { + if ( read >= 0xF0 ) + break; + if ( 0x80 <= read && read <= 0xBF ) // 鍗曠嫭鍑虹幇BF浠ヤ笅鐨勶紝涔熺畻鏄疓BK + break; + if ( 0xC0 <= read && read <= 0xDF ) { + read = bis.read(); + if ( 0x80 <= read && read <= 0xBF ) // 鍙屽瓧鑺� (0xC0 - 0xDF) (0x80 - 0xBF),涔熷彲鑳藉湪GBK缂栫爜鍐吢犅� + continue; + else + break; + } else if ( 0xE0 <= read && read <= 0xEF ) { + // 涔熸湁鍙兘鍑洪敊锛屼絾鏄嚑鐜囪緝灏� + read = bis.read(); + if ( 0x80 <= read && read <= 0xBF ) { + read = bis.read(); + if ( 0x80 <= read && read <= 0xBF ) { + charset = "UTF-8"; + break; + } else + break; + } else { + break; + } + } + } + } + return charset; + }catch (Exception e) { + return null; + }finally { + if(bis != null) { + try { + bis.close(); + } catch (IOException e) { + } + } + } + + } + + public static String changeFileFormat(String flow) { + BigDecimal flows = new BigDecimal(flow); + if (flows.compareTo(new BigDecimal(0)) > 0 && flows.compareTo(new BigDecimal(1024)) < 0) {//灏忎簬1M + return flows.toString() + "B"; + } else if(flows.compareTo(new BigDecimal(1024)) >= 0 && flows.compareTo(new BigDecimal(1048576)) < 0){ + BigDecimal result = flows.divide(new BigDecimal(1024),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "KB"; + } else if(flows.compareTo(new BigDecimal(1048576)) >= 0 && flows.compareTo(new BigDecimal(1073741824)) < 0){ + BigDecimal result = flows.divide(new BigDecimal(1048576),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "MB"; + } else if(flows.compareTo(new BigDecimal(1073741824)) >= 0 && flows.compareTo(new BigDecimal("1099511627776")) < 0){ + BigDecimal result = flows.divide(new BigDecimal(1073741824),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "GB"; + } else if(flows.compareTo(new BigDecimal("1099511627776")) >= 0 && flows.compareTo(new BigDecimal("1125899906842624")) < 0){ + BigDecimal result = flows.divide(new BigDecimal("1099511627776"),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "TB"; + } else if(flows.compareTo(new BigDecimal("1125899906842624")) >= 0){ + BigDecimal result = flows.divide(new BigDecimal("1125899906842624"),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "PB"; + }else { + return "0"; + } + } + + + public static String changeFileFormatKb(String flow) { + BigDecimal flows = new BigDecimal(flow); + if (flows.compareTo(new BigDecimal(0)) > 0 && flows.compareTo(new BigDecimal(1024)) < 0) {//灏忎簬1M + return flows.toString() + "B"; + } else if(flows.compareTo(new BigDecimal(1024)) >= 0){ + BigDecimal result = flows.divide(new BigDecimal(1024),2,BigDecimal.ROUND_HALF_UP); + return result.toString() + "KB"; + } else { + return "0"; + } + } + + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileZipUtil.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileZipUtil.java new file mode 100644 index 0000000..8030d70 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/FileZipUtil.java @@ -0,0 +1,95 @@ +package org.jeecg.modules.dnc.utils.file; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +/** + * @author clown + * * @date 2023/10/20 + */ +public class FileZipUtil { + /** + * zip鏂囦欢瑙e帇 + * @param inputFile 寰呰В鍘嬫枃浠跺す/鏂囦欢 + * @param destDirPath 瑙e帇璺緞 + */ + public static void unZipFiles(String inputFile,String destDirPath) throws Exception { + File srcFile = new File(inputFile);//鑾峰彇褰撳墠鍘嬬缉鏂囦欢 + // 鍒ゆ柇婧愭枃浠舵槸鍚﹀瓨鍦� + if (!srcFile.exists()) { + throw new Exception(srcFile.getPath() + "鎵�鎸囨枃浠朵笉瀛樺湪"); + } + ZipFile zipFile = new ZipFile(srcFile, Charset.forName("GBK"));//鍒涘缓鍘嬬缉鏂囦欢瀵硅薄 + //寮�濮嬭В鍘� + Enumeration<?> entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = (ZipEntry) entries.nextElement(); + // 濡傛灉鏄枃浠跺す锛屽氨鍒涘缓涓枃浠跺す + if (entry.isDirectory()) { + String dirPath = destDirPath + "/" + entry.getName(); + srcFile.mkdirs(); + } else { + // 濡傛灉鏄枃浠讹紝灏卞厛鍒涘缓涓�涓枃浠讹紝鐒跺悗鐢╥o娴佹妸鍐呭copy杩囧幓 + File targetFile = new File(destDirPath + "/" + entry.getName()); + // 淇濊瘉杩欎釜鏂囦欢鐨勭埗鏂囦欢澶瑰繀椤昏瀛樺湪 + if (!targetFile.getParentFile().exists()) { + targetFile.getParentFile().mkdirs(); + } + targetFile.createNewFile(); + // 灏嗗帇缂╂枃浠跺唴瀹瑰啓鍏ュ埌杩欎釜鏂囦欢涓� + InputStream is = zipFile.getInputStream(entry); + FileOutputStream fos = new FileOutputStream(targetFile); + int len; + byte[] buf = new byte[1024]; + while ((len = is.read(buf)) != -1) { + fos.write(buf, 0, len); + } + // 鍏虫祦椤哄簭锛屽厛鎵撳紑鐨勫悗鍏抽棴 + fos.close(); + is.close(); + } + } + } + + /** + * 鍒犻櫎鏂囦欢 + * + * @param filePath + * @return + */ + public static boolean deleteFile(String filePath) { + boolean flag = false; + File file = new File(filePath); + if (!file.exists()) { + return flag; + } + if (!file.isDirectory()) { + return flag; + } + String[] tempList = file.list(); + File temp; + for (int i = 0; i < tempList.length; i++) { + if (filePath.endsWith(File.separator)) { + temp = new File(filePath + tempList[i]); + } else { + temp = new File(filePath + File.separator + tempList[i]); + } + if (temp.isFile()) { + temp.delete(); + } + if (temp.isDirectory()) { + // 鍏堝垹闄ゆ枃浠跺す閲岄潰鐨勬枃浠� + deleteFile(filePath + "/" + tempList[i]); + // 鍐嶅垹闄ょ┖鏂囦欢澶� + deleteFile(filePath + "/" + tempList[i]); + flag = true; + } + } + return flag; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/SM3Util.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/SM3Util.java new file mode 100644 index 0000000..66c6aa5 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/utils/file/SM3Util.java @@ -0,0 +1,133 @@ +package org.jeecg.modules.dnc.utils.file; + + +import org.bouncycastle.crypto.digests.SM3Digest; +import org.bouncycastle.crypto.macs.HMac; +import org.bouncycastle.crypto.params.KeyParameter; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; + +import java.io.UnsupportedEncodingException; +import java.security.Security; +import java.util.Arrays; + +/** + * @author clown + * * @date 2023/11/23 + */ +public class SM3Util { + private static final String ENCODING = "UTF-8"; + static { + Security.addProvider(new BouncyCastleProvider()); + } + + /** + * sm3绠楁硶鍔犲瘑 + * @explain + * @param paramStr + * 寰呭姞瀵嗗瓧绗︿覆 + * @return 杩斿洖鍔犲瘑鍚庯紝鍥哄畾闀垮害=32鐨�16杩涘埗瀛楃涓� + */ + public static String encrypt(String paramStr){ + // 灏嗚繑鍥炵殑hash鍊艰浆鎹㈡垚16杩涘埗瀛楃涓� + String resultHexString = ""; + try { + // 灏嗗瓧绗︿覆杞崲鎴恇yte鏁扮粍 + byte[] srcData = paramStr.getBytes(ENCODING); + // 璋冪敤hash() + byte[] resultHash = hash(srcData); + // 灏嗚繑鍥炵殑hash鍊艰浆鎹㈡垚16杩涘埗瀛楃涓� + resultHexString = ByteUtils.toHexString(resultHash); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return resultHexString; + } + + /** + * 杩斿洖闀垮害=32鐨刡yte鏁扮粍 + * @explain 鐢熸垚瀵瑰簲鐨刪ash鍊� + * @param srcData + * @return + */ + public static byte[] hash(byte[] srcData) { + SM3Digest digest = new SM3Digest(); + //update the message digest with a single byte. + digest.update(srcData, 0, srcData.length); + byte[] hash = new byte[digest.getDigestSize()]; + //close the digest, producing the final digest value. + digest.doFinal(hash, 0); + return hash; + } + /** + * sm3绠楁硶鍔犲瘑 + * @explain + * @param paramStr + * 寰呭姞瀵嗗瓧绗︿覆 + * @param key + * 瀵嗛挜 + * @return 杩斿洖鍔犲瘑鍚庯紝鍥哄畾闀垮害=32鐨�16杩涘埗瀛楃涓� + */ + public static String encryptPlus(String paramStr,String key){ + // 灏嗚繑鍥炵殑hash鍊艰浆鎹㈡垚16杩涘埗瀛楃涓� + String resultHexString = ""; + try { + // 灏嗗瓧绗︿覆杞崲鎴恇yte鏁扮粍 + byte[] srcData = paramStr.getBytes(ENCODING); + // 璋冪敤hash() + byte[] resultHash = hmac(srcData,key.getBytes(ENCODING)); + // 灏嗚繑鍥炵殑hash鍊艰浆鎹㈡垚16杩涘埗瀛楃涓� + resultHexString = ByteUtils.toHexString(resultHash); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return resultHexString; + } + + /** + * 閫氳繃瀵嗛挜杩涜鍔犲瘑 + * @explain 鎸囧畾瀵嗛挜杩涜鍔犲瘑 + * @param key + * 瀵嗛挜 + * @param srcData + * 琚姞瀵嗙殑byte鏁扮粍 + * @return + */ + public static byte[] hmac(byte[] key, byte[] srcData) { + KeyParameter keyParameter = new KeyParameter(key); + SM3Digest digest = new SM3Digest(); + HMac mac = new HMac(digest); + mac.init(keyParameter); + mac.update(srcData, 0, srcData.length); + byte[] result = new byte[mac.getMacSize()]; + mac.doFinal(result, 0); + return result; + } + + /** + * 鍒ゆ柇婧愭暟鎹笌鍔犲瘑鏁版嵁鏄惁涓�鑷� + * @explain 閫氳繃楠岃瘉鍘熸暟缁勫拰鐢熸垚鐨刪ash鏁扮粍鏄惁涓哄悓涓�鏁扮粍锛岄獙璇�2鑰呮槸鍚︿负鍚屼竴鏁版嵁 + * @param srcStr + * 鍘熷瓧绗︿覆 + * @param sm3HexString + * 16杩涘埗瀛楃涓� + * @return 鏍¢獙缁撴灉 + */ + public static boolean verify(String srcStr, String sm3HexString) { + boolean flag = false; + try { + //浣跨敤鎸囧畾鐨勫瓧绗﹂泦灏嗗瓧绗︿覆缂栫爜涓� byte 搴忓垪锛屽苟灏嗙粨鏋滃瓨鍌ㄥ埌涓�涓柊鐨� byte 鏁扮粍涓� + byte[] srcData = srcStr.getBytes(ENCODING); + //16杩涘埗 --> byte[] + byte[] sm3Hash = ByteUtils.fromHexString(sm3HexString); + byte[] newHash = hash(srcData); + //鍒ゆ柇鏁扮粍鏄惁鐩哥瓑 + if (Arrays.equals(newHash, sm3Hash)) { + flag = true; + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return flag; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/lxzn/modules/dnc/TestController.java b/lxzn-module-dnc/src/main/java/org/lxzn/modules/dnc/TestController.java deleted file mode 100644 index 1509a6d..0000000 --- a/lxzn-module-dnc/src/main/java/org/lxzn/modules/dnc/TestController.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.lxzn.modules.dnc; - -/** - * @author Lius - * @date 2025/1/3 9:29 - */ -public class TestController { -} diff --git a/lxzn-module-system/lxzn-system-start/pom.xml b/lxzn-module-system/lxzn-system-start/pom.xml index f09da3b..8291eb6 100644 --- a/lxzn-module-system/lxzn-system-start/pom.xml +++ b/lxzn-module-system/lxzn-system-start/pom.xml @@ -10,7 +10,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>lxzn-system-start</artifactId> - + <dependencies> <!-- SYSTEM 绯荤粺绠$悊妯″潡 --> <dependency> @@ -24,6 +24,20 @@ <artifactId>lxzn-module-mdc</artifactId> <version>${jeecgboot.version}</version> </dependency> + <!-- DNC 鏁版嵁閲囬泦鍒嗘瀽妯″潡 --> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-module-dnc</artifactId> + <version>${jeecgboot.version}</version> + </dependency> + <!-- activiti 妯″潡 --> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-module-activiti</artifactId> + <version>${jeecgboot.version}</version> + </dependency> + + </dependencies> <build> @@ -35,4 +49,4 @@ </plugins> </build> -</project> \ No newline at end of file +</project> diff --git a/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java b/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java index 01335dc..10dacec 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java +++ b/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java @@ -1,9 +1,12 @@ package org.jeecg; import lombok.extern.slf4j.Slf4j; +import org.activiti.spring.boot.SecurityAutoConfiguration; import org.jeecg.common.util.oConvertUtils; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ConfigurableApplicationContext; @@ -17,7 +20,9 @@ * 鎶ラ敊鎻愰啋: 鏈泦鎴恗ongo鎶ラ敊锛屽彲浠ユ墦寮�鍚姩绫讳笂闈㈢殑娉ㄩ噴 exclude={MongoAutoConfiguration.class} */ @Slf4j -@SpringBootApplication +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class, + SecurityAutoConfiguration.class, + ManagementWebSecurityAutoConfiguration.class}) //@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class}) public class JeecgSystemApplication extends SpringBootServletInitializer { @@ -41,4 +46,4 @@ } -} \ No newline at end of file +} diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml index 74c38c3..481e2df 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml @@ -136,6 +136,22 @@ host: 127.0.0.1 port: 6379 password: 123456 + activiti: + #1.flase锛氶粯璁ゅ�笺�俛ctiviti鍦ㄥ惎鍔ㄦ椂锛屽姣旀暟鎹簱琛ㄤ腑淇濆瓨鐨勭増鏈紝濡傛灉娌℃湁琛ㄦ垨鑰呯増鏈笉鍖归厤锛屽皢鎶涘嚭寮傚父 + #2.true锛� activiti浼氬鏁版嵁搴撲腑鎵�鏈夎〃杩涜鏇存柊鎿嶄綔銆傚鏋滆〃涓嶅瓨鍦紝鍒欒嚜鍔ㄥ垱寤� + #3.create_drop锛� 鍦╝ctiviti鍚姩鏃跺垱寤鸿〃锛屽湪鍏抽棴鏃跺垹闄よ〃锛堝繀椤绘墜鍔ㄥ叧闂紩鎿庯紝鎵嶈兘鍒犻櫎琛級 + #4.drop-create锛� 鍦╝ctiviti鍚姩鏃跺垹闄ゅ師鏉ョ殑鏃ц〃锛岀劧鍚庡湪鍒涘缓鏂拌〃锛堜笉闇�瑕佹墜鍔ㄥ叧闂紩鎿庯級 + database-schema-update: true + # 妫�娴嬪巻鍙蹭俊鎭〃鏄惁瀛樺湪锛宎ctiviti7榛樿涓嶇敓鎴愬巻鍙蹭俊鎭〃锛屽紑鍚巻鍙茶〃 + db-history-used: true + # 鍘嗗彶璁板綍瀛樺偍绛夌骇 + history-level: full + check-process-definitions: true + #鍦ㄦ祦绋嬪紩鎿庡惎鍔ㄥ氨婵�娲籄syncExecutor,寮傛 true false 鍏抽棴 锛堝垏璁板叧闂級 + async-executor-activate: false + async-executor-enabled: true +activiti: + enable: false # true 鍚敤瀹℃壒 false 涓嶅惎鐢ㄥ鎵� #mybatis plus 璁剧疆 mybatis-plus: mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml @@ -290,4 +306,42 @@ url: http://localhost:8081/services/EquipmentService?wsdl namespace: http://service.server.webservice.example.com statusMethod: equipmentStatus - rateMethod: equipmentRate \ No newline at end of file + rateMethod: equipmentRate +securedoc: #鍥尯缃戜笌缃戦椄閫氳瀹㈡埛绔� + whether: true #鏄惁鍚敤 true / false + serverIp: 10.118.10.63 #鏁版嵁鏈嶅姟绔疘P + serverPort: 8399 #鏁版嵁鏈嶅姟绔帴鍙� + # serverIp: 127.0.0.1 #鏁版嵁鏈嶅姟绔疘P + # serverPort: 8399 #鏁版嵁鏈嶅姟绔帴鍙� + username: admin #瀹氫箟璐﹀彿 + pwd: 123 #瀹氫箟瀵嗙爜 + addressToken: /outer/appAuth #鏈嶅姟娈佃幏鍙杢oken鍦板潃 + addressUploadFile: /outer/fileUpload #鏈嶅姟娈典笂浼犲湴鍧� + localFilePath: E:\\test\\a #鎺ユ敹鍦板潃 + servicePath: E:\\test\\b #鍙戦�佸湴鍧� + copyFilePath: E:\\test\\bak_a #鏂囦欢澶囦唤鍦板潃 + # localFilePath: /jar/test/a/ #鎺ユ敹鍦板潃 + # servicePath: /jar/test/b/ #鍙戦�佸湴鍧� + # copyFilePath: /jar/test/bak_a/ #鏂囦欢澶囦唤鍦板潃 + logIp: 127.0.0.1 #鏃ュ織绯荤粺鍦板潃 + logPort: 8888 #鏃ュ織绯荤粺绔彛 +serviceIntranet: #鍥尯缃戜笌缃戦椄閫氳鏈嶅姟娈� + # filePath: E:\\test\\b #闆嗘垚瀹㈡埛绔繚瀛樺湴鍧� + # newFilePath: E:/test/bak_sql/ #鏂囦欢澶囦唤鍦板潃 + filePath: /jar/test/b/ #闆嗘垚瀹㈡埛绔繚瀛樺湴鍧� + newFilePath: /jar/test/bak_sql/ #鏂囦欢澶囦唤鍦板潃 + appIdCheck: admin #token 鐢ㄦ埛鍚� + passwordCheck: 123 #token 瀵嗙爜 + logIp: 127.0.0.1 + logPort: 8888 + clientIp: 127.0.0.1 #瀹㈡埛绔疘P +fileNumPath: D:/demo/fileNum.txt #椤哄簭鍙疯褰曞湴鍧� +#鏂囦欢涓婁紶鐩綍锛堟敞鎰廘inux鍜學indows涓婄殑鐩綍缁撴瀯涓嶅悓锛� +#file.uploadFolder=/root/uploadFiles/ +#fileHomePath: ${UPLOAD_FOLDER:/jar/lxzn_storage} +#fileNCPath: ${NC_FOLDER:/jar/NC} # NC鏂囦欢浣嶇疆 +fileHomePath: ${UPLOAD_FOLDER:d://lxzn_storage} +fileNCPath: ${NC_FOLDER:D://NC} # NC鏂囦欢浣嶇疆 +ncSend: + addOrDelete: false #//鏄惁鍒犻櫎seed 涓殑涔嬪墠鏂囦欢 +#staticAccessPath: /api/ffile/** # 褰撳墠椤圭洰鐨勯潤鎬佽祫婧愯闂厤缃湪nginx涓� diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/processes/assign_nc_to_device.bpmn b/lxzn-module-system/lxzn-system-start/src/main/resources/processes/assign_nc_to_device.bpmn new file mode 100644 index 0000000..87fa824 --- /dev/null +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/processes/assign_nc_to_device.bpmn @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1589077876043" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema"> + <process id="assign_nc_to_device" isClosed="false" isExecutable="true" name="鎸囨淳NC鏂囨。鍒拌澶�" processType="None"> + <startEvent id="_2" name="StartEvent"/> + <userTask activiti:assignee="${apply_user}" activiti:exclusive="true" id="_3" name="鎻愪氦鐢宠"/> + <userTask activiti:candidateUsers="${approve_users}" activiti:exclusive="true" id="_4" name="瀹℃壒"/> + <endEvent id="_5" name="EndEvent"/> + <sequenceFlow id="_6" sourceRef="_2" targetRef="_3"/> + <sequenceFlow id="_7" sourceRef="_3" targetRef="_4"/> + <sequenceFlow id="_8" sourceRef="_4" targetRef="_5"/> + </process> + <bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram"> + <bpmndi:BPMNPlane bpmnElement="assign_nc_to_device"> + <bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2"> + <omgdc:Bounds height="32.0" width="32.0" x="40.0" y="135.0"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3"> + <omgdc:Bounds height="55.0" width="85.0" x="145.0" y="125.0"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="_4" id="Shape-_4"> + <omgdc:Bounds height="55.0" width="85.0" x="335.0" y="125.0"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="_5" id="Shape-_5"> + <omgdc:Bounds height="32.0" width="32.0" x="545.0" y="135.0"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="_2" targetElement="_3"> + <omgdi:waypoint x="72.0" y="151.0"/> + <omgdi:waypoint x="145.0" y="152.5"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="_7" id="BPMNEdge__7" sourceElement="_3" targetElement="_4"> + <omgdi:waypoint x="230.0" y="152.5"/> + <omgdi:waypoint x="335.0" y="152.5"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="_4" targetElement="_5"> + <omgdi:waypoint x="420.0" y="152.5"/> + <omgdi:waypoint x="545.0" y="151.0"/> + <bpmndi:BPMNLabel> + <omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</definitions> -- Gitblit v1.9.3