From 3bd5690369703dbd2ae31ced8691a70e307a0fd4 Mon Sep 17 00:00:00 2001 From: zhourui Date: Thu, 2 Jul 2020 16:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4teamwork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- o2server/pom.xml | 14 + o2server/x_teamwork_assemble_control/pom.xml | 129 -- .../x/teamwork/assemble/control/Business.java | 353 ----- .../assemble/control/MimeTypeDefinition.java | 7 - .../factory/CustomExtFieldReleFactory.java | 150 --- .../control/factory/PriorityFactory.java | 105 -- .../control/factory/ProjectConfigFactory.java | 230 ---- .../control/factory/ProjectFactory.java | 289 ----- .../factory/ProjectTemplateFactory.java | 278 ---- .../control/factory/StatisticFactory.java | 184 --- .../factory/TaskListTemplateFactory.java | 270 ---- .../control/jaxrs/ActionApplication.java | 49 - .../control/jaxrs/JaxrsManagerUserFilter.java | 25 - .../control/jaxrs/chat/ActionCreate.java | 219 ---- .../control/jaxrs/extfield/ActionDelete.java | 120 -- .../control/jaxrs/extfield/ActionGet.java | 85 -- .../ActionGetNextUseableExtFieldName.java | 81 -- .../extfield/ActionListAllExtFields.java | 33 - .../extfield/ActionListWithCorrelation.java | 80 -- .../jaxrs/extfield/ActionListWithType.java | 80 -- .../control/jaxrs/extfield/ActionSave.java | 290 ----- .../control/jaxrs/extfield/BaseAction.java | 30 - .../extfield/CustomExtFieldReleAction.java | 167 --- ...xtFieldReleFlagForQueryEmptyException.java | 12 - .../CustomExtFieldReleNotExistsException.java | 12 - .../CustomExtFieldRelePersistException.java | 20 - .../CustomExtFieldReleQueryException.java | 20 - .../extfield/TaskNotExistsException.java | 12 - .../jaxrs/global/ActionInitConfig.java | 73 -- .../control/jaxrs/global/ActionIsManager.java | 39 - ...ActionListProjectConfigNextWithFilter.java | 140 -- .../jaxrs/global/ActionPriorityDelete.java | 80 -- .../jaxrs/global/ActionPriorityGet.java | 78 -- .../jaxrs/global/ActionPriorityList.java | 70 - .../jaxrs/global/ActionPrioritySave.java | 61 - .../global/ActionProjectConfigDelete.java | 70 - .../jaxrs/global/ActionProjectConfigGet.java | 79 -- .../ActionProjectConfigGetByProject.java | 83 -- .../jaxrs/global/ActionProjectConfigSave.java | 61 - .../control/jaxrs/global/BaseAction.java | 34 - .../control/jaxrs/global/GlobalAction.java | 245 ---- .../PriorityFlagForQueryEmptyException.java | 12 - .../global/PriorityNotExistsException.java | 12 - .../global/PriorityPersistException.java | 20 - .../jaxrs/global/PriorityQueryException.java | 16 - ...ojectConfigFlagForQueryEmptyException.java | 12 - .../ProjectConfigNotExistsException.java | 12 - .../global/ProjectConfigPersistException.java | 20 - .../global/ProjectConfigQueryException.java | 16 - .../global/WrapInQueryProjectConfig.java | 223 ---- .../jaxrs/list/ActionListWithTaskGroup.java | 160 --- .../control/jaxrs/list/BaseAction.java | 37 - .../control/jaxrs/project/ActionComplete.java | 92 -- .../jaxrs/project/ActionCreateable.java | 92 -- .../control/jaxrs/project/ActionGet.java | 230 ---- .../ActionListArchiveNextWithFilter.java | 190 --- .../ActionListCompletedNextWithFilter.java | 190 --- .../project/ActionListMyNextWithFilter.java | 190 --- .../ActionListNextInGroupWithFilter.java | 184 --- .../project/ActionListNextWithFilter.java | 213 ---- .../ActionListNoGroupNextWithFilter.java | 190 --- .../ActionListPageInGroupWithFilter.java | 180 --- .../project/ActionListPageWithFilter.java | 187 --- .../ActionListRecycleNextWithFilter.java | 185 --- .../project/ActionListStarNextWithFilter.java | 190 --- .../control/jaxrs/project/ActionRecovery.java | 74 -- .../control/jaxrs/project/ActionSave.java | 276 ---- .../project/ActionStatisticMyProjects.java | 280 ---- .../ActionStatisticMyProjectsGroups.java | 167 --- .../control/jaxrs/project/BaseAction.java | 35 - .../control/jaxrs/project/ProjectAction.java | 447 ------- .../control/jaxrs/project/WrapOutControl.java | 139 -- .../jaxrs/projectTemplate/ActionDelete.java | 122 -- .../jaxrs/projectTemplate/ActionGet.java | 161 --- .../jaxrs/projectTemplate/ActionList.java | 74 -- .../ActionListNextWithFilter.java | 173 --- .../ActionStatisticProjectTemplates.java | 220 ---- .../ProjectTemplateAction.java | 131 -- .../WrapInQueryProjectTemplate.java | 103 -- .../jaxrs/projectTemplate/WrapOutControl.java | 51 - .../statistics/ActionStatisticMyProjects.java | 272 ---- .../ActionStatisticTaskWithFilter.java | 132 -- .../control/jaxrs/statistics/BaseAction.java | 28 - .../statistics/ProjectQueryException.java | 16 - .../statistics/StatisticQueryException.java | 16 - .../jaxrs/statistics/StatisticsAction.java | 73 -- .../jaxrs/statistics/WrapInQueryTask.java | 139 -- .../control/jaxrs/task/ActionCopyTask.java | 216 ---- .../control/jaxrs/task/ActionGet.java | 474 ------- .../task/ActionListMyTaskWithTaskList.java | 219 ---- .../jaxrs/task/ActionListNextWithFilter.java | 252 ---- .../jaxrs/task/ActionListPageWithFilter.java | 248 ---- .../task/ActionListSubTaskWithTaskId.java | 153 --- .../jaxrs/task/ActionListWithTaskList.java | 231 ---- .../control/jaxrs/task/ActionSave.java | 758 ----------- .../task/ActionUpdateSingleProperty.java | 428 ------- .../task/ActionViewAllListNextWithFilter.java | 426 ------- ...ActionViewCompletedListNextWithFilter.java | 425 ------- .../ActionViewMyExecutListNextWithFilter.java | 426 ------- .../ActionViewOverTimeListNextWithFilter.java | 425 ------- ...tionViewUncompletedListNextWithFilter.java | 426 ------- .../control/jaxrs/task/BaseAction.java | 74 -- .../jaxrs/taskListTemplate/ActionList.java | 83 -- .../service/BatchOperationProcessService.java | 242 ---- .../CustomExtFieldRelePersistService.java | 90 -- .../CustomExtFieldReleQueryService.java | 141 -- .../service/CustomExtFieldReleService.java | 173 --- .../service/DynamicPersistService.java | 896 ------------- .../control/service/DynamicService.java | 1133 ----------------- .../service/PriorityPersistService.java | 141 -- .../control/service/PriorityQueryService.java | 165 --- .../control/service/PriorityService.java | 219 ---- .../service/ProjectConfigPersistService.java | 140 -- .../service/ProjectConfigQueryService.java | 227 ---- .../control/service/ProjectConfigService.java | 280 ---- .../service/ProjectPersistService.java | 281 ---- .../control/service/ProjectQueryService.java | 367 ------ .../control/service/ProjectService.java | 297 ----- .../service/ProjectTemplateQueryService.java | 369 ------ .../service/ProjectTemplateService.java | 300 ----- .../control/service/ReviewService.java | 457 ------- .../service/StatisticQueryService.java | 615 --------- .../control/service/TaskListService.java | 293 ----- .../service/TaskListTemplateService.java | 302 ----- .../control/service/TaskPersistService.java | 640 ---------- .../control/x_teamwork_assemble_control.java | 18 - .../src/main/webapp/WEB-INF/web.xml | 1 - o2server/x_teamwork_core_entity/pom.xml | 111 -- .../com/x/teamwork/core/entity/Config.java | 129 -- .../core/entity/CustomExtFieldRele.java | 184 --- .../core/entity/PersistenceProperties.java | 128 -- .../com/x/teamwork/core/entity/Priority.java | 129 -- .../com/x/teamwork/core/entity/Project.java | 504 -------- .../x/teamwork/core/entity/ProjectConfig.java | 250 ---- .../teamwork/core/entity/ProjectTemplate.java | 194 --- .../com/x/teamwork/core/entity/Review.java | 559 -------- .../java/com/x/teamwork/core/entity/Task.java | 532 -------- .../core/entity/tools/CustomExtField.java | 37 - 138 files changed, 14 insertions(+), 26233 deletions(-) delete mode 100644 o2server/x_teamwork_assemble_control/pom.xml delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/Business.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/MimeTypeDefinition.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/CustomExtFieldReleFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/PriorityFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectConfigFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectTemplateFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/StatisticFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListTemplateFactory.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/ActionApplication.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/JaxrsManagerUserFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/chat/ActionCreate.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionDelete.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGetNextUseableExtFieldName.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListAllExtFields.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithCorrelation.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithType.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionSave.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleFlagForQueryEmptyException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleNotExistsException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldRelePersistException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleQueryException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/TaskNotExistsException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionInitConfig.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionIsManager.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionListProjectConfigNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityDelete.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityList.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPrioritySave.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigDelete.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGetByProject.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigSave.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/GlobalAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityFlagForQueryEmptyException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityNotExistsException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityPersistException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityQueryException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigFlagForQueryEmptyException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigNotExistsException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigPersistException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigQueryException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/WrapInQueryProjectConfig.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/ActionListWithTaskGroup.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionComplete.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionCreateable.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListArchiveNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListCompletedNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListMyNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextInGroupWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNoGroupNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageInGroupWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListRecycleNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListStarNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionRecovery.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionSave.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjects.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjectsGroups.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ProjectAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/WrapOutControl.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionDelete.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionList.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionStatisticProjectTemplates.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ProjectTemplateAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapInQueryProjectTemplate.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapOutControl.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticMyProjects.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticTaskWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ProjectQueryException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticQueryException.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticsAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/WrapInQueryTask.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionCopyTask.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListMyTaskWithTaskList.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListPageWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListSubTaskWithTaskId.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListWithTaskList.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionUpdateSingleProperty.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewAllListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewCompletedListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewMyExecutListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewOverTimeListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewUncompletedListNextWithFilter.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/taskListTemplate/ActionList.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldRelePersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityPersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigPersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectPersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/StatisticQueryService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListTemplateService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/x_teamwork_assemble_control.java delete mode 100644 o2server/x_teamwork_assemble_control/src/main/webapp/WEB-INF/web.xml delete mode 100644 o2server/x_teamwork_core_entity/pom.xml delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Config.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/CustomExtFieldRele.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/PersistenceProperties.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Priority.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Project.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectConfig.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectTemplate.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Review.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Task.java delete mode 100644 o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/tools/CustomExtField.java diff --git a/o2server/pom.xml b/o2server/pom.xml index c42a5b26d8..72f0fda664 100644 --- a/o2server/pom.xml +++ b/o2server/pom.xml @@ -320,6 +320,20 @@ ${project.artifactId} + + maven-clean-plugin + 3.1.0 + + + + ${basedir} + + **/*_.java + + + + + org.codehaus.mojo exec-maven-plugin diff --git a/o2server/x_teamwork_assemble_control/pom.xml b/o2server/x_teamwork_assemble_control/pom.xml deleted file mode 100644 index fa88239dc8..0000000000 --- a/o2server/x_teamwork_assemble_control/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - 4.0.0 - - o2oa - o2server - 5 - - x_teamwork_assemble_control - war - - - o2oa - x_base_core_project - - - o2oa - x_organization_core_entity - - - o2oa - x_organization_core_express - - - o2oa - x_teamwork_core_entity - - - - - - org.codehaus.mojo - exec-maven-plugin - - - describeBuilder - prepare-package - - java - - - true - true - true - com.x.base.core.project.annotation.DescribeBuilder - - ${basedir} - ${project.build.sourceDirectory} - - - - - apiBuilder - prepare-package - - java - - - true - true - true - com.x.base.core.project.annotation.ApiBuilder - - ${basedir} - ${project.build.sourceDirectory} - - - - - checkAssemble - prepare-package - - java - - - true - true - true - com.x.base.core.project.build.CheckAssemble - - - - createWebXml - prepare-package - - java - - - true - true - true - com.x.base.core.project.build.CreateWebXml - - ${basedir} - ${project.artifactId} - - - - - - - maven-resources-plugin - - - copy-war - verify - - copy-resources - - - ../../o2server/custom - - - target - - ${project.artifactId}.war - - - - - - - - - - diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/Business.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/Business.java deleted file mode 100644 index e031fa28ff..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/Business.java +++ /dev/null @@ -1,353 +0,0 @@ -package com.x.teamwork.assemble.control; - -import java.util.List; - -import com.x.base.core.project.tools.ListTools; -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.project.http.EffectivePerson; -import com.x.organization.core.express.Organization; -import com.x.teamwork.assemble.control.factory.AttachmentFactory; -import com.x.teamwork.assemble.control.factory.BatchOperationFactory; -import com.x.teamwork.assemble.control.factory.ChatFactory; -import com.x.teamwork.assemble.control.factory.DynamicFactory; -import com.x.teamwork.assemble.control.factory.PriorityFactory; -import com.x.teamwork.assemble.control.factory.ProjectConfigFactory; -import com.x.teamwork.assemble.control.factory.CustomExtFieldReleFactory; -import com.x.teamwork.assemble.control.factory.ProjectFactory; -import com.x.teamwork.assemble.control.factory.ProjectGroupFactory; -import com.x.teamwork.assemble.control.factory.ProjectGroupReleFactory; -import com.x.teamwork.assemble.control.factory.ProjectTemplateFactory; -import com.x.teamwork.assemble.control.factory.ReviewFactory; -import com.x.teamwork.assemble.control.factory.SystemConfigFactory; -import com.x.teamwork.assemble.control.factory.TaskFactory; -import com.x.teamwork.assemble.control.factory.TaskGroupFactory; -import com.x.teamwork.assemble.control.factory.TaskGroupReleFactory; -import com.x.teamwork.assemble.control.factory.TaskListFactory; -import com.x.teamwork.assemble.control.factory.TaskListTemplateFactory; -import com.x.teamwork.assemble.control.factory.TaskTagFactory; -import com.x.teamwork.assemble.control.factory.TaskViewFactory; - -public class Business { - - private EntityManagerContainer emc; - - public Business(EntityManagerContainer emc) throws Exception { - this.emc = emc; - } - public EntityManagerContainer entityManagerContainer() { - return this.emc; - } - - private Organization organization; - private ProjectFactory projectFactory; - private TaskFactory taskFactory; - private ProjectTemplateFactory projectTemplateFactory; - private TaskListTemplateFactory taskListTemplateFactory; - private DynamicFactory dynamicFactory; - private SystemConfigFactory systemConfigFactory; - private ProjectGroupFactory projectGroupFactory; - private ProjectGroupReleFactory projectGroupReleFactory; - private TaskListFactory taskListFactory; - private ChatFactory chatFactory; - private TaskGroupFactory taskGroupFactory; - private TaskGroupReleFactory taskGroupReleFactory; - private TaskViewFactory taskViewFactory; - private CustomExtFieldReleFactory customExtFieldReleFactory; - private ReviewFactory reviewFactory; - private BatchOperationFactory batchOperationFactory; - private TaskTagFactory taskTagFactory; - private AttachmentFactory attachmentFactory; - private PriorityFactory priorityFactory; - private ProjectConfigFactory projectConfigFactory; - - public Organization organization() throws Exception { - if (null == this.organization) { - this.organization = new Organization(ThisApplication.context()); - } - return organization; - } - - /** - * 获取附件信息数据库访问类 - * @return - * @throws Exception - */ - public AttachmentFactory attachmentFactory() throws Exception { - if (null == this.attachmentFactory) { - this.attachmentFactory = new AttachmentFactory( this ); - } - return attachmentFactory; - } - - /** - * 获取工作任务标签数据库访问类 - * @return - * @throws Exception - */ - public TaskTagFactory taskTagFactory() throws Exception { - if (null == this.taskTagFactory) { - this.taskTagFactory = new TaskTagFactory( this ); - } - return taskTagFactory; - } - - /** - * 获取批处理任务数据库访问类 - * @return - * @throws Exception - */ - public BatchOperationFactory batchOperationFactory() throws Exception { - if (null == this.batchOperationFactory) { - this.batchOperationFactory = new BatchOperationFactory( this ); - } - return batchOperationFactory; - } - - /** - * 获取Review信息数据库访问类 - * @return - * @throws Exception - */ - public ReviewFactory reviewFactory() throws Exception { - if (null == this.reviewFactory) { - this.reviewFactory = new ReviewFactory( this ); - } - return reviewFactory; - } - - /** - * 获取项目扩展属性关联信息数据库访问类 - * @return - * @throws Exception - */ - public CustomExtFieldReleFactory customExtFieldReleFactory() throws Exception { - if (null == this.customExtFieldReleFactory) { - this.customExtFieldReleFactory = new CustomExtFieldReleFactory( this ); - } - return customExtFieldReleFactory; - } - - /** - * 获取任务视图数据库访问类 - * @return - * @throws Exception - */ - public TaskViewFactory taskViewFactory() throws Exception { - if (null == this.taskViewFactory) { - this.taskViewFactory = new TaskViewFactory( this ); - } - return taskViewFactory; - } - - /** - * 获取工作任务组关联信息数据库访问类 - * @return - * @throws Exception - */ - public TaskGroupReleFactory taskGroupReleFactory() throws Exception { - if (null == this.taskGroupReleFactory) { - this.taskGroupReleFactory = new TaskGroupReleFactory( this ); - } - return taskGroupReleFactory; - } - - /** - * 获取工作任务组数据库访问类 - * @return - * @throws Exception - */ - public TaskGroupFactory taskGroupFactory() throws Exception { - if (null == this.taskGroupFactory) { - this.taskGroupFactory = new TaskGroupFactory( this ); - } - return taskGroupFactory; - } - - /** - * 获取工作交流数据库访问类 - * @return - * @throws Exception - */ - public ChatFactory chatFactory() throws Exception { - if (null == this.chatFactory) { - this.chatFactory = new ChatFactory( this ); - } - return chatFactory; - } - - /** - * 获取工作任务列表数据库访问类 - * @return - * @throws Exception - */ - public TaskListFactory taskListFactory() throws Exception { - if (null == this.taskListFactory) { - this.taskListFactory = new TaskListFactory( this ); - } - return taskListFactory; - } - - /** - * 获取项目组数据库访问类 - * @return - * @throws Exception - */ - public ProjectGroupFactory projectGroupFactory() throws Exception { - if (null == this.projectGroupFactory) { - this.projectGroupFactory = new ProjectGroupFactory( this ); - } - return projectGroupFactory; - } - - /** - * 获取优先级数据库访问类 - * @return - * @throws Exception - */ - public ProjectConfigFactory projectConfigFactory() throws Exception { - if (null == this.projectConfigFactory) { - this.projectConfigFactory = new ProjectConfigFactory( this ); - } - return projectConfigFactory; - } - - /** - * 获取优先级数据库访问类 - * @return - * @throws Exception - */ - public PriorityFactory priorityFactory() throws Exception { - if (null == this.priorityFactory) { - this.priorityFactory = new PriorityFactory( this ); - } - return priorityFactory; - } - - /** - * 获取项目模板数据库访问类 - * @return - * @throws Exception - */ - public ProjectTemplateFactory projectTemplateFactory() throws Exception { - if (null == this.projectTemplateFactory) { - this.projectTemplateFactory = new ProjectTemplateFactory( this ); - } - return projectTemplateFactory; - } - - /** - * 获取项目模板对应的泳道数据库访问类 - * @return - * @throws Exception - */ - public TaskListTemplateFactory taskListTemplateFactory() throws Exception { - if (null == this.taskListTemplateFactory) { - this.taskListTemplateFactory = new TaskListTemplateFactory( this ); - } - return taskListTemplateFactory; - } - - /** - * 获取项目与项目组关联信息数据库访问类 - * @return - * @throws Exception - */ - public ProjectGroupReleFactory projectGroupReleFactory() throws Exception { - if (null == this.projectGroupReleFactory) { - this.projectGroupReleFactory = new ProjectGroupReleFactory( this ); - } - return projectGroupReleFactory; - } - - /** - * 获取系统配置信息数据库访问类 - * @return - * @throws Exception - */ - public SystemConfigFactory systemConfigFactory() throws Exception { - if (null == this.systemConfigFactory) { - this.systemConfigFactory = new SystemConfigFactory( this ); - } - return systemConfigFactory; - } - - /** - * 获取工作任务信息数据库访问类 - * @return - * @throws Exception - */ - public TaskFactory taskFactory() throws Exception { - if (null == this.taskFactory) { - this.taskFactory = new TaskFactory( this ); - } - return taskFactory; - } - - /** - * 获取项目信息数据库访问类 - * @return - * @throws Exception - */ - public ProjectFactory projectFactory() throws Exception { - if (null == this.projectFactory) { - this.projectFactory = new ProjectFactory( this ); - } - return projectFactory; - } - - /** - * 获取动态信息数据库访问类 - * @return - * @throws Exception - */ - public DynamicFactory dynamicFactory() throws Exception { - if (null == this.dynamicFactory) { - this.dynamicFactory = new DynamicFactory( this ); - } - return dynamicFactory; - } - - /** - * TODO 判断用户是否管理员权限 1、person.isManager() 2、xadmin 3、CRMManager - * - * @param request - * @param personName - * @return - * @throws Exception - */ - - public boolean isManager(EffectivePerson person) throws Exception { - // 如果用户的身份是平台的超级管理员,那么就是超级管理员权限 - if (person.isManager()) { - return true; - } - if ("xadmin".equalsIgnoreCase(person.getDistinguishedName())) { - return true; - } - if (isHasPlatformRole(person.getDistinguishedName(), "TeamWorkManager@TeamWorkManager@R")) { - return true; - } - return false; - } - - public boolean isHasPlatformRole(String personName, String roleName) throws Exception { - if (StringUtils.isEmpty(personName)) { - throw new Exception("personName is null!"); - } - if (StringUtils.isEmpty(roleName)) { - throw new Exception("roleName is null!"); - } - List roleList = null; - roleList = organization().role().listWithPerson(personName); - if (ListTools.isNotEmpty(roleList) ) { - if (roleList.stream().filter(r -> roleName.equalsIgnoreCase(r)).count() > 0) { - return true; - } - } else { - return false; - } - return false; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/MimeTypeDefinition.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/MimeTypeDefinition.java deleted file mode 100644 index 4fdb27448c..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/MimeTypeDefinition.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.x.teamwork.assemble.control; - -import javax.activation.MimetypesFileTypeMap; - -public class MimeTypeDefinition { - public static MimetypesFileTypeMap instance; -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/CustomExtFieldReleFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/CustomExtFieldReleFactory.java deleted file mode 100644 index f96a6e7fee..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/CustomExtFieldReleFactory.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.CustomExtFieldRele_; - - -public class CustomExtFieldReleFactory extends AbstractFactory { - - public CustomExtFieldReleFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的CustomExtFieldRele实体信息对象 - * @param id - * @return - * @throws Exception - */ - public CustomExtFieldRele get( String id ) throws Exception { - return this.entityManagerContainer().find( id, CustomExtFieldRele.class, ExceptionWhen.none ); - } - - /** - * 列示指定Id的CustomExtFieldRele实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list( List ids ) throws Exception { - if( ids == null || ids.size() == 0 ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(CustomExtFieldRele.class); - Root root = cq.from(CustomExtFieldRele.class); - Predicate p = root.get(CustomExtFieldRele_.id).in(ids); - cq.orderBy( cb.desc( root.get( CustomExtFieldRele_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 列示所有扩展属性信息列表 - * @return - * @throws Exception - */ - public List listAllFieldReleObj() throws Exception { - - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(CustomExtFieldRele.class); - Root root = cq.from(CustomExtFieldRele.class); - cq.orderBy( cb.asc( root.get( CustomExtFieldRele_.order ) ) ); - return em.createQuery(cq).getResultList(); - } - - /** - * 根据关联ID列示扩展属性信息列表 - * @param correlationId - * @return - * @throws Exception - */ - public List listFieldReleObjByCorrelation( String correlationId ) throws Exception { - if( StringUtils.isEmpty( correlationId ) ){ - throw new Exception("correlationId can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(CustomExtFieldRele.class); - Root root = cq.from(CustomExtFieldRele.class); - Predicate p = cb.equal( root.get(CustomExtFieldRele_.correlationId), correlationId ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据扩展属性类型列示扩展属性信息列表 - * @param type - * @return - * @throws Exception - */ - public List listFieldReleObjByType( String type ) throws Exception { - if( StringUtils.isEmpty( type ) ){ - throw new Exception("type can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(CustomExtFieldRele.class); - Root root = cq.from(CustomExtFieldRele.class); - Predicate p = cb.equal( root.get(CustomExtFieldRele_.type), type ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据关联ID列示扩展属性ID信息列表 - * @param correlationId - * @return - * @throws Exception - */ - public List listFieldReleIdsByCorrelation( String correlationId ) throws Exception { - if( StringUtils.isEmpty( correlationId ) ){ - throw new Exception("correlationId can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(CustomExtFieldRele.class); - Predicate p = cb.equal( root.get(CustomExtFieldRele_.correlationId), correlationId ); - cq.select( root.get(CustomExtFieldRele_.correlationId) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据扩展属性名以及关联ID获取一组关联信息 - * @param fieldName - * @param correlationId - * @return - * @throws Exception - */ - public List listWithFieldNameAndCorrelation( String fieldName, String correlationId ) throws Exception { - if( StringUtils.isEmpty( fieldName ) ){ - throw new Exception("fieldName can not be empty!"); - } - /*if( StringUtils.isEmpty( correlationId ) ){ - throw new Exception("correlationId can not be empty!"); - }*/ - EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(CustomExtFieldRele.class); - Root root = cq.from(CustomExtFieldRele.class); - Predicate p = cb.equal( root.get(CustomExtFieldRele_.extFieldName), fieldName ); - if( StringUtils.isNotEmpty( correlationId ) ){ - p = cb.and( p, cb.equal( root.get(CustomExtFieldRele_.correlationId), correlationId )); - } - return em.createQuery(cq.where(p)).getResultList(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/PriorityFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/PriorityFactory.java deleted file mode 100644 index 93031f5915..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/PriorityFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Priority_; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectGroup_; - - -public class PriorityFactory extends AbstractFactory { - - public PriorityFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的ProjectGroup实体信息对象 - * @param id - * @return - * @throws Exception - */ - public Priority get( String id ) throws Exception { - return this.entityManagerContainer().find( id, Priority.class, ExceptionWhen.none ); - } - - /** - * 获取指定name的优先级实体信息对象 - * @param name - * @return - * @throws Exception - */ - public List getByName( String name ) throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - Predicate p = cb.equal( root.get(Priority_.priority), name ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 列示指定Id的ProjectGroup实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List listPriority() throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - //Predicate p = cb.equal( root.get(Priority_.owner), person ); - cq.orderBy( cb.asc( root.get( Priority_.order ) ) ); - return em.createQuery(cq).getResultList(); - } - - /** - * 根据用户列示ProjectGroup实体信息列表 - * @param person - * @return - * @throws Exception - */ - public List listByPerson( String person ) throws Exception { - if( StringUtils.isEmpty( person ) ){ - throw new Exception("person can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(ProjectGroup.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(ProjectGroup.class); - Predicate p = cb.equal( root.get(ProjectGroup_.owner), person ); - cq.select( root.get(ProjectGroup_.id ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据用户列示Priority实体信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriorityByPerson( String person ) throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - //Predicate p = cb.equal( root.get(Priority_.owner), person ); - cq.orderBy( cb.desc( root.get( Priority_.order ) ) ); - return em.createQuery(cq).getResultList(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectConfigFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectConfigFactory.java deleted file mode 100644 index dafa572929..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectConfigFactory.java +++ /dev/null @@ -1,230 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Dynamic_; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Priority_; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectConfig_; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectGroup_; -import com.x.teamwork.core.entity.Project_; -import com.x.teamwork.core.entity.tools.CriteriaBuilderTools; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - - -public class ProjectConfigFactory extends AbstractFactory { - - public ProjectConfigFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的ProjectGroup实体信息对象 - * @param id - * @return - * @throws Exception - */ - public ProjectConfig get( String id ) throws Exception { - return this.entityManagerContainer().find( id, ProjectConfig.class, ExceptionWhen.none ); - } - - /** - * 获取指定name的优先级实体信息对象 - * @param name - * @return - * @throws Exception - */ - public List getByName( String name ) throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - Predicate p = cb.equal( root.get(Priority_.priority), name ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 列示指定Id的ProjectGroup实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List listPriority() throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - //Predicate p = cb.equal( root.get(Priority_.owner), person ); - cq.orderBy( cb.asc( root.get( Priority_.order ) ) ); - return em.createQuery(cq).getResultList(); - } - - /** - * 根据用户列示ProjectGroup实体信息列表 - * @param person - * @return - * @throws Exception - */ - public List listByPerson( String person ) throws Exception { - if( StringUtils.isEmpty( person ) ){ - throw new Exception("person can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(ProjectGroup.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(ProjectGroup.class); - Predicate p = cb.equal( root.get(ProjectGroup_.owner), person ); - cq.select( root.get(ProjectGroup_.id ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据用户列示Priority实体信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriorityByPerson( String person ) throws Exception { - EntityManager em = this.entityManagerContainer().get(Priority.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Priority.class); - Root root = cq.from(Priority.class); - //Predicate p = cb.equal( root.get(Priority_.owner), person ); - cq.orderBy( cb.desc( root.get( Priority_.order ) ) ); - return em.createQuery(cq).getResultList(); - } - - /** - * 根据条件查询所有符合条件的项目配置信息ID,项目配置信息不会很多 ,所以直接查询出来 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectConfigIds( Integer maxCount, String personName, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( ProjectConfig.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(ProjectConfig.class); - Predicate p_permission = null; - - - /*if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - }*/ - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( ProjectConfig_.class, cb, p_permission, root, queryFilter ); - cq.distinct(true).select( root.get(ProjectConfig_.id) ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( ProjectConfig.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(ProjectConfig.class); - Root root = cq.from(ProjectConfig.class); - Predicate p_permission = null; - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( ProjectConfig_.class, cb, p_permission, root, queryFilter ); - - Order orderWithField = CriteriaBuilderTools.getOrder(cb, root, ProjectConfig_.class, orderField, orderType); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, Object sequenceFieldValue, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( ProjectConfig.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(ProjectConfig.class); - Root root = cq.from(ProjectConfig.class); - Predicate p_permission = null; - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( ProjectConfig_.class, cb, p_permission, root, queryFilter ); - - if( sequenceFieldValue != null && StringUtils.isNotEmpty( sequenceFieldValue.toString() )) { - Predicate p_seq = cb.isNotNull( root.get( Dynamic_.sequence ) ); - if( "desc".equalsIgnoreCase( orderType )){ - p_seq = cb.and( p_seq, cb.lessThan( root.get( ProjectConfig_.sequence ), sequenceFieldValue.toString() )); - }else{ - p_seq = cb.and( p_seq, cb.greaterThan( root.get( ProjectConfig_.sequence ), sequenceFieldValue.toString() )); - } - p = cb.and( p, p_seq); - } - - Order orderWithField = CriteriaBuilderTools.getOrder( cb, root, ProjectConfig_.class, orderField, orderType ); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - System.out.println(">>>SQL:" + em.createQuery(cq.where(p)).setMaxResults( maxCount).toString() ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 获取指定name的优先级实体信息对象 - * @param name - * @return - * @throws Exception - */ - public List getProjectConfigByProject( String name ) throws Exception { - EntityManager em = this.entityManagerContainer().get(ProjectConfig.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(ProjectConfig.class); - Root root = cq.from(ProjectConfig.class); - Predicate p = cb.equal( root.get(ProjectConfig_.project), name ); - return em.createQuery(cq.where(p)).getResultList(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectFactory.java deleted file mode 100644 index cb2bff7ab7..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectFactory.java +++ /dev/null @@ -1,289 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Dynamic_; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.Project_; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.Task_; -import com.x.teamwork.core.entity.tools.CriteriaBuilderTools; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - - -public class ProjectFactory extends AbstractFactory { - - public ProjectFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的Project实体信息对象 - * @param id - * @return - * @throws Exception - */ - public Project get( String id ) throws Exception { - return this.entityManagerContainer().find( id, Project.class, ExceptionWhen.none ); - } - - public ProjectDetail getDetail(String id) throws Exception { - return this.entityManagerContainer().find( id, ProjectDetail.class, ExceptionWhen.none ); - } - - /** - * 列示指定Id的Project实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list( List ids ) throws Exception { - if( ids == null || ids.size() == 0 ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(Project.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p = root.get(Project_.id).in(ids); - cq.orderBy( cb.desc( root.get( Project_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - public List listAllProjectIds() throws Exception { - EntityManager em = this.entityManagerContainer().get(Project.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Project.class); - cq.select( root.get( Project_.id) ); - return em.createQuery(cq ).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息数量 - * @param personName - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public Long countWithFilter( String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Long.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - cq.select(cb.count(root)).where(p); - Long count = em.createQuery(cq).getSingleResult(); - return count; - } - - /** - * 根据条件查询符合条件的项目信息ID - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - - Order orderWithField = CriteriaBuilderTools.getOrder(cb, root, Project_.class, orderField, orderType); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID - * @param projectId - * @param deleted - * @return - * @throws Exception - */ - public List listAllTasks(String projectId, Boolean deleted) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Task.class); - Root root = cq.from(Task.class); - Predicate p = root.get(Task_.project).in(projectId); - p = cb.and( p, cb.isFalse( root.get(Task_.deleted ))); - - cq.orderBy( cb.desc( root.get( Task_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, Object sequenceFieldValue, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - - if( sequenceFieldValue != null && StringUtils.isNotEmpty( sequenceFieldValue.toString() )) { - Predicate p_seq = cb.isNotNull( root.get( Dynamic_.sequence ) ); - if( "desc".equalsIgnoreCase( orderType )){ - p_seq = cb.and( p_seq, cb.lessThan( root.get( Project_.sequence ), sequenceFieldValue.toString() )); - }else{ - p_seq = cb.and( p_seq, cb.greaterThan( root.get( Project_.sequence ), sequenceFieldValue.toString() )); - } - p = cb.and( p, p_seq); - } - - Order orderWithField = CriteriaBuilderTools.getOrder( cb, root, Project_.class, orderField, orderType ); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - System.out.println(">>>SQL:" + em.createQuery(cq.where(p)).setMaxResults( maxCount).toString() ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询所有符合条件的项目信息ID,项目信息不会很多 ,所以直接查询出来 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllViewableProjectIds( Integer maxCount, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - cq.distinct(true).select( root.get(Project_.id) ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectTemplateFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectTemplateFactory.java deleted file mode 100644 index f07add7b65..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ProjectTemplateFactory.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.base.core.project.tools.ListTools; -import com.x.organization.core.entity.PersonCard; -import com.x.organization.core.entity.PersonCard_; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Dynamic_; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.ProjectTemplate_; -import com.x.teamwork.core.entity.Project_; -import com.x.teamwork.core.entity.tools.CriteriaBuilderTools; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - - -public class ProjectTemplateFactory extends AbstractFactory { - - public ProjectTemplateFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的Project实体信息对象 - * @param id - * @return - * @throws Exception - */ - public ProjectTemplate get( String id ) throws Exception { - return this.entityManagerContainer().find( id, ProjectTemplate.class, ExceptionWhen.none ); - } - - public ProjectDetail getDetail(String id) throws Exception { - return this.entityManagerContainer().find( id, ProjectDetail.class, ExceptionWhen.none ); - } - - /** - * 列示指定Id的Project实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list( List ids ) throws Exception { - if( ids == null || ids.size() == 0 ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(Project.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p = root.get(Project_.id).in(ids); - cq.orderBy( cb.desc( root.get( Project_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - public List listAllProjectIds() throws Exception { - EntityManager em = this.entityManagerContainer().get(Project.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Project.class); - cq.select( root.get( Project_.id) ); - return em.createQuery(cq ).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息数量 - * @param personName - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public Long countWithFilter( String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Long.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - cq.select(cb.count(root)).where(p); - Long count = em.createQuery(cq).getSingleResult(); - return count; - } - - /** - * 根据条件查询符合条件的项目信息ID - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - - Order orderWithField = CriteriaBuilderTools.getOrder(cb, root, Project_.class, orderField, orderType); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, Object sequenceFieldValue, String orderField, String orderType, String personName, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( ProjectTemplate.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(ProjectTemplate.class); - Root root = cq.from(ProjectTemplate.class); - Predicate p_permission = null; - - /*if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - }*/ - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( ProjectTemplate_.class, cb, p_permission, root, queryFilter ); - - if( sequenceFieldValue != null && StringUtils.isNotEmpty( sequenceFieldValue.toString() )) { - Predicate p_seq = cb.isNotNull( root.get( Dynamic_.sequence ) ); - if( "desc".equalsIgnoreCase( orderType )){ - p_seq = cb.and( p_seq, cb.lessThan( root.get( ProjectTemplate_.sequence ), sequenceFieldValue.toString() )); - }else{ - p_seq = cb.and( p_seq, cb.greaterThan( root.get( ProjectTemplate_.sequence ), sequenceFieldValue.toString() )); - } - p = cb.and( p, p_seq); - } - - Order orderWithField = CriteriaBuilderTools.getOrder( cb, root, ProjectTemplate_.class, orderField, orderType ); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - System.out.println(">>>SQL:" + em.createQuery(cq.where(p)).setMaxResults( maxCount).toString() ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询所有符合条件的项目模板信息ID,项目信息不会很多 ,所以直接查询出来 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectTemplateIds( Integer maxCount, String personName, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( ProjectTemplate.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(ProjectTemplate.class); - Predicate p_permission = null; - - - /*if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( ProjectTemplate_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( ProjectTemplate_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( ProjectTemplate_.executor ), personName ) ); - }*/ - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( ProjectTemplate_.class, cb, p_permission, root, queryFilter ); - cq.distinct(true).select( root.get(ProjectTemplate_.id) ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 列示所有模板的分类信息 - * @param distinguishName - * @return - * @throws Exception - */ - public List fetchAllGroupType( String distinguishName ) throws Exception { - EntityManager em = this.entityManagerContainer().get(ProjectTemplate.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(ProjectTemplate.class); - Predicate p = cb.equal(root.get(ProjectTemplate_.deleted), false); - cq.select(root.get(ProjectTemplate_.type)).where(p).distinct(true); - return em.createQuery(cq).getResultList(); - } - - /** - * 根据模板类型列示模板信息 - * @param type - * @return - * @throws Exception - */ - public List ListProjectTemplateWithType( String type ) throws Exception { - EntityManager em = this.entityManagerContainer().get(ProjectTemplate.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(ProjectTemplate.class); - Root root = cq.from(ProjectTemplate.class); - Predicate p = cb.equal(root.get(ProjectTemplate_.deleted), false); - p = cb.and( p, cb.equal(root.get(ProjectTemplate_.type), type)); - return em.createQuery(cq.where(p)).getResultList(); - } - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/StatisticFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/StatisticFactory.java deleted file mode 100644 index 172a6d45f3..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/StatisticFactory.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.Task_; - - -public class StatisticFactory extends AbstractFactory { - - public StatisticFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的Task实体信息对象 - * @param id - * @return - * @throws Exception - */ - public Task get( String id ) throws Exception { - return this.entityManagerContainer().find( id, Task.class, ExceptionWhen.none ); - } - - /** - * 获取指定Id的TaskDetail实体信息对象 - * @param id - * @return - * @throws Exception - */ - public TaskDetail getDetail( String id ) throws Exception { - return this.entityManagerContainer().find( id, TaskDetail.class, ExceptionWhen.none ); - } - - /** - * 列示指定Id的Task实体信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list( List ids ) throws Exception { - if( ids == null || ids.size() == 0 ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Task.class); - Root root = cq.from(Task.class); - Predicate p = root.get(Task_.id).in(ids); - cq.orderBy( cb.asc( root.get( Task_.createTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据类别列示Task实体ID信息列表 - * @param application - * @return - * @throws Exception - */ - public List listByProject( String projectId ) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get(Task_.project), projectId ); - cq.select( root.get(Task_.id ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据类别列示Task实体ID信息列表 - * @param projectId - * @return - * @throws Exception - */ - public List listAllTasksByProject( String projectId ) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Task.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get(Task_.project), projectId ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 查询未review的工作任务信息 - * @param maxCount - * @return - * @throws Exception - */ - public List listUnReviewTask(int maxCount) throws Exception { - if( maxCount == 0 ){ - maxCount = 100; - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Task.class); - Root root = cq.from(Task.class); - Predicate p = cb.or( cb.isNull(root.get(Task_.reviewed )), cb.isFalse( root.get(Task_.reviewed ))); - cq.orderBy( cb.asc( root.get( Task_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - - /** - * 根据类别列示Task实体信息列表 - * @param application - * @return - * @throws Exception - */ - public List listByParent( String pid) throws Exception { - if( StringUtils.isEmpty( pid ) ){ - throw new Exception("projectId can not be empty!"); - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get(Task_.parent), pid ); - cq.select( root.get(Task_.id ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息数量 - * @param projectId - * @return - * @throws Exception - */ - public Long countWithProject( String projectId ) throws Exception { - EntityManager em = this.entityManagerContainer().get( Task.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Long.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get( Task_.project), projectId ); - cq.select(cb.count(root)).where(p); - return em.createQuery(cq).getSingleResult(); - } - - public List allUnCompletedSubTasks(String taskId) throws Exception { - if( StringUtils.isEmpty( taskId ) ){ - return null; - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Task.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get( Task_.parent ), taskId ); - p = cb.and( p, cb.isFalse( root.get(Task_.completed ))); - return em.createQuery(cq.where(p)).getResultList(); - } - - public List listAllTaskIdsWithProject(String project) throws Exception { - if( StringUtils.isEmpty( project ) ){ - return null; - } - EntityManager em = this.entityManagerContainer().get(Task.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Task.class); - Predicate p = cb.equal( root.get( Task_.project ), project ); - cq.select( root.get(Task_.id ) ); - return em.createQuery(cq.where(p)).getResultList(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListTemplateFactory.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListTemplateFactory.java deleted file mode 100644 index b425878b1c..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListTemplateFactory.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.x.teamwork.assemble.control.factory; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.exception.ExceptionWhen; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.AbstractFactory; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Dynamic_; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.Project_; -import com.x.teamwork.core.entity.TaskListTemplate; -import com.x.teamwork.core.entity.TaskListTemplate_; -import com.x.teamwork.core.entity.Task_; -import com.x.teamwork.core.entity.tools.CriteriaBuilderTools; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - - -public class TaskListTemplateFactory extends AbstractFactory { - - public TaskListTemplateFactory( Business business ) throws Exception { - super(business); - } - - /** - * 获取指定Id的Project实体信息对象 - * @param id - * @return - * @throws Exception - */ - public TaskListTemplate get( String id ) throws Exception { - return this.entityManagerContainer().find( id, TaskListTemplate.class, ExceptionWhen.none ); - } - - public ProjectDetail getDetail(String id) throws Exception { - return this.entityManagerContainer().find( id, ProjectDetail.class, ExceptionWhen.none ); - } - - /** - * 列示指定ProjectTemplate Id的TaskListTemplate实体信息列表 - * @param id - * @return - * @throws Exception - */ - public List list( String id ) throws Exception { - if( StringUtils.isEmpty( id ) ){ - return new ArrayList(); - } - EntityManager em = this.entityManagerContainer().get(TaskListTemplate.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(TaskListTemplate.class); - Root root = cq.from(TaskListTemplate.class); - Predicate p = cb.equal( root.get( TaskListTemplate_.projectTemplate ), id ); - p = cb.and( p, cb.isFalse( root.get(TaskListTemplate_.deleted))); - cq.orderBy( cb.desc( root.get( TaskListTemplate_.updateTime ) ) ); - return em.createQuery(cq.where(p)).getResultList(); - } - - public List listAllProjectIds() throws Exception { - EntityManager em = this.entityManagerContainer().get(Project.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Project.class); - cq.select( root.get( Project_.id) ); - return em.createQuery(cq ).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息数量 - * @param personName - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public Long countWithFilter( String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Long.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - cq.select(cb.count(root)).where(p); - Long count = em.createQuery(cq).getSingleResult(); - return count; - } - - /** - * 根据条件查询符合条件的项目信息ID - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - - Order orderWithField = CriteriaBuilderTools.getOrder(cb, root, Project_.class, orderField, orderType); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( Integer maxCount, Object sequenceFieldValue, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Project.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - - if( sequenceFieldValue != null && StringUtils.isNotEmpty( sequenceFieldValue.toString() )) { - Predicate p_seq = cb.isNotNull( root.get( Dynamic_.sequence ) ); - if( "desc".equalsIgnoreCase( orderType )){ - p_seq = cb.and( p_seq, cb.lessThan( root.get( Project_.sequence ), sequenceFieldValue.toString() )); - }else{ - p_seq = cb.and( p_seq, cb.greaterThan( root.get( Project_.sequence ), sequenceFieldValue.toString() )); - } - p = cb.and( p, p_seq); - } - - Order orderWithField = CriteriaBuilderTools.getOrder( cb, root, Project_.class, orderField, orderType ); - if( orderWithField != null ){ - cq.orderBy( orderWithField ); - } - System.out.println(">>>SQL:" + em.createQuery(cq.where(p)).setMaxResults( maxCount).toString() ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - /** - * 根据条件查询所有符合条件的项目信息ID,项目信息不会很多 ,所以直接查询出来 - * @param maxCount - * @param sequenceFieldValue - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllViewableProjectIds( Integer maxCount, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - EntityManager em = this.entityManagerContainer().get( Project.class ); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(String.class); - Root root = cq.from(Project.class); - Predicate p_permission = null; - - - if( StringUtils.isNotEmpty( personName )) { - //可以管理的栏目,肯定可以发布信息 - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.participantPersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.isMember( personName, root.get( Project_.manageablePersonList )) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.creatorPerson ), personName ) ); - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, cb.equal( root.get( Project_.executor ), personName ) ); - } - if( ListTools.isNotEmpty( identityNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantIdentityList).in(identityNames)); - } - if( ListTools.isNotEmpty( unitNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantUnitList).in(unitNames)); - } - if( ListTools.isNotEmpty( groupNames )) { - p_permission = CriteriaBuilderTools.predicate_or( cb, p_permission, root.get( Project_.participantGroupList).in(groupNames)); - } - - Predicate p = CriteriaBuilderTools.composePredicateWithQueryFilter( Project_.class, cb, p_permission, root, queryFilter ); - cq.distinct(true).select( root.get(Project_.id) ); - return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList(); - } - - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/ActionApplication.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/ActionApplication.java deleted file mode 100644 index a5199f458f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/ActionApplication.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs; - -import java.util.Set; - -import javax.ws.rs.ApplicationPath; - -import com.x.base.core.project.jaxrs.AbstractActionApplication; -import com.x.teamwork.assemble.control.jaxrs.attachment.AttachmentAction; -import com.x.teamwork.assemble.control.jaxrs.chat.ChatAction; -import com.x.teamwork.assemble.control.jaxrs.config.SystemConfigAction; -import com.x.teamwork.assemble.control.jaxrs.dynamic.DynamicAction; -import com.x.teamwork.assemble.control.jaxrs.extfield.CustomExtFieldReleAction; -import com.x.teamwork.assemble.control.jaxrs.global.GlobalAction; -import com.x.teamwork.assemble.control.jaxrs.list.TaskListAction; -import com.x.teamwork.assemble.control.jaxrs.project.ProjectAction; -import com.x.teamwork.assemble.control.jaxrs.projectTemplate.ProjectTemplateAction; -import com.x.teamwork.assemble.control.jaxrs.projectgroup.ProjectGroupAction; -import com.x.teamwork.assemble.control.jaxrs.task.TaskAction; -import com.x.teamwork.assemble.control.jaxrs.taskListTemplate.TaskListTemplateAction; -import com.x.teamwork.assemble.control.jaxrs.taskgroup.TaskGroupAction; -import com.x.teamwork.assemble.control.jaxrs.tasktag.TaskTagAction; -import com.x.teamwork.assemble.control.jaxrs.taskview.TaskViewAction; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -@ApplicationPath("jaxrs") -public class ActionApplication extends AbstractActionApplication { - - public Set> getClasses() { - - this.classes.add( ProjectAction.class ); - this.classes.add( TaskAction.class ); - this.classes.add( TaskTagAction.class ); - this.classes.add( TaskViewAction.class ); - this.classes.add( AttachmentAction.class ); - this.classes.add( ProjectGroupAction.class ); - this.classes.add( TaskGroupAction.class ); - this.classes.add( TaskListAction.class ); - this.classes.add( DynamicAction.class ); - this.classes.add( ChatAction.class ); - this.classes.add( SystemConfigAction.class ); - this.classes.add( CustomExtFieldReleAction.class ); - this.classes.add( ProjectTemplateAction.class ); - this.classes.add( TaskListTemplateAction.class ); - this.classes.add( GlobalAction.class ); - this.classes.add( CustomExtFieldRele.class ); - return this.classes; - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/JaxrsManagerUserFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/JaxrsManagerUserFilter.java deleted file mode 100644 index 108e13de16..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/JaxrsManagerUserFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs; - -import javax.servlet.annotation.WebFilter; - -import com.x.base.core.project.jaxrs.ManagerUserJaxrsFilter; - -@WebFilter(urlPatterns = { - "/jaxrs/project/*", - "/jaxrs/chat/*", - "/jaxrs/task/*", - "/jaxrs/task_tag/*", - "/jaxrs/task_view/*", - "/jaxrs/attachment/*", - "/jaxrs/project_group/*", - "/jaxrs/projectTemplate/*", - "/jaxrs/taskListTemplate/*", - "/jaxrs/task_group/*", - "/jaxrs/task_list/*", - "/jaxrs/config/*", - "/jaxrs/extfield/*", - "/jaxrs/global/*", - "/jaxrs/dynamic/*" - }, asyncSupported = true) -public class JaxrsManagerUserFilter extends ManagerUserJaxrsFilter { -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/chat/ActionCreate.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/chat/ActionCreate.java deleted file mode 100644 index 6cbe98d25c..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/chat/ActionCreate.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.chat; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.assemble.control.service.MessageFactory; -import com.x.teamwork.core.entity.Chat; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Task; - -public class ActionCreate extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionCreate.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Chat chat = null; - Task task = null; - Wi wi = null; - Wo wo = new Wo(); - Boolean check = true; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - chat = Wi.copier.copy( wi ); - } catch (Exception e) { - check = false; - Exception exception = new ChatPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( wi.getTaskId() )) { - check = false; - Exception exception = new TaskIDEmptyException(); - result.error(exception); - } - } - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( wi.getContent() )) { - check = false; - Exception exception = new ChatContentEmptyException(); - result.error(exception); - } - } - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( wi.getSender() )) { - chat.setSender( effectivePerson.getDistinguishedName() ); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - task = taskQueryService.get( wi.getTaskId() ); - if ( task == null) { - check = false; - Exception exception = new TaskNotExistsException( wi.getTaskId() ); - result.error( exception ); - }else { - chat.setProjectId( task.getProject() ); - chat.setProjectTitle( task.getProjectName() ); - chat.setTaskTitle( task.getName() ); - chat.setTarget(effectivePerson.getDistinguishedName()); - } - } catch (Exception e) { - check = false; - Exception exception = new ChatPersistException(e, "根据ID查询工作任务信息对象时发生异常。ID:" + wi.getTaskId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - String lobContent = wi.getContent(); - if( wi.getContent().length() > 70 ) { - chat.setIsLob( true ); - chat.setContent( wi.getContent().substring(0, 70) + "..."); - } - - chat = chatPersistService.create( effectivePerson, chat, lobContent ); - - // 更新缓存 - ApplicationCache.notify( Chat.class ); - - wo.setId( chat.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new ChatPersistException(e, "工作评论信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - MessageFactory.message_to_chat( chat ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - Dynamic dynamic = dynamicPersistService.chatPublishDynamic( chat, effectivePerson, jsonElement.toString() ); - if( dynamic != null ) { - List dynamics = new ArrayList<>(); - dynamics.add( WoDynamic.copier.copy( dynamic ) ); - if( wo != null ) { - wo.setDynamics(dynamics); - } - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wi { - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, Chat.class, null, null ); - - @FieldDescribe("所属工作ID,必填") - private String taskId = null; - - @FieldDescribe("交流内容,必填" ) - private String content = null; - - @FieldDescribe("发送者,非必填") - private String sender = null; - - @FieldDescribe("目标者,非必填") - private String target = null; - - public String getTaskId() { - return taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionDelete.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionDelete.java deleted file mode 100644 index 80c4ac83a8..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionDelete.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -public class ActionDelete extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionDelete.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - CustomExtFieldRele customExtFieldRele = null; - Wo wo = new Wo(); - Boolean check = true; - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new CustomExtFieldReleFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - customExtFieldRele = customExtFieldReleQueryService.get(flag); - if ( customExtFieldRele == null) { - check = false; - Exception exception = new CustomExtFieldReleNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException(e, "根据指定flag查询扩展属性关联信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - customExtFieldRelePersistService.delete(flag, effectivePerson ); - - // 更新缓存 - ApplicationCache.notify( CustomExtFieldRele.class ); - - wo.setId( customExtFieldRele.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException(e, "根据指定flag删除扩展属性关联信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - if( Boolean.TRUE.equals( check ) ){ - try { - Dynamic dynamic = dynamicPersistService.projectExtFieldReleDeleteDynamic( customExtFieldRele, effectivePerson); - if( dynamic != null ) { - List dynamics = new ArrayList<>(); - dynamics.add( WoDynamic.copier.copy( dynamic ) ); - if( wo != null ) { - wo.setDynamics(dynamics); - } - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGet.java deleted file mode 100644 index 2804f2c039..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGet.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -import net.sf.ehcache.Element; - -public class ActionGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - CustomExtFieldRele customExtFieldRele = null; - Boolean check = true; - - if ( StringUtils.isEmpty( id ) ) { - check = false; - Exception exception = new CustomExtFieldReleFlagForQueryEmptyException(); - result.error( exception ); - } - - String cacheKey = ApplicationCache.concreteCacheKey( "CustomExtFieldRele.Get." + id ); - Element element = customExtFieldReleCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - - } else { - if( Boolean.TRUE.equals( check ) ){ - try { - customExtFieldRele = customExtFieldReleQueryService.get(id); - if ( customExtFieldRele == null) { - check = false; - Exception exception = new CustomExtFieldReleNotExistsException(id); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException( e, "根据指定id查询扩展属性关联信息对象时发生异常。flag:" + id ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( customExtFieldRele ); - } catch (Exception e) { - Exception exception = new CustomExtFieldReleQueryException(e, "将查询出来的扩展属性关联信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - result.setData( wo ); - return result; - } - - public static class Wo extends CustomExtFieldRele { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( CustomExtFieldRele.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGetNextUseableExtFieldName.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGetNextUseableExtFieldName.java deleted file mode 100644 index 7e28590786..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionGetNextUseableExtFieldName.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Task; - -public class ActionGetNextUseableExtFieldName extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGetNextUseableExtFieldName.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String correlationId, String fieldType ) throws Exception { - ActionResult result = new ActionResult<>(); - Project project = null; - Task task = null; - Boolean check = true; - Wo wo = new Wo(); - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( correlationId )) { - check = false; - Exception exception = new CustomExtFieldReleFlagForQueryEmptyException(); - result.error( exception ); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( fieldType )) { - fieldType = "TEXT"; - } - } - - /*if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get( correlationId ); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException( correlationId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldRelePersistException(e, "根据指定flag查询应用项目信息对象时发生异常。flag:" + correlationId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - }*/ - - if( Boolean.TRUE.equals( check ) ){ - String fieldName = customExtFieldReleQueryService.getNextUseableExtFieldName( correlationId, fieldType ); - if( StringUtils.isNotEmpty( fieldName )) { - wo.setFieldName(fieldName); - }else { - Exception exception = new CustomExtFieldReleQueryException( "当前关联ID无可用扩展属性。" ); - result.error(exception); - } - } - - result.setData(wo); - return result; - } - - public static class Wo { - - private String fieldName = null; - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListAllExtFields.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListAllExtFields.java deleted file mode 100644 index 0bef4208c0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListAllExtFields.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.teamwork.core.entity.tools.FieldInfo; -import com.x.teamwork.core.entity.tools.CustomExtField; - -public class ActionListAllExtFields extends BaseAction { - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = new Wo(); - result.setData(wo); - return result; - } - - public static class Wo { - - private List fieldInfos = CustomExtField.listAllExtField(); - - public List getFieldInfos() { - return fieldInfos; - } - - public void setFieldInfos(List fieldInfos) { - this.fieldInfos = fieldInfos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithCorrelation.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithCorrelation.java deleted file mode 100644 index aca488a2bd..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithCorrelation.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -import net.sf.ehcache.Element; - -public class ActionListWithCorrelation extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListWithCorrelation.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, String correlationId ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List customExtFieldReles = null; - Boolean check = true; - - String cacheKey = ApplicationCache.concreteCacheKey( "ActionListWithCorrelation", correlationId, effectivePerson.getDistinguishedName() ); - Element element = customExtFieldReleCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wos = (List) element.getObjectValue(); - result.setData( wos ); - } else { - if( Boolean.TRUE.equals( check ) ){ - try { - customExtFieldReles = customExtFieldReleQueryService.listReleWithCorrelation(correlationId); - if( ListTools.isEmpty( customExtFieldReles )) { - customExtFieldReles = new ArrayList<>(); - } - wos = Wo.copier.copy( customExtFieldReles ); - SortTools.asc( wos, "createTime"); - customExtFieldReleCache.put(new Element(cacheKey, wos)); - result.setData(wos); - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException(e, "根据关联ID查询对应的扩展属性信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wo extends CustomExtFieldRele { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( CustomExtFieldRele.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithType.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithType.java deleted file mode 100644 index 4125afbe1e..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionListWithType.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -import net.sf.ehcache.Element; - -public class ActionListWithType extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListWithType.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, String type ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List customExtFieldReles = null; - Boolean check = true; - - String cacheKey = ApplicationCache.concreteCacheKey( "ActionListWithPublic", type, effectivePerson.getDistinguishedName() ); - Element element = customExtFieldReleCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wos = (List) element.getObjectValue(); - result.setData( wos ); - } else { - if( Boolean.TRUE.equals( check ) ){ - try { - customExtFieldReles = customExtFieldReleQueryService.listReleWithType(type); - if( ListTools.isEmpty( customExtFieldReles )) { - customExtFieldReles = new ArrayList<>(); - } - wos = Wo.copier.copy( customExtFieldReles ); - SortTools.asc( wos, "createTime"); - customExtFieldReleCache.put(new Element(cacheKey, wos)); - result.setData(wos); - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException(e, "根据关联ID查询对应的扩展属性信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wo extends CustomExtFieldRele { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( CustomExtFieldRele.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionSave.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionSave.java deleted file mode 100644 index 8da7b96543..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/ActionSave.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -public class ActionSave extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionSave.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - CustomExtFieldRele customExtFieldRele = null; - CustomExtFieldRele customExtFieldRele_old = null; - Project project = null; - Task task = null; - Wi wi = null; - Wo wo = new Wo(); - String fieldName = null; - Boolean check = true; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - customExtFieldRele = Wi.copier.copy( wi ); - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldRelePersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - /*if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( customExtFieldRele.getProjectId() )) { - check = false; - Exception exception = new ProjectFlagForQueryEmptyException(); - result.error( exception ); - } - }*/ - - if( Boolean.TRUE.equals( check ) ){ - if(StringUtils.isNotEmpty( customExtFieldRele.getCorrelationId() )){ - try { - if(StringUtils.equals(customExtFieldRele.getType(), "project")){ - project = projectQueryService.get( customExtFieldRele.getCorrelationId() ); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException( customExtFieldRele.getCorrelationId() ); - result.error( exception ); - } - } - if(StringUtils.equals(customExtFieldRele.getType(), "task")){ - task = taskQueryService.get( customExtFieldRele.getCorrelationId() ); - if ( task == null) { - check = false; - Exception exception = new TaskNotExistsException( customExtFieldRele.getCorrelationId() ); - result.error( exception ); - } - } - - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldRelePersistException(e, "根据指定flag查询应用项目信息对象时发生异常。flag:" + customExtFieldRele.getCorrelationId() ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isNotEmpty( customExtFieldRele.getId() )) { - try { - customExtFieldRele_old = customExtFieldReleQueryService.get( customExtFieldRele.getId() ); - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldReleQueryException(e, "系统在根据ID查询指定的扩展属性关联信息时发生异常。ID:" + customExtFieldRele.getId() ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( customExtFieldRele_old == null ) { //新建 - fieldName = customExtFieldReleQueryService.getNextUseableExtFieldName( customExtFieldRele.getCorrelationId(), customExtFieldRele.getDisplayType() ); - }else { - //判断是否属性在富文本和普通 文本之间发生了变换 - if( (StringUtils.equals("RICHTEXT",wi.getDisplayType()) && !StringUtils.equals("RICHTEXT",customExtFieldRele_old.getDisplayType())) - || !StringUtils.equals("RICHTEXT",wi.getDisplayType()) && StringUtils.equals("RICHTEXT",customExtFieldRele_old.getDisplayType())) { - //判断当前所需要的类型的备用属性是否足够 - fieldName = customExtFieldReleQueryService.getNextUseableExtFieldName( customExtFieldRele.getCorrelationId(), customExtFieldRele.getDisplayType() ); - }else { - fieldName = customExtFieldRele_old.getExtFieldName(); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( fieldName )) { - //备用属性已经用完了,无法再添加新的属性 - check = false; - wo.setUseable(false); - /*Exception exception = new CustomExtFieldRelePersistException( "扩展属性不足(备用属性已用完),系统无法为该对象分配["+ customExtFieldRele.getDisplayType() +"]。" ); - result.error(exception);*/ - }else { - customExtFieldRele.setExtFieldName( fieldName ); - } - } - - - if( Boolean.TRUE.equals( check ) ){ - try { - - customExtFieldRele = customExtFieldRelePersistService.save( customExtFieldRele, effectivePerson ); - - // 更新缓存 - ApplicationCache.notify( CustomExtFieldRele.class ); - - wo.setId( customExtFieldRele.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new CustomExtFieldRelePersistException(e, "扩展属性关联信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - if( Boolean.TRUE.equals( check ) ){ - try { - Dynamic dynamic = dynamicPersistService.projectExtFieldReleSaveDynamic(customExtFieldRele_old, customExtFieldRele, effectivePerson); - if( dynamic != null ) { - List dynamics = new ArrayList<>(); - dynamics.add( WoDynamic.copier.copy( dynamic ) ); - if( wo != null ) { - wo.setDynamics(dynamics); - } - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wi { - - @FieldDescribe("ID,为空时为新建") - private String id; - - @FieldDescribe("显示属性名称(必填)") - private String displayName; - - @FieldDescribe("显示方式:TEXT|RADIO|CHECKBOX|SELECT|MUTISELECT|RICHTEXT(必填)") - private String displayType="TEXT"; - - @FieldDescribe("类型:project|task(必填)") - private String type; - - @FieldDescribe("说明信息(非必填)") - private String description; - - @FieldDescribe("关联ID((非必填)") - private String correlationId; - - @FieldDescribe("选择荐的备选数据,数据Json, displayType=RADIO|CHECKBOX|SELECT|MUTISELECT时必须填写,否则无选择项") - private String optionsData; - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, CustomExtFieldRele.class, null, null ); - - public String getDisplayType() { - return displayType; - } - - public void setDisplayType(String displayType) { - this.displayType = displayType; - } - - public String getOptionsData() { - return optionsData; - } - - public void setOptionsData(String optionsData) { - this.optionsData = optionsData; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - @FieldDescribe("备用属性是否可用") - Boolean useable = true; - - public Boolean getUseable(){ - return useable; - } - - public void setUseable(Boolean useable){ - this.useable = useable; - } - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/BaseAction.java deleted file mode 100644 index 67e6951220..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/BaseAction.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.DynamicPersistService; -import com.x.teamwork.assemble.control.service.CustomExtFieldRelePersistService; -import com.x.teamwork.assemble.control.service.CustomExtFieldReleQueryService; -import com.x.teamwork.assemble.control.service.ProjectQueryService; -import com.x.teamwork.assemble.control.service.SystemConfigQueryService; -import com.x.teamwork.assemble.control.service.TaskQueryService; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache customExtFieldReleCache = ApplicationCache.instance().getCache( CustomExtFieldRele.class ); - - protected CustomExtFieldReleQueryService customExtFieldReleQueryService = new CustomExtFieldReleQueryService(); - - protected CustomExtFieldRelePersistService customExtFieldRelePersistService = new CustomExtFieldRelePersistService(); - - protected ProjectQueryService projectQueryService = new ProjectQueryService(); - protected TaskQueryService taskQueryService = new TaskQueryService(); - - protected DynamicPersistService dynamicPersistService = new DynamicPersistService(); - - protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService(); - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleAction.java deleted file mode 100644 index 53f1cd7846..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleAction.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.container.Suspended; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.JaxrsDescribe; -import com.x.base.core.project.annotation.JaxrsMethodDescribe; -import com.x.base.core.project.annotation.JaxrsParameterDescribe; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.http.HttpMediaType; -import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; - -@Path("extfield") -@JaxrsDescribe("扩展属性关联信息管理") -public class CustomExtFieldReleAction extends StandardJaxrsAction { - - private Logger logger = LoggerFactory.getLogger(CustomExtFieldReleAction.class); - - @JaxrsMethodDescribe(value = "查询所有扩展属性信息.", action = ActionListAllExtFields.class) - @GET - @Path("list/fields/all") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listAllUseableFields(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListAllExtFields().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据指定ID查询扩展属性关联信息.", action = ActionGet.class) - @GET - @Path("rele/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void get(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("关联信息ID") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGet().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据关联ID,需要的扩展属性类别获取下一个可用的属性名称.", action = ActionGetNextUseableExtFieldName.class) - @GET - @Path("next/field/{correlationId}/{fieldType}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getNextUseableFieldName(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("关联ID") @PathParam("correlationId") String correlationId, - @JaxrsParameterDescribe("属性类别:TEXT|SELECT|MUTISELECT|RICHTEXT|DATE|DATETIME|PERSON|IDENTITY|UNIT|GROUP|") @PathParam("fieldType") String fieldType ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGetNextUseableExtFieldName().execute( request, effectivePerson, correlationId, fieldType ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据关联ID查询用户创建的所有扩展属性关联信息列表.", action = ActionListWithCorrelation.class) - @GET - @Path("list/{correlationId}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listFieldsWithCorrelation(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("关联ID") @PathParam("correlationId") String correlationId ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListWithCorrelation().execute( request, effectivePerson, correlationId ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据扩展属性类型查询扩展属性信息列表.", action = ActionListWithType.class) - @GET - @Path("listPublicFields/{type}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listFieldsWithType(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("扩展属性类型") @PathParam("type") String type ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListWithType().execute( request, effectivePerson, type ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "创建或者更新一个扩展属性关联信息.", action = ActionSave.class) - @POST - @Path("relevance") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void save(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("需要保存的扩展属性关联信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionSave().execute(request, effectivePerson, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识删除扩展属性关联信息.", action = ActionDelete.class) - @DELETE - @Path("relevance/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void delete(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionDelete().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleFlagForQueryEmptyException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleFlagForQueryEmptyException.java deleted file mode 100644 index 64aee5da0f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleFlagForQueryEmptyException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.exception.PromptException; - -class CustomExtFieldReleFlagForQueryEmptyException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - CustomExtFieldReleFlagForQueryEmptyException() { - super("查询的扩展属性关联信息ID为空,无法继续查询数据。" ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleNotExistsException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleNotExistsException.java deleted file mode 100644 index 7f9f297911..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleNotExistsException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.exception.PromptException; - -class CustomExtFieldReleNotExistsException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - CustomExtFieldReleNotExistsException( String id ) { - super("指定ID的扩展属性关联信息不存在。ID:" + id ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldRelePersistException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldRelePersistException.java deleted file mode 100644 index db72174c28..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldRelePersistException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.exception.PromptException; - -class CustomExtFieldRelePersistException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - CustomExtFieldRelePersistException( Throwable e ) { - super("系统在保存扩展属性关联信息时发生异常。" , e ); - } - - CustomExtFieldRelePersistException( Throwable e, String message ) { - super("系统在保存扩展属性关联信息时发生异常。Message:" + message, e ); - } - - CustomExtFieldRelePersistException( String message ) { - super("系统在保存扩展属性关联信息时发生异常。Message:" + message ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleQueryException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleQueryException.java deleted file mode 100644 index 77df2683d0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/CustomExtFieldReleQueryException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.exception.PromptException; - -class CustomExtFieldReleQueryException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - CustomExtFieldReleQueryException( Throwable e ) { - super("系统在查询扩展属性关联信息时发生异常。" , e ); - } - - CustomExtFieldReleQueryException( Throwable e, String message ) { - super("系统在查询扩展属性关联信息时发生异常。Message:" + message, e ); - } - - CustomExtFieldReleQueryException( String message ) { - super("系统在查询扩展属性关联信息时发生异常。Message:" + message ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/TaskNotExistsException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/TaskNotExistsException.java deleted file mode 100644 index 88cd16c79d..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/extfield/TaskNotExistsException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.extfield; - -import com.x.base.core.project.exception.PromptException; - -class TaskNotExistsException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - TaskNotExistsException( String id ) { - super("指定ID的任务信息不存在。ID:" + id ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionInitConfig.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionInitConfig.java deleted file mode 100644 index 2427a54131..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionInitConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Priority; - -public class ActionInitConfig extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionInitConfig.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = new Wo(); - List prioritys = null; - - try { - prioritys = priorityQueryService.listPriority(); - if( ListTools.isEmpty( prioritys )) { - //初始化默认的优先级配置、默认模板 - this.initPrioritys(wo,effectivePerson); - - } - } catch (Exception e) { - Exception exception = new PriorityQueryException(e, "查询优先级信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - result.setData( wo ); - return result; - } - - private void initPrioritys(Wo wo,EffectivePerson effectivePerson) throws Exception{ - for(int i=0;i<3;i++){ - Priority priority = new Priority(); - if(i==0){ - priority.setPriority("紧急"); - priority.setPriorityColor("#e62412"); - } - if(i==1){ - priority.setPriority("优先"); - priority.setPriorityColor("#fa8c15"); - } - if(i==2){ - priority.setPriority("普通"); - priority.setPriorityColor("#15ad31"); - } - priority.setOrder(i); - priority.setOwner("系统"); - try { - priority = priorityPersistService.save( priority, effectivePerson ); - ApplicationCache.notify( Priority.class ); - wo.setId( priority.getId() ); - } catch (Exception e) { - Exception exception = new PriorityPersistException(e, "优先级信息保存时发生异常。"); - } - } - } - - public static class Wo extends WoId { - - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionIsManager.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionIsManager.java deleted file mode 100644 index 33e6289abf..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionIsManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import javax.servlet.http.HttpServletRequest; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.assemble.control.Business; - - - -public class ActionIsManager extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionIsManager.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson) throws Exception { - ActionResult result = new ActionResult<>(); - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()){ - Business business = new Business(emc); - if(business.isManager(effectivePerson)){ - result.setData( "yes" ); - }else{ - result.setData( "no" ); - } - } catch (Exception e) { - result.error(e); - logger.error(e, effectivePerson, request, null); - } - - return result; - } - public static class Wo extends WoId { - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionListProjectConfigNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionListProjectConfigNextWithFilter.java deleted file mode 100644 index 914ca32bd3..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionListProjectConfigNextWithFilter.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -import com.x.teamwork.core.entity.ProjectConfig; - -public class ActionListProjectConfigNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListProjectConfigNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - QueryFilter queryFilter = null; - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectConfigQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - } - - if( Boolean.TRUE.equals( check ) ){ - /*采用缓存 - * cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectConfigIds = projectConfigQueryService.listAllProjectConfigIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectConfigIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectConfigIds.size() + "" ); - List projectConfigList = projectConfigQueryService.listWithProjectConfigIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectConfigIds ); - - if( ListTools.isNotEmpty( projectConfigList )) { - for( ProjectConfig projectConfig : projectConfigList ) { - Wo wo = Wo.copier.copy(projectConfig); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目配置信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProjectConfig{ - - } - - public static class Wo extends ProjectConfig { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectConfig.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityDelete.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityDelete.java deleted file mode 100644 index e6a8c29fa3..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityDelete.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectGroup; - -public class ActionPriorityDelete extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionPriorityDelete.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - Priority priority = null; - Boolean check = true; - Wo wo = new Wo(); - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new PriorityFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - priority = priorityQueryService.get(flag); - if ( priority == null) { - check = false; - Exception exception = new PriorityNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new PriorityQueryException(e, "根据指定flag查询优先级信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - priorityPersistService.delete(flag, effectivePerson ); - // 更新缓存 - ApplicationCache.notify( Priority.class ); - - wo.setId( priority.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new PriorityQueryException(e, "根据指定flag删除优先级信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wo extends WoId { - - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityGet.java deleted file mode 100644 index fb1c9757e9..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityGet.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectGroup; - -import net.sf.ehcache.Element; - -public class ActionPriorityGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionPriorityGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - Priority priority = null; - Boolean check = true; - - if ( StringUtils.isEmpty( id ) ) { - check = false; - Exception exception = new PriorityFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - priority = priorityQueryService.get( id ); - if ( priority == null) { - check = false; - Exception exception = new PriorityNotExistsException( id ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new PriorityQueryException(e, "根据指定flag查询优先级信息对象时发生异常。id:" + id ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( priority ); - result.setData(wo); - } catch (Exception e) { - Exception exception = new PriorityQueryException(e, "将查询出来的优先级信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - public static class Wo extends Priority { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Priority.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityList.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityList.java deleted file mode 100644 index 6ee6644d2b..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPriorityList.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectGroup; - -import net.sf.ehcache.Element; - -public class ActionPriorityList extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionPriorityList.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List prioritys = null; - - try { - prioritys = priorityQueryService.listPriority(); - if( ListTools.isNotEmpty( prioritys )) { - wos = Wo.copier.copy( prioritys ); - - //SortTools.asc( wos, "createTime"); - result.setData(wos); - } - result.setData(wos); - } catch (Exception e) { - Exception exception = new PriorityQueryException(e, "查询优先级信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - return result; - } - - public static class Wo extends Priority { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Priority.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPrioritySave.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPrioritySave.java deleted file mode 100644 index e9594c5587..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionPrioritySave.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Priority; - -public class ActionPrioritySave extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionPrioritySave.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Priority priority = null; - Wi wi = null; - Wo wo = new Wo(); - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - Exception exception = new PriorityPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - - try { - priority = priorityPersistService.save( wi, effectivePerson ); - // 更新缓存 - ApplicationCache.notify( Priority.class ); - wo.setId( priority.getId() ); - } catch (Exception e) { - Exception exception = new PriorityPersistException(e, "优先级信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - result.setData( wo ); - return result; - } - - public static class Wi extends Priority { - private static final long serialVersionUID = -6314932919066148113L; - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, Priority.class, null, null ); - - } - - public static class Wo extends WoId { - - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigDelete.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigDelete.java deleted file mode 100644 index 8c0823dee5..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigDelete.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.ProjectConfig; - -public class ActionProjectConfigDelete extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigDelete.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - ProjectConfig projectConfig = null; - Boolean check = true; - Wo wo = new Wo(); - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new ProjectConfigFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectConfig = projectConfigQueryService.get(flag); - if ( projectConfig == null) { - check = false; - Exception exception = new ProjectConfigNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectConfigQueryException(e, "根据指定flag查询项目配置信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectConfigPersistService.delete(flag, effectivePerson ); - // 更新缓存 - ApplicationCache.notify( ProjectConfig.class ); - - wo.setId( projectConfig.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new ProjectConfigQueryException(e, "根据指定flag删除项目配置信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wo extends WoId { - - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGet.java deleted file mode 100644 index acea73fbd9..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGet.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectGroup; - -import net.sf.ehcache.Element; - -public class ActionProjectConfigGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - ProjectConfig projectConfig = null; - Boolean check = true; - - if ( StringUtils.isEmpty( id ) ) { - check = false; - Exception exception = new PriorityFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectConfig = projectConfigQueryService.get( id ); - if ( projectConfig == null) { - check = false; - Exception exception = new ProjectConfigNotExistsException( id ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectConfigQueryException(e, "根据指定flag查询项目配置信息对象时发生异常。id:" + id ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( projectConfig ); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectConfigQueryException(e, "将查询出来的项目配置信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - public static class Wo extends ProjectConfig { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectConfig.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGetByProject.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGetByProject.java deleted file mode 100644 index 8834e28119..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGetByProject.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.ProjectConfig; - - - - -public class ActionProjectConfigGetByProject extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigGetByProject.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception { - ActionResult result = new ActionResult(); - Wo wo = null; - List projectConfigs = null; - ProjectConfig projectConfig = null; - Boolean check = true; - - if ( StringUtils.isEmpty( id ) ) { - check = false; - Exception exception = new ProjectConfigFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectConfigs = projectConfigQueryService.getProjectConfigByProject( id ); - if(ListTools.isNotEmpty(projectConfigs)){ - projectConfig = projectConfigs.get(0); - } - /* - if ( projectConfig == null) { - check = false; - Exception exception = new ProjectConfigNotExistsException( id ); - result.error( exception ); - }*/ - } catch (Exception e) { - check = false; - Exception exception = new ProjectConfigQueryException(e, "根据指定flag查询项目配置信息对象时发生异常。id:" + id ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( projectConfig ); - result.setData(wo); - - } catch (Exception e) { - Exception exception = new ProjectConfigQueryException(e, "将查询出来的项目配置信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - public static class Wo extends ProjectConfig { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectConfig.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigSave.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigSave.java deleted file mode 100644 index f89240eac1..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigSave.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.ProjectConfig; - -public class ActionProjectConfigSave extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigSave.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - ProjectConfig projectConfig = null; - Wi wi = null; - Wo wo = new Wo(); - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - Exception exception = new PriorityPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - - try { - projectConfig = projectConfigPersistService.save( wi, effectivePerson ); - // 更新缓存 - ApplicationCache.notify( ProjectConfig.class ); - wo.setId( projectConfig.getId() ); - } catch (Exception e) { - Exception exception = new PriorityPersistException(e, "项目配置信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - result.setData( wo ); - return result; - } - - public static class Wi extends ProjectConfig { - private static final long serialVersionUID = -6314932919066148113L; - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, ProjectConfig.class, null, null ); - - } - - public static class Wo extends WoId { - - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/BaseAction.java deleted file mode 100644 index 7c25c0e1eb..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/BaseAction.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.DynamicPersistService; -import com.x.teamwork.assemble.control.service.PriorityPersistService; -import com.x.teamwork.assemble.control.service.PriorityQueryService; -import com.x.teamwork.assemble.control.service.ProjectConfigPersistService; -import com.x.teamwork.assemble.control.service.ProjectConfigQueryService; -import com.x.teamwork.assemble.control.service.SystemConfigQueryService; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectConfig; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache priorityCache = ApplicationCache.instance().getCache( Priority.class ); - - protected PriorityQueryService priorityQueryService = new PriorityQueryService(); - - protected PriorityPersistService priorityPersistService = new PriorityPersistService(); - - protected DynamicPersistService dynamicPersistService = new DynamicPersistService(); - - protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService(); - - protected Ehcache projectConfigCache = ApplicationCache.instance().getCache( ProjectConfig.class ); - - protected ProjectConfigPersistService projectConfigPersistService = new ProjectConfigPersistService(); - - protected ProjectConfigQueryService projectConfigQueryService = new ProjectConfigQueryService(); - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/GlobalAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/GlobalAction.java deleted file mode 100644 index 6a5c69b039..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/GlobalAction.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.container.Suspended; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.JaxrsDescribe; -import com.x.base.core.project.annotation.JaxrsMethodDescribe; -import com.x.base.core.project.annotation.JaxrsParameterDescribe; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.http.HttpMediaType; -import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.assemble.control.jaxrs.project.ActionListNextWithFilter; - -@Path("global") -@JaxrsDescribe("全局信息管理") -public class GlobalAction extends StandardJaxrsAction { - - private Logger logger = LoggerFactory.getLogger(GlobalAction.class); - - @JaxrsMethodDescribe(value = "查询当前用户是否具有管理员权限.", action = ActionIsManager.class) - @GET - @Path("isManager") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void isManager(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionIsManager().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID查询优先级信息.", action = ActionPriorityGet.class) - @GET - @Path("priority/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void priorityGet(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("优先级ID") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionPriorityGet().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "查询所有优先级信息列表.", action = ActionPriorityList.class) - @GET - @Path("priority/list") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void priorityList(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionPriorityList().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "创建或者更新一个优先级信息.", action = ActionPrioritySave.class) - @POST - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void prioritySave(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("需要保存的优先级信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionPrioritySave().execute(request, effectivePerson, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识删除优先级信息.", action = ActionPriorityDelete.class) - @DELETE - @Path("priority/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void priorityDelete(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionPriorityDelete().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID查询项目配置信息.", action = ActionProjectConfigGet.class) - @GET - @Path("projectConfig/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void projectConfigGet(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("项目配置ID") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionProjectConfigGet().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "创建或者更新一个项目配置信息.", action = ActionProjectConfigSave.class) - @POST - @Path("projectConfig") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void projectConfigSave(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("需要保存的优先级信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionProjectConfigSave().execute(request, effectivePerson, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识删除项目配置信息.", action = ActionProjectConfigDelete.class) - @DELETE - @Path("projectConfig/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void projectConfigDelete(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionProjectConfigDelete().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示项目配置信息,下一页.", action = ActionListProjectConfigNextWithFilter.class) - @PUT - @Path("listProjectConfig/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listProjectConfigNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListProjectConfigNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID查询项目配置信息.", action = ActionProjectConfigGetByProject.class) - @GET - @Path("projectConfig/project/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void projectConfigGetByProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("项目ID") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionProjectConfigGetByProject().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "初始化优先级信息.", action = ActionInitConfig.class) - @GET - @Path("initConfig") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void initConfig(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionInitConfig().execute(request, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityFlagForQueryEmptyException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityFlagForQueryEmptyException.java deleted file mode 100644 index 5c16d84ca7..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityFlagForQueryEmptyException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class PriorityFlagForQueryEmptyException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - PriorityFlagForQueryEmptyException() { - super("查询的优先级信息ID为空,无法继续查询数据。" ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityNotExistsException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityNotExistsException.java deleted file mode 100644 index 6f35114693..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityNotExistsException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class PriorityNotExistsException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - PriorityNotExistsException( String id ) { - super("指定ID的优先级信息不存在。ID:" + id ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityPersistException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityPersistException.java deleted file mode 100644 index 694af4cfe9..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityPersistException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class PriorityPersistException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - PriorityPersistException( Throwable e ) { - super("系统在保存项目组信息时发生异常。" , e ); - } - - PriorityPersistException( Throwable e, String message ) { - super("系统在保存项目组信息时发生异常。Message:" + message, e ); - } - - PriorityPersistException( String message ) { - super("系统在保存项目组信息时发生异常。Message:" + message ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityQueryException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityQueryException.java deleted file mode 100644 index 28dbd7b4d0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/PriorityQueryException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class PriorityQueryException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - PriorityQueryException( Throwable e ) { - super("系统在查询优先级信息时发生异常。" , e ); - } - - PriorityQueryException( Throwable e, String message ) { - super("系统在查询优先级信息时发生异常。Message:" + message, e ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigFlagForQueryEmptyException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigFlagForQueryEmptyException.java deleted file mode 100644 index a26845e109..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigFlagForQueryEmptyException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class ProjectConfigFlagForQueryEmptyException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - ProjectConfigFlagForQueryEmptyException() { - super("查询的项目配置信息ID为空,无法继续查询数据。" ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigNotExistsException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigNotExistsException.java deleted file mode 100644 index 923489a95c..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigNotExistsException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class ProjectConfigNotExistsException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - ProjectConfigNotExistsException( String id ) { - super("指定ID的项目配置信息不存在。ID:" + id ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigPersistException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigPersistException.java deleted file mode 100644 index 3a7600618e..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigPersistException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class ProjectConfigPersistException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - ProjectConfigPersistException( Throwable e ) { - super("系统在保存项目配置信息时发生异常。" , e ); - } - - ProjectConfigPersistException( Throwable e, String message ) { - super("系统在保存项目配置信息时发生异常。Message:" + message, e ); - } - - ProjectConfigPersistException( String message ) { - super("系统在保存项目配置信息时发生异常。Message:" + message ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigQueryException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigQueryException.java deleted file mode 100644 index e4b6f47dae..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ProjectConfigQueryException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import com.x.base.core.project.exception.PromptException; - -class ProjectConfigQueryException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - ProjectConfigQueryException( Throwable e ) { - super("系统在查询项目配置信息时发生异常。" , e ); - } - - ProjectConfigQueryException( Throwable e, String message ) { - super("系统在查询项目配置信息时发生异常。Message:" + message, e ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/WrapInQueryProjectConfig.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/WrapInQueryProjectConfig.java deleted file mode 100644 index 52fe444d38..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/WrapInQueryProjectConfig.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.global; - -import javax.persistence.Column; - -import org.apache.commons.lang3.StringUtils; -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -public class WrapInQueryProjectConfig { - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填, 默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("项目ID.") - private String project=null; - - @FieldDescribe("新建任务:true|false.") - private String taskCreate = null; - - @FieldDescribe("复制任务:true|false.") - private String taskCopy = null; - - @FieldDescribe("删除任务:true|false.") - private String taskRemove = null; - - @FieldDescribe("新建泳道:true|false.") - private String laneCreate = null; - - @FieldDescribe("编辑泳道:true|false.") - private String laneEdit = null; - - @FieldDescribe("删除泳道:true|false.") - private String laneRemove = null; - - @FieldDescribe("上传附件:true|false.") - private String attachmentUpload = null; - - @FieldDescribe("允许评论:true|false.") - private String comment = null; - - private Long rank = 0L; - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getTaskCreate() { - return taskCreate; - } - - public void setTaskCreate(String taskCreate) { - this.taskCreate = taskCreate; - } - - public String getTaskCopy() { - return taskCopy; - } - - public void setTaskCopy(String taskCopy) { - this.taskCopy = taskCopy; - } - - public String getTaskRemove() { - return taskRemove; - } - - public void setTaskRemove(String taskRemove) { - this.taskRemove = taskRemove; - } - - public String getLaneCreate() { - return laneCreate; - } - - public void setLaneCreate(String laneCreate) { - this.laneCreate = laneCreate; - } - - public String getLaneEdit() { - return laneEdit; - } - - public void setLaneEdit(String laneEdit) { - this.laneEdit = laneEdit; - } - - public String getLaneRemove() { - return laneRemove; - } - - public void setLaneRemove(String laneRemove) { - this.laneRemove = laneRemove; - } - - public String getAttachmentUpload() { - return attachmentUpload; - } - - public void setAttachmentUpload(String attachmentUpload) { - this.attachmentUpload = attachmentUpload; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getOrderField() { - return orderField; - } - public void setOrderField(String orderField) { - this.orderField = orderField; - } - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public Long getRank() { - return rank; - } - public void setRank(Long rank) { - this.rank = rank; - } - - - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - queryFilter.setJoinType( "and" ); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getProject())) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - - if( StringUtils.isNotEmpty( this.getTaskCreate() )) { - if("true".equalsIgnoreCase( this.getTaskCreate() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "taskCreate", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "taskCreate", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getTaskCopy() )) { - if("true".equalsIgnoreCase( this.getTaskCopy() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "taskCopy", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "taskCopy", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getTaskRemove() )) { - if("true".equalsIgnoreCase( this.getTaskRemove() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "taskRemove", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "taskRemove", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getLaneCreate() )) { - if("true".equalsIgnoreCase( this.getLaneCreate() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "laneCreate", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "laneCreate", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getLaneEdit() )) { - if("true".equalsIgnoreCase( this.getLaneEdit() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "laneEdit", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "laneEdit", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getLaneRemove() )) { - if("true".equalsIgnoreCase( this.getLaneRemove() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "laneRemove", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "laneRemove", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getAttachmentUpload() )) { - if("true".equalsIgnoreCase( this.getAttachmentUpload() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "attachmentUpload", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "attachmentUpload", false ) ); - } - } - - if( StringUtils.isNotEmpty( this.getComment() )) { - if("true".equalsIgnoreCase( this.getComment() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "comment", true ) ); - }else{ - queryFilter.addEqualsTerm( new EqualsTerm( "comment", false ) ); - } - } - - return queryFilter; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/ActionListWithTaskGroup.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/ActionListWithTaskGroup.java deleted file mode 100644 index 4fa1ecdda5..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/ActionListWithTaskGroup.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.list; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.TaskList; - - -public class ActionListWithTaskGroup extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListWithTaskGroup.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, String taskGroupId ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List taskLists = null; - Boolean check = true; - /*String cacheKey = ApplicationCache.concreteCacheKey( "list.my.taskgroup", taskGroupId, effectivePerson.getDistinguishedName() ); - Element element = taskListCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - System.out.println("111"); - wos = (List) element.getObjectValue(); - result.setData( wos ); - } else {*/ - if( Boolean.TRUE.equals( check ) ){ - try { - taskLists = taskListQueryService.listWithTaskGroup( effectivePerson.getDistinguishedName(), taskGroupId ); - if( ListTools.isNotEmpty( taskLists )) { - wos = Wo.copier.copy( taskLists ); - if( ListTools.isNotEmpty( wos )) { - for( Wo wo : wos ) { - //计算当前List里的任务数量 - wo.setTaskCount(taskListQueryService.countTaskWithTaskListId( effectivePerson.getDistinguishedName(), wo.getId(), wo.getTaskGroup() )); - if( "NoneList".equalsIgnoreCase( wo.getMemo() )) { - wo.setControl( new Control(false, false, false, false )); - }else { - wo.setControl( new Control(true, true, true, true )); - } - Project project = null; - project = projectQueryService.get(wo.getProject()); - if(project != null && (project.getDeleted() || project.getCompleted())){ - wo.setControl( new Control(false, false, false, false )); - } - } - } - //taskListCache.put(new Element(cacheKey, wos)); - result.setData(wos); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskListQueryException(e, "根据用户在指定工作任务组拥有的工作任务列表信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //} - return result; - } - - public static class Wo extends TaskList { - - private Long rank; - - @FieldDescribe("工作任务数量.") - private Long taskCount = 0L; - - @FieldDescribe("工作任务列表操作权限.") - private Control control; - - public Control getControl() { - return control; - } - - public void setControl(Control control) { - this.control = control; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public Long getTaskCount() { - return taskCount; - } - - public void setTaskCount(Long taskCount) { - this.taskCount = taskCount; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskList.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class Control{ - - private Boolean delete = false; - - private Boolean edit = false; - - private Boolean sortable = true; - - private Boolean founder = false; - - public Control( Boolean edit, Boolean delete, Boolean sortable, Boolean founder ) { - this.delete = delete; - this.edit = edit; - this.sortable = sortable; - this.founder = founder; - } - public Boolean getDelete() { - return delete; - } - - public void setDelete(Boolean delete) { - this.delete = delete; - } - - public Boolean getEdit() { - return edit; - } - - public void setEdit(Boolean edit) { - this.edit = edit; - } - public Boolean getSortable() { - return sortable; - } - public void setSortable(Boolean sortable) { - this.sortable = sortable; - } - public Boolean getFounder() { - return founder; - } - public void setFounder(Boolean founder) { - this.founder = founder; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/BaseAction.java deleted file mode 100644 index 71b8fc7cdb..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/list/BaseAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.list; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.DynamicPersistService; -import com.x.teamwork.assemble.control.service.ProjectQueryService; -import com.x.teamwork.assemble.control.service.SystemConfigQueryService; -import com.x.teamwork.assemble.control.service.TaskGroupQueryService; -import com.x.teamwork.assemble.control.service.TaskListPersistService; -import com.x.teamwork.assemble.control.service.TaskListQueryService; -import com.x.teamwork.assemble.control.service.TaskQueryService; -import com.x.teamwork.assemble.control.service.TaskTagQueryService; -import com.x.teamwork.core.entity.TaskList; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache taskListCache = ApplicationCache.instance().getCache( TaskList.class ); - - protected TaskGroupQueryService taskGroupQueryService = new TaskGroupQueryService(); - - protected TaskListQueryService taskListQueryService = new TaskListQueryService(); - - protected TaskQueryService taskQueryService = new TaskQueryService(); - - protected TaskListPersistService taskListPersistService = new TaskListPersistService(); - - protected DynamicPersistService dynamicPersistService = new DynamicPersistService(); - - protected TaskTagQueryService taskTagQueryService = new TaskTagQueryService(); - - protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService(); - - protected ProjectQueryService projectQueryService = new ProjectQueryService(); - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionComplete.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionComplete.java deleted file mode 100644 index a843ac9390..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionComplete.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Project; - -public class ActionComplete extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionComplete.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Wi wi = null; - Project project = null; - Boolean check = true; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get( projectId ); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException( projectId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "根据指定flag查询应用项目信息对象时发生异常。ID:" + projectId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectPersistService.completeProject( projectId,wi.getCompleted()); - - // 更新缓存 - ApplicationCache.notify( Project.class ); - Wo wo = new Wo(); - wo.setId( project.getId() ); - result.setData( wo ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "项目状态信息更新时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - try { - dynamicPersistService.projectCompleteDynamic( project, effectivePerson ,wi.getCompleted()); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - -public static class Wi { - - @FieldDescribe("已完成/未完成") - private Boolean completed = true; - - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(Boolean completed) { - this.completed = completed; - } - } - - public static class Wo extends WoId { - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionCreateable.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionCreateable.java deleted file mode 100644 index 95bc241f9f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionCreateable.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Project; - -public class ActionCreateable extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionCreateable.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Wi wi = null; - Project project = null; - Boolean check = true; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get( projectId ); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException( projectId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "根据指定flag查询应用项目信息对象时发生异常。ID:" + projectId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectPersistService.createableProject( projectId,wi.getCreateable()); - - // 更新缓存 - ApplicationCache.notify( Project.class ); - Wo wo = new Wo(); - wo.setId( project.getId() ); - result.setData( wo ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "项目状态信息更新时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - try { - dynamicPersistService.projectCreateableDynamic( project, effectivePerson ,wi.getCreateable()); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - -public static class Wi { - - @FieldDescribe("是否可新建任务") - private Boolean createable = true; - - public Boolean getCreateable() { - return createable; - } - - public void setCreateable(Boolean createable) { - this.createable = createable; - } - } - - public static class Wo extends WoId { - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionGet.java deleted file mode 100644 index 838eda5b16..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionGet.java +++ /dev/null @@ -1,230 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.Task; - - -public class ActionGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - Project project = null; - ProjectDetail projectDetail = null; - List groupIds = null; - List groups = null; - List taskList = null; - List projectConfigs = null; - WrapOutControl control = null; - Boolean check = true; - - Integer taskTotal = 0; - Integer progressTotal = 0; - Integer completedTotal = 0; - Integer overtimeTotal = 0; - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new ProjectFlagForQueryEmptyException(); - result.error( exception ); - } - - /*String cacheKey = ApplicationCache.concreteCacheKey( flag,effectivePerson ); - Element element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else {*/ - if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get(flag); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "根据指定flag查询应用项目信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - taskList = projectQueryService.listAllTasks(flag , true); - if( ListTools.isNotEmpty( taskList )) { - for( Task task : taskList ) { - taskTotal ++; - if( "completed".equalsIgnoreCase(task.getWorkStatus()) ) { - completedTotal++; - } - if( "processing".equalsIgnoreCase(task.getWorkStatus()) ) { - progressTotal++; - } - if( task.getOvertime() ) { - overtimeTotal++; - } - } - } - - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( project ); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - //查询项目详情 - projectDetail = projectQueryService.getDetail( project.getId() ); - if( projectDetail != null ) { - wo.setDescription( projectDetail.getDescription() ); - } - - //查询项目组信息 - groupIds = projectGroupQueryService.listGroupIdByProject( project.getId() ); - groups = projectGroupQueryService.list( groupIds ); - wo.setGroups( groups ); - - //查询项目配置信息 - projectConfigs = projectConfigQueryService.getProjectConfigByProject( project.getId() ); - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - - control = new WrapOutControl(); - if(ListTools.isNotEmpty(projectConfigs)){ - ProjectConfig projectConfig = projectConfigs.get(0); - control.setTaskCreate(projectConfig.getTaskCreate()); - control.setTaskCopy(projectConfig.getTaskCopy()); - control.setTaskRemove(projectConfig.getTaskRemove()); - control.setLaneCreate(projectConfig.getLaneCreate()); - control.setLaneEdit(projectConfig.getLaneEdit()); - control.setLaneRemove(projectConfig.getLaneRemove()); - control.setAttachmentUpload(projectConfig.getAttachmentUpload()); - control.setComment(projectConfig.getComment()); - }else{ - control.setTaskCreate(true); - } - - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - control.setTaskCreate(true); - - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(project.getDeleted() || project.getCompleted()){ - control.setTaskCreate(false); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - - wo.setProgressTotal(progressTotal); - wo.setCompletedTotal(completedTotal); - wo.setOvertimeTotal(overtimeTotal); - wo.setTaskTotal(taskTotal); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //} - return result; - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - @FieldDescribe("所有任务数量") - private Integer taskTotal = 0; - - @FieldDescribe("执行中任务数量") - private Integer progressTotal = 0; - - @FieldDescribe("已完成任务数量") - private Integer completedTotal = 0; - - @FieldDescribe("超时任务数量") - private Integer overtimeTotal = 0; - - public Integer getTaskTotal() { - return taskTotal; - } - - public void setTaskTotal(Integer taskTotal) { - this.taskTotal = taskTotal; - } - - public Integer getProgressTotal() { - return progressTotal; - } - - public void setProgressTotal(Integer progressTotal) { - this.progressTotal = progressTotal; - } - - public Integer getCompletedTotal() { - return completedTotal; - } - - public void setCompletedTotal( Integer completedTotal ) { - this.completedTotal = completedTotal; - } - - public Integer getOvertimeTotal() { - return overtimeTotal; - } - - public void setOvertimeTotal( Integer overtimeTotal ) { - this.overtimeTotal = overtimeTotal; - } - - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListArchiveNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListArchiveNextWithFilter.java deleted file mode 100644 index 4efc4b18d4..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListArchiveNextWithFilter.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsTrueTerm; - -import net.sf.ehcache.Element; - -public class ActionListArchiveNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListArchiveNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //已归档 - queryFilter.addIsTrueTerm( new IsTrueTerm("archive" )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListArchiveNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListCompletedNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListCompletedNextWithFilter.java deleted file mode 100644 index ed0aa9ee9a..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListCompletedNextWithFilter.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsTrueTerm; - -import net.sf.ehcache.Element; - -public class ActionListCompletedNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListCompletedNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //已完成 - queryFilter.addIsTrueTerm( new IsTrueTerm("completed" )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListCompletedNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListMyNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListMyNextWithFilter.java deleted file mode 100644 index bb676dd57d..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListMyNextWithFilter.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListMyNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListMyNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //执行者该用户 - queryFilter.addEqualsTerm( new EqualsTerm("executor", effectivePerson.getDistinguishedName() )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListMyNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextInGroupWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextInGroupWithFilter.java deleted file mode 100644 index 0ec8e776c0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextInGroupWithFilter.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListNextInGroupWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListNextInGroupWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String groupId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - List projectIds = projectGroupQueryService.listProjectIdByGroup( groupId ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextInGroupWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextWithFilter.java deleted file mode 100644 index 79f015154d..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextWithFilter.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - } - - if( Boolean.TRUE.equals( check ) ){ - /*采用缓存 - * cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - - //查询项目配置信息 - List projectConfigs = null; - projectConfigs = projectConfigQueryService.getProjectConfigByProject( project.getId() ); - - control = new WrapOutControl(); - - if(ListTools.isNotEmpty(projectConfigs)){ - ProjectConfig projectConfig = projectConfigs.get(0); - control.setTaskCreate(projectConfig.getTaskCreate()); - control.setTaskCopy(projectConfig.getTaskCopy()); - control.setTaskRemove(projectConfig.getTaskRemove()); - control.setLaneCreate(projectConfig.getLaneCreate()); - control.setLaneEdit(projectConfig.getLaneEdit()); - control.setLaneRemove(projectConfig.getLaneRemove()); - control.setAttachmentUpload(projectConfig.getAttachmentUpload()); - control.setComment(projectConfig.getComment()); - }else{ - control.setTaskCreate(true); - } - - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - control.setTaskCreate(true); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - if(project.getDeleted() || project.getCompleted()){ - control.setTaskCreate(false); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNoGroupNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNoGroupNextWithFilter.java deleted file mode 100644 index 94e3102ee8..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNoGroupNextWithFilter.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListNoGroupNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListNoGroupNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //分组个数为0 - queryFilter.addEqualsTerm( new EqualsTerm("groupCount", 0 )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListNoGroupNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageInGroupWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageInGroupWithFilter.java deleted file mode 100644 index 4db1c9a3f0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageInGroupWithFilter.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListPageInGroupWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListPageInGroupWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, Integer pageNum, Integer count, String groupId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - List projectIds = projectGroupQueryService.listProjectIdByGroup( groupId ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - - /*if( Boolean.TRUE.equals( check ) ){ - - cacheKey = ApplicationCache.concreteCacheKey( "ActionListPageWithFilter", effectivePerson.getDistinguishedName(), - pageNum, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - }*/ - - if( Boolean.TRUE.equals( check ) ){ - /*if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdsFilter( count, pageNum, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageWithFilter.java deleted file mode 100644 index 12b3dd9d5b..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListPageWithFilter.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListPageWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListPageWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, Integer pageNum, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - //添加过滤条件未删除状态才被查询 - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - } - - /*if( Boolean.TRUE.equals( check ) ){ - - cacheKey = ApplicationCache.concreteCacheKey( "ActionListPageWithFilter", effectivePerson.getDistinguishedName(), - pageNum, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - }*/ - - if( Boolean.TRUE.equals( check ) ){ - /*if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { */ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdsFilter( count, pageNum, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListRecycleNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListRecycleNextWithFilter.java deleted file mode 100644 index 61c58444f7..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListRecycleNextWithFilter.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsTrueTerm; -import java.util.ArrayList; -import java.util.List; -import javax.servlet.http.HttpServletRequest; -import net.sf.ehcache.Element; -import org.apache.commons.lang3.StringUtils; - -public class ActionListRecycleNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListRecycleNextWithFilter.class); - - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ) { - if( wrapIn == null ) { - wrapIn = new Wi(); - } - //已删除 - wrapIn.setDeleted("true"); - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //queryFilter.addIsTrueTerm( new IsTrueTerm("deleted" )); - } - - if( Boolean.TRUE.equals( check ) ) { - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListRecycleNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListStarNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListStarNextWithFilter.java deleted file mode 100644 index 088a42a270..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListStarNextWithFilter.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; -import com.x.teamwork.core.entity.tools.filter.term.MemberTerm; - -import net.sf.ehcache.Element; - -public class ActionListStarNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListStarNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - //String cacheKey = null; - //Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - if( StringUtils.isNotEmpty( wrapIn.getGroup() )) { - //如果项目分组不为空,那么需要先根据项目分组来查询这个分组下的所有项目ID集合 - List projectIds = projectGroupQueryService.listProjectIdByGroup( wrapIn.getGroup() ); - if( ListTools.isEmpty( projectIds )) { - queryProjectIds.add("0000-0000-0000"); - }else { - for( String projectId : projectIds ) { - queryProjectIds.add( projectId ); - } - } - queryFilter.addInTerm( new InTerm("id", new ArrayList(queryProjectIds) )); - } - //标星人员里有该用户 - queryFilter.addMemberTerm( new MemberTerm("starPersonList", effectivePerson.getDistinguishedName() )); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListStarNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( Project project : projectList ) { - Wo wo = Wo.copier.copy(project); - wo.setDescription( projectQueryService.getDescription( project.getId())); - if( wo.getStarPersonList().contains( effectivePerson.getDistinguishedName() )) { - wo.setStar( true ); - } - - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProject{ - } - - public static class Wo extends WrapOutProject { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Project.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionRecovery.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionRecovery.java deleted file mode 100644 index e8de5be080..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionRecovery.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Project; - -public class ActionRecovery extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionRecovery.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String projectId) throws Exception { - ActionResult result = new ActionResult<>(); - Project project = null; - Boolean check = true; - - if ( StringUtils.isEmpty( projectId )) { - check = false; - Exception exception = new ProjectFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get( projectId ); - if ( project == null) { - check = false; - Exception exception = new ProjectNotExistsException( projectId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException(e, "根据指定flag查询应用项目信息对象时发生异常。ID:" + projectId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectPersistService.recoveryProject( projectId); - - // 更新缓存 - ApplicationCache.notify( Project.class ); - Wo wo = new Wo(); - wo.setId( project.getId() ); - result.setData( wo ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "项目恢复时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - try { - dynamicPersistService.projectRecoveryDynamic( project, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - public static class Wo extends WoId { - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionSave.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionSave.java deleted file mode 100644 index 94af020c52..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionSave.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.google.gson.JsonElement; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.service.BatchOperationPersistService; -import com.x.teamwork.assemble.control.service.BatchOperationProcessService; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.Task; - -public class ActionSave extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionSave.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Project project = null; - Project old_project = null; - Wi wi = null; - Wo wo = new Wo(); - Boolean check = true; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if ( !projectPersistService.checkPermissionForPersist( effectivePerson, systemConfigQueryService.getValueByCode("PROJECT_CREATOR")) ) { - check = false; - Exception exception = new ProjectPersistException("project save permission denied!" ); - result.error(exception); - } - } - - if( Boolean.TRUE.equals( check ) ){ - old_project = projectQueryService.get( wi.getId() ); - } - - if( Boolean.TRUE.equals( check ) ){ - ProjectDetail projectDetail = new ProjectDetail(); - projectDetail.setDescription( wi.getDescription() ); - - try { - if( ListTools.isNotEmpty( wi.getGroups() )) { - wi.setGroupCount( wi.getGroups().size() ); - } - - project = projectPersistService.save( Wi.copier.copy(wi), projectDetail, effectivePerson ); - - //将项目添加到指定的项目组 - projectGroupPersistService.releProjectToGroup( project.getId(), wi.getGroups() ); - - // 更新缓存 - ApplicationCache.notify( Project.class ); - ApplicationCache.notify( ProjectGroup.class ); - - ApplicationCache.notify( Task.class, ApplicationCache.concreteCacheKey( "ActionStatisticMyTasks", project.getId(), effectivePerson.getDistinguishedName() ) ); - ApplicationCache.notify( Task.class, ApplicationCache.concreteCacheKey( "ActionStatisticMyTaskViews", project.getId(), effectivePerson.getDistinguishedName() ) ); - - wo.setId( project.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new ProjectPersistException(e, "项目信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - new BatchOperationPersistService().addOperation( - BatchOperationProcessService.OPT_OBJ_PROJECT, - BatchOperationProcessService.OPT_TYPE_PERMISSION, project.getId(), project.getId(), "刷新文档权限:ID=" + project.getId() ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - List dynamics = dynamicPersistService.projectSaveDynamic(old_project, project, effectivePerson, jsonElement.toString() ); - if( dynamics == null ) { - dynamics = new ArrayList<>(); - } - if( wo != null ) { - wo.setDynamics(WoDynamic.copier.copy(dynamics)); - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wi { - - @FieldDescribe("数据库主键,自动生成,非必填.") - private String id; - - @FieldDescribe("项目名称,必填") - private String title; - - @FieldDescribe("排序号,非必填") - private Integer order; - - @FieldDescribe("项目类型:普通项目 | 软件项目,非必填") - private String type = "普通项目"; - - @FieldDescribe("图标文件ID,非必填") - private String icon = null; - - @FieldDescribe("执行者|负责人,非必填") - private String executor; - - @FieldDescribe("模板id") - private String templateId; - - @FieldDescribe("管理者,非必填") - private List manageablePersonList; - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, Project.class, null, null ); - - @FieldDescribe("说明信息(1M),非必填") - private String description; - - @FieldDescribe("项目所属的项目组,可多值,非必填.") - private List groups = null; - - private Integer groupCount = 0; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Integer getGroupCount() { - return groupCount; - } - - public void setGroupCount(Integer groupCount) { - this.groupCount = groupCount; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getTemplateId() { - return templateId; - } - - public void setTemplateId(String templateId) { - this.templateId = templateId; - } - - public List getManageablePersonList() { - return manageablePersonList; - } - - public void setManageablePersonList(List manageablePersonList) { - this.manageablePersonList = manageablePersonList; - } - } - -public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjects.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjects.java deleted file mode 100644 index 2772be7455..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjects.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; - -import net.sf.ehcache.Element; - -public class ActionStatisticMyProjects extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionStatisticMyProjects.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - List projectIds = null; - List projectList = null; - List projectGroupList = null; - List woGroupList = null; - Boolean check = true; - - Integer allCount = 0; - Integer starCount = 0; - Integer myCount = 0; - Integer unGroupCount = 0; - Integer completedCount = 0; - Integer archiveCount = 0; - Integer deleteCount = 0; - - /*String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjects", effectivePerson.getDistinguishedName() ); - Element element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else {*/ - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我参与的所有项目 - projectIds = projectQueryService.listAllProjectIds( effectivePerson, 2000, new QueryFilter() ); - if( ListTools.isNotEmpty( projectIds )) { - projectList = projectQueryService.list( projectIds ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户参与的所有项目信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我所有的项目组列表 - projectGroupList = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户所有项目组信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectGroupList )) { - woGroupList = WoGroup.copier.copy( projectGroupList ); - SortTools.asc( woGroupList, "createTime"); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectList )) { - for( Project project : projectList ) { - if(project.getDeleted() != null && project.getDeleted() ){ - deleteCount++; - }else{ - allCount++; - if( project.getStarPersonList() != null && project.getStarPersonList().contains( effectivePerson.getDistinguishedName() ) ) { - starCount++; - } - if( project.getCreatorPerson().equalsIgnoreCase(effectivePerson.getDistinguishedName() )) { - myCount++; - } - if( project.getGroupCount() == null || project.getGroupCount() == 0 ) { - unGroupCount++; - } - if( project.getCompleted() != null && project.getCompleted() ) { - completedCount++; - } - if( project.getArchive() != null && project.getArchive() ) { - archiveCount++; - } - woGroupList = checkGroup( project, woGroupList ); - } - - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = new Wo(); - wo.setAllCount( allCount ); - wo.setMyCount(myCount); - wo.setStarCount(starCount); - wo.setUnGroupCount(unGroupCount); - wo.setCompletedCount(completedCount); - wo.setArchiveCount(archiveCount); - wo.setDeleteCount(deleteCount); - if( ListTools.isNotEmpty( woGroupList )) { - SortTools.asc( woGroupList, "createTime"); - } - wo.setGroups( woGroupList ); - //projectCache.put( new Element(cacheKey, wo) ); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //} - return result; - } - - private List checkGroup( Project project, List woGroupList) throws Exception { - if( ListTools.isEmpty( woGroupList )) { - return null; - } - for( WoGroup woGroup : woGroupList ) { - if( projectGroupQueryService.existsWithProjectAndGroup( woGroup.getId(), project.getId() ) ) { - woGroup.addProjectCount(1); - break; - } - } - return woGroupList; - } - - public static class Wo{ - - @FieldDescribe("所有项目数量") - private Integer allCount = 0; - - @FieldDescribe("所有项目数量") - private Integer starCount = 0; - - @FieldDescribe("所有项目数量") - private Integer myCount = 0; - - @FieldDescribe("所有项目数量") - private Integer unGroupCount = 0; - - @FieldDescribe("所有项目数量") - private Integer completedCount = 0; - - @FieldDescribe("所有项目数量") - private Integer archiveCount = 0; - - @FieldDescribe("所有项目数量") - private Integer deleteCount = 0; - - @FieldDescribe("所有分组信息") - private List groups = null; - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public Integer getAllCount() { - return allCount; - } - - public void setAllCount(Integer allCount) { - this.allCount = allCount; - } - - public Integer getStarCount() { - return starCount; - } - - public void setStarCount(Integer starCount) { - this.starCount = starCount; - } - - public Integer getMyCount() { - return myCount; - } - - public void setMyCount(Integer myCount) { - this.myCount = myCount; - } - - public Integer getUnGroupCount() { - return unGroupCount; - } - - public void setUnGroupCount(Integer unGroupCount) { - this.unGroupCount = unGroupCount; - } - - public Integer getCompletedCount() { - return completedCount; - } - - public void setCompletedCount(Integer completedCount) { - this.completedCount = completedCount; - } - - public Integer getArchiveCount() { - return archiveCount; - } - - public void setArchiveCount(Integer archiveCount) { - this.archiveCount = archiveCount; - } - - public Integer getDeleteCount() { - return deleteCount; - } - - public void setDeleteCount(Integer deleteCount) { - this.deleteCount = deleteCount; - } - } - - public static class WoGroup extends ProjectGroup{ - - @FieldDescribe("分组项目数量") - private Integer projectCount = 0; - - public Integer getProjectCount() { - return projectCount; - } - - public void setProjectCount(Integer projectCount) { - this.projectCount = projectCount; - } - - public void addProjectCount( Integer count ) { - if( this.projectCount == null ) { - this.projectCount =0; - } - this.projectCount += count; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static { - Excludes.add("creatorPerson"); - Excludes.add("owner"); - Excludes.add("updateTime"); - Excludes.add("distributeFactor"); - Excludes.add("sequence"); - } - - static WrapCopier copier = WrapCopierFactory.wo( ProjectGroup.class, WoGroup.class, null, Excludes); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjectsGroups.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjectsGroups.java deleted file mode 100644 index 8849750159..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionStatisticMyProjectsGroups.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -import net.sf.ehcache.Element; - -public class ActionStatisticMyProjectsGroups extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionStatisticMyProjectsGroups.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - List projectIds = null; - List projectList = null; - List projectGroupList = null; - List woGroupList = null; - Boolean check = true; - - /*String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjectsGroups", effectivePerson.getDistinguishedName() ); - Element element = projectCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else {*/ - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我参与的所有项目 - projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, new QueryFilter() ); - if( ListTools.isNotEmpty( projectIds )) { - projectList = projectQueryService.list( projectIds ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户参与的所有项目信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我所有的项目组列表 - projectGroupList = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户所有项目组信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectGroupList )) { - woGroupList = WoGroup.copier.copy( projectGroupList ); - SortTools.asc( woGroupList, "createTime"); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectList )) { - for( Project project : projectList ) { - woGroupList = checkGroup( project, woGroupList ); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = new Wo(); - if( ListTools.isNotEmpty( woGroupList )) { - SortTools.asc( woGroupList, "createTime"); - } - wo.setGroups( woGroupList ); - result.setData(wo); - - //projectCache.put( new Element(cacheKey, wo) ); - } catch (Exception e) { - Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //} - return result; - } - - private List checkGroup( Project project, List woGroupList) throws Exception { - if( ListTools.isEmpty( woGroupList )) { - return null; - } - for( WoGroup woGroup : woGroupList ) { - if( projectGroupQueryService.existsWithProjectAndGroup( woGroup.getId(), project.getId() ) ) { - woGroup.addProjectCount(1); - break; - } - } - return woGroupList; - } - - public static class Wo{ - - @FieldDescribe("所有分组信息") - private List groups = null; - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - } - - public static class WoGroup extends ProjectGroup{ - - @FieldDescribe("分组项目数量") - private Integer projectCount = 0; - - public Integer getProjectCount() { - return projectCount; - } - - public void setProjectCount(Integer projectCount) { - this.projectCount = projectCount; - } - - public void addProjectCount( Integer count ) { - if( this.projectCount == null ) { - this.projectCount =0; - } - this.projectCount += count; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static { - Excludes.add("creatorPerson"); - Excludes.add("owner"); - Excludes.add("updateTime"); - Excludes.add("distributeFactor"); - Excludes.add("sequence"); - } - - static WrapCopier copier = WrapCopierFactory.wo( ProjectGroup.class, WoGroup.class, null, Excludes); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/BaseAction.java deleted file mode 100644 index 61c9e0bb07..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/BaseAction.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.DynamicPersistService; -import com.x.teamwork.assemble.control.service.ProjectConfigQueryService; -import com.x.teamwork.assemble.control.service.ProjectGroupPersistService; -import com.x.teamwork.assemble.control.service.ProjectGroupQueryService; -import com.x.teamwork.assemble.control.service.ProjectPersistService; -import com.x.teamwork.assemble.control.service.ProjectQueryService; -import com.x.teamwork.assemble.control.service.SystemConfigQueryService; -import com.x.teamwork.assemble.control.service.TaskPersistService; -import com.x.teamwork.core.entity.Project; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache projectCache = ApplicationCache.instance().getCache( Project.class ); - - protected ProjectQueryService projectQueryService = new ProjectQueryService(); - - protected ProjectPersistService projectPersistService = new ProjectPersistService(); - - protected DynamicPersistService dynamicPersistService = new DynamicPersistService(); - - protected ProjectGroupQueryService projectGroupQueryService = new ProjectGroupQueryService(); - - protected ProjectGroupPersistService projectGroupPersistService = new ProjectGroupPersistService(); - - protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService(); - - protected ProjectConfigQueryService projectConfigQueryService = new ProjectConfigQueryService(); - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ProjectAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ProjectAction.java deleted file mode 100644 index 0d33b98f4a..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ProjectAction.java +++ /dev/null @@ -1,447 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.container.Suspended; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.JaxrsDescribe; -import com.x.base.core.project.annotation.JaxrsMethodDescribe; -import com.x.base.core.project.annotation.JaxrsParameterDescribe; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.http.HttpMediaType; -import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; - -@Path("project") -@JaxrsDescribe("项目信息管理") -public class ProjectAction extends StandardJaxrsAction { - - private Logger logger = LoggerFactory.getLogger(ProjectAction.class); - - @JaxrsMethodDescribe(value = "查询我的项目统计信息.", action = ActionStatisticMyProjects.class) - @GET - @Path("statitic/my") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void statiticMyProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStatisticMyProjects().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "查询我的项目组统计信息.", action = ActionStatisticMyProjectsGroups.class) - @GET - @Path("statitic/group") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void statiticMyProjectGroup(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStatisticMyProjectsGroups().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID查询项目信息.", action = ActionGet.class) - @GET - @Path("{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void get(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGet().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID给项目标星.", action = ActionStar.class) - @GET - @Path("star/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void star(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStar().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID取消项目标星.", action = ActionUnStar.class) - @GET - @Path("unstar/{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void unStar(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionUnStar().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示项目信息,按页码分页.", action = ActionListPageWithFilter.class) - @PUT - @Path("list/{page}/size/{size}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listPageWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("当前页码") @PathParam( "page" ) Integer page, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "size" ) Integer size, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListPageWithFilter().execute(request, effectivePerson, page, size, jsonElement ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示指定项目组中的项目信息,按页码分页.", action = ActionListPageInGroupWithFilter.class) - @PUT - @Path("list/{page}/size/{size}/group/{groupId}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listPageInGroupWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("当前页码") @PathParam( "page" ) Integer page, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "size" ) Integer size, - @JaxrsParameterDescribe("项目组ID") @PathParam( "groupId" ) String groupId, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListPageInGroupWithFilter().execute(request, effectivePerson, page, size, groupId, jsonElement ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示项目信息,下一页.", action = ActionListNextWithFilter.class) - @PUT - @Path("list/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示指定项目组中的项目信息,下一页.", action = ActionListNextInGroupWithFilter.class) - @PUT - @Path("list/{id}/next/{count}/group/{groupId}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listNextInGroupWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("项目组ID") @PathParam( "groupId" ) String groupId, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListNextInGroupWithFilter().execute(request, effectivePerson, id, count, groupId, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示已归档项目信息,下一页.", action = ActionListArchiveNextWithFilter.class) - @PUT - @Path("list/archive/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listArchiveNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListArchiveNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示已完成项目信息,下一页.", action = ActionListCompletedNextWithFilter.class) - @PUT - @Path("list/completed/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listCompletedNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListCompletedNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示我负责的项目信息,下一页.", action = ActionListMyNextWithFilter.class) - @PUT - @Path("list/my/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listMyNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListMyNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示未分类项目信息,下一页.", action = ActionListNoGroupNextWithFilter.class) - @PUT - @Path("list/groupness/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listNoGroupNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListNoGroupNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示标星项目信息,下一页.", action = ActionListStarNextWithFilter.class) - @PUT - @Path("list/star/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listStarNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListStarNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示回收站项目信息,下一页.", action = ActionListRecycleNextWithFilter.class) - @PUT - @Path("list/recycle/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listRecycleNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListRecycleNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "创建或者更新一个项目信息.", action = ActionSave.class) - @POST - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void save(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("需要保存的项目信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionSave().execute(request, effectivePerson, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "更新一个项目图标信息.", action = ActionUpdateIcon.class) - @PUT - @Path("{id}/icon") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void updateIcon(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id, - @JaxrsParameterDescribe("需要保存的项目图标信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionUpdateIcon().execute(request, effectivePerson, id, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识恢复项目.", action = ActionRecovery.class) - @GET - @Path("{id}/recovery") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void recoveryProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionRecovery().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识更改项目状态为已完成或未完成.", action = ActionComplete.class) - @PUT - @Path("{id}/complete") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void completeProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id, - @JaxrsParameterDescribe("需要保存的项目状态信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplete().execute(request, effectivePerson, id, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识设置项目是否可新建任务.", action = ActionCreateable.class) - @PUT - @Path("{id}/createable") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void createableProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id, - @JaxrsParameterDescribe("需要保存的项目状态信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionCreateable().execute(request, effectivePerson, id, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识删除项目信息.", action = ActionDelete.class) - @DELETE - @Path("{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void delete(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionDelete().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/WrapOutControl.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/WrapOutControl.java deleted file mode 100644 index 0fb4a5b842..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/WrapOutControl.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.project; - -import com.x.base.core.project.annotation.FieldDescribe; - -public class WrapOutControl { - - @FieldDescribe("是否可删除") - private Boolean delete = false; - - @FieldDescribe("是否可编辑") - private Boolean edit = false; - - @FieldDescribe("是否可排序") - private Boolean sortable = true; - - @FieldDescribe("是否创始人") - private Boolean founder = false; - - - @FieldDescribe("是否可新建任务") - private Boolean taskCreate = true; - - @FieldDescribe("是否可复制任务") - private Boolean taskCopy = true; - - @FieldDescribe("是否可删除任务") - private Boolean taskRemove = true; - - @FieldDescribe("是否可新建泳道") - private Boolean laneCreate = true; - - @FieldDescribe("是否可编辑泳道") - private Boolean laneEdit = true; - - @FieldDescribe("是否可删除泳道") - private Boolean laneRemove = true; - - @FieldDescribe("是否上传附件") - private Boolean attachmentUpload = true; - - @FieldDescribe("是否允许评论") - private Boolean comment = true; - - public Boolean getDelete() { - return delete; - } - - public void setDelete(Boolean delete) { - this.delete = delete; - } - - public Boolean getEdit() { - return edit; - } - - public void setEdit(Boolean edit) { - this.edit = edit; - } - - public Boolean getSortable() { - return sortable; - } - - public void setSortable(Boolean sortable) { - this.sortable = sortable; - } - - public Boolean getFounder() { - return founder; - } - - public void setFounder(Boolean founder) { - this.founder = founder; - } - - public Boolean getTaskCreate() { - return taskCreate; - } - - public void setTaskCreate(Boolean taskCreate) { - this.taskCreate = taskCreate; - } - - public Boolean getTaskCopy() { - return taskCopy; - } - - public void setTaskCopy(Boolean taskCopy) { - this.taskCopy = taskCopy; - } - - public Boolean getTaskRemove() { - return taskRemove; - } - - public void setTaskRemove(Boolean taskRemove) { - this.taskRemove = taskRemove; - } - - public Boolean getLaneCreate() { - return laneCreate; - } - - public void setLaneCreate(Boolean laneCreate) { - this.laneCreate = laneCreate; - } - - public Boolean getLaneEdit() { - return laneEdit; - } - - public void setLaneEdit(Boolean laneEdit) { - this.laneEdit = laneEdit; - } - - public Boolean getLaneRemove() { - return laneRemove; - } - - public void setLaneRemove(Boolean laneRemove) { - this.laneRemove = laneRemove; - } - - public Boolean getAttachmentUpload() { - return attachmentUpload; - } - - public void setAttachmentUpload(Boolean attachmentUpload) { - this.attachmentUpload = attachmentUpload; - } - - public Boolean getComment() { - return comment; - } - - public void setComment(Boolean comment) { - this.comment = comment; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionDelete.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionDelete.java deleted file mode 100644 index 037ca65e39..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionDelete.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.TaskListTemplate; - -public class ActionDelete extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionDelete.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - ProjectTemplate projectTemplate = null; - Boolean check = true; - Wo wo = new Wo(); - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new ProjectTemplateFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectTemplate = projectTemplateQueryService.get(flag); - if ( projectTemplate == null) { - check = false; - Exception exception = new ProjectTemplateNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据指定flag查询项模板目信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - projectTemplatePersistService.delete(flag, effectivePerson ); - - // 更新缓存 - ApplicationCache.notify( ProjectTemplate.class ); - ApplicationCache.notify( TaskListTemplate.class ); - - wo.setId( projectTemplate.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据指定flag删除项目模板信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - if( Boolean.TRUE.equals( check ) ){ - try { - Dynamic dynamic = dynamicPersistService.projectTemplateDeleteDynamic( projectTemplate, effectivePerson ); - if( dynamic != null ) { - List dynamics = new ArrayList<>(); - dynamics.add( WoDynamic.copier.copy( dynamic ) ); - if( wo != null ) { - wo.setDynamics(dynamics); - } - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - result.setData( wo ); - return result; - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionGet.java deleted file mode 100644 index aa5442715e..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionGet.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.TaskListTemplate; - -import net.sf.ehcache.Element; - -public class ActionGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - ProjectTemplate projectTemplate = null; - Boolean check = true; - List taskListTemplate = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( id ) ) { - check = false; - Exception exception = new ProjectTemplateFlagForQueryEmptyException(); - result.error( exception ); - } - - /*String cacheKey = ApplicationCache.concreteCacheKey( id ,effectivePerson); - Element element = projectTemplateCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else {*/ - if( Boolean.TRUE.equals( check ) ){ - try { - projectTemplate = projectTemplateQueryService.get( id ); - if ( projectTemplate == null) { - check = false; - Exception exception = new ProjectTemplateNotExistsException( id ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据指定flag查询项目模板信息对象时发生异常。id:" + id ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( projectTemplate ); - taskListTemplate = projectTemplateQueryService.getTaskListTemplateWithTemplateId(wo.getId()); - if( ListTools.isNotEmpty( taskListTemplate )) { - wo.setTaskListTemplate( WoTaskListTemplate.copier.copy( taskListTemplate )); - } - - //计算权限 - if( Boolean.TRUE.equals( check ) ){ - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( projectTemplate.getOwner() )){ - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( projectTemplate.getOwner() )){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。id:" + id); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - //projectTemplateCache.put(new Element(cacheKey, wo)); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectTemplateQueryException(e, "将查询出来的项目模板信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //} - return result; - } - - public static class Wo extends ProjectTemplate { - @FieldDescribe("项目模板权限") - private WrapOutControl control = null; - - @FieldDescribe("模板对应的泳道信息") - private List taskListTemplate = null; - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - public List getTaskListTemplate() { - return taskListTemplate; - } - - public void setTaskListTemplate(List taskListTemplate) { - this.taskListTemplate = taskListTemplate; - } - - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectTemplate.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - public static class WoTaskListTemplate extends TaskListTemplate { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskListTemplate.class, WoTaskListTemplate.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionList.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionList.java deleted file mode 100644 index 52fea61ccc..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionList.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.TaskListTemplate; - -import net.sf.ehcache.Element; - -public class ActionList extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionList.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List projectGroups = null; - Boolean check = true; - - /*if( Boolean.TRUE.equals( check ) ){ - try { - projectGroups = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - if( ListTools.isNotEmpty( projectGroups )) { - wos = Wo.copier.copy( projectGroups ); - - SortTools.asc( wos, "createTime"); - - result.setData(wos); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据用户拥有的项目组信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - }*/ - - return result; - } - - public static class Wo extends TaskListTemplate { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskListTemplate.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionListNextWithFilter.java deleted file mode 100644 index 4a804abf60..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionListNextWithFilter.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List queryProjectIds = new ArrayList<>(); - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( wrapIn == null ) { - wrapIn = new Wi(); - } - queryFilter = wrapIn.getQueryFilter(); - - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count, - wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = projectTemplateCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - try { - //获取用户能查看的所有的项目信息ID列表,最多查询2000条数据 - List projectIds = projectTemplateQueryService.listAllProjectTemplateIds( effectivePerson, 2000, queryFilter ); - if( ListTools.isNotEmpty( projectIds )) { - //直接根据可见项目ID列表进行分页查询 - Long total = Long.parseLong( projectIds.size() + "" ); - List projectList = projectTemplateQueryService.listWithProjectIdFilter( count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), projectIds ); - - if( ListTools.isNotEmpty( projectList )) { - WrapOutControl control = null; - for( ProjectTemplate project : projectList ) { - Wo wo = Wo.copier.copy(project); - - /*Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() ) - || project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { - control.setDelete( true ); - control.setEdit( true ); - control.setSortable( true ); - }else{ - control.setDelete( false ); - control.setEdit( false ); - control.setSortable( false ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control);*/ - wos.add( wo ); - } - } - resultObject = new ResultObject( total, wos ); - //projectTemplateCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wi extends WrapInQueryProjectTemplate{ - } - - public static class Wo extends ProjectTemplate { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectTemplate.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionStatisticProjectTemplates.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionStatisticProjectTemplates.java deleted file mode 100644 index 1dd9d124c0..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ActionStatisticProjectTemplates.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - - -import net.sf.ehcache.Element; - -public class ActionStatisticProjectTemplates extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionStatisticProjectTemplates.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - List projectTemplateIds = null; - List projectTemplateList = null; - List projectGroupList = null; - List woGroupList = new ArrayList<>(); - Business business = null; - Boolean check = true; - - Integer allCount = 0; - Integer myCount = 0; - - String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticProjectTemplates", effectivePerson.getDistinguishedName() ); - Element element = projectTemplateCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else { - if( Boolean.TRUE.equals( check ) ){ - try { - //查询所有模板 - projectTemplateIds = projectTemplateQueryService.listAllProjectTemplateIds( effectivePerson, 2000, new QueryFilter() ); - if( ListTools.isNotEmpty( projectTemplateIds )) { - projectTemplateList = projectTemplateQueryService.list( projectTemplateIds ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException( e, "查询所有项目模板信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我所有的项目组列表 - //projectGroupList = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - business = new Business(emc); - projectGroupList = business.projectTemplateFactory().fetchAllGroupType(effectivePerson.getDistinguishedName()); - } - - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException( e, "查询用户所有项目模板信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectTemplateList )) { - for( ProjectTemplate projectTemplate : projectTemplateList ) { - allCount++; - if( projectTemplate.getOwner().equalsIgnoreCase(effectivePerson.getDistinguishedName() )) { - myCount++; - } - } - } - } - - if(Boolean.TRUE.equals( check )){ - if( ListTools.isNotEmpty( projectGroupList )) { - for( String projectGroup : projectGroupList ) { - List templateLists = business.projectTemplateFactory().ListProjectTemplateWithType(projectGroup); - if(ListTools.isNotEmpty(templateLists)){ - List woTemplate = new ArrayList<>(); - WoGroup woGroup = new WoGroup(); - String type = ""; - woTemplate = WoTemplate.copier.copy( templateLists ); - for(ProjectTemplate templateList : templateLists){ - woGroup.addProjectTemplateTypeCount(1); - type = templateList.getType(); - } - woGroup.setProjecTemplatetTypeName(type); - woGroup.setWoTemplate(woTemplate); - woGroupList.add(woGroup); - } - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = new Wo(); - wo.setAllCount( allCount ); - wo.setMyCount(myCount); - //SortTools.asc( woGroupList, "projectTemplateTypeCount"); - wo.setGroups( woGroupList ); - projectTemplateCache.put( new Element(cacheKey, wo) ); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectTemplateQueryException(e, "将查询出来的应用项目模板信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wo{ - - @FieldDescribe("所有项目数量") - private Integer allCount = 0; - - @FieldDescribe("所有项目数量") - private Integer myCount = 0; - - @FieldDescribe("所有分组信息") - private List groups = null; - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public Integer getAllCount() { - return allCount; - } - - public void setAllCount(Integer allCount) { - this.allCount = allCount; - } - - public Integer getMyCount() { - return myCount; - } - - public void setMyCount(Integer myCount) { - this.myCount = myCount; - } - - } - - public static class WoTemplate extends ProjectTemplate{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( ProjectTemplate.class, WoTemplate.class, null, JpaObject.FieldsInvisible); - } - - public static class WoGroup{ - - @FieldDescribe("分组项目数量") - private Integer projectTemplateTypeCount = 0; - - @FieldDescribe("分组名称") - private String projecTemplatetTypeName; - - public String getProjecTemplatetName() { - return projecTemplatetTypeName; - } - - public void setProjecTemplatetTypeName(String projecTemplatetTypeName) { - this.projecTemplatetTypeName = projecTemplatetTypeName; - } - - public Integer getProjectTemplateTypeCount() { - return projectTemplateTypeCount; - } - - public void setProjectTemplateTypeCount(Integer projectTemplateTypeCount) { - this.projectTemplateTypeCount = projectTemplateTypeCount; - } - - public void addProjectTemplateTypeCount( Integer count ) { - if( this.projectTemplateTypeCount == null ) { - this.projectTemplateTypeCount =0; - } - this.projectTemplateTypeCount += count; - } - - @FieldDescribe("所有分组信息") - private List woTemplate = null; - - public List getWoTemplate() { - return woTemplate; - } - - public void setWoTemplate(List woTemplate) { - this.woTemplate = woTemplate; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ProjectTemplateAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ProjectTemplateAction.java deleted file mode 100644 index 958d174adc..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/ProjectTemplateAction.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.container.Suspended; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.JaxrsDescribe; -import com.x.base.core.project.annotation.JaxrsMethodDescribe; -import com.x.base.core.project.annotation.JaxrsParameterDescribe; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.http.HttpMediaType; -import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; - - -@Path("projectTemplate") -@JaxrsDescribe("项目模板信息管理") -public class ProjectTemplateAction extends StandardJaxrsAction { - - private Logger logger = LoggerFactory.getLogger(ProjectTemplateAction.class); - - @JaxrsMethodDescribe(value = "查询项目模板统计信息.", action = ActionStatisticProjectTemplates.class) - @GET - @Path("statitic/all") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void statiticMyProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStatisticProjectTemplates().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据ID查询项目模板信息.", action = ActionGet.class) - @GET - @Path("{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void get(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("项目组ID") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGet().execute( request, effectivePerson, id ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示项目信息,下一页.", action = ActionListNextWithFilter.class) - @PUT - @Path("list/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息数据的ID") @PathParam( "id" ) String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam( "count" ) Integer count, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionListNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "创建或者更新一个项目模板信息.", action = ActionSave.class) - @POST - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void save(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("需要保存的项目模板信息") JsonElement jsonElement ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionSave().execute(request, effectivePerson, jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据标识删除项目模板信息.", action = ActionDelete.class) - @DELETE - @Path("{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void delete(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionDelete().execute(request, effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapInQueryProjectTemplate.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapInQueryProjectTemplate.java deleted file mode 100644 index 1bb8a96cc8..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapInQueryProjectTemplate.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -public class WrapInQueryProjectTemplate { - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填, 默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,非必填.") - private String title = null; - - @FieldDescribe("用于搜索的项目模板类型,非必填.") - private String type = null; - - @FieldDescribe("是否已经删除,非必填") - private String deleted = null; - - @FieldDescribe("创建者,非必填") - private String owner = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - public void setOrderField(String orderField) { - this.orderField = orderField; - } - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getDeleted() { - return deleted; - } - public void setDeleted(String deleted) { - this.deleted = deleted; - } - public String getOwner() { - return owner; - } - public void setOwner(String owner) { - this.owner = owner; - } - public Long getRank() { - return rank; - } - public void setRank(Long rank) { - this.rank = rank; - } - - - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - queryFilter.setJoinType( "and" ); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "title", this.getTitle() ) ); - } - if( StringUtils.isNotEmpty( this.getType())) { - queryFilter.addEqualsTerm( new EqualsTerm( "type", this.getType() ) ); - } - if( StringUtils.isNotEmpty( this.getOwner())) { - queryFilter.addEqualsTerm( new EqualsTerm( "owner", this.getOwner() ) ); - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - return queryFilter; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapOutControl.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapOutControl.java deleted file mode 100644 index 06e6d3bc01..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/projectTemplate/WrapOutControl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.projectTemplate; - -import com.x.base.core.project.annotation.FieldDescribe; - -public class WrapOutControl { - - @FieldDescribe("是否可删除") - private Boolean delete = false; - - @FieldDescribe("是否可编辑") - private Boolean edit = false; - - @FieldDescribe("是否可排序") - private Boolean sortable = true; - - @FieldDescribe("是否创始人") - private Boolean founder = false; - - public Boolean getDelete() { - return delete; - } - - public void setDelete(Boolean delete) { - this.delete = delete; - } - - public Boolean getEdit() { - return edit; - } - - public void setEdit(Boolean edit) { - this.edit = edit; - } - - public Boolean getSortable() { - return sortable; - } - - public void setSortable(Boolean sortable) { - this.sortable = sortable; - } - - public Boolean getFounder() { - return founder; - } - - public void setFounder(Boolean founder) { - this.founder = founder; - } - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticMyProjects.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticMyProjects.java deleted file mode 100644 index 1fdd0ab5aa..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticMyProjects.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; - -import net.sf.ehcache.Element; - -public class ActionStatisticMyProjects extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionStatisticMyProjects.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - List projectIds = null; - List projectList = null; - List projectGroupList = null; - List woGroupList = null; - Boolean check = true; - - Integer allCount = 0; - Integer starCount = 0; - Integer myCount = 0; - Integer unGroupCount = 0; - Integer completedCount = 0; - Integer archiveCount = 0; - Integer deleteCount = 0; - - - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我参与的所有项目 - projectIds = projectQueryService.listAllProjectIds( effectivePerson, 2000, new QueryFilter() ); - if( ListTools.isNotEmpty( projectIds )) { - projectList = projectQueryService.list( projectIds ); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户参与的所有项目信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - //查询我所有的项目组列表 - projectGroupList = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - } catch (Exception e) { - check = false; - Exception exception = new ProjectQueryException( e, "查询用户所有项目组信息列表时发生异常。" ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectGroupList )) { - woGroupList = WoGroup.copier.copy( projectGroupList ); - SortTools.asc( woGroupList, "createTime"); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( ListTools.isNotEmpty( projectList )) { - for( Project project : projectList ) { - if(project.getDeleted() != null && project.getDeleted() ){ - deleteCount++; - }else{ - allCount++; - if( project.getStarPersonList() != null && project.getStarPersonList().contains( effectivePerson.getDistinguishedName() ) ) { - starCount++; - } - if( project.getCreatorPerson().equalsIgnoreCase(effectivePerson.getDistinguishedName() )) { - myCount++; - } - if( project.getGroupCount() == null || project.getGroupCount() == 0 ) { - unGroupCount++; - } - if( project.getCompleted() != null && project.getCompleted() ) { - completedCount++; - } - if( project.getArchive() != null && project.getArchive() ) { - archiveCount++; - } - woGroupList = checkGroup( project, woGroupList ); - } - - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = new Wo(); - wo.setAllCount( allCount ); - wo.setMyCount(myCount); - wo.setStarCount(starCount); - wo.setUnGroupCount(unGroupCount); - wo.setCompletedCount(completedCount); - wo.setArchiveCount(archiveCount); - wo.setDeleteCount(deleteCount); - if( ListTools.isNotEmpty( woGroupList )) { - SortTools.asc( woGroupList, "createTime"); - } - wo.setGroups( woGroupList ); - result.setData(wo); - } catch (Exception e) { - Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - private List checkGroup( Project project, List woGroupList) throws Exception { - if( ListTools.isEmpty( woGroupList )) { - return null; - } - for( WoGroup woGroup : woGroupList ) { - if( projectGroupQueryService.existsWithProjectAndGroup( woGroup.getId(), project.getId() ) ) { - woGroup.addProjectCount(1); - break; - } - } - return woGroupList; - } - - public static class Wo{ - - @FieldDescribe("所有项目数量") - private Integer allCount = 0; - - @FieldDescribe("所有项目数量") - private Integer starCount = 0; - - @FieldDescribe("所有项目数量") - private Integer myCount = 0; - - @FieldDescribe("所有项目数量") - private Integer unGroupCount = 0; - - @FieldDescribe("所有项目数量") - private Integer completedCount = 0; - - @FieldDescribe("所有项目数量") - private Integer archiveCount = 0; - - @FieldDescribe("所有项目数量") - private Integer deleteCount = 0; - - @FieldDescribe("所有分组信息") - private List groups = null; - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public Integer getAllCount() { - return allCount; - } - - public void setAllCount(Integer allCount) { - this.allCount = allCount; - } - - public Integer getStarCount() { - return starCount; - } - - public void setStarCount(Integer starCount) { - this.starCount = starCount; - } - - public Integer getMyCount() { - return myCount; - } - - public void setMyCount(Integer myCount) { - this.myCount = myCount; - } - - public Integer getUnGroupCount() { - return unGroupCount; - } - - public void setUnGroupCount(Integer unGroupCount) { - this.unGroupCount = unGroupCount; - } - - public Integer getCompletedCount() { - return completedCount; - } - - public void setCompletedCount(Integer completedCount) { - this.completedCount = completedCount; - } - - public Integer getArchiveCount() { - return archiveCount; - } - - public void setArchiveCount(Integer archiveCount) { - this.archiveCount = archiveCount; - } - - public Integer getDeleteCount() { - return deleteCount; - } - - public void setDeleteCount(Integer deleteCount) { - this.deleteCount = deleteCount; - } - } - - public static class WoGroup extends ProjectGroup{ - - @FieldDescribe("分组项目数量") - private Integer projectCount = 0; - - public Integer getProjectCount() { - return projectCount; - } - - public void setProjectCount(Integer projectCount) { - this.projectCount = projectCount; - } - - public void addProjectCount( Integer count ) { - if( this.projectCount == null ) { - this.projectCount =0; - } - this.projectCount += count; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static { - Excludes.add("creatorPerson"); - Excludes.add("owner"); - Excludes.add("updateTime"); - Excludes.add("distributeFactor"); - Excludes.add("sequence"); - } - - static WrapCopier copier = WrapCopierFactory.wo( ProjectGroup.class, WoGroup.class, null, Excludes); - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticTaskWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticTaskWithFilter.java deleted file mode 100644 index c2a475b036..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ActionStatisticTaskWithFilter.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionStatisticTaskWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionStatisticTaskWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - QueryFilter queryFilter = null; - String flag = null; - Integer count = 2000; - - - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new StatisticQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - - if( Boolean.TRUE.equals( check ) ){ - - try { - Long total = statisticQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = statisticQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - wos = Wo.copier.copy(taskList); - resultObject = new ResultObject( total, wos ); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - return result; - } - - public static class Wi extends WrapInQueryTask{ - } - - public static class Wo extends Task { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/BaseAction.java deleted file mode 100644 index 26b427f7fb..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/BaseAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.ProjectGroupPersistService; -import com.x.teamwork.assemble.control.service.ProjectGroupQueryService; -import com.x.teamwork.assemble.control.service.ProjectQueryService; -import com.x.teamwork.assemble.control.service.StatisticQueryService; -import com.x.teamwork.assemble.control.service.SystemConfigQueryService; -import com.x.teamwork.core.entity.Project; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache projectCache = ApplicationCache.instance().getCache( Project.class ); - - protected ProjectQueryService projectQueryService = new ProjectQueryService(); - - protected ProjectGroupQueryService projectGroupQueryService = new ProjectGroupQueryService(); - - protected ProjectGroupPersistService projectGroupPersistService = new ProjectGroupPersistService(); - - protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService(); - - protected StatisticQueryService statisticQueryService = new StatisticQueryService(); - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ProjectQueryException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ProjectQueryException.java deleted file mode 100644 index ad82ef8ff8..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/ProjectQueryException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import com.x.base.core.project.exception.PromptException; - -class ProjectQueryException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - ProjectQueryException( Throwable e ) { - super("系统在查询项目信息时发生异常。" , e ); - } - - ProjectQueryException( Throwable e, String message ) { - super("系统在查询项目信息时发生异常。Message:" + message, e ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticQueryException.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticQueryException.java deleted file mode 100644 index f4adf482d6..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticQueryException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import com.x.base.core.project.exception.PromptException; - -class StatisticQueryException extends PromptException { - - private static final long serialVersionUID = 1859164370743532895L; - - StatisticQueryException( Throwable e ) { - super("统计查询工作任务信息时发生异常。" , e ); - } - - StatisticQueryException( Throwable e, String message ) { - super("统计查询工作任务信息时发生异常。Message:" + message, e ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticsAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticsAction.java deleted file mode 100644 index 178ba44267..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticsAction.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.container.Suspended; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.JaxrsDescribe; -import com.x.base.core.project.annotation.JaxrsMethodDescribe; -import com.x.base.core.project.annotation.JaxrsParameterDescribe; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.http.HttpMediaType; -import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; - - -@Path("statistics") -@JaxrsDescribe("统计管理") -public class StatisticsAction extends StandardJaxrsAction { - - private Logger logger = LoggerFactory.getLogger(StatisticsAction.class); - - @JaxrsMethodDescribe(value = "查询我的项目统计信息.", action = ActionStatisticMyProjects.class) - @GET - @Path("statitic/my") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void statiticMyProject(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request ) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStatisticMyProjects().execute( request, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "列示工作任务信息,下一页.", action = ActionStatisticTaskWithFilter.class) - @PUT - @Path("statitic/{id}/next/{count}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void listNextWithFilter(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("查询过滤条件") JsonElement jsonElement ) { - ActionResult> result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionStatisticTaskWithFilter().execute(request, effectivePerson,jsonElement); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/WrapInQueryTask.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/WrapInQueryTask.java deleted file mode 100644 index e73b0f2bac..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/statistics/WrapInQueryTask.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.statistics; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -public class WrapInQueryTask { - - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的项目ID,单值,非必填.") - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作状态:草稿- draft | 执行中- processing | 已完成- completed | 已归档- archived,单值,非必填") - private String workStatus = null; - - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - @FieldDescribe("执行者或者负责人,单值,非必填") - private String executor = null; - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - /*if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - }*/ - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - return queryFilter; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionCopyTask.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionCopyTask.java deleted file mode 100644 index 0c102a80a5..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionCopyTask.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.service.BatchOperationPersistService; -import com.x.teamwork.assemble.control.service.BatchOperationProcessService; -import com.x.teamwork.assemble.control.service.UserManagerService; -import com.x.teamwork.core.entity.*; -import org.apache.commons.lang3.StringUtils; - -import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.List; - -/** - * 将指定的任务复制为新的工作任务 - */ -public class ActionCopyTask extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionCopyTask.class); - private UserManagerService userManagerService = new UserManagerService(); - - /** - * 将指定的任务复制为新的工作任务 - * 1、确认ID是否合法 - * 2、将Task,TaskDetail,以及TaskExtField复制一份 - * 3、调整ID,并且进行新任务的存储工作 - * 4、记录动态信息 - * - * @param request - * @param effectivePerson - * @param sourceTaskId - * @return - * @throws Exception - */ - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String sourceTaskId ) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = new Wo(); - Task sourceTask = null; - TaskDetail taskDetail = null; - TaskExtField taskExtField = null; - List dynamics = new ArrayList<>(); - Boolean check = true; - List groupIds = null; - List listIds = null; - - if ( StringUtils.isEmpty( sourceTaskId ) ) { - check = false; - Exception exception = new TaskTransformException("需要复制的工作任务ID不允许为空!"); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - sourceTask = taskQueryService.get( sourceTaskId ); - if ( sourceTask == null) { - check = false; - Exception exception = new TaskNotExistsException(sourceTaskId); - result.error( exception ); - } - groupIds = taskGroupQueryService.listGroupIdsByTask( sourceTask.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + sourceTaskId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - taskDetail = taskQueryService.getDetail( sourceTaskId ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + sourceTaskId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - taskExtField = taskQueryService.getExtField( sourceTaskId ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务扩展属性信息对象时发生异常。ID:" + sourceTaskId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - Task newTask = new Task(); - TaskDetail newTaskDetail = new TaskDetail(); - TaskExtField newTaskExtField = new TaskExtField(); - - if( Boolean.TRUE.equals( check ) ){ - //COPY对象 - sourceTask.copyTo( newTask ); - taskDetail.copyTo( newTaskDetail ); - taskExtField.copyTo( newTaskExtField ); - - //重新命名 - newTask.setName( sourceTask.getName() + " - 副本"); - - //调整负责人为当前用户 - newTask.setExecutor(effectivePerson.getDistinguishedName()); - newTask.setExecutorIdentity(userManagerService.getIdentityWithPerson( newTask.getExecutor(), "min")); - - //调整创建人为当前用户 - newTask.setCreatorPerson(effectivePerson.getDistinguishedName()); - - //调整ID - newTask.setId( Task.createId() ); - newTaskDetail.setId( newTask.getId() ); - newTaskExtField.setId( newTask.getId() ); - - try { - newTask = taskPersistService.save( newTask, newTaskDetail, newTaskExtField, effectivePerson ); - wo.setId( newTask.getId() ); - if(ListTools.isNotEmpty( groupIds )){ - if( !taskGroupQueryService.existsWithTaskAndGroup( groupIds.get(0), newTask.getId() )){ - //添加任务和任务组的关联 - taskGroupPersistService.addTaskToGroup( newTask.getId(),groupIds.get(0) ); - taskGroupPersistService.refreshTaskCountInTaskGroupWithTaskId( effectivePerson.getDistinguishedName(), newTask.getId() ); - listIds = taskListQueryService.listTaskListIdWithTaskId( sourceTask.getId(), groupIds.get(0)); - } - } - if(ListTools.isNotEmpty( listIds )){ - taskListPersistService.addTaskToTaskListWithOrderNumber( newTask.getId(), listIds.get(0), null, effectivePerson); - } - - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "工作上级任务ID信息更新时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - dynamics = dynamicPersistService.taskCopyDynamic( sourceTask, newTask, effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - new BatchOperationPersistService().addOperation( - BatchOperationProcessService.OPT_OBJ_TASK, - BatchOperationProcessService.OPT_TYPE_PERMISSION, newTask.getId(), newTask.getId(), "刷新文档权限:ID=" + sourceTask.getId() ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( ListTools.isNotEmpty( dynamics ) ) { - wo.setDynamics( WoDynamic.copier.copy( dynamics ) ); - } - - // 更新缓存 - ApplicationCache.notify( Task.class ); - ApplicationCache.notify( TaskList.class ); - ApplicationCache.notify( TaskView.class ); - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( TaskGroup.class ); - ApplicationCache.notify( Dynamic.class ); - - result.setData( wo ); - return result; - } - - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, ActionSave.WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java deleted file mode 100644 index 8ab18bcfa1..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java +++ /dev/null @@ -1,474 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.*; -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; - -import net.sf.ehcache.Element; - -public class ActionGet extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGet.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception { - ActionResult result = new ActionResult<>(); - Wo wo = null; - Task task = null; - TaskDetail taskDetail = null; - TaskExtField taskExtField = null; - List extFieldReleList = null; - List tags = null; - Boolean check = true; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( flag ) ) { - check = false; - Exception exception = new TaskFlagForQueryEmptyException(); - result.error( exception ); - } - - String cacheKey = ApplicationCache.concreteCacheKey( flag,effectivePerson ); - Element element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wo = (Wo) element.getObjectValue(); - result.setData( wo ); - } else { - if( Boolean.TRUE.equals( check ) ){ - try { - task = taskQueryService.get( flag ); - if ( task == null) { - check = false; - Exception exception = new TaskNotExistsException(flag); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - taskDetail = taskQueryService.getDetail( flag ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - taskExtField = taskQueryService.getExtField( flag ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务扩展属性信息对象时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - extFieldReleList = customExtFieldReleQueryService.listReleWithCorrelation( task.getId() ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定taskId查询任务扩展列配置信息对象时发生异常。taskId:" + task.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wo = Wo.copier.copy( task ); - if ( wo != null && taskDetail != null) { - wo.setDetail( taskDetail.getDetail() ); - wo.setDescription( taskDetail.getDescription() ); - } - - if( taskExtField != null ) { - wo.setExtField( WoTaskExtField.copier.copy( taskExtField )); - } - - if( ListTools.isNotEmpty( extFieldReleList )) { - List reles = WoExtFieldRele.copier.copy( extFieldReleList ) ; - for( WoExtFieldRele woExtFieldRele : reles ) { - woExtFieldRele.setValue( taskQueryService.getValueFromTaskExtField( taskExtField, woExtFieldRele.getExtFieldName() )); - } - wo.setExtFieldConfigs( reles ); - } - - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, task); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "将查询出来的工作任务信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - //计算权限 - if( Boolean.TRUE.equals( check ) ){ - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( task.getCreatorPerson() ) - || (ListTools.isNotEmpty(task.getManageablePersonList()) && task.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor( true ); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor( false ); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( task.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( task.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - - Project project = null; - project = projectQueryService.get(wo.getProject()); - if(project != null && (project.getDeleted() || project.getCompleted())){ - control.setEdit( false ); - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor( false ); - } - - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + flag); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - //查询任务所在的Group信息 - if( Boolean.TRUE.equals( check ) ){ - List groupIds = null; - try { - //groupIds = taskGroupQueryService.listGroupIdsByTask( task.getId() ); - groupIds = taskGroupQueryService.listGroupIdsByPersonAndProject(effectivePerson,task.getProject()); - if( ListTools.isNotEmpty( groupIds )){ - wo.setTaskGroupId( groupIds.get(0) ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - //查询任务所在的List信息 - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isNotEmpty(wo.getTaskGroupId() )){ - List listIds = null; - try { - listIds = taskListQueryService.listTaskListIdWithTaskId( task.getId(), wo.getTaskGroupId() ); - if( ListTools.isNotEmpty( listIds )){ - wo.setTaskListId( listIds.get(0) ); - }else{ - //返回当前项目的未分类taskListId - List taskList= null; - taskList = taskListQueryService.listWithTaskGroup( effectivePerson.getDistinguishedName(), wo.getTaskGroupId() ); - if(taskList !=null){ - wo.setTaskListId(taskList.get(0).getId()); - } - } - } catch (Exception e) { - Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - } - taskCache.put(new Element( cacheKey, wo )); - result.setData(wo); - return result; - } - - public static class Wo extends Task { - - @FieldDescribe("工作内容(128K)") - private String detail; - - @FieldDescribe("说明详细信息(10M)") - private String description; - - @FieldDescribe("扩展属性信息(对象)") - private WoTaskExtField extField; - - @FieldDescribe("任务标签(列表)") - private List tags = null; - - @FieldDescribe("所属项目的扩展列设定(配置列表)") - private List extFieldConfigs; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - @FieldDescribe("工作任务所属的工作任务组信息ID") - String taskGroupId = null; - - @FieldDescribe("工作任务所属的工作任务列表(泳道)信息ID") - String taskListId = null; - - private Long rank; - - public String getTaskGroupId() { - return taskGroupId; - } - - public void setTaskGroupId(String taskGroupId) { - this.taskGroupId = taskGroupId; - } - - public String getTaskListId() { - return taskListId; - } - - public void setTaskListId(String taskListId) { - this.taskListId = taskListId; - } - - public WoTaskExtField getExtField() { - return extField; - } - - public void setExtField(WoTaskExtField extField) { - this.extField = extField; - } - - public List getExtFieldConfigs() { - return extFieldConfigs; - } - - public void setExtFieldConfigs(List extFieldConfigs) { - this.extFieldConfigs = extFieldConfigs; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getDetail() { - return detail; - } - - public void setDetail(String detail) { - this.detail = detail; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskExtField extends TaskExtField { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskExtField.class, WoTaskExtField.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoExtFieldRele{ - - @FieldDescribe("关联ID(必填)") - private String correlationId; - - @FieldDescribe("备用列名(必填)") - private String extFieldName; - - @FieldDescribe("显示属性名称(必填)") - private String displayName; - - @FieldDescribe("类型:project|task(必填)") - private String type; - - @FieldDescribe("显示方式:TEXT|SELECT|MUTISELECT|RICHTEXT|DATE|DATETIME|PERSON|IDENTITY|UNIT|GROUP|(必填)") - private String displayType="TEXT"; - - @FieldDescribe("选择荐的备选数据,数据Json, displayType=SELECT|MUTISELECT时必须填写,否则无选择项") - private String optionsData; - - @FieldDescribe("排序号(非必填)") - private Integer order= 0 ; - - @FieldDescribe("是否允许为空(非必填)") - private Boolean nullable = true ; - - @FieldDescribe("说明信息(非必填)") - private String description; - - @FieldDescribe("属性值") - private String value = ""; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( CustomExtFieldRele.class, WoExtFieldRele.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - public String getExtFieldName() { - return extFieldName; - } - - public void setExtFieldName(String extFieldName) { - this.extFieldName = extFieldName; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - public String getDisplayType() { - return displayType; - } - - public void setDisplayType(String displayType) { - this.displayType = displayType; - } - - public String getOptionsData() { - return optionsData; - } - - public void setOptionsData(String optionsData) { - this.optionsData = optionsData; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public Boolean getNullable() { - return nullable; - } - - public void setNullable(Boolean nullable) { - this.nullable = nullable; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListMyTaskWithTaskList.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListMyTaskWithTaskList.java deleted file mode 100644 index fd4a0ce43f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListMyTaskWithTaskList.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.assemble.control.jaxrs.task.ActionListWithTaskList.WoSubTask; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; - -import net.sf.ehcache.Element; - -public class ActionListMyTaskWithTaskList extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListMyTaskWithTaskList.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String projectId, String taskListId ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Boolean check = true; - String cacheKey = null; - Element element = null; - List tags = null; - List subTasks = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( taskListId ) ) { - check = false; - Exception exception = new TaskListIdForQueryEmptyException( ); - result.error(exception); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListMyTaskWithTaskList", taskListId ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - List taskList = taskQueryService.listMyTaskWithTaskListId( projectId, taskListId, effectivePerson.getDistinguishedName() ); - Long total = 0L; - if( ListTools.isNotEmpty( taskList )) { - total = Long.parseLong( taskList.size() + "" ); - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - //添加一级子任务信息 - subTasks = taskQueryService.listTaskWithParentId( wo.getId(), effectivePerson ); - if( ListTools.isNotEmpty( subTasks )) { - wo.setSubTasks( WoSubTask.copier.copy( subTasks )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - //taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("一级子任务") - private List subTasks = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public List getSubTasks() { - return subTasks; - } - - public void setSubTasks(List subTasks) { - this.subTasks = subTasks; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListNextWithFilter.java deleted file mode 100644 index 54d79d5e56..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListNextWithFilter.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.assemble.control.jaxrs.task.ActionListWithTaskList.WoSubTask; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - List tags = null; - QueryFilter queryFilter = null; - List subTasks = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - List taskIds = null; - if( StringUtils.isNotEmpty( wrapIn.getTag() )) { - //查询该拥有该Tag的TaskId列表 - taskIds = taskTagQueryService.listTaskIdsWithTagContent( wrapIn.getTag(), null, effectivePerson.getDistinguishedName() ); - if( ListTools.isEmpty( taskIds )) { - taskIds = new ArrayList<>(); - taskIds.add( "NoOne" ); - } - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(taskIds)) ); - } - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - //添加一级子任务信息 - subTasks = taskQueryService.listTaskWithParentId( wo.getId(), effectivePerson ); - if( ListTools.isNotEmpty( subTasks )) { - wo.setSubTasks( WoSubTask.copier.copy( subTasks )); - } - - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends WrapInQueryTask{ - } - - public static class Wo extends Task { - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - @FieldDescribe("一级子任务") - private List subTasks = null; - - @FieldDescribe("任务标签") - private List tags = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public List getSubTasks() { - return subTasks; - } - - public void setSubTasks(List subTasks) { - this.subTasks = subTasks; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - -public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListPageWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListPageWithFilter.java deleted file mode 100644 index dd722afc6f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListPageWithFilter.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.assemble.control.jaxrs.task.ActionListWithTaskList.WoSubTask; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -import net.sf.ehcache.Element; - -public class ActionListPageWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListPageWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, Integer pageNum, Integer pageSize, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - List subTasks = null; - WrapOutControl control = null; - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - wrapIn.setDeleted("false"); - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - queryFilter = wrapIn.getQueryFilter(); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionListPage", effectivePerson.getDistinguishedName(), - pageNum, pageSize, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - List taskIds = null; - if( StringUtils.isNotEmpty( wrapIn.getTag() )) { - //查询该拥有该Tag的TaskId列表 - taskIds = taskTagQueryService.listTaskIdsWithTagContent( wrapIn.getTag(), null, effectivePerson.getDistinguishedName() ); - if( ListTools.isEmpty( taskIds )) { - taskIds = new ArrayList<>(); - taskIds.add( "NoOne" ); - } - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(taskIds)) ); - } - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, pageSize, pageNum, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - //添加一级子任务信息 - subTasks = taskQueryService.listTaskWithParentId( wo.getId(), effectivePerson ); - if( ListTools.isNotEmpty( subTasks )) { - wo.setSubTasks( WoSubTask.copier.copy( subTasks )); - } - - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends WrapInQueryTask{ - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - @FieldDescribe("一级子任务") - private List subTasks = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public List getSubTasks() { - return subTasks; - } - - public void setSubTasks(List subTasks) { - this.subTasks = subTasks; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListSubTaskWithTaskId.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListSubTaskWithTaskId.java deleted file mode 100644 index 6fbde5e4d7..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListSubTaskWithTaskId.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; - -public class ActionListSubTaskWithTaskId extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListSubTaskWithTaskId.class); - - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, String taskId ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - Task task = null; - List taskList = null; - Boolean check = true; - List tags = null; - - if ( StringUtils.isEmpty( taskId ) ) { - check = false; - Exception exception = new TaskFlagForQueryEmptyException(); - result.error( exception ); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - task = taskQueryService.get( taskId ); - if ( task == null) { - check = false; - Exception exception = new TaskNotExistsException(taskId); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务信息对象时发生异常。flag:" + taskId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - taskList = taskQueryService.listTaskWithParentId( taskId, effectivePerson ); - if( taskList == null ) { - taskList = new ArrayList<>(); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询子任务列表时发生异常。flag:" + taskId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - wos = Wo.copier.copy( taskList ); - if(ListTools.isNotEmpty( wos )) { - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - } - } - result.setCount( Long.parseLong( wos.size() + "" ) ); - result.setData( wos ); - } catch (Exception e) { - Exception exception = new TaskQueryException(e, "将查询出来的工作任务信息对象转换为可输出的数据信息时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - return result; - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoExtFieldRele{ - - @FieldDescribe("备用列名称") - private String extFieldName; - - @FieldDescribe("显示属性名称") - private String displayName; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( CustomExtFieldRele.class, WoExtFieldRele.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - public String getExtFieldName() { - return extFieldName; - } - - public void setExtFieldName(String extFieldName) { - this.extFieldName = extFieldName; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListWithTaskList.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListWithTaskList.java deleted file mode 100644 index 9b5372820d..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionListWithTaskList.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; - -import net.sf.ehcache.Element; - -public class ActionListWithTaskList extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionListWithTaskList.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String projectId, String taskListId ) throws Exception { - ActionResult> result = new ActionResult<>(); - ResultObject resultObject = null; - List wos = new ArrayList<>(); - Boolean check = true; - String cacheKey = null; - Element element = null; - List tags = null; - List subTasks = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( taskListId ) ) { - check = false; - Exception exception = new TaskListIdForQueryEmptyException( ); - result.error(exception); - } - - if( Boolean.TRUE.equals( check ) ){ - /*cacheKey = ApplicationCache.concreteCacheKey( "ActionListWithTaskList", taskListId ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else {*/ - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - List taskList = taskQueryService.listTaskWithTaskListId( projectId, taskListId, effectivePerson.getDistinguishedName() ); - Long total = 0L; - if( ListTools.isNotEmpty( taskList )) { - total = Long.parseLong( taskList.size() + "" ); - wos = Wo.copier.copy(taskList); - - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - //添加一级子任务信息 - subTasks = taskQueryService.listTaskWithParentId( wo.getId(), effectivePerson ); - if( ListTools.isNotEmpty( subTasks )) { - wo.setSubTasks( WoSubTask.copier.copy( subTasks )); - } - - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - resultObject = new ResultObject( total, wos ); - //taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询项目信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - //} - } - return result; - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - @FieldDescribe("一级子任务") - private List subTasks = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - - public List getSubTasks() { - return subTasks; - } - - public void setSubTasks(List subTasks) { - this.subTasks = subTasks; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoSubTask extends Task { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, WoSubTask.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java deleted file mode 100644 index 2fa74ef787..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java +++ /dev/null @@ -1,758 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.service.BatchOperationPersistService; -import com.x.teamwork.assemble.control.service.BatchOperationProcessService; -import com.x.teamwork.assemble.control.service.MessageFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskExtField; -import com.x.teamwork.core.entity.TaskGroup; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskStatuType; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.TaskView; - -public class ActionSave extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionSave.class); - - protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Task task = null; - Task oldTask = null; - Task parentTask = null; - TaskDetail oldTaskDetail = null; - Project project = null; - TaskGroup taskGroup = null; - Wi wi = null; - Boolean check = true; - Boolean split = false; - Wo wo = new Wo(); - List dynamics = new ArrayList<>(); - List tagDynamics = new ArrayList<>(); - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - oldTask = taskQueryService.get( wi.getId() ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + wi.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - oldTaskDetail = taskQueryService.getDetail( wi.getId() ); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + wi.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( wi.getProject() ) && oldTask != null ) { - wi.setProject( oldTask.getProject() ); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isEmpty( wi.getTaskGroupId() ) && StringUtils.isEmpty( wi.getProject() ) ) { - check = false; - Exception exception = new TaskGroupIdAndProjectEmptyException( ); - result.error(exception); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( StringUtils.isNotEmpty( wi.getTaskGroupId()) ) { - try { - taskGroup = taskGroupQueryService.get( wi.getTaskGroupId() ); - if( taskGroup == null ) { - check = false; - Exception exception = new TaskPersistException( "指定的工作任务组不存在!taskGroupId:" + wi.getTaskGroupId() ); - result.error(exception); - }else { - wi.setProject( taskGroup.getProject()); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "根据指定ID查询工作任务组信息对象时发生异常.taskGroupId:" + wi.getTaskGroupId() ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - project = projectQueryService.get( wi.getProject() ); - if( project == null ) { - check = false; - Exception exception = new TaskPersistException( "指定的项目信息不存在!projectID:" + wi.getProject() ); - result.error(exception); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "根据指定ID查询项目信息对象时发生异常.projectID:" + wi.getProject() ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if ( !taskPersistService.checkPermissionForPersist( project, effectivePerson ) ) { - check = false; - Exception exception = new TaskPersistException("task save permission denied!" ); - result.error(exception); - } - } - - if( Boolean.TRUE.equals( check ) ){ - if( taskGroup == null ) { - //查询默认的全部工作的taskGroup - taskGroup = taskGroupQueryService.getDefaultTaskGroupWithProject( effectivePerson, project.getId() ); - } - } - - if( Boolean.TRUE.equals( check ) ){ - //校验parentID, 确认上级任务是否存在, parentId = "0"或者为空都不会视为工作拆解 - if( StringUtils.isNotEmpty( wi.getParent() ) && !wi.getParent().equalsIgnoreCase( "0" ) && !wi.getParent().equalsIgnoreCase( wi.getId() )) { - try { - parentTask = taskQueryService.get( wi.getParent() ); - if( parentTask == null ) { - check = false; - Exception exception = new TaskPersistException("parent task not exists!PID=" + wi.getParent() ); - result.error(exception); - }else { - //判断是否是新的工作拆解操作 - if( StringUtils.isEmpty( wi.getId() ) || taskQueryService.get( wi.getId() ) == null ) { - split = true; //新增下级任务 - } - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + wi.getParent()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - //如果是标识为已完成,那么需要判断一下,该任务的所有下级任务是否全部都已经完成,否则不允许标识为已完成 - if( TaskStatuType.completed.name().equalsIgnoreCase( wi.getWorkStatus() )) { - List unCompletedTasks = taskQueryService.allUnCompletedSubTasks( wi.getId() ); - if( ListTools.isNotEmpty( unCompletedTasks )) { - check = false; - Exception exception = new TaskPersistException( "当前任务还有"+ unCompletedTasks.size() +"个子任务未完成,暂无法设定为已完成任务。"); - result.error(exception); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - TaskDetail taskDetail = new TaskDetail(); - taskDetail.setId( wi.getId() ); - taskDetail.setProject( project.getId() ); - taskDetail.setDescription( wi.getDescription() ); - taskDetail.setDetail( wi.getDetail() ); - - TaskExtField taskExtField = new TaskExtField(); - taskExtField.setId( wi.getId()); - taskExtField.setProject( project.getId() ); - taskExtField.setName( wi.getName() ); - taskExtField.setMemoString_1( wi.getMemoString_1() ); - taskExtField.setMemoString_2( wi.getMemoString_2() ); - taskExtField.setMemoString_3( wi.getMemoString_3() ); - taskExtField.setMemoString_4( wi.getMemoString_4() ); - taskExtField.setMemoString_5( wi.getMemoString_5() ); - taskExtField.setMemoString_6( wi.getMemoString_6() ); - taskExtField.setMemoString_7( wi.getMemoString_7() ); - taskExtField.setMemoString_8( wi.getMemoString_8() ); - taskExtField.setMemoString_1_lob( wi.getMemoString_1_lob() ); - taskExtField.setMemoString_2_lob( wi.getMemoString_2_lob() ); - taskExtField.setMemoString_3_lob( wi.getMemoString_3_lob() ); - taskExtField.setMemoString_4_lob( wi.getMemoString_4_lob() ); - - try { - wi.setProject( project.getId() ); - task = taskPersistService.save( Wi.copier.copy(wi), taskDetail, taskExtField, effectivePerson ); - - taskListPersistService.addTaskToTaskListWithOrderNumber( task.getId(), wi.getTaskListIds(), null, effectivePerson); - - wo.setId( task.getId() ); - - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "工作任务信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - //查询该任务和任务组的绑定情况 - if( Boolean.TRUE.equals( check ) ){ - if( !taskGroupQueryService.existsWithTaskAndGroup( wi.getTaskGroupId(), task.getId() )){ - //添加任务和任务组的关联 - taskGroupPersistService.addTaskToGroup( task.getId(), wi.getTaskGroupId() ); - taskGroupPersistService.refreshTaskCountInTaskGroupWithTaskId( effectivePerson.getDistinguishedName(), task.getId() ); - } - } - - //检查标签是否有变动 - if( Boolean.TRUE.equals( check ) ){ - //检查任务和标签的所有关联 - List tagIds = taskTagQueryService.listTagIdsWithTask( effectivePerson, task.getId() ); - if( ListTools.isNotEmpty( wi.getTaskTagIds() )) { - TaskTag taskTag = null; - for( String _tagId : wi.getTaskTagIds() ) { - try { - taskTag = taskTagQueryService.get( _tagId ); - if ( taskTag == null) { - check = false; - Exception exception = new TaskTagNotExistsException( _tagId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "根据指定flag查询应用工作任务标签信息对象时发生异常。ID:" + _tagId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - break; - } - if( !tagIds.contains( _tagId )) { - //需要新增 - taskTagPersistService.addTagRele( task, taskTag, effectivePerson ); - tagDynamics.add( dynamicPersistService.addTaskTagReleDynamic( task, taskTag, effectivePerson )); - } - } - if( check && ListTools.isNotEmpty( tagIds )) { - for( String _tagId : tagIds ) { - if( !wi.getTaskTagIds().contains( _tagId )) { - try { - taskTag = taskTagQueryService.get( _tagId ); - if ( taskTag == null) { - check = false; - Exception exception = new TaskTagNotExistsException( _tagId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "根据指定flag查询应用工作任务标签信息对象时发生异常。ID:" + _tagId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - break; - } - //需要删除 - taskTagPersistService.removeTagRele( task.getId(), _tagId, effectivePerson); - tagDynamics.add( dynamicPersistService.removeTaskTagReleDynamic( task, taskTag, effectivePerson )); - } - } - } - }else { - if( ListTools.isNotEmpty( tagIds )) { - TaskTag taskTag = null; - for( String _tagId : tagIds ) { - try { - taskTag = taskTagQueryService.get( _tagId ); - if ( taskTag == null) { - check = false; - Exception exception = new TaskTagNotExistsException( _tagId ); - result.error( exception ); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "根据指定flag查询应用工作任务标签信息对象时发生异常。ID:" + _tagId); - result.error(exception); - logger.error(e, effectivePerson, request, null); - break; - } - //需要删除 - taskTagPersistService.removeTagRele( task.getId(), _tagId, effectivePerson); - tagDynamics.add( dynamicPersistService.removeTaskTagReleDynamic( task, taskTag, effectivePerson )); - } - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - new BatchOperationPersistService().addOperation( - BatchOperationProcessService.OPT_OBJ_TASK, - BatchOperationProcessService.OPT_TYPE_PERMISSION, task.getId(), task.getId(), "刷新文档权限:ID=" + task.getId() ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - //记录父工作任务拆解的动态记录 - if( split && parentTask != null ) { - dynamics = new ArrayList<>(); - try { - dynamics.add( dynamicPersistService.taskSplitDynamic( parentTask, task, effectivePerson )); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - if( oldTask == null ) { - MessageFactory.message_to_teamWorkCreate( task ); - }else { - MessageFactory.message_to_teamWorkUpdate( task, null ); - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - //记录工作任务信息变化记录 - try { - if( ListTools.isNotEmpty( dynamics ) ) { - dynamicPersistService.taskSaveDynamic( oldTask, task, oldTaskDetail, effectivePerson, jsonElement.toString() ); - }else { - dynamics = dynamicPersistService.taskSaveDynamic( oldTask, task, oldTaskDetail, effectivePerson, jsonElement.toString() ); - } - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( ListTools.isEmpty( dynamics ) ) { - dynamics = new ArrayList<>(); - } - - // 更新缓存 - ApplicationCache.notify( Task.class ); - ApplicationCache.notify( TaskList.class ); - ApplicationCache.notify( TaskView.class ); - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( TaskGroup.class ); - ApplicationCache.notify( TaskExtField.class ); - - dynamics.addAll( tagDynamics ); - wo.setDynamics( WoDynamic.copier.copy( dynamics ) ); - result.setData( wo ); - return result; - } - - public static class Wi { - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, Task.class, null, null ); - - @FieldDescribe("数据库主键,非必填,自动生成.") - private String id; - - @FieldDescribe("所属项目ID,必填") - private String project; - - @FieldDescribe("父级工作任务ID,非必填.") - private String parent; - - @FieldDescribe("工作任务名称(40字),必填") - private String name; - - @FieldDescribe("工作任务概括(80字),非必填") - private String summay; - - @FieldDescribe("工作开始时间,非必填") - private Date startTime; - - @FieldDescribe("工作开始时间,非必填") - private Date endTime; - - @FieldDescribe("工作状态:processing | completed,非必填,默认processing") - private String workStatus = "processing"; - - @FieldDescribe("工作优先级:普通 | 紧急 | 特急 ,非必填") - private String priority; - - @FieldDescribe("提醒关联任务,非必填") - private Boolean remindRelevance; - - @FieldDescribe("执行者和负责人,必填") - private String executor; - - @FieldDescribe("执行者|负责人身份,非必填,若有则以identity为准") - private String executorIdentity; - - @FieldDescribe("工作内容(128K),非必填") - private String detail; - - @FieldDescribe("说明信息(10M),非必填") - private String description; - - @FieldDescribe("工作任务组ID,非必填,与taskListIds必须填写一种") - private String taskGroupId; - - @FieldDescribe("任务默认归类的任务列表ID,非必填,与taskGroupId必须填写一种") - private List taskListIds; - - @FieldDescribe("工作任务标签ID列表,非必填") - private List taskTagIds; - - @FieldDescribe("工作任务参与者,非必填") - private List participantList; - - @FieldDescribe("工作任务管理者,非必填") - private List manageablePersonList; - - @FieldDescribe("备用属性1(最大长度:255)") - private String memoString_1 = ""; - - @FieldDescribe("备用属性2(最大长度:255)") - private String memoString_2 = ""; - - @FieldDescribe("备用属性3(最大长度:255)") - private String memoString_3 = ""; - - @FieldDescribe("备用属性4(最大长度:255)") - private String memoString_4 = ""; - - @FieldDescribe("备用属性5(最大长度:255)") - private String memoString_5 = ""; - - @FieldDescribe("备用属性6(最大长度:255)") - private String memoString_6 = ""; - - @FieldDescribe("备用属性7(最大长度:255)") - private String memoString_7 = ""; - - @FieldDescribe("备用属性8(最大长度:255)") - private String memoString_8 = ""; - - @FieldDescribe("备用长文本1(最大长度:10M)") - private String memoString_1_lob = ""; - - @FieldDescribe("备用长文本2(最大长度:10M)") - private String memoString_2_lob = ""; - - @FieldDescribe("备用长文本3(最大长度:10M)") - private String memoString_3_lob = ""; - - @FieldDescribe("备用长文本4(最大长度:10M)") - private String memoString_4_lob = ""; - - public List getTaskTagIds() { - return taskTagIds; - } - - public void setTaskTagIds(List taskTagIds) { - this.taskTagIds = taskTagIds; - } - - public List getParticipantList() { - return participantList; - } - - public void setParticipantList(List participantList) { - this.participantList = participantList; - } - - public List getManageablePersonList() { - return manageablePersonList; - } - - public void setManageablePersonList(List manageablePersonList) { - this.manageablePersonList = manageablePersonList; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getDetail() { - return detail; - } - - public void setDetail(String detail) { - this.detail = detail; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getTaskListIds() { - return taskListIds; - } - - public void setTaskListIds(List taskListIds) { - this.taskListIds = taskListIds; - } - - public String getTaskGroupId() { - return taskGroupId; - } - - public void setTaskGroupId(String taskGroupId) { - this.taskGroupId = taskGroupId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSummay() { - return summay; - } - - public void setSummay(String summay) { - this.summay = summay; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public Boolean getRemindRelevance() { - return remindRelevance; - } - - public void setRemindRelevance(Boolean remindRelevance) { - this.remindRelevance = remindRelevance; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getExecutorIdentity() { - return executorIdentity; - } - - public void setExecutorIdentity(String executorIdentity) { - this.executorIdentity = executorIdentity; - } - - public String getMemoString_1() { - return memoString_1; - } - - public void setMemoString_1(String memoString_1) { - this.memoString_1 = memoString_1; - } - - public String getMemoString_2() { - return memoString_2; - } - - public void setMemoString_2(String memoString_2) { - this.memoString_2 = memoString_2; - } - - public String getMemoString_3() { - return memoString_3; - } - - public void setMemoString_3(String memoString_3) { - this.memoString_3 = memoString_3; - } - - public String getMemoString_4() { - return memoString_4; - } - - public void setMemoString_4(String memoString_4) { - this.memoString_4 = memoString_4; - } - - public String getMemoString_5() { - return memoString_5; - } - - public void setMemoString_5(String memoString_5) { - this.memoString_5 = memoString_5; - } - - public String getMemoString_6() { - return memoString_6; - } - - public void setMemoString_6(String memoString_6) { - this.memoString_6 = memoString_6; - } - - public String getMemoString_7() { - return memoString_7; - } - - public void setMemoString_7(String memoString_7) { - this.memoString_7 = memoString_7; - } - - public String getMemoString_8() { - return memoString_8; - } - - public void setMemoString_8(String memoString_8) { - this.memoString_8 = memoString_8; - } - - public String getMemoString_1_lob() { - return memoString_1_lob; - } - - public void setMemoString_1_lob(String memoString_1_lob) { - this.memoString_1_lob = memoString_1_lob; - } - - public String getMemoString_2_lob() { - return memoString_2_lob; - } - - public void setMemoString_2_lob(String memoString_2_lob) { - this.memoString_2_lob = memoString_2_lob; - } - - public String getMemoString_3_lob() { - return memoString_3_lob; - } - - public void setMemoString_3_lob(String memoString_3_lob) { - this.memoString_3_lob = memoString_3_lob; - } - - public String getMemoString_4_lob() { - return memoString_4_lob; - } - - public void setMemoString_4_lob(String memoString_4_lob) { - this.memoString_4_lob = memoString_4_lob; - } - - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, JpaObject.FieldsInvisible); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionUpdateSingleProperty.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionUpdateSingleProperty.java deleted file mode 100644 index db0c6827e9..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionUpdateSingleProperty.java +++ /dev/null @@ -1,428 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.service.BatchOperationPersistService; -import com.x.teamwork.assemble.control.service.BatchOperationProcessService; -import com.x.teamwork.assemble.control.service.MessageFactory; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskExtField; -import com.x.teamwork.core.entity.TaskStatuType; - -public class ActionUpdateSingleProperty extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger( ActionUpdateSingleProperty.class ); - - protected ActionResult execute( HttpServletRequest request, EffectivePerson effectivePerson, String taskId, JsonElement jsonElement ) throws Exception { - ActionResult result = new ActionResult<>(); - Task newTask = null; - Task oldTask = null; - TaskDetail oldDetail = null; - TaskExtField oldExtField = null; - Wi wi = null; - Wo wo = new Wo(); - Boolean check = true; - Dynamic dynamicInfo = new Dynamic(); - List dynamics = null; - - try { - wi = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - try { - oldTask = taskQueryService.get( taskId ); - if( oldTask == null ) { - check = false; - Exception exception = new TaskNotExistsException(taskId); - result.error(exception); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + taskId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - oldDetail = taskQueryService.getDetail( taskId ); - if( oldDetail == null ) { - oldDetail = new TaskDetail(); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务信息对象时发生异常。ID:" + taskId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - oldExtField = taskQueryService.getExtField( taskId ); - if( oldExtField == null ) { - oldExtField = new TaskExtField(); - } - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定ID查询工作任务扩展属性信息对象时发生异常。ID:" + taskId ); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - //如果是标识为已完成,那么需要判断一下,该任务的所有下级任务是否全部都已经完成,否则不允许标识为已完成 - if( Task.workStatus_FIELDNAME.equalsIgnoreCase(wi.getProperty()) && TaskStatuType.completed.name().equalsIgnoreCase( wi.getMainValue().toString() )) { - List unCompletedTasks = taskQueryService.allUnCompletedSubTasks( taskId ); - if( ListTools.isNotEmpty( unCompletedTasks )) { - check = false; - Exception exception = new TaskPersistException( "当前任务还有"+ unCompletedTasks.size() +"个子任务未完成,暂无法设定为已完成任务。"); - result.error(exception); - } - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - if( TaskDetail.description_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "任务说明", "UPDATE_DESCRIPTION", - wi.getProperty(), oldDetail.getDescription(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), true ); - } else if( TaskDetail.detail_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "详细内容", "UPDATE_DETAIL", - wi.getProperty(), oldDetail.getDetail(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), true ); - } else if( Task.workStatus_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "任务状态", "UPDATE_WORKSTATUS", - wi.getProperty(), oldTask.getWorkStatus(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - } else if( Task.priority_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "优先级", "UPDATE_PRIORITY", - wi.getProperty(), oldTask.getPriority(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - } else if( Task.name_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "任务名称", "UPDATE_NAME", - wi.getProperty(), oldTask.getName(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - } else if( Task.executor_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "工作负责人", "UPDATE_EXECUTOR", - wi.getProperty(), oldTask.getExecutor(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - //也要给新的工作负责人发送通知 - newTask = taskQueryService.get( taskId ); - } else if( Task.startTime_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "任务开始日期", "UPDATE_STARTDATE", - wi.getProperty(), oldTask.getExecutor(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - } else if( Task.endTime_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, "任务截止日期", "UPDATE_WORKDATE", - wi.getProperty(), oldTask.getExecutor(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType(), false ); - } else if( TaskExtField.memoString_1_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_1(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_2_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_2(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_3_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_3(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_4_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_4(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_5_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_5(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_6_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_6(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_7_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_7(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_8_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_8(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_1_lob_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_1_lob(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_2_lob_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_2_lob(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_3_lob_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_3_lob(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else if( TaskExtField.memoString_4_lob_FIELDNAME.equalsIgnoreCase( wi.getProperty() )) { - dynamicInfo = changeExtTaskProperty( - effectivePerson.getName(), oldTask.getProject(), taskId, wi.getProperty(), oldExtField.getMemoString_4_lob(), wi.getMainValue(), wi.getSecondaryValue(), wi.getDataType() ); - } else { - check = false; - Exception exception = new TaskPersistException( "工作任务属性暂不支持属性名称:" + wi.getProperty() ); - result.error(exception); - } - - // 缓存 - ApplicationCache.notify( Task.class ); - ApplicationCache.notify( Review.class ); - - wo.setId( taskId ); - - } catch (Exception e) { - check = false; - Exception exception = new TaskPersistException(e, "工作任务信息保存时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - new BatchOperationPersistService().addOperation( - BatchOperationProcessService.OPT_OBJ_TASK, - BatchOperationProcessService.OPT_TYPE_PERMISSION, oldTask.getId(), oldTask.getId(), "变更任务信息,刷新Review:ID=" + taskId ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - try { - MessageFactory.message_to_teamWorkUpdate( oldTask, newTask ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( Boolean.TRUE.equals( check ) ){ - //记录工作任务属性信息变化记录 - try { - dynamics = dynamicPersistService.taskUpdatePropertyDynamic( oldTask, dynamicInfo.getTitle(), dynamicInfo.getOptType(), dynamicInfo.getDescription(), effectivePerson ); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - } - } - - if( ListTools.isNotEmpty( dynamics ) ) { - wo.setDynamics( WoDynamic.copier.copy( dynamics ) ); - } - result.setData( wo ); - return result; - } - - private Dynamic changeTaskProperty( String personName, String projectId, String taskId, String dynamicTitle, String dynamicOptType, String property, String oldValue, String mainValue, String secondaryValue, String dataType, Boolean nullable ) throws Exception { - - taskPersistService.changeTaskProperty( taskId, property, mainValue, secondaryValue ); - if(Task.priority_FIELDNAME.equalsIgnoreCase( property )){ - mainValue = mainValue.split("\\|\\|")[0]; - } - if(mainValue.equals("completed")){ - mainValue = "已完成"; - } - if(mainValue.equals("processing")){ - mainValue = "执行中"; - } - String dynamicDescription = personName + "将工作任务的[" + dynamicTitle + "]变更为:[" + mainValue + "]。"; - if( StringUtils.isEmpty( mainValue ) && nullable ) { - Exception exception = new TaskPersistException( "工作任务属性["+ dynamicTitle +"]不允许为空,请检查您的输入。"); - throw exception; - } - if( StringUtils.isEmpty( mainValue ) ) { - if( StringUtils.isNotEmpty( oldValue )) { - dynamicDescription = personName + "清除了工作任务的["+dynamicTitle+"]信息["+ transferOrganNameToShort(oldValue) +"]。"; - } - }else { - if( StringUtils.isEmpty( oldValue ) ) { - if( "RichText".equalsIgnoreCase(dataType )) { - dynamicDescription =personName + "设置了工作任务属性["+ dynamicTitle +"]为:["+ transferOrganNameToShort(secondaryValue) +"]。"; - }else { - dynamicDescription = personName + "设置了工作任务属性["+ dynamicTitle +"]为:["+ transferOrganNameToShort(mainValue) +"]。"; - } - }else { - if( "RichText".equalsIgnoreCase(dataType )) { - dynamicDescription =personName + "将工作任务属性["+ dynamicTitle +"]变更为:["+ transferOrganNameToShort(secondaryValue) +"]。"; - }else { - dynamicDescription = personName + "将工作任务属性["+ dynamicTitle +"]变更为:["+ transferOrganNameToShort(mainValue) +"]。"; - } - } - } - //taskPersistService.changeTaskProperty( taskId, property, mainValue, secondaryValue ); - - Dynamic dynamic_info = new Dynamic(); - dynamic_info.setTitle( dynamicTitle ); - dynamic_info.setOptType( dynamicOptType ); - dynamic_info.setDescription( dynamicDescription ); - return dynamic_info; - } - - private Dynamic changeExtTaskProperty( String personName, String projectId, String taskId, String property, String oldValue, String mainValue, String secondaryValue, String dataType ) throws Exception { - CustomExtFieldRele projectExtFieldRele = customExtFieldReleQueryService.getExtFieldRele(projectId, property); - if( projectExtFieldRele == null || StringUtils.isEmpty( projectExtFieldRele.getDisplayName() )) { - Exception exception = new TaskPersistException( "工作任务未配置扩展属性:" + property ); - throw exception; - } - - String dynamicTitle = projectExtFieldRele.getDisplayName(); - String dynamicOptType = "UPDATE_EXTFIELD"; - String dynamicDescription = personName + "将工作任务的[" + dynamicTitle + "]变更为:[" + mainValue + "]。"; - if( StringUtils.isEmpty( mainValue ) && projectExtFieldRele.getNullable() ) { - Exception exception = new TaskPersistException( "工作任务属性["+ dynamicTitle +"]不允许为空,请检查您的输入。"); - throw exception; - } - - if( StringUtils.isEmpty( mainValue ) ) { - if( StringUtils.isNotEmpty( oldValue )) { - dynamicDescription = personName + "清除了工作任务的["+dynamicTitle+"]信息["+ transferOrganNameToShort(oldValue) +"]。"; - } - }else { - if( StringUtils.isEmpty( oldValue ) ) { - if( "RichText".equalsIgnoreCase(dataType )) { - dynamicDescription =personName + "设置了工作任务属性["+ dynamicTitle +"]为:["+ transferOrganNameToShort(secondaryValue) +"]。"; - }else { - dynamicDescription = personName + "设置了工作任务属性["+ dynamicTitle +"]为:["+ transferOrganNameToShort(mainValue) +"]。"; - } - }else { - if( "RichText".equalsIgnoreCase(dataType )) { - dynamicDescription =personName + "将工作任务属性["+ dynamicTitle +"]变更为:["+ transferOrganNameToShort(secondaryValue) +"]。"; - }else { - dynamicDescription = personName + "将工作任务属性["+ dynamicTitle +"]变更为:["+ transferOrganNameToShort(mainValue) +"]。"; - } - } - } - taskPersistService.changeTaskProperty( taskId, property, mainValue, secondaryValue ); - - Dynamic dynamic_info = new Dynamic(); - dynamic_info.setTitle( dynamicTitle ); - dynamic_info.setOptType( dynamicOptType ); - dynamic_info.setDescription( dynamicDescription ); - return dynamic_info; - } - - /** - * 将值里的所有数据中组织类别相关的数据改成简称,人员,身份,组织,群组等,适应列表数据(使用##分隔) - * @param oldValue - * @return - */ - private String transferOrganNameToShort(String oldValue) { - String[] array = oldValue.split("##"); - StringBuffer sb = new StringBuffer(); - if( array != null && array.length > 0) { - for( int i = 0; i< array.length; i++ ) { - if( i == 0) { - sb.append( array[i].split("@")[0]); - }else { - sb.append("##").append( array[i].split("@")[0]); - } - } - } - return sb.toString(); - } - - public static class Wi { - - public static WrapCopier copier = WrapCopierFactory.wi( Wi.class, Task.class, null, null ); - - @FieldDescribe("需要修改的属性标识,必填。" ) - private String property; - - @FieldDescribe("属性的主要值,必填") - private String mainValue; - - @FieldDescribe("属性次要值,如果工作任务时间中的结束时间,非必填") - private String secondaryValue; - - @FieldDescribe("值的类别Number|Text|RichText,默认Text,如果是RichText, secondaryValue需要填写去除标签的文字内容(<70字),会记录到动态内容") - private String dataType ="Text"; - - public String getDataType() { - return dataType; - } - - public void setDataType(String dataType) { - this.dataType = dataType; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - - public String getMainValue() { - return mainValue; - } - - public void setMainValue(String mainValue) { - this.mainValue = mainValue; - } - - public String getSecondaryValue() { - return secondaryValue; - } - - public void setSecondaryValue(String secondaryValue) { - this.secondaryValue = secondaryValue; - } - } - - public static class Wo extends WoId { - - @FieldDescribe("操作引起的动态内容") - List dynamics = new ArrayList<>(); - - public List getDynamics() { - return dynamics; - } - - public void setDynamics(List dynamics) { - this.dynamics = dynamics; - } - - } - - public static class WoDynamic extends Dynamic{ - - private static final long serialVersionUID = -5076990764713538973L; - - public static WrapCopier copier = WrapCopierFactory.wo( Dynamic.class, WoDynamic.class, null, null); - - private Long rank = 0L; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewAllListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewAllListNextWithFilter.java deleted file mode 100644 index 37ccf5b918..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewAllListNextWithFilter.java +++ /dev/null @@ -1,426 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -import net.sf.ehcache.Element; - -public class ActionViewAllListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionViewAllListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( projectId ) ) { - check = false; - Exception exception = new TaskProjectFlagForQueryEmptyException(); - result.error( exception ); - } - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setProject(projectId); - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionAllListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends GsonPropertyObject{ - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,单值,非必填.") - private String title = null; - - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作标签:自定义标签,单值,非必填.") - private String tag = null; - - @FieldDescribe("工作等级:普通-normal | 紧急-urgent | 特急-extraurgent,单值,非必填") - private String priority = null; - - @FieldDescribe("用于搜索的工作状态:草稿- draft | 执行中- processing | 已完成- completed | 已归档- archived,单值,非必填") - private String workStatus = null; - - @FieldDescribe("是否已完成,true|false,非必填") - private String completed = null; - - @FieldDescribe("是否已超时,true|false,非必填") - private String overtime = null; - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - @FieldDescribe("执行者或者负责人,单值,非必填") - private String executor = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getCompleted() { - return completed; - } - - public void setCompleted(String completed) { - this.completed = completed; - } - - public String getOvertime() { - return overtime; - } - - public void setOvertime(String overtime) { - this.overtime = overtime; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "name", "%" + this.getTitle() + "%" ) ); - } - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getPriority())) { - queryFilter.addEqualsTerm( new EqualsTerm( "priority", this.getPriority() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getOvertime() )) { - if( "true".equalsIgnoreCase( this.getOvertime() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", false ) ); - } - } - return queryFilter; - } - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewCompletedListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewCompletedListNextWithFilter.java deleted file mode 100644 index 4e9d645c93..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewCompletedListNextWithFilter.java +++ /dev/null @@ -1,425 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -import net.sf.ehcache.Element; - -public class ActionViewCompletedListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionViewCompletedListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( projectId ) ) { - check = false; - Exception exception = new TaskProjectFlagForQueryEmptyException(); - result.error( exception ); - } - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setProject(projectId); - wrapIn.setWorkStatus("completed"); - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionCompletedListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends GsonPropertyObject{ - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,单值,非必填.") - private String title = null; - - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作标签:自定义标签,单值,非必填.") - private String tag = null; - - @FieldDescribe("工作等级:普通-normal | 紧急-urgent | 特急-extraurgent,单值,非必填") - private String priority = null; - - private String workStatus = null; - - private String completed = null; - - @FieldDescribe("是否已超时,true|false,非必填") - private String overtime = null; - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - @FieldDescribe("执行者或者负责人,单值,非必填") - private String executor = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getCompleted() { - return completed; - } - - public void setCompleted(String completed) { - this.completed = completed; - } - - public String getOvertime() { - return overtime; - } - - public void setOvertime(String overtime) { - this.overtime = overtime; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "name", "%" + this.getTitle() + "%" ) ); - } - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getPriority())) { - queryFilter.addEqualsTerm( new EqualsTerm( "priority", this.getPriority() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getOvertime() )) { - if( "true".equalsIgnoreCase( this.getOvertime() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", false ) ); - } - } - return queryFilter; - } - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewMyExecutListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewMyExecutListNextWithFilter.java deleted file mode 100644 index 9c9681a986..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewMyExecutListNextWithFilter.java +++ /dev/null @@ -1,426 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -import net.sf.ehcache.Element; - -public class ActionViewMyExecutListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionViewMyExecutListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( projectId ) ) { - check = false; - Exception exception = new TaskProjectFlagForQueryEmptyException(); - result.error( exception ); - } - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setProject(projectId); - wrapIn.setExecutor(effectivePerson.getDistinguishedName()); - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - //queryFilter.addEqualsTerm( new EqualsTerm( "executor", effectivePerson.getDistinguishedName() ) ); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionMyExecutListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends GsonPropertyObject{ - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,单值,非必填.") - private String title = null; - - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作标签:自定义标签,单值,非必填.") - private String tag = null; - - @FieldDescribe("工作等级:普通-normal | 紧急-urgent | 特急-extraurgent,单值,非必填") - private String priority = null; - - @FieldDescribe("用于搜索的工作状态:草稿- draft | 执行中- processing | 已完成- completed | 已归档- archived,单值,非必填") - private String workStatus = null; - - @FieldDescribe("是否已完成,true|false,非必填") - private String completed = null; - - @FieldDescribe("是否已超时,true|false,非必填") - private String overtime = null; - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - private String executor = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getCompleted() { - return completed; - } - - public void setCompleted(String completed) { - this.completed = completed; - } - - public String getOvertime() { - return overtime; - } - - public void setOvertime(String overtime) { - this.overtime = overtime; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "name", "%" + this.getTitle() + "%" ) ); - } - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getPriority())) { - queryFilter.addEqualsTerm( new EqualsTerm( "priority", this.getPriority() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getOvertime() )) { - if( "true".equalsIgnoreCase( this.getOvertime() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", false ) ); - } - } - return queryFilter; - } - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewOverTimeListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewOverTimeListNextWithFilter.java deleted file mode 100644 index 905888dc6a..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewOverTimeListNextWithFilter.java +++ /dev/null @@ -1,425 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; - -import net.sf.ehcache.Element; - -public class ActionViewOverTimeListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionViewOverTimeListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( projectId ) ) { - check = false; - Exception exception = new TaskProjectFlagForQueryEmptyException(); - result.error( exception ); - } - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setProject(projectId); - wrapIn.setOvertime("true"); - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionOverTimeListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends GsonPropertyObject{ - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,单值,非必填.") - private String title = null; - - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作标签:自定义标签,单值,非必填.") - private String tag = null; - - @FieldDescribe("工作等级:普通-normal | 紧急-urgent | 特急-extraurgent,单值,非必填") - private String priority = null; - - @FieldDescribe("用于搜索的工作状态:草稿- draft | 执行中- processing | 已完成- completed | 已归档- archived,单值,非必填") - private String workStatus = null; - - @FieldDescribe("是否已完成,true|false,非必填") - private String completed = null; - - private String overtime = null; - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - @FieldDescribe("执行者或者负责人,单值,非必填") - private String executor = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getCompleted() { - return completed; - } - - public void setCompleted(String completed) { - this.completed = completed; - } - - public String getOvertime() { - return overtime; - } - - public void setOvertime(String overtime) { - this.overtime = overtime; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "name", "%" + this.getTitle() + "%" ) ); - } - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getPriority())) { - queryFilter.addEqualsTerm( new EqualsTerm( "priority", this.getPriority() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getOvertime() )) { - if( "true".equalsIgnoreCase( this.getOvertime() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", false ) ); - } - } - return queryFilter; - } - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewUncompletedListNextWithFilter.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewUncompletedListNextWithFilter.java deleted file mode 100644 index 69bf51d8db..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionViewUncompletedListNextWithFilter.java +++ /dev/null @@ -1,426 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.IsFalseTerm; -import com.x.teamwork.core.entity.tools.filter.term.LikeTerm; -import com.x.teamwork.core.entity.tools.filter.term.NotEqualsTerm; - -import net.sf.ehcache.Element; - -public class ActionViewUncompletedListNextWithFilter extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionViewUncompletedListNextWithFilter.class); - - protected ActionResult> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, Integer count, String projectId, JsonElement jsonElement ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = new ArrayList<>(); - ResultObject resultObject = null; - Wi wrapIn = null; - Boolean check = true; - String cacheKey = null; - Element element = null; - QueryFilter queryFilter = null; - List tags = null; - WrapOutControl control = null; - - if ( StringUtils.isEmpty( projectId ) ) { - check = false; - Exception exception = new TaskProjectFlagForQueryEmptyException(); - result.error( exception ); - } - if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) { - flag = null; - } - - try { - wrapIn = this.convertToWrapIn(jsonElement, Wi.class); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - - if( Boolean.TRUE.equals( check ) ){ - if( Boolean.TRUE.equals( check ) ){ - wrapIn.setProject(projectId); - wrapIn.setWorkStatus("processing"); - wrapIn.setDeleted("false"); - queryFilter = wrapIn.getQueryFilter(); - } - } - - if( Boolean.TRUE.equals( check ) ){ - cacheKey = ApplicationCache.concreteCacheKey( "ActionUncompletedListNext", effectivePerson.getDistinguishedName(), - flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() ); - element = taskCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - resultObject = (ResultObject) element.getObjectValue(); - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } else { - Business business = null; - try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) { - business = new Business(bc); - } - try { - - Long total = taskQueryService.countWithFilter( effectivePerson, queryFilter ); - List taskList = taskQueryService.listWithFilter( effectivePerson, count, flag, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter ); - - if( ListTools.isNotEmpty( taskList )) { - wos = Wo.copier.copy(taskList); - for( Wo wo : wos ) { - tags = taskTagQueryService.listWithTaskAndPerson(effectivePerson, wo ); - if( ListTools.isNotEmpty( tags )) { - wo.setTags( WoTaskTag.copier.copy( tags )); - } - try { - control = new WrapOutControl(); - if( business.isManager(effectivePerson) - || effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson() ) - || (ListTools.isNotEmpty(wo.getManageablePersonList()) && wo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() ))){ - control.setDelete( true ); - control.setSortable( true ); - control.setChangeExecutor(true); - }else{ - control.setDelete( false ); - control.setSortable( false ); - control.setChangeExecutor(false); - } - control.setEdit( true ); - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getExecutor())){ - control.setChangeExecutor( true ); - } - if(effectivePerson.getDistinguishedName().equalsIgnoreCase( wo.getCreatorPerson())){ - control.setFounder( true ); - }else{ - control.setFounder( false ); - } - wo.setControl(control); - } catch (Exception e) { - check = false; - Exception exception = new TaskQueryException(e, "根据指定flag查询工作任务权限信息时发生异常。flag:" + wo.getId()); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - } - - resultObject = new ResultObject( total, wos ); - taskCache.put(new Element( cacheKey, resultObject )); - - result.setCount( resultObject.getTotal() ); - result.setData( resultObject.getWos() ); - } catch (Exception e) { - check = false; - logger.warn("系统查询工作任务信息列表时发生异常!"); - result.error(e); - logger.error(e, effectivePerson, request, null); - } - } - } - return result; - } - - public static class Wi extends GsonPropertyObject{ - @FieldDescribe("用于排列的属性,非必填,默认为createTime.") - private String orderField = "createTime"; - - @FieldDescribe("排序方式:DESC | ASC,非必填,默认为DESC.") - private String orderType = "DESC"; - - @FieldDescribe("用于搜索的标题,单值,非必填.") - private String title = null; - - private String project = null; - - @FieldDescribe("用于搜索的上级工作任务ID,单值,非必填.") - private String parentId = null; - - @FieldDescribe("用于搜索的工作标签:自定义标签,单值,非必填.") - private String tag = null; - - @FieldDescribe("工作等级:普通-normal | 紧急-urgent | 特急-extraurgent,单值,非必填") - private String priority = null; - - private String workStatus = null; - - private String completed = null; - - @FieldDescribe("是否已超时,true|false,非必填") - private String overtime = null; - - @FieldDescribe("是否已经删除,true|false,非必填") - private String deleted = null; - - @FieldDescribe("执行者或者负责人,单值,非必填") - private String executor = null; - - private Long rank = 0L; - - public String getOrderField() { - return orderField; - } - - public void setOrderField(String orderField) { - this.orderField = orderField; - } - - public String getOrderType() { - return orderType; - } - - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public String getCompleted() { - return completed; - } - - public void setCompleted(String completed) { - this.completed = completed; - } - - public String getOvertime() { - return overtime; - } - - public void setOvertime(String overtime) { - this.overtime = overtime; - } - - public String getDeleted() { - return deleted; - } - - public void setDeleted(String deleted) { - this.deleted = deleted; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - /** - * 根据传入的查询参数,组织一个完整的QueryFilter对象 - * @return - */ - public QueryFilter getQueryFilter() { - QueryFilter queryFilter = new QueryFilter(); - //组织查询条件对象 - if( StringUtils.isNotEmpty( this.getTitle() )) { - queryFilter.addLikeTerm( new LikeTerm( "name", "%" + this.getTitle() + "%" ) ); - } - if( StringUtils.isNotEmpty( this.getProject() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "project", this.getProject() ) ); - } - if( StringUtils.isNotEmpty( this.getParentId() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "parent", this.getParentId() ) ); - } - if( StringUtils.isNotEmpty( this.getPriority())) { - queryFilter.addEqualsTerm( new EqualsTerm( "priority", this.getPriority() ) ); - } - if( StringUtils.isNotEmpty( this.getWorkStatus() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "workStatus", this.getWorkStatus() ) ); - }else { - //默认查询所有的未归档的工作任务 - queryFilter.addIsFalseTerm( new IsFalseTerm("archive")); - } - if( StringUtils.isNotEmpty( this.getExecutor())) { - queryFilter.addEqualsTerm( new EqualsTerm( "executor", this.getExecutor() ) ); - } - if( StringUtils.isNotEmpty( this.getCompleted() )) { - if( "true".equalsIgnoreCase( this.getCompleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "completed", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getDeleted() )) { - if( "true".equalsIgnoreCase( this.getDeleted() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - } - } - if( StringUtils.isNotEmpty( this.getOvertime() )) { - if( "true".equalsIgnoreCase( this.getOvertime() )) { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", true ) ); - }else { - queryFilter.addEqualsTerm( new EqualsTerm( "overtime", false ) ); - } - } - return queryFilter; - } - } - - public static class Wo extends Task { - - @FieldDescribe("任务标签") - private List tags = null; - - @FieldDescribe("任务权限") - private WrapOutControl control = null; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - public WrapOutControl getControl() { - return control; - } - - public void setControl(WrapOutControl control) { - this.control = control; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( Task.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class WoTaskTag extends TaskTag { - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( TaskTag.class, WoTaskTag.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } - - public static class ResultObject { - - private Long total; - - private List wos; - - public ResultObject() {} - - public ResultObject(Long count, List data) { - this.total = count; - this.wos = data; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } - - public List getWos() { - return wos; - } - - public void setWos(List wos) { - this.wos = wos; - } - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java deleted file mode 100644 index 3383a836c8..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.task; - -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.teamwork.assemble.control.service.*; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskView; - -import net.sf.ehcache.Ehcache; - -public class BaseAction extends StandardJaxrsAction { - - protected Ehcache taskCache = ApplicationCache.instance().getCache( Task.class ); - - protected Ehcache taskViewCache = ApplicationCache.instance().getCache( TaskView.class ); - - protected TaskQueryService taskQueryService = new TaskQueryService(); - - protected TaskTagQueryService taskTagQueryService = new TaskTagQueryService(); - - protected TaskTagPersistService taskTagPersistService = new TaskTagPersistService(); - - protected ProjectQueryService projectQueryService = new ProjectQueryService(); - - protected CustomExtFieldReleQueryService customExtFieldReleQueryService = new CustomExtFieldReleQueryService(); - - protected TaskPersistService taskPersistService = new TaskPersistService(); - - protected TaskListPersistService taskListPersistService = new TaskListPersistService(); - - protected TaskListQueryService taskListQueryService = new TaskListQueryService(); - - protected TaskGroupQueryService taskGroupQueryService = new TaskGroupQueryService(); - - protected TaskGroupPersistService taskGroupPersistService = new TaskGroupPersistService(); - - protected TaskViewQueryService taskViewQueryService = new TaskViewQueryService(); - - protected DynamicPersistService dynamicPersistService = new DynamicPersistService(); - - public static class TaskListChange { - - @FieldDescribe("转移前的列表ID") - private String source; - - @FieldDescribe("转移后的列表ID") - private String target; - - public TaskListChange() {} - - public TaskListChange( String _source, String _target ) { - this.source = _source; - this.target = _target; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - } - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/taskListTemplate/ActionList.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/taskListTemplate/ActionList.java deleted file mode 100644 index 3770d3cf91..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/taskListTemplate/ActionList.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.x.teamwork.assemble.control.jaxrs.taskListTemplate; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.base.core.project.tools.SortTools; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.TaskListTemplate; - -import net.sf.ehcache.Element; - -public class ActionList extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionList.class); - - @SuppressWarnings("unchecked") - protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception { - ActionResult> result = new ActionResult<>(); - List wos = null; - List taskListTemplates = null; - Boolean check = true; - - /*String cacheKey = ApplicationCache.concreteCacheKey( "list.taskListTemplates", effectivePerson.getDistinguishedName() ); - Element element = projectGroupCache.get( cacheKey ); - - if ((null != element) && (null != element.getObjectValue())) { - wos = (List) element.getObjectValue(); - result.setData( wos ); - } else { - - if( Boolean.TRUE.equals( check ) ){ - try { - projectGroups = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() ); - if( ListTools.isNotEmpty( projectGroups )) { - wos = Wo.copier.copy( projectGroups ); - - SortTools.asc( wos, "createTime"); - - projectGroupCache.put(new Element(cacheKey, wos)); - result.setData(wos); - } - } catch (Exception e) { - check = false; - Exception exception = new ProjectTemplateQueryException(e, "根据用户拥有的项目组信息列表时发生异常。"); - result.error(exception); - logger.error(e, effectivePerson, request, null); - } - } - //}*/ - return result; - } - - public static class Wo extends ProjectGroup { - - private Long rank; - - public Long getRank() { - return rank; - } - - public void setRank(Long rank) { - this.rank = rank; - } - - private static final long serialVersionUID = -5076990764713538973L; - - public static List Excludes = new ArrayList(); - - static WrapCopier copier = WrapCopierFactory.wo( ProjectGroup.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); - - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java deleted file mode 100644 index 3326748d83..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.BatchOperation; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; - -/** - * 批处理操作执行 - */ -public class BatchOperationProcessService { - - public static String OPT_OBJ_TASK = "TASK"; - public static String OPT_OBJ_PROJECT = "PROJECT"; - public static String OPT_OBJ_TASKLIST = "TASKLIST"; - public static String OPT_TYPE_PERMISSION = "PERMISSION"; - public static String OPT_TYPE_UPDATENAME = "UPDATENAME"; - public static String OPT_TYPE_DELETE = "DELETE"; - - private static Logger logger = LoggerFactory.getLogger( BatchOperationProcessService.class ); - private TaskService taskService = new TaskService(); - private ReviewService reviewService = new ReviewService(); - /** - * 批处理操作执行 - * @param batchOperation - * @return - * @throws Exception - */ - public String process( BatchOperation batchOperation ) throws Exception { - logger.info( "process -> Task processing batch operation: " + batchOperation.toString() ); - //先把batchOperation状态修改为执行中 - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - batchOperation = emc.find( batchOperation.getId(), BatchOperation.class ); - batchOperation.setIsRunning( true ); - emc.beginTransaction( BatchOperation.class ); - emc.check( batchOperation, CheckPersistType.all ); - logger.info( "process -> Task change batch operation running......: " ); - emc.commit(); - } catch (Exception e) { - throw e; - } - - if( "TASK".equalsIgnoreCase( batchOperation.getObjType() )) { - if( "PERMISSION".equalsIgnoreCase( batchOperation.getOptType() )) {//工作任务处理 - //重新计算指定任务所有的Review信息 - refreshTaskReview( batchOperation.getId(), batchOperation.getBundle() ); - }else if( "DELETE".equalsIgnoreCase( batchOperation.getOptType() )) { - //删除工作任务,并且修改分类所属的栏目中的分类数量和工作任务数量 - deleteTaskReview( batchOperation.getId(), batchOperation.getBundle() ); - } - }else if( "PROJECT".equalsIgnoreCase( batchOperation.getObjType() )) { - //重新计算项目涉及的任务所有的Review信息 - if( "PERMISSION".equalsIgnoreCase( batchOperation.getOptType() )) { - //分类修改权限 - refreshTaskReviewInProject( batchOperation.getId(), batchOperation.getBundle() ); - }else if( "DELETE".equalsIgnoreCase( batchOperation.getOptType() )) { - //删除工作任务,并且修改分类所属的栏目中的分类数量和工作任务数量 - deleteTaskInProject( batchOperation.getId(), batchOperation.getBundle() ); - } - } - logger.info( "task batch operation process completed." ); - return "error"; - } - - /** - * 根据数据库中的工作任务的信息,重新计算工作任务的Review信息,全部删除,然后再重新插入Review记录 - * @param id - * @param taskId - * @throws Exception - */ - private void refreshTaskReview( String id, String taskId ) throws Exception { - BatchOperation batchOperation = null; - Task task = null; - Project project = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - batchOperation = emc.find( id, BatchOperation.class ); - task = emc.find( taskId, Task.class ); - if( task != null ) { - project = emc.find( task.getProject(), Project.class ); - - emc.beginTransaction( Task.class ); - task.setReviewed( true ); - if( project != null ) { - task.setProjectName( project.getTitle() ); - } - if( StringUtils.isEmpty( task.getParent() )) { - task.setParent( "0" ); - } - if( StringUtils.equals( task.getId(), task.getParent() )) { - task.setParent( "0" ); - } - emc.check( task, CheckPersistType.all ); - emc.commit(); - } - - //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>reviewService.refreshTaskReview......"); - reviewService.refreshTaskReview( emc, taskId ); - - if( batchOperation != null ) { - //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>delete batch operation......"); - emc.beginTransaction( BatchOperation.class ); - emc.remove( batchOperation, CheckRemoveType.all ); - logger.info( "refreshTaskReview -> task delete batch operation: " + batchOperation.toString() ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( Task.class ); - } - - /** - * 删除指定工作任务的所有Review信息 - * @param id - * @param taskId - * @throws Exception - */ - private void deleteTaskReview(String id, String taskId) throws Exception { - BatchOperation batchOperation = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - batchOperation = emc.find( id, BatchOperation.class ); - logger.info( "deleteTaskReview -> delete all reviews for task: " + taskId ); - reviewService.deleteTaskReview( emc, taskId ); - if( batchOperation != null ) { - emc.beginTransaction( BatchOperation.class ); - emc.remove( batchOperation, CheckRemoveType.all ); - logger.info( "deleteTaskReview -> task delete batch operation: " + batchOperation.toString() ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( Task.class ); - } - - /** - * 重新计算指定项目中所有工作任务的Review信息 - * @param id batch_id - * @param projectId - * @throws Exception - */ - private void refreshTaskReviewInProject( String id, String projectId ) throws Exception { - BatchOperation batchOperation = null; - Business business = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - business = new Business(emc); - batchOperation = emc.find( id, BatchOperation.class ); - //查询项目中所有的工作任务,重发为工作任务Review更新, 增加删除栏目批量操作(对分类和工作任务)的信息 - List ids = business.taskFactory().listByProject( projectId ); - List taskList = null; - Long count = business.taskFactory().countWithProject( projectId ); - logger.info( "refreshTaskReviewInProject -> There are : " + count + " tasks need to refresh review......" ); - - if(ListTools.isNotEmpty( ids )) { - taskList = emc.list( Task.class, ids); - } - if( ListTools.isNotEmpty( taskList )) { - Integer total = taskList.size(); - Integer current = 0; - BatchOperationPersistService batchOperationPersistService = new BatchOperationPersistService(); - for( Task task : taskList ) { - current++; - emc.beginTransaction(Task.class ); - task.setReviewed( false ); - emc.check( task, CheckPersistType.all ); - emc.commit(); - - logger.info( "refreshTaskReviewInProject -> Send ["+ current +"/"+total+"]task permission operation to queue[queueBatchOperation], task:" + task.getName() ); - batchOperationPersistService.addOperation( - BatchOperationProcessService.OPT_OBJ_TASK, - BatchOperationProcessService.OPT_TYPE_PERMISSION, task.getId(), task.getId(), "项目变更引起工作任务Review变更:ID=" + task.getId() ); - } - } - if( batchOperation != null ) { - emc.beginTransaction( BatchOperation.class ); - emc.remove( batchOperation, CheckRemoveType.all ); - logger.info( "refreshTaskReviewInProject -> task delete batch operation: " + batchOperation.toString() ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 将项目下所有的工作任务及Review删除,最后删除当前的批处理信息 - * @param id - * @param projectId - * @throws Exception - */ - private void deleteTaskInProject( String id, String projectId ) throws Exception { - /*Integer totalWhileCount = 0; - Integer currenteWhileCount = 0; - List taskIds = null; - Task task = null;*/ - BatchOperation batchOperation = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - //Business business = new Business(emc); - batchOperation = emc.find( id, BatchOperation.class ); - - /*taskIds = business.taskFactory().listByProject(projectId); - - if( ListTools.isNotEmpty( taskIds )) { - for( String taskId : taskIds ) { - task = emc.find( taskId, Task.class ); - if( task != null ) { - taskService.remove( emc, taskId ); - new BatchOperationPersistService().addOperation( - BatchOperationProcessService.OPT_OBJ_TASK, - BatchOperationProcessService.OPT_TYPE_DELETE, id, id, "项目删除引起工作任务删除:ID=" + id ); - logger.info( "deleteTaskInApp -> task processing batch operation: remove task("+ currenteWhileCount +"/" + totalWhileCount + "): " + taskId ); - } - } - }*/ - if( batchOperation != null ) { - emc.beginTransaction( BatchOperation.class ); - emc.remove( batchOperation, CheckRemoveType.all ); - logger.info( "deleteTaskInApp -> task delete batch operation: " + batchOperation.toString() ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - ApplicationCache.notify( Task.class ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldRelePersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldRelePersistService.java deleted file mode 100644 index ac2312ae2b..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldRelePersistService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -public class CustomExtFieldRelePersistService { - - private CustomExtFieldReleService customExtFieldReleService = new CustomExtFieldReleService(); - - /** - * 删除扩展属性信息 - * @param flag - * @param effectivePerson - * @throws Exception - */ - public void delete( String id, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty."); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - customExtFieldReleService.delete( emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 保存扩展属性关联信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public CustomExtFieldRele save( CustomExtFieldRele object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - /*if( StringUtils.isEmpty( object.getCorrelationId()) ){ - throw new Exception("correlationId can not empty for save field rele."); - }*/ - if( StringUtils.isEmpty( object.getExtFieldName() ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - if( StringUtils.isEmpty( object.getDisplayName() ) ){ - throw new Exception("displayName can not empty for save field rele."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - object = customExtFieldReleService.save( emc, object ); - } catch (Exception e) { - throw e; - } - return object; - } - - /** - * 保存项目扩展属性关联信息 - * @param projectId - * @param extFieldName - * @param displayName - * @param effectivePerson - * @return - * @throws Exception - */ - public CustomExtFieldRele save( String projectId, String extFieldName, String displayName, EffectivePerson effectivePerson ) throws Exception { - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - /*if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - }*/ - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - if( StringUtils.isEmpty( displayName ) ){ - throw new Exception("displayName can not empty for save field rele."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.save(emc, projectId, extFieldName, displayName); - } catch (Exception e) { - throw e; - } - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleQueryService.java deleted file mode 100644 index 91271fb495..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleQueryService.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.tools.FieldInfo; -import com.x.teamwork.core.entity.tools.CustomExtField; - - -/** - * 对项目扩展属性信息查询的服务 - */ -public class CustomExtFieldReleQueryService { - - private CustomExtFieldReleService customExtFieldReleService = new CustomExtFieldReleService(); - - - public List list(List ids ) throws Exception { - if ( ListTools.isEmpty( ids )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.list( emc, ids ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据扩展属性关联信息的标识查询项目扩展属性关联信息 - * @param id - * @return - * @throws Exception - */ - public CustomExtFieldRele get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.get(emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目ID查询项目/任务关联的所有扩展属性关联信息 - * @param correlationId - * @return - * @throws Exception - */ - public List listReleWithCorrelation( String correlationId ) throws Exception { - /*if (StringUtils.isEmpty(correlationId)) { - return new ArrayList<>(); - }*/ - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.listReleWithCorrelation(emc, correlationId); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据扩展属性类型查询扩展属性关联信息 - * @param type - * @return - * @throws Exception - */ - public List listReleWithType( String type ) throws Exception { - if (StringUtils.isEmpty(type)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.listReleWithType(emc, type); - } catch (Exception e) { - throw e; - } - } - - public String getExtFieldDisplayName(String projectId, String extFieldName) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - } - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.getExtFieldDisplayName(emc, projectId, extFieldName); - } catch (Exception e) { - throw e; - } - } - - public CustomExtFieldRele getExtFieldRele(String projectId, String extFieldName) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - } - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return customExtFieldReleService.getExtFieldRele(emc, projectId, extFieldName); - } catch (Exception e) { - throw e; - } - } - - /** - * 在可用的扩展属性里选择一个未占用的属性名 - * @param correlationId - * @param displayType - * @return - * @throws Exception - */ - public String getNextUseableExtFieldName( String correlationId, String displayType ) throws Exception { - List reles = listReleWithCorrelation( correlationId ); - List fieldInfos = CustomExtField.listAllExtField(); - List fieldNames = new ArrayList<>(); - for( CustomExtFieldRele projectExtFieldRele : reles ) { - fieldNames.add( projectExtFieldRele.getExtFieldName() ); - } - for( FieldInfo fieldInfo : fieldInfos ) { - if( "RICHTEXT".equalsIgnoreCase(displayType)) { - if( fieldInfo.getFieldName().indexOf("lob") > 0 && !fieldNames.contains( fieldInfo.getFieldName() )) { - return fieldInfo.getFieldName(); - } - }else { - if( fieldInfo.getFieldName().indexOf("lob") < 0 && !fieldNames.contains( fieldInfo.getFieldName() )) { - return fieldInfo.getFieldName(); - } - } - } - return null; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleService.java deleted file mode 100644 index 0876467366..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/CustomExtFieldReleService.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.CustomExtFieldRele; - -/** - * 对项目扩展属性查询信息的服务 - * - * @author O2LEE,O2LJ - */ -class CustomExtFieldReleService { - - protected List list(EntityManagerContainer emc, List groupIds) throws Exception { - Business business = new Business( emc ); - return business.customExtFieldReleFactory().list(groupIds); - } - - /** - * 根据扩展属性ID查询项目扩展属性的信息 - * @param emc - * @param id - * @return - * @throws Exception - */ - protected CustomExtFieldRele get( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - return business.customExtFieldReleFactory().get( id ); - } - - /** - * 根据项目或任务ID查询关联的所有扩展属性关联信息 - * @param emc - * @param correlationId - * @return - * @throws Exception - */ - protected List listReleWithCorrelation(EntityManagerContainer emc, String correlationId ) throws Exception { - Business business = new Business( emc ); - if(StringUtils.isEmpty(correlationId)){ - return business.customExtFieldReleFactory().listAllFieldReleObj(); - }else{ - return business.customExtFieldReleFactory().listFieldReleObjByCorrelation( correlationId ); - } - } - - /** - * 根据扩展属性类型查询扩展属性关联信息 - * @param emc - * @param type - * @return - * @throws Exception - */ - protected List listReleWithType(EntityManagerContainer emc, String type ) throws Exception { - Business business = new Business( emc ); - return business.customExtFieldReleFactory().listFieldReleObjByType( type ); - } - - /** - * 根据扩展属性ID删除项目扩展属性信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete( EntityManagerContainer emc, String id ) throws Exception { - CustomExtFieldRele customExtFieldRele = emc.find( id, CustomExtFieldRele.class ); - emc.beginTransaction( CustomExtFieldRele.class ); - if( customExtFieldRele != null ) { - emc.remove( customExtFieldRele , CheckRemoveType.all ); - } - emc.commit(); - } - - /** - * 向数据库持久化扩展属性信息 - * @param emc - * @param customExtFieldRele - * @return - * @throws Exception - */ - protected CustomExtFieldRele save( EntityManagerContainer emc, CustomExtFieldRele object ) throws Exception { - /*if( StringUtils.isEmpty( object.getCorrelationId() ) ){ - throw new Exception("projectId can not empty for save field rele."); - }*/ - if( StringUtils.isEmpty( object.getExtFieldName() ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - if( StringUtils.isEmpty( object.getDisplayName() ) ){ - throw new Exception("displayName can not empty for save field rele."); - } - Business business = new Business( emc ); - CustomExtFieldRele customExtFieldRele = null; - List customExtFieldReleList = business.customExtFieldReleFactory().listWithFieldNameAndCorrelation( object.getExtFieldName(), object.getCorrelationId() ); - if( ListTools.isNotEmpty( customExtFieldReleList )) { - customExtFieldRele = customExtFieldReleList.get( 0 ); - object.copyTo( customExtFieldRele ); - emc.beginTransaction( CustomExtFieldRele.class ); - emc.check( customExtFieldRele, CheckPersistType.all); - emc.commit(); - return customExtFieldRele; - }else { - if( StringUtils.isEmpty( object.getId())) { - object.setId( CustomExtFieldRele.createId() ); - } - emc.beginTransaction( CustomExtFieldRele.class ); - emc.persist( object, CheckPersistType.all); - emc.commit(); - return object; - } - } - - /** - * 向数据库持久化项目扩展属性信息 - * @param emc - * @param projectExtFieldRele - * @return - * @throws Exception - */ - protected CustomExtFieldRele save( EntityManagerContainer emc, String projectId, String extFieldName, String displayName ) throws Exception { - CustomExtFieldRele projectExtFieldRele = null; - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - } - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - if( StringUtils.isEmpty( displayName ) ){ - throw new Exception("displayName can not empty for save field rele."); - } - projectExtFieldRele = new CustomExtFieldRele(); - projectExtFieldRele.setCorrelationId(projectId); - projectExtFieldRele.setExtFieldName(extFieldName); - projectExtFieldRele.setDisplayName(displayName); - return save( emc, projectExtFieldRele ); - } - - public String getExtFieldDisplayName(EntityManagerContainer emc, String projectId, String extFieldName) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - } - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - Business business = new Business( emc ); - List fieldReles = business.customExtFieldReleFactory().listWithFieldNameAndCorrelation( extFieldName, projectId ); - if(ListTools.isNotEmpty(fieldReles )) { - return fieldReles.get(0).getDisplayName(); - } - return null; - } - - public CustomExtFieldRele getExtFieldRele(EntityManagerContainer emc, String projectId, String extFieldName) throws Exception { - if( StringUtils.isEmpty( projectId ) ){ - throw new Exception("projectId can not empty for save field rele."); - } - if( StringUtils.isEmpty( extFieldName ) ){ - throw new Exception("extFieldName can not empty for save field rele."); - } - Business business = new Business( emc ); - List fieldReles = business.customExtFieldReleFactory().listWithFieldNameAndCorrelation( extFieldName, projectId ); - if(ListTools.isNotEmpty(fieldReles )) { - return fieldReles.get(0); - } - return null; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java deleted file mode 100644 index 3dcc07fac7..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java +++ /dev/null @@ -1,896 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Attachment; -import com.x.teamwork.core.entity.Chat; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskTag; - -public class DynamicPersistService { - - private DynamicService dynamicService = new DynamicService(); - - /** - * 删除动态信息(管理员可删除) - * @param flag - * @param effectivePerson - * @throws Exception - */ - public void delete( String flag, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( flag )) { - throw new Exception("flag is empty."); - } - Boolean hasDeletePermission = false; - if( effectivePerson.isManager() ) { - hasDeletePermission = true; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( !hasDeletePermission ) { - throw new Exception("dynamic delete permission denied."); - }else { - dynamicService.delete( emc, flag ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 保存项目创建或者更新动态信息 - * @param old_object - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public List projectSaveDynamic( Project old_object, Project object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List dynamics = dynamicService.getProjectSaveDynamic( old_object, object, effectivePerson ); - List result = new ArrayList<>(); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamic = dynamicService.save( emc, dynamic, content ); - result.add( dynamic ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 保存项目创建或者更新动态信息 - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public Dynamic projectIconSaveDynamic( Project object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectIconSaveDynamic( object, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, content ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存项目删除操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectDeleteDynamic( Project object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectDeleteDynamic( object, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 恢复项目操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectRecoveryDynamic( Project object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectRecoveryDynamic( object, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 更改项目状态操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectCompleteDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getCompleteDynamic( object, effectivePerson ,status); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 是否可创建任务操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectCreateableDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getCreateableDynamic( object, effectivePerson ,status); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存项目扩展信息保存操作动态信息 - * @param object_old - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectExtFieldReleSaveDynamic( CustomExtFieldRele object_old, CustomExtFieldRele object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectSaveExtFieldReleDynamic( object_old, object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存扩展属性信息删除操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectExtFieldReleDeleteDynamic( CustomExtFieldRele object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectDeleteExtFieldReleDynamic( object, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存项目模板创建或者更新动态信息 - * @param old_object - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public List projectTemplateSaveDynamic( ProjectTemplate old_object, ProjectTemplate object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List dynamics = dynamicService.getProjectTemplateSaveDynamic( old_object, object, effectivePerson ); - List result = new ArrayList<>(); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamic = dynamicService.save( emc, dynamic, content ); - result.add( dynamic ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 保存动态信息 - * @param object_old - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public Dynamic taskListSaveDynamic( TaskList object_old, TaskList object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getTaskListSaveDynamic(object_old, object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, content ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存工作任务列表删除操作动态 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic taskListDeleteDynamic( TaskList object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getTaskListDeleteDynamic(object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存动态信息 - * @param object_old - * @param object_new - * @param effectivePerson - * @return - * @throws Exception - */ - public List taskSaveDynamic( Task object_old, Task object_new, TaskDetail oldDetail , EffectivePerson effectivePerson, String content ) throws Exception { - if ( object_new == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List result = new ArrayList<>(); - List dynamics = null; - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - TaskDetail newDetail = emc.find( object_new.getId(), TaskDetail.class ); - dynamics = dynamicService.getTaskDynamic( object_old, object_new, oldDetail, newDetail, effectivePerson ); - if( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamic = dynamicService.save( emc, dynamic, content ); - result.add( dynamic ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 工作复制动态信息 - * @param sourceTask - * @param newTask - * @param effectivePerson - * @return - * @throws Exception - */ - public List taskCopyDynamic( Task sourceTask, Task newTask, EffectivePerson effectivePerson ) throws Exception { - if ( sourceTask == null) { - throw new Exception("sourceTask is null."); - } - if ( newTask == null) { - throw new Exception("newTask is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List result = new ArrayList<>(); - List dynamics = null; - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamics = dynamicService.getTaskCopyDynamic( sourceTask, newTask, effectivePerson ); - if( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamic = dynamicService.save( emc, dynamic, "" ); - result.add( dynamic ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 保存转换子工作的动态信息 - * @param subTask - * @param parentTask - * @param effectivePerson - * @return - * @throws Exception - */ - public List subTaskTransformDynamic( Task subTask, Task parentTask, EffectivePerson effectivePerson ) throws Exception { - if ( subTask == null) { - throw new Exception("sourceTask is null."); - } - if ( parentTask == null) { - throw new Exception("parentTask is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List result = new ArrayList<>(); - - //记录一个添加子任务转换的动态信息 - result.add(dynamicService.getTaskTransformDynamic( parentTask, subTask, effectivePerson)); - - //记录一个为上级任务添加子任务的动态信息 - result.add(dynamicService.getTaskSplitDynamic( parentTask, subTask, effectivePerson)); - - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( ListTools.isNotEmpty( result )) { - for( Dynamic dynamic : result ) { - //持久化工作操作动态 - dynamicService.save( emc, dynamic, "" ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 保存项目工作组信息动态 - * @param object_old - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public Dynamic projectGroupSaveDynamic( ProjectGroup object_old, ProjectGroup object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - - Dynamic dynamic = dynamicService.getProjectGroupSaveDynamic(object_old, object, effectivePerson); - - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, content ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存项目组删除动态信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectGroupDeleteDynamic( ProjectGroup object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("ProjectGroup object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectGroupDeleteDynamic(object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - /** - * 保存项目模板删除动态信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic projectTemplateDeleteDynamic( ProjectTemplate object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("ProjectTemplate object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getProjectTemplateDeleteDynamic(object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存工作任务删除动态信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic taskDeleteDynamic( Task object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("Task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - - Dynamic dynamic = dynamicService.getTaskDeleteDynamic( object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存工作管理员变更动态 - * @param task - * @param addManagers - * @param removeManagers - * @param effectivePerson - * @throws Exception - */ - public List taskManagerUpdateDynamic(Task task, List addManagers, List removeManagers, EffectivePerson effectivePerson ) throws Exception { - if ( task == null) { - throw new Exception("task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List result = new ArrayList<>(); - List dynamics = dynamicService.getTaskManagerDynamic( task, addManagers, removeManagers, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if ( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamicService.save( emc, dynamic, null ); - result.add( emc.find( dynamic.getId(), Dynamic.class )); - } - } - } catch (Exception e) { - throw e; - } - return result; - } -// -// /** -// * 保存工作标签变更动态 -// * @param task -// * @param addTags -// * @param removeTags -// * @param effectivePerson -// * @param content -// * @throws Exception -// */ -// public void taskTagUpdateDynamic(Task task, List addTags, List removeTags, EffectivePerson effectivePerson ) throws Exception { -// if ( task == null) { -// throw new Exception("task object is null."); -// } -// if ( effectivePerson == null ) { -// throw new Exception("effectivePerson is null."); -// } -// List dynamics = dynamicService.getTaskTagsDynamic( task, addTags, removeTags, effectivePerson ); -// try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { -// if ( ListTools.isNotEmpty( dynamics )) { -// for( Dynamic dynamic : dynamics ) { -// dynamicService.save( emc, dynamic, null ); -// } -// } -// } catch (Exception e) { -// throw e; -// } -// } -// -// /** -// * 删除工作标签操作动态 -// * @param task -// * @param tag -// * @param effectivePerson -// * @throws Exception -// */ -// public void taskTagDeleteDynamic( TaskTag tag, EffectivePerson effectivePerson ) throws Exception { -// if ( tag == null) { -// throw new Exception("TaskTag object is null."); -// } -// if ( effectivePerson == null ) { -// throw new Exception("effectivePerson is null."); -// } -// Dynamic dynamic = dynamicService.getTaskTagDeleteDynamic( tag, effectivePerson); -// try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { -// if ( dynamic != null ) { -// dynamicService.save( emc, dynamic, null ); -// } -// } catch (Exception e) { -// throw e; -// } -// } - - /** - * 保存工作参与者变更动态 - * @param task - * @param addParticipants - * @param removeParticipants - * @param effectivePerson - * @throws Exception - */ - public List taskParticipantsUpdateDynamic(Task task, List addParticipants, List removeParticipants, EffectivePerson effectivePerson ) throws Exception { - if ( task == null) { - throw new Exception("task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - List result = new ArrayList<>(); - List dynamics = dynamicService.getTaskParticipantsDynamic( task, addParticipants, removeParticipants, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if ( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamicService.save( emc, dynamic, null ); - result.add( emc.find( dynamic.getId() , Dynamic.class ) ); - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 任务分解,添加子任务的动态 - * @param parentTask - * @param task - * @param effectivePerson - * @throws Exception - */ - public Dynamic taskSplitDynamic(Task parentTask, Task task, EffectivePerson effectivePerson ) throws Exception { - if ( parentTask == null) { - throw new Exception("parentTask object is null."); - } - if ( task == null) { - throw new Exception("task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getTaskSplitDynamic( parentTask, task, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if ( dynamic != null ) { - dynamic = dynamicService.save( emc, dynamic, null ); - } - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public void subTaskDeleteDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) throws Exception { - if ( parentTask == null) { - throw new Exception("parentTask object is null."); - } - if ( task == null) { - throw new Exception("task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.subTaskDeleteDynamic( parentTask, task, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if ( dynamic != null ) { - dynamicService.save( emc, dynamic, null ); - } - } catch (Exception e) { - throw e; - } - } - - public Dynamic uploadAttachmentDynamic(Attachment attachment, EffectivePerson effectivePerson) throws Exception { - if ( attachment == null) { - throw new Exception("attachment is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getAttachmentUploadDynamic( attachment, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public Dynamic downloadAttachmentDynamic(Attachment attachment, EffectivePerson effectivePerson) throws Exception { - if ( attachment == null) { - throw new Exception("attachment is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getAttachmentDownloadDynamic( attachment, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public Dynamic deleteAttachment(Attachment attachment, EffectivePerson effectivePerson) throws Exception { - if ( attachment == null) { - throw new Exception("attachment is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getAttachmentDeleteDynamic( attachment, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存任务评论动态信息 - * @param object - * @param effectivePerson - * @param content - * @return - * @throws Exception - */ - public Dynamic chatPublishDynamic( Chat object, EffectivePerson effectivePerson, String content ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getChatPublishDynamic( object, effectivePerson ); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, content ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 保存工作任务评论删除动态信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic chatDeleteDynamic( Chat object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("Task object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - - Dynamic dynamic = dynamicService.getChatDeleteDynamic( object, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public List taskUpdatePropertyDynamic(Task task, String dynamicTitle, String dynamicOptType, String dynamicDescription, EffectivePerson effectivePerson) throws Exception { - if ( StringUtils.isEmpty( dynamicTitle ) || StringUtils.isEmpty( dynamicOptType ) || StringUtils.isEmpty( dynamicDescription ) ) { - return null; - } - if ( task == null) { - return null; - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - if( dynamicDescription.length() > 70 ) { - dynamicDescription = dynamicDescription.substring( 0, 60 )+ "..."; - } - List dynamics = dynamicService.getTaskPropertyUpdateDynamic( task, dynamicTitle, dynamicOptType, dynamicDescription, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( ListTools.isNotEmpty( dynamics )) { - for( Dynamic dynamic : dynamics ) { - dynamic = dynamicService.save( emc, dynamic, null ); - } - } - } catch (Exception e) { - throw e; - } - return dynamics; - } - - /** - * 为任务关联新的标签动态 - * @param task - * @param taskTag - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic addTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) throws Exception { - if ( task == null) { - throw new Exception("task object is null."); - } - if ( taskTag == null) { - throw new Exception("taskTag object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - - Dynamic dynamic = dynamicService.getAddTaskTagReleDynamic( task, taskTag, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - /** - * 移除工作任务标签操作动态 - * @param task - * @param taskTag - * @param effectivePerson - * @return - * @throws Exception - */ - public Dynamic removeTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) throws Exception { - if ( task == null) { - throw new Exception("task object is null."); - } - if ( taskTag == null) { - throw new Exception("taskTag object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - - Dynamic dynamic = dynamicService.geRemoveTaskTagReleDynamic( task, taskTag, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public Dynamic taskTagCreateDynamic(TaskTag taskTag, EffectivePerson effectivePerson) throws Exception { - if ( taskTag == null) { - throw new Exception("taskTag object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getTagCreateDynamic( taskTag, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } - - public Dynamic taskTagDeleteDynamic(TaskTag taskTag, EffectivePerson effectivePerson) throws Exception { - if ( taskTag == null) { - throw new Exception("taskTag object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - Dynamic dynamic = dynamicService.getTagDeleteDynamic( taskTag, effectivePerson); - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - dynamic = dynamicService.save( emc, dynamic, null ); - } catch (Exception e) { - throw e; - } - return dynamic; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java deleted file mode 100644 index d136608564..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java +++ /dev/null @@ -1,1133 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.common.date.DateOperation; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Attachment; -import com.x.teamwork.core.entity.Chat; -import com.x.teamwork.core.entity.Dynamic; -import com.x.teamwork.core.entity.DynamicDetail; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskTag; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -/** - * 对项目信息查询的服务 - * - * @author O2LEE - */ -class DynamicService { - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected Dynamic get(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.dynamicFactory().get( flag ); - } - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected DynamicDetail getDetail(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.dynamicFactory().getDetail( flag ); - } - - /** - * 根据过滤条件查询符合要求的项目信息数量 - * @param emc - * @param queryFilter - * @return - * @throws Exception - */ - protected Long countWithFilter( EntityManagerContainer emc, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.dynamicFactory().countWithFilter( queryFilter ); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @param projectIds - * @param taskIds - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, List projectIds, List taskIds ) throws Exception { - Business business = new Business( emc ); - - //组织查询条件对象 - QueryFilter queryFilter = new QueryFilter(); - if( ListTools.isNotEmpty( projectIds )) { - queryFilter.addInTerm( new InTerm( "projectId", new ArrayList(projectIds) ) ); - } - if( ListTools.isNotEmpty( taskIds )) { - queryFilter.addInTerm( new InTerm( "taskIds", new ArrayList(taskIds) ) ); - } - - return business.dynamicFactory().listWithFilter(maxCount, orderField, orderType, queryFilter); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @return - * @throws Exception - */ - protected List listWithFilterNext( EntityManagerContainer emc, Integer maxCount, String sequenceFieldValue, String orderField, String orderType, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.dynamicFactory().listWithFilter( maxCount, sequenceFieldValue, orderField, orderType, queryFilter ); - } - - /** - * 向数据库持久化动态信息 - * @param emc - * @param object - * @return - * @throws Exception - */ - protected Dynamic save( EntityManagerContainer emc, Dynamic object, String content ) throws Exception { - Dynamic dynamic = null; - DynamicDetail dynamicDetail = null; - Project project = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( Dynamic.createId() ); - } - dynamic = emc.find( object.getId(), Dynamic.class ); - dynamicDetail = emc.find( object.getId(), DynamicDetail.class ); - project = emc.find( object.getProjectId() , Project.class ); - - emc.beginTransaction( Dynamic.class ); - emc.beginTransaction( DynamicDetail.class ); - if( project != null && StringUtils.isEmpty( object.getProjectTitle() ) ) { - object.setProjectTitle( project.getTitle() ); - } - String lobValue = null; - if( object.getCreateTime() == null ) { - object.setCreateTime( new Date()); - } - if( object.getUpdateTime() == null ) { - object.setUpdateTime( new Date()); - } - if( dynamic == null ){ // 保存一个新的对象 - dynamic = new Dynamic(); - object.copyTo( dynamic ); - if( StringUtils.isNotEmpty( object.getId() ) ){ - dynamic.setId( object.getId() ); - } - lobValue = dynamic.getDescription(); - if( dynamic.getDescription().length() > 80 ) { - dynamic.setDescription( dynamic.getDescription().substring(0, 80) + "..."); - } - emc.persist( dynamic, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - object.copyTo( dynamic, JpaObject.FieldsUnmodify ); - emc.check( dynamic, CheckPersistType.all ); - } - if( dynamicDetail == null ){ - dynamicDetail = new DynamicDetail(); - dynamicDetail.setId( dynamic.getId() ); - dynamicDetail.setContent(content); - emc.persist( dynamicDetail, CheckPersistType.all); - }else { - dynamicDetail.setContent(content); - if( StringUtils.isEmpty( dynamicDetail.getContent() )) { - dynamicDetail.setContent( lobValue ); - } - emc.check( dynamicDetail, CheckPersistType.all ); - } - emc.commit(); - return dynamic; - } - - /** - * 根据项目标识删除项目信息 - * @param emc - * @param flag 主要是ID - * @throws Exception - */ - protected void delete(EntityManagerContainer emc, String flag) throws Exception { - Dynamic dynamic = emc.find( flag, Dynamic.class ); - if( dynamic != null ) { - //这里要先递归删除所有的任务信息 - emc.beginTransaction( Dynamic.class ); - emc.remove( dynamic , CheckRemoveType.all ); - emc.commit(); - } - } - - /** - * 根据参数组织一个简单的通用操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewSimpleDynamic( String objectType, String title, String description, String viewUrl, String optType, EffectivePerson effectivePerson, Boolean personal) { - if( StringUtils.isNotEmpty(description) && description.length() > 70 ) { - description = description.substring( 0 , 70 ) + "..." ; - } - Dynamic dynamic = new Dynamic(); - dynamic.setObjectType( objectType ); - dynamic.setOperator( effectivePerson.getDistinguishedName() ); - dynamic.setOptType(optType); - dynamic.setOptTime( new Date() ); - dynamic.setDateTimeStr( DateOperation.getNowDateTime()); - dynamic.setTitle( title ); - dynamic.setDescription( description ); - dynamic.setViewUrl(viewUrl); - dynamic.setPersonal( personal ); - return dynamic; - } - - /** - * 根据参数组织一个新的Project操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Project object, EffectivePerson effectivePerson, Boolean personal) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( object.getTitle() ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( object.getExecutor() ); - return dynamic; - } - - /** - * 根据参数组织一个新的ProjectTemplate操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, ProjectTemplate object, EffectivePerson effectivePerson, Boolean personal) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( object.getTitle() ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( object.getOwner() ); - return dynamic; - } - - /** - * 根据参数组织一个新的ProjectExtFieldRele操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, CustomExtFieldRele object, EffectivePerson effectivePerson, Boolean personal ) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( object.getDisplayName() + "(" + object.getExtFieldName() + ")" ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( effectivePerson.getDistinguishedName() ); - return dynamic; - } - - /** - * 根据参数组织一个新的TaskList操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, TaskList object, EffectivePerson effectivePerson, Boolean personal ) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( null ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( effectivePerson.getDistinguishedName() ); - return dynamic; - } - - /** - * 根据参数组织一个新的Task操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Task object, EffectivePerson effectivePerson, Boolean personal ) { - if( description.length() > 70 ) { - description = description.substring( 0, 60 )+ "..."; - } - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( object.getProjectName() ); - dynamic.setTaskId( object.getId() ); - dynamic.setTaskTitle( object.getName() ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( object.getExecutor() ); - return dynamic; - } - - /** - * 根据参数组织一个新的ProjectGroup操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, ProjectGroup object, EffectivePerson effectivePerson, Boolean personal ) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( "" ); - dynamic.setProjectTitle(null ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( effectivePerson.getDistinguishedName() ); - return dynamic; - } - - /** - * 根据参数组织一个新的Attachment操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Attachment object, EffectivePerson effectivePerson, Boolean personal) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getProjectId() ); - dynamic.setProjectTitle( null ); - dynamic.setTaskId( object.getTaskId() ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( effectivePerson.getDistinguishedName() ); - return dynamic; - } - - /** - * 根据参数组织一个新的TaskTag操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, TaskTag object, EffectivePerson effectivePerson, Boolean personal) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getProject() ); - dynamic.setProjectTitle( null ); - dynamic.setTaskId( "" ); - dynamic.setTaskTitle( null ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( effectivePerson.getDistinguishedName() ); - return dynamic; - } - - /** - * 根据参数组织一个新的Chat操作动态信息 - * @param objectType - * @param title - * @param description - * @param viewUrl - * @param optType - * @param object - * @param effectivePerson - * @param personal - * @return - */ - private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Chat object, EffectivePerson effectivePerson, Boolean personal) { - Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal ); - dynamic.setProjectId( object.getId() ); - dynamic.setProjectTitle( object.getProjectTitle() ); - dynamic.setTaskId( object.getTaskId() ); - dynamic.setTaskTitle( object.getTaskTitle() ); - dynamic.setBundle( object.getId() ); - dynamic.setTarget( object.getTarget() ); - return dynamic; - } - - /** - * 保存项目创建或者更新动态信息 - * @param object_old - * @param object - * @param effectivePerson - * @return - */ - protected List getProjectSaveDynamic( Project object_old, Project object, EffectivePerson effectivePerson ) { - List dynamics = new ArrayList<>(); - String objectType = "PROJECT"; - String viewUrl = null; - String title = null; - String optType = "UPDATE_PROJECT"; - String description = null; - if( object_old != null ) { - if( !object_old.getTitle().equalsIgnoreCase( object.getTitle() )) { //变更了名称 - title = "项目信息标题变更"; - optType = "UPDATE_TITLE"; - description = effectivePerson.getName() + "变更了项目信息的标题为:" + object.getTitle(); - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !object_old.getExecutor().equalsIgnoreCase( object.getExecutor() )) {//变更了负责人 - title = "项目负责人变更"; - optType = "UPDATE_EXECUTOR"; - if( StringUtils.isNotEmpty( object.getExecutor() ) && object.getExecutor().split( "@" ).length > 1 ) { - description = effectivePerson.getName() + "变更了项目负责人为:" + object.getExecutor().split( "@" )[0] + "。"; - }else { - description = effectivePerson.getName() + "变更了项目负责人为:" + object.getExecutor() + "。"; - } - - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - }else {//创建项目 - title = "项目信息创建"; - optType = "CREATE"; - description = effectivePerson.getName() + "创建了新的项目信息:" + object.getTitle() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - return dynamics; - } - - /** - * 组织一个更新项目图片操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectIconSaveDynamic( Project object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT"; - String title = "项目信息图标更新"; - String viewUrl = null; - String optType = "UPDATE_ICON"; - String description = effectivePerson.getName() +"更新了项目信息图标。"; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 组织一个项目删除操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectDeleteDynamic( Project object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT"; - String title = "项目信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了项目信息:" + object.getTitle(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 组织一个项目恢复操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectRecoveryDynamic( Project object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT"; - String title = "项目恢复"; - String viewUrl = null; - String optType = "RECOVERY"; - String description = effectivePerson.getName() +"恢复了项目:" + object.getTitle(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 组织一个项目更改状态操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getCompleteDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) { - String objectType = "PROJECT"; - String title = "项目状态更改"; - String viewUrl = null; - String optType = "COMPLETE"; - String description = effectivePerson.getName() +"项目:" + object.getTitle()+",状态更改为:未完成"; - if(status){ - description = effectivePerson.getName() +"项目:" + object.getTitle()+",状态更改为:已完成"; - } - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 组织一个项目更改是否可创建任务操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getCreateableDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) { - String objectType = "PROJECT"; - String title = "项目权限设置"; - String viewUrl = null; - String optType = "CREATEABLE"; - String description = effectivePerson.getName() +"项目:" + object.getTitle()+",权限设置为:不可创建任务"; - if(status){ - description = effectivePerson.getName() +"项目:" + object.getTitle()+",权限设置为:可创建任务"; - } - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 保存和根据项目组信息操作动态 - * @param object_old - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectGroupSaveDynamic( ProjectGroup object_old, ProjectGroup object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT_GROUP"; - String optType = "UPDATE_PROJECT_GROUP"; - String viewUrl = null; - String title = "项目组信息" + optType.toUpperCase(); - String description = effectivePerson.getDistinguishedName() + "添加了了一个项目组信息:" + object.getName(); - if( object_old != null ) { - if( !object_old.getName().equalsIgnoreCase( object.getName() )) { //变更了显示名称 - title = "变更项目组名称"; - optType = "UPDATE_NAME"; - description = effectivePerson.getName() + "变更了项目组名称为:" + object.getName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - }else { - title = "添加项目组信息"; - optType = "CREATE"; - description = effectivePerson.getName() + "添加了新的项目组:" + object.getName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - return null; - } - - /** - * 组织一个项目组删除操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectGroupDeleteDynamic( ProjectGroup object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT_GROUP"; - String title = "项目组信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了项目组信息:" + object.getName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - - /** - * 组织一个项目模板删除操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectTemplateDeleteDynamic( ProjectTemplate object, EffectivePerson effectivePerson ) { - String objectType = "PROJECT_TEMPLATE"; - String title = "项目模板信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了项目模板信息:" + object.getTitle(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - - /** - * 组织扩展信息配置保存操作动态 - * @param object_old - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectSaveExtFieldReleDynamic( CustomExtFieldRele object_old, CustomExtFieldRele object, EffectivePerson effectivePerson ) { - String objectType = "CUSTOM_EXTFIELD_RELE"; - String optType = "UPDATE_EXTFIELD_RELE"; - String title = "保存扩展属性"; - String viewUrl = null; - String description = null; - if( object_old != null ) { - if( !object_old.getDisplayName().equalsIgnoreCase( object.getDisplayName() )) { //变更了显示名称 - title = "变更扩展属性显示名称"; - optType = "UPDATE_DISPLAYNAME"; - description = effectivePerson.getName() + "变更了扩展属性"+object.getExtFieldName()+"的显示名称为:" + object.getDisplayName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - }else { - title = "添加扩展属性信息"; - optType = "CREATE"; - description = effectivePerson.getName() + "添加了新的扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。"; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - return null; - } - - /** - * 组织扩展信息配置删除操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getProjectDeleteExtFieldReleDynamic( CustomExtFieldRele object, EffectivePerson effectivePerson ) { - String objectType = "CUSTOM_EXTFIELD_RELE"; - String title = "扩展属性信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。"; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 保存项目模板创建或者更新动态信息 - * @param object_old - * @param object - * @param effectivePerson - * @return - */ - protected List getProjectTemplateSaveDynamic( ProjectTemplate object_old, ProjectTemplate object, EffectivePerson effectivePerson ) { - List dynamics = new ArrayList<>(); - String objectType = "PROJECTTEMPLATE"; - String viewUrl = null; - String title = null; - String optType = "UPDATE_PROJECTTEMPLATE"; - String description = null; - if( object_old != null ) { - if( !object_old.getTitle().equalsIgnoreCase( object.getTitle() )) { //变更了名称 - title = "项目模板信息标题变更"; - optType = "UPDATE_TITLE"; - description = effectivePerson.getName() + "变更了项目模板信息的标题为:" + object.getTitle(); - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !object_old.getOwner().equalsIgnoreCase( object.getOwner() )) {//变更了所有人 - title = "项目模板所有人变更"; - optType = "UPDATE_EXECUTOR"; - if( StringUtils.isNotEmpty( object.getOwner() ) && object.getOwner().split( "@" ).length > 1 ) { - description = effectivePerson.getName() + "变更了项目模板所有人为:" + object.getOwner().split( "@" )[0] + "。"; - }else { - description = effectivePerson.getName() + "变更了项目模板所有人为:" + object.getOwner() + "。"; - } - - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - }else {//创建项目 - title = "项目模板信息创建"; - optType = "CREATE"; - description = effectivePerson.getName() + "创建了新的项目模板信息:" + object.getTitle() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - return dynamics; - } - - /** - * 组织项目工作任务列表保存操作动态 - * @param object_old - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getTaskListSaveDynamic( TaskList object_old, TaskList object, EffectivePerson effectivePerson ) { - String objectType = "TASK_LIST"; - String optType = "TASK_LIST"; - String viewUrl = null; - String title = "保存工作任务列表信息:" + object.getName(); - String description = effectivePerson.getDistinguishedName() + "保存了一个工作任务列表信息:" + object.getName(); - - if( object_old != null ) { - if( !object_old.getName().equalsIgnoreCase( object.getName() )) { //变更了列表名称 - title = "变更工作任务列表名称"; - optType = "UPDATE_NAME"; - description = effectivePerson.getName() + "变更了工作任务列表名称为:"+object.getName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - }else { - title = "添加工作任务列表信息"; - optType = "CREATE"; - description = effectivePerson.getName() + "添加了新的工作任务列表:" + object.getName() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - return null; - } - - /** - * 组织项目工作任务列表删除操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getTaskListDeleteDynamic( TaskList object, EffectivePerson effectivePerson ) { - String objectType = "TASK_LIST"; - String title = "工作任务列表信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了工作任务列表:" + object.getName(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ); - } - - /** - * 删除工作任务信息操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getTaskDeleteDynamic( Task object, EffectivePerson effectivePerson ) { - String objectType = "TASK"; - String title = "工作任务信息删除"; - String viewUrl = null; - String optType = "DELETE"; - String description = effectivePerson.getName() +"删除了工作任务信息:" + object.getName(); - Dynamic dynamic = composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - dynamic.setTarget( object.getExecutor() ); - return dynamic; - } - - /** - * 保存和更新任务信息操作动态 - * @param object_old - * @param object - * @param newDetail - * @param oldDetail - * @param effectivePerson - * @return - * @throws Exception - */ - protected List getTaskDynamic( Task object_old, Task object, TaskDetail oldDetail, TaskDetail newDetail, EffectivePerson effectivePerson ) throws Exception { - String objectType = "TASK"; - String optType = "TASK_INFO"; - String title = "保存工作任务信息"; - List dynamics = new ArrayList<>(); - String viewUrl = null; - String description = null; - - if( object_old != null ) { - if( !object_old.getName().equalsIgnoreCase( object.getName() )) { - optType = "UPDATE_NAME"; - title = "工作任务标题变更"; - description = effectivePerson.getName() + "变更了任务信息:" + object.getName() + "的标题。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !object_old.getExecutor().equalsIgnoreCase( object.getExecutor() )) { - optType = "UPDATE_EXECUTOR"; - title = "工作任务负责人变更"; - description = effectivePerson.getName() + "变更了任务信息的负责人为:" + object.getExecutor() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !object_old.getWorkStatus().equalsIgnoreCase( object.getWorkStatus() )) { - optType = "UPDATE_STATUS"; - title = "工作任务状态变更"; - description = effectivePerson.getName() + "变更了任务信息的状态为:" + object.getWorkStatus() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( object_old.getStartTime().getTime() != object.getStartTime().getTime() - || object_old.getEndTime().getTime() != object.getEndTime().getTime() ) { - optType = "UPDATE_TIME"; - title = "工作任务启始时间变更"; - description = effectivePerson.getName() + "变更了任务信息的启始时间为:" + - DateOperation.getDateStringFromDate( object_old.getStartTime(), "yyyy-MM-dd HH:mm:ss") + "到" + - DateOperation.getDateStringFromDate( object_old.getEndTime(), "yyyy-MM-dd HH:mm:ss") ; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl,optType, object, effectivePerson, false ) ); - } - if( object_old.getProgress() != object.getProgress()) { - optType = "UPDATE_PROGRESS"; - title = "工作任务进度变更"; - description = effectivePerson.getName() + "变更了任务信息的工作进度为:" + object.getProgress() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !StringUtils.equals( object_old.getPriority(), object.getPriority())) { - optType = "UPDATE_PRIORITY"; - title = "工作任务紧急程度变更"; - description = effectivePerson.getName() + "变更了任务信息的紧急程度为:" + object.getPriority() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - if( !StringUtils.equals( oldDetail.getDescription(), newDetail.getDescription()) ) { - if( StringUtils.isEmpty( oldDetail.getDescription() ) && StringUtils.isNotEmpty( newDetail.getDescription() )) { - optType = "ADD_DESCRIPTION"; - title = "工作任务备注信息添加"; - description = effectivePerson.getName() + "添加了任务的备注信息。"; - }else { - if( StringUtils.isNotEmpty( newDetail.getDescription() ) ) { - title = "工作任务备注信息变更"; - optType = "UPDATE_DESCRIPTION"; - description = effectivePerson.getName() + "变更了任务的备注信息。"; - }else { - title = "工作任务备注信息清空"; - optType = "REMOVE_DESCRIPTION"; - description = effectivePerson.getName() + "清空了任务的备注信息。"; - } - } - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - }else { - optType = "CREATE"; - title = "工作任务信息新增"; - description = effectivePerson.getName() + "新增了新的任务信息:" + object.getName() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - return dynamics; - } - - public List getTaskPropertyUpdateDynamic( Task task, String dynamicTitle, String dynamicOptType, String dynamicDescription, EffectivePerson effectivePerson) { - List dynamics = new ArrayList<>(); - String objectType = "TASK"; - String viewUrl = null; - if( StringUtils.isEmpty( dynamicOptType )) { - dynamicOptType = "TASK_INFO"; - } - if( StringUtils.isEmpty( dynamicTitle )) { - dynamicTitle = "工作任务信息更新"; - } - if( StringUtils.isEmpty( dynamicDescription )) { - dynamicDescription = effectivePerson.getName() + "变更了任务信息:" + task.getName() + "的信息。"; - } - if( StringUtils.isNotEmpty( dynamicTitle ) && task != null ) { - dynamics.add( composeNewDynamic( objectType, dynamicTitle, dynamicDescription, viewUrl, dynamicOptType, task, effectivePerson, false ) ); - } - - return dynamics; - } - - /** - * 复制任务信息操作动态 - * @param sourceTask - * @param newTask - * @param effectivePerson - * @return - * @throws Exception - */ - protected List getTaskCopyDynamic( Task sourceTask, Task newTask, EffectivePerson effectivePerson ) throws Exception { - String objectType = "TASK"; - String optType = "TASK_INFO"; - String title = "复制工作任务信息"; - List dynamics = new ArrayList<>(); - String viewUrl = null; - String description = null; - - if( sourceTask != null ) { - optType = "COPY"; - title = "工作任务信息复制"; - description = effectivePerson.getName() + "复制了任务:" + sourceTask.getName() + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, newTask, effectivePerson, false ) ); - } - return dynamics; - } - - /** - * 更新工作任务管理者信息操作动态 - * @param object - * @param addManagers - * @param removeManagers - * @param effectivePerson - * @return - */ - public List getTaskManagerDynamic( Task object, List addManagers, List removeManagers, EffectivePerson effectivePerson ) { - String objectType = "TASK"; - String optType = "UPDATE_MANAGER"; - String title = "更新工作任务管理者信息"; - List dynamics = new ArrayList<>(); - String viewUrl = null; - String description = null; - if( ListTools.isNotEmpty( addManagers )) { - for( String manager : addManagers ) { - optType = "ADD_MANAGER"; - title = "添加工作任务管理者"; - description = effectivePerson.getName() + "为工作" +object.getName() + "添加了管理者:" + manager.split("@")[0] + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - } - if( ListTools.isNotEmpty( removeManagers )) { - for( String manager : removeManagers ) { - optType = "REMOVE_MANAGER"; - title = "删除工作任务管理者"; - description = effectivePerson.getName() + "从工作" +object.getName() + "的管理者中删除了:" + manager.split("@")[0] + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - } - return dynamics; - } - - /** - * 更新工作任务参与者操作动态 - * @param object - * @param addParticipants - * @param removeParticipants - * @param effectivePerson - * @return - */ - public List getTaskParticipantsDynamic( Task object, List addParticipants, List removeParticipants, EffectivePerson effectivePerson ) { - String objectType = "TASK"; - String optType = "UPDATE_PARTICIPANTS"; - String title = "更新工作任务参与者信息"; - List dynamics = new ArrayList<>(); - String viewUrl = null; - String description = null; - if( ListTools.isNotEmpty( addParticipants )) { - for( String participant : addParticipants ) { - optType = "ADD_PARTICIPANTS"; - title = "添加工作任务参与者"; - description = effectivePerson.getName() + "为工作" +object.getName() + "添加了参与者:" + participant.split("@")[0] + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - } - if( ListTools.isNotEmpty( removeParticipants)) { - for( String participant : removeParticipants ) { - optType = "REMOVE_PARTICIPANTS"; - title = "删除工作任务参与者"; - description = effectivePerson.getName() + "从工作" +object.getName() + "的参与者中删除了:" + participant.split("@")[0] + "。"; - dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); - } - } - return dynamics; - } - - public Dynamic getTaskSplitDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) { - String objectType = "TASK"; - String title = "工作任务分解"; - String viewUrl = task.getId(); - String optType = "SPLIT"; - String description = effectivePerson.getName() +"为工作添加了一个子任务:[" + task.getName() + "]"; - Dynamic dynamic = composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false ); - dynamic.setTarget( parentTask.getExecutor() ); - return dynamic; - } - - public Dynamic getTaskTransformDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) { - String objectType = "TASK"; - String title = "转换为子工作"; - String viewUrl = task.getId(); - String optType = "TRANSFORM"; - String description = effectivePerson.getName() +"将工作转换为工作[" +parentTask.getName() + "]的一个子任务。"; - Dynamic dynamic = composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false ); - dynamic.setTarget( task.getExecutor() ); - return dynamic; - } - - public Dynamic subTaskDeleteDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) { - String objectType = "TASK"; - String title = "删除下级工作"; - String viewUrl = task.getId(); - String optType = "DELETE_SUBTASK"; - String description = effectivePerson.getName() +"删除了一个子任务:" + task.getName(); - Dynamic dynamic = composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false ); - dynamic.setTarget( parentTask.getExecutor() ); - return dynamic; - } - -// /** -// * 更新任务标签信息操作动态 -// * @param task -// * @param addTags -// * @param removeTags -// * @param effectivePerson -// * @return -// */ -// public List getTaskTagsDynamic( Task object, List addTags, List removeTags, EffectivePerson effectivePerson ) { -// String objectType = "TASK"; -// String optType = "UPDATE_TAGS"; -// String title = "更新工作任务参与者信息"; -// List dynamics = new ArrayList<>(); -// String viewUrl = null; -// String description = null; -// if( ListTools.isNotEmpty( addTags )) { -// for( String tag : addTags ) { -// optType = "ADD_TAGS"; -// title = "添加工作任务标签"; -// description = effectivePerson.getName() + "为工作" +object.getName() + "添加了标签:" + tag + "。"; -// dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ) ); -// } -// } -// if( ListTools.isNotEmpty( removeTags )) { -// for( String tag : removeTags ) { -// optType = "REMOVE_TAGS"; -// title = "删除工作任务标签"; -// description = effectivePerson.getName() + "从工作" +object.getName() + "的标签中删除了:" + tag + "。"; -// dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ) ); -// } -// } -// return dynamics; -// } - - /** - * 创建工作任务标签信息操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getTagCreateDynamic( TaskTag object, EffectivePerson effectivePerson ) { - String objectType = "TAG"; - String optType = "CREATE"; - String title = "创建工作标签信息"; - String viewUrl = null; - String description = effectivePerson.getName() +"创建了工作任务标签信息:" + object.getTag(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 删除工作任务标签信息操作动态 - * @param object - * @param effectivePerson - * @return - */ - protected Dynamic getTagDeleteDynamic( TaskTag object, EffectivePerson effectivePerson ) { - String objectType = "TAG"; - String optType = "DELETE"; - String title = "工作标签信息删除"; - String viewUrl = null; - String description = effectivePerson.getName() +"删除了工作任务标签信息:" + object.getTag(); - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 工作任务附件上传操作动态信息 - * @param object - * @param effectivePerson - * @return - */ - public Dynamic getAttachmentUploadDynamic( Attachment object, EffectivePerson effectivePerson) { - String objectType = "ATTACHMENT"; - String optType = "UPLOAD"; - String viewUrl = null; - String title = "上传附件"; - String description = effectivePerson.getName() + "上传了附件:" + object.getName() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 工作任务附件下载操作动态信息 - * @param object - * @param effectivePerson - * @return - */ - public Dynamic getAttachmentDownloadDynamic( Attachment object, EffectivePerson effectivePerson) { - String objectType = "ATTACHMENT"; - String optType = "DOWNLOAD"; - String viewUrl = null; - String title = "下载附件"; - String description = effectivePerson.getName() + "下载了附件:" + object.getName() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - /** - * 工作任务附件删除操作动态信息 - * @param object - * @param effectivePerson - * @return - */ - public Dynamic getAttachmentDeleteDynamic( Attachment object, EffectivePerson effectivePerson) { - String objectType = "ATTACHMENT"; - String optType = "DELETE"; - String viewUrl = null; - String title = "删除附件"; - String description = effectivePerson.getName() + "删除了附件:" + object.getName() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - public Dynamic getChatPublishDynamic(Chat object, EffectivePerson effectivePerson) { - String objectType = "CHAT"; - String optType = "PUBLISH"; - String title = "工作任务评论信息发布"; - String viewUrl = null; - String description = effectivePerson.getName() +"发表了工作任务评论信息。" ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - public Dynamic getChatDeleteDynamic( Chat object, EffectivePerson effectivePerson) { - String objectType = "CHAT"; - String optType = "DELETE"; - String title = "工作任务评论信息删除"; - String viewUrl = null; - String description = effectivePerson.getName() +"删除了工作任务评论信息。" ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ); - } - - public Dynamic getAddTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) { - String objectType = "TASK_TAG"; - String optType = "ADD"; - String title = "工作任务添加标签"; - String viewUrl = null; - String description = effectivePerson.getName() +"为工作任务添加了标签:" + taskTag.getTag() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false ); - } - - public Dynamic geRemoveTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) { - String objectType = "TASK_TAG"; - String optType = "REMOVE"; - String title = "工作任务移除标签"; - String viewUrl = null; - String description = effectivePerson.getName() +"为工作任务移除了标签:" + taskTag.getTag() ; - return composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityPersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityPersistService.java deleted file mode 100644 index 5be47dc022..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityPersistService.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectGroupRele; - -public class PriorityPersistService { - - private PriorityService priorityService = new PriorityService(); - - /** - * 删除优先级信息 - * @param flag - * @param effectivePerson - * @throws Exception - */ - public void delete( String id, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty."); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - priorityService.delete( emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 保存优先级信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public Priority save( Priority object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - object.setOwner( effectivePerson.getDistinguishedName() ); - object = priorityService.save( emc, object ); - } catch (Exception e) { - throw e; - } - return object; - } - - /** - * 将项目添加到项目组中去 - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - public ProjectGroupRele addToGroup( String projectId, String groupId ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty."); - } - if ( StringUtils.isEmpty( groupId )) { - throw new Exception("groupId is empty."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.addToGroup(emc, projectId, groupId); - } catch (Exception e) { - throw e; - } - } - - /** - * 将项目从项目组中除去 - * @param emc - * @param projectId - * @param groupId - * @throws Exception - */ - public void removeFromGroup( String projectId, String groupId ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty."); - } - if ( StringUtils.isEmpty( groupId )) { - throw new Exception("groupId is empty."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - priorityService.removeFromGroup( emc, groupId, projectId ); - } catch (Exception e) { - throw e; - } - } - - /** - * 先删除项目所有已经关联的项目组,然后再将新的项目组与项目关联 - * @param projectId - * @param groups - * @throws Exception - */ - public void releProjectToGroup( String projectId, List groups ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - return; - } - ProjectGroupRele projectGroupRele = null; - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - - //查询项目所有已经关联的项目组关联信息 - List reles = priorityService.listReleWithProject( emc, projectId ); - - emc.beginTransaction( ProjectGroupRele.class ); - //删除项目所有已经关联的项目组关联信息 - if( ListTools.isNotEmpty( reles )) { - for( ProjectGroupRele rele : reles ) { - emc.remove( rele, CheckRemoveType.all ); - } - } - - //将新的项目组与项目关联 - if( ListTools.isNotEmpty( groups )) { - for( String group : groups ) { - projectGroupRele = new ProjectGroupRele(); - projectGroupRele.setProjectId( projectId ); - projectGroupRele.setGroupId( group ); - emc.persist( projectGroupRele, CheckPersistType.all ); - } - } - emc.commit(); - } catch (Exception e) { - throw e; - } - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityQueryService.java deleted file mode 100644 index 1851652541..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityQueryService.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.ProjectGroupRele; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectGroup; - - -/** - * 对项目组信息查询的服务 - * - * @author O2LEE - */ -public class PriorityQueryService { - - private PriorityService priorityService = new PriorityService(); - - - public List list(List groupIds) throws Exception { - if ( ListTools.isEmpty( groupIds )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.list( emc, groupIds ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据优先级的标识查询优先级信息 - * @param id - * @return - * @throws Exception - */ - public Priority get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.get(emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据优先级的名称查询优先级信息 - * @param name - * @return - * @throws Exception - */ - public List getByName( String name ) throws Exception { - if ( StringUtils.isEmpty( name )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.getByName(emc, name ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据用户列示优先级信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriority() throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.listPriority(emc); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据用户列示优先级信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriorityByPerson( String person ) throws Exception { - if (StringUtils.isEmpty(person)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.listPriorityByPerson(emc, person); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目组ID,查询项目组内所有的项目ID列表 - * @param emc - * @param group - * @return - * @throws Exception - */ - public List listProjectIdByGroup(String group ) throws Exception { - if (StringUtils.isEmpty(group)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return priorityService.listProjectIdByGroup(emc, group); - } catch (Exception e) { - throw e; - } - } - - public List listGroupIdByProject( String projectId ) throws Exception { - List result = new ArrayList<>(); - if (StringUtils.isEmpty( projectId )) { - return result; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - List reles = priorityService.listReleWithProject(emc, projectId); - if( ListTools.isNotEmpty( reles )) { - for( ProjectGroupRele rele : reles ) { - if( !result.contains( rele.getGroupId() )) { - result.add( rele.getGroupId() ); - } - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 判断是否存在分组和项目的关联 - * @param groupId - * @param projectId - * @return - * @throws Exception - */ - public boolean existsWithProjectAndGroup(String groupId, String projectId) throws Exception { - if (StringUtils.isEmpty( groupId )) { - return false; - } - if (StringUtils.isEmpty( projectId )) { - return false; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - List reles = priorityService.listReleWithProjectAndGroup(emc, projectId, groupId ); - if( ListTools.isNotEmpty( reles )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityService.java deleted file mode 100644 index 2243aaf52b..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/PriorityService.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectGroupRele; - -/** - * 对项目组查询信息的服务 - * - * @author O2LEE - */ -class PriorityService { - - protected List list(EntityManagerContainer emc, List groupIds) throws Exception { - Business business = new Business( emc ); - return business.projectGroupFactory().list(groupIds); - } - - /** - * 根据优先级ID查询优先级的信息 - * @param emc - * @param id - * @return - * @throws Exception - */ - protected Priority get( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().get( id ); - } - - /** - * 根据优先级名称查询优先级的信息 - * @param emc - * @param name - * @return - * @throws Exception - */ - protected List getByName( EntityManagerContainer emc, String name ) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().getByName( name ); - } - - /** - * 根据优先级ID删除优先级信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete( EntityManagerContainer emc, String id ) throws Exception { - Priority priority = emc.find( id, Priority.class ); - emc.beginTransaction( Priority.class ); - if( priority != null ) { - emc.remove( priority , CheckRemoveType.all ); - } - emc.commit(); - } - - /** - * 向数据库持久化优先级信息 - * @param emc - * @param projectGroup - * @return - * @throws Exception - */ - protected Priority save( EntityManagerContainer emc, Priority object ) throws Exception { - Priority priority = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( Priority.createId() ); - } - priority = emc.find( object.getId(), Priority.class ); - emc.beginTransaction( Priority.class ); - if( priority == null ){ // 保存一个新的对象 - priority = new Priority(); - object.copyTo( priority ); - priority.setId( object.getId() ); - emc.persist( priority, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - if( StringUtils.isNotEmpty( priority.getOwner() )) { - object.setOwner( priority.getOwner() ); - } - object.copyTo( priority, JpaObject.FieldsUnmodify ); - emc.check( priority, CheckPersistType.all ); - } - emc.commit(); - return priority; - } - - /** - * 将项目添加到项目组中去 - * @param emc - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - protected ProjectGroupRele addToGroup( EntityManagerContainer emc, String projectId, String groupId ) throws Exception { - List reles = null; - Business business = new Business( emc ); - ProjectGroupRele projectGroupRele = null; - ProjectGroup projectGroup = emc.find( groupId, ProjectGroup.class ); - if( projectGroup != null ){ - reles = business.projectGroupReleFactory().listWithGroupAndProject(groupId, projectId); - if( ListTools.isEmpty( reles )) { - emc.beginTransaction( ProjectGroup.class ); - projectGroupRele = new ProjectGroupRele(); - projectGroupRele.setId( ProjectGroupRele.createId() ); - projectGroupRele.setProjectId(projectId); - projectGroupRele.setGroupId(groupId); - emc.persist( projectGroupRele, CheckPersistType.all ); - emc.commit(); - } - } - return projectGroupRele; - } - - /** - * 将项目从项目组中除去 - * @param emc - * @param projectId - * @param groupId - * @throws Exception - */ - protected void removeFromGroup( EntityManagerContainer emc, String projectId, String groupId ) throws Exception { - Business business = new Business( emc ); - List reles = business.projectGroupReleFactory().listWithGroupAndProject(groupId, projectId); - if( ListTools.isNotEmpty( reles )) { - emc.beginTransaction( ProjectGroup.class ); - for( ProjectGroupRele rele : reles ) { - emc.remove( rele, CheckRemoveType.all ); - } - emc.commit(); - } - } - - /** - * 根据用户列示所有的优先级信息列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listPriority( EntityManagerContainer emc) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().listPriority(); - } - - /** - * 根据用户列示所有的优先级信息列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listPriorityByPerson( EntityManagerContainer emc, String person) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().listPriorityByPerson(person); - } - - /** - * 根据用户列示所有的项目组信息ID列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listGroupIdsByPerson( EntityManagerContainer emc, String person) throws Exception { - Business business = new Business( emc ); - return business.projectGroupFactory().listByPerson(person); - } - - /** - * 根据项目组ID,查询项目组内所有的项目ID列表 - * @param emc - * @param group - * @return - * @throws Exception - */ - protected List listProjectIdByGroup(EntityManagerContainer emc, String group) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listProjectIdByGroup(group); - } - - /** - * 根据项目ID查询项目所有的项目组关联信息对象列表 - * @param emc - * @param projectId - * @return - * @throws Exception - */ - protected List listReleWithProject(EntityManagerContainer emc, String projectId) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listReleWithProject( projectId ); - } - - /** - * 判断是否存在分组和项目的关联 - * @param emc - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - protected List listReleWithProjectAndGroup(EntityManagerContainer emc, String projectId, String groupId) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listWithGroupAndProject( groupId, projectId ); - } - - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigPersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigPersistService.java deleted file mode 100644 index 1289b63f76..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigPersistService.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectGroupRele; - -public class ProjectConfigPersistService { - - private ProjectConfigService projectConfigService = new ProjectConfigService(); - - /** - * 删除优先级信息 - * @param flag - * @param effectivePerson - * @throws Exception - */ - public void delete( String id, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty."); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - projectConfigService.delete( emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 保存项目配置信息 - * @param object - * @param effectivePerson - * @return - * @throws Exception - */ - public ProjectConfig save( ProjectConfig object, EffectivePerson effectivePerson ) throws Exception { - if ( object == null) { - throw new Exception("object is null."); - } - if ( effectivePerson == null ) { - throw new Exception("effectivePerson is null."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - object.setOwner( effectivePerson.getDistinguishedName() ); - object = projectConfigService.save( emc, object ); - } catch (Exception e) { - throw e; - } - return object; - } - - /** - * 将项目添加到项目组中去 - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - public ProjectGroupRele addToGroup( String projectId, String groupId ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty."); - } - if ( StringUtils.isEmpty( groupId )) { - throw new Exception("groupId is empty."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.addToGroup(emc, projectId, groupId); - } catch (Exception e) { - throw e; - } - } - - /** - * 将项目从项目组中除去 - * @param emc - * @param projectId - * @param groupId - * @throws Exception - */ - public void removeFromGroup( String projectId, String groupId ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty."); - } - if ( StringUtils.isEmpty( groupId )) { - throw new Exception("groupId is empty."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - projectConfigService.removeFromGroup( emc, groupId, projectId ); - } catch (Exception e) { - throw e; - } - } - - /** - * 先删除项目所有已经关联的项目组,然后再将新的项目组与项目关联 - * @param projectId - * @param groups - * @throws Exception - */ - public void releProjectToGroup( String projectId, List groups ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - return; - } - ProjectGroupRele projectGroupRele = null; - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - - //查询项目所有已经关联的项目组关联信息 - List reles = projectConfigService.listReleWithProject( emc, projectId ); - - emc.beginTransaction( ProjectGroupRele.class ); - //删除项目所有已经关联的项目组关联信息 - if( ListTools.isNotEmpty( reles )) { - for( ProjectGroupRele rele : reles ) { - emc.remove( rele, CheckRemoveType.all ); - } - } - - //将新的项目组与项目关联 - if( ListTools.isNotEmpty( groups )) { - for( String group : groups ) { - projectGroupRele = new ProjectGroupRele(); - projectGroupRele.setProjectId( projectId ); - projectGroupRele.setGroupId( group ); - emc.persist( projectGroupRele, CheckPersistType.all ); - } - } - emc.commit(); - } catch (Exception e) { - throw e; - } - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigQueryService.java deleted file mode 100644 index 5d52e7095a..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigQueryService.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.ProjectGroupRele; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectGroup; - - -/** - * 对项目组信息查询的服务 - * - * @author O2LEE - */ -public class ProjectConfigQueryService { - - private ProjectConfigService projectConfigService = new ProjectConfigService(); - - - public List list(List groupIds) throws Exception { - if ( ListTools.isEmpty( groupIds )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.list( emc, groupIds ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目组的标识查询项目组信息 - * @param id - * @return - * @throws Exception - */ - public ProjectConfig get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.get(emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据project获取项目配置信息列表 - * @param project - * @return - * @throws Exception - */ - public List getProjectConfigByProject( String project ) throws Exception { - if (StringUtils.isEmpty(project)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.getProjectConfigByProject(emc, project); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据用户列示优先级信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriority() throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.listPriority(emc); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据用户列示优先级信息列表 - * @param person - * @return - * @throws Exception - */ - public List listPriorityByPerson( String person ) throws Exception { - if (StringUtils.isEmpty(person)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.listPriorityByPerson(emc, person); - } catch (Exception e) { - throw e; - } - } - - - /** - * 根据条件查询项目配置ID列表,最大查询2000条,查询未删除 - * @param effectivePerson - * @param i - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectConfigIds(EffectivePerson effectivePerson, int maxCount, QueryFilter queryFilter) throws Exception { - String personName = effectivePerson.getDistinguishedName(); - if( maxCount == 0) { - maxCount = 1000; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.listAllProjectConfigIds( emc, maxCount, personName, queryFilter ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目ID列表查询项目信息列表,根据上一条的sequnce查询指定数量的信息 - * @param pageSize - * @param lastId - * @param orderField - * @param orderType - * @param projectIds - * @return - * @throws Exception - */ - public List listWithProjectConfigIdFilter( Integer pageSize, String lastId, String orderField, String orderType, List projectConfigIds ) throws Exception { - ProjectConfig projectConfig = null; - if( pageSize == 0 ) { pageSize = 20; } - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - QueryFilter queryFilter = new QueryFilter(); - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(projectConfigIds) )); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( lastId != null ) { - projectConfig = emc.find( lastId, ProjectConfig.class ); - } - if( projectConfig != null ) { - return projectConfigService.listWithFilter(emc, pageSize, projectConfig.getSequence(), orderField, orderType, null, null, null, null, queryFilter ); - }else { - return projectConfigService.listWithFilter(emc, pageSize, null, orderField, orderType, null, null, null, null, queryFilter ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目组ID,查询项目组内所有的项目ID列表 - * @param emc - * @param group - * @return - * @throws Exception - */ - public List listProjectIdByGroup(String group ) throws Exception { - if (StringUtils.isEmpty(group)) { - return new ArrayList<>(); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectConfigService.listProjectIdByGroup(emc, group); - } catch (Exception e) { - throw e; - } - } - - public List listGroupIdByProject( String projectId ) throws Exception { - List result = new ArrayList<>(); - if (StringUtils.isEmpty( projectId )) { - return result; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - List reles = projectConfigService.listReleWithProject(emc, projectId); - if( ListTools.isNotEmpty( reles )) { - for( ProjectGroupRele rele : reles ) { - if( !result.contains( rele.getGroupId() )) { - result.add( rele.getGroupId() ); - } - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 判断是否存在分组和项目的关联 - * @param groupId - * @param projectId - * @return - * @throws Exception - */ - public boolean existsWithProjectAndGroup(String groupId, String projectId) throws Exception { - if (StringUtils.isEmpty( groupId )) { - return false; - } - if (StringUtils.isEmpty( projectId )) { - return false; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - List reles = projectConfigService.listReleWithProjectAndGroup(emc, projectId, groupId ); - if( ListTools.isNotEmpty( reles )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigService.java deleted file mode 100644 index da4c352305..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectConfigService.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectConfig; -import com.x.teamwork.core.entity.ProjectGroup; -import com.x.teamwork.core.entity.ProjectGroupRele; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -/** - * 对项目组查询信息的服务 - * - * @author O2LEE - */ -class ProjectConfigService { - - protected List list(EntityManagerContainer emc, List groupIds) throws Exception { - Business business = new Business( emc ); - return business.projectGroupFactory().list(groupIds); - } - - /** - * 根据优先级ID查询优先级的信息 - * @param emc - * @param id - * @return - * @throws Exception - */ - protected ProjectConfig get( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - return business.projectConfigFactory().get( id ); - } - - /** - * 根据优先级ID删除优先级信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete( EntityManagerContainer emc, String id ) throws Exception { - ProjectConfig projectConfig = emc.find( id, ProjectConfig.class ); - emc.beginTransaction( ProjectConfig.class ); - if( projectConfig != null ) { - emc.remove( projectConfig , CheckRemoveType.all ); - } - emc.commit(); - } - - /** - * 向数据库持久化项目配置信息 - * @param emc - * @param projectGroup - * @return - * @throws Exception - */ - protected ProjectConfig save( EntityManagerContainer emc, ProjectConfig object ) throws Exception { - ProjectConfig projectConfig = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( ProjectConfig.createId() ); - } - projectConfig = emc.find( object.getId(), ProjectConfig.class ); - emc.beginTransaction( ProjectConfig.class ); - if( projectConfig == null ){ // 保存一个新的对象 - projectConfig = new ProjectConfig(); - object.copyTo( projectConfig ); - projectConfig.setId( object.getId() ); - emc.persist( projectConfig, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - if( StringUtils.isNotEmpty( projectConfig.getOwner() )) { - object.setOwner( projectConfig.getOwner() ); - } - object.copyTo( projectConfig, JpaObject.FieldsUnmodify ); - emc.check( projectConfig, CheckPersistType.all ); - } - emc.commit(); - return projectConfig; - } - - /** - * 根据条件查询项目ID列表,最大查询2000条 - * @param emc - * @param maxCount - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectConfigIds(EntityManagerContainer emc, int maxCount, String personName, QueryFilter queryFilter) throws Exception { - Business business = new Business( emc ); - return business.projectConfigFactory().listAllProjectConfigIds(maxCount, personName, queryFilter); - } - - /** - * 根据project获取项目配置信息列表 - * @param emc - * @param project - * @return - * @throws Exception - */ - protected List getProjectConfigByProject( EntityManagerContainer emc, String project) throws Exception { - Business business = new Business( emc ); - return business.projectConfigFactory().getProjectConfigByProject(project); - } - - /** - * 将项目添加到项目组中去 - * @param emc - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - protected ProjectGroupRele addToGroup( EntityManagerContainer emc, String projectId, String groupId ) throws Exception { - List reles = null; - Business business = new Business( emc ); - ProjectGroupRele projectGroupRele = null; - ProjectGroup projectGroup = emc.find( groupId, ProjectGroup.class ); - if( projectGroup != null ){ - reles = business.projectGroupReleFactory().listWithGroupAndProject(groupId, projectId); - if( ListTools.isEmpty( reles )) { - emc.beginTransaction( ProjectGroup.class ); - projectGroupRele = new ProjectGroupRele(); - projectGroupRele.setId( ProjectGroupRele.createId() ); - projectGroupRele.setProjectId(projectId); - projectGroupRele.setGroupId(groupId); - emc.persist( projectGroupRele, CheckPersistType.all ); - emc.commit(); - } - } - return projectGroupRele; - } - - /** - * 将项目从项目组中除去 - * @param emc - * @param projectId - * @param groupId - * @throws Exception - */ - protected void removeFromGroup( EntityManagerContainer emc, String projectId, String groupId ) throws Exception { - Business business = new Business( emc ); - List reles = business.projectGroupReleFactory().listWithGroupAndProject(groupId, projectId); - if( ListTools.isNotEmpty( reles )) { - emc.beginTransaction( ProjectGroup.class ); - for( ProjectGroupRele rele : reles ) { - emc.remove( rele, CheckRemoveType.all ); - } - emc.commit(); - } - } - - /** - * 根据用户列示所有的优先级信息列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listPriority( EntityManagerContainer emc) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().listPriority(); - } - - /** - * 根据用户列示所有的优先级信息列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listPriorityByPerson( EntityManagerContainer emc, String person) throws Exception { - Business business = new Business( emc ); - return business.priorityFactory().listPriorityByPerson(person); - } - - /** - * 根据用户列示所有的项目组信息ID列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listGroupIdsByPerson( EntityManagerContainer emc, String person) throws Exception { - Business business = new Business( emc ); - return business.projectGroupFactory().listByPerson(person); - } - - /** - * 根据项目组ID,查询项目组内所有的项目ID列表 - * @param emc - * @param group - * @return - * @throws Exception - */ - protected List listProjectIdByGroup(EntityManagerContainer emc, String group) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listProjectIdByGroup(group); - } - - /** - * 根据项目ID查询项目所有的项目组关联信息对象列表 - * @param emc - * @param projectId - * @return - * @throws Exception - */ - protected List listReleWithProject(EntityManagerContainer emc, String projectId) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listReleWithProject( projectId ); - } - - /** - * 判断是否存在分组和项目的关联 - * @param emc - * @param projectId - * @param groupId - * @return - * @throws Exception - */ - protected List listReleWithProjectAndGroup(EntityManagerContainer emc, String projectId, String groupId) throws Exception { - Business business = new Business( emc ); - return business.projectGroupReleFactory().listWithGroupAndProject( groupId, projectId ); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectConfigFactory().listWithFilter(maxCount, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param emc - * @param maxCount - * @param sequnce - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String sequnce, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectConfigFactory().listWithFilter(maxCount, sequnce, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectPersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectPersistService.java deleted file mode 100644 index ea5e718da9..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectPersistService.java +++ /dev/null @@ -1,281 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.common.date.DateOperation; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.Task; - -/** - * 对项目信息查询的服务 - * - * @author O2LEE - */ -public class ProjectPersistService { - - private ProjectService projectService = new ProjectService(); - private UserManagerService userManagerService = new UserManagerService(); - - public void delete( String flag, EffectivePerson currentPerson ) throws Exception { - if ( StringUtils.isEmpty( flag )) { - throw new Exception("flag is empty."); - } - Boolean hasDeletePermission = false; - if( currentPerson.isManager() ) { - hasDeletePermission = true; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = projectService.get(emc, flag); - //管理员可以删除,创建者可以删除 - if( !hasDeletePermission ) { - //看看是不是项目创建者 - if( project.getCreatorPerson().equalsIgnoreCase( currentPerson.getDistinguishedName() )) { - hasDeletePermission = true; - } - } - if( !hasDeletePermission ) { - throw new Exception("project delete permission denied."); - }else { - projectService.delete( emc, flag ); - } - } catch (Exception e) { - throw e; - } - } - - public Project save( Project project, ProjectDetail projectDetail, EffectivePerson effectivePerson ) throws Exception { - if ( project == null) { - throw new Exception("project is null."); - } - if( StringUtils.isEmpty( project.getTitle() )) { - project.setTitle("无标题项目("+ DateOperation.getNowDateTime() +")"); - } - if( StringUtils.isEmpty( project.getExecutor() ) ) { - project.setExecutor( effectivePerson.getDistinguishedName() ); - } - if( StringUtils.isEmpty( project.getCreatorPerson() ) ) { - project.setCreatorPerson( effectivePerson.getDistinguishedName() ); - } - if( ListTools.isEmpty( project.getManageablePersonList()) ) { - project.addManageablePerson( effectivePerson.getDistinguishedName()); - } - if( project.getTitle().length() > 70 ) { - project.setTitle( project.getTitle().substring(0, 70) + "..." ); - } - if( StringUtils.isEmpty( project.getType()) ) { - project.setType("普通项目"); - } - - if( project.getGroupCount() == null ) { - project.setGroupCount( 0 ); - } - project.addParticipantPerson( effectivePerson.getDistinguishedName() ); - - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - project = projectService.save( emc, project, projectDetail ); - } catch (Exception e) { - throw e; - } - return project; - } - - /** - * 项目标星 - * @param id - * @param effectivePerson - * @return - * @throws Exception - */ - public void star( String id, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( id, Project.class ); - if( project == null ) { - throw new Exception("Project not exists.id:" + id ); - }else { - emc.beginTransaction( Project.class ); - project.addStarPerson( effectivePerson.getDistinguishedName() ); - emc.check( project, CheckPersistType.all ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 取消项目标星 - * @param flag - * @param effectivePerson - * @return - * @throws Exception - */ - public void unStar(String flag, EffectivePerson effectivePerson) throws Exception { - if ( StringUtils.isEmpty( flag )) { - throw new Exception("flag is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( flag, Project.class ); - if( project == null ) { - throw new Exception("Project not exists.id:" + flag ); - }else { - emc.beginTransaction( Project.class ); - project.removeStarPerson( effectivePerson.getDistinguishedName() ); - emc.check( project, CheckPersistType.all ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目ID恢复项目 - * @param projectId - * @param icon - * @throws Exception - */ - public void recoveryProject( String projectId ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - Business business = new Business( emc ); - if( project == null ) { - throw new Exception("Project not exists.id:" + projectId ); - }else { - emc.beginTransaction( Project.class ); - emc.beginTransaction( Task.class ); - project.setDeleted(false); - emc.check( project, CheckPersistType.all ); - - List ids = business.taskFactory().listByProject( projectId ); - List tasks = business.taskFactory().list(ids); - if( ListTools.isNotEmpty(tasks)) { - for( Task task : tasks ) { - task.setRelation(false); - emc.check( task, CheckPersistType.all ); - } - } - - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目更改项目为已完成或未 - * @param projectId - * @param icon - * @throws Exception - */ - public void completeProject( String projectId ,Boolean status) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - if( project == null ) { - throw new Exception("Project not exists.id:" + projectId ); - }else { - emc.beginTransaction( Project.class ); - project.setCompleted(status); - emc.check( project, CheckPersistType.all ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目设置项目是否可创建任务 - * @param projectId - * @param icon - * @throws Exception - */ - public void createableProject( String projectId ,Boolean status) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - if( project == null ) { - throw new Exception("Project not exists.id:" + projectId ); - }else { - emc.beginTransaction( Project.class ); - project.setCreateable(status); - emc.check( project, CheckPersistType.all ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 保存或者更新项目的图标信息 - * @param projectId - * @param icon - * @throws Exception - */ - public void saveProjectIcon( String projectId, String icon ) throws Exception { - if ( StringUtils.isEmpty( projectId )) { - throw new Exception("projectId is empty!"); - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - if( project == null ) { - throw new Exception("Project not exists.id:" + projectId ); - }else { - emc.beginTransaction( Project.class ); - if( StringUtils.isEmpty( icon )) { - project.setIcon( null ); - }else { - project.setIcon(icon); - } - emc.check( project, CheckPersistType.all ); - emc.commit(); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 查询用户是否拥有创建项目的权限 - * 根据配置的权限来确定项目创建权限 - * @param effectivePerson - * @return - * @throws Exception - */ - public boolean checkPermissionForPersist( EffectivePerson effectivePerson, String project_creator_config ) throws Exception { - //根据配置为全员可以创建项目 - if( "ALL".equalsIgnoreCase( project_creator_config )) { - return true; - } - //系统管理员可以创建项目 - if( effectivePerson.isManager() ) { - return true; - } - //工作任务系统管理员可以创建项目 - if( userManagerService.isHasPlatformRole( effectivePerson.getDistinguishedName(), "TeamWorkManager" )) { - return true; - } - return false; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectQueryService.java deleted file mode 100644 index 59bc49b756..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectQueryService.java +++ /dev/null @@ -1,367 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -/** - * 对项目信息查询的服务 - * - * @author O2LEE - */ -public class ProjectQueryService { - - private ProjectService projectService = new ProjectService(); - private UserManagerService userManagerService = new UserManagerService(); - - /** - * 根据项目的标识查询项目信息 - * @param id - * @return - * @throws Exception - */ - public Project get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectService.get(emc, id ); - } catch (Exception e) { - throw e; - } - } - - public ProjectDetail getDetail(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectService.getDetail(emc, id); - } catch (Exception e) { - throw e; - } - } - - public String getDescription(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ProjectDetail detail = projectService.getDetail(emc, id ); - if( detail != null ) { - return detail.getDescription(); - }else { - return ""; - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据ID列表查询项目信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list(List ids) throws Exception { - if (ListTools.isEmpty( ids )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.list( Project.class, ids ); - } catch (Exception e) { - throw e; - } - } - - public List listAllProjectIds() throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectService.listAllProjectIds( emc ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param effectivePerson - * @param pageSize - * @param pageNum - * @param orderField - * @param orderType - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - public List listWithProjectIdsFilter( Integer pageSize, Integer pageNum, String orderField, String orderType, List projectIds ) throws Exception { - List projectList = null; - List result = new ArrayList<>(); - Integer maxCount = 20; - Integer startNumber = 0; - - if( pageNum == 0 ) { pageNum = 1; } - if( pageSize == 0 ) { pageSize = 20; } - maxCount = pageSize * pageNum; - startNumber = pageSize * ( pageNum -1 ); - - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - QueryFilter queryFilter = new QueryFilter(); - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(projectIds) )); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - - projectList = projectService.listWithFilter( emc, maxCount, orderField, orderType, null, null, null, null, queryFilter ); - - if( ListTools.isNotEmpty( projectList )) { - for( int i = 0; i= startNumber ) { - result.add( projectList.get( i )); - } - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 根据项目ID列表查询项目信息列表,根据上一条的sequnce查询指定数量的信息 - * @param pageSize - * @param lastId - * @param orderField - * @param orderType - * @param projectIds - * @return - * @throws Exception - */ - public List listWithProjectIdFilter( Integer pageSize, String lastId, String orderField, String orderType, List projectIds ) throws Exception { - Project project = null; - if( pageSize == 0 ) { pageSize = 20; } - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - QueryFilter queryFilter = new QueryFilter(); - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(projectIds) )); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( lastId != null ) { - project = emc.find( lastId, Project.class ); - } - if( project != null ) { - return projectService.listWithFilter(emc, pageSize, project.getSequence(), orderField, orderType, null, null, null, null, queryFilter ); - }else { - return projectService.listWithFilter(emc, pageSize, null, orderField, orderType, null, null, null, null, queryFilter ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目ID查询任务信息列表 - * @param projectId - * @param deleted - * @return - * @throws Exception - */ - public List listAllTasks(String projectId, Boolean deleted) throws Exception{ - if ( StringUtils.isEmpty( projectId )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectService.listAllTasks(emc, projectId, deleted ); - }catch (Exception e) { - throw e; - } - - - } - - /** - * 判断用户是否为指定项目的管理员 - * @param projectId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectManager(String projectId, String distinguishedName) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - if( ListTools.isNotEmpty( project.getManageablePersonList() )){ - if( distinguishedName.equalsIgnoreCase( project.getCreatorPerson() )) { - return true; - } - if( distinguishedName.equalsIgnoreCase( project.getExecutor() )) { - return true; - } - if( project.getManageablePersonList().contains( distinguishedName )) { - return true; - } - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 判断用户是项目参与者 - * @param projectId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectParticipant( String projectId, String personName ) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson(personName); - identityNames = userManagerService.listIdentitiesWithPerson(personName); - - Project project = emc.find( projectId, Project.class ); - - if( project.getParticipantPersonList().contains( personName )) { - return true; - } - project.getParticipantIdentityList().retainAll( identityNames ); - if( ListTools.isNotEmpty( project.getParticipantIdentityList() )) { - return true; - } - project.getParticipantUnitList().retainAll( unitNames ); - if( ListTools.isNotEmpty( project.getParticipantUnitList() )) { - return true; - } - project.getParticipantGroupList().retainAll( groupNames ); - if( ListTools.isNotEmpty( project.getParticipantGroupList() )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 判断用户是否拥有指定项目的访问权限 - * @param appId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectViewer(String appId, String personName ) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson(personName); - identityNames = userManagerService.listIdentitiesWithPerson(personName); - - Project project = emc.find( appId, Project.class ); - if( personName.equalsIgnoreCase( project.getCreatorPerson() )) { - return true; - } - if( personName.equalsIgnoreCase( project.getExecutor() )) { - return true; - } - if( project.getManageablePersonList().contains( personName )) { - return true; - } - if( project.getParticipantPersonList().contains( personName )) { - return true; - } - project.getParticipantIdentityList().retainAll( identityNames ); - if( ListTools.isNotEmpty( project.getParticipantIdentityList() )) { - return true; - } - project.getParticipantUnitList().retainAll( unitNames ); - if( ListTools.isNotEmpty( project.getParticipantUnitList() )) { - return true; - } - project.getParticipantGroupList().retainAll( groupNames ); - if( ListTools.isNotEmpty( project.getParticipantGroupList() )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 根据条件查询项目ID列表,最大查询2000条,查询未删除 - * @param effectivePerson - * @param i - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllViewableProjectIds(EffectivePerson effectivePerson, int maxCount, QueryFilter queryFilter) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - String personName = effectivePerson.getDistinguishedName(); - if( maxCount == 0) { - maxCount = 1000; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson( personName ); - identityNames = userManagerService.listIdentitiesWithPerson( personName ); - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - return projectService.listAllViewableProjectIds( emc, maxCount, personName, identityNames, unitNames, groupNames, queryFilter ); - } catch (Exception e) { - throw e; - } - } - /** - * 根据条件查询项目ID列表,最大查询2000条 - * @param effectivePerson - * @param i - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectIds(EffectivePerson effectivePerson, int maxCount, QueryFilter queryFilter) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - String personName = effectivePerson.getDistinguishedName(); - if( maxCount == 0) { - maxCount = 1000; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson( personName ); - identityNames = userManagerService.listIdentitiesWithPerson( personName ); - return projectService.listAllViewableProjectIds( emc, maxCount, personName, identityNames, unitNames, groupNames, queryFilter ); - } catch (Exception e) { - throw e; - } - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectService.java deleted file mode 100644 index 4bcf5867f4..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectService.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.CustomExtFieldRele; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskGroupRele; -import com.x.teamwork.core.entity.TaskListRele; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -class ProjectService { - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected Project get(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().get( flag ); - } - - protected ProjectDetail getDetail(EntityManagerContainer emc, String id) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().getDetail( id ); - } - -// /** -// * 根据过滤条件查询符合要求的项目信息数量 -// * @param emc -// * @param personName -// * @param identityNames -// * @param unitNames -// * @param groupNames -// * @param group 项目分组 -// * @param title -// * @return -// * @throws Exception -// */ -// protected Long countWithFilter( EntityManagerContainer emc, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { -// Business business = new Business( emc ); -// return business.projectFactory().countWithFilter( personName, identityNames, unitNames, groupNames, queryFilter ); -// } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listWithFilter(maxCount, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param projectId - * @param deleted - * @return - * @throws Exception - */ - protected List listAllTasks( EntityManagerContainer emc, String projectId, Boolean deleted) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllTasks(projectId, deleted); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param emc - * @param maxCount - * @param sequnce - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String sequnce, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listWithFilter(maxCount, sequnce, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 向数据库持久化项目信息 - * @param emc - * @param projectDetail - * @param project - * @return - * @throws Exception - */ - protected Project save( EntityManagerContainer emc, Project object, ProjectDetail detail ) throws Exception { - Project project = null; - ProjectDetail projectDetail = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( Project.createId() ); - } - - project = emc.find( object.getId(), Project.class ); - projectDetail = emc.find( object.getId(), ProjectDetail.class ); - - emc.beginTransaction( Project.class ); - emc.beginTransaction( ProjectDetail.class ); - - if( project == null ){ // 保存一个新的对象 - project = new Project(); - object.copyTo( project ); - if( StringUtils.isNotEmpty( object.getId() ) ){ - project.setId( object.getId() ); - } - emc.persist( project, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - if( StringUtils.isNotEmpty( project.getCreatorPerson() )) { - object.setCreatorPerson( project.getCreatorPerson() ); - } - object.copyTo( project, JpaObject.FieldsUnmodify ); - emc.check( project, CheckPersistType.all ); - } - - if( projectDetail == null ){ // 保存一个新的对象 - projectDetail = new ProjectDetail(); - detail.copyTo( projectDetail ); - projectDetail.setId( object.getId() ); - emc.persist( projectDetail, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - detail.copyTo( projectDetail, JpaObject.FieldsUnmodify ); - projectDetail.setId( object.getId() ); - emc.check( projectDetail, CheckPersistType.all ); - } - emc.commit(); - return project; - } - - /** - * 根据项目标识删除项目信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete(EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - Project project = emc.find( id, Project.class ); - if( project != null ) { - //这里要先递归删除所有的任务信息 - emc.beginTransaction( Task.class ); - emc.beginTransaction( Project.class ); - if( project != null ) { - //emc.remove( project , CheckRemoveType.all ); - //改为软删除 - project.setDeleted(true); - emc.check( project , CheckPersistType.all ); - } - //还需要删除所有的Task - List ids = business.taskFactory().listByProject( id ); - List tasks = business.taskFactory().list(ids); - if( ListTools.isNotEmpty(tasks)) { - for( Task task : tasks ) { - //this.remove( emc, task.getId() ); - task.setRelation(true); - emc.check( task, CheckPersistType.all ); - } - } - emc.commit(); - } - } - /** - * 根据工作任务标识删除工作任务信息(物理删除) - * @param emc - * @param flag 主要是ID - * @throws Exception - */ - public void remove( EntityManagerContainer emc, String flag ) throws Exception { - emc.beginTransaction( Task.class ); -/* emc.beginTransaction( Review.class ); - emc.beginTransaction( TaskDetail.class ); - emc.beginTransaction( TaskListRele.class ); - emc.beginTransaction( TaskGroupRele.class );*/ - removeTaskWithChildren( emc, flag); - emc.commit(); - } - /** - * 根据工作任务标识删除工作任务信息( 物理删除 ) - * @param emc - * @param id - * @throws Exception - */ - private void removeTaskWithChildren( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - - //还需要递归删除所有的下级Task - List childrenIds = business.taskFactory().listByParent( id ); - if( ListTools.isNotEmpty( childrenIds )) { - for( String _id : childrenIds ) { - removeTaskWithChildren( emc, _id ); - } - } - - /*//任务列表中的关联信息 - List listReles = business.taskListFactory().listReleWithTask( id ); - if( ListTools.isNotEmpty( listReles )) { - for( TaskListRele taskListRele : listReles ) { - emc.remove( taskListRele , CheckRemoveType.all ); - } - } - - //删除任务组关联信息 - List groupReles = business.taskGroupReleFactory().listTaskReleWithTask( id ); - if( ListTools.isNotEmpty( groupReles )) { - for( TaskGroupRele taskGroupRele : groupReles ) { - emc.remove( taskGroupRele , CheckRemoveType.all ); - } - } - TaskDetail taskDetail = emc.find( id, TaskDetail.class ); - List reviewList = null; - List> reviewIdBatchs = null; - List reviewIds = business.reviewFactory().listReviewByTask( id, 9999 ); - if( ListTools.isNotEmpty( reviewIds )) { - reviewIdBatchs = ListTools.batch( reviewIds, 1000 ); - } - if( ListTools.isNotEmpty( reviewIdBatchs )) { - for( List batch : reviewIdBatchs ) { - reviewList = emc.list( Review.class, batch ); - if( ListTools.isNotEmpty( reviewList )) { - for( Review review : reviewList ) { - //emc.remove( review, CheckRemoveType.all ); - //改为软删除 - review.setDeleted(true); - emc.check( review, CheckPersistType.all ); - } - } - } - } - if( taskDetail != null ) { - emc.remove( taskDetail , CheckRemoveType.all ); - }*/ - Task task = emc.find( id, Task.class ); - if( task != null ) { - //emc.remove( task , CheckRemoveType.all ); - //改为软删除 - //task.setDeleted(true); - task.setRelation(true); - emc.check( task, CheckPersistType.all ); - } - - } - - /** - * 根据条件查询项目ID列表,最大查询2000条 - * @param emc - * @param maxCount - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllViewableProjectIds(EntityManagerContainer emc, int maxCount, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllViewableProjectIds(maxCount, personName, identityNames, unitNames, groupNames, queryFilter); - } - - public List listAllProjectIds(EntityManagerContainer emc ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllProjectIds(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateQueryService.java deleted file mode 100644 index 1d6c7df02b..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateQueryService.java +++ /dev/null @@ -1,369 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.organization.core.entity.PersonCard; -import com.x.organization.core.entity.PersonCard_; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.TaskListTemplate; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; -import com.x.teamwork.core.entity.tools.filter.term.EqualsTerm; -import com.x.teamwork.core.entity.tools.filter.term.InTerm; - -/** - * 对项目信息查询的服务 - * - * @author O2LEE - */ -public class ProjectTemplateQueryService { - - private ProjectTemplateService projectTemplateService = new ProjectTemplateService(); - private TaskListTemplateService taskListTemplateService = new TaskListTemplateService(); - - private UserManagerService userManagerService = new UserManagerService(); - - /** - * 根据项目的标识查询项目信息 - * @param id - * @return - * @throws Exception - */ - public ProjectTemplate get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectTemplateService.get(emc, id ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据项目模板的标识查询模板对应的泳道信息 - * @param id - * @return - * @throws Exception - */ - public List getTaskListTemplateWithTemplateId( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskListTemplateService.getTaskListTemplateWithTemplateId(emc, id ); - } catch (Exception e) { - throw e; - } - } - - public ProjectDetail getDetail(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectTemplateService.getDetail(emc, id); - } catch (Exception e) { - throw e; - } - } - - public String getDescription(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ProjectDetail detail = projectTemplateService.getDetail(emc, id ); - if( detail != null ) { - return detail.getDescription(); - }else { - return ""; - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据ID列表查询项目模板信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list(List ids) throws Exception { - if (ListTools.isEmpty( ids )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.list( ProjectTemplate.class, ids ); - } catch (Exception e) { - throw e; - } - } - - public List listAllProjectIds() throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return projectTemplateService.listAllProjectIds( emc ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param effectivePerson - * @param pageSize - * @param pageNum - * @param orderField - * @param orderType - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - public List listWithProjectIdsFilter( Integer pageSize, Integer pageNum, String orderField, String orderType, List projectIds ) throws Exception { - List projectList = null; - List result = new ArrayList<>(); - Integer maxCount = 20; - Integer startNumber = 0; - - if( pageNum == 0 ) { pageNum = 1; } - if( pageSize == 0 ) { pageSize = 20; } - maxCount = pageSize * pageNum; - startNumber = pageSize * ( pageNum -1 ); - - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - QueryFilter queryFilter = new QueryFilter(); - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(projectIds) )); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - - projectList = projectTemplateService.listWithFilter( emc, maxCount, orderField, orderType, null, null, null, null, queryFilter ); - - if( ListTools.isNotEmpty( projectList )) { - for( int i = 0; i= startNumber ) { - result.add( projectList.get( i )); - } - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - /** - * 根据项目ID列表查询项目信息列表,根据上一条的sequnce查询指定数量的信息 - * @param pageSize - * @param lastId - * @param orderField - * @param orderType - * @param projectIds - * @return - * @throws Exception - */ - public List listWithProjectIdFilter( Integer pageSize, String lastId, String orderField, String orderType, List projectIds ) throws Exception { - ProjectTemplate project = null; - if( pageSize == 0 ) { pageSize = 20; } - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - QueryFilter queryFilter = new QueryFilter(); - queryFilter.addInTerm( new InTerm("id", new ArrayList<>(projectIds) )); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( lastId != null ) { - project = emc.find( lastId, ProjectTemplate.class ); - } - if( project != null ) { - return projectTemplateService.listWithFilter(emc, pageSize, project.getSequence(), orderField, orderType, null, null, null, null, queryFilter ); - }else { - return projectTemplateService.listWithFilter(emc, pageSize, null, orderField, orderType, null, null, null, null, queryFilter ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 判断用户是否为指定项目的管理员 - * @param projectId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectManager(String projectId, String distinguishedName) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Project project = emc.find( projectId, Project.class ); - if( ListTools.isNotEmpty( project.getManageablePersonList() )){ - if( distinguishedName.equalsIgnoreCase( project.getCreatorPerson() )) { - return true; - } - if( distinguishedName.equalsIgnoreCase( project.getExecutor() )) { - return true; - } - if( project.getManageablePersonList().contains( distinguishedName )) { - return true; - } - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 判断用户是项目参与者 - * @param projectId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectParticipant( String projectId, String personName ) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson(personName); - identityNames = userManagerService.listIdentitiesWithPerson(personName); - - Project project = emc.find( projectId, Project.class ); - - if( project.getParticipantPersonList().contains( personName )) { - return true; - } - project.getParticipantIdentityList().retainAll( identityNames ); - if( ListTools.isNotEmpty( project.getParticipantIdentityList() )) { - return true; - } - project.getParticipantUnitList().retainAll( unitNames ); - if( ListTools.isNotEmpty( project.getParticipantUnitList() )) { - return true; - } - project.getParticipantGroupList().retainAll( groupNames ); - if( ListTools.isNotEmpty( project.getParticipantGroupList() )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 判断用户是否拥有指定项目的访问权限 - * @param appId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isProjectViewer(String appId, String personName ) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson(personName); - identityNames = userManagerService.listIdentitiesWithPerson(personName); - - Project project = emc.find( appId, Project.class ); - if( personName.equalsIgnoreCase( project.getCreatorPerson() )) { - return true; - } - if( personName.equalsIgnoreCase( project.getExecutor() )) { - return true; - } - if( project.getManageablePersonList().contains( personName )) { - return true; - } - if( project.getParticipantPersonList().contains( personName )) { - return true; - } - project.getParticipantIdentityList().retainAll( identityNames ); - if( ListTools.isNotEmpty( project.getParticipantIdentityList() )) { - return true; - } - project.getParticipantUnitList().retainAll( unitNames ); - if( ListTools.isNotEmpty( project.getParticipantUnitList() )) { - return true; - } - project.getParticipantGroupList().retainAll( groupNames ); - if( ListTools.isNotEmpty( project.getParticipantGroupList() )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 根据条件查询项目模板ID列表,最大查询2000条,查询未删除 - * @param effectivePerson - * @param i - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectTemplateIds(EffectivePerson effectivePerson, int maxCount, QueryFilter queryFilter) throws Exception { - String personName = effectivePerson.getDistinguishedName(); - if( maxCount == 0) { - maxCount = 1000; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - queryFilter.addEqualsTerm( new EqualsTerm( "deleted", false ) ); - return projectTemplateService.listAllProjectTemplateIds( emc, maxCount, personName, queryFilter ); - } catch (Exception e) { - throw e; - } - } - /** - * 根据条件查询项目ID列表,最大查询2000条 - * @param effectivePerson - * @param i - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectIds(EffectivePerson effectivePerson, int maxCount, QueryFilter queryFilter) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - String personName = effectivePerson.getDistinguishedName(); - if( maxCount == 0) { - maxCount = 1000; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson( personName ); - identityNames = userManagerService.listIdentitiesWithPerson( personName ); - return projectTemplateService.listAllProjectTemplateIds( emc, maxCount, personName, queryFilter ); - } catch (Exception e) { - throw e; - } - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateService.java deleted file mode 100644 index 62c0033680..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ProjectTemplateService.java +++ /dev/null @@ -1,300 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskGroupRele; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskListRele; -import com.x.teamwork.core.entity.TaskListTemplate; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -class ProjectTemplateService { - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected ProjectTemplate get(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.projectTemplateFactory().get( flag ); - } - - protected ProjectDetail getDetail(EntityManagerContainer emc, String id) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().getDetail( id ); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listWithFilter(maxCount, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 根据条件查询符合条件的项目模板信息ID,根据上一条的sequnce查询指定数量的信息 - * @param emc - * @param maxCount - * @param sequnce - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String sequnce, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectTemplateFactory().listWithFilter(maxCount, sequnce, orderField, orderType, personName, queryFilter); - } - - /** - * 向数据库持久化项目信息 - * @param emc - * @param projectDetail - * @param project - * @return - * @throws Exception - */ - protected ProjectTemplate save( EntityManagerContainer emc, ProjectTemplate object) throws Exception { - ProjectTemplate projectTemplate = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( Project.createId() ); - } - - projectTemplate = emc.find( object.getId(), ProjectTemplate.class ); - - emc.beginTransaction( ProjectTemplate.class ); - - if( projectTemplate == null ){ // 保存一个新的对象 - projectTemplate = new ProjectTemplate(); - object.copyTo( projectTemplate ); - if( StringUtils.isNotEmpty( object.getId() ) ){ - projectTemplate.setId( object.getId() ); - } - emc.persist( projectTemplate, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - if( StringUtils.isNotEmpty( projectTemplate.getOwner() )) { - object.setOwner( projectTemplate.getOwner() ); - } - object.copyTo( projectTemplate, JpaObject.FieldsUnmodify ); - emc.check( projectTemplate, CheckPersistType.all ); - } - emc.commit(); - return projectTemplate; - } - - /** - * 根据项目模板标识删除项目模板信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete(EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - ProjectTemplate projectTemplate = emc.find( id, ProjectTemplate.class ); - if( projectTemplate != null ) { - emc.beginTransaction( TaskListTemplate.class ); - emc.beginTransaction( ProjectTemplate.class ); - if( projectTemplate != null ) { - //emc.remove( projectTemplate , CheckRemoveType.all ); - //改为软删除 - projectTemplate.setDeleted(true); - emc.check( projectTemplate , CheckPersistType.all ); - } - //还需要删除所有的TaskListTemplate - List taskListTemplates = business.taskListTemplateFactory().list(projectTemplate.getId()); - if( ListTools.isNotEmpty(taskListTemplates)) { - for( TaskListTemplate taskListTemplate : taskListTemplates ) { - //emc.remove( task , CheckRemoveType.all ); - taskListTemplate.setDeleted(true); - emc.check( taskListTemplate , CheckPersistType.all ); - } - } - emc.commit(); - } - } - /** - * 根据工作任务标识删除工作任务信息(物理删除) - * @param emc - * @param flag 主要是ID - * @throws Exception - */ - public void remove( EntityManagerContainer emc, String flag ) throws Exception { - emc.beginTransaction( Task.class ); - emc.beginTransaction( Review.class ); - emc.beginTransaction( TaskDetail.class ); - emc.beginTransaction( TaskListRele.class ); - emc.beginTransaction( TaskGroupRele.class ); - removeTaskWithChildren( emc, flag); - emc.commit(); - } - /** - * 根据工作任务标识删除工作任务信息( 物理删除 ) - * @param emc - * @param id - * @throws Exception - */ - private void removeTaskWithChildren( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - - //还需要递归删除所有的下级Task - List childrenIds = business.taskFactory().listByParent( id ); - if( ListTools.isNotEmpty( childrenIds )) { - for( String _id : childrenIds ) { - removeTaskWithChildren( emc, _id ); - } - } - - //任务列表中的关联信息 - List listReles = business.taskListFactory().listReleWithTask( id ); - if( ListTools.isNotEmpty( listReles )) { - for( TaskListRele taskListRele : listReles ) { - emc.remove( taskListRele , CheckRemoveType.all ); - } - } - - //删除任务组关联信息 - List groupReles = business.taskGroupReleFactory().listTaskReleWithTask( id ); - if( ListTools.isNotEmpty( groupReles )) { - for( TaskGroupRele taskGroupRele : groupReles ) { - emc.remove( taskGroupRele , CheckRemoveType.all ); - } - } - - Task task = emc.find( id, Task.class ); - TaskDetail taskDetail = emc.find( id, TaskDetail.class ); - List reviewList = null; - List> reviewIdBatchs = null; - List reviewIds = business.reviewFactory().listReviewByTask( id, 9999 ); - if( ListTools.isNotEmpty( reviewIds )) { - reviewIdBatchs = ListTools.batch( reviewIds, 1000 ); - } - if( ListTools.isNotEmpty( reviewIdBatchs )) { - for( List batch : reviewIdBatchs ) { - reviewList = emc.list( Review.class, batch ); - if( ListTools.isNotEmpty( reviewList )) { - for( Review review : reviewList ) { - //emc.remove( review, CheckRemoveType.all ); - //改为软删除 - review.setDeleted(true); - emc.check( review, CheckPersistType.all ); - } - } - } - } - if( task != null ) { - //emc.remove( task , CheckRemoveType.all ); - //改为软删除 - task.setDeleted(true); - emc.check( task, CheckPersistType.all ); - } - if( taskDetail != null ) { - emc.remove( taskDetail , CheckRemoveType.all ); - } - } - - /** - * 创建模板的工作任务列表 - * @param emc - * @param person - * @param template - * @return - * @throws Exception - */ - public void createDefaultTaskListForProjectTemplate( EntityManagerContainer emc, String person, ProjectTemplate template) throws Exception { - TaskListTemplate taskList = null; - List taskListsTemplate = template.getTaskList(); - - //检查是否已有模板对应的泳道,如有则先删除 - Business business = new Business( emc ); - List tlTemplates = business.taskListTemplateFactory().list(template.getId()); - if( ListTools.isNotEmpty(tlTemplates)) { - for( TaskListTemplate tlemplate : tlTemplates ) { - //emc.remove( task , CheckRemoveType.all ); - tlemplate.setDeleted(true); - emc.check( tlemplate , CheckPersistType.all ); - } - } - - if( !ListTools.isEmpty( taskListsTemplate )) { - emc.beginTransaction( TaskListTemplate.class ); - //添加模板对应的泳道 - for( String taskListTemplate: taskListsTemplate ) { - taskList = composeTaskListObject( template.getId(), taskListTemplate, 1, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - } - } - emc.commit(); - } - - private TaskListTemplate composeTaskListObject( String projectTemplateId, String listName, int orderNum, String creatorName, String owner, String memo ) { - TaskListTemplate taskTemplateList = new TaskListTemplate(); - taskTemplateList.setId( TaskListTemplate.createId() ); - taskTemplateList.setName( listName ); - taskTemplateList.setProjectTemplate( projectTemplateId ); - taskTemplateList.setMemo( memo ); - - taskTemplateList.setOrder( orderNum ); - taskTemplateList.setCreatorPerson( creatorName ); - taskTemplateList.setOwner( owner ); - taskTemplateList.setDeleted(false); - return taskTemplateList; - } - - /** - * 根据条件查询项目模板ID列表,最大查询2000条 - * @param emc - * @param maxCount - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllProjectTemplateIds(EntityManagerContainer emc, int maxCount, String personName, QueryFilter queryFilter) throws Exception { - Business business = new Business( emc ); - return business.projectTemplateFactory().listAllProjectTemplateIds(maxCount, personName, queryFilter); - } - - public List listAllProjectIds(EntityManagerContainer emc ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllProjectIds(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java deleted file mode 100644 index 2d40195bd4..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java +++ /dev/null @@ -1,457 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.organization.Person; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -public class ReviewService { - - private UserManagerService userManagerService = new UserManagerService(); - private static Logger logger = LoggerFactory.getLogger( ReviewService.class ); - - /** - * 根据指定文档的权限信息重置或者刷新所有的Review信息 - * @param emc - * @param docId - * @throws Exception - */ - public void refreshTaskReview( EntityManagerContainer emc, String taskId ) throws Exception { - Task task = emc.find( taskId, Task.class ); - Project project = null; - if( task != null ) { - project = emc.find( task.getProject(), Project.class ); - } - if( task != null ) {//正常发布后的工作需要计算工作的可见范围 - logger.info( "refreshTaskReview -> refresh review for [published] task: " + task.getName() ); - List persons = addTaskAllPermission( emc, new ArrayList<>(), taskId ); - logger.info( "refreshTaskReview -> there are "+ persons.size() +" permission in this task: " + task.getName() ); - refreshTaskReview( emc, project, task, persons ); - } - } - - /** - * 根据指定文档删除所有的Review信息 - * @param emc - * @param docId - * @throws Exception - */ - public void deleteTaskReview( EntityManagerContainer emc, String taskId ) throws Exception { - Business business = new Business(emc); - Integer maxQueryCount = 1000; - Long count = business.reviewFactory().countByTask(taskId); - Long maxTimes = count/maxQueryCount + 1 + 1; //多补偿一次 - List reviewList = null; - List ids = null; - for( int i = 0 ; i <= maxTimes; i++ ) { - ids = business.reviewFactory().listReviewByTask(taskId, maxQueryCount ); - if( ListTools.isNotEmpty( ids )) { - reviewList = emc.list( Review.class, ids); - } - if( ListTools.isNotEmpty( reviewList )) { - emc.beginTransaction( Review.class ); - for( Review review : reviewList ) { - //emc.remove( review ); - //改为软删除-lj - review.setDeleted(true); - emc.check( review , CheckPersistType.all ); - } - emc.commit(); - } - } - } - - /** - * 将指定工作任务的Review刷新为指定的人员可见 - * @param emc - * @param project - * @param task - * @param permissionPersons - * @throws Exception - */ - private void refreshTaskReview( EntityManagerContainer emc, Project project, Task task, List permissionPersons) throws Exception { - Business business = new Business(emc); - Review review = null; - Project projectEntity = null; - List reviews = null; - List reviews_tmp = null; - //先检查该文档是否存在Review信息 - List oldReviewIds = business.reviewFactory().listReviewByTask( task.getId(), 10000 ); - - List oldPermissionPersons = new ArrayList<>(); - if( permissionPersons == null ) { - permissionPersons = new ArrayList<>(); - } - - emc.beginTransaction( Review.class ); - if( ListTools.isNotEmpty( oldReviewIds )) { - reviews = emc.list( Review.class, oldReviewIds ); //查询该文档所有的Review列表,收集原来的Review人员名称oldPermissionPersons - if( ListTools.isNotEmpty( reviews )) { - emc.beginTransaction( Review.class ); - for( Review review_tmp : reviews ) { - oldPermissionPersons.add( review_tmp.getPermissionObj() ); - //对比是否有需要删除的Review数据 - if( ListTools.isNotEmpty( permissionPersons) && permissionPersons.contains( review_tmp.getPermissionObj() ) ) { - //说明存在的,保留,不需要处理,检查一下,是否有重复的需要删除 - reviews_tmp = business.reviewFactory().listByTaskAndPerson( task.getId(), review_tmp.getPermissionObj() ); - if( ListTools.isNotEmpty( reviews_tmp) ) { - //如果有数据不一致,就更新,把重复的数据删除掉 - for( int i=0; i 0 ) { - //删除多余的Review - emc.remove( reviews_tmp.get(i), CheckRemoveType.all ); - }else { - //只取一个,对比一下,把数据更新一下 - if( taskInfoChanged( task, reviews_tmp.get(0))) { -// System.out.println("任务内容变更过了,需要更新所有的Review"); - updateWithTask( reviews_tmp.get(0), task ); - emc.check( reviews_tmp.get(0), CheckPersistType.all ); - }else { -// System.out.println("任务内容没有变更,不需要更新Review"); - } - } - } - } - }else { - //不存在的Review需要删除 - emc.remove( review_tmp, CheckRemoveType.all ); - } - } - emc.commit(); - } - } - - //再判断是否需要添加新的Review信息 - Person personObj = null; - String personName = null; - projectEntity = emc.find( project.getId(), Project.class ); - if( projectEntity == null ) { - throw new Exception("project not exist! id:" + project.getId()); - } - permissionPersons = ListTools.trim( permissionPersons, true, true, new String[0] ); //去重复 - for( String person : permissionPersons ) { - if( !person.equalsIgnoreCase( "*" )) { - //检查一下个人是否存在,防止姓名或者唯一标识变更过了导致权限不正确 - personObj = userManagerService.getPerson( person ); - if( personObj != null ) { - personName = personObj.getDistinguishedName(); - }else{ - personName = userManagerService.getPersonNameWithIdentity(person); - } - } - if( StringUtils.isNotEmpty( personName )) { - //查询一下,数据库里, 是否有相同的数据,如果有,就不再添加了 - oldReviewIds = business.reviewFactory().listIdsByTaskAndPerson( task.getId(), personName ); - if( ListTools.isEmpty( oldReviewIds )) { - review = createReviewWithTask( project, task, personName ); - emc.beginTransaction( Review.class ); - emc.persist( review, CheckPersistType.all ); - emc.commit(); - } - } - - //判断所有的人员是否全部加入到Project的参与者里 - //projectEntity.addParticipantPerson( person ); - projectEntity.addParticipantPerson( personName ); - } - emc.beginTransaction( Project.class ); - emc.check( projectEntity, CheckPersistType.all); - emc.commit(); -// System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>refreshTaskReview over!"); - } - - /** - * 使用Task信息更新已存在的Review信息 - * @param review - * @param task - */ - private void updateWithTask( Review review, Task task) { - review.setTaskId( task.getId() ); - review.setParent( task.getParent() ); - review.setName( task.getName() ); - review.setProject( task.getProject() ); - review.setProjectName( task.getProjectName() ); - review.setCreatorPerson( task.getCreatorPerson() ); - review.setExecutor( task.getExecutor() ); - review.setExecutorIdentity( task.getExecutorIdentity() ); - review.setExecutorUnit( task.getExecutorUnit() ); - review.setStartTime( task.getStartTime() ); - review.setEndTime( task.getEndTime() ); - review.setArchive( task.getArchive() ); - review.setCompleted( task.getCompleted() ); - review.setOvertime( task.getOvertime() ); - review.setDeleted( task.getDeleted() ); - review.setWorkStatus( task.getWorkStatus() ); - review.setPriority( task.getPriority() ); - review.setProgress( task.getProgress() ); - review.setOrder( task.getOrder() ); - review.setTaskSequence( task.getSequence() ); - review.setClaimed( task.getClaimed() ); - review.setRemindRelevance( task.getRemindRelevance()); - } - - private boolean taskInfoChanged(Task task, Review review) { - if( review.getExecutor() == null ) { - review.setExecutor( "" ); - } - if( task.getExecutor() == null ) { - task.setExecutor( "" ); - } - if( !review.getTaskId().equalsIgnoreCase( task.getId() )) { return true; } - if( !review.getParent().equalsIgnoreCase( task.getParent() )) { return true; } - if( !review.getProject().equalsIgnoreCase( task.getProject() )) { return true; } - if( !review.getName().equalsIgnoreCase( task.getName() )) { return true; } - if( !review.getProjectName().equalsIgnoreCase( task.getProjectName() )) { return true; } - if( !review.getCreatorPerson().equalsIgnoreCase( task.getCreatorPerson() )) { return true; } - if( !review.getExecutor().equalsIgnoreCase( task.getExecutor() )) { return true; } -// if( !review.getExecutorIdentity().equalsIgnoreCase( task.getExecutorIdentity() )) { return true; } -// if( !review.getExecutorUnit().equalsIgnoreCase( task.getExecutorUnit() )) { return true; } - if( review.getStartTime().getTime() != task.getStartTime().getTime() ) { return true; } - if( review.getEndTime().getTime() != task.getEndTime().getTime() ) { return true; } - if( review.getArchive() != task.getArchive() ) { return true; } - if( review.getCompleted() != task.getCompleted() ) { return true; } - if( review.getOvertime() != task.getOvertime() ) { return true; } - if( review.getDeleted() != task.getDeleted() ) { return true; } - if( review.getArchive() != task.getArchive() ) { return true; } - if( review.getArchive() != task.getArchive() ) { return true; } - if( !review.getWorkStatus().equalsIgnoreCase( task.getWorkStatus() )) { return true; } - if( !review.getPriority().equalsIgnoreCase( task.getPriority() )) { return true; } - if( review.getProgress() != task.getProgress() ) { return true; } - if( review.getOrder() == task.getOrder() ) { return true; } - if( !review.getSequence().equalsIgnoreCase( task.getSequence() )) { return true; } - if( review.getClaimed() != task.getClaimed() ) { return true; } - if( review.getRemindRelevance() != task.getRemindRelevance() ) { return true; } - return false; - } - - /** - * 将一个任务涉及到的所有权限转换为人员 - * @param emc - * @param permissionObjs - * @param taskId - * @return - * @throws Exception - */ - private List addTaskAllPermission( EntityManagerContainer emc, List permissionObjs, String taskId ) throws Exception { - if( permissionObjs == null ) { - permissionObjs = new ArrayList<>(); - } - Task task = emc.find( taskId, Task.class ); - Project project = null; - if( task != null ) { - if( StringUtils.isNotBlank( task.getCreatorPerson() ) && !permissionObjs.contains( task.getCreatorPerson() )) { - permissionObjs.add( task.getCreatorPerson() ); - } - if( StringUtils.isNotBlank( task.getExecutor() ) && !permissionObjs.contains( task.getExecutor() )) { - permissionObjs.add( task.getExecutor() ); - } - if( ListTools.isNotEmpty( task.getParticipantList() )) { - permissionObjs = addPermissionObj( permissionObjs, task.getParticipantList() ); - } - //工作所在项目的创建者和负责人也应该可以看见这个任务 - project = emc.find( task.getProject(), Project.class ); - if( StringUtils.isNotBlank( project.getCreatorPerson() ) && !permissionObjs.contains( project.getCreatorPerson() )) { - permissionObjs.add( project.getCreatorPerson() ); - } - if( StringUtils.isNotBlank( project.getExecutor() ) && !permissionObjs.contains( project.getExecutor() )) { - permissionObjs.add( project.getExecutor() ); - } - - //查查该工作是否有上级工作,如果有上级工作,那上级工作的可见人员也应该加入到该工作的可见人员中 - if( StringUtils.isNotEmpty( task.getParent() ) && !StringUtils.equals( task.getParent(), task.getId() ) ) { - permissionObjs = addTaskAllPermission( emc, permissionObjs, task.getParent() ); - } - } - return permissionObjs; - } - - /** - * 将指定的权限名称拆解人员,添加到permissionObjs,并且返回 - * @param permissionObjs - * @param objNames - * @return - * @throws Exception - */ - private List addPermissionObj(List permissionObjs, List objNames ) throws Exception { - String result = null; - List persons = null; - if( permissionObjs == null ) { - permissionObjs = new ArrayList<>(); - } - for( String objName : objNames ) { - if( objName.endsWith( "@P" ) ) { - if( !permissionObjs.contains( objName )) { - permissionObjs.add( objName ); - } - }else if( objName.endsWith( "@I" ) ) {//将Identity转换为人员 - result = userManagerService.getPersonNameWithIdentity( objName ); - permissionObjs = addStringToList( permissionObjs, result ); - }else if( objName.endsWith( "@U" ) ) {//将组织拆解为人员 - //判断一下,如果不是顶层组织,就或者顶层组织不唯一,才将组织解析为人员 - if( !userManagerService.isTopUnit( objName ) || userManagerService.countTopUnit() > 1 ) { - persons = userManagerService.listPersonWithUnit( objName ); - permissionObjs = addListToList( permissionObjs, persons ); - } - }else if( objName.endsWith( "@G" ) ) {//将群组拆解为人员 - persons = userManagerService.listPersonWithGroup( objName ); - permissionObjs = addListToList( permissionObjs, persons ); - }else if( objName.endsWith( "@R" ) ) { - persons = userManagerService.listPersonWithRole( objName ); - permissionObjs = addListToList( permissionObjs, persons ); - }else if( "*".equals( objName ) ) { - permissionObjs = addStringToList( permissionObjs, objName ); - } - } - return permissionObjs; - } - - /** - * 根据工作任务信息以及可见权限来组织一个Review对象 - * @param project - * @param task - * @param person - * @return - */ - private Review createReviewWithTask( Project project, Task task, String person ) { - Review review = new Review(); - - review.setId( Review.createId() ); - review.setTaskId( task.getId() ); - review.setParent( task.getParent() ); - review.setName( task.getName() ); - review.setProject(project.getId() ); - review.setProjectName( project.getTitle() ); - - review.setCreatorPerson( task.getCreatorPerson() ); - review.setExecutor( task.getExecutor() ); - review.setExecutorIdentity( task.getExecutorIdentity() ); - review.setExecutorUnit( task.getExecutorUnit() ); - review.setPermissionObj( person ); - review.setPermissionObjType( "PERSON" ); - - review.setStartTime( task.getStartTime() ); - review.setEndTime( task.getEndTime() ); - review.setCreateTime( task.getCreateTime() ); - review.setUpdateTime( task.getUpdateTime() ); - - review.setArchive( task.getArchive() ); - review.setCompleted( task.getCompleted() ); - review.setOvertime( task.getOvertime() ); - review.setDeleted( task.getDeleted() ); - review.setWorkStatus( task.getWorkStatus() ); - - review.setPriority( task.getPriority() ); - review.setProgress( task.getProgress() ); - review.setOrder( task.getOrder() ); - - review.setTaskSequence( task.getSequence() ); - - review.setClaimed( task.getClaimed() ); - review.setRemindRelevance( task.getRemindRelevance()); - - review.setPermissionObj( person ); - if( "*".equals( person ) ) { - review.setPermissionObjType( "*" ); - }else { - review.setPermissionObjType( "PERSON" ); - } - return review; - } - - /** - * 将字符串添加到集合里,去重 - * @param list - * @param string - * @return list - */ - private List addStringToList( List list, String string ) { - if( list == null ) { - list = new ArrayList<>(); - } - if( !list.contains( string )) { - list.add( string); - } - return list; - } - - /** - * 将字符串列表添加到集合里,去重 - * @param list - * @param list2 - * @return list - */ - private List addListToList( List list, List list2 ) { - if( list == null ) { - list = new ArrayList<>(); - } - if( ListTools.isEmpty( list2 ) ) { - return list; - }else { - for( String string : list2 ) { - if( !list.contains( string )) { - list.add( string); - } - } - } - return list; - } - - /** - * 检查传入的taskIds中有多少是指定用户可见的ID - * @param taskIds - * @param personName - * @return - * @throws Exception - */ - public List checkTaskIdsWithPermission(EntityManagerContainer emc, List taskIds, String personName) throws Exception { - if( ListTools.isEmpty( taskIds )) { - return null; - } - if( StringUtils.isEmpty( personName )) { - return null; - } - Business business = new Business(emc); - return business.reviewFactory().checkTaskIdsWithPermission( taskIds, personName ); - } - - /** - * 查询用户在指定项目下所有可见的工作任务ID列表 - * @param emc - * @param person - * @param project - * @return - * @throws Exception - */ - public List listTaskIdsWithPerson(EntityManagerContainer emc, String person, String project ) throws Exception { - if( StringUtils.isEmpty( person )) { - return null; - } - if( StringUtils.isEmpty( project )) { - return null; - } - Business business = new Business(emc); - return business.reviewFactory().listTaskIdsWithPersonAndProject( person, project ); - } - - public List listTaskWithPersonAndParentId(EntityManagerContainer emc, String person, String taskId) throws Exception { - if( StringUtils.isEmpty( person )) { - return null; - } - if( StringUtils.isEmpty( taskId )) { - return null; - } - Business business = new Business(emc); - return business.reviewFactory().listTaskWithPersonAndParentId( person, taskId ); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/StatisticQueryService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/StatisticQueryService.java deleted file mode 100644 index 4d1cf5651f..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/StatisticQueryService.java +++ /dev/null @@ -1,615 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.assemble.control.jaxrs.task.BaseAction.TaskListChange; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskExtField; -import com.x.teamwork.core.entity.TaskGroup; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskListRele; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -/** - * 对工作任务信息查询的服务 - * - * @author O2LEE - */ -public class StatisticQueryService { - - private TaskService taskService = new TaskService(); - private TaskListService taskListService = new TaskListService(); - private TaskGroupService taskGroupService = new TaskGroupService(); - private ReviewService reviewService = new ReviewService(); - private UserManagerService userManagerService = new UserManagerService(); - - /** - * 根据工作任务的标识查询工作任务信息 - * @param id - * @return - * @throws Exception - */ - public Task get( String id ) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.find(id, Task.class ); - } catch (Exception e) { - throw e; - } - } - - public TaskDetail getDetail(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.find(id, TaskDetail.class ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据任务ID查询扩展属性信息 - * @param id - * @return - * @throws Exception - */ - public TaskExtField getExtField(String id) throws Exception { - if ( StringUtils.isEmpty( id )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.find(id, TaskExtField.class ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据ID列表查询工作任务信息列表 - * @param ids - * @return - * @throws Exception - */ - public List list(List ids) throws Exception { - if (ListTools.isEmpty( ids )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return emc.list( Task.class, ids ); - } catch (Exception e) { - throw e; - } - } - - public Long countWithFilter( EffectivePerson effectivePerson, QueryFilter queryFilter ) throws Exception { - String personName = effectivePerson.getDistinguishedName(); - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.countWithFilter(emc, personName, queryFilter); - } catch (Exception e) { - throw e; - } - } - - public Long countWithTaskListId(String taskListId) throws Exception { - if ( StringUtils.isEmpty( taskListId )) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.countWithTaskListId( emc, taskListId ); - } catch (Exception e) { - throw e; - } - } - - /** - * 根据TaskListID查询任务列表,如果taskListId,则查询所有未分类的工作列表 - * @param projectId - * @param taskListId - * @param personName - * @return - * @throws Exception - */ - public List listTaskWithTaskListId( String projectId, String taskListId, String personName ) throws Exception { - if ( StringUtils.isEmpty( taskListId )) { - return null; - } - - Task task = null; - TaskList taskList = null; - List taskIds = null; - List taskListIds = null; - List taskIds_forTaskList = null; - List taskGroupList = null; - List taskListReles = null; - List resultList = new ArrayList<>(); - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - taskList = emc.find( taskListId, TaskList.class ); - if( taskList != null ) { - //查询该TaskList下所有的任务列表 - taskIds = taskListService.listTaskIdsWithTaskListId( emc, taskListId ); - //查询这些任务在指定工作任务列表里的关联,按关联的排序号查询任务信息列表 - taskListReles = taskListService.listReleWithTaskAndListId(emc, taskIds, taskListId ); - if( ListTools.isNotEmpty( taskListReles )) { - for( TaskListRele rele : taskListReles ) { - task = emc.find( rele.getTaskId(), Task.class ); - task.setOrder( rele.getOrder() ); - resultList.add( task ); - } - } - return resultList; - }else { - //查询所有未归类的任务列表 - List taskIds_all = new ArrayList<>(); - //查询在指定项目里所有可见的工作任务列表 - List taskIds_all_tmp = reviewService.listTaskIdsWithPerson(emc, personName, projectId ); - if( taskIds_all_tmp == null ) { - taskIds_all_tmp = new ArrayList<>(); - } - for( String str : taskIds_all_tmp ) { - taskIds_all.add( str ); - } - //查询默认的TaskGroup - taskGroupList = taskGroupService.listGroupByPersonAndProject( emc, personName, projectId); - if( ListTools.isNotEmpty( taskGroupList )) { - //查询该用户所有的TaskList的ID列表 - taskListIds = taskListService.listTaskListIdsWithGroup( emc, taskGroupList.get(0).getId(), personName ); - if( ListTools.isNotEmpty( taskListIds )) { - //看看这些TaskList所关联的所有的TaskId列表 - taskIds_forTaskList = taskListService.listTaskIdsWithTaskListIds( emc, taskListIds ); - if( taskIds_forTaskList == null ) { - taskIds_forTaskList = new ArrayList<>(); - } - taskIds_all.removeAll( taskIds_forTaskList ); - } - } - return new Business(emc).taskFactory().list(taskIds_all ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 根据TaskListID查询任务列表,如果taskListId,则查询所有未分类的工作列表 - * @param projectId - * @param taskListId - * @param personName - * @return - * @throws Exception - */ - public List listMyTaskWithTaskListId( String projectId, String taskListId, String personName ) throws Exception { - if ( StringUtils.isEmpty( taskListId )) { - return null; - } - - Task task = null; - TaskList taskList = null; - List taskIds = null; - List taskListIds = null; - List taskIds_forTaskList = null; - List taskGroupList = null; - List taskListReles = null; - List resultList = new ArrayList<>(); - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - taskList = emc.find( taskListId, TaskList.class ); - if( taskList != null ) { - //查询该TaskList下所有的任务列表 - taskIds = taskListService.listTaskIdsWithTaskListId( emc, taskListId ); - //查询这些任务在指定工作任务列表里的关联,按关联的排序号查询任务信息列表 - taskListReles = taskListService.listReleWithTaskAndListId(emc, taskIds, taskListId ); - if( ListTools.isNotEmpty( taskListReles )) { - for( TaskListRele rele : taskListReles ) { - task = emc.find( rele.getTaskId(), Task.class ); - //只查询自己负责的任务 - if( personName.equalsIgnoreCase( task.getExecutor() ) || - ( task.getParticipantList() !=null && task.getParticipantList().contains( personName )) - ) { - task.setOrder( rele.getOrder() ); - resultList.add( task ); - } - } - } - }else { - //查询所有未归类的任务列表 - List taskIds_all = new ArrayList<>(); - //查询在指定项目里所有可见的工作任务列表 - List taskIds_all_tmp = reviewService.listTaskIdsWithPerson(emc, personName, projectId ); - if( taskIds_all_tmp == null ) { - taskIds_all_tmp = new ArrayList<>(); - } - System.out.println("w:taskIds_all_tmp="+taskIds_all_tmp.size()); - - for( String str : taskIds_all_tmp ) { - taskIds_all.add( str ); - } - System.out.println("w:taskIds_all="+taskIds_all.size()); - //查询默认的TaskGroup - taskGroupList = taskGroupService.listGroupByPersonAndProject( emc, personName, projectId); - if( ListTools.isNotEmpty( taskGroupList )) { - //查询该用户所有的TaskList的ID列表 - taskListIds = taskListService.listTaskListIdsWithGroup( emc, taskGroupList.get(0).getId(), personName ); - if( ListTools.isNotEmpty( taskListIds )) { - //看看这些TaskList所关联的所有的TaskId列表 - taskIds_forTaskList = taskListService.listTaskIdsWithTaskListIds( emc, taskListIds ); - if( taskIds_forTaskList == null ) { - taskIds_forTaskList = new ArrayList<>(); - } - System.out.println("默认泳道:taskIds_forTaskList="+taskIds_forTaskList.size()); - taskIds_all.removeAll( taskIds_forTaskList ); - } - } - List taskListTmp = new Business(emc).taskFactory().list(taskIds_all ); - if( ListTools.isNotEmpty( taskListTmp )) { - for( Task _task : taskListTmp ) { - //只查询自己负责的任务 - if( personName.equalsIgnoreCase( _task.getExecutor() )|| - ( _task.getParticipantList() !=null && _task.getParticipantList().contains( personName ))) - { - resultList.add( _task ); - } - } - } - } - } catch (Exception e) { - throw e; - } - return resultList; - } - - /** - * 在人员的可见范围之类,根据指定的工作任务ID,查询子任务列表 - * @param taskId - * @param effectivePerson - * @return - * @throws Exception - */ - public List listTaskWithParentId(String taskId, EffectivePerson effectivePerson) throws Exception { - if ( StringUtils.isEmpty( taskId )) { - return null; - } - if ( effectivePerson == null ) { - return null; - } - List taskList = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - //查询用户在该项目里可见的所有项目列表 - List reviewList = reviewService.listTaskWithPersonAndParentId( emc, effectivePerson.getDistinguishedName(), taskId ); - if( ListTools.isNotEmpty( reviewList )) { - taskList = taskService.convertToTask(reviewList); - } - } catch (Exception e) { - throw e; - } - return taskList; - } - - /** - * 根据过滤条件查询符合要求的工作任务信息列表 - * @param effectivePerson - * @param pageSize - * @param pageNum - * @param orderField - * @param orderType - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( EffectivePerson effectivePerson, Integer pageSize, Integer pageNum, String orderField, String orderType, QueryFilter queryFilter ) throws Exception { - List taskList = null; - List result = new ArrayList<>(); - Integer maxCount = 20; - Integer startNumber = 0; - - if( pageNum == 0 ) { pageNum = 1; } - if( pageSize == 0 ) { pageSize = 20; } - maxCount = pageSize * pageNum; - startNumber = pageSize * ( pageNum -1 ); - - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - taskList = taskService.listWithFilter( emc, maxCount, orderField, orderType, effectivePerson.getDistinguishedName(), queryFilter ); - if( ListTools.isNotEmpty( taskList )) { - for( int i = 0; i= startNumber ) { - result.add( taskList.get( i )); - } - } - } - } catch (Exception e) { - throw e; - } - return result; - } - - - /** - * 根据条件查询符合条件的工作任务信息ID,根据上一条的sequnce查询指定数量的信息 - * @param effectivePerson - * @param pageSize - * @param lastId - * @param orderField - * @param orderType - * @param queryFilter - * @return - * @throws Exception - */ - public List listWithFilter( EffectivePerson effectivePerson, Integer pageSize, String lastId, String orderField, String orderType, QueryFilter queryFilter ) throws Exception { - List taskList = null; - List resultList = new ArrayList<>(); - Integer maxCount = 2000; - Task lastTask = null; - - if( pageSize == 0 ) { pageSize = 20; } - - if( StringUtils.isEmpty( orderField ) ) { - orderField = "createTime"; - } - if( StringUtils.isEmpty( orderType ) ) { - orderType = "desc"; - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - if( StringUtils.isNotEmpty(lastId) && !"(0)".equals( lastId ) && !"null".equals( lastId )) { - lastTask = emc.find( lastId, Task.class ); - } - taskList = taskService.listWithFilter( emc, maxCount, orderField, orderType, effectivePerson.getDistinguishedName(), queryFilter ); - } catch (Exception e) { - throw e; - } - if( ListTools.isNotEmpty( taskList )) { - int count = 0; - if( lastTask != null ) { - boolean add = false; - //获取自lastTask之后的一页内容 - for( Task task : taskList ) { - if( add ) { - count ++; - if( count <= pageSize ) { - resultList.add( task ); - } - } - if( task.getId().equals( lastTask.getId() )) { - add = true; - } - } - }else { - //只获取第一页内容 - for( Task task : taskList ) { - count ++; - if( count <= pageSize ) { - resultList.add(task); - } - } - } - } - return resultList; - } - - /** - * 判断用户是否为指定工作任务的管理员 - * @param taskId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isTaskManager(String taskId, String distinguishedName) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Task task = emc.find( taskId, Task.class ); - if( ListTools.isNotEmpty( task.getManageablePersonList() )){ - if( distinguishedName.equalsIgnoreCase( task.getCreatorPerson() )) { - return true; - } - if( distinguishedName.equalsIgnoreCase( task.getExecutor() )) { - return true; - } - if( task.getManageablePersonList().contains( distinguishedName )) { - return true; - } - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 判断用户是工作任务参与者 - * @param taskId - * @param distinguishedName - * @return - * @throws Exception - */ - public Boolean isTaskParticipant( String taskId, String personName ) throws Exception { - List unitNames = null; - List groupNames = null; - List identityNames = null; - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - unitNames = userManagerService.listUnitNamesWithPerson( personName ); - groupNames = userManagerService.listGroupNamesByPerson(personName); - identityNames = userManagerService.listIdentitiesWithPerson(personName); - - Task task = emc.find( taskId, Task.class ); - - if( task.getParticipantList().contains( personName )) { - return true; - } - - identityNames.retainAll( task.getParticipantList() ); - if( ListTools.isNotEmpty( identityNames )) { - return true; - } - unitNames.retainAll( task.getParticipantList() ); - if( ListTools.isNotEmpty( unitNames )) { - return true; - } - groupNames.retainAll( task.getParticipantList() ); - if( ListTools.isNotEmpty( groupNames )) { - return true; - } - } catch (Exception e) { - throw e; - } - return false; - } - - /** - * 根据任务的状态信息变化查询展现的列表变化 - * 任务原来所在的列表是绑定状态的,才会根据状态来变化列表,否则就不变 - * @param id - * @param sourceStatus - * @param targetStatus - * @return - */ - public TaskListChange getTaskListChange( String id, String sourceStatus, String targetStatus ) { - TaskListChange change = null; - String sourceListId = null; - String targetListId = null; - //根据任务ID、sourceStatus查询原来所在列表ID - - //根据任务ID、targetStatus查询目标列表ID - - //组织一个ViewChange - if( StringUtils.isNotEmpty( sourceListId ) || StringUtils.isNotEmpty( targetListId ) ) { - change = new TaskListChange(); - change.setSource(sourceListId); - change.setTarget(targetListId); - return change; - } - return null; - } - - public List listUnReviewIds( int maxCount ) throws Exception { - if ( maxCount == 0 ) { - maxCount = 100; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.listUnReviewTaskIds( emc, 100 ); - } catch (Exception e) { - throw e; - } - } - - /** - * 查询指定任务的所有未完成的子任务信息列表 - * @param taskId - * @return - * @throws Exception - */ - public List allUnCompletedSubTasks(String taskId) throws Exception { - if( StringUtils.isEmpty( taskId ) ) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.allUnCompletedSubTasks( emc, taskId ); - } catch (Exception e) { - throw e; - } - } - - public Integer countWithTaskGroupId( String taskGroupId, EffectivePerson effectivePerson ) throws Exception { - if( StringUtils.isEmpty( taskGroupId ) ) { - return 0; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - TaskGroup taskGroup = emc.find( taskGroupId, TaskGroup.class ); - if( taskGroup != null ) { - List taskIds = taskService.listTaskIdsWithPermissionInProject(emc, 999, taskGroup.getProject(), effectivePerson.getDistinguishedName() ); - if( ListTools.isNotEmpty( taskIds )) { - return taskIds.size(); - } - } - } catch (Exception e) { - throw e; - } - return 0; - } - - public List listTaskWithProjectAndPerson(String project, EffectivePerson effectivePerson) throws Exception { - if( StringUtils.isEmpty( project ) ) { - return null; - } - if( effectivePerson == null ) { - return null; - } - Business business = null; - List taskIds = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - business = new Business( emc ); - taskIds = business.reviewFactory().listTaskIdsWithPersonAndProject( effectivePerson.getDistinguishedName(), project); - if( ListTools.isNotEmpty( taskIds )) { - return emc.list( Task.class, taskIds ); - } - } catch (Exception e) { - throw e; - } - return null; - } - - public List listAllTaskIdsWithProject( String project ) throws Exception { - if( StringUtils.isEmpty( project ) ) { - return null; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.listAllTaskIdsWithProject( emc, project ); - } catch (Exception e) { - throw e; - } - } - - public String getValueFromTaskExtField( TaskExtField taskExtField, String extFieldName) { - if( StringUtils.isEmpty( extFieldName )) { - return ""; - } - if( taskExtField == null ) { - return ""; - } - if( StringUtils.equals( extFieldName, "memoString_1" ) ) { - return taskExtField.getMemoString_1(); - }else if( StringUtils.equals( extFieldName, "memoString_2" ) ) { - return taskExtField.getMemoString_2(); - }else if( StringUtils.equals( extFieldName, "memoString_3" ) ) { - return taskExtField.getMemoString_3(); - }else if( StringUtils.equals( extFieldName, "memoString_4" ) ) { - return taskExtField.getMemoString_4(); - }else if( StringUtils.equals( extFieldName, "memoString_5" ) ) { - return taskExtField.getMemoString_5(); - }else if( StringUtils.equals( extFieldName, "memoString_6" ) ) { - return taskExtField.getMemoString_6(); - }else if( StringUtils.equals( extFieldName, "memoString_7" ) ) { - return taskExtField.getMemoString_7(); - }else if( StringUtils.equals( extFieldName, "memoString_8" ) ) { - return taskExtField.getMemoString_8(); - }else if( StringUtils.equals( extFieldName, "memoString_1_lob" ) ) { - return taskExtField.getMemoString_1_lob(); - }else if( StringUtils.equals( extFieldName, "memoString_2_lob" ) ) { - return taskExtField.getMemoString_2_lob(); - }else if( StringUtils.equals( extFieldName, "memoString_3_lob" ) ) { - return taskExtField.getMemoString_3_lob(); - }else if( StringUtils.equals( extFieldName, "memoString_4_lob" ) ) { - return taskExtField.getMemoString_4_lob(); - } - return ""; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java deleted file mode 100644 index da273f5818..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.assemble.control.jaxrs.list.ActionListWithTaskGroup.Wo; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.TaskGroup; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskListRele; - -class TaskListService { - - /** - * 根据工作任务列表的标识查询工作任务列表的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected TaskList get(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().get( flag ); - } - - /** - * 根据用户和项目ID查询工作任务列表 - * @param emc - * @param person - * @return - * @throws Exception - */ - protected List listWithProject( EntityManagerContainer emc, String person, String projectId ) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listWithPersonAndProject( person, projectId ); - } - - /** - * 根据工作任务组ID查询工作任务列表 - * @param emc - * @param taskGroupId - * @return - * @throws Exception - */ - protected List listWithTaskGroup( EntityManagerContainer emc, String taskGroupId ) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listWithTaskGroup( taskGroupId ); - } - - public List listTaskIdsWithTaskListId( EntityManagerContainer emc, String taskListId) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listTaskIdWithTaskListId(taskListId); - } - - public List listTaskIdsWithTaskListIds( EntityManagerContainer emc, List taskListIds) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listTaskIdWithTaskListIds(taskListIds); - } - - public List listTaskListWithTask(EntityManagerContainer emc, String taskId, String taskGroupId ) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listTaskListWithTask( taskId, taskGroupId ); - } - - public List listTaskListIdWithTask(EntityManagerContainer emc, String taskId, String taskGroupId ) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listTaskListIdWithTask( taskId, taskGroupId ); - } - - public List listTaskListIdsWithGroup(EntityManagerContainer emc, String taskGroupId, String person) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listTaskListIdsWithGroup( taskGroupId, person ); - } - - public List listReleWithTaskAndListId(EntityManagerContainer emc, List taskIds, String taskListId) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().listReleWithTaskAndListId( taskIds, taskListId ); - } - - public Long countTaskWithTaskListId(EntityManagerContainer emc, String taskListId) throws Exception { - Business business = new Business( emc ); - return business.taskListFactory().countTaskWithTaskListId( taskListId ); - } - - public Long countTaskWithOutoTaskListInGroup(EntityManagerContainer emc, String personName, String taskGroupId) throws Exception { - Business business = new Business(emc); - TaskGroup taskGroup = emc.find( taskGroupId, TaskGroup.class ); - //查询所有未归类的任务列表 - List taskIds_all = new ArrayList<>(); - List taskIds_allViewable = null; - List taskIds_forGroup = null; - List taskListIds_forGroup = null; - - if( taskGroup == null ) { - return 0L; - } - - //查询在指定项目里所有可见的工作任务列表 - taskIds_allViewable = business.reviewFactory().listTaskIdsWithPersonAndProject( personName, taskGroup.getProject() ); - if( ListTools.isNotEmpty( taskIds_allViewable ) ) { - for( String str : taskIds_allViewable ) { - //先全部添加到输出的工作任务ID里,然后将所有已经归过类的任务排除 - taskIds_all.add( str ); - } - } - - //查询用户在该taskGroup里所有已经有关联的任务ID列表 - taskListIds_forGroup = business.taskListFactory().listTaskListIdsWithGroup( taskGroupId, personName ); - taskIds_forGroup = business.taskListFactory().listTaskIdsWithTaskGroupId( taskListIds_forGroup ); - if( ListTools.isNotEmpty( taskIds_forGroup )) { - taskIds_all.removeAll( taskIds_forGroup ); - } - - return Long.parseLong( taskIds_all.size()+"" ); - } - - /** - * 向数据库持久化工作任务列表列表信息 - * @param emc - * @param object - * @return - * @throws Exception - */ - protected TaskList save( EntityManagerContainer emc, TaskList object ) throws Exception { - TaskList taskList = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( TaskList.createId() ); - } - - taskList = emc.find( object.getId(), TaskList.class ); - Business business = new Business(emc); - emc.beginTransaction( TaskList.class ); - if( taskList == null ){ // 保存一个新的对象 - TaskGroup taskGroup = emc.find( object.getTaskGroup(), TaskGroup.class ); - if( taskGroup == null ) { - throw new Exception("TaskGroup not exists!ID:" + object.getTaskGroup() ); - } - object.setProject( taskGroup.getProject() ); - - taskList = new TaskList(); - object.copyTo( taskList ); - if( StringUtils.isNotEmpty( object.getId() ) ){ - taskList.setId( object.getId() ); - } - - //查询最大的排序号 - Integer maxListOrder = business.taskListFactory().maxListOrder( taskGroup.getId() ) + 1; - taskList.setOrder( maxListOrder ); - emc.persist( taskList, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - TaskGroup taskGroup = emc.find( taskList.getTaskGroup(), TaskGroup.class ); - if( taskGroup == null ) { - throw new Exception("TaskGroup not exists!ID:" + object.getTaskGroup() ); - } - taskList.setMemo( object.getMemo() ); - if( StringUtils.isNotEmpty( object.getName() )) { - taskList.setName( object.getName() ); - } - if( object.getOrder() != null ) { - taskList.setOrder( object.getOrder() ); - } - emc.check( taskList, CheckPersistType.all ); - } - emc.commit(); - - return taskList; - } - - /** - * 根据工作任务列表标识删除工作任务列表信息(逻辑删除,加上delete标识) - * @param emc - * @param id - * @throws Exception - */ - protected void delete( EntityManagerContainer emc, String id ) throws Exception { - emc.beginTransaction( TaskList.class ); - TaskList taskList = emc.find( id, TaskList.class ); - if( taskList != null ) { - taskList.setDeleted( true ); - emc.check( taskList , CheckPersistType.all ); - } - emc.commit(); - } - - /** - * 根据工作任务列表标识删除工作任务列表信息(物理删除) - * @param emc - * @param id - * @throws Exception - */ - protected void remove( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - emc.beginTransaction( TaskList.class ); - emc.beginTransaction( TaskListRele.class ); - TaskList taskList = emc.find( id, TaskList.class ); - //还需删除TaskList所有的关联信息 - List lists = business.taskListFactory().listReleWithListId( id ); - if( ListTools.isNotEmpty( lists )) { - for( TaskListRele listRele: lists ) { - emc.remove( listRele , CheckRemoveType.all ); - } - } - if( taskList != null ) { - emc.remove( taskList , CheckRemoveType.all ); - } - emc.commit(); - } - - /** - * 创建默认的工作任务列表(四个) - * @param emc - * @param person - * @param taskGroupId - * @return - * @throws Exception - */ - public List createDefaultTaskListForTaskGroup( EntityManagerContainer emc, String person, String taskGroupId) throws Exception { - List taskLists = new ArrayList<>(); - TaskGroup taskGroup = emc.find( taskGroupId, TaskGroup.class ); - - TaskList taskList = null; - - if( taskGroup != null ) { - Project project = emc.find( taskGroup.getProject(), Project.class ); - - emc.beginTransaction( TaskList.class ); - if(project != null && StringUtils.isNotEmpty( project.getTemplateId() )){ - //如果有模板id,则按模板创建泳道,否则创建默认的四个泳道 - ProjectTemplate projectTemplate = emc.find( project.getTemplateId(), ProjectTemplate.class ); - if(projectTemplate != null){ - List taskListNames = null; - taskListNames = projectTemplate.getTaskList(); - if(ListTools.isNotEmpty( taskListNames )){ - int nameCount = 0; - for( String taskListName : taskListNames ) { - nameCount++; - taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, taskListName, nameCount, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - taskLists.add( taskList ); - } - }else{ - throw new Exception("TaskListTemplate not exists!ProjectTemplateID:" + project.getTemplateId() ); - } - }else{ - throw new Exception("ProjectTemplate not exists!ID:" + project.getTemplateId() ); - } - - }else{ - taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已规划的工作", 1, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - taskLists.add( taskList ); - - taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已分解的任务", 2, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - taskLists.add( taskList ); - - taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "进行中的任务", 3, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - taskLists.add( taskList ); - - taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已完成的任务", 4, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - taskLists.add( taskList ); - } - - - emc.commit(); - } - - return taskLists; - } - - private TaskList composeTaskListObject( String projectId, String taskGroupId, String listName, int orderNum, String creatorName, String owner, String memo ) { - TaskList taskList = new TaskList(); - taskList.setId( TaskList.createId() ); - taskList.setProject( projectId ); - taskList.setTaskGroup( taskGroupId ); - taskList.setMemo( memo ); - taskList.setName( listName ); - taskList.setOrder( orderNum ); - taskList.setCreatorPerson( creatorName ); - taskList.setOwner( owner ); - return taskList; - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListTemplateService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListTemplateService.java deleted file mode 100644 index 82a2d7b67a..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListTemplateService.java +++ /dev/null @@ -1,302 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.entity.annotation.CheckRemoveType; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.ProjectDetail; -import com.x.teamwork.core.entity.ProjectTemplate; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskGroupRele; -import com.x.teamwork.core.entity.TaskList; -import com.x.teamwork.core.entity.TaskListRele; -import com.x.teamwork.core.entity.TaskListTemplate; -import com.x.teamwork.core.entity.tools.filter.QueryFilter; - -class TaskListTemplateService { - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected TaskListTemplate get(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.taskListTemplateFactory().get( flag ); - } - - protected ProjectDetail getDetail(EntityManagerContainer emc, String id) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().getDetail( id ); - } - - /** - * 根据项目的标识查询项目的信息 - * @param emc - * @param flag 主要是ID - * @return - * @throws Exception - */ - protected List getTaskListTemplateWithTemplateId(EntityManagerContainer emc, String flag) throws Exception { - Business business = new Business( emc ); - return business.taskListTemplateFactory().list( flag ); - } - - /** - * 根据过滤条件查询符合要求的项目信息列表 - * @param emc - * @param maxCount - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listWithFilter(maxCount, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 根据条件查询符合条件的项目信息ID,根据上一条的sequnce查询指定数量的信息 - * @param emc - * @param maxCount - * @param sequnce - * @param orderField - * @param orderType - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param group 项目分组 - * @param title - * @return - * @throws Exception - */ - protected List listWithFilter( EntityManagerContainer emc, Integer maxCount, String sequnce, String orderField, String orderType, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listWithFilter(maxCount, sequnce, orderField, orderType, personName, identityNames, unitNames, groupNames, queryFilter); - } - - /** - * 向数据库持久化项目信息 - * @param emc - * @param projectDetail - * @param project - * @return - * @throws Exception - */ - protected TaskListTemplate save( EntityManagerContainer emc, TaskListTemplate object) throws Exception { - TaskListTemplate taskListTemplate = null; - if( StringUtils.isEmpty( object.getId() ) ){ - object.setId( Project.createId() ); - } - - taskListTemplate = emc.find( object.getId(), TaskListTemplate.class ); - - emc.beginTransaction( Project.class ); - emc.beginTransaction( ProjectDetail.class ); - - if( taskListTemplate == null ){ // 保存一个新的对象 - taskListTemplate = new TaskListTemplate(); - object.copyTo( taskListTemplate ); - if( StringUtils.isNotEmpty( object.getId() ) ){ - taskListTemplate.setId( object.getId() ); - } - emc.persist( taskListTemplate, CheckPersistType.all); - }else{ //对象已经存在,更新对象信息 - if( StringUtils.isNotEmpty( taskListTemplate.getOwner() )) { - object.setOwner( taskListTemplate.getOwner() ); - } - object.copyTo( taskListTemplate, JpaObject.FieldsUnmodify ); - emc.check( taskListTemplate, CheckPersistType.all ); - } - emc.commit(); - return taskListTemplate; - } - - /** - * 根据项目模板标识删除项目模板信息 - * @param emc - * @param id - * @throws Exception - */ - protected void delete(EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - TaskListTemplate taskListTemplate = emc.find( id, TaskListTemplate.class ); - if( taskListTemplate != null ) { - emc.beginTransaction( TaskListTemplate.class ); - emc.beginTransaction( ProjectTemplate.class ); - if( taskListTemplate != null ) { - //emc.remove( projectTemplate , CheckRemoveType.all ); - //改为软删除 - taskListTemplate.setDeleted(true); - emc.check( taskListTemplate , CheckPersistType.all ); - } - //还需要删除所有的TaskListTemplate - List TaskListTemplates = business.taskListTemplateFactory().list(taskListTemplate.getId()); - if( ListTools.isNotEmpty(TaskListTemplates)) { - for( TaskListTemplate TaskListTemplate : TaskListTemplates ) { - //emc.remove( task , CheckRemoveType.all ); - TaskListTemplate.setDeleted(true); - emc.check( TaskListTemplate , CheckPersistType.all ); - } - } - emc.commit(); - } - } - /** - * 根据工作任务标识删除工作任务信息(物理删除) - * @param emc - * @param flag 主要是ID - * @throws Exception - */ - public void remove( EntityManagerContainer emc, String flag ) throws Exception { - emc.beginTransaction( Task.class ); - emc.beginTransaction( Review.class ); - emc.beginTransaction( TaskDetail.class ); - emc.beginTransaction( TaskListRele.class ); - emc.beginTransaction( TaskGroupRele.class ); - removeTaskWithChildren( emc, flag); - emc.commit(); - } - /** - * 根据工作任务标识删除工作任务信息( 物理删除 ) - * @param emc - * @param id - * @throws Exception - */ - private void removeTaskWithChildren( EntityManagerContainer emc, String id ) throws Exception { - Business business = new Business( emc ); - - //还需要递归删除所有的下级Task - List childrenIds = business.taskFactory().listByParent( id ); - if( ListTools.isNotEmpty( childrenIds )) { - for( String _id : childrenIds ) { - removeTaskWithChildren( emc, _id ); - } - } - - //任务列表中的关联信息 - List listReles = business.taskListFactory().listReleWithTask( id ); - if( ListTools.isNotEmpty( listReles )) { - for( TaskListRele taskListRele : listReles ) { - emc.remove( taskListRele , CheckRemoveType.all ); - } - } - - //删除任务组关联信息 - List groupReles = business.taskGroupReleFactory().listTaskReleWithTask( id ); - if( ListTools.isNotEmpty( groupReles )) { - for( TaskGroupRele taskGroupRele : groupReles ) { - emc.remove( taskGroupRele , CheckRemoveType.all ); - } - } - - Task task = emc.find( id, Task.class ); - TaskDetail taskDetail = emc.find( id, TaskDetail.class ); - List reviewList = null; - List> reviewIdBatchs = null; - List reviewIds = business.reviewFactory().listReviewByTask( id, 9999 ); - if( ListTools.isNotEmpty( reviewIds )) { - reviewIdBatchs = ListTools.batch( reviewIds, 1000 ); - } - if( ListTools.isNotEmpty( reviewIdBatchs )) { - for( List batch : reviewIdBatchs ) { - reviewList = emc.list( Review.class, batch ); - if( ListTools.isNotEmpty( reviewList )) { - for( Review review : reviewList ) { - //emc.remove( review, CheckRemoveType.all ); - //改为软删除 - review.setDeleted(true); - emc.check( review, CheckPersistType.all ); - } - } - } - } - if( task != null ) { - //emc.remove( task , CheckRemoveType.all ); - //改为软删除 - task.setDeleted(true); - emc.check( task, CheckPersistType.all ); - } - if( taskDetail != null ) { - emc.remove( taskDetail , CheckRemoveType.all ); - } - } - - /** - * 创建模板的工作任务列表 - * @param emc - * @param person - * @param template - * @return - * @throws Exception - */ - public void createDefaultTaskListForProjectTemplate( EntityManagerContainer emc, String person, ProjectTemplate template) throws Exception { - TaskListTemplate taskList = null; - List taskListsTemplate = template.getTaskList(); - - if( !ListTools.isEmpty( taskListsTemplate )) { - emc.beginTransaction( TaskList.class ); - for( String taskListTemplate: taskListsTemplate ) { - taskList = composeTaskListObject( template.getId(), taskListTemplate, 1, "SYSTEM", person, "" ); - emc.persist( taskList, CheckPersistType.all ); - } - - emc.commit(); - } - } - - private TaskListTemplate composeTaskListObject( String projectTemplateId, String listName, int orderNum, String creatorName, String owner, String memo ) { - TaskListTemplate taskTemplateList = new TaskListTemplate(); - taskTemplateList.setId( TaskListTemplate.createId() ); - taskTemplateList.setName( listName ); - taskTemplateList.setProjectTemplate( projectTemplateId ); - taskTemplateList.setMemo( memo ); - - taskTemplateList.setOrder( orderNum ); - taskTemplateList.setCreatorPerson( creatorName ); - taskTemplateList.setOwner( owner ); - taskTemplateList.setDeleted(false); - return taskTemplateList; - } - - /** - * 根据条件查询项目ID列表,最大查询2000条 - * @param emc - * @param maxCount - * @param personName - * @param identityNames - * @param unitNames - * @param groupNames - * @param queryFilter - * @return - * @throws Exception - */ - public List listAllViewableProjectIds(EntityManagerContainer emc, int maxCount, String personName, List identityNames, List unitNames, List groupNames, QueryFilter queryFilter) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllViewableProjectIds(maxCount, personName, identityNames, unitNames, groupNames, queryFilter); - } - - public List listAllProjectIds(EntityManagerContainer emc ) throws Exception { - Business business = new Business( emc ); - return business.projectFactory().listAllProjectIds(); - } -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java deleted file mode 100644 index b6f3341845..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java +++ /dev/null @@ -1,640 +0,0 @@ -package com.x.teamwork.assemble.control.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.annotation.CheckPersistType; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.tools.ListTools; -import com.x.teamwork.assemble.common.date.DateOperation; -import com.x.teamwork.assemble.control.Business; -import com.x.teamwork.core.entity.Priority; -import com.x.teamwork.core.entity.Project; -import com.x.teamwork.core.entity.Review; -import com.x.teamwork.core.entity.Task; -import com.x.teamwork.core.entity.TaskDetail; -import com.x.teamwork.core.entity.TaskExtField; -import com.x.teamwork.core.entity.TaskStatuType; - -/** - * 对工作任务信息查询的服务 - * - * @author O2LEE - */ -public class TaskPersistService { - - private TaskService taskService = new TaskService(); - private TaskGroupService taskGroupService = new TaskGroupService(); - private UserManagerService userManagerService = new UserManagerService(); - - /** - * 删除任务信息 - * @param flag - * @param effectivePerson - * @throws Exception - */ - public void delete( String flag, EffectivePerson effectivePerson ) throws Exception { - if ( StringUtils.isEmpty( flag )) { - throw new Exception("flag is empty."); - } - Boolean hasDeletePermission = false; - if( effectivePerson.isManager() ) { - hasDeletePermission = true; - } - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Task task = taskService.get(emc, flag); - //管理员可以删除,创建者可以删除,工作任务创建者、管理者都可以删除 - if( !hasDeletePermission ) { - if( task.getCreatorPerson().equalsIgnoreCase( effectivePerson.getDistinguishedName() )) { - hasDeletePermission = true; - }else if( ListTools.isNotEmpty( task.getManageablePersonList() ) && task.getManageablePersonList().contains(effectivePerson.getDistinguishedName() )) { - hasDeletePermission = true; - } - } - if( !hasDeletePermission ) { - throw new Exception("task delete permission denied."); - }else { - taskService.remove( emc, flag ); - taskGroupService.refreshTaskCountInTaskGroupWithTaskId(emc, effectivePerson.getDistinguishedName(), task.getId() ); - } - } catch (Exception e) { - throw e; - } - } - - /** - * 保存工作任务信息 - * @param task - * @param taskDetail - * @param taskExtField - * @param effectivePerson - * @return - * @throws Exception - */ - public Task save( Task task, TaskDetail taskDetail, TaskExtField taskExtField, EffectivePerson effectivePerson ) throws Exception { - if ( task == null) { - throw new Exception( "task is null." ); - } - - if( StringUtils.isEmpty( task.getName() )) { - task.setName("无标题工作任务("+ DateOperation.getNowDateTime() +")"); - } - if( StringUtils.isEmpty( task.getParent() ) ) { - task.setParent("0"); - } - - if( StringUtils.isEmpty( task.getExecutor() ) ) { - task.setExecutor( effectivePerson.getDistinguishedName() ); - } - if( StringUtils.isEmpty( task.getPriority() ) ) { - PriorityQueryService priorityQueryService = new PriorityQueryService(); - List prioritys = priorityQueryService.listPriorityByPerson( effectivePerson.getDistinguishedName() ); - if( ListTools.isNotEmpty( prioritys )) { - Priority priority = prioritys.get(0); - if(priority != null){ - task.setPriority(priority.getPriority()+"||"+priority.getPriorityColor() ); - } - } - } - - if( StringUtils.isEmpty( task.getWorkStatus() ) ) { - task.setWorkStatus( TaskStatuType.processing.name() ); - } - - //校验工作任务的状态变更 - if( TaskStatuType.completed.name().equalsIgnoreCase( task.getWorkStatus() )) { - task.setCompleted( true ); - task.setArchive( false ); - }else if( TaskStatuType.processing.name().equalsIgnoreCase( task.getWorkStatus() )) { - task.setCompleted( false ); - task.setArchive( false ); - }else if( TaskStatuType.archived.name().equalsIgnoreCase( task.getWorkStatus() )) { - task.setCompleted( true ); - task.setArchive( true ); - } - - - String executor = null; - String executorIdentity = null; - String executorUnit = null; - - //前端可能传身份,也可以直接传Person - if( StringUtils.isNotEmpty( task.getExecutorIdentity() ) ) { - executor = userManagerService.getPersonNameWithIdentity( task.getExecutorIdentity() ); - if( StringUtils.isEmpty( executor )) { - throw new Exception("executor identity invalid , executorIdentity:" + task.getExecutorIdentity()); - } - task.setExecutor( executor ); - }else { - if( StringUtils.isNotEmpty( task.getExecutor()) ) { - executorIdentity = userManagerService.getIdentityWithPerson( task.getExecutor(), "min"); - if( StringUtils.isEmpty( executorIdentity )) { - throw new Exception("executor has no identity, please concat manager! person:" + task.getExecutor()); - } - task.setExecutorIdentity(executorIdentity); - }else { - throw new Exception("executor can not empty! "); - } - } - - if( StringUtils.isNotEmpty( task.getExecutorIdentity() ) ) { - executorUnit = userManagerService.getUnitNameByIdentity( task.getExecutorIdentity() ); - if( StringUtils.isEmpty( executorUnit)) { - throw new Exception("executor unit not exists with identity:" + task.getExecutorIdentity()); - } - task.setExecutorUnit( executorUnit ); - } - - if( StringUtils.isEmpty( task.getCreatorPerson() ) ) { - task.setCreatorPerson( effectivePerson.getDistinguishedName() ); - } - if( ListTools.isEmpty( task.getManageablePersonList()) ) { - task.addManageablePerson( effectivePerson.getDistinguishedName()); - } - if(task.getName().length() > 80 ) { - task.setName( task.getName().substring(0, 80) + "..." ); - } - - - if( task.getStartTime() == null ) { - task.setStartTime( new Date() ); - } - if( task.getEndTime() == null ) { - task.setEndTime( new Date( ( task.getStartTime().getTime() + 7*1440*60*1000) ) ); //30分钟之后 - } - - if( ListTools.isEmpty( task.getParticipantList() )) { - task.addParticipant( effectivePerson.getDistinguishedName() ); - } - - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - task = taskService.save( emc, task, taskDetail, taskExtField ); - } catch (Exception e) { - throw e; - } - return task; - } - - /** - * 更新工作任务的标签信息 - * @param id - * @param new_tags - * @param add_tags - * @param remove_tags - * @param effectivePerson - * @return - * @throws Exception - */ - public List updateTag(String id, List new_tags, List add_tags, List remove_tags, EffectivePerson effectivePerson) throws Exception { - if( StringUtils.isEmpty( id )) { - throw new Exception("id can not empty in operation updateTag."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - return taskService.updateTag( emc, id, new_tags, add_tags, remove_tags, effectivePerson ); - } catch (Exception e) { - throw e; - } - } - - - /** - * 更新任务的上级任务ID信息 - * @param taskId - * @param parentId - * @param effectivePerson - * @throws Exception - */ - public void updateParentId( String taskId, String parentId, EffectivePerson effectivePerson) throws Exception { - - if( StringUtils.isEmpty( taskId )) { - throw new Exception("taskId can not empty in update parentId."); - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Task task = emc.find( taskId, Task.class ); - if( task != null ){ - task.setParent( parentId ); - } - emc.beginTransaction( Task.class ); - emc.check( task, CheckPersistType.all ); - emc.commit(); - } catch (Exception e) { - throw e; - } - - } - - /** - * 查询用户是否拥有创建工作任务的权限 - * @param effectivePerson - * @return - * @throws Exception - */ - public boolean checkPermissionForPersist( Project project, EffectivePerson effectivePerson ) throws Exception { - if( effectivePerson.isManager() ) { - return true; - } - String personName = effectivePerson.getDistinguishedName(); - if( userManagerService.isHasPlatformRole( personName, "TeamWorkManager" )) { - return true; - } - //项目的创建者,负责人以及参与者都应该可以在项目内项目任务 - if( project.getCreatorPerson().equalsIgnoreCase( personName )) { - return true; - } - if( project.getExecutor().equalsIgnoreCase( personName )) { - return true; - } - //查询用户所在的所有组织和群组 - if( ListTools.isNotEmpty( project.getParticipantPersonList() ) && project.getParticipantPersonList().contains( personName )) { - return true; - } - - List groupNames = userManagerService.listGroupNamesByPerson(personName); - List unitNames = userManagerService.listUnitNamesWithPerson(personName); - - if( ListTools.isNotEmpty( unitNames )) { - unitNames.retainAll( project.getParticipantUnitList() ); - if( ListTools.isNotEmpty( unitNames )) { - return true; - } - } - - if( ListTools.isNotEmpty( groupNames )) { - groupNames.retainAll( project.getParticipantGroupList() ); - if( ListTools.isNotEmpty( groupNames )) { - return true; - } - } - return false; - } - - /** - * 添加工作任务的参与者 - * @param id - * @param participants_source - * @return - * @throws Exception - */ - public Task addParticipants(String id, List participants_source ) - throws Exception { - if (StringUtils.isEmpty(id)) { - throw new Exception("id is empty."); - } - Task task = null; - List participants = new ArrayList<>(); - if( ListTools.isNotEmpty( participants_source )) { - for( String participant : participants_source ) { - if( !participants.contains( participant ) ) { - participants.add( participant ); - } - } - } - try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) { - task = emc.find(id, Task.class); - if ( task != null ) { - task.setParticipantList( participants ); - emc.beginTransaction( Task.class); - emc.check(task, CheckPersistType.all); - emc.commit(); - } else { - throw new Exception("task not exists.id=" + id); - } - } catch (Exception e) { - throw e; - } - return task; - } - - /** - * 向工作任务管理者中添加指定人员 - * @param id - * @param managers - * @param effectivePerson - * @return - * @throws Exception - */ - public Task addManager(String id, List managers, EffectivePerson effectivePerson) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty."); - } - Task task = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - task = emc.find( id, Task.class ); - if( task != null ) { - task.addManageablePerson(managers); - - emc.beginTransaction( Task.class ); - emc.check( task , CheckPersistType.all ); - emc.commit(); - }else { - throw new Exception("task not exists.id=" + id ); - } - } catch (Exception e) { - throw e; - } - return task; - } - - /** - * 从工作任务管理者中移除指定人员 - * @param id - * @param managers - * @param effectivePerson - * @return - * @throws Exception - */ - public Task removeParticipants(String id, List managers, EffectivePerson effectivePerson) throws Exception { - if ( StringUtils.isEmpty( id )) { - throw new Exception("id is empty."); - } - Task task = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - task = emc.find( id, Task.class ); - if( task != null ) { - task.removeManageablePerson(managers); - - emc.beginTransaction( Task.class ); - emc.check( task , CheckPersistType.all ); - emc.commit(); - }else { - throw new Exception("task not exists.id=" + id ); - } - } catch (Exception e) { - throw e; - } - return task; - } - - /** - * 对指定的工作任务进行归档,递归执行所有的子任务 - * @param taskId - * @throws Exception - */ - public void archiveTask( String taskId ) throws Exception { - if ( StringUtils.isEmpty( taskId )) { - throw new Exception("taskId is empty."); - } - Task task = null; - List subTaskReviews = null; - List subTaskReviewIds = null; - List subTaskIds = null; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Business business = new Business( emc ); - //先归档子任务 - subTaskIds = business.taskFactory().listByParent( taskId ); - if( ListTools.isNotEmpty( subTaskIds )) { - for( String subTaskId : subTaskIds ) { - archiveTask( subTaskId ); - } - } - task = emc.find( taskId, Task.class ); - subTaskReviewIds = business.reviewFactory().listReviewByTask(taskId, 999); - //Task - if( task != null ) { - task.setArchive( true ); - emc.beginTransaction( Task.class ); - emc.check( task , CheckPersistType.all ); - emc.commit(); - } - //Review - if( ListTools.isNotEmpty( subTaskReviewIds ) ) { - subTaskReviews = emc.list( Review.class, subTaskReviewIds ); - if( ListTools.isNotEmpty(subTaskReviews)) { - emc.beginTransaction( Task.class ); - for( Review review : subTaskReviews ) { - review.setArchive( true ); - emc.check( review , CheckPersistType.all ); - } - emc.commit(); - } - } - } catch (Exception e) { - throw e; - } - } - - /** - * 单独修改与任务相关的单个属性值 - * @param taskId - * @param property - * @param mainValue - * @param secondaryValue - * @throws Exception - */ - public void changeTaskProperty( String taskId, String property, String mainValue, String secondaryValue) throws Exception { - if( Task.workStatus_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( Task.priority_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( Task.executor_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( Task.startTime_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( Task.endTime_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( Task.name_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskDetail.detail_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskDetailEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskDetail.description_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskDetailEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_1_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_2_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_3_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_4_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_5_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_6_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_7_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_8_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_1_lob_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_2_lob_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_3_lob_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } else if( TaskExtField.memoString_4_lob_FIELDNAME.equalsIgnoreCase( property )) { - changeTaskExtFieldEntityProperty( taskId, property, mainValue, secondaryValue ); - } - } - - private void changeTaskEntityProperty( String taskId, String property, String mainValue, String secondaryValue) throws Exception { - final String dateStyle = "yyyy-MM-dd HH:mm:ss"; - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Task task = emc.find( taskId, Task.class ); - if( task == null ) { - throw new Exception("task info not exists.ID=" + taskId ); - } - - if( Task.name_FIELDNAME.equalsIgnoreCase( property )) { - task.setName( mainValue ); - }else if( Task.workStatus_FIELDNAME.equalsIgnoreCase( property )) { - task.setWorkStatus( mainValue ); - } else if( Task.priority_FIELDNAME.equalsIgnoreCase( property )) { - /*PriorityQueryService priorityQueryService = new PriorityQueryService(); - if( StringUtils.isNotEmpty( mainValue )) { - String priorityName = mainValue.split("||")[0]; - List prioritys = priorityQueryService.getByName(priorityName); - if(ListTools.isNotEmpty(prioritys)){ - Priority priority = prioritys.get(0); - task.setPriority(priority.getPriority()+"||"+priority.getPriorityColor() ); - } - }*/ - task.setPriority( mainValue ); - } else if( Task.executor_FIELDNAME.equalsIgnoreCase( property )) { - if( StringUtils.isNotEmpty( mainValue )) { - String personName = null, personIdentity = null, personUnit = null; - if( mainValue.endsWith( "@I" )) { - personName = userManagerService.getPersonNameWithIdentity(mainValue); - personUnit = userManagerService.getUnitNameByIdentity(mainValue); - task.setExecutor( personName ); - task.setExecutorIdentity(mainValue); - task.setExecutorUnit(personUnit); - }else if( mainValue.endsWith( "@P" ) ) { - personName = mainValue; - personIdentity = userManagerService.getIdentityWithPerson(personName, "min"); - personUnit = userManagerService.getUnitNameByIdentity(personIdentity); - task.setExecutor( personName ); - task.setExecutorIdentity(personIdentity); - task.setExecutorUnit(personUnit); - } - }else { - throw new Exception("executor or indentity invalid. executor:" + mainValue ); - } - } else if( Task.executorIdentity_FIELDNAME.equalsIgnoreCase( property )) { - if( StringUtils.isNotEmpty( mainValue )) { - String personName = null, personIdentity = null, personUnit = null; - if( mainValue.endsWith( "@I" )) { - personName = userManagerService.getPersonNameWithIdentity(mainValue); - personUnit = userManagerService.getUnitNameByIdentity(mainValue); - task.setExecutor( personName ); - task.setExecutorIdentity(mainValue); - task.setExecutorUnit(personUnit); - }else if( mainValue.endsWith( "@P" ) ) { - personName = mainValue; - personIdentity = userManagerService.getIdentityWithPerson(personName, "min"); - personUnit = userManagerService.getUnitNameByIdentity(personIdentity); - task.setExecutor( personName ); - task.setExecutorIdentity(personIdentity); - task.setExecutorUnit(personUnit); - } - }else { - throw new Exception("executor or indentity invalid. executor:" + mainValue ); - } - } else if( Task.startTime_FIELDNAME.equalsIgnoreCase( property )) { - try { - task.setStartTime( DateOperation.getDateFromString( mainValue, dateStyle )); - }catch( Exception e ) { - new Exception("将传入的参数转化为日期格式时发生异常:" + mainValue ); - } - - if( secondaryValue != null && StringUtils.isNotEmpty( secondaryValue.toString()) ) { - try { - task.setEndTime( DateOperation.getDateFromString( mainValue, dateStyle ) ); - }catch( Exception e ) { - new Exception("将传入的参数转化为日期格式时发生异常:" + mainValue ); - } - } - } else if( Task.endTime_FIELDNAME.equalsIgnoreCase( property )) { - try { - task.setEndTime( DateOperation.getDateFromString( mainValue, dateStyle ) ); - }catch( Exception e ) { - new Exception("将传入的参数转化为日期格式时发生异常:" + mainValue ); - } - } - emc.beginTransaction( Task.class ); - emc.check( task, CheckPersistType.all ); - emc.commit(); - } catch (Exception e) { - throw e; - } - } - - /** - * 变更工作任务详情的属性 - * @param taskId - * @param property - * @param mainValue - * @param secondaryValue - * @throws Exception - */ - private void changeTaskDetailEntityProperty( String taskId, String property, String mainValue, String secondaryValue ) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - TaskDetail detail = emc.find( taskId, TaskDetail.class ); - if( detail == null ) { - throw new Exception("task detail info not exists.ID=" + taskId ); - } - if( TaskDetail.detail_FIELDNAME.equalsIgnoreCase( property )) { - detail.setDetail( mainValue ); - }else if( TaskDetail.description_FIELDNAME.equalsIgnoreCase( property )) { - detail.setDescription(mainValue ); - } - emc.beginTransaction( TaskDetail.class ); - emc.check( detail, CheckPersistType.all ); - emc.commit(); - } catch (Exception e) { - throw e; - } - } - - /** - * 变更工作任务扩展属性信息 - * @param taskId - * @param property - * @param mainValue - * @param secondaryValue - * @throws Exception - */ - private void changeTaskExtFieldEntityProperty(String taskId, String property, String mainValue, String secondaryValue) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - TaskExtField taskExtField = emc.find( taskId, TaskExtField.class ); - if( taskExtField == null ) { - throw new Exception("task extField info not exists.ID=" + taskId ); - } - if( TaskExtField.memoString_1_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_1( mainValue ); - } else if( TaskExtField.memoString_2_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_2( mainValue ); - } else if( TaskExtField.memoString_3_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_3( mainValue ); - } else if( TaskExtField.memoString_4_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_4( mainValue ); - } else if( TaskExtField.memoString_5_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_5( mainValue ); - } else if( TaskExtField.memoString_6_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_6( mainValue ); - } else if( TaskExtField.memoString_7_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_7( mainValue ); - } else if( TaskExtField.memoString_8_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_8( mainValue ); - } else if( TaskExtField.memoString_1_lob_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_1_lob( mainValue ); - } else if( TaskExtField.memoString_2_lob_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_2_lob( mainValue ); - } else if( TaskExtField.memoString_3_lob_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_3_lob( mainValue ); - } else if( TaskExtField.memoString_4_lob_FIELDNAME.equalsIgnoreCase( property )) { - taskExtField.setMemoString_4_lob( mainValue ); - } - emc.beginTransaction( TaskExtField.class ); - emc.check( taskExtField, CheckPersistType.all ); - emc.commit(); - } catch (Exception e) { - throw e; - } - } - - -} diff --git a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/x_teamwork_assemble_control.java b/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/x_teamwork_assemble_control.java deleted file mode 100644 index fb4f624d59..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/x_teamwork_assemble_control.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.x.teamwork.assemble.control; - -import com.x.base.core.project.Deployable; -import com.x.base.core.project.annotation.Module; -import com.x.base.core.project.annotation.ModuleCategory; -import com.x.base.core.project.annotation.ModuleType; - -@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.CUSTOM, name = "团队管理", packageName = "com.x.teamwork.assemble.control", containerEntities = { - "com.x.teamwork.core.entity.Attachment","com.x.teamwork.core.entity.BatchOperation","com.x.teamwork.core.entity.Chat","com.x.teamwork.core.entity.ChatContent","com.x.teamwork.core.entity.Config","com.x.teamwork.core.entity.CustomExtFieldRele","com.x.teamwork.core.entity.Dynamic" - ,"com.x.teamwork.core.entity.DynamicDetail","com.x.teamwork.core.entity.Priority","com.x.teamwork.core.entity.Project","com.x.teamwork.core.entity.ProjectConfig","com.x.teamwork.core.entity.ProjectDetail","com.x.teamwork.core.entity.ProjectGroup" - ,"com.x.teamwork.core.entity.ProjectGroupRele","com.x.teamwork.core.entity.ProjectGroupRele","com.x.teamwork.core.entity.ProjectGroupRele","com.x.teamwork.core.entity.ProjectTemplate","com.x.teamwork.core.entity.Review","com.x.teamwork.core.entity.SystemConfig" - ,"com.x.teamwork.core.entity.SystemConfig","com.x.teamwork.core.entity.PersistenceProperties","com.x.teamwork.core.entity.SystemConfigLobValue","com.x.teamwork.core.entity.Task","com.x.teamwork.core.entity.TaskDetail","com.x.teamwork.core.entity.TaskExtField" - ,"com.x.teamwork.core.entity.TaskExtField","com.x.teamwork.core.entity.TaskGroup","com.x.teamwork.core.entity.TaskGroupRele","com.x.teamwork.core.entity.TaskList","com.x.teamwork.core.entity.TaskListRele","com.x.teamwork.core.entity.TaskListTemplate" - ,"com.x.teamwork.core.entity.TaskRelevance","com.x.teamwork.core.entity.TaskStatuType","com.x.teamwork.core.entity.TaskTag","com.x.teamwork.core.entity.TaskTagRele","com.x.teamwork.core.entity.TaskView"}, - storeJars = { "x_organization_core_entity", - "x_organization_core_express" }, customJars = { "x_teamwork_core_entity" }) -public class x_teamwork_assemble_control extends Deployable { -} diff --git a/o2server/x_teamwork_assemble_control/src/main/webapp/WEB-INF/web.xml b/o2server/x_teamwork_assemble_control/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 1552b6dec3..0000000000 --- a/o2server/x_teamwork_assemble_control/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1 +0,0 @@ -x_teamwork_assemble_controlprojectcom.x.teamwork.assemble.control.x_teamwork_assemble_control \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/pom.xml b/o2server/x_teamwork_core_entity/pom.xml deleted file mode 100644 index 309e1a966e..0000000000 --- a/o2server/x_teamwork_core_entity/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - 4.0.0 - - o2oa - o2server - 5 - - x_teamwork_core_entity - jar - - - o2oa - x_base_core_project - - - - - - org.codehaus.mojo - exec-maven-plugin - - - metaModelBuilder - generate-sources - - java - - - true - true - true - com.x.base.core.entity.tools.MetaModelBuilder - - ${basedir} - ${project.build.sourceDirectory} - ${project.build.outputDirectory} - - - - - enhanceBuilder - process-classes - - java - - - true - true - true - com.x.base.core.entity.tools.EnhanceBuilder - - ${project.build.directory} - ${project.build.outputDirectory} - - - - - checkCore - prepare-package - - java - - - true - true - true - com.x.base.core.project.build.CheckCore - - - - - - maven-resources-plugin - - - copy-jar - verify - - copy-resources - - - ../../o2server/custom/jars - - - target - - ${project.artifactId}.jar - - - - - - - - - maven-compiler-plugin - - - initialize - - compile - - - - - - - \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Config.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Config.java deleted file mode 100644 index 16c75cd36d..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Config.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.x.teamwork.core.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.tools.DateTools; - -/** - * 优先级信息 - * - * @author O2LJ - * - */ -@ContainerEntity -@Entity -@Table(name = PersistenceProperties.Config.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Config.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class Config extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.Config.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - /** 生成默认排序号 */ - if (null == this.order) { - this.order = DateTools.timeOrderNumber(); - } - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String relationId_FIELDNAME = "relationId"; - @FieldDescribe("关联对象id.") - @Column(length = length_id, name = ColumnNamePrefix + relationId_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + relationId_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String relationId; - - public static final String type_FIELDNAME = "type"; - @FieldDescribe("配置类型") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + type_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String type; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order; - - public static final String owner_FIELDNAME = "owner"; - @FieldDescribe("创建者") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + owner_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + owner_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String owner; - - public String getRelationId() { - return relationId; - } - - public void setRelationId(String relationId) { - this.relationId = relationId; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/CustomExtFieldRele.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/CustomExtFieldRele.java deleted file mode 100644 index b955102c6d..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/CustomExtFieldRele.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.x.teamwork.core.entity; - -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Lob; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; - -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) -@Entity -@Table(name = PersistenceProperties.CustomExtFieldRele.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.CustomExtFieldRele.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class CustomExtFieldRele extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - - private static final String TABLE = PersistenceProperties.CustomExtFieldRele.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成(必填).") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String correlationId_FIELDNAME = "correlationId"; - @FieldDescribe("关联ID(非必填)") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + correlationId_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + correlationId_FIELDNAME) - private String correlationId; - - public static final String extFieldName_FIELDNAME = "extFieldName"; - @FieldDescribe("扩展属性列名(必填)") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + extFieldName_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + extFieldName_FIELDNAME) - private String extFieldName; - - public static final String displayName_FIELDNAME = "displayName"; - @FieldDescribe("显示属性名称(必填)") - @Column( length = JpaObject.length_64B, name = ColumnNamePrefix + displayName_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + displayName_FIELDNAME) - private String displayName; - - public static final String displayType_FIELDNAME = "displayType"; - @FieldDescribe("类型:TEXT|SELECT|MUTISELECT|RICHTEXT|DATE|DATETIME|PERSON|IDENTITY|UNIT|GROUP|(必填)") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + displayType_FIELDNAME) - private String displayType="TEXT"; - - public static final String type_FIELDNAME = "type"; - @FieldDescribe("类型:project|task(必填)") - @Column( length = JpaObject.length_64B, name = ColumnNamePrefix + type_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + type_FIELDNAME) - private String type; - - public static final String optionsData_FIELDNAME = "optionsData"; - @FieldDescribe("选择荐的备选数据,数据Json, displayType=SELECT|MUTISELECT时必须填写,否则无选择项") - @Lob - @Basic(fetch = FetchType.EAGER) - @Column( length = JpaObject.length_1M, name = ColumnNamePrefix + optionsData_FIELDNAME) - private String optionsData; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号(非必填)") - @Column( name = ColumnNamePrefix + order_FIELDNAME) - private Integer order= 0 ; - - public static final String nullable_FIELDNAME = "nullable"; - @FieldDescribe("是否允许为空(非必填)") - @Column( name = ColumnNamePrefix + nullable_FIELDNAME) - private Boolean nullable = true ; - - public static final String description_FIELDNAME = "description"; - @FieldDescribe("说明信息(非必填)") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME) - private String description; - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getDisplayType() { - return displayType; - } - - public void setDisplayType(String displayType) { - this.displayType = displayType; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getOptionsData() { - return optionsData; - } - - public void setOptionsData(String optionsData) { - this.optionsData = optionsData; - } - - public String getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - public String getExtFieldName() { - return extFieldName; - } - - public void setExtFieldName(String extFieldName) { - this.extFieldName = extFieldName; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public Boolean getNullable() { - return nullable; - } - - public void setNullable(Boolean nullable) { - this.nullable = nullable; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/PersistenceProperties.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/PersistenceProperties.java deleted file mode 100644 index 0ea88ff208..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/PersistenceProperties.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.x.teamwork.core.entity; - -import com.x.base.core.entity.AbstractPersistenceProperties; - -public final class PersistenceProperties extends AbstractPersistenceProperties { - - public static class Attachment { - public static final String table = "TEW_ATTACHMENT"; - } - - public static class Project { - public static final String table = "TEW_PROJECT"; - } - - public static class ProjectDetail { - public static final String table = "TEW_PROJECTDETAIL"; - } - - public static class ProjectTemplate { - public static final String table = "TEW_PROJECTTEMPLATE"; - } - - public static class TaskExtField { - public static final String table = "TEW_TASKEXTFIELD"; - } - - public static class ProjectGroup { - public static final String table = "TEW_PROJECTGROUP"; - } - - public static class Task { - public static final String table = "TEW_TASK"; - } - - public static class Review { - public static final String table = "TEW_REVIEW"; - } - - public static class TaskTag { - public static final String table = "TEW_TAG"; - } - - public static class Priority { - public static final String table = "TEW_PIORITY"; - } - - public static class ProjectConfig { - public static final String table = "TEW_PROJECTCONFIG"; - } - - public static class Config { - public static final String table = "TEW_CONFIG"; - } - - public static class TaskDetail { - public static final String table = "TEW_TASKDETAIL"; - } - - public static class TodoList { - public static final String table = "TEW_TASKVIEW"; - } - - public static class TaskGroup { - public static final String table = "TEW_TASKGROUP"; - } - - public static class TaskList { - public static final String table = "TEW_TASKLIST"; - } - - public static class TaskListTemplate { - public static final String table = "TEW_TASKLISTTEMPLATE"; - } - - public static class TaskRelevance { - public static final String table = "TEW_TASKRELEVANCE"; - } - - public static class Dynamic { - public static final String table = "TEW_DYNAMIC"; - } - - public static class DynamicDetail { - public static final String table = "TEW_DYNAMIC_DETAIL"; - } - - public static class Chat { - public static final String table = "TEW_CHAT"; - } - - public static class ChatContent { - public static final String table = "TEW_CHATCONTENT"; - } - - public static class SystemConfig { - public static final String table = "TEW_SYSTEMCONFIG"; - } - - public static class SystemConfigLobValue { - public static final String table = "TEW_SYSTEMCONFIG_LOB"; - } - - - - public static class BatchOperation { - public static final String table = "TEW_BATCHOPERATION"; - } - - public static class ProjectGroupRele { - public static final String table = "TEW_PROJECTGROUP_RELE"; - } - - public static class CustomExtFieldRele { - public static final String table = "TEW_CUSTOMEXTFIELD_RELE"; - } - - public static class TaskGroupRele { - public static final String table = "TEW_TASKGROUP_RELE"; - } - - public static class TaskListRele { - public static final String table = "TEW_TASKLIST_RELE"; - } - - public static class TaskTagRele { - public static final String table = "TEW_TASKTAG_RELE"; - } -} diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Priority.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Priority.java deleted file mode 100644 index 97fb1400bf..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Priority.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.x.teamwork.core.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.tools.DateTools; - -/** - * 优先级信息 - * - * @author O2LJ - * - */ -@ContainerEntity -@Entity -@Table(name = PersistenceProperties.Priority.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Priority.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class Priority extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.Priority.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - /** 生成默认排序号 */ - if (null == this.order) { - this.order = DateTools.timeOrderNumber(); - } - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String priority_FIELDNAME = "priority"; - @FieldDescribe("优先级名称.") - @Column(length = JpaObject.length_255B, name = ColumnNamePrefix + priority_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + priority_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String priority; - - public static final String color_FIELDNAME = "priorityColor"; - @FieldDescribe("优先级颜色") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + color_FIELDNAME) - @CheckPersist( allowEmpty = false ) - private String priorityColor; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order; - - public static final String owner_FIELDNAME = "owner"; - @FieldDescribe("创建者") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + owner_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + owner_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String owner; - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getPriorityColor() { - return priorityColor; - } - - public void setPriorityColor(String priorityColor) { - this.priorityColor = priorityColor; - } - - -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Project.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Project.java deleted file mode 100644 index 451c95634e..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Project.java +++ /dev/null @@ -1,504 +0,0 @@ -package com.x.teamwork.core.entity; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.commons.lang3.StringUtils; -import org.apache.openjpa.persistence.PersistentCollection; -import org.apache.openjpa.persistence.jdbc.ContainerTable; -import org.apache.openjpa.persistence.jdbc.ElementColumn; -import org.apache.openjpa.persistence.jdbc.ElementIndex; -import org.apache.openjpa.persistence.jdbc.Index; -import org.apache.openjpa.persistence.jdbc.OrderColumn; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.tools.ListTools; - -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) -@Entity -@Table(name = PersistenceProperties.Project.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Project.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class Project extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.Project.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String title_FIELDNAME = "title"; - @FieldDescribe("项目名称") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + title_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + title_FIELDNAME) - private String title; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order; - - public static final String type_FIELDNAME = "type"; - @FieldDescribe("项目类型:普通项目 | 软件项目") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + type_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + type_FIELDNAME) - @CheckPersist(allowEmpty = true ) - private String type = "普通项目"; - - public static final String icon_FIELDNAME = "icon"; - @FieldDescribe("图标文件ID") - @Column( length = JpaObject.length_id, name = ColumnNamePrefix + icon_FIELDNAME) - @CheckPersist(allowEmpty = true ) - private String icon = null; - - public static final String progress_FIELDNAME = "progress"; - @FieldDescribe("总体进度:记录4位数,显示的时候除以100") - @Column( name = ColumnNamePrefix + progress_FIELDNAME) - private Integer progress = 0; - - public static final String groupCount_FIELDNAME = "groupCount"; - @FieldDescribe("分组个数,未分组为0") - @Column( name = ColumnNamePrefix + groupCount_FIELDNAME) - private Integer groupCount = 0; - - public static final String deleted_FIELDNAME = "deleted"; - @FieldDescribe("是否已经删除") - @Column( name = ColumnNamePrefix + deleted_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + deleted_FIELDNAME ) - private Boolean deleted = false; - - public static final String completed_FIELDNAME = "completed"; - @FieldDescribe("是否已经完成") - @Column( name = ColumnNamePrefix + completed_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + completed_FIELDNAME ) - private Boolean completed = false; - - public static final String archive_FIELDNAME = "archive"; - @FieldDescribe("是否已经归档") - @Column( name = ColumnNamePrefix + archive_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + archive_FIELDNAME ) - private Boolean archive = false; - - public static final String createable_FIELDNAME = "createable"; - @FieldDescribe("是否可新建任务") - @Column( name = ColumnNamePrefix + createable_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + createable_FIELDNAME ) - private Boolean createable = true; - - public static final String creatorPerson_FIELDNAME = "creatorPerson"; - @FieldDescribe("创建者,可能为System,如果由系统创建。") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorPerson_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String creatorPerson; - - public static final String executor_FIELDNAME = "executor"; - @FieldDescribe("执行者|负责人") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executor_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + executor_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executor; - - public static final String templateId_FIELDNAME = "templateId"; - @FieldDescribe("模板id") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + templateId_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + templateId_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String templateId; - - public static final String starPersonList_FIELDNAME = "starPersonList"; - @FieldDescribe("标星人员") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + starPersonList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + starPersonList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + starPersonList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + starPersonList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List starPersonList; - - public static final String participantPersonList_FIELDNAME = "participantPersonList"; - @FieldDescribe("参与人员") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + participantPersonList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + participantPersonList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + participantPersonList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + participantPersonList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List participantPersonList; - - public static final String participantIdentityList_FIELDNAME = "participantIdentityList"; - @FieldDescribe("参与人员身份") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + participantIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + participantIdentityList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + participantIdentityList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + participantIdentityList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List participantIdentityList; - - public static final String participantUnitList_FIELDNAME = "participantUnitList"; - @FieldDescribe("参与组织") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + participantUnitList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + participantUnitList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + participantUnitList_FIELDNAME ) - @ElementIndex(name = TABLE + IndexNameMiddle + participantUnitList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List participantUnitList; - - public static final String participantGroupList_FIELDNAME = "participantGroupList"; - @FieldDescribe("参与群组") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + participantGroupList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + participantGroupList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + participantGroupList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + participantGroupList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List participantGroupList; - - public static final String manageablePersonList_FIELDNAME = "manageablePersonList"; - @FieldDescribe("管理者") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + manageablePersonList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + manageablePersonList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + manageablePersonList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + manageablePersonList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List manageablePersonList; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - public Integer getProgress() { - return progress; - } - - public void setProgress(Integer progress) { - this.progress = progress; - } - - public String getCreatorPerson() { - return creatorPerson; - } - - public void setCreatorPerson(String creatorPerson) { - this.creatorPerson = creatorPerson; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getTemplateId() { - return templateId; - } - - public void setTemplateId(String templateId) { - this.templateId = templateId; - } - - public List getParticipantPersonList() { - return participantPersonList; - } - - public void setParticipantPersonList(List participantPersonList) { - this.participantPersonList = participantPersonList; - } - - public List getParticipantUnitList() { - return participantUnitList; - } - - public void setParticipantUnitList(List participantUnitList) { - this.participantUnitList = participantUnitList; - } - - public List getParticipantGroupList() { - return participantGroupList; - } - - public void setParticipantGroupList(List participantGroupList) { - this.participantGroupList = participantGroupList; - } - - public List getManageablePersonList() { - return manageablePersonList; - } - - public void setManageablePersonList(List manageablePersonList) { - this.manageablePersonList = manageablePersonList; - } - - public List getParticipantIdentityList() { - return participantIdentityList; - } - - public void setParticipantIdentityList(List participantIdentityList) { - this.participantIdentityList = participantIdentityList; - } - - public List getStarPersonList() { - return starPersonList; - } - - public void setStarPersonList(List starPersonList) { - this.starPersonList = starPersonList; - } - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(Boolean completed) { - this.completed = completed; - } - - public Boolean getArchive() { - return archive; - } - - public void setArchive(Boolean archive) { - this.archive = archive; - } - - public Boolean getCreateable() { - return createable; - } - - public void setCreateable(Boolean createable) { - this.createable = createable; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public void addStarPerson( String distinguishedName ) { - this.starPersonList = addStringToList( distinguishedName , this.starPersonList ); - } - public void addStarPersons( List distinguishedNames ) { - this.starPersonList = addListToList( distinguishedNames , this.starPersonList ); - } - public void removeStarPerson( String distinguishedName ) { - this.starPersonList = removeStringFromList( distinguishedName , this.starPersonList ); - } - public void removeStarPersons( List distinguishedNames ) { - this.starPersonList = removeListFromList( distinguishedNames , this.starPersonList ); - } - - public void addManageablePerson( String distinguishedName ) { - this.manageablePersonList = addStringToList( distinguishedName , this.manageablePersonList ); - } - public void addManageablePerson( List distinguishedNames ) { - this.manageablePersonList = addListToList( distinguishedNames , this.manageablePersonList ); - } - public void removeManageablePerson( String distinguishedName ) { - this.manageablePersonList = removeStringFromList( distinguishedName , this.manageablePersonList ); - } - public void removeManageablePersons( List distinguishedNames ) { - this.manageablePersonList = removeListFromList( distinguishedNames , this.manageablePersonList ); - } - - public void addParticipantGroup( String distinguishedName ) { - this.participantGroupList = addStringToList( distinguishedName , this.participantGroupList ); - } - public void addParticipantGroup( List distinguishedNames ) { - this.participantGroupList = addListToList( distinguishedNames , this.participantGroupList ); - } - public void removeParticipantGroup( String distinguishedName ) { - this.participantGroupList = removeStringFromList( distinguishedName , this.participantGroupList ); - } - public void removeParticipantGroups( List distinguishedNames ) { - this.participantGroupList = removeListFromList( distinguishedNames , this.participantGroupList ); - } - - public void addParticipantUnit( String distinguishedName ) { - this.participantUnitList = addStringToList( distinguishedName , this.participantUnitList ); - } - public void addParticipantUnit( List distinguishedNames ) { - this.participantUnitList = addListToList( distinguishedNames , this.participantUnitList ); - } - public void removeParticipantUnit( String distinguishedName ) { - this.participantUnitList = removeStringFromList( distinguishedName , this.participantUnitList ); - } - public void removeParticipantUnits( List distinguishedNames ) { - this.participantUnitList = removeListFromList( distinguishedNames , this.participantUnitList ); - } - - public void addParticipantPerson( String distinguishedName ) { - this.participantPersonList = addStringToList( distinguishedName , this.participantPersonList ); - } - public void addParticipantPerson( List distinguishedNames ) { - this.participantPersonList = addListToList( distinguishedNames , this.participantPersonList ); - } - public void removeParticipantPerson( String distinguishedName ) { - this.participantPersonList = removeStringFromList( distinguishedName , this.participantPersonList ); - } - public void removeParticipantPersons( List distinguishedNames ) { - this.participantPersonList = removeListFromList( distinguishedNames , this.participantPersonList ); - } - - public void addParticipantIdentity( String distinguishedName ) { - this.participantIdentityList = addStringToList( distinguishedName , this.participantIdentityList ); - } - public void addParticipantIdentity( List distinguishedNames ) { - this.participantIdentityList = addListToList( distinguishedNames , this.participantIdentityList ); - } - public void removeParticipantIdentity( String distinguishedName ) { - this.participantIdentityList = removeStringFromList( distinguishedName , this.participantIdentityList ); - } - public void removeParticipantIdentitys( List distinguishedNames ) { - this.participantIdentityList = removeListFromList( distinguishedNames , this.participantIdentityList ); - } - - public Integer getGroupCount() { - return groupCount; - } - - public void setGroupCount(Integer groupCount) { - this.groupCount = groupCount; - } - - private List removeStringFromList( String source, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( StringUtils.isEmpty( source )) { - return targetList; - } - if( targetList.contains( source )) { - targetList.remove( source ); - } - return targetList; - } - - private List removeListFromList( List sourceList, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( ListTools.isEmpty( sourceList )) { - return targetList; - } - List result = new ArrayList<>(); - for( String target : targetList ) { - if( !sourceList.contains( target )) { - result.add( target ); - } - } - targetList = result; - return targetList; - } - - private List addStringToList( String source, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( StringUtils.isEmpty( source )) { - return targetList; - } - if( !targetList.contains( source )) { - targetList.add( source ); - } - return targetList; - } - - private List addListToList( List sourceList, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( ListTools.isEmpty( sourceList )) { - return targetList; - } - if( ListTools.isNotEmpty( sourceList )) { - for( String source : sourceList ) { - if( !targetList.contains( source )) { - targetList.add(source); - } - } - } - return targetList; - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectConfig.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectConfig.java deleted file mode 100644 index 9eb12fcdca..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectConfig.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.x.teamwork.core.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.tools.DateTools; - -/** - * 优先级信息 - * - * @author O2LJ - * - */ -@ContainerEntity -@Entity -@Table(name = PersistenceProperties.ProjectConfig.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.ProjectConfig.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class ProjectConfig extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.ProjectConfig.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - /** 生成默认排序号 */ - if (null == this.order) { - this.order = DateTools.timeOrderNumber(); - } - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String project_FIELDNAME = "project"; - @FieldDescribe("项目信息ID.") - @Column(length = length_id, name = ColumnNamePrefix + project_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + project_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String project; - - public static final String taskCreate_FIELDNAME = "taskCreate"; - @FieldDescribe("新建任务") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + taskCreate_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + taskCreate_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean taskCreate; - - public static final String taskCopy_FIELDNAME = "taskCopy"; - @FieldDescribe("复制任务") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + taskCopy_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + taskCopy_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean taskCopy; - - public static final String taskRemove_FIELDNAME = "taskRemove"; - @FieldDescribe("删除任务") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + taskRemove_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + taskRemove_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean taskRemove; - - public static final String laneCreate_FIELDNAME = "laneCreate"; - @FieldDescribe("新建泳道") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + laneCreate_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + laneCreate_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean laneCreate; - - public static final String laneEdit_FIELDNAME = "laneEdit"; - @FieldDescribe("编辑泳道") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + laneEdit_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + laneEdit_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean laneEdit; - - public static final String laneRemove_FIELDNAME = "laneRemove"; - @FieldDescribe("删除泳道") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + laneRemove_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + laneRemove_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean laneRemove; - - public static final String attachmentUpload_FIELDNAME = "attachmentUpload"; - @FieldDescribe("上传附件") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + attachmentUpload_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + attachmentUpload_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean attachmentUpload; - - public static final String comment_FIELDNAME = "comment"; - @FieldDescribe("允许评论") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + comment_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + comment_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean comment; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order; - - public static final String owner_FIELDNAME = "owner"; - @FieldDescribe("创建者") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + owner_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + owner_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String owner; - - public static final String description_FIELDNAME = "description"; - @FieldDescribe("描述.") - @Column(length = length_id, name = ColumnNamePrefix + description_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + description_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String description; - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public Boolean getTaskCreate() { - return taskCreate; - } - - public void setTaskCreate(Boolean taskCreate) { - this.taskCreate = taskCreate; - } - - public Boolean getTaskCopy() { - return taskCopy; - } - - public void setTaskCopy(Boolean taskCopy) { - this.taskCopy = taskCopy; - } - - public Boolean getTaskRemove() { - return taskRemove; - } - - public void setTaskRemove(Boolean taskRemove) { - this.taskRemove = taskRemove; - } - - public Boolean getLaneCreate() { - return laneCreate; - } - - public void setLaneCreate(Boolean laneCreate) { - this.laneCreate = laneCreate; - } - - public Boolean getLaneEdit() { - return laneEdit; - } - - public void setLaneEdit(Boolean laneEdit) { - this.laneEdit = laneEdit; - } - - public Boolean getLaneRemove() { - return laneRemove; - } - - public void setLaneRemove(Boolean laneRemove) { - this.laneRemove = laneRemove; - } - - public Boolean getAttachmentUpload() { - return attachmentUpload; - } - - public void setAttachmentUpload(Boolean attachmentUpload) { - this.attachmentUpload = attachmentUpload; - } - - public Boolean getComment() { - return comment; - } - - public void setComment(Boolean comment) { - this.comment = comment; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectTemplate.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectTemplate.java deleted file mode 100644 index feebfc06c4..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/ProjectTemplate.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.x.teamwork.core.entity; - -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.PersistentCollection; -import org.apache.openjpa.persistence.jdbc.ContainerTable; -import org.apache.openjpa.persistence.jdbc.ElementColumn; -import org.apache.openjpa.persistence.jdbc.ElementIndex; -import org.apache.openjpa.persistence.jdbc.Index; -import org.apache.openjpa.persistence.jdbc.OrderColumn; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; - -/** - * 项目模板信息 - * - * @author O2LJ - * - */ -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) -@Entity -@Table(name = PersistenceProperties.ProjectTemplate.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.ProjectTemplate.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class ProjectTemplate extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.ProjectTemplate.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String title_FIELDNAME = "title"; - @FieldDescribe("模板名称") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + title_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + title_FIELDNAME) - private String title; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order; - - public static final String type_FIELDNAME = "type"; - @FieldDescribe("模板类型") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + type_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + type_FIELDNAME) - @CheckPersist(allowEmpty = true ) - private String type; - - public static final String icon_FIELDNAME = "icon"; - @FieldDescribe("图标文件ID") - @Column( length = JpaObject.length_id, name = ColumnNamePrefix + icon_FIELDNAME) - @CheckPersist(allowEmpty = true ) - private String icon = null; - - public static final String description_FIELDNAME = "description"; - @FieldDescribe("描述") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + description_FIELDNAME) - @CheckPersist(allowEmpty = true ) - private String description; - - public static final String owner_FIELDNAME = "owner"; - @FieldDescribe("创建者") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + owner_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + owner_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String owner; - - public static final String taskList_FIELDNAME = "taskList"; - @FieldDescribe("默认永道") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + taskList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + taskList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = JpaObject.length_255B, name = ColumnNamePrefix + taskList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + taskList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List taskList; - - public static final String deleted_FIELDNAME = "deleted"; - @FieldDescribe("是否已经删除") - @Column( name = ColumnNamePrefix + deleted_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + deleted_FIELDNAME ) - private Boolean deleted = false; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public List getTaskList() { - return taskList; - } - - public void setTaskList(List taskList) { - this.taskList = taskList; - } - - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Review.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Review.java deleted file mode 100644 index 101ca6282d..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Review.java +++ /dev/null @@ -1,559 +0,0 @@ -package com.x.teamwork.core.entity; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.openjpa.persistence.jdbc.Index; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; - -@Entity -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) -@Table(name = PersistenceProperties.Review.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Review.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class Review extends SliceJpaObject { - - private static final long serialVersionUID = -570048661936488247L; - - private static final String TABLE = PersistenceProperties.Review.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - /* 以上为 JpaObject 默认字段 */ - public void onPersist() throws Exception { - } - - public static final String taskId_FIELDNAME = "taskId"; - @FieldDescribe("工作任务ID.") - @Column(length = length_id, name = ColumnNamePrefix + taskId_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + taskId_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String taskId; - - public static final String taskSequence_FIELDNAME = "taskSequence"; - @FieldDescribe("工作任务序列") - @Column(length = JpaObject.length_128B, name = ColumnNamePrefix + taskSequence_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle +taskSequence_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String taskSequence; - - public static final String permissionObj_FIELDNAME = "permissionObj"; - @FieldDescribe("权限拥有者") - @Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + permissionObj_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + permissionObj_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String permissionObj; - - public static final String permissionObjType_FIELDNAME = "permissionObjType"; - @FieldDescribe("权限拥有者类型: PERSON|IDENTITY|UNIT|GROUP|ROLE") - @Column(length = JpaObject.length_16B, name = ColumnNamePrefix + permissionObjType_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String permissionObjType; - - public static final String project_FIELDNAME = "project"; - @FieldDescribe("所属项目ID.") - @Column(length = length_id, name = ColumnNamePrefix + project_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + project_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String project; - - public static final String projectName_FIELDNAME = "projectName"; - @FieldDescribe("所属项目名称.") - @Column(length = length_id, name = ColumnNamePrefix + projectName_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String projectName; - - public static final String parent_FIELDNAME = "parent"; - @FieldDescribe("父级工作任务ID.") - @Column(length = length_id, name = ColumnNamePrefix + parent_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + parent_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String parent; - - public static final String name_FIELDNAME = "name"; - @FieldDescribe("工作任务名称") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + name_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String name; - - public static final String startTime_FIELDNAME = "startTime"; - @FieldDescribe("工作开始时间") - @Column( name = ColumnNamePrefix + startTime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + startTime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Date startTime; - - public static final String endTime_FIELDNAME = "endTime"; - @FieldDescribe("工作开始时间") - @Column( name = ColumnNamePrefix + endTime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + endTime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Date endTime; - - public static final String tagContent_FIELDNAME = "tagContent"; - @FieldDescribe("展示用,工作任务的标签信息,用#号分隔") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + tagContent_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + tagContent_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String tagContent = ""; - - public static final String priority_FIELDNAME = "priority"; - @FieldDescribe("工作等级:普通、紧急、特急") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + priority_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + priority_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String priority = "普通"; - - public static final String workStatus_FIELDNAME = "workStatus"; - @FieldDescribe("工作状态:草稿、未开始、执行中、已完成、已挂起、已取消") - @Column( length = JpaObject.length_32B, name = ColumnNamePrefix + workStatus_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + workStatus_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String workStatus = "草稿"; - - public static final String completed_FIELDNAME = "completed"; - @FieldDescribe("是否已完成") - @Column( name = ColumnNamePrefix + completed_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + completed_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean completed = false; - - public static final String claimed_FIELDNAME = "claimed"; - @FieldDescribe("是否已认领") - @Column( name = ColumnNamePrefix + claimed_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + claimed_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean claimed = false; - - public static final String overtime_FIELDNAME = "overtime"; - @FieldDescribe("是否已超时") - @Column( name = ColumnNamePrefix + overtime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + overtime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean overtime = false; - - public static final String deleted_FIELDNAME = "deleted"; - @FieldDescribe("是否已经删除") - @Column( name = ColumnNamePrefix + deleted_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + deleted_FIELDNAME ) - private Boolean deleted = false; - - public static final String remindRelevance_FIELDNAME = "remindRelevance"; - @FieldDescribe("提醒关联任务") - @Column( name = ColumnNamePrefix + remindRelevance_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + remindRelevance_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean remindRelevance; - - public static final String archive_FIELDNAME = "archive"; - @FieldDescribe("是否已经归档") - @Column( name = ColumnNamePrefix + archive_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + archive_FIELDNAME ) - private Boolean archive = false; - - public static final String progress_FIELDNAME = "progress"; - @FieldDescribe("工作进度:记录4位数,显示的时候除以100") - @Column( name = ColumnNamePrefix + progress_FIELDNAME) - private Integer progress = 0; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order = 0; - - public static final String executor_FIELDNAME = "executor"; - @FieldDescribe("执行者和负责人") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executor_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + executor_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executor; - - public static final String executorIdentity_FIELDNAME = "executorIdentity"; - @FieldDescribe("执行者|负责人身份") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executorIdentity_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + executorIdentity_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executorIdentity; - - public static final String executorUnit_FIELDNAME = "executorUnit"; - @FieldDescribe("执行者|负责人所属组织") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executorUnit_FIELDNAME ) - @Index( name = TABLE + IndexNameMiddle + executorUnit_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executorUnit; - - public static final String creatorPerson_FIELDNAME = "creatorPerson"; - @FieldDescribe("创建者,可能为System,如果由系统创建。") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorPerson_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String creatorPerson; - - public static final String memoString64_1_FIELDNAME = "memoString64_1"; - @FieldDescribe("备用字符串64属性1.") - @Column(length = length_64B, name = ColumnNamePrefix + memoString64_1_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String memoString64_1 = ""; - - public static final String memoString64_2_FIELDNAME = "memoString64_2"; - @FieldDescribe("备用字符串64属性2.") - @Column(length = length_64B, name = ColumnNamePrefix + memoString64_2_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String memoString64_2 = ""; - - public static final String memoString64_3_FIELDNAME = "memoString64_3"; - @FieldDescribe("备用字符串64属性3.") - @Column(length = length_255B, name = ColumnNamePrefix + memoString64_3_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String memoString64_3 = ""; - - public static final String memoString255_1_FIELDNAME = "memoString255_1"; - @FieldDescribe("备用字符串255属性1.") - @Column(length = length_255B, name = ColumnNamePrefix + memoString255_1_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String memoString255_1 = ""; - - public static final String memoString255_2_FIELDNAME = "memoString255_2"; - @FieldDescribe("备用字符串255属性2.") - @Column(length = length_255B, name = ColumnNamePrefix + memoString255_2_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String memoString255_2 = ""; - - public static final String memoInteger1_FIELDNAME = "memoInteger1"; - @FieldDescribe("备用整型属性1.") - @Column( name = ColumnNamePrefix + memoInteger1_FIELDNAME) - @CheckPersist(allowEmpty = true) - private Integer memoInteger1 = 0; - - public static final String memoInteger2_FIELDNAME = "memoInteger2"; - @FieldDescribe("备用整型属性2.") - @Column( name = ColumnNamePrefix + memoInteger2_FIELDNAME) - @CheckPersist(allowEmpty = true) - private Integer memoInteger2 = 0; - - public static final String memoInteger3_FIELDNAME = "memoInteger3"; - @FieldDescribe("备用整型属性3.") - @Column( name = ColumnNamePrefix + memoInteger3_FIELDNAME) - @CheckPersist(allowEmpty = true) - private Integer memoInteger3 = 0; - - public static final String memoDouble1_FIELDNAME = "memoDouble1"; - @FieldDescribe("备用Double属性1.") - @Column( name = ColumnNamePrefix + memoDouble1_FIELDNAME) - @CheckPersist(allowEmpty = true) - private Double memoDouble1 = 0.0; - - public static final String memoDouble2_FIELDNAME = "memoDouble2"; - @FieldDescribe("备用Double属性2.") - @Column( name = ColumnNamePrefix + memoDouble2_FIELDNAME) - @CheckPersist(allowEmpty = true) - private Double memoDouble2 = 0.0; - - public Boolean getRemindRelevance() { - return remindRelevance; - } - - public void setRemindRelevance(Boolean remindRelevance) { - this.remindRelevance = remindRelevance; - } - - public String getTagContent() { - return tagContent; - } - - public void setTagContent(String tagContent) { - this.tagContent = tagContent; - } - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(Boolean completed) { - this.completed = completed; - } - - public Boolean getOvertime() { - return overtime; - } - - public void setOvertime(Boolean overtime) { - this.overtime = overtime; - } - - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - public Integer getProgress() { - return progress; - } - - public void setProgress(Integer progress) { - this.progress = progress; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getExecutorIdentity() { - return executorIdentity; - } - - public void setExecutorIdentity(String executorIdentity) { - this.executorIdentity = executorIdentity; - } - - public String getExecutorUnit() { - return executorUnit; - } - - public void setExecutorUnit(String executorUnit) { - this.executorUnit = executorUnit; - } - - public String getCreatorPerson() { - return creatorPerson; - } - - public void setCreatorPerson(String creatorPerson) { - this.creatorPerson = creatorPerson; - } - - public String getMemoString64_1() { - return memoString64_1; - } - - public void setMemoString64_1(String memoString64_1) { - this.memoString64_1 = memoString64_1; - } - - public String getMemoString64_2() { - return memoString64_2; - } - - public void setMemoString64_2(String memoString64_2) { - this.memoString64_2 = memoString64_2; - } - - public String getMemoString64_3() { - return memoString64_3; - } - - public void setMemoString64_3(String memoString64_3) { - this.memoString64_3 = memoString64_3; - } - - public String getMemoString255_1() { - return memoString255_1; - } - - public void setMemoString255_1(String memoString255_1) { - this.memoString255_1 = memoString255_1; - } - - public String getMemoString255_2() { - return memoString255_2; - } - - public void setMemoString255_2(String memoString255_2) { - this.memoString255_2 = memoString255_2; - } - - public Integer getMemoInteger1() { - return memoInteger1; - } - - public void setMemoInteger1(Integer memoInteger1) { - this.memoInteger1 = memoInteger1; - } - - public Integer getMemoInteger2() { - return memoInteger2; - } - - public void setMemoInteger2(Integer memoInteger2) { - this.memoInteger2 = memoInteger2; - } - - public Integer getMemoInteger3() { - return memoInteger3; - } - - public void setMemoInteger3(Integer memoInteger3) { - this.memoInteger3 = memoInteger3; - } - - public Double getMemoDouble1() { - return memoDouble1; - } - - public void setMemoDouble1(Double memoDouble1) { - this.memoDouble1 = memoDouble1; - } - - public Double getMemoDouble2() { - return memoDouble2; - } - - public void setMemoDouble2(Double memoDouble2) { - this.memoDouble2 = memoDouble2; - } - - public String getTaskId() { - return taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getPermissionObj() { - return permissionObj; - } - - public void setPermissionObj(String permissionObj) { - this.permissionObj = permissionObj; - } - - public String getPermissionObjType() { - return permissionObjType; - } - - public void setPermissionObjType(String permissionObjType) { - this.permissionObjType = permissionObjType; - } - - public String getTaskSequence() { - return taskSequence; - } - - public void setTaskSequence(String taskSequence) { - this.taskSequence = taskSequence; - } - - public Boolean getArchive() { - return archive; - } - - public void setArchive(Boolean archive) { - this.archive = archive; - } - - public Boolean getClaimed() { - return claimed; - } - - public void setClaimed(Boolean claimed) { - this.claimed = claimed; - } - -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Task.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Task.java deleted file mode 100644 index 4e3ffdc124..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/Task.java +++ /dev/null @@ -1,532 +0,0 @@ -package com.x.teamwork.core.entity; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import org.apache.commons.lang3.StringUtils; -import org.apache.openjpa.persistence.PersistentCollection; -import org.apache.openjpa.persistence.jdbc.ContainerTable; -import org.apache.openjpa.persistence.jdbc.ElementColumn; -import org.apache.openjpa.persistence.jdbc.ElementIndex; -import org.apache.openjpa.persistence.jdbc.Index; -import org.apache.openjpa.persistence.jdbc.OrderColumn; - -import com.x.base.core.entity.AbstractPersistenceProperties; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.CheckPersist; -import com.x.base.core.entity.annotation.ContainerEntity; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.tools.ListTools; - -/** - * 工作任务信息 - * - * @author O2LEE - * - */ -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) -@Entity -@Table(name = PersistenceProperties.Task.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Task.table + JpaObject.IndexNameMiddle - + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, - JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class Task extends SliceJpaObject { - - private static final long serialVersionUID = 3856138316794473794L; - private static final String TABLE = PersistenceProperties.Task.table; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @FieldDescribe("数据库主键,自动生成.") - @Id - @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) - private String id = createId(); - - public void onPersist() throws Exception { - } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - public static final String project_FIELDNAME = "project"; - @FieldDescribe("所属项目ID.") - @Column(length = length_id, name = ColumnNamePrefix + project_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + project_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String project; - - public static final String projectName_FIELDNAME = "projectName"; - @FieldDescribe("所属项目名称.") - @Column(length = length_id, name = ColumnNamePrefix + projectName_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String projectName; - - public static final String parent_FIELDNAME = "parent"; - @FieldDescribe("父级工作任务ID.") - @Column(length = length_id, name = ColumnNamePrefix + parent_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + parent_FIELDNAME) - @CheckPersist(allowEmpty = false) - private String parent; - - public static final String name_FIELDNAME = "name"; - @FieldDescribe("工作任务名称(40字)") - @Column( length = JpaObject.length_128B, name = ColumnNamePrefix + name_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String name; - - public static final String summay_FIELDNAME = "summay"; - @FieldDescribe("工作任务概括(80字)") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + summay_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + summay_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String summay; - - public static final String startTime_FIELDNAME = "startTime"; - @FieldDescribe("工作开始时间") - @Column( name = ColumnNamePrefix + startTime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + startTime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Date startTime; - - public static final String endTime_FIELDNAME = "endTime"; - @FieldDescribe("工作开始时间") - @Column( name = ColumnNamePrefix + endTime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + endTime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Date endTime; - - public static final String priority_FIELDNAME = "priority"; - @FieldDescribe("工作等级:普通 | 紧急 | 特急") - @Column( length = JpaObject.length_255B, name = ColumnNamePrefix + priority_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + priority_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String priority; - - public static final String workStatus_FIELDNAME = "workStatus"; - @FieldDescribe("工作状态:执行中- processing | 已完成- completed | 已归档- archived") - @Column( length = JpaObject.length_16B, name = ColumnNamePrefix + workStatus_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + workStatus_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private String workStatus = "processing"; - - public static final String completed_FIELDNAME = "completed"; - @FieldDescribe("是否已完成") - @Column( name = ColumnNamePrefix + completed_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + completed_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean completed = false; - - public static final String claimed_FIELDNAME = "claimed"; - @FieldDescribe("是否已认领") - @Column( name = ColumnNamePrefix + claimed_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + claimed_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean claimed = false; - - public static final String overtime_FIELDNAME = "overtime"; - @FieldDescribe("是否已超时") - @Column( name = ColumnNamePrefix + overtime_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + overtime_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean overtime = false; - - public static final String remindRelevance_FIELDNAME = "remindRelevance"; - @FieldDescribe("提醒关联任务") - @Column( name = ColumnNamePrefix + remindRelevance_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + remindRelevance_FIELDNAME) - @CheckPersist( allowEmpty = true ) - private Boolean remindRelevance; - - public static final String deleted_FIELDNAME = "deleted"; - @FieldDescribe("是否已经删除") - @Column( name = ColumnNamePrefix + deleted_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + deleted_FIELDNAME ) - private Boolean deleted = false; - - public static final String archive_FIELDNAME = "archive"; - @FieldDescribe("是否已经归档") - @Column( name = ColumnNamePrefix + archive_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + archive_FIELDNAME ) - private Boolean archive = false; - - public static final String relation_FIELDNAME = "relation"; - @FieldDescribe("是否项目关联操作") - @Column( name = ColumnNamePrefix + relation_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + relation_FIELDNAME ) - private Boolean relation = false; - - public static final String reviewed_FIELDNAME = "reviewed"; - @FieldDescribe("是否检查过review信息") - @Column( name = ColumnNamePrefix + reviewed_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + reviewed_FIELDNAME ) - private Boolean reviewed = false; - - public static final String progress_FIELDNAME = "progress"; - @FieldDescribe("工作进度:记录4位数,显示的时候除以100") - @Column( name = ColumnNamePrefix + progress_FIELDNAME) - private Integer progress = 0; - - public static final String order_FIELDNAME = "order"; - @FieldDescribe("排序号") - @Column( name = ColumnNamePrefix + order_FIELDNAME ) - private Integer order = 0; - - public static final String executor_FIELDNAME = "executor"; - @FieldDescribe("执行者和负责人") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executor_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + executor_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executor; - - public static final String executorIdentity_FIELDNAME = "executorIdentity"; - @FieldDescribe("执行者|负责人身份") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executorIdentity_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + executorIdentity_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executorIdentity; - - public static final String executorUnit_FIELDNAME = "executorUnit"; - @FieldDescribe("执行者|负责人所属组织") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + executorUnit_FIELDNAME ) - @Index( name = TABLE + IndexNameMiddle + executorUnit_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String executorUnit; - - public static final String creatorPerson_FIELDNAME = "creatorPerson"; - @FieldDescribe("创建者,可能为System,如果由系统创建。") - @Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorPerson_FIELDNAME) - @Index( name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME ) - @CheckPersist(allowEmpty = true) - private String creatorPerson; - - public static final String participantList_FIELDNAME = "participantList"; - @FieldDescribe("工作任务参与者") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + participantList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + participantList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + participantList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + participantList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List participantList; - - public static final String manageablePersonList_FIELDNAME = "manageablePersonList"; - @FieldDescribe("管理者") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle + manageablePersonList_FIELDNAME, joinIndex = @Index(name = TABLE - + IndexNameMiddle + manageablePersonList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + manageablePersonList_FIELDNAME) - @ElementIndex(name = TABLE + IndexNameMiddle + manageablePersonList_FIELDNAME + ElementIndexNameSuffix) - @CheckPersist(allowEmpty = true) - private List manageablePersonList; - - public String getProject() { - return project; - } - - public void setProject(String project) { - this.project = project; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getExecutorIdentity() { - return executorIdentity; - } - - public void setExecutorIdentity(String executorIdentity) { - this.executorIdentity = executorIdentity; - } - - public String getExecutorUnit() { - return executorUnit; - } - - public void setExecutorUnit(String executorUnit) { - this.executorUnit = executorUnit; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public String getWorkStatus() { - return workStatus; - } - - public void setWorkStatus(String workStatus) { - this.workStatus = workStatus; - } - - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(Boolean completed) { - this.completed = completed; - } - - public Boolean getClaimed() { - return claimed; - } - - public void setClaimed(Boolean claimed) { - this.claimed = claimed; - } - - public Boolean getOvertime() { - return overtime; - } - - public void setOvertime(Boolean overtime) { - this.overtime = overtime; - } - - public Boolean getRelation() { - return relation; - } - - public void setRelation(Boolean relation) { - this.relation = relation; - } - - public Boolean getRemindRelevance() { - return remindRelevance; - } - - public void setRemindRelevance(Boolean remindRelevance) { - this.remindRelevance = remindRelevance; - } - - public Boolean getDeleted() { - return deleted; - } - - public void setDeleted(Boolean deleted) { - this.deleted = deleted; - } - - public Integer getProgress() { - return progress; - } - - public void setProgress(Integer progress) { - this.progress = progress; - } - - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public String getCreatorPerson() { - return creatorPerson; - } - - public void setCreatorPerson(String creatorPerson) { - this.creatorPerson = creatorPerson; - } - - public List getManageablePersonList() { - return manageablePersonList; - } - - public void setManageablePersonList(List manageablePersonList) { - this.manageablePersonList = manageablePersonList; - } - - public String getSummay() { - return summay; - } - - public void setSummay(String summay) { - this.summay = summay; - } - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public void addManageablePerson( String distinguishedName ) { - this.manageablePersonList = addStringToList( distinguishedName , this.manageablePersonList ); - } - public void addManageablePerson( List distinguishedNames ) { - this.manageablePersonList = addListToList( distinguishedNames , this.manageablePersonList ); - } - - public void removeManageablePerson( String distinguishedName ) { - this.manageablePersonList = removeStringFromList( distinguishedName , this.manageablePersonList ); - } - - public void removeManageablePerson( List distinguishedNames ) { - this.manageablePersonList = removeListFromList( distinguishedNames , this.manageablePersonList ); - } - - public void addParticipant( String distinguishedName ) { - this.participantList = addStringToList( distinguishedName , this.participantList ); - } - public void removeParticipant( String distinguishedName ) { - this.participantList = removeStringFromList( distinguishedName , this.participantList ); - } - public List getParticipantList() { - return participantList; - } - - public void setParticipantList(List participantList) { - this.participantList = participantList; - } - - private List addStringToList( String source, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( StringUtils.isEmpty( source )) { - return targetList; - } - if( !targetList.contains( source )) { - targetList.add( source ); - } - return targetList; - } - - private List addListToList( List sourceList, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( ListTools.isEmpty( sourceList )) { - return targetList; - } - if( ListTools.isNotEmpty( sourceList )) { - for( String source : sourceList ) { - if( !targetList.contains( source )) { - targetList.add(source); - } - } - } - return targetList; - } - - private List removeStringFromList( String source, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( StringUtils.isEmpty( source )) { - return targetList; - } - if( targetList.contains( source )) { - targetList.remove( source ); - } - return targetList; - } - - private List removeListFromList( List sourceList, List targetList ){ - if( targetList == null ) { - targetList = new ArrayList<>(); - } - if( ListTools.isEmpty( sourceList )) { - return targetList; - } - List result = new ArrayList<>(); - for( String target : targetList ) { - if( !sourceList.contains( target )) { - result.add( target ); - } - } - targetList = result; - return targetList; - } - - public Boolean getArchive() { - return archive; - } - - public void setArchive(Boolean archive) { - this.archive = archive; - } - - public Boolean getReviewed() { - return reviewed; - } - - public void setReviewed(Boolean reviewed) { - this.reviewed = reviewed; - } -} \ No newline at end of file diff --git a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/tools/CustomExtField.java b/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/tools/CustomExtField.java deleted file mode 100644 index 74495fb1a9..0000000000 --- a/o2server/x_teamwork_core_entity/src/main/java/com/x/teamwork/core/entity/tools/CustomExtField.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.x.teamwork.core.entity.tools; - -import java.util.ArrayList; -import java.util.List; - -public class CustomExtField { - - private static List fieldList = new ArrayList<>(); - - static { - fieldList.add( new FieldInfo("memoString_1", "备用属性1(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_2", "备选属性2(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_3", "备选属性3(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_4", "备选属性4(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_5", "备选属性5(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_6", "备选属性6(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_7", "备选属性7(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_8", "备选属性8(最大长度:255)" )); - fieldList.add( new FieldInfo("memoString_1_lob", "备用长文本1(最大长度:10M)" )); - fieldList.add( new FieldInfo("memoString_2_lob", "备用长文本2(最大长度:10M)" )); - fieldList.add( new FieldInfo("memoString_3_lob", "备用长文本3(最大长度:10M)" )); - fieldList.add( new FieldInfo("memoString_4_lob", "备用长文本4(最大长度:10M)" )); - } - - public static List listAllExtField() { - return fieldList; - } - - public static FieldInfo getExtField( String name ) { - for( FieldInfo fieldInfo : fieldList ) { - if( fieldInfo.getFieldName().equalsIgnoreCase( name )) { - return fieldInfo; - } - } - return null; - } -} \ No newline at end of file -- GitLab