From 4681cb93fb1bc15e817afb094252b86b1447c6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BB=BA=E8=B6=85?= <3182967682@qq.com> Date: Mon, 26 Oct 2020 16:19:25 +0800 Subject: [PATCH 1/4] fix --- .../lz/modules/flow/dao/FlowStartMapper.java | 4 ++ .../flow/service/FlowStartService.java | 2 + .../impl/EvaluationGroupServiceImpl.java | 3 ++ .../controller/ChartController.java | 35 +++++++++++---- .../performance/req/ChartStartsReq.java | 21 +++++++++ .../modules/performance/res/ChartStart.java | 12 ----- .../performance/res/ChartStartsRes.java | 9 +++- .../performance/res/ChartStatisticalRes.java | 3 ++ .../service/ChartResultService.java | 7 ++- .../service/impl/ChartResultServiceImpl.java | 45 +++++++++++++------ .../resources/mapper/flow/FlowStartMapper.xml | 12 +++++ 11 files changed, 115 insertions(+), 38 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/req/ChartStartsReq.java delete mode 100644 src/main/java/com/lz/modules/performance/res/ChartStart.java diff --git a/src/main/java/com/lz/modules/flow/dao/FlowStartMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowStartMapper.java index 9270bc6b..1c28183c 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowStartMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowStartMapper.java @@ -36,4 +36,8 @@ public interface FlowStartMapper extends BaseMapper { List selectListByTime(@Param("page") IPage page, @Param("cycleType")Integer cycleType,@Param("name")String name); FlowStart selectFlowStartByName(@Param("name") String name); + + List selectListByPage(@Param("page")IPage page,@Param("cycleType") Integer cycleType); + + FlowStart selectRecentlyLimt(); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowStartService.java b/src/main/java/com/lz/modules/flow/service/FlowStartService.java index a75945fd..b8be0bad 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowStartService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowStartService.java @@ -33,4 +33,6 @@ public interface FlowStartService extends IService { FlowStart selectFlowStartByName(String name); + + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java index 63a418a2..6eaa0b06 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java @@ -104,6 +104,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl selectAllStaffIdsByGroupId(Long id) { EvaluationGroup evaluationGroup = this.selectEvaluationGroupById(id); + if(evaluationGroup ==null ){ + return Collections.EMPTY_LIST; + } String depIds = evaluationGroup.getDepIds(); Set allDeparmentIds = new HashSet<>(); if(StringUtils.isNotBlank(depIds)){ 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 e4f70a90..c5c0f2f6 100644 --- a/src/main/java/com/lz/modules/performance/controller/ChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/ChartController.java @@ -2,12 +2,19 @@ package com.lz.modules.performance.controller; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; +import com.lz.common.utils.StringUtil; import com.lz.modules.equipment.entity.model.BasePage; +import com.lz.modules.flow.dao.FlowStartMapper; +import com.lz.modules.flow.entity.FlowStart; +import com.lz.modules.flow.service.FlowStartService; +import com.lz.modules.performance.req.ChartStartsReq; +import com.lz.modules.performance.res.ChartStartsRes; 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 io.swagger.annotations.*; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -24,23 +31,35 @@ import java.util.*; public class ChartController extends AbstractController{ @Autowired private ChartResultService chartResultService; + @Autowired + private FlowStartMapper flowStartMapper; - @PostMapping("chart/result") + @GetMapping("chart/result") @ApiOperation("获取绩效报表统计") - @ApiImplicitParam(name = "startId",value = "考核周期标识id", required = true, dataType = "Long",paramType = "query") @ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)}) - public R chartResult(@RequestParam Long startId){ - List chartStatisticalRes = chartResultService.chartReport(startId); + public R chartResult(@RequestParam(required = false) @ApiParam(name = "startId",value = "考核周期标识id") Long startId){ + String defaultTime = StringUtils.EMPTY; + if(startId==null){ + //取最近一条记录 + FlowStart flowStart = flowStartMapper.selectRecentlyLimt(); + if(flowStart!=null){ + startId = flowStart.getId(); + defaultTime = flowStart.getName(); + }else { + return R.ok(); + } + } + List chartStatisticalRes = chartResultService.chartReport(startId,defaultTime); return R.ok().put("data",chartStatisticalRes); } @PostMapping("chart/starts") @ApiOperation("获取考核类型列表") - @ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)}) - public R chartStarts(@RequestBody BasePage req){ - - return R.ok().put("data",""); + @ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStartsRes.class)}) + public R chartStarts(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true)ChartStartsReq req){ + PageUtils pageUtils = chartResultService.chartStarts(req); + return R.ok().put("data",pageUtils); } diff --git a/src/main/java/com/lz/modules/performance/req/ChartStartsReq.java b/src/main/java/com/lz/modules/performance/req/ChartStartsReq.java new file mode 100644 index 00000000..fb29d271 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/req/ChartStartsReq.java @@ -0,0 +1,21 @@ +package com.lz.modules.performance.req; + +import com.lz.modules.equipment.entity.model.BasePage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2020/10/26 15:08 + */ +@Data +@ApiModel("获取考核类型列表") +public class ChartStartsReq extends BasePage{ + + @ApiModelProperty(value = "(必传)类型,0 月度 1:自定义",name = "cycleType",required = true) + private Integer cycleType; + +} diff --git a/src/main/java/com/lz/modules/performance/res/ChartStart.java b/src/main/java/com/lz/modules/performance/res/ChartStart.java deleted file mode 100644 index 7d8f2ea6..00000000 --- a/src/main/java/com/lz/modules/performance/res/ChartStart.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.lz.modules.performance.res; - -import lombok.Data; - -@Data -public class ChartStart{ - - private String time; - - private Long startId; - -} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/res/ChartStartsRes.java b/src/main/java/com/lz/modules/performance/res/ChartStartsRes.java index d2349f24..611effad 100644 --- a/src/main/java/com/lz/modules/performance/res/ChartStartsRes.java +++ b/src/main/java/com/lz/modules/performance/res/ChartStartsRes.java @@ -1,5 +1,7 @@ package com.lz.modules.performance.res; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @@ -10,10 +12,13 @@ import java.util.List; * @Date: 2020/10/26 14:21 */ @Data +@ApiModel("全部考核列表实体") public class ChartStartsRes { - private int type; + @ApiModelProperty(value = "时间" , name = "time",example = "2020年08月绩效考核") + private String time; - private List list; + @ApiModelProperty(value = "考核id" , name = "startId") + private Long startId; } diff --git a/src/main/java/com/lz/modules/performance/res/ChartStatisticalRes.java b/src/main/java/com/lz/modules/performance/res/ChartStatisticalRes.java index 04829e53..86de2643 100644 --- a/src/main/java/com/lz/modules/performance/res/ChartStatisticalRes.java +++ b/src/main/java/com/lz/modules/performance/res/ChartStatisticalRes.java @@ -17,6 +17,9 @@ public class ChartStatisticalRes { @ApiModelProperty(value = "类型 0:节点统计 1:等级统计 2:人数统计 ",name = "type") private int type; + @ApiModelProperty(value = "默认时间 ",name = "defaultTime") + private String defaultTime; + private List statisticals; } diff --git a/src/main/java/com/lz/modules/performance/service/ChartResultService.java b/src/main/java/com/lz/modules/performance/service/ChartResultService.java index e5e64f02..899ee8ce 100644 --- a/src/main/java/com/lz/modules/performance/service/ChartResultService.java +++ b/src/main/java/com/lz/modules/performance/service/ChartResultService.java @@ -1,6 +1,9 @@ package com.lz.modules.performance.service; import com.lz.common.utils.PageUtils; +import com.lz.modules.equipment.entity.model.BasePage; +import com.lz.modules.performance.req.ChartStartsReq; +import com.lz.modules.performance.res.ChartStartsRes; import com.lz.modules.performance.res.ChartStatistical; import com.lz.modules.performance.res.ChartStatisticalRes; @@ -13,12 +16,12 @@ import java.util.List; */ public interface ChartResultService { - List chartReport(Long startId); + List chartReport(Long startId,String defaultTime); List countDepartmentAndStaffNum(ListstaffIds); //PageUtils resultRankList(ChartResultReq req); - void chartStarts(); + PageUtils chartStarts(ChartStartsReq req); } diff --git a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java index 988d2c9d..420823cf 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java @@ -6,10 +6,11 @@ import com.lz.common.utils.PageUtils; import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; +import com.lz.modules.flow.dao.FlowStartMapper; import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.flow.service.EvaluationGroupService; import com.lz.modules.flow.service.FlowStartService; -import com.lz.modules.performance.res.ChartStart; +import com.lz.modules.performance.req.ChartStartsReq; import com.lz.modules.performance.res.ChartStartsRes; import com.lz.modules.performance.res.ChartStatistical; import com.lz.modules.performance.res.ChartStatisticalRes; @@ -21,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; -import java.util.function.Consumer; /** * @Author: djc @@ -43,9 +43,12 @@ public class ChartResultServiceImpl implements ChartResultService { private StaffService staffService; @Autowired private FlowStartService flowStartService; + @Autowired + private FlowStartMapper flowStartMapper; + @Override - public List chartReport(Long startId) { + public List chartReport(Long startId,String defaultTime) { List data = new ArrayList<>(); ChartStatisticalRes res; @@ -53,12 +56,14 @@ public class ChartResultServiceImpl implements ChartResultService { res = new ChartStatisticalRes(); res.setType(0); res.setStatisticals(process); + res.setDefaultTime(defaultTime); data.add(res); List scoreLevel = resultRecordService.countNumByScoreLevel(startId); res = new ChartStatisticalRes(); res.setType(1); res.setStatisticals(scoreLevel); + res.setDefaultTime(defaultTime); data.add(res); List strings = evaluationGroupService.selectAllStaffIdsByGroupId(3L); @@ -66,6 +71,7 @@ public class ChartResultServiceImpl implements ChartResultService { res = new ChartStatisticalRes(); res.setType(2); res.setStatisticals(depstaff); + res.setDefaultTime(defaultTime); data.add(res); return data; @@ -110,17 +116,28 @@ public class ChartResultServiceImpl implements ChartResultService { }*/ @Override - public void chartStarts() { - List res = new ArrayList<>(); - List list = flowStartService.list(new QueryWrapper().eq("is_delete", 0).orderByAsc("start_time")); - list.forEach(new Consumer() { - @Override - public void accept(FlowStart flowStart) { - - if(flowStart.getCycleType()==0){ - ChartStart chartStart = new ChartStart(); - } - } + public PageUtils chartStarts(ChartStartsReq req) { + List data = new ArrayList<>(); + PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect( + page -> flowStartMapper.selectListByPage(page,req.getCycleType()) + ); + List starts = pageUtils.getList(); + starts.forEach(flowStart -> { + ChartStartsRes start = new ChartStartsRes(); + start.setStartId(flowStart.getId()); + start.setTime(flowStart.getName()); + data.add(start); }); + + + PageUtils pages = new PageUtils(); + pages.setTotalPage(pageUtils.getTotalPage()); + pages.setTotalCount(pageUtils.getTotalCount()); + pages.setCurrPage(req.getCurrPage()); + pages.setPageSize(req.getPageSize()); + pages.setList(data); + + return pages; + } } diff --git a/src/main/resources/mapper/flow/FlowStartMapper.xml b/src/main/resources/mapper/flow/FlowStartMapper.xml index ac15bf19..a23f94a7 100644 --- a/src/main/resources/mapper/flow/FlowStartMapper.xml +++ b/src/main/resources/mapper/flow/FlowStartMapper.xml @@ -101,5 +101,17 @@ + + + + From 86fc82ae8c35c60ab6a5305fb42edb668cb9aab2 Mon Sep 17 00:00:00 2001 From: wulin Date: Mon, 26 Oct 2020 16:29:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=9C=A8=E5=A4=9A=E4=B8=AA=E9=83=A8=E9=97=A8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E9=83=A8=E9=97=A8=E5=87=A0=E7=BA=A7?= =?UTF-8?q?=E9=A2=86=E5=AF=BC=E5=BC=82=E5=B8=B8=E3=80=82=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=AC=AC=E4=B8=80=E4=B8=AA=E4=B8=BA=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lz/modules/app/service/impl/StaffServiceImpl.java | 1 + .../com/lz/modules/flow/service/FlowStartService.java | 2 ++ .../modules/flow/service/impl/FlowStartServiceImpl.java | 9 +++++++++ .../performance/controller/FlowStartController.java | 8 +------- .../mapper/generator/DepartmentsStaffRelateDao.xml | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java index 8d2abf42..93011dc1 100644 --- a/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java @@ -488,6 +488,7 @@ public class StaffServiceImpl extends ServiceImpl impleme }else{ log.info("没有找到父级部门,部门id{}", depId); departManagers.setManagers(new ArrayList<>()); + return departManagers; } type--; } diff --git a/src/main/java/com/lz/modules/flow/service/FlowStartService.java b/src/main/java/com/lz/modules/flow/service/FlowStartService.java index 41e1458f..32e5b1f5 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowStartService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowStartService.java @@ -36,4 +36,6 @@ public interface FlowStartService extends IService { FlowStart selectFlowStartByName(String name); R saveStart(FlowStart flowStart); + + R getModelById(Long id, int type); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index c126c7e1..cdd06d39 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -490,5 +490,14 @@ public class FlowStartServiceImpl extends ServiceImpl staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);*/ + //flowStart = flowStartService.selectFlowStartById(flowStart.getId()); + DepartManagers staffEntity = staffService.findLeader(id, type); + return R.ok().put("data",staffEntity); + } + } diff --git a/src/main/java/com/lz/modules/performance/controller/FlowStartController.java b/src/main/java/com/lz/modules/performance/controller/FlowStartController.java index 8d50ec45..5074fa94 100644 --- a/src/main/java/com/lz/modules/performance/controller/FlowStartController.java +++ b/src/main/java/com/lz/modules/performance/controller/FlowStartController.java @@ -46,8 +46,6 @@ public class FlowStartController { private FlowStartService flowStartService; - @Autowired - private EvaluationGroupService evaluationGroupService; @@ -58,11 +56,7 @@ public class FlowStartController { @GetMapping("/getById") public R getById(@RequestParam Long id, @RequestParam int type) { - EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(id); - List staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup); - //flowStart = flowStartService.selectFlowStartById(flowStart.getId()); - //List staffEntity = staffService.findLeader(id, type); - return R.ok().put("data",staffIds); + return flowStartService.getModelById(id, type); } diff --git a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml index 519a57b9..f686fa45 100644 --- a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml +++ b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml @@ -78,7 +78,7 @@ From 353daceb4181f54ec83a5df66c1f24c0729be429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BB=BA=E8=B6=85?= <3182967682@qq.com> Date: Mon, 26 Oct 2020 17:05:46 +0800 Subject: [PATCH 3/4] fix --- .../enums/ResultFlowProcessEnum.java | 10 ++++++ .../service/impl/ChartResultServiceImpl.java | 35 ++++++++++++++++++- .../mapper/app/ResultRecordMapper.xml | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/enums/ResultFlowProcessEnum.java b/src/main/java/com/lz/modules/performance/enums/ResultFlowProcessEnum.java index 1af5959e..35c082f9 100644 --- a/src/main/java/com/lz/modules/performance/enums/ResultFlowProcessEnum.java +++ b/src/main/java/com/lz/modules/performance/enums/ResultFlowProcessEnum.java @@ -9,6 +9,7 @@ public enum ResultFlowProcessEnum { TARGET(0,"制定目标"), CONFIRM(1,"目标确认"), DO(2,"执行中"), + WRITE(3,"结果值录入"), SCORE(4,"评分"), FINISH(5,"考核结束"), ; @@ -17,6 +18,15 @@ public enum ResultFlowProcessEnum { private String desc; + public static String getDesc(int status){ + for(ResultFlowProcessEnum flowProcessEnum:ResultFlowProcessEnum.values()){ + if(flowProcessEnum.getStatus() == status){ + return flowProcessEnum.getDesc(); + } + } + return ""; + + } ResultFlowProcessEnum(int status, String desc) { this.status = status; diff --git a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java index 420823cf..ea8114b0 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java @@ -10,12 +10,14 @@ import com.lz.modules.flow.dao.FlowStartMapper; import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.flow.service.EvaluationGroupService; import com.lz.modules.flow.service.FlowStartService; +import com.lz.modules.performance.enums.ResultFlowProcessEnum; import com.lz.modules.performance.req.ChartStartsReq; import com.lz.modules.performance.res.ChartStartsRes; import com.lz.modules.performance.res.ChartStatistical; import com.lz.modules.performance.res.ChartStatisticalRes; import com.lz.modules.performance.service.ChartResultService; import com.lz.modules.sys.dao.app.ResultRecordMapper; +import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.service.app.ResultRecordService; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -53,9 +55,10 @@ public class ChartResultServiceImpl implements ChartResultService { ChartStatisticalRes res; List process = resultRecordService.countNumByFlowProcess(startId); + res = new ChartStatisticalRes(); res.setType(0); - res.setStatisticals(process); + res.setStatisticals(buildProcess(process,startId)); res.setDefaultTime(defaultTime); data.add(res); @@ -140,4 +143,34 @@ public class ChartResultServiceImpl implements ChartResultService { return pages; } + + + //构建流程默认人数 + private List buildProcess(List process,Long startId){ + List data = new ArrayList<>(); + Map map = Maps.newHashMap(); + int count = resultRecordService.count(new QueryWrapper() + .eq("is_delete", 0) + .eq("start_id", startId)); + + ChartStatistical all = new ChartStatistical(); + all.setDesc("参与人数"); + all.setNum(count); + data.add(all); + + for(ChartStatistical statistical:process){ + map.put(ResultFlowProcessEnum.getDesc(Integer.valueOf(statistical.getDesc())),statistical.getNum()); + } + for(ResultFlowProcessEnum flowProcessEnum:ResultFlowProcessEnum.values()){ + ChartStatistical statistical = new ChartStatistical(); + statistical.setDesc(flowProcessEnum.getDesc()); + statistical.setNum(0); + Object o = map.get(flowProcessEnum.getDesc()); + if(o!=null){ + statistical.setNum(Integer.valueOf(o.toString())); + } + data.add(statistical); + } + return data; + } } diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index 3b056758..961f96ab 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -357,7 +357,7 @@