Merge branch 'dev' of http://192.168.124.50:3000/wangliwen/share-platform into dev
# Conflicts: # renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java
This commit is contained in:
commit
1c143be715
|
@ -11,6 +11,8 @@ import io.renren.common.utils.Result;
|
||||||
import io.renren.modules.activiti.dto.BatchCompleteDTO;
|
import io.renren.modules.activiti.dto.BatchCompleteDTO;
|
||||||
import io.renren.modules.activiti.dto.TaskDTO;
|
import io.renren.modules.activiti.dto.TaskDTO;
|
||||||
import io.renren.modules.activiti.service.ActTaskService;
|
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.SecurityUser;
|
||||||
import io.renren.modules.security.user.UserDetail;
|
import io.renren.modules.security.user.UserDetail;
|
||||||
import io.renren.modules.sys.dto.SysUserDTO;
|
import io.renren.modules.sys.dto.SysUserDTO;
|
||||||
|
@ -28,6 +30,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -64,6 +67,11 @@ public class ActTaskController {
|
||||||
protected RepositoryService repositoryService;
|
protected RepositoryService repositoryService;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected TaskService taskService;
|
protected TaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private SysAuditTeamService sysAuditTeamService;
|
||||||
|
|
||||||
|
@Value("#{new Boolean(${auditteam.enable})}")
|
||||||
|
private Boolean auditteam; // 是否进行审核组
|
||||||
|
|
||||||
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
|
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
|
||||||
|
|
||||||
|
@ -115,7 +123,7 @@ public class ActTaskController {
|
||||||
if (userId.equals(taskDTO.getAssignee())) {
|
if (userId.equals(taskDTO.getAssignee())) {
|
||||||
taskDTO.setSynergism(Boolean.FALSE);
|
taskDTO.setSynergism(Boolean.FALSE);
|
||||||
} else {
|
} else {
|
||||||
taskDTO.setSynergism(Boolean.FALSE);
|
taskDTO.setSynergism(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +173,8 @@ public class ActTaskController {
|
||||||
})
|
})
|
||||||
public Result<Map<String, Long>> myToDoTaskNum(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result<Map<String, Long>> myToDoTaskNum(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
Map<String, Long> result = new LinkedHashMap<>();
|
Map<String, Long> result = new LinkedHashMap<>();
|
||||||
params.put("userId", SecurityUser.getUserId().toString());
|
String userId = SecurityUser.getUserId().toString();
|
||||||
|
params.put("userId", userId);
|
||||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
|
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
|
||||||
.orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
|
.orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
|
||||||
processDefinitionQuery.latestVersion();
|
processDefinitionQuery.latestVersion();
|
||||||
|
@ -175,7 +184,28 @@ public class ActTaskController {
|
||||||
taskQuery.processDefinitionKey(index.getKey()); // 流程模型key
|
taskQuery.processDefinitionKey(index.getKey()); // 流程模型key
|
||||||
taskQuery.taskAssignee(SecurityUser.getUserId().toString());
|
taskQuery.taskAssignee(SecurityUser.getUserId().toString());
|
||||||
taskQuery.active();
|
taskQuery.active();
|
||||||
result.put(index.getKey(), taskQuery.count());
|
if (auditteam) { // 允许流程审核协作时
|
||||||
|
List<SysAuditTeamDTO> sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(userId);
|
||||||
|
List<String> 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));
|
result.put("meetingroom_book", jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Long.class));
|
||||||
return new Result<Map<String, Long>>().ok(result);
|
return new Result<Map<String, Long>>().ok(result);
|
||||||
|
@ -252,7 +282,7 @@ public class ActTaskController {
|
||||||
return new Result().error(ErrorCode.PARAMS_GET_ERROR);
|
return new Result().error(ErrorCode.PARAMS_GET_ERROR);
|
||||||
}
|
}
|
||||||
actTaskService.completeTask(taskId, comment);
|
actTaskService.completeTask(taskId, comment);
|
||||||
return new Result();
|
return new Result().ok("审核通过");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +620,6 @@ public class ActTaskController {
|
||||||
CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw);
|
CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw);
|
||||||
all.join();
|
all.join();
|
||||||
return new Result().ok(arrayList);
|
return new Result().ok(arrayList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getZwyVideoInfoById")
|
@GetMapping("/getZwyVideoInfoById")
|
||||||
|
@ -624,9 +653,7 @@ public class ActTaskController {
|
||||||
public Result batchBackToFirst(@RequestBody BatchCompleteDTO batchCompleteDTO) {
|
public Result batchBackToFirst(@RequestBody BatchCompleteDTO batchCompleteDTO) {
|
||||||
batchCompleteDTO.getTaskIds().stream()
|
batchCompleteDTO.getTaskIds().stream()
|
||||||
.filter(index -> org.apache.commons.lang3.StringUtils.isNotEmpty(index))
|
.filter(index -> org.apache.commons.lang3.StringUtils.isNotEmpty(index))
|
||||||
.forEach(taskId -> {
|
.forEach(taskId -> actTaskService.backToFirst(taskId, batchCompleteDTO.getComment()));
|
||||||
actTaskService.backToFirst(taskId, batchCompleteDTO.getComment());
|
|
||||||
});
|
|
||||||
return new Result().ok("批量驳回成功");
|
return new Result().ok("批量驳回成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ public class TaskDTO {
|
||||||
private String provideDept;
|
private String provideDept;
|
||||||
@ApiModelProperty(value = "是否为审核组内协助任务")
|
@ApiModelProperty(value = "是否为审核组内协助任务")
|
||||||
private Boolean synergism;
|
private Boolean synergism;
|
||||||
|
@ApiModelProperty(value = "审核组名称")
|
||||||
|
private String auditTeamName;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class ActHistoryService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("不存在正在进行流程节点");
|
logger.info("不存在正在进行流程节点:" + index.getProcessInstanceId());
|
||||||
index.setAllowReminders(Boolean.FALSE);
|
index.setAllowReminders(Boolean.FALSE);
|
||||||
index.setDoneReminders(Boolean.FALSE);
|
index.setDoneReminders(Boolean.FALSE);
|
||||||
index.setNextRemindersDays(0);
|
index.setNextRemindersDays(0);
|
||||||
|
|
|
@ -11,6 +11,8 @@ import io.renren.common.page.PageData;
|
||||||
import io.renren.common.service.impl.BaseServiceImpl;
|
import io.renren.common.service.impl.BaseServiceImpl;
|
||||||
import io.renren.common.utils.MessageUtils;
|
import io.renren.common.utils.MessageUtils;
|
||||||
import io.renren.modules.activiti.dto.TaskDTO;
|
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.dto.TDemandDataDTO;
|
||||||
import io.renren.modules.demanData.service.TDemandDataService;
|
import io.renren.modules.demanData.service.TDemandDataService;
|
||||||
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
|
||||||
|
@ -60,6 +62,7 @@ import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
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 Integer CPUNUM = Runtime.getRuntime().availableProcessors();
|
||||||
private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2);
|
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 = "handleState"; //任务节点处理状态key
|
||||||
public static String Task_HANDLE_STATE_AGREE = "agree"; //同意
|
public static String Task_HANDLE_STATE_AGREE = "agree"; //同意
|
||||||
public static String Task_HANDLE_STATE_REJECTED = "rejected"; //驳回
|
public static String Task_HANDLE_STATE_REJECTED = "rejected"; //驳回
|
||||||
|
@ -123,6 +128,11 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
private SysNoticeService sysNoticeService;
|
private SysNoticeService sysNoticeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageData<TaskDTO> page(Map<String, Object> params) {
|
public PageData<TaskDTO> page(Map<String, Object> params) {
|
||||||
// TODO 同一审核组内成员
|
|
||||||
List<String> groupUserId = new ArrayList<String>() {{ // 测试
|
|
||||||
|
|
||||||
}};
|
|
||||||
String userId = (String) params.get("userId");
|
String userId = (String) params.get("userId");
|
||||||
|
// 同一审核组内成员
|
||||||
|
List<String> groupUserId = new ArrayList<>();
|
||||||
|
List<SysAuditTeamDTO> 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 curPage = 1;
|
||||||
Integer limit = 10;
|
Integer limit = 10;
|
||||||
if (params.get(Constant.PAGE) != null) {
|
if (params.get(Constant.PAGE) != null) {
|
||||||
|
@ -158,9 +180,11 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
if (StringUtils.isNotEmpty(userId)) {
|
if (StringUtils.isNotEmpty(userId)) {
|
||||||
where.append("AND ( RES.ASSIGNEE_ = #{userId} ");
|
where.append("AND ( RES.ASSIGNEE_ = #{userId} ");
|
||||||
// 处理同一工作组内
|
// 处理同一工作组内
|
||||||
groupUserId.stream().forEach(index -> {
|
if (auditteam) { // 进行审核组协作时
|
||||||
where.append(String.format(" OR RES.ASSIGNEE_ = '%s' ", index));
|
groupUserId.stream().forEach(index -> {
|
||||||
});
|
where.append(String.format(" OR RES.ASSIGNEE_ = '%s' ", index));
|
||||||
|
});
|
||||||
|
}
|
||||||
where.append(")");
|
where.append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +217,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
List<CompletableFuture> completableFutures = new ArrayList<CompletableFuture>();
|
List<CompletableFuture> completableFutures = new ArrayList<CompletableFuture>();
|
||||||
final TaskQuery taskQuery = taskService.createTaskQuery();
|
final TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
List<Task> list_ = tasks.stream().map(index -> {
|
List<Task> 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;
|
Task temp = null;
|
||||||
try {
|
try {
|
||||||
temp = (Task) tempTask.get();
|
temp = (Task) tempTask.get();
|
||||||
|
@ -205,7 +229,8 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
return temp;
|
return temp;
|
||||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
|
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();
|
// TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
// if (StringUtils.isNotEmpty(userId)) {
|
// if (StringUtils.isNotEmpty(userId)) {
|
||||||
|
@ -266,7 +291,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
.listPage((finalCurPage - 1) * finalLimit, finalCurPage * finalLimit);
|
.listPage((finalCurPage - 1) * finalLimit, finalCurPage * finalLimit);
|
||||||
count.add(taskQuery.taskAssignee(index.getId().toString())
|
count.add(taskQuery.taskAssignee(index.getId().toString())
|
||||||
.orderByTaskCreateTime().desc().count());
|
.orderByTaskCreateTime().desc().count());
|
||||||
taskDtoList.addAll(tasks2TaskDtos(list));
|
taskDtoList.addAll(tasks2TaskDtos(list, ""));
|
||||||
});
|
});
|
||||||
return completableFuture;
|
return completableFuture;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -287,11 +312,13 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TaskDTO> tasks2TaskDtos(List<Task> list) {
|
private List<TaskDTO> tasks2TaskDtos(List<Task> list, String audioTeamName) {
|
||||||
List<TaskDTO> listDto = new ArrayList<>();
|
List<TaskDTO> listDto = new ArrayList<>();
|
||||||
for (Task task : list) {
|
for (Task task : list) {
|
||||||
TaskDTO dto = new TaskDTO();
|
TaskDTO dto = new TaskDTO();
|
||||||
this.convertTaskInfo(task, dto);
|
this.convertTaskInfo(task, dto);
|
||||||
|
// 填入审核协作组名称
|
||||||
|
dto.setAuditTeamName(audioTeamName);
|
||||||
Map<String, Object> processVariable = new LinkedHashMap<>();
|
Map<String, Object> processVariable = new LinkedHashMap<>();
|
||||||
|
|
||||||
if (task.getProcessVariables().containsKey("tAbilityApplicationDTOList")) {
|
if (task.getProcessVariables().containsKey("tAbilityApplicationDTOList")) {
|
||||||
|
@ -497,8 +524,10 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
public void completeTask(String taskId, String comment) {
|
public void completeTask(String taskId, String comment) {
|
||||||
String userId = SecurityUser.getUserId().toString();
|
String userId = SecurityUser.getUserId().toString();
|
||||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||||
if (StringUtils.isNotEmpty(task.getAssignee())) {
|
if (StringUtils.isNotEmpty(task.getAssignee())
|
||||||
taskService.setAssignee(taskId, userId);
|
&& !task.getAssignee().equals(userId)) {
|
||||||
|
taskService.setVariable(taskId, "autoApply", taskId); // 配置不发送审核人分配通知
|
||||||
|
taskService.setAssignee(taskId, userId); //与原任务审核人员不一致时,换成实际通过的人
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(comment)) {
|
if (StringUtils.isNotEmpty(comment)) {
|
||||||
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
||||||
|
|
|
@ -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<PageData<SysAuditTeamDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
|
PageData<SysAuditTeamDTO> page = sysAuditTeamService.page(params);
|
||||||
|
|
||||||
|
return new Result<PageData<SysAuditTeamDTO>>().ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@ApiOperation("信息")
|
||||||
|
// @RequiresPermissions("audit_team:sysauditteam:info")
|
||||||
|
public Result<SysAuditTeamDTO> get(@PathVariable("id") Long id) {
|
||||||
|
SysAuditTeamDTO data = sysAuditTeamService.get(id);
|
||||||
|
|
||||||
|
return new Result<SysAuditTeamDTO>().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> 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().ok("保存成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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> 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().ok("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@LogOperation("删除")
|
||||||
|
// @RequiresPermissions("audit_team:sysauditteam:delete")
|
||||||
|
public Result delete(@RequestBody Long[] ids) {
|
||||||
|
//效验数据
|
||||||
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
|
||||||
|
sysAuditTeamService.delete(ids);
|
||||||
|
|
||||||
|
return new Result().ok("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("export")
|
||||||
|
@ApiOperation("导出")
|
||||||
|
@LogOperation("导出")
|
||||||
|
// @RequiresPermissions("audit_team:sysauditteam:export")
|
||||||
|
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||||
|
List<SysAuditTeamDTO> list = sysAuditTeamService.list(params);
|
||||||
|
|
||||||
|
ExcelUtils.exportExcelToTarget(response, null, "流程审核组组员", list, SysAuditTeamExcel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<SysAuditTeamEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据审核组成员用户id,获取审核组列表
|
||||||
|
*
|
||||||
|
* @param member
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysAuditTeamDTO> selectByMemberOne(@Param("member") String member);
|
||||||
|
}
|
|
@ -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<Map> member;
|
||||||
|
@ApiModelProperty(value = "审核组索引")
|
||||||
|
private String index;
|
||||||
|
|
||||||
|
}
|
|
@ -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<Map> member;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核组索引
|
||||||
|
*/
|
||||||
|
@TableField(value = "`index`")
|
||||||
|
private String index;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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<SysAuditTeamEntity, SysAuditTeamDTO> {
|
||||||
|
List<SysAuditTeamDTO> selectByMemberOne(String member);
|
||||||
|
}
|
|
@ -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<SysAuditTeamDao, SysAuditTeamEntity, SysAuditTeamDTO> implements SysAuditTeamService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<SysAuditTeamEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
QueryWrapper<SysAuditTeamEntity> wrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysAuditTeamDTO> selectByMemberOne(String member) {
|
||||||
|
return baseDao.selectByMemberOne(member);
|
||||||
|
}
|
||||||
|
}
|
|
@ -182,4 +182,7 @@ reminders:
|
||||||
# 恩科会议
|
# 恩科会议
|
||||||
enke:
|
enke:
|
||||||
enable: true
|
enable: true
|
||||||
|
# 开启审核组成员支持
|
||||||
|
auditteam:
|
||||||
|
enable: true
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
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`)
|
||||||
|
) comment = '流程审核组组员';
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="io.renren.modules.audit_team.dao.SysAuditTeamDao">
|
||||||
|
|
||||||
|
<resultMap type="io.renren.modules.audit_team.entity.SysAuditTeamEntity" id="sysAuditTeamMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="creator" column="creator"/>
|
||||||
|
<result property="createDate" column="create_date"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="member" column="member"
|
||||||
|
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||||
|
<result property="index" column="`index`"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="sysAuditTeamDTO" type="io.renren.modules.audit_team.dto.SysAuditTeamDTO">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="creator" column="creator"/>
|
||||||
|
<result property="createDate" column="create_date"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="member" column="member"
|
||||||
|
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||||
|
<result property="index" column="`index`"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectByMemberOne" resultMap="sysAuditTeamDTO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
sys_audit_team
|
||||||
|
WHERE
|
||||||
|
JSON_CONTAINS( sys_audit_team.member, JSON_OBJECT( "id", #{member} ));
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue