|
@@ -39,6 +39,7 @@ import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
@@ -52,6 +53,7 @@ import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import org.springframework.data.redis.core.ListOperations;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -816,4 +818,41 @@ public class TaskManager {
|
|
|
|
|
|
return page.getRecords();
|
|
|
}
|
|
|
+
|
|
|
+ public List<Map<String, String>> listCurrTaskCheckHis(String taskId) {
|
|
|
+
|
|
|
+ List<SysCheckChainNodeCheckHistory> histories =
|
|
|
+ checkChainNodeCheckHistoryMapper.selectList(
|
|
|
+ Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
+ .eq(SysCheckChainNodeCheckHistory::getTargetId, taskId)
|
|
|
+ .orderByAsc(SysCheckChainNodeCheckHistory::getHistoryId));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(histories)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从缓存中获取用户信息
|
|
|
+ List<SysUser> users = redisTemplate.opsForList().range(CacheConstants.USER_KEY, 0, -1);
|
|
|
+ Map<String, SysUser> userMap =
|
|
|
+ users.stream()
|
|
|
+ .collect(Collectors.toMap(SysUser::getUsername, Function.identity(), (v1, v2) -> v2));
|
|
|
+
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ List<Map<String, String>> collect =
|
|
|
+ histories.stream()
|
|
|
+ .map(
|
|
|
+ h -> {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("nodeId", h.getNodeId().toString());
|
|
|
+ SysUser sysUser = userMap.get(h.getCreateBy());
|
|
|
+ map.put("checker", sysUser != null ? sysUser.getUsername() : "");
|
|
|
+ map.put("checkResult", h.getCheckResult() ? "通过" : "拒绝");
|
|
|
+ map.put("checkMessage", h.getCheckMsg());
|
|
|
+ map.put("checkTime", formatter.format(h.getCreateTime()));
|
|
|
+ return map;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return collect;
|
|
|
+ }
|
|
|
}
|