From 82ec4b4da5764185331c4009296a4330ade0d334 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 09:54:26 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E7=BB=84=E6=88=90=E5=91=98=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/controller/ActTaskController.java | 10 ++++------ .../modules/activiti/service/ActTaskService.java | 5 +++-- .../src/main/resources/db/V8.3__add_table.sql | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 renren-admin/src/main/resources/db/V8.3__add_table.sql 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 af2e5078..ef6edab0 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 @@ -1,6 +1,5 @@ package io.renren.modules.activiti.controller; -import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.annotation.LogOperation; @@ -12,7 +11,6 @@ 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.resource.service.impl.ResourceServiceImpl; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; import io.renren.modules.sys.dto.SysUserDTO; @@ -252,7 +250,7 @@ public class ActTaskController { return new Result().error(ErrorCode.PARAMS_GET_ERROR); } actTaskService.completeTask(taskId, comment); - return new Result(); + return new Result().ok("审核通过"); } /** @@ -473,7 +471,7 @@ public class ActTaskController { return new Result().ok(resultMap); } catch (Exception e) { logger.error("浪潮数据查询异常", e); - + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); } @@ -580,7 +578,7 @@ public class ActTaskController { return new Result().ok(arrayList); } catch (Exception e) { logger.error("浪潮数据查询异常", e); - + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); } @@ -603,7 +601,7 @@ public class ActTaskController { return new Result().ok(list); } catch (Exception e) { logger.error("浪潮数据查询异常", e); - + return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index cdef7742..4feeb584 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -497,8 +497,9 @@ public class ActTaskService extends BaseServiceImpl { public void completeTask(String taskId, String comment) { String userId = SecurityUser.getUserId().toString(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); - if (StringUtils.isNotEmpty(task.getAssignee())) { - taskService.setAssignee(taskId, userId); + if (StringUtils.isNotEmpty(task.getAssignee()) + && !task.getAssignee().equals(userId)) { + taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 } if (StringUtils.isNotEmpty(comment)) { taskService.addComment(taskId, task.getProcessInstanceId(), comment); diff --git a/renren-admin/src/main/resources/db/V8.3__add_table.sql b/renren-admin/src/main/resources/db/V8.3__add_table.sql new file mode 100644 index 00000000..a1235511 --- /dev/null +++ b/renren-admin/src/main/resources/db/V8.3__add_table.sql @@ -0,0 +1,15 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +CREATE TABLE `sys_audit_team` ( + `id` bigint NOT NULL COMMENT '主键ID', + `creator` bigint NOT NULL COMMENT '创建人', + `create_date` datetime NOT NULL COMMENT '创建时间', + `name` longtext NOT NULL COMMENT '审核组名称', + `member` json NOT NULL COMMENT '审核组成员id数组', + `index` varchar(255) NULL COMMENT '审核组索引', + PRIMARY KEY (`id`), + INDEX `name`(`name`) USING BTREE COMMENT '审核组名称索引' +) COMMENT = '流程审核组组员'; + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From 871862bd005d9a0267bbba402d4b8f3086111905 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 09:54:39 +0800 Subject: [PATCH 02/11] ... --- .../src/main/resources/db/V8.3__add_table.sql | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/renren-admin/src/main/resources/db/V8.3__add_table.sql b/renren-admin/src/main/resources/db/V8.3__add_table.sql index a1235511..601dad11 100644 --- a/renren-admin/src/main/resources/db/V8.3__add_table.sql +++ b/renren-admin/src/main/resources/db/V8.3__add_table.sql @@ -1,15 +1,14 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; - -CREATE TABLE `sys_audit_team` ( - `id` bigint NOT NULL COMMENT '主键ID', - `creator` bigint NOT NULL COMMENT '创建人', - `create_date` datetime NOT NULL COMMENT '创建时间', - `name` longtext NOT NULL COMMENT '审核组名称', - `member` json NOT NULL COMMENT '审核组成员id数组', - `index` varchar(255) NULL COMMENT '审核组索引', +drop table IF EXISTS `sys_audit_team`; +create TABLE `sys_audit_team` ( + `id` bigint NOT NULL comment '主键ID', + `creator` bigint NOT NULL comment '创建人', + `create_date` datetime NOT NULL comment '创建时间', + `name` longtext NOT NULL comment '审核组名称', + `member` json NOT NULL comment '审核组成员id数组', + `index` varchar(255) NULL comment '审核组索引', PRIMARY KEY (`id`), - INDEX `name`(`name`) USING BTREE COMMENT '审核组名称索引' -) COMMENT = '流程审核组组员'; - + INDEX `name`(`name`) USING BTREE comment '审核组名称索引' +) comment = '流程审核组组员'; SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From eb97a398fe3742323a8d1ec1a5867bf91415051a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 10:04:25 +0800 Subject: [PATCH 03/11] =?UTF-8?q?sql=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/renren/modules/activiti/service/ActHistoryService.java | 2 +- renren-admin/src/main/resources/db/V8.3__add_table.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index c6b90442..e41e9f5d 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -425,7 +425,7 @@ public class ActHistoryService { } } } else { - logger.info("不存在正在进行流程节点"); + logger.info("不存在正在进行流程节点:" + index.getProcessInstanceId()); index.setAllowReminders(Boolean.FALSE); index.setDoneReminders(Boolean.FALSE); index.setNextRemindersDays(0); diff --git a/renren-admin/src/main/resources/db/V8.3__add_table.sql b/renren-admin/src/main/resources/db/V8.3__add_table.sql index 601dad11..5d761760 100644 --- a/renren-admin/src/main/resources/db/V8.3__add_table.sql +++ b/renren-admin/src/main/resources/db/V8.3__add_table.sql @@ -8,7 +8,7 @@ create TABLE `sys_audit_team` ( `name` longtext NOT NULL comment '审核组名称', `member` json NOT NULL comment '审核组成员id数组', `index` varchar(255) NULL comment '审核组索引', - PRIMARY KEY (`id`), - INDEX `name`(`name`) USING BTREE comment '审核组名称索引' + PRIMARY KEY (`id`) ) comment = '流程审核组组员'; +alter table `sys_audit_team` ADD INDEX `name`(`name`) USING BTREE comment '审核组名称索引'; SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From 3147d1ea2ef01ef666882617a9d6a64ab8920588 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 10:04:34 +0800 Subject: [PATCH 04/11] .. --- renren-admin/src/main/resources/db/V8.3__add_table.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/resources/db/V8.3__add_table.sql b/renren-admin/src/main/resources/db/V8.3__add_table.sql index 5d761760..c27247b4 100644 --- a/renren-admin/src/main/resources/db/V8.3__add_table.sql +++ b/renren-admin/src/main/resources/db/V8.3__add_table.sql @@ -10,5 +10,5 @@ create TABLE `sys_audit_team` ( `index` varchar(255) NULL comment '审核组索引', PRIMARY KEY (`id`) ) comment = '流程审核组组员'; -alter table `sys_audit_team` ADD INDEX `name`(`name`) USING BTREE comment '审核组名称索引'; +alter table `sys_audit_team` ADD INDEX `name_`(`name`) USING BTREE comment '审核组名称索引'; SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From 31abb2e28cebb4a7a7e7c1d61ed1b2da92bc0dc0 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 10:12:53 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=B1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- renren-admin/src/main/resources/db/V8.3__add_table.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/renren-admin/src/main/resources/db/V8.3__add_table.sql b/renren-admin/src/main/resources/db/V8.3__add_table.sql index c27247b4..46928079 100644 --- a/renren-admin/src/main/resources/db/V8.3__add_table.sql +++ b/renren-admin/src/main/resources/db/V8.3__add_table.sql @@ -10,5 +10,4 @@ create TABLE `sys_audit_team` ( `index` varchar(255) NULL comment '审核组索引', PRIMARY KEY (`id`) ) comment = '流程审核组组员'; -alter table `sys_audit_team` ADD INDEX `name_`(`name`) USING BTREE comment '审核组名称索引'; SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From b2f03e421884b91e7cefee45dbe01e3b3b10d50f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 15:57:11 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E6=B6=89=E5=8F=8A?= =?UTF-8?q?=E7=9A=84=E5=AE=A1=E6=A0=B8=E5=8D=8F=E4=BD=9C=E7=BB=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActTaskController.java | 2 +- .../renren/modules/activiti/dto/TaskDTO.java | 2 + .../activiti/service/ActTaskService.java | 49 +++++-- .../controller/SysAuditTeamController.java | 137 ++++++++++++++++++ .../audit_team/dao/SysAuditTeamDao.java | 27 ++++ .../audit_team/dto/SysAuditTeamDTO.java | 36 +++++ .../audit_team/entity/SysAuditTeamEntity.java | 42 ++++++ .../audit_team/excel/SysAuditTeamExcel.java | 32 ++++ .../service/SysAuditTeamService.java | 17 +++ .../service/impl/SysAuditTeamServiceImpl.java | 36 +++++ .../src/main/resources/application.yml | 3 + .../mapper/audit_team/SysAuditTeamDao.xml | 35 +++++ 12 files changed, 406 insertions(+), 12 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/dao/SysAuditTeamDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/dto/SysAuditTeamDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/entity/SysAuditTeamEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/excel/SysAuditTeamExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/service/SysAuditTeamService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/audit_team/service/impl/SysAuditTeamServiceImpl.java create mode 100644 renren-admin/src/main/resources/mapper/audit_team/SysAuditTeamDao.xml 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 ef6edab0..d249ebd7 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 @@ -113,7 +113,7 @@ public class ActTaskController { if (userId.equals(taskDTO.getAssignee())) { taskDTO.setSynergism(Boolean.FALSE); } else { - taskDTO.setSynergism(Boolean.FALSE); + taskDTO.setSynergism(Boolean.TRUE); } } } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java b/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java index c666d17a..41bf5d18 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/dto/TaskDTO.java @@ -102,6 +102,8 @@ public class TaskDTO { private String provideDept; @ApiModelProperty(value = "是否为审核组内协助任务") private Boolean synergism; + @ApiModelProperty(value = "审核组名称") + private String auditTeamName; @Override diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 4feeb584..3a158c58 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -11,6 +11,8 @@ import io.renren.common.page.PageData; import io.renren.common.service.impl.BaseServiceImpl; import io.renren.common.utils.MessageUtils; import io.renren.modules.activiti.dto.TaskDTO; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.service.SysAuditTeamService; import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.demandComment.dto.TDemandCommentDTO; @@ -60,6 +62,7 @@ import org.codehaus.jackson.map.ObjectMapper; 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.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -81,6 +84,8 @@ public class ActTaskService extends BaseServiceImpl { private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2); + private static final ExecutorService executor_task = Executors.newCachedThreadPool(); + public static String Task_HANDLE_STATE = "handleState"; //任务节点处理状态key public static String Task_HANDLE_STATE_AGREE = "agree"; //同意 public static String Task_HANDLE_STATE_REJECTED = "rejected"; //驳回 @@ -123,6 +128,11 @@ public class ActTaskService extends BaseServiceImpl { private SysNoticeService sysNoticeService; @Autowired private JdbcTemplate jdbcTemplate; + @Autowired + private SysAuditTeamService sysAuditTeamService; + + @Value("#{new Boolean(${auditteam.enable})}") + private Boolean auditteam; // 是否进行审核组 /** * 根据参数获取当前运行的任务信息 @@ -131,11 +141,23 @@ public class ActTaskService extends BaseServiceImpl { * @return */ public PageData page(Map params) { - // TODO 同一审核组内成员 - List groupUserId = new ArrayList() {{ // 测试 - - }}; String userId = (String) params.get("userId"); + // 同一审核组内成员 + List groupUserId = new ArrayList<>(); + List sysAuditTeamDTOS = new ArrayList<>(); + if (auditteam) { + sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(userId); + 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()); + } + Integer curPage = 1; Integer limit = 10; if (params.get(Constant.PAGE) != null) { @@ -158,9 +180,11 @@ public class ActTaskService extends BaseServiceImpl { if (StringUtils.isNotEmpty(userId)) { where.append("AND ( RES.ASSIGNEE_ = #{userId} "); // 处理同一工作组内 - groupUserId.stream().forEach(index -> { - where.append(String.format(" OR RES.ASSIGNEE_ = '%s' ", index)); - }); + if (auditteam) { // 进行审核组协作时 + groupUserId.stream().forEach(index -> { + where.append(String.format(" OR RES.ASSIGNEE_ = '%s' ", index)); + }); + } where.append(")"); } @@ -193,7 +217,7 @@ public class ActTaskService extends BaseServiceImpl { List completableFutures = new ArrayList(); final TaskQuery taskQuery = taskService.createTaskQuery(); List list_ = tasks.stream().map(index -> { - CompletableFuture tempTask = CompletableFuture.supplyAsync(() -> taskQuery.taskId(index.getId()).includeProcessVariables().singleResult(), executor); + CompletableFuture tempTask = CompletableFuture.supplyAsync(() -> taskQuery.taskId(index.getId()).includeProcessVariables().singleResult(), executor_task); Task temp = null; try { temp = (Task) tempTask.get(); @@ -205,7 +229,8 @@ public class ActTaskService extends BaseServiceImpl { return temp; }).filter(Objects::nonNull).collect(Collectors.toList()); CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join(); - return new PageData<>(tasks2TaskDtos(list_), (int) count); + String name = sysAuditTeamDTOS.stream().map(index -> index.getName()).findFirst().orElse(""); + return new PageData<>(tasks2TaskDtos(list_, name), (int) count); // 以下注释为原实现方案 // TaskQuery taskQuery = taskService.createTaskQuery(); // if (StringUtils.isNotEmpty(userId)) { @@ -266,7 +291,7 @@ public class ActTaskService extends BaseServiceImpl { .listPage((finalCurPage - 1) * finalLimit, finalCurPage * finalLimit); count.add(taskQuery.taskAssignee(index.getId().toString()) .orderByTaskCreateTime().desc().count()); - taskDtoList.addAll(tasks2TaskDtos(list)); + taskDtoList.addAll(tasks2TaskDtos(list, "")); }); return completableFuture; }).collect(Collectors.toList()); @@ -287,11 +312,13 @@ public class ActTaskService extends BaseServiceImpl { return page; } - private List tasks2TaskDtos(List list) { + private List tasks2TaskDtos(List list, String audioTeamName) { List listDto = new ArrayList<>(); for (Task task : list) { TaskDTO dto = new TaskDTO(); this.convertTaskInfo(task, dto); + // 填入审核协作组名称 + dto.setAuditTeamName(audioTeamName); Map processVariable = new LinkedHashMap<>(); if (task.getProcessVariables().containsKey("tAbilityApplicationDTOList")) { 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 new file mode 100644 index 00000000..9299a462 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/controller/SysAuditTeamController.java @@ -0,0 +1,137 @@ +package io.renren.modules.audit_team.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.excel.SysAuditTeamExcel; +import io.renren.modules.audit_team.service.SysAuditTeamService; +import io.renren.modules.category.util.CommonUtils; +import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.service.SysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@RestController +@RequestMapping("audit_team/sysauditteam") +@Api(tags = "流程审核组组员") +public class SysAuditTeamController { + @Autowired + private SysAuditTeamService sysAuditTeamService; + @Autowired + private SysUserService sysUserService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String") + }) +// @RequiresPermissions("audit_team:sysauditteam:page") + public Result> page(@ApiIgnore @RequestParam Map params) { + PageData page = sysAuditTeamService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") +// @RequiresPermissions("audit_team:sysauditteam:info") + public Result get(@PathVariable("id") Long id) { + SysAuditTeamDTO data = sysAuditTeamService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @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 -> { + Optional sysUserDTO = Optional.ofNullable(sysUserService.get(Long.parseLong((String) index.get("id")))); + if (sysUserDTO.isPresent()) { + index.put("name", sysUserDTO.get().getRealName()); + index.put("dept_name", sysUserDTO.get().getDeptName()); + } + return index; + }).collect(Collectors.toList())); + sysAuditTeamService.save(dto); + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") +// @RequiresPermissions("audit_team:sysauditteam:update") + public Result update(@RequestBody SysAuditTeamDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音 + dto.setMember(dto.getMember().stream().map(index -> { + Optional sysUserDTO = Optional.ofNullable(sysUserService.get((long) index.get("id"))); + if (sysUserDTO.isPresent()) { + index.put("name", sysUserDTO.get().getRealName()); + index.put("dept_name", sysUserDTO.get().getDeptName()); + } + return index; + }).collect(Collectors.toList())); + sysAuditTeamService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") +// @RequiresPermissions("audit_team:sysauditteam:delete") + public Result delete(@RequestBody Long[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + sysAuditTeamService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") +// @RequiresPermissions("audit_team:sysauditteam:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = sysAuditTeamService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "流程审核组组员", list, SysAuditTeamExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/dao/SysAuditTeamDao.java b/renren-admin/src/main/java/io/renren/modules/audit_team/dao/SysAuditTeamDao.java new file mode 100644 index 00000000..0bb304c2 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/dao/SysAuditTeamDao.java @@ -0,0 +1,27 @@ +package io.renren.modules.audit_team.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.entity.SysAuditTeamEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@Mapper +public interface SysAuditTeamDao extends BaseDao { + + /** + * 根据审核组成员用户id,获取审核组列表 + * + * @param member + * @return + */ + List selectByMemberOne(@Param("member") String member); +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/dto/SysAuditTeamDTO.java b/renren-admin/src/main/java/io/renren/modules/audit_team/dto/SysAuditTeamDTO.java new file mode 100644 index 00000000..3e438067 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/dto/SysAuditTeamDTO.java @@ -0,0 +1,36 @@ +package io.renren.modules.audit_team.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@Data +@ApiModel(value = "流程审核组组员") +public class SysAuditTeamDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "审核组名称") + private String name; + @ApiModelProperty(value = "审核组成员id数组") + private List member; + @ApiModelProperty(value = "审核组索引") + private String index; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/entity/SysAuditTeamEntity.java b/renren-admin/src/main/java/io/renren/modules/audit_team/entity/SysAuditTeamEntity.java new file mode 100644 index 00000000..20c0fb04 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/entity/SysAuditTeamEntity.java @@ -0,0 +1,42 @@ +package io.renren.modules.audit_team.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; +import io.renren.common.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "sys_audit_team", autoResultMap = true) +public class SysAuditTeamEntity extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 审核组名称 + */ + private String name; + + /** + * 审核组成员id数组 + */ + @TableField(value = "member", typeHandler = FastjsonTypeHandler.class) + private List member; + + /** + * 审核组索引 + */ + @TableField(value = "`index`") + private String index; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/excel/SysAuditTeamExcel.java b/renren-admin/src/main/java/io/renren/modules/audit_team/excel/SysAuditTeamExcel.java new file mode 100644 index 00000000..3ec03faa --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/excel/SysAuditTeamExcel.java @@ -0,0 +1,32 @@ +package io.renren.modules.audit_team.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class SysAuditTeamExcel { + @ExcelProperty(value = "主键ID", index = 0) + private Object id; + @ExcelProperty(value = "创建人", index = 1) + private Object creator; + @ExcelProperty(value = "创建时间", index = 2) + private Object createDate; + @ExcelProperty(value = "审核组名称", index = 3) + private Object name; + @ExcelProperty(value = "审核组成员id数组", index = 4) + private Object member; + @ExcelProperty(value = "审核组索引", index = 5) + private Object index; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/service/SysAuditTeamService.java b/renren-admin/src/main/java/io/renren/modules/audit_team/service/SysAuditTeamService.java new file mode 100644 index 00000000..2cf6c23d --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/service/SysAuditTeamService.java @@ -0,0 +1,17 @@ +package io.renren.modules.audit_team.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.entity.SysAuditTeamEntity; + +import java.util.List; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +public interface SysAuditTeamService extends CrudService { + List selectByMemberOne(String member); +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/audit_team/service/impl/SysAuditTeamServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/audit_team/service/impl/SysAuditTeamServiceImpl.java new file mode 100644 index 00000000..86e9ce48 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/audit_team/service/impl/SysAuditTeamServiceImpl.java @@ -0,0 +1,36 @@ +package io.renren.modules.audit_team.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.modules.audit_team.dao.SysAuditTeamDao; +import io.renren.modules.audit_team.dto.SysAuditTeamDTO; +import io.renren.modules.audit_team.entity.SysAuditTeamEntity; +import io.renren.modules.audit_team.service.SysAuditTeamService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * 流程审核组组员 + * + * @author wangliwen wangliwen2@hisense.com + * @since 1.0 2022-12-12 + */ +@Service +public class SysAuditTeamServiceImpl extends CrudServiceImpl implements SysAuditTeamService { + + @Override + public QueryWrapper getWrapper(Map params) { + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + + @Override + public List selectByMemberOne(String member) { + return baseDao.selectByMemberOne(member); + } +} \ No newline at end of file diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 853b9125..afad6a31 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -182,4 +182,7 @@ reminders: # 恩科会议 enke: enable: true +# 开启审核组成员支持 +auditteam: + enable: true diff --git a/renren-admin/src/main/resources/mapper/audit_team/SysAuditTeamDao.xml b/renren-admin/src/main/resources/mapper/audit_team/SysAuditTeamDao.xml new file mode 100644 index 00000000..c830806f --- /dev/null +++ b/renren-admin/src/main/resources/mapper/audit_team/SysAuditTeamDao.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c883aaf8d2e59aa125814c97f18ca6adbb97ab8f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 16:21:23 +0800 Subject: [PATCH 07/11] ... --- .../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 08/11] =?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); From 4bdebca7d7d1a217273c2ba8d9c7f785f8548f61 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 16:55:33 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8D=8F=E4=BD=9C?= =?UTF-8?q?=E7=BB=84=E5=86=85=E5=AE=A1=E6=A0=B8=E4=BA=BA=E4=B8=8D=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renren/modules/activiti/service/ActTaskService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 3a158c58..9f0e9c14 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -524,10 +524,10 @@ public class ActTaskService extends BaseServiceImpl { public void completeTask(String taskId, String comment) { String userId = SecurityUser.getUserId().toString(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); - if (StringUtils.isNotEmpty(task.getAssignee()) - && !task.getAssignee().equals(userId)) { - taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 - } +// if (StringUtils.isNotEmpty(task.getAssignee()) +// && !task.getAssignee().equals(userId)) { +// taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 +// } if (StringUtils.isNotEmpty(comment)) { taskService.addComment(taskId, task.getProcessInstanceId(), comment); } From 5f2b55d97582ca4be78675ca47602ea376a74029 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 17:06:21 +0800 Subject: [PATCH 10/11] =?UTF-8?q?...=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renren/modules/activiti/service/ActTaskService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 9f0e9c14..3a158c58 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -524,10 +524,10 @@ public class ActTaskService extends BaseServiceImpl { public void completeTask(String taskId, String comment) { String userId = SecurityUser.getUserId().toString(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); -// if (StringUtils.isNotEmpty(task.getAssignee()) -// && !task.getAssignee().equals(userId)) { -// taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 -// } + if (StringUtils.isNotEmpty(task.getAssignee()) + && !task.getAssignee().equals(userId)) { + taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 + } if (StringUtils.isNotEmpty(comment)) { taskService.addComment(taskId, task.getProcessInstanceId(), comment); } From e3184382fcbe7e7a483cad899187aba0cb81e884 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 12 Dec 2022 17:20:13 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E5=8D=8F=E4=BD=9C=E7=BB=84=E4=BA=92?= =?UTF-8?q?=E5=8A=A9=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E5=8F=91=E5=88=86=E9=85=8D=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/modules/activiti/service/ActTaskService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 3a158c58..e2a759ff 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -526,6 +526,7 @@ public class ActTaskService extends BaseServiceImpl { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (StringUtils.isNotEmpty(task.getAssignee()) && !task.getAssignee().equals(userId)) { + taskService.setVariable(taskId, "autoApply", taskId); // 配置不发送审核人分配通知 taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人 } if (StringUtils.isNotEmpty(comment)) {