|
@@ -788,12 +788,12 @@ public class SysImplementPlanManager {
|
|
|
// 获取父级
|
|
|
Integer parentId = p.getParentId();
|
|
|
|
|
|
- if (parentId == 0){
|
|
|
+ if (parentId == 0) {
|
|
|
copied.setParentPlanAvailScore(0L);
|
|
|
copied.setParentPlanScore(0L);
|
|
|
} else {
|
|
|
SysImplementPlan pp = implementPlanService.getById(p.getParentId());
|
|
|
- if (pp == null){
|
|
|
+ if (pp == null) {
|
|
|
copied.setParentPlanAvailScore(0L);
|
|
|
copied.setParentPlanScore(0L);
|
|
|
} else {
|
|
@@ -803,7 +803,6 @@ public class SysImplementPlanManager {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
return copied;
|
|
|
}
|
|
|
|
|
@@ -1095,6 +1094,9 @@ public class SysImplementPlanManager {
|
|
|
qtr = "";
|
|
|
}
|
|
|
model.setQuarter(qtr);
|
|
|
+ model.setPlanId(item.getId().toString());
|
|
|
+ // model.setCheckResult(toPage.getCheckResult() == null ? "" : toPage.getCheckResult() ? "通过" : "拒绝");
|
|
|
+ // model.setCheckMarks(StrUtil.isNotBlank(toPage.getCheckMessage()) ? toPage.getCheckMessage() : "");
|
|
|
|
|
|
return model;
|
|
|
|
|
@@ -1356,15 +1358,14 @@ public class SysImplementPlanManager {
|
|
|
errorMsg.append("表单中存在重复的详情ID;");
|
|
|
}
|
|
|
|
|
|
- if (!StrUtil.equalsAny(result, "通过", "驳回")) {
|
|
|
- errorMsg.append("审核结果只能是通过/驳回;");
|
|
|
+ if (!StrUtil.equalsAny(result, "通过", "拒绝")) {
|
|
|
+ errorMsg.append("审核结果只能是通过/拒绝;");
|
|
|
}
|
|
|
|
|
|
- if ("驳回".equals(result) && StrUtil.isBlank(msg)) {
|
|
|
- errorMsg.append("驳回信息必填;");
|
|
|
+ if ("拒绝".equals(result) && StrUtil.isBlank(msg)) {
|
|
|
+ errorMsg.append("审核信息必填;");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (StrUtil.isNotBlank(errorMsg)) {
|
|
|
Map<String, String> errorMap = new HashMap<>(2);
|
|
|
String idx = String.valueOf(i + 1);
|
|
@@ -1471,4 +1472,121 @@ public class SysImplementPlanManager {
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public List<Map<String, String>> batchCheckPlansInfo(List<SysImplementPlanDTO.OnBatchCheckInfo> resource, HnqzUser user) {
|
|
|
+
|
|
|
+ // 上锁
|
|
|
+ Set<String> cacheKeySet = resource.stream().map(res -> "lock:plan:info:check:batch:" + res.getPlanId()).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<String> lockKey = new ArrayList<>(resource.size());
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ cacheKeySet.forEach(key -> {
|
|
|
+ boolean locked = Boolean.TRUE.equals(redisTemplate.opsForValue().setIfAbsent(key, IdUtil.fastUUID(), 10, TimeUnit.MINUTES));
|
|
|
+
|
|
|
+ if (!locked) {
|
|
|
+ throw new BizException("有在途的操作,请稍后");
|
|
|
+ }
|
|
|
+ log.info("批量操作加锁:{} =====================================", key);
|
|
|
+ lockKey.add(key);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ // 校验
|
|
|
+ List<Map<String, String>> errorList = this.checkDataOnBatchCheckPlanInfo(resource);
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(errorList)) {
|
|
|
+ return errorList;
|
|
|
+ }
|
|
|
+
|
|
|
+ resource.forEach(res -> {
|
|
|
+
|
|
|
+ boolean result = "通过".equals(res.getResult());
|
|
|
+ String msg = res.getMsg();
|
|
|
+
|
|
|
+ SysImplementPlanDTO.OnCheck r = new SysImplementPlanDTO.OnCheck();
|
|
|
+ r.setPlanId(res.getPlanId());
|
|
|
+ r.setResult(result);
|
|
|
+ r.setMsg(msg);
|
|
|
+
|
|
|
+ this.checkPlan(r, user);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ return Collections.emptyList();
|
|
|
+
|
|
|
+
|
|
|
+ } finally {
|
|
|
+ if (CollUtil.isNotEmpty(lockKey)) {
|
|
|
+ redisTemplate.delete(lockKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Map<String, String>> checkDataOnBatchCheckPlanInfo(List<SysImplementPlanDTO.OnBatchCheckInfo> resource) {
|
|
|
+
|
|
|
+ List<Map<String, String>> errorList = new LinkedList<>();
|
|
|
+
|
|
|
+ int size = resource.size();
|
|
|
+
|
|
|
+ if (size == 0) {
|
|
|
+ Map<String, String> errorMap = new HashMap<>(2);
|
|
|
+ errorMap.put("idx", "1");
|
|
|
+ errorMap.put("errorMsg", "空表单不支持审核");
|
|
|
+ errorList.add(errorMap);
|
|
|
+ return errorList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<Integer, List<SysImplementPlanDTO.OnBatchCheckInfo>> detailsId2batchCheck = resource.stream().collect(Collectors.groupingBy(SysImplementPlanDTO.OnBatchCheckInfo::getPlanId));
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+
|
|
|
+
|
|
|
+ StringBuilder errorMsg = new StringBuilder();
|
|
|
+
|
|
|
+ SysImplementPlanDTO.OnBatchCheckInfo onBatchCheck = resource.get(i);
|
|
|
+
|
|
|
+ String result = onBatchCheck.getResult();
|
|
|
+ String msg = onBatchCheck.getMsg();
|
|
|
+ Integer planId = onBatchCheck.getPlanId();
|
|
|
+
|
|
|
+ // 校验空值
|
|
|
+ if (StrUtil.hasBlank(result) || planId == null) {
|
|
|
+ errorMsg.append("存在未填写的内容;");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<SysImplementPlanDTO.OnBatchCheckInfo> onBatchChecks = detailsId2batchCheck.get(planId);
|
|
|
+ if (CollUtil.isNotEmpty(onBatchChecks) && onBatchChecks.size() > 1) {
|
|
|
+ errorMsg.append("表单中存在重复的详情ID;");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StrUtil.equalsAny(result, "通过", "拒绝")) {
|
|
|
+ errorMsg.append("审核结果只能是通过/拒绝;");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("拒绝".equals(result) && StrUtil.isBlank(msg)) {
|
|
|
+ errorMsg.append("审核信息必填;");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (StrUtil.isNotBlank(errorMsg)) {
|
|
|
+ Map<String, String> errorMap = new HashMap<>(2);
|
|
|
+ String idx = String.valueOf(i + 1);
|
|
|
+ errorMap.put("idx", idx);
|
|
|
+ errorMap.put("errorMsg", errorMsg.toString());
|
|
|
+ errorList.add(errorMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return errorList;
|
|
|
+ }
|
|
|
}
|