Commit b85621d6ca7179c99ee2121850455418554e4783
1 parent
a2bd1e6c
a
Showing
19 changed files
with
683 additions
and
30 deletions
trash-activiti/src/main/java/com/trash/activiti/service/impl/ActTaskServiceImpl.java
| 1 | - | |
| 2 | 1 | package com.trash.activiti.service.impl; |
| 3 | 2 | |
| 4 | 3 | import java.text.ParseException; |
| ... | ... | @@ -46,6 +45,7 @@ import com.trash.activiti.domain.dto.ActWorkflowFormDataDTO; |
| 46 | 45 | import com.trash.activiti.mapper.ActReDeploymentMapper; |
| 47 | 46 | import com.trash.activiti.service.IActTaskService; |
| 48 | 47 | import com.trash.activiti.service.IActWorkflowFormDataService; |
| 48 | +import com.trash.activiti.service.myTaskService; | |
| 49 | 49 | import com.trash.common.core.page.PageDomain; |
| 50 | 50 | import com.trash.common.utils.SecurityUtils; |
| 51 | 51 | |
| ... | ... | @@ -56,7 +56,7 @@ public class ActTaskServiceImpl implements IActTaskService { |
| 56 | 56 | private RepositoryService repositoryService; |
| 57 | 57 | |
| 58 | 58 | @Autowired |
| 59 | - private TaskRuntime taskRuntime; | |
| 59 | + private myTaskService taskRuntime; | |
| 60 | 60 | |
| 61 | 61 | @Autowired |
| 62 | 62 | private TaskService taskService; |
| ... | ... | @@ -81,8 +81,13 @@ public class ActTaskServiceImpl implements IActTaskService { |
| 81 | 81 | public Page<ActTaskDTO> selectProcessDefinitionList(PageDomain pageDomain) { |
| 82 | 82 | Page<ActTaskDTO> list = new Page<ActTaskDTO>(); |
| 83 | 83 | |
| 84 | -// tasks(pageable,TaskPayloadBuilder.tasks().withAssignee(authenticatedUserId).withGroups(userGroups).build()); | |
| 85 | - | |
| 84 | +// List<String> posts = new ArrayList<>(); | |
| 85 | +// posts.add("4"); | |
| 86 | +// SecurityUtils.getLoginUser().getUser().setPostIds(posts); | |
| 87 | +// List<String> roles = new ArrayList<>(); | |
| 88 | +// posts.add("7"); | |
| 89 | +// SecurityUtils.getLoginUser().getUser().setRoleIds(roles); | |
| 90 | + | |
| 86 | 91 | org.activiti.api.runtime.shared.query.Page<Task> pageTasks = taskRuntime.tasks(Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize())); |
| 87 | 92 | List<Task> tasks = pageTasks.getContent(); |
| 88 | 93 | int totalItems = pageTasks.getTotalItems(); | ... | ... |
trash-activiti/src/main/java/com/trash/activiti/service/impl/myTaskServiceImpl.java
0 → 100644
| 1 | +package com.trash.activiti.service.impl; | |
| 2 | + | |
| 3 | +import org.activiti.api.model.shared.model.VariableInstance; | |
| 4 | +import org.activiti.api.runtime.shared.NotFoundException; | |
| 5 | +import org.activiti.api.runtime.shared.identity.UserGroupManager; | |
| 6 | +import org.activiti.api.runtime.shared.query.Page; | |
| 7 | +import org.activiti.api.runtime.shared.query.Pageable; | |
| 8 | +import org.activiti.api.runtime.shared.security.SecurityManager; | |
| 9 | +import org.activiti.api.task.model.Task; | |
| 10 | +import org.activiti.api.task.model.builders.TaskPayloadBuilder; | |
| 11 | +import org.activiti.api.task.model.impl.TaskImpl; | |
| 12 | +import org.activiti.api.task.model.payloads.CandidateGroupsPayload; | |
| 13 | +import org.activiti.api.task.model.payloads.CandidateUsersPayload; | |
| 14 | +import org.activiti.api.task.model.payloads.ClaimTaskPayload; | |
| 15 | +import org.activiti.api.task.model.payloads.CompleteTaskPayload; | |
| 16 | +import org.activiti.api.task.model.payloads.CreateTaskPayload; | |
| 17 | +import org.activiti.api.task.model.payloads.CreateTaskVariablePayload; | |
| 18 | +import org.activiti.api.task.model.payloads.DeleteTaskPayload; | |
| 19 | +import org.activiti.api.task.model.payloads.GetTaskVariablesPayload; | |
| 20 | +import org.activiti.api.task.model.payloads.GetTasksPayload; | |
| 21 | +import org.activiti.api.task.model.payloads.ReleaseTaskPayload; | |
| 22 | +import org.activiti.api.task.model.payloads.SaveTaskPayload; | |
| 23 | +import org.activiti.api.task.model.payloads.UpdateTaskPayload; | |
| 24 | +import org.activiti.api.task.model.payloads.UpdateTaskVariablePayload; | |
| 25 | +import org.activiti.api.task.runtime.TaskRuntime; | |
| 26 | +import org.activiti.api.task.runtime.conf.TaskRuntimeConfiguration; | |
| 27 | +import org.activiti.engine.TaskService; | |
| 28 | +import org.activiti.engine.task.IdentityLink; | |
| 29 | +import org.activiti.engine.task.IdentityLinkType; | |
| 30 | +import org.activiti.engine.task.TaskQuery; | |
| 31 | +import org.activiti.runtime.api.impl.TaskRuntimeHelper; | |
| 32 | +import org.activiti.runtime.api.model.impl.APITaskConverter; | |
| 33 | +import org.activiti.runtime.api.model.impl.APIVariableInstanceConverter; | |
| 34 | +import org.activiti.runtime.api.query.impl.PageImpl; | |
| 35 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 36 | +import org.springframework.stereotype.Service; | |
| 37 | + | |
| 38 | +import com.trash.activiti.service.myTaskService; | |
| 39 | +import com.trash.common.utils.SecurityUtils; | |
| 40 | + | |
| 41 | +import java.util.ArrayList; | |
| 42 | +import java.util.List; | |
| 43 | +import java.util.Objects; | |
| 44 | + | |
| 45 | +@PreAuthorize("hasRole('ACTIVITI_USER')") | |
| 46 | +@Service | |
| 47 | +public class myTaskServiceImpl implements myTaskService { | |
| 48 | + | |
| 49 | + private final TaskService taskService; | |
| 50 | + | |
| 51 | + private final APITaskConverter taskConverter; | |
| 52 | + | |
| 53 | + private final APIVariableInstanceConverter variableInstanceConverter; | |
| 54 | + | |
| 55 | + private final TaskRuntimeConfiguration configuration; | |
| 56 | + | |
| 57 | + private final UserGroupManager userGroupManager; | |
| 58 | + | |
| 59 | + private final SecurityManager securityManager; | |
| 60 | + | |
| 61 | + private final TaskRuntimeHelper taskRuntimeHelper; | |
| 62 | + | |
| 63 | + public myTaskServiceImpl(TaskService taskService, | |
| 64 | + UserGroupManager userGroupManager, | |
| 65 | + SecurityManager securityManager, | |
| 66 | + APITaskConverter taskConverter, | |
| 67 | + APIVariableInstanceConverter variableInstanceConverter, | |
| 68 | + TaskRuntimeConfiguration configuration, | |
| 69 | + TaskRuntimeHelper taskRuntimeHelper) { | |
| 70 | + this.taskService = taskService; | |
| 71 | + this.userGroupManager = userGroupManager; | |
| 72 | + this.securityManager = securityManager; | |
| 73 | + this.taskConverter = taskConverter; | |
| 74 | + this.variableInstanceConverter = variableInstanceConverter; | |
| 75 | + this.configuration = configuration; | |
| 76 | + this.taskRuntimeHelper = taskRuntimeHelper; | |
| 77 | + } | |
| 78 | + | |
| 79 | + @Override | |
| 80 | + public TaskRuntimeConfiguration configuration() { | |
| 81 | + return configuration; | |
| 82 | + } | |
| 83 | + | |
| 84 | + @Override | |
| 85 | + public Task task(String taskId) { | |
| 86 | + | |
| 87 | + org.activiti.engine.task.Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); | |
| 88 | + | |
| 89 | + if (task == null) { | |
| 90 | + throw new NotFoundException("未找到审批任务 id: " + taskId); | |
| 91 | + } | |
| 92 | + | |
| 93 | + | |
| 94 | + return taskConverter.from(task); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @Override | |
| 98 | + public Page<Task> tasks(Pageable pageable) { | |
| 99 | + return tasks(pageable,null); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public Page<Task> tasks(Pageable pageable,GetTasksPayload getTasksPayload) { | |
| 104 | + TaskQuery taskQuery = taskService.createTaskQuery(); | |
| 105 | + if (getTasksPayload == null) { | |
| 106 | + getTasksPayload = TaskPayloadBuilder.tasks().build(); | |
| 107 | + } | |
| 108 | + | |
| 109 | + if(SecurityUtils.getLoginUser().getUser().getPostIds() == null && SecurityUtils.getLoginUser().getUser().getRoleIds() == null){ | |
| 110 | + taskQuery.taskCandidateOrAssigned(SecurityUtils.getUsername()); | |
| 111 | + }else{ | |
| 112 | + if( SecurityUtils.getLoginUser().getUser().getPostIds() != null && SecurityUtils.getLoginUser().getUser().getRoleIds() != null){ | |
| 113 | + taskQuery.or().taskCandidateGroupIn(SecurityUtils.getLoginUser().getUser().getPostIds()); | |
| 114 | + for(String role : SecurityUtils.getLoginUser().getUser().getRoleIds()){ | |
| 115 | + taskQuery.taskCandidateUser(role); | |
| 116 | + } | |
| 117 | + taskQuery.endOr(); | |
| 118 | + }else{ | |
| 119 | + if(SecurityUtils.getLoginUser().getUser().getPostIds() != null){ | |
| 120 | + taskQuery.taskCandidateGroupIn(SecurityUtils.getLoginUser().getUser().getPostIds()); | |
| 121 | + } | |
| 122 | + | |
| 123 | + if(SecurityUtils.getLoginUser().getUser().getRoleIds() != null){ | |
| 124 | + for(String role : SecurityUtils.getLoginUser().getUser().getRoleIds()){ | |
| 125 | + taskQuery.taskCandidateUser(role); | |
| 126 | + } | |
| 127 | + } | |
| 128 | + } | |
| 129 | + } | |
| 130 | + | |
| 131 | + List<org.activiti.engine.task.Task> tt = taskQuery.list(); | |
| 132 | + | |
| 133 | + | |
| 134 | + if (getTasksPayload.getProcessInstanceId() != null) { | |
| 135 | + taskQuery = taskQuery.processInstanceId(getTasksPayload.getProcessInstanceId()); | |
| 136 | + } | |
| 137 | + if (getTasksPayload.getParentTaskId() != null) { | |
| 138 | + taskQuery = taskQuery.taskParentTaskId(getTasksPayload.getParentTaskId()); | |
| 139 | + } | |
| 140 | + List<Task> tasks = taskConverter.from(taskQuery.listPage(pageable.getStartIndex(), | |
| 141 | + pageable.getMaxItems())); | |
| 142 | + return new PageImpl<>(tasks, | |
| 143 | + Math.toIntExact(taskQuery.count())); | |
| 144 | + } | |
| 145 | + | |
| 146 | + @Override | |
| 147 | + public Task complete(CompleteTaskPayload completeTaskPayload) { | |
| 148 | + //@TODO: not the most efficient way to return the just completed task, improve | |
| 149 | + // we might need to create an empty shell with the task ID and Status only | |
| 150 | + Task task; | |
| 151 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 152 | + try { | |
| 153 | + task = task(completeTaskPayload.getTaskId()); | |
| 154 | + } catch (IllegalStateException ex) { | |
| 155 | + throw new IllegalStateException("The authenticated user cannot complete task" + completeTaskPayload.getTaskId() + " due he/she cannot access to the task"); | |
| 156 | + } | |
| 157 | + // validate the the task does have an assignee | |
| 158 | + if (task.getAssignee() == null || task.getAssignee().isEmpty()) { | |
| 159 | + throw new IllegalStateException("The task needs to be claimed before trying to complete it"); | |
| 160 | + } | |
| 161 | + if (!task.getAssignee().equals(authenticatedUserId)) { | |
| 162 | + throw new IllegalStateException("You cannot complete the task if you are not assigned to it"); | |
| 163 | + } | |
| 164 | + | |
| 165 | + taskService.complete(completeTaskPayload.getTaskId(), | |
| 166 | + completeTaskPayload.getVariables(), true); | |
| 167 | + | |
| 168 | + | |
| 169 | + ((TaskImpl) task).setStatus(Task.TaskStatus.COMPLETED); | |
| 170 | + | |
| 171 | + return task; | |
| 172 | + } | |
| 173 | + | |
| 174 | + @Override | |
| 175 | + public Task claim(ClaimTaskPayload claimTaskPayload) { | |
| 176 | + // Validate that the task is visible by the currently authorized user | |
| 177 | + Task task; | |
| 178 | + try { | |
| 179 | + task = task(claimTaskPayload.getTaskId()); | |
| 180 | + } catch (IllegalStateException ex) { | |
| 181 | + throw new IllegalStateException("The authenticated user cannot claim task" + claimTaskPayload.getTaskId() + " due it is not a candidate for it"); | |
| 182 | + } | |
| 183 | + // validate the the task doesn't have an assignee | |
| 184 | + if (task.getAssignee() != null && !task.getAssignee().isEmpty()) { | |
| 185 | + throw new IllegalStateException("The task was already claimed, the assignee of this task needs to release it first for you to claim it"); | |
| 186 | + } | |
| 187 | + | |
| 188 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 189 | + claimTaskPayload.setAssignee(authenticatedUserId); | |
| 190 | + taskService.claim(claimTaskPayload.getTaskId(), | |
| 191 | + claimTaskPayload.getAssignee()); | |
| 192 | + | |
| 193 | + return task(claimTaskPayload.getTaskId()); | |
| 194 | + } | |
| 195 | + | |
| 196 | + @Override | |
| 197 | + public Task release(ReleaseTaskPayload releaseTaskPayload) { | |
| 198 | + // Validate that the task is visible by the currently authorized user | |
| 199 | + Task task; | |
| 200 | + try { | |
| 201 | + task = task(releaseTaskPayload.getTaskId()); | |
| 202 | + } catch (IllegalStateException ex) { | |
| 203 | + throw new IllegalStateException("The authenticated user cannot claim task" + releaseTaskPayload.getTaskId() + " due it is not a candidate for it"); | |
| 204 | + } | |
| 205 | + // validate the the task doesn't have an assignee | |
| 206 | + if (task.getAssignee() == null || task.getAssignee().isEmpty()) { | |
| 207 | + throw new IllegalStateException("You cannot release a task that is not claimed"); | |
| 208 | + } | |
| 209 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 210 | + // validate that you are trying to release task where you are the assignee | |
| 211 | + if (!task.getAssignee().equals(authenticatedUserId)) { | |
| 212 | + throw new IllegalStateException("You cannot release a task where you are not the assignee"); | |
| 213 | + } | |
| 214 | + | |
| 215 | + taskService.unclaim(releaseTaskPayload.getTaskId()); | |
| 216 | + return task(releaseTaskPayload.getTaskId()); | |
| 217 | + } | |
| 218 | + | |
| 219 | + @Override | |
| 220 | + public Task update(UpdateTaskPayload updateTaskPayload) { | |
| 221 | + return taskRuntimeHelper.applyUpdateTaskPayload(false, updateTaskPayload); | |
| 222 | + } | |
| 223 | + | |
| 224 | + @Override | |
| 225 | + public Task delete(DeleteTaskPayload deleteTaskPayload) { | |
| 226 | + //@TODO: not the most efficient way to return the just deleted task, improve | |
| 227 | + // we might need to create an empty shell with the task ID and Status only | |
| 228 | + Task task; | |
| 229 | + try { | |
| 230 | + task = task(deleteTaskPayload.getTaskId()); | |
| 231 | + } catch (IllegalStateException ex) { | |
| 232 | + throw new IllegalStateException("The authenticated user cannot delete the task" + deleteTaskPayload.getTaskId() + " due it is not the current assignee"); | |
| 233 | + } | |
| 234 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 235 | + // validate that you are trying to delete task where you are the assignee or the owner | |
| 236 | + if ((task.getAssignee() == null || task.getAssignee().isEmpty() || !task.getAssignee().equals(authenticatedUserId)) && | |
| 237 | + (task.getOwner() == null || task.getOwner().isEmpty() || !task.getOwner().equals(authenticatedUserId))) { | |
| 238 | + throw new IllegalStateException("You cannot delete a task where you are not the assignee/owner"); | |
| 239 | + } | |
| 240 | + TaskImpl deletedTaskData = new TaskImpl(task.getId(), | |
| 241 | + task.getName(), | |
| 242 | + Task.TaskStatus.CANCELLED); | |
| 243 | + if (!deleteTaskPayload.hasReason()) { | |
| 244 | + deleteTaskPayload.setReason("Task deleted by " + authenticatedUserId); | |
| 245 | + } | |
| 246 | + taskService.deleteTask(deleteTaskPayload.getTaskId(), | |
| 247 | + deleteTaskPayload.getReason(), | |
| 248 | + true); | |
| 249 | + return deletedTaskData; | |
| 250 | + } | |
| 251 | + | |
| 252 | + @Override | |
| 253 | + public Task create(CreateTaskPayload createTaskPayload) { | |
| 254 | + if (createTaskPayload.getName() == null || createTaskPayload.getName().isEmpty()) { | |
| 255 | + throw new IllegalStateException("You cannot create a task without name"); | |
| 256 | + } | |
| 257 | + | |
| 258 | + org.activiti.engine.task.Task task = taskService.newTask(); | |
| 259 | + task.setName(createTaskPayload.getName()); | |
| 260 | + task.setDescription(createTaskPayload.getDescription()); | |
| 261 | + task.setDueDate(createTaskPayload.getDueDate()); | |
| 262 | + task.setPriority(createTaskPayload.getPriority()); | |
| 263 | + if (createTaskPayload.getAssignee() != null && !createTaskPayload.getAssignee().isEmpty()) { | |
| 264 | + task.setAssignee(createTaskPayload.getAssignee()); | |
| 265 | + } | |
| 266 | + task.setParentTaskId(createTaskPayload.getParentTaskId()); | |
| 267 | + task.setFormKey(createTaskPayload.getFormKey()); | |
| 268 | + task.setOwner(securityManager.getAuthenticatedUserId()); | |
| 269 | + taskService.saveTask(task); | |
| 270 | + taskService.addCandidateUser(task.getId(), | |
| 271 | + securityManager.getAuthenticatedUserId()); | |
| 272 | + if (createTaskPayload.getCandidateGroups() != null && !createTaskPayload.getCandidateGroups().isEmpty()) { | |
| 273 | + for ( String g : createTaskPayload.getCandidateGroups() ) { | |
| 274 | + taskService.addCandidateGroup(task.getId(), | |
| 275 | + g); | |
| 276 | + } | |
| 277 | + } | |
| 278 | + | |
| 279 | + if (createTaskPayload.getCandidateUsers() != null && !createTaskPayload.getCandidateUsers().isEmpty()) { | |
| 280 | + for ( String u : createTaskPayload.getCandidateUsers() ) { | |
| 281 | + taskService.addCandidateUser(task.getId(), | |
| 282 | + u); | |
| 283 | + } | |
| 284 | + } | |
| 285 | + | |
| 286 | + return taskConverter.from(task); | |
| 287 | + } | |
| 288 | + | |
| 289 | + @Override | |
| 290 | + public void addCandidateUsers(CandidateUsersPayload candidateUsersPayload) { | |
| 291 | + org.activiti.engine.task.Task internalTask; | |
| 292 | + try { | |
| 293 | + internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId()); | |
| 294 | + | |
| 295 | + } catch (IllegalStateException ex) { | |
| 296 | + throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee"); | |
| 297 | + } | |
| 298 | + | |
| 299 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 300 | + | |
| 301 | + // validate that you are trying to add CandidateUsers to the task where you are the assignee | |
| 302 | + if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) { | |
| 303 | + throw new IllegalStateException("You cannot update a task where you are not the assignee"); | |
| 304 | + } | |
| 305 | + | |
| 306 | + | |
| 307 | + if (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) { | |
| 308 | + for ( String u : candidateUsersPayload.getCandidateUsers() ) { | |
| 309 | + taskService.addCandidateUser(internalTask.getId(), | |
| 310 | + u); | |
| 311 | + } | |
| 312 | + } | |
| 313 | + } | |
| 314 | + | |
| 315 | + @Override | |
| 316 | + public void deleteCandidateUsers(CandidateUsersPayload candidateUsersPayload) { | |
| 317 | + org.activiti.engine.task.Task internalTask; | |
| 318 | + try { | |
| 319 | + internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateUsersPayload.getTaskId()); | |
| 320 | + | |
| 321 | + } catch (IllegalStateException ex) { | |
| 322 | + throw new IllegalStateException("The authenticated user cannot update the task" + candidateUsersPayload.getTaskId() + " due it is not the current assignee"); | |
| 323 | + } | |
| 324 | + | |
| 325 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 326 | + | |
| 327 | + // validate that you are trying to add CandidateUsers to the task where you are the assignee | |
| 328 | + if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) { | |
| 329 | + throw new IllegalStateException("You cannot update a task where you are not the assignee"); | |
| 330 | + } | |
| 331 | + | |
| 332 | + | |
| 333 | + if (candidateUsersPayload.getCandidateUsers() != null && !candidateUsersPayload.getCandidateUsers().isEmpty()) { | |
| 334 | + for ( String u : candidateUsersPayload.getCandidateUsers() ) { | |
| 335 | + taskService.deleteCandidateUser(internalTask.getId(), | |
| 336 | + u); | |
| 337 | + } | |
| 338 | + } | |
| 339 | + } | |
| 340 | + | |
| 341 | + @Override | |
| 342 | + public void addCandidateGroups(CandidateGroupsPayload candidateGroupsPayload) { | |
| 343 | + org.activiti.engine.task.Task internalTask; | |
| 344 | + try { | |
| 345 | + internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateGroupsPayload.getTaskId()); | |
| 346 | + | |
| 347 | + } catch (IllegalStateException ex) { | |
| 348 | + throw new IllegalStateException("The authenticated user cannot update the task" + candidateGroupsPayload.getTaskId() + " due it is not the current assignee"); | |
| 349 | + } | |
| 350 | + | |
| 351 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 352 | + // validate that you are trying to add CandidateGroups to the task where you are the assignee | |
| 353 | + if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) { | |
| 354 | + throw new IllegalStateException("You cannot update a task where you are not the assignee"); | |
| 355 | + } | |
| 356 | + | |
| 357 | + | |
| 358 | + if (candidateGroupsPayload.getCandidateGroups() != null && !candidateGroupsPayload.getCandidateGroups().isEmpty()) { | |
| 359 | + for ( String g : candidateGroupsPayload.getCandidateGroups() ) { | |
| 360 | + taskService.addCandidateGroup(internalTask.getId(), | |
| 361 | + g); | |
| 362 | + } | |
| 363 | + } | |
| 364 | + } | |
| 365 | + | |
| 366 | + @Override | |
| 367 | + public void deleteCandidateGroups(CandidateGroupsPayload candidateGroupsPayload) { | |
| 368 | + org.activiti.engine.task.Task internalTask; | |
| 369 | + try { | |
| 370 | + internalTask = taskRuntimeHelper.getInternalTaskWithChecks(candidateGroupsPayload.getTaskId()); | |
| 371 | + | |
| 372 | + } catch (IllegalStateException ex) { | |
| 373 | + throw new IllegalStateException("The authenticated user cannot update the task" + candidateGroupsPayload.getTaskId() + " due it is not the current assignee"); | |
| 374 | + } | |
| 375 | + | |
| 376 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 377 | + // validate that you are trying to add CandidateGroups to the task where you are the assignee | |
| 378 | + if (!Objects.equals(internalTask.getAssignee(), authenticatedUserId)) { | |
| 379 | + throw new IllegalStateException("You cannot update a task where you are not the assignee"); | |
| 380 | + } | |
| 381 | + | |
| 382 | + | |
| 383 | + if (candidateGroupsPayload.getCandidateGroups() != null && !candidateGroupsPayload.getCandidateGroups().isEmpty()) { | |
| 384 | + for ( String g : candidateGroupsPayload.getCandidateGroups() ) { | |
| 385 | + taskService.deleteCandidateGroup(internalTask.getId(), | |
| 386 | + g); | |
| 387 | + } | |
| 388 | + } | |
| 389 | + } | |
| 390 | + | |
| 391 | + @Override | |
| 392 | + public List<String> userCandidates(String taskId) { | |
| 393 | + List<IdentityLink> identityLinks = getIdentityLinks(taskId); | |
| 394 | + List<String> userCandidates = new ArrayList<>(); | |
| 395 | + if (identityLinks != null) { | |
| 396 | + for ( IdentityLink i : identityLinks ) { | |
| 397 | + if (i.getUserId() != null) { | |
| 398 | + if (i.getType().equals(IdentityLinkType.CANDIDATE)) { | |
| 399 | + userCandidates.add(i.getUserId()); | |
| 400 | + } | |
| 401 | + } | |
| 402 | + } | |
| 403 | + | |
| 404 | + } | |
| 405 | + return userCandidates; | |
| 406 | + } | |
| 407 | + | |
| 408 | + @Override | |
| 409 | + public List<String> groupCandidates(String taskId) { | |
| 410 | + List<IdentityLink> identityLinks = getIdentityLinks(taskId); | |
| 411 | + List<String> groupCandidates = new ArrayList<>(); | |
| 412 | + if (identityLinks != null) { | |
| 413 | + for ( IdentityLink i : identityLinks ) { | |
| 414 | + if (i.getGroupId() != null) { | |
| 415 | + if (i.getType().equals(IdentityLinkType.CANDIDATE)) { | |
| 416 | + groupCandidates.add(i.getGroupId()); | |
| 417 | + } | |
| 418 | + } | |
| 419 | + } | |
| 420 | + | |
| 421 | + } | |
| 422 | + return groupCandidates; | |
| 423 | + } | |
| 424 | + | |
| 425 | + @Override | |
| 426 | + public List<VariableInstance> variables(GetTaskVariablesPayload getTaskVariablesPayload) { | |
| 427 | + taskRuntimeHelper.assertHasAccessToTask(getTaskVariablesPayload.getTaskId()); | |
| 428 | + return variableInstanceConverter.from(taskRuntimeHelper.getInternalTaskVariables(getTaskVariablesPayload.getTaskId()).values()); | |
| 429 | + } | |
| 430 | + | |
| 431 | + @Override | |
| 432 | + public void createVariable(CreateTaskVariablePayload createTaskVariablePayload) { | |
| 433 | + taskRuntimeHelper.createVariable(false, createTaskVariablePayload); | |
| 434 | + } | |
| 435 | + | |
| 436 | + @Override | |
| 437 | + public void updateVariable(UpdateTaskVariablePayload updateTaskVariablePayload) { | |
| 438 | + taskRuntimeHelper.updateVariable(false, updateTaskVariablePayload); | |
| 439 | + } | |
| 440 | + | |
| 441 | + private List<IdentityLink> getIdentityLinks(String taskId) { | |
| 442 | + String authenticatedUserId = securityManager.getAuthenticatedUserId(); | |
| 443 | + if (authenticatedUserId != null && !authenticatedUserId.isEmpty()) { | |
| 444 | + List<String> userRoles = userGroupManager.getUserRoles(authenticatedUserId); | |
| 445 | + List<String> userGroups = userGroupManager.getUserGroups(authenticatedUserId); | |
| 446 | + org.activiti.engine.task.Task internalTask = taskService.createTaskQuery().taskCandidateOrAssigned(authenticatedUserId, | |
| 447 | + userGroups).taskId(taskId).singleResult(); | |
| 448 | + if (internalTask == null) { | |
| 449 | + throw new NotFoundException("Unable to find task for the given id: " + taskId + " for user: " + authenticatedUserId + " (with groups: " + userGroups + " & with roles: " + userRoles + ")"); | |
| 450 | + } | |
| 451 | + return taskService.getIdentityLinksForTask(taskId); | |
| 452 | + } | |
| 453 | + throw new IllegalStateException("There is no authenticated user, we need a user authenticated to find tasks"); | |
| 454 | + } | |
| 455 | + | |
| 456 | + @Override | |
| 457 | + public void save(SaveTaskPayload saveTaskPayload) { | |
| 458 | + taskRuntimeHelper.assertHasAccessToTask(saveTaskPayload.getTaskId()); | |
| 459 | + | |
| 460 | + taskService.setVariablesLocal(saveTaskPayload.getTaskId(), | |
| 461 | + saveTaskPayload.getVariables()); | |
| 462 | + } | |
| 463 | + | |
| 464 | +} | ... | ... |
trash-activiti/src/main/java/com/trash/activiti/service/myTaskService.java
0 → 100644
| 1 | +package com.trash.activiti.service; | |
| 2 | +import java.util.List; | |
| 3 | + | |
| 4 | +import org.activiti.api.model.shared.model.VariableInstance; | |
| 5 | +import org.activiti.api.runtime.shared.query.Page; | |
| 6 | +import org.activiti.api.runtime.shared.query.Pageable; | |
| 7 | +import org.activiti.api.task.model.Task; | |
| 8 | +import org.activiti.api.task.model.payloads.CandidateGroupsPayload; | |
| 9 | +import org.activiti.api.task.model.payloads.CandidateUsersPayload; | |
| 10 | +import org.activiti.api.task.model.payloads.ClaimTaskPayload; | |
| 11 | +import org.activiti.api.task.model.payloads.CompleteTaskPayload; | |
| 12 | +import org.activiti.api.task.model.payloads.CreateTaskPayload; | |
| 13 | +import org.activiti.api.task.model.payloads.CreateTaskVariablePayload; | |
| 14 | +import org.activiti.api.task.model.payloads.DeleteTaskPayload; | |
| 15 | +import org.activiti.api.task.model.payloads.GetTaskVariablesPayload; | |
| 16 | +import org.activiti.api.task.model.payloads.GetTasksPayload; | |
| 17 | +import org.activiti.api.task.model.payloads.ReleaseTaskPayload; | |
| 18 | +import org.activiti.api.task.model.payloads.SaveTaskPayload; | |
| 19 | +import org.activiti.api.task.model.payloads.UpdateTaskPayload; | |
| 20 | +import org.activiti.api.task.model.payloads.UpdateTaskVariablePayload; | |
| 21 | +import org.activiti.api.task.runtime.conf.TaskRuntimeConfiguration; | |
| 22 | + | |
| 23 | +public interface myTaskService { | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + TaskRuntimeConfiguration configuration(); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Get task by id if the authenticated user: | |
| 31 | + * - is the assignee or | |
| 32 | + * - is in a group with is assigned to the task or | |
| 33 | + * - has admin role | |
| 34 | + */ | |
| 35 | + Task task(String taskId); | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Get all tasks where | |
| 39 | + * - the authenticated user is the actual assignee | |
| 40 | + * - the user belongs to a group that is a candidate for the task | |
| 41 | + */ | |
| 42 | + Page<Task> tasks(Pageable pageable); | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * Get all tasks where applying the filters in the Payload | |
| 46 | + * - the authenticated user is the actual assignee | |
| 47 | + * - the user belongs to a group that is a candidate for the task | |
| 48 | + */ | |
| 49 | + Page<Task> tasks(Pageable pageable, | |
| 50 | + GetTasksPayload getTasksPayload); | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * Creates a task based on the following rules | |
| 54 | + * - If an assignee is provided it creates and assign the task to the provided user | |
| 55 | + * - If there is no assignee the task is not assigned, just created | |
| 56 | + * - The owner of the task is the currently authenticated user (which is automatically added as a candidate) | |
| 57 | + * - If a group or list of groups is provided those groups are added as candidates for claiming the task | |
| 58 | + */ | |
| 59 | + Task create(CreateTaskPayload createTaskPayload); | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Claim a task with the currently authenticated user | |
| 63 | + * - If there is no authenticated user throw an IllegalStateException | |
| 64 | + * - If the currently authenticated user is not a candidate throw an IllegalStateException | |
| 65 | + * - The current approach doesn't support impersonation, it will always take the currently authenticated user | |
| 66 | + * - after the claim the task should be in assigned status | |
| 67 | + */ | |
| 68 | + Task claim(ClaimTaskPayload claimTaskPayload); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Release a previously claimed task | |
| 72 | + * - The authenticated user needs to be the assignee in order to release it | |
| 73 | + */ | |
| 74 | + Task release(ReleaseTaskPayload releaseTaskPayload); | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Completes the selected task with the variables set in the payload | |
| 78 | + * - This method checks that the task is visible by the authenticated user | |
| 79 | + * - This method also check that the task is assigned to the currently authenticated user before complete | |
| 80 | + * - This method return a shallow Task object with the basic information needed to validate that the task was completed | |
| 81 | + */ | |
| 82 | + Task complete(CompleteTaskPayload completeTaskPayload); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Saves the selected task with the variables set in the payload in the task scope | |
| 86 | + * - This method checks that the task is visible by the authenticated user | |
| 87 | + * - This method also check that the task is assigned to the currently authenticated user | |
| 88 | + */ | |
| 89 | + void save(SaveTaskPayload saveTaskPayload); | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * Updates details of a task | |
| 93 | + * - The authenticated user should be able to see the task in order to update its details | |
| 94 | + * - The authenticated user needs to be the assignee of the task to update its details, if not he/she will need to claim the task first | |
| 95 | + */ | |
| 96 | + Task update(UpdateTaskPayload updateTaskPayload); | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * Deletes a task | |
| 100 | + * - The authenticated user should be able to see the task in order to delete it | |
| 101 | + * - The authenticated user needs to be the assignee of the task in order to delete it | |
| 102 | + * - this method returns a shallow Task with the necessary information to validate that the task was deleted | |
| 103 | + */ | |
| 104 | + Task delete(DeleteTaskPayload deleteTaskPayload); | |
| 105 | + | |
| 106 | + void createVariable(CreateTaskVariablePayload createTaskVariablePayload); | |
| 107 | + void updateVariable(UpdateTaskVariablePayload updateTaskVariablePayload); | |
| 108 | + List<VariableInstance> variables(GetTaskVariablesPayload getTaskVariablesPayload); | |
| 109 | + | |
| 110 | + void addCandidateUsers(CandidateUsersPayload candidateUsersPayload); | |
| 111 | + void deleteCandidateUsers(CandidateUsersPayload candidateUsersPayload); | |
| 112 | + | |
| 113 | + void addCandidateGroups(CandidateGroupsPayload candidateGroupsPayload); | |
| 114 | + void deleteCandidateGroups(CandidateGroupsPayload candidateGroupsPayload); | |
| 115 | + | |
| 116 | + List<String> userCandidates(String taskId); | |
| 117 | + List<String> groupCandidates(String taskId); | |
| 118 | + | |
| 119 | +} | ... | ... |
trash-common/src/main/java/com/trash/common/core/domain/entity/SysUser.java
| ... | ... | @@ -88,10 +88,10 @@ public class SysUser extends BaseEntity |
| 88 | 88 | private List<SysRole> roles; |
| 89 | 89 | |
| 90 | 90 | /** 角色组 */ |
| 91 | - private Long[] roleIds; | |
| 91 | + private List<String> roleIds; | |
| 92 | 92 | |
| 93 | 93 | /** 岗位组 */ |
| 94 | - private Long[] postIds; | |
| 94 | + private List<String> postIds; | |
| 95 | 95 | |
| 96 | 96 | public SysUser() |
| 97 | 97 | { |
| ... | ... | @@ -281,22 +281,22 @@ public class SysUser extends BaseEntity |
| 281 | 281 | this.roles = roles; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - public Long[] getRoleIds() | |
| 284 | + public List<String> getRoleIds() | |
| 285 | 285 | { |
| 286 | 286 | return roleIds; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public void setRoleIds(Long[] roleIds) | |
| 289 | + public void setRoleIds(List<String> roleIds) | |
| 290 | 290 | { |
| 291 | 291 | this.roleIds = roleIds; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - public Long[] getPostIds() | |
| 294 | + public List<String> getPostIds() | |
| 295 | 295 | { |
| 296 | 296 | return postIds; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - public void setPostIds(Long[] postIds) | |
| 299 | + public void setPostIds(List<String> postIds) | |
| 300 | 300 | { |
| 301 | 301 | this.postIds = postIds; |
| 302 | 302 | } | ... | ... |
trash-framework/src/main/java/com/trash/framework/web/service/SysLoginService.java
| ... | ... | @@ -2,11 +2,13 @@ package com.trash.framework.web.service; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.HashSet; |
| 5 | +import java.util.List; | |
| 5 | 6 | import java.util.Set; |
| 6 | 7 | import java.util.concurrent.TimeUnit; |
| 7 | 8 | |
| 8 | 9 | import javax.annotation.Resource; |
| 9 | 10 | |
| 11 | +import org.apache.commons.collections4.iterators.ArrayListIterator; | |
| 10 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 13 | import org.springframework.security.authentication.AuthenticationManager; |
| 12 | 14 | import org.springframework.security.authentication.BadCredentialsException; |
| ... | ... | @@ -163,7 +165,24 @@ public class SysLoginService |
| 163 | 165 | user.setNickName(userJson.getString("name")); |
| 164 | 166 | user.setPassword(userJson.getString("id")); |
| 165 | 167 | SysDept dept = new SysDept(); |
| 166 | - | |
| 168 | + | |
| 169 | + | |
| 170 | + List<String> poStrings = new ArrayList<String>(); | |
| 171 | + | |
| 172 | + for(String str :userJson.getString("postType").split(",")){ | |
| 173 | + poStrings.add(str); | |
| 174 | + } | |
| 175 | + | |
| 176 | + List<String> rolStrings = new ArrayList<String>(); | |
| 177 | + | |
| 178 | + for(String str :userJson.getString("departmentType").split(",")){ | |
| 179 | + rolStrings.add(str); | |
| 180 | + } | |
| 181 | + | |
| 182 | + user.setPostIds(poStrings); | |
| 183 | + | |
| 184 | + user.setRoleIds(rolStrings); | |
| 185 | + | |
| 167 | 186 | dept.setDeptName(userJson.getString("orgName")); |
| 168 | 187 | |
| 169 | 188 | user.setDept(dept); |
| ... | ... | @@ -184,9 +203,9 @@ public class SysLoginService |
| 184 | 203 | |
| 185 | 204 | user.setRoles(roles); |
| 186 | 205 | |
| 187 | - loginUser.setPermissions(set); | |
| 188 | - | |
| 189 | 206 | token = token.replace("Bearer ", "").replace("auth:token:", ""); |
| 207 | + | |
| 208 | + loginUser.setPermissions(set); | |
| 190 | 209 | |
| 191 | 210 | loginUser.setToken(token); |
| 192 | 211 | tokenService.refreshToken(loginUser); | ... | ... |
trash-system/src/main/java/com/trash/system/domain/SysUserPost.java
| ... | ... | @@ -14,7 +14,7 @@ public class SysUserPost |
| 14 | 14 | private String userId; |
| 15 | 15 | |
| 16 | 16 | /** 岗位ID */ |
| 17 | - private Long postId; | |
| 17 | + private String postId; | |
| 18 | 18 | |
| 19 | 19 | public String getUserId() |
| 20 | 20 | { |
| ... | ... | @@ -26,12 +26,12 @@ public class SysUserPost |
| 26 | 26 | this.userId = userId; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public Long getPostId() | |
| 29 | + public String getPostId() | |
| 30 | 30 | { |
| 31 | 31 | return postId; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public void setPostId(Long postId) | |
| 34 | + public void setPostId(String postId) | |
| 35 | 35 | { |
| 36 | 36 | this.postId = postId; |
| 37 | 37 | } | ... | ... |
trash-system/src/main/java/com/trash/system/domain/SysUserRole.java
| ... | ... | @@ -14,7 +14,7 @@ public class SysUserRole |
| 14 | 14 | private String userId; |
| 15 | 15 | |
| 16 | 16 | /** 角色ID */ |
| 17 | - private Long roleId; | |
| 17 | + private String roleId; | |
| 18 | 18 | |
| 19 | 19 | public String getUserId() |
| 20 | 20 | { |
| ... | ... | @@ -26,12 +26,12 @@ public class SysUserRole |
| 26 | 26 | this.userId = userId; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public Long getRoleId() | |
| 29 | + public String getRoleId() | |
| 30 | 30 | { |
| 31 | 31 | return roleId; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public void setRoleId(Long roleId) | |
| 34 | + public void setRoleId(String roleId) | |
| 35 | 35 | { |
| 36 | 36 | this.roleId = roleId; |
| 37 | 37 | } | ... | ... |
trash-system/src/main/java/com/trash/system/service/impl/SysUserServiceImpl.java
| ... | ... | @@ -315,12 +315,12 @@ public class SysUserServiceImpl implements ISysUserService |
| 315 | 315 | */ |
| 316 | 316 | public void insertUserRole(SysUser user) |
| 317 | 317 | { |
| 318 | - Long[] roles = user.getRoleIds(); | |
| 318 | + List<String> roles = user.getRoleIds(); | |
| 319 | 319 | if (StringUtils.isNotNull(roles)) |
| 320 | 320 | { |
| 321 | 321 | // 新增用户与角色管理 |
| 322 | 322 | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| 323 | - for (Long roleId : roles) | |
| 323 | + for (String roleId : roles) | |
| 324 | 324 | { |
| 325 | 325 | SysUserRole ur = new SysUserRole(); |
| 326 | 326 | ur.setUserId(user.getUserId()); |
| ... | ... | @@ -341,12 +341,12 @@ public class SysUserServiceImpl implements ISysUserService |
| 341 | 341 | */ |
| 342 | 342 | public void insertUserPost(SysUser user) |
| 343 | 343 | { |
| 344 | - Long[] posts = user.getPostIds(); | |
| 344 | + List<String> posts = user.getPostIds(); | |
| 345 | 345 | if (StringUtils.isNotNull(posts)) |
| 346 | 346 | { |
| 347 | 347 | // 新增用户与岗位管理 |
| 348 | 348 | List<SysUserPost> list = new ArrayList<SysUserPost>(); |
| 349 | - for (Long postId : posts) | |
| 349 | + for (String postId : posts) | |
| 350 | 350 | { |
| 351 | 351 | SysUserPost up = new SysUserPost(); |
| 352 | 352 | up.setUserId(user.getUserId()); | ... | ... |
trash-ui/src/router/index.js
| ... | ... | @@ -184,7 +184,7 @@ export const constantRoutes = [ |
| 184 | 184 | name: '工作报表', |
| 185 | 185 | meta: { title: '工作报表' } |
| 186 | 186 | }, { |
| 187 | - path: 'Weeklys/day', | |
| 187 | + path: 'weeklys/day', | |
| 188 | 188 | component: (resolve) => require(['@/views/daily/report/day'], resolve), |
| 189 | 189 | name: '工作日报', |
| 190 | 190 | meta: { title: '工作日报' } | ... | ... |
trash-ui/src/views/activiti/task/index.vue
trash-ui/src/views/business/dayWorkReport/index.vue
| ... | ... | @@ -132,6 +132,7 @@ |
| 132 | 132 | projectTypes:null, |
| 133 | 133 | earthsitesTypes:null, |
| 134 | 134 | |
| 135 | + outside:["长沙县","望城区","浏阳市","宁乡市","株洲市","湘潭市","汩罗市","湘阴县"], | |
| 135 | 136 | }; |
| 136 | 137 | }, |
| 137 | 138 | created() { |
| ... | ... | @@ -179,13 +180,10 @@ |
| 179 | 180 | dayWorkList(this.queryParams).then(response => { |
| 180 | 181 | this.threestepList = response.rows; |
| 181 | 182 | |
| 182 | - | |
| 183 | - | |
| 184 | 183 | getArea().then(res => { |
| 185 | 184 | this.areas = res.result; |
| 186 | 185 | for(let i =0;i< this.threestepList.length;i++){ |
| 187 | 186 | this.threestepList[i].place = this.getAreaName(this.threestepList[i].place); |
| 188 | - | |
| 189 | 187 | if(this.outside.indexOf(this.threestepList[i].place) > -1){ |
| 190 | 188 | if(this.threestepList[i].status == 1){ |
| 191 | 189 | this.threestepList[i].estatus = "开工"; | ... | ... |
trash-ui/src/views/business/threestep/index.vue
| ... | ... | @@ -829,7 +829,14 @@ |
| 829 | 829 | getThreestep(row.id).then(res=>{ |
| 830 | 830 | this.form = res.data; |
| 831 | 831 | this.form.type = this.form.type + ""; |
| 832 | - | |
| 832 | + this.form.place = Number(this.form.place); | |
| 833 | + this.bindname = res.data.earthsitesName; | |
| 834 | + if(res.data.companys){ | |
| 835 | + this.form.companys = res.data.companys.split(","); | |
| 836 | + } | |
| 837 | + if(res.data.companyTrucks){ | |
| 838 | + this.form.companyTrucks = res.data.companyTrucks.split(","); | |
| 839 | + } | |
| 833 | 840 | for (let i = 0; i < 13; i++) { |
| 834 | 841 | if (this.form["img" + i]) { |
| 835 | 842 | this.form["img" + i] = this.form["img" + i].split(","); | ... | ... |
trash-workFlow/src/main/java/com/trash/business/controller/SupervisionThreestepController.java
| ... | ... | @@ -69,6 +69,17 @@ public class SupervisionThreestepController extends BaseController |
| 69 | 69 | return getDataTable(list); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 查询三查机制列表 | |
| 75 | + */ | |
| 76 | + @PreAuthorize("@ss.hasPermi('business:threestep:list')") | |
| 77 | + @PostMapping("/dayWorkList") | |
| 78 | + public AjaxResult days(@RequestBody SupervisionThreestep supervisionThreestep) | |
| 79 | + { | |
| 80 | + return AjaxResult.success(supervisionThreestepService.selectDayWorkListByType(supervisionThreestep)); | |
| 81 | + } | |
| 82 | + | |
| 72 | 83 | /** |
| 73 | 84 | * 导出三查机制列表 |
| 74 | 85 | */ | ... | ... |
trash-workFlow/src/main/java/com/trash/business/domain/SupervisionThreestep.java
trash-workFlow/src/main/java/com/trash/business/mapper/SupervisionThreestepMapper.java
| ... | ... | @@ -66,4 +66,6 @@ public interface SupervisionThreestepMapper |
| 66 | 66 | public SupervisionThreestep selectTodayData(SupervisionThreestep supervisionThreestep); |
| 67 | 67 | |
| 68 | 68 | public List<String> getNames(SupervisionThreestep supervisionThreestep); |
| 69 | + | |
| 70 | + public List<Map> selectDayWorkListByType(SupervisionThreestep supervisionThreestep); | |
| 69 | 71 | } | ... | ... |
trash-workFlow/src/main/java/com/trash/business/service/ISupervisionThreestepService.java
| ... | ... | @@ -70,4 +70,6 @@ public interface ISupervisionThreestepService |
| 70 | 70 | public int activeSupervisionThreestep(SupervisionThreestep supervisionThreestep); |
| 71 | 71 | |
| 72 | 72 | public List<String> getNames(SupervisionThreestep supervisionThreestep); |
| 73 | + | |
| 74 | + public List<Map> selectDayWorkListByType(SupervisionThreestep supervisionThreestep); | |
| 73 | 75 | } | ... | ... |
trash-workFlow/src/main/java/com/trash/business/service/impl/SupervisionThreestepServiceImpl.java
| ... | ... | @@ -213,7 +213,16 @@ public class SupervisionThreestepServiceImpl implements ISupervisionThreestepSer |
| 213 | 213 | |
| 214 | 214 | return list; |
| 215 | 215 | } |
| 216 | + | |
| 217 | + | |
| 218 | + @Override | |
| 219 | + public List<Map> selectDayWorkListByType(SupervisionThreestep supervisionThreestep) { | |
| 220 | + | |
| 221 | + return supervisionThreestepMapper.selectDayWorkListByType(supervisionThreestep); | |
| 216 | 222 | |
| 223 | + } | |
| 224 | + | |
| 225 | + | |
| 217 | 226 | /** |
| 218 | 227 | * 新增三查机制 |
| 219 | 228 | * |
| ... | ... | @@ -410,4 +419,5 @@ public class SupervisionThreestepServiceImpl implements ISupervisionThreestepSer |
| 410 | 419 | } |
| 411 | 420 | return null; |
| 412 | 421 | } |
| 422 | + | |
| 413 | 423 | } | ... | ... |
trash-workFlow/src/main/java/com/trash/workflow/service/impl/WorkflowServiceImpl.java
| ... | ... | @@ -185,7 +185,6 @@ public class WorkflowServiceImpl implements IWorkflowService { |
| 185 | 185 | .build()); |
| 186 | 186 | |
| 187 | 187 | // List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); |
| 188 | -// | |
| 189 | 188 | // for(Task task : tasks){ //测试 当前用户为审批用户 |
| 190 | 189 | // task.setAssignee(SecurityUtils.getUsername()); |
| 191 | 190 | // taskService.saveTask(task); | ... | ... |
trash-workFlow/src/main/resources/mapper/SupervisionThreestepMapper.xml
| ... | ... | @@ -63,7 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 63 | 63 | </resultMap> |
| 64 | 64 | |
| 65 | 65 | <sql id="selectSupervisionThreestepVo"> |
| 66 | - select id, name, type, place, self_check_time, object_id, earthsites_id, create_time, check_time, earthsites_name,check_end_time, contract, companys, company_trucks, img0, img1, img2, img3, img4, img5, img6, img7, img8, img9, img10, img11, img12, sub_img0, sub_img1, sub_img2, sub_img3, sub_img4, sub_img5, sub_img6, sub_img7, sub_img8, sub_img9, sub_img10, sub_img11, sub_img12, person, phone,status,create_by,sub_reason,earth_pip_person,enforce_person,sub_sub_reason,attch_item1,attch_item2,attch_item3 from supervision_threestep | |
| 66 | + select id, name, type, place, self_check_time, object_id, earthsites_id, create_time, check_time, earthsites_name,check_end_time, contract, | |
| 67 | + companys, company_trucks, img0, img1, img2, img3, img4, img5, img6, img7, img8, img9, img10, img11, img12, sub_img0, sub_img1, | |
| 68 | + sub_img2, sub_img3, sub_img4, sub_img5, sub_img6, sub_img7, sub_img8, sub_img9, sub_img10, sub_img11, sub_img12, | |
| 69 | + person, phone,status,create_by,sub_reason,earth_pip_person,enforce_person,sub_sub_reason,attch_item1,attch_item2,attch_item3 from supervision_threestep | |
| 67 | 70 | </sql> |
| 68 | 71 | |
| 69 | 72 | <select id="selectSupervisionThreestepList" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult"> |
| ... | ... | @@ -148,6 +151,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 148 | 151 | ORDER BY a.create_time DESC |
| 149 | 152 | </select> |
| 150 | 153 | |
| 154 | + | |
| 155 | + <select id="selectDayWorkListByType" parameterType="SupervisionThreestep" resultType="java.util.HashMap"> | |
| 156 | + select object_id id,name,earthsites_id relationSiteId from supervision_threestep | |
| 157 | + where type = #{type} | |
| 158 | + and DATE_FORMAT(self_check_time,("%y%m%d")) = DATE_FORMAT(NOW(),("%y%m%d")) | |
| 159 | + and status = 1 | |
| 160 | + ORDER BY self_check_time DESC | |
| 161 | + </select> | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 151 | 165 | <select id="selectSupervisionThreestepById" parameterType="Long" resultMap="SupervisionThreestepResult"> |
| 152 | 166 | <include refid="selectSupervisionThreestepVo"/> |
| 153 | 167 | where id = #{id} | ... | ... |