|
@@ -1853,25 +1853,8 @@ public class WmSupervisionManager {
|
|
|
}
|
|
|
|
|
|
m.put("modifiable", wmTaskSupervision.getModifiable());
|
|
|
-
|
|
|
- SysUser supUser = userMap.get(wmTaskSupervision.getCreateBy());
|
|
|
- SysUserRole supSysUserRole = userRoleMap.get(supUser.getUserId()).get(0);
|
|
|
- SysRole supRole = roleMap.get(supSysUserRole.getRoleId());
|
|
|
- String supRoleName =
|
|
|
- (supRole == null
|
|
|
- ? " "
|
|
|
- : (StrUtil.isNotBlank(supRole.getRoleDesc())
|
|
|
- ? supRole.getRoleDesc()
|
|
|
- : supRole.getRoleName()));
|
|
|
- String supervisionMsg =
|
|
|
- String.format(
|
|
|
- "%s【%s】,审核【%s】,监督意见为【%s】(%s)。",
|
|
|
- supRoleName, supUser.getRealname(),
|
|
|
- wmTaskSupervision.getSupervisionResult() ? " 通过 " : " 不通过 " ,
|
|
|
- StrUtil.isBlank(wmTaskSupervision.getRemarks()) ? " " : wmTaskSupervision.getRemarks(),
|
|
|
- formatter.format(wmTaskSupervision.getCreateTime()));
|
|
|
-
|
|
|
- m.put("supervisionMessage", supervisionMsg);
|
|
|
+ // 所有审核信息展示都从Advice来
|
|
|
+ m.put("supervisionMessage", "");
|
|
|
|
|
|
List<String> advMsg = new ArrayList<>();
|
|
|
if (!isService) {
|
|
@@ -1881,6 +1864,7 @@ public class WmSupervisionManager {
|
|
|
.eq(
|
|
|
WmTaskSupervisionAdvice::getTaskSupervisionId,
|
|
|
wmTaskSupervision.getSupervisionId())
|
|
|
+ .orderByAsc(WmTaskSupervisionAdvice::getCreateTime)
|
|
|
);
|
|
|
|
|
|
WmTaskSupervisionAdvice lastAdv = null;
|
|
@@ -1899,13 +1883,15 @@ public class WmSupervisionManager {
|
|
|
: role.getRoleName()));
|
|
|
String realName = u.getRealname();
|
|
|
String date = formatter.format(adv.getCreateTime());
|
|
|
- String resultMsg = adv.getAdviceResult() ? " 同意 " : " 不同意 ";
|
|
|
+ String resultMsg = isSupervisor(SecurityUtils.getRoles())
|
|
|
+ ? adv.getAdviceResult() ? " 通过 " : " 不通过 "
|
|
|
+ : adv.getAdviceResult() ? " 同意 " : " 不同意 ";
|
|
|
String remarks =
|
|
|
StrUtil.isBlank(adv.getRemarks()) ? " " : adv.getRemarks();
|
|
|
|
|
|
advMsg.add(String.format(
|
|
|
- "%s%s【%s】,审核【%s】,监督意见为【%s】(%s)。",
|
|
|
- adv.getDelFlag() ? "[历史] " : "", roleName, realName, resultMsg, remarks, date));
|
|
|
+ "%s【%s】,审核【%s】,监督意见为【%s】(%s)。",
|
|
|
+ roleName, realName, resultMsg, remarks, date));
|
|
|
lastAdv = adv;
|
|
|
}
|
|
|
}
|
|
@@ -1967,9 +1953,8 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
boolean modifiable = false;
|
|
|
String remarks = resource.getRemarks();
|
|
|
|
|
|
- // 如果监督记录创建人不是当前人,就记录监督意见
|
|
|
- if (!StrUtil.equals(operator.getUsername(), supervision.getCreateBy())
|
|
|
- && !CollUtil.containsAny(SecurityUtils.getRoles(), List.of(49, 52, 53, 56))) { // 不是监督员
|
|
|
+ // 领导,记录监督意见
|
|
|
+ if (!StrUtil.equals(operator.getUsername(), supervision.getCreateBy()) && !isSupervisor(SecurityUtils.getRoles())) {
|
|
|
modifiable = !resource.getSupervision();
|
|
|
if (resource.getSupervision()) {
|
|
|
remarks = "同意监督员监督结果";
|
|
@@ -1983,11 +1968,18 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
taskSupervisionService.updateSupervision(
|
|
|
supervision.getSupervisionId(), supervision.getRemarks(), modifiable, supervision.getSupervisionResult(), operator);
|
|
|
|
|
|
- } else {
|
|
|
+ } else { // 监督员
|
|
|
+ if (!StrUtil.equals(operator.getUsername(), supervision.getCreateBy())) {
|
|
|
+ // 独占
|
|
|
+ return false;
|
|
|
+ }
|
|
|
// 监察员重新提交,删除历史的审核意见
|
|
|
taskSupervisionAdviceService.delAdvice(supervision.getSupervisionId(), operator);
|
|
|
taskSupervisionService.updateSupervision(
|
|
|
supervision.getSupervisionId(), remarks, modifiable, resource.getSupervision(), operator);
|
|
|
+ // 监督员advice作为历史保留
|
|
|
+ taskSupervisionAdviceService.createAdvice(
|
|
|
+ supervision.getSupervisionId(), resource, remarks, operator);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1995,7 +1987,13 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
else {
|
|
|
|
|
|
try {
|
|
|
- taskSupervisionService.createTaskSupervision(resource, operator);
|
|
|
+ WmTaskSupervision sup = taskSupervisionService.createTaskSupervision(resource, operator);
|
|
|
+ if (sup == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 监督员advice作为历史保留
|
|
|
+ taskSupervisionAdviceService.createAdvice(
|
|
|
+ sup.getSupervisionId(), resource, sup.getRemarks(), operator);
|
|
|
} catch(DataIntegrityViolationException e) {
|
|
|
throw new BizException("任务已被监督:" + resource.getTaskId().toString());
|
|
|
}
|
|
@@ -2004,6 +2002,10 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ private boolean isSupervisor(List<Integer> roles) {
|
|
|
+ return CollUtil.containsAny(roles, List.of(49, 52, 53, 56));
|
|
|
+ }
|
|
|
|
|
|
// 执行任务监察(批量)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -2304,8 +2306,9 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
if (j == 11) {
|
|
|
List<WmTaskSupervisionAdvice> supervisionAdvices =
|
|
|
advices.get(wmTaskSupervision.getSupervisionId());
|
|
|
- if (CollUtil.isNotEmpty(supervisionAdvices)) {
|
|
|
- WmTaskSupervisionAdvice advice = supervisionAdvices.get(0);
|
|
|
+ if (CollUtil.isNotEmpty(supervisionAdvices) && supervisionAdvices.size() > 1) {
|
|
|
+ supervisionAdvices.sort((a, b) -> a.getCreateTime().compareTo(b.getCreateTime()));
|
|
|
+ WmTaskSupervisionAdvice advice = supervisionAdvices.get(1); // The first is supervisor's advice
|
|
|
datas[i][j] = advice != null ? advice.getRemarks() : "";
|
|
|
} else {
|
|
|
datas[i][j] = "";
|
|
@@ -2316,13 +2319,15 @@ private Page<WmTask> getReviewTaskPage(WmSupervisionDto.OnTaskSupervisionPage qu
|
|
|
if (j == 12) {
|
|
|
List<WmTaskSupervisionAdvice> supervisionAdvices =
|
|
|
advices.get(wmTaskSupervision.getSupervisionId());
|
|
|
- if (CollUtil.isNotEmpty(supervisionAdvices) && supervisionAdvices.size() > 1) {
|
|
|
- int idx = 1;
|
|
|
+ if (CollUtil.isNotEmpty(supervisionAdvices) && supervisionAdvices.size() > 2) {
|
|
|
+ supervisionAdvices.sort((a, b) -> a.getCreateTime().compareTo(b.getCreateTime()));
|
|
|
+ int idx = 2;
|
|
|
WmTaskSupervisionAdvice advice = supervisionAdvices.get(idx);
|
|
|
- while(advice.getCreateBy().equals(supervisionAdvices.get(0).getCreateBy()) && idx + 1 < supervisionAdvices.size()) {
|
|
|
+ // 仅和负责人比较, 不同于负责人就认为是分管领导
|
|
|
+ while(advice.getCreateBy().equals(supervisionAdvices.get(1).getCreateBy()) && idx + 1 < supervisionAdvices.size()) {
|
|
|
advice = supervisionAdvices.get(++idx);
|
|
|
}
|
|
|
- datas[i][j] = advice != null && !advice.getCreateBy().equals(supervisionAdvices.get(0).getCreateBy()) ? advice.getRemarks() : "";
|
|
|
+ datas[i][j] = advice != null && !advice.getCreateBy().equals(supervisionAdvices.get(1).getCreateBy()) ? advice.getRemarks() : "";
|
|
|
} else {
|
|
|
datas[i][j] = "";
|
|
|
}
|