From 76e70c8b1f67636a740c9e3d0b0e94b944b390e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BB=BA=E8=B6=85?= <3182967682@qq.com> Date: Tue, 17 Nov 2020 15:11:01 +0800 Subject: [PATCH] fix --- .../performance/controller/ChartController.java | 17 +++++++++++++++++ .../controller/UserTaskController.java | 5 +++-- .../service/impl/AssessServiceImpl.java | 15 +++++++++++---- .../resources/mapper/flow/FlowRecordMapper.xml | 2 +- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/ChartController.java b/src/main/java/com/lz/modules/performance/controller/ChartController.java index 54e83a24..7f160b91 100644 --- a/src/main/java/com/lz/modules/performance/controller/ChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/ChartController.java @@ -1,6 +1,7 @@ package com.lz.modules.performance.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.google.common.collect.Lists; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; @@ -18,6 +19,7 @@ import com.lz.modules.performance.res.ChartStatisticalRes; import com.lz.modules.performance.res.ResultRankListRes; import com.lz.modules.performance.service.ChartResultService; import com.lz.modules.sys.controller.AbstractController; +import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.service.app.ResultRecordService; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; @@ -25,6 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Supplier; /** * @Author: djc @@ -104,5 +111,15 @@ public class ChartController extends AbstractController{ return R.ok().put("data",ownResultResps); } + public void main(String[] args) { + ExecutorService executor = Executors.newFixedThreadPool(10); + List resultRecords = Lists.newArrayList(); + CompletableFuture> listCompletableFuture = CompletableFuture.supplyAsync(() -> resultRecordService.list(), executor); + try { + resultRecords = listCompletableFuture.get(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/com/lz/modules/performance/controller/UserTaskController.java b/src/main/java/com/lz/modules/performance/controller/UserTaskController.java index d1277728..bfadfae0 100644 --- a/src/main/java/com/lz/modules/performance/controller/UserTaskController.java +++ b/src/main/java/com/lz/modules/performance/controller/UserTaskController.java @@ -32,11 +32,12 @@ public class UserTaskController extends AbstractController{ @ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskListRes.class)}) public R list(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) AssessTaskReq req){ PageUtils pageUtils; + Long userId = null; try { - Long userId = getUserId(); + userId = getUserId(); pageUtils = assessService.userTaskList(req, userId); } catch (Exception e) { - log.error("获取用户事项异常 userId:" ,e); + log.error("获取用户事项异常 userId:" + userId,e); return R.error(e.getMessage()); } return R.ok().put("data",pageUtils); diff --git a/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java index 6e3df194..a7f404ec 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java @@ -69,11 +69,18 @@ public class AssessServiceImpl implements AssessService { dtos.stream().forEach(taskListDto -> { TaskListRes res = new TaskListRes(); StaffEntity staffEntity = staffService.selectStaffById(taskListDto.getRecordStaffId()); - res.setAvatar(Optional.ofNullable(staffEntity.getAvatar()).orElse(StringUtil.EMPTY)); - String name = staffEntity.getName(); - if(taskListDto.getRecordStaffId().equals(taskListDto.getApprovalStaffId())){ - name = "您"; + String name = ""; + if(staffEntity!=null){ + res.setAvatar(Optional.ofNullable(staffEntity.getAvatar()).orElse(StringUtil.EMPTY)); + name = staffEntity.getName(); + if(taskListDto.getRecordStaffId().equals(taskListDto.getApprovalStaffId())){ + name = "您"; + } + }else { + name = "未知"; + log.info("未找到此人信息 staffId: " + taskListDto.getRecordStaffId()); } + FlowStart start = flowStartService.selectFlowStartById(taskListDto.getStartId()); //根据状态拼接文案 String startName = start == null ? "" : start.getName(); diff --git a/src/main/resources/mapper/flow/FlowRecordMapper.xml b/src/main/resources/mapper/flow/FlowRecordMapper.xml index c58c61ac..aa192578 100644 --- a/src/main/resources/mapper/flow/FlowRecordMapper.xml +++ b/src/main/resources/mapper/flow/FlowRecordMapper.xml @@ -175,7 +175,7 @@