|
@@ -2,6 +2,7 @@ package com.qunzhixinxi.hnqz.admin.manager;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -36,6 +37,7 @@ import com.qunzhixinxi.hnqz.admin.service.WmTaskService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskSupervisionAdviceService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskSupervisionService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmWarnUserRelationService;
|
|
|
+import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.exception.BizException;
|
|
|
import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
@@ -46,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
@@ -963,9 +966,8 @@ public class WmSupervisionManager {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
List<Long> entIds;
|
|
|
- if (CollUtil.containsAny(SecurityUtils.getRoles(), List.of(37))){
|
|
|
+ if (CollUtil.containsAny(SecurityUtils.getRoles(), List.of(37))) {
|
|
|
entIds = Collections.singletonList(Long.valueOf(operator.getDeptId()));
|
|
|
} else {
|
|
|
// 筛查区域内所有企业
|
|
@@ -1026,6 +1028,11 @@ public class WmSupervisionManager {
|
|
|
}
|
|
|
// 服务商
|
|
|
else if (CollUtil.containsAny(roles, List.of(37))) {
|
|
|
+
|
|
|
+ supTotal = CollUtil.isNotEmpty(supervisions)
|
|
|
+ ? supervisions.stream().filter(ts -> UpmsState.TaskSupervisionState.PASSED.equals(ts.getSupervisionState()))
|
|
|
+ .map(WmTaskSupervision::getTaskId).collect(Collectors.toSet()).size() : 0;
|
|
|
+
|
|
|
// 获取监察结果
|
|
|
total1 = supTotal;
|
|
|
supTotal1 = supTotal;
|
|
@@ -1033,34 +1040,45 @@ public class WmSupervisionManager {
|
|
|
// 其他角色
|
|
|
else {
|
|
|
|
|
|
- Map<UpmsState.TaskSupervisionState, Set<Integer>> collect1 = supervisions.stream()
|
|
|
- .collect(Collectors.groupingBy(WmTaskSupervision::getSupervisionState, Collectors.mapping(WmTaskSupervision::getTaskId, Collectors.toSet())));
|
|
|
+ // 所有监察的
|
|
|
+ List<Long> supId = supervisions.stream().map(WmTaskSupervision::getSupervisionId).collect(Collectors.toList());
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(supId)) {
|
|
|
|
|
|
- Set<Integer> init = collect1.getOrDefault(UpmsState.TaskSupervisionState.INIT, Collections.emptySet());
|
|
|
- Set<Integer> ckt1 = collect1.getOrDefault(UpmsState.TaskSupervisionState.CKT1, Collections.emptySet());
|
|
|
- Set<Integer> ckt2 = collect1.getOrDefault(UpmsState.TaskSupervisionState.CKT2, Collections.emptySet());
|
|
|
- Set<Integer> passed = collect1.getOrDefault(UpmsState.TaskSupervisionState.PASSED, Collections.emptySet());
|
|
|
- // Set<Integer> rejected = collect1.getOrDefault(UpmsState.TaskSupervisionState.REJECTED, Collections.emptySet());
|
|
|
|
|
|
- // 负责人
|
|
|
- if (CollUtil.containsAny(roles, List.of(57, 58, 59, 60))) {
|
|
|
+ // 我监察过的(有重复的的)
|
|
|
+ Set<Long> advices = taskSupervisionAdviceService.list(Wrappers.<WmTaskSupervisionAdvice>lambdaQuery()
|
|
|
+ .in(WmTaskSupervisionAdvice::getTaskSupervisionId, supId)
|
|
|
+ .eq(WmTaskSupervisionAdvice::getCreateBy, operator.getUsername())).stream().map(WmTaskSupervisionAdvice::getTaskSupervisionId).collect(Collectors.toSet());
|
|
|
|
|
|
- supTotal1 = ckt1.size();
|
|
|
- total1 = init.size() + supTotal1;
|
|
|
- }
|
|
|
- // 分管领导
|
|
|
- else if (CollUtil.containsAny(roles, List.of(51, 54, 55, 61))) {
|
|
|
+ Map<UpmsState.TaskSupervisionState, Set<Integer>> collect1 = supervisions.stream()
|
|
|
+ .collect(Collectors.groupingBy(WmTaskSupervision::getSupervisionState, Collectors.mapping(WmTaskSupervision::getTaskId, Collectors.toSet())));
|
|
|
|
|
|
- supTotal1 = ckt2.size();
|
|
|
- total1 = ckt1.size() + supTotal1;
|
|
|
- }
|
|
|
- // 事业部总经理
|
|
|
- else if (CollUtil.containsAny(roles, List.of(39))) {
|
|
|
- supTotal1 = passed.size();
|
|
|
- total1 = ckt2.size() + supTotal1;
|
|
|
- }
|
|
|
|
|
|
+ Set<Integer> init = collect1.getOrDefault(UpmsState.TaskSupervisionState.INIT, Collections.emptySet());
|
|
|
+ Set<Integer> ckt1 = collect1.getOrDefault(UpmsState.TaskSupervisionState.CKT1, Collections.emptySet());
|
|
|
+ Set<Integer> ckt2 = collect1.getOrDefault(UpmsState.TaskSupervisionState.CKT2, Collections.emptySet());
|
|
|
+ Set<Integer> passed = collect1.getOrDefault(UpmsState.TaskSupervisionState.PASSED, Collections.emptySet());
|
|
|
+ // Set<Integer> rejected = collect1.getOrDefault(UpmsState.TaskSupervisionState.REJECTED, Collections.emptySet());
|
|
|
+
|
|
|
+ // 负责人
|
|
|
+ if (CollUtil.containsAny(roles, List.of(57, 58, 59, 60))) {
|
|
|
+
|
|
|
+ supTotal1 = advices.size();
|
|
|
+ total1 = init.size() + supTotal1;
|
|
|
+ }
|
|
|
+ // 分管领导
|
|
|
+ else if (CollUtil.containsAny(roles, List.of(51, 54, 55, 61))) {
|
|
|
+
|
|
|
+ supTotal1 = advices.size();
|
|
|
+ total1 = ckt1.size() + supTotal1;
|
|
|
+ }
|
|
|
+ // 事业部总经理
|
|
|
+ else if (CollUtil.containsAny(roles, List.of(39))) {
|
|
|
+ supTotal1 = advices.size();
|
|
|
+ total1 = ckt2.size() + supTotal1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1104,7 +1122,9 @@ public class WmSupervisionManager {
|
|
|
Boolean review = query.getReview();
|
|
|
HnqzUser user = SecurityUtils.getUser();
|
|
|
Page<WmTask> taskPage;
|
|
|
+ boolean isService;
|
|
|
if (CollUtil.containsAny(roles, List.of(49, 52, 53, 56))) {
|
|
|
+ isService = false;
|
|
|
|
|
|
if (review) {
|
|
|
List<String> taskIds = list.stream().filter(ts -> StrUtil.equals(ts.getCreateBy(), user.getUsername())).map(ts -> ts.getTaskId().toString()).distinct().collect(Collectors.toList());
|
|
@@ -1121,6 +1141,8 @@ public class WmSupervisionManager {
|
|
|
// 服务商
|
|
|
else if (CollUtil.containsAny(roles, List.of(37))) {
|
|
|
|
|
|
+ isService = true;
|
|
|
+
|
|
|
// 获取当前积分包已经监督过的任务ID
|
|
|
List<WmTaskSupervision> collect = list.stream().filter(ts -> UpmsState.TaskSupervisionState.PASSED.equals(ts.getSupervisionState())).collect(Collectors.toList());
|
|
|
|
|
@@ -1135,6 +1157,7 @@ public class WmSupervisionManager {
|
|
|
}
|
|
|
// 负责人|分管领导|事业部总经理
|
|
|
else {
|
|
|
+ isService = false;
|
|
|
|
|
|
if (review) {
|
|
|
// 获取当前积分包已经监督过的任务ID
|
|
@@ -1211,6 +1234,18 @@ public class WmSupervisionManager {
|
|
|
// 封装监察信息
|
|
|
Map<Integer, WmTaskSupervision> taskId2TaskSupervisionMap = list.stream().collect(Collectors.toMap(WmTaskSupervision::getTaskId, Function.identity()));
|
|
|
|
|
|
+
|
|
|
+ List<SysUser> users = userService.list(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getDelFlag, CommonConstants.STATUS_NORMAL).eq(SysUser::getLockFlag, CommonConstants.STATUS_NORMAL));
|
|
|
+ // List<SysUser> users = userService.list();
|
|
|
+ Map<String, SysUser> userMap = users.stream().collect(Collectors.toMap(SysUser::getUsername, Function.identity(), (v1, v2) -> v2));
|
|
|
+ Set<Integer> userIds = users.stream().mapToInt(SysUser::getUserId).boxed().collect(Collectors.toSet());
|
|
|
+ List<SysUserRole> userRoles = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().in(SysUserRole::getUserId, userIds));
|
|
|
+ Map<Integer, List<SysUserRole>> userRoleMap = userRoles.stream().collect(Collectors.groupingBy(SysUserRole::getUserId));
|
|
|
+ Set<Integer> roleId = userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
+ Map<Integer, String> roleMap = roleService.listByIds(roleId).stream().collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName));
|
|
|
+
|
|
|
+
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN);
|
|
|
maps.forEach(m -> {
|
|
|
Integer tId = Integer.valueOf(m.get("id").toString());
|
|
|
WmTaskSupervision wmTaskSupervision = taskId2TaskSupervisionMap.get(tId);
|
|
@@ -1225,7 +1260,28 @@ public class WmSupervisionManager {
|
|
|
|
|
|
m.put("supervisionMessage", supervisionMsg);
|
|
|
|
|
|
- m.put("adviceMessages", Collections.emptyList());
|
|
|
+ List<String> advMsg;
|
|
|
+ if (isService) {
|
|
|
+ advMsg = Collections.emptyList();
|
|
|
+ } else {
|
|
|
+ List<WmTaskSupervisionAdvice> advices = taskSupervisionAdviceService.list(Wrappers.<WmTaskSupervisionAdvice>lambdaQuery().eq(WmTaskSupervisionAdvice::getTaskSupervisionId, wmTaskSupervision.getSupervisionId()));
|
|
|
+ advMsg = advices.stream().map(adv -> {
|
|
|
+ SysUser u = userMap.get(adv.getCreateBy());
|
|
|
+ SysUserRole sysUserRole = userRoleMap.get(u.getUserId()).get(0);
|
|
|
+ String roleName = roleMap.get(sysUserRole.getRoleId());
|
|
|
+ String realName = u.getRealname();
|
|
|
+ String date = formatter.format(adv.getCreateTime());
|
|
|
+ String resultMsg = adv.getAdviceResult() ? " 通过 " : " 不通过 ";
|
|
|
+ String remarks = StrUtil.isBlank(adv.getRemarks()) ? " " : adv.getRemarks();
|
|
|
+
|
|
|
+ return String.format("%s【%s】,审核【%s】,监督意见为【%s】(%s)。", roleName, realName, resultMsg, remarks, date);
|
|
|
+
|
|
|
+
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ m.put("adviceMessages", advMsg);
|
|
|
});
|
|
|
|
|
|
|
|
@@ -1234,271 +1290,6 @@ public class WmSupervisionManager {
|
|
|
|
|
|
return page;
|
|
|
|
|
|
-
|
|
|
- // String username = SecurityUtils.getUser().getUsername();
|
|
|
- // List<Integer> roles = SecurityUtils.getRoles();
|
|
|
- //
|
|
|
- // // 监督员
|
|
|
- // if (CollUtil.containsAny(roles, List.of(49, 52, 53, 56))) {
|
|
|
- // List<WmTaskSupervision> list = taskSupervisionService.list(Wrappers.<WmTaskSupervision>lambdaQuery()
|
|
|
- // .eq(WmTaskSupervision::getPackageId, pkgId)
|
|
|
- // .orderByDesc(WmTaskSupervision::getCreateTime)
|
|
|
- // );
|
|
|
- //
|
|
|
- //
|
|
|
- // // 复查
|
|
|
- // List<WmTask> wmTasks;
|
|
|
- // if (review) {
|
|
|
- // // 获取当前积分包已经监督过的任务ID
|
|
|
- // Set<Integer> supTaskIds = list.stream().filter(ts -> StrUtil.equals(username, ts.getCreateBy())).mapToInt(WmTaskSupervision::getTaskId).boxed().collect(Collectors.toSet());
|
|
|
- // wmTasks = CollUtil.isEmpty(supTaskIds) ? Collections.emptyList() : taskService.listByIds(supTaskIds);
|
|
|
- // } else {
|
|
|
- // // 获取当前积分包已经监督过的任务ID
|
|
|
- // Set<Integer> supTaskIds = list.stream().mapToInt(WmTaskSupervision::getTaskId).boxed().collect(Collectors.toSet());
|
|
|
- // wmTasks = taskService.listAvailableTaskForSupervision(pkgId, supTaskIds);
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // List<Map<String, Object>> maps = CollUtil.isEmpty(wmTasks) ? Collections.emptyList() : taskService.listTaskInfo(wmTasks, pkgId.toString());
|
|
|
- //
|
|
|
- // Set<String> createdBy = list.stream().map(WmTaskSupervision::getCreateBy).collect(Collectors.toSet());
|
|
|
- // Map<String, SysUser> userMap;
|
|
|
- // Map<Integer, List<SysUserRole>> userRoleMap;
|
|
|
- // Map<Integer, String> roleMap;
|
|
|
- // if (CollUtil.isNotEmpty(createdBy)) {
|
|
|
- // List<SysUser> users = userService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUsername, createdBy));
|
|
|
- // userMap = users.stream().collect(Collectors.toMap(SysUser::getUsername, Function.identity()));
|
|
|
- // Set<Integer> userIds = users.stream().mapToInt(SysUser::getUserId).boxed().collect(Collectors.toSet());
|
|
|
- // List<SysUserRole> userRoles = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().in(SysUserRole::getUserId, userIds));
|
|
|
- // userRoleMap = userRoles.stream().collect(Collectors.groupingBy(SysUserRole::getUserId));
|
|
|
- // Set<Integer> roleId = userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
- // roleMap = roleService.listByIds(roleId).stream().collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName));
|
|
|
- // } else {
|
|
|
- // userMap = Collections.emptyMap();
|
|
|
- // userRoleMap = Collections.emptyMap();
|
|
|
- // roleMap = Collections.emptyMap();
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // Map<Integer, List<WmTaskSupervision>> collect = list.stream().collect(Collectors.groupingBy(WmTaskSupervision::getTaskId));
|
|
|
- // maps.forEach(m -> {
|
|
|
- //
|
|
|
- // Integer id = Integer.valueOf(m.get("id").toString());
|
|
|
- //
|
|
|
- // List<WmTaskSupervision> wmTaskSupervisions = collect.get(id);
|
|
|
- // m.put("supervision", wmTaskSupervisions);
|
|
|
- //
|
|
|
- // List<String> msgs = new ArrayList<>(4);
|
|
|
- // if (CollUtil.isNotEmpty(wmTaskSupervisions)) {
|
|
|
- //
|
|
|
- // msgs = wmTaskSupervisions.stream().sorted(Comparator.comparingInt(WmTaskSupervision::getTaskId).reversed())
|
|
|
- // .map(ts -> {
|
|
|
- // SysUser user = userMap.get(ts.getCreateBy());
|
|
|
- // SysUserRole sysUserRole = userRoleMap.get(user.getUserId()).get(0);
|
|
|
- // String roleName = roleMap.get(sysUserRole.getRoleId());
|
|
|
- // String realName = user.getRealname();
|
|
|
- // String date = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN).format(ts.getCreateTime());
|
|
|
- // String resultMsg = ts.getSupervisionResult() ? " 通过 " : " 不通过 ";
|
|
|
- // String remarks = StrUtil.isBlank(ts.getRemarks()) ? " " : ts.getRemarks();
|
|
|
- //
|
|
|
- // return String.format("%s【%s】,审核【%s】,监督意见为【%s】(%s)。", roleName, realName, resultMsg, remarks, date);
|
|
|
- //
|
|
|
- // }).collect(Collectors.toList());
|
|
|
- //
|
|
|
- //
|
|
|
- // }
|
|
|
- // m.put("supervisionMessages", msgs);
|
|
|
- // m.put("review", review);
|
|
|
- //
|
|
|
- // });
|
|
|
- //
|
|
|
- // return maps;
|
|
|
- // }
|
|
|
- // // 服务商
|
|
|
- // else if (CollUtil.containsAny(roles, List.of(37))) {
|
|
|
- // // 获取当前积分包已经监督过的任务ID
|
|
|
- // List<WmTaskSupervision> list = taskSupervisionService.list(Wrappers.<WmTaskSupervision>lambdaQuery()
|
|
|
- // // .eq(WmTaskSupervision::getSupervisionState, UpmsState.TaskSupervisionState.PASSED)
|
|
|
- // .eq(WmTaskSupervision::getPackageId, pkgId).orderByDesc(WmTaskSupervision::getCreateTime));
|
|
|
- //
|
|
|
- // if (CollUtil.isEmpty(list)) {
|
|
|
- // return Collections.emptyList();
|
|
|
- // }
|
|
|
- //
|
|
|
- // Set<Integer> supTaskIds = list.stream().filter(ts -> UpmsState.TaskSupervisionState.PASSED.equals(ts.getSupervisionState())).mapToInt(WmTaskSupervision::getTaskId).boxed().collect(Collectors.toSet());
|
|
|
- //
|
|
|
- // if (CollUtil.isEmpty(supTaskIds)) {
|
|
|
- // return Collections.emptyList();
|
|
|
- // }
|
|
|
- //
|
|
|
- // List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getId, supTaskIds));
|
|
|
- // List<Map<String, Object>> maps = taskService.listTaskInfo(tasks, pkgId.toString());
|
|
|
- //
|
|
|
- // Set<String> createdBy = list.stream().map(WmTaskSupervision::getCreateBy).collect(Collectors.toSet());
|
|
|
- // Map<String, SysUser> userMap;
|
|
|
- // Map<Integer, List<SysUserRole>> userRoleMap;
|
|
|
- // Map<Integer, String> roleMap;
|
|
|
- // if (CollUtil.isNotEmpty(createdBy)) {
|
|
|
- // List<SysUser> users = userService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUsername, createdBy));
|
|
|
- // userMap = users.stream().collect(Collectors.toMap(SysUser::getUsername, Function.identity()));
|
|
|
- // Set<Integer> userIds = users.stream().mapToInt(SysUser::getUserId).boxed().collect(Collectors.toSet());
|
|
|
- // List<SysUserRole> userRoles = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().in(SysUserRole::getUserId, userIds));
|
|
|
- // userRoleMap = userRoles.stream().collect(Collectors.groupingBy(SysUserRole::getUserId));
|
|
|
- // Set<Integer> roleId = userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
- // roleMap = roleService.listByIds(roleId).stream().collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName));
|
|
|
- // } else {
|
|
|
- // userMap = Collections.emptyMap();
|
|
|
- // userRoleMap = Collections.emptyMap();
|
|
|
- // roleMap = Collections.emptyMap();
|
|
|
- // }
|
|
|
- //
|
|
|
- // Map<Integer, List<WmTaskSupervision>> collect = list.stream().collect(Collectors.groupingBy(WmTaskSupervision::getTaskId));
|
|
|
- // maps.forEach(m -> {
|
|
|
- //
|
|
|
- // Integer id = Integer.valueOf(m.get("id").toString());
|
|
|
- //
|
|
|
- // List<WmTaskSupervision> wmTaskSupervisions = collect.get(id);
|
|
|
- // m.put("supervision", wmTaskSupervisions);
|
|
|
- //
|
|
|
- // List<String> msgs = new ArrayList<>(4);
|
|
|
- // if (CollUtil.isNotEmpty(wmTaskSupervisions)) {
|
|
|
- //
|
|
|
- // msgs = wmTaskSupervisions.stream().sorted(Comparator.comparingInt(WmTaskSupervision::getTaskId).reversed())
|
|
|
- // .map(ts -> {
|
|
|
- // SysUser user = userMap.get(ts.getCreateBy());
|
|
|
- // SysUserRole sysUserRole = userRoleMap.get(user.getUserId()).get(0);
|
|
|
- // String roleName = roleMap.get(sysUserRole.getRoleId());
|
|
|
- // String realName = user.getRealname();
|
|
|
- // String date = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN).format(ts.getCreateTime());
|
|
|
- // String resultMsg = ts.getSupervisionResult() ? " 通过 " : " 不通过 ";
|
|
|
- // String remarks = StrUtil.isBlank(ts.getRemarks()) ? " " : ts.getRemarks();
|
|
|
- //
|
|
|
- // return String.format("%s【%s】,审核【%s】,监督意见为【%s】(%s)。", roleName, realName, resultMsg, remarks, date);
|
|
|
- //
|
|
|
- // }).collect(Collectors.toList());
|
|
|
- //
|
|
|
- //
|
|
|
- // }
|
|
|
- // m.put("supervisionMessages", msgs);
|
|
|
- // m.put("review", review);
|
|
|
- //
|
|
|
- // });
|
|
|
- //
|
|
|
- // return maps;
|
|
|
- // }
|
|
|
- // // 负责人|分管领导|事业部总经理
|
|
|
- // else {
|
|
|
- //
|
|
|
- //
|
|
|
- // // 获取当前积分包已经监督过的任务ID
|
|
|
- // List<WmTaskSupervision> list = taskSupervisionService.list(Wrappers.<WmTaskSupervision>lambdaQuery()
|
|
|
- // .eq(WmTaskSupervision::getPackageId, pkgId)
|
|
|
- // .orderByDesc(WmTaskSupervision::getCreateTime));
|
|
|
- //
|
|
|
- //
|
|
|
- // List<WmTask> wmTasks;
|
|
|
- // if (review) {
|
|
|
- // // 获取当前积分包已经监督过的任务ID
|
|
|
- // Set<Integer> supTaskIds = list.stream().filter(ts -> StrUtil.equals(username, ts.getCreateBy())).mapToInt(WmTaskSupervision::getTaskId).boxed().collect(Collectors.toSet());
|
|
|
- // wmTasks = CollUtil.isEmpty(supTaskIds) ? Collections.emptyList() : taskService.listByIds(supTaskIds);
|
|
|
- // } else {
|
|
|
- // Map<UpmsState.TaskSupervisionState, Set<Integer>> collect1 = list.stream()
|
|
|
- // .collect(Collectors.groupingBy(WmTaskSupervision::getSupervisionState, Collectors.mapping(WmTaskSupervision::getTaskId, Collectors.toSet())));
|
|
|
- //
|
|
|
- //
|
|
|
- // Set<Integer> init = collect1.get(UpmsState.TaskSupervisionState.INIT);
|
|
|
- // Set<Integer> ckt1 = collect1.get(UpmsState.TaskSupervisionState.CKT1);
|
|
|
- // Set<Integer> ckt2 = collect1.get(UpmsState.TaskSupervisionState.CKT2);
|
|
|
- // Set<Integer> passed = collect1.get(UpmsState.TaskSupervisionState.PASSED);
|
|
|
- // Set<Integer> rejected = collect1.get(UpmsState.TaskSupervisionState.REJECTED);
|
|
|
- //
|
|
|
- // // 负责人
|
|
|
- // List<Integer> supTaskIds;
|
|
|
- // if (CollUtil.containsAny(roles, List.of(57, 58, 59, 60))) {
|
|
|
- //
|
|
|
- // Set<Integer> temp = CollUtil.unionDistinct(ckt1, rejected);
|
|
|
- // supTaskIds = CollUtil.subtractToList(init, temp);
|
|
|
- //
|
|
|
- // }
|
|
|
- // // 分管领导
|
|
|
- // else if (CollUtil.containsAny(roles, List.of(51, 54, 55, 61))) {
|
|
|
- // Set<Integer> temp = CollUtil.unionDistinct(ckt2, rejected);
|
|
|
- // supTaskIds = CollUtil.subtractToList(ckt1, temp);
|
|
|
- //
|
|
|
- // }
|
|
|
- // // 事业部总经理
|
|
|
- // else if (CollUtil.containsAny(roles, List.of(39))) {
|
|
|
- // Set<Integer> temp = CollUtil.unionDistinct(passed, rejected);
|
|
|
- // supTaskIds = CollUtil.subtractToList(ckt2, temp);
|
|
|
- // } else {
|
|
|
- // throw new BizException("无监督权限");
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // if (CollUtil.isEmpty(supTaskIds)) {
|
|
|
- // return Collections.emptyList();
|
|
|
- // }
|
|
|
- //
|
|
|
- // wmTasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getId, supTaskIds));
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // List<Map<String, Object>> maps = taskService.listTaskInfo(wmTasks, pkgId.toString());
|
|
|
- //
|
|
|
- // Map<Integer, List<WmTaskSupervision>> collect = list.stream().collect(Collectors.groupingBy(WmTaskSupervision::getTaskId));
|
|
|
- //
|
|
|
- // Set<String> createdBy = list.stream().map(WmTaskSupervision::getCreateBy).collect(Collectors.toSet());
|
|
|
- // Map<String, SysUser> userMap;
|
|
|
- // Map<Integer, List<SysUserRole>> userRoleMap;
|
|
|
- // Map<Integer, String> roleMap;
|
|
|
- // if (CollUtil.isNotEmpty(createdBy)) {
|
|
|
- // List<SysUser> users = userService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUsername, createdBy));
|
|
|
- // userMap = users.stream().collect(Collectors.toMap(SysUser::getUsername, Function.identity()));
|
|
|
- // Set<Integer> userIds = users.stream().mapToInt(SysUser::getUserId).boxed().collect(Collectors.toSet());
|
|
|
- // List<SysUserRole> userRoles = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().in(SysUserRole::getUserId, userIds));
|
|
|
- // userRoleMap = userRoles.stream().collect(Collectors.groupingBy(SysUserRole::getUserId));
|
|
|
- // Set<Integer> roleId = userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
- // roleMap = roleService.listByIds(roleId).stream().collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName));
|
|
|
- // } else {
|
|
|
- // userMap = Collections.emptyMap();
|
|
|
- // userRoleMap = Collections.emptyMap();
|
|
|
- // roleMap = Collections.emptyMap();
|
|
|
- // }
|
|
|
- //
|
|
|
- // maps.forEach(m -> {
|
|
|
- //
|
|
|
- // Integer id = Integer.valueOf(m.get("id").toString());
|
|
|
- //
|
|
|
- // List<WmTaskSupervision> wmTaskSupervisions = collect.get(id);
|
|
|
- // m.put("supervision", wmTaskSupervisions);
|
|
|
- //
|
|
|
- // List<String> msgs = new ArrayList<>(4);
|
|
|
- // if (CollUtil.isNotEmpty(wmTaskSupervisions)) {
|
|
|
- //
|
|
|
- // msgs = wmTaskSupervisions.stream().sorted(Comparator.comparingInt(WmTaskSupervision::getTaskId).reversed())
|
|
|
- // .map(ts -> {
|
|
|
- // SysUser user = userMap.get(ts.getCreateBy());
|
|
|
- // SysUserRole sysUserRole = userRoleMap.get(user.getUserId()).get(0);
|
|
|
- // String roleName = roleMap.get(sysUserRole.getRoleId());
|
|
|
- // String realName = user.getRealname();
|
|
|
- // String date = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN).format(ts.getCreateTime());
|
|
|
- // String resultMsg = ts.getSupervisionResult() ? " 通过 " : " 不通过 ";
|
|
|
- // String remarks = StrUtil.isBlank(ts.getRemarks()) ? " " : ts.getRemarks();
|
|
|
- //
|
|
|
- // return String.format("%s【%s】,审核【%s】,监督意见为【%s】(%s)。", roleName, realName, resultMsg, remarks, date);
|
|
|
- //
|
|
|
- // }).collect(Collectors.toList());
|
|
|
- //
|
|
|
- //
|
|
|
- // }
|
|
|
- // m.put("supervisionMessages", msgs);
|
|
|
- // m.put("review", review);
|
|
|
- //
|
|
|
- // });
|
|
|
- //
|
|
|
- // return maps;
|
|
|
- // return null;
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
// 执行任务监察
|