From c883aaf8d2e59aa125814c97f18ca6adbb97ab8f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 16:21:23 +0800 Subject: [PATCH 1/2] ... --- .../audit_team/controller/SysAuditTeamController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java b/renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java index 9299a462..7d78e58d 100644 --- a/renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java @@ -75,7 +75,7 @@ public class SysAuditTeamController { @LogOperation("保存") // @RequiresPermissions("audit_team:sysauditteam:save") public Result save(@RequestBody SysAuditTeamDTO dto) { - //效验数据 + // 效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音 dto.setMember(dto.getMember().stream().map(index -> { @@ -87,7 +87,7 @@ public class SysAuditTeamController { return index; }).collect(Collectors.toList())); sysAuditTeamService.save(dto); - return new Result(); + return new Result().ok("保存成功"); } @PutMapping @@ -108,7 +108,7 @@ public class SysAuditTeamController { }).collect(Collectors.toList())); sysAuditTeamService.update(dto); - return new Result(); + return new Result().ok("修改成功"); } @DeleteMapping @@ -121,7 +121,7 @@ public class SysAuditTeamController { sysAuditTeamService.delete(ids); - return new Result(); + return new Result().ok("删除成功"); } @GetMapping("export") From d9f600f046237ffcb5ad6dbfbccc7301cde4848a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 16:38:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=AD=E5=8A=A0=E5=85=A5=E5=8D=8F=E4=BD=9C?= =?UTF-8?q?=E7=BB=84=E5=86=85=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActTaskController.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index d249ebd7..220389d2 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -11,6 +11,8 @@ import io.renren.common.utils.Result; import io.renren.modules.activiti.dto.BatchCompleteDTO; import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.activiti.service.ActTaskService; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.service.SysAuditTeamService; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; import io.renren.modules.sys.dto.SysUserDTO; @@ -27,6 +29,7 @@ import org.activiti.engine.task.TaskQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -63,6 +66,11 @@ public class ActTaskController { protected RepositoryService repositoryService; @Autowired protected TaskService taskService; + @Autowired + private SysAuditTeamService sysAuditTeamService; + + @Value("#{new Boolean(${auditteam.enable})}") + private Boolean auditteam; // 是否进行审核组 /** @@ -163,7 +171,8 @@ public class ActTaskController { }) public Result> myToDoTaskNum(@ApiIgnore @RequestParam Map params) { Map result = new LinkedHashMap<>(); - params.put("userId", SecurityUser.getUserId().toString()); + String userId = SecurityUser.getUserId().toString(); + params.put("userId", userId); ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() .orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc(); processDefinitionQuery.latestVersion(); @@ -173,7 +182,28 @@ public class ActTaskController { taskQuery.processDefinitionKey(index.getKey()); // 流程模型key taskQuery.taskAssignee(SecurityUser.getUserId().toString()); taskQuery.active(); - result.put(index.getKey(), taskQuery.count()); + if (auditteam) { // 允许流程审核协作时 + List sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(userId); + List groupUserId = sysAuditTeamDTOS + .stream() + .map(index_ -> index_.getMember()) + .filter(Objects::nonNull) + .flatMap(index_ -> index_.stream()) + .map(index_ -> (String) index_.get("id")) + .filter(index_ -> !userId.equals(index_)) // 过滤非本人 + .distinct() + .collect(Collectors.toList()); + long sum = groupUserId.stream().mapToLong(inedx_ -> { + TaskQuery taskQuery_ = taskService.createTaskQuery(); + taskQuery_.processDefinitionKey(index.getKey()); // 流程模型key + taskQuery_.taskAssignee(inedx_); // 协作组审核人 + taskQuery_.active(); + return taskQuery_.count(); + }).sum(); + result.put(index.getKey(), taskQuery.count() + sum); // 加上协作组任务数 + } else { + result.put(index.getKey(), taskQuery.count()); + } }); result.put("meetingroom_book", jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Long.class)); return new Result>().ok(result);