This commit is contained in:
杜建超 2020-11-03 16:03:59 +08:00
parent 3e51dbc961
commit 611c07cb01
7 changed files with 37 additions and 12 deletions

View File

@ -1,5 +1,6 @@
package com.lz.modules.performance.controller; package com.lz.modules.performance.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lz.common.utils.PageUtils; import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R; import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil; import com.lz.common.utils.StringUtil;
@ -42,7 +43,8 @@ public class ChartController extends AbstractController{
public R chartResult(@RequestParam(required = false) @ApiParam(name = "startId",value = "考核周期标识id") Long startId){ public R chartResult(@RequestParam(required = false) @ApiParam(name = "startId",value = "考核周期标识id") Long startId){
List<ChartStatisticalRes> chartStatisticalRes = null; List<ChartStatisticalRes> chartStatisticalRes = null;
try { try {
Long userId = getUserId(); //Long userId = getUserId();
Long userId = 313L;
chartStatisticalRes = chartResultService.chartReport(startId,userId); chartStatisticalRes = chartResultService.chartReport(startId,userId);
} catch (Exception e) { } catch (Exception e) {
log.error("获取绩效报表统计异常" ,e); log.error("获取绩效报表统计异常" ,e);
@ -83,5 +85,12 @@ public class ChartController extends AbstractController{
@PostMapping("chart/test")
public R chartTest(){
List<FlowStart> starts = flowStartMapper.selectList(new QueryWrapper<FlowStart>().in("group_ids", Collections.EMPTY_LIST));
System.out.println();
return null;
}
} }

View File

@ -33,4 +33,6 @@ public class AssessDetailReq extends BasePage{
private Integer flowProcess; private Integer flowProcess;
private List<String> departmentIds; private List<String> departmentIds;
private Long loginUserId;
} }

View File

@ -21,6 +21,6 @@ public class AssessListReq extends BasePage {
@ApiModelProperty(value = "考核名称",name = "name") @ApiModelProperty(value = "考核名称",name = "name")
private String name; private String name;
private Long staffId; private Long loginUserId;
} }

View File

@ -23,6 +23,6 @@ public class ChartResultReq extends BasePage{
@ApiModelProperty(value = "等级",name = "scoreLevel") @ApiModelProperty(value = "等级",name = "scoreLevel")
private Long scoreLevel; private Long scoreLevel;
private Long staffId; private Long loginUserId;
} }

View File

@ -88,7 +88,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
log.info("未找到考核发起数据"); log.info("未找到考核发起数据");
return pageUtils; return pageUtils;
} }
List<String> mandepartmentIds = assessService.roleDepartments(req.getStaffId()); //List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
List<String> mandepartmentIds = Collections.EMPTY_LIST;
list.forEach(flowStart -> { list.forEach(flowStart -> {
AssessManagerListRes res = new AssessManagerListRes(); AssessManagerListRes res = new AssessManagerListRes();
String name = flowStart.getName(); String name = flowStart.getName();

View File

@ -86,7 +86,8 @@ public class ChartResultServiceImpl implements ChartResultService {
} }
} }
//自己管理的部门 //自己管理的部门
List<String> mandepartmentIds = assessService.roleDepartments(staffId); //List<String> mandepartmentIds = assessService.roleDepartments(staffId);
List<String> mandepartmentIds = Collections.EMPTY_LIST;
List<ChartStatisticalRes> data = new ArrayList<>(); List<ChartStatisticalRes> data = new ArrayList<>();
ChartStatisticalRes res; ChartStatisticalRes res;
@ -94,7 +95,7 @@ public class ChartResultServiceImpl implements ChartResultService {
res = new ChartStatisticalRes(); res = new ChartStatisticalRes();
res.setType(0); res.setType(0);
res.setStatisticals(buildProcess(process,startId)); res.setStatisticals(buildProcess(process,startId,mandepartmentIds));
res.setDefaultTime(defaultTime); res.setDefaultTime(defaultTime);
if(StringUtil.isNotBlank(defaultTime)){ if(StringUtil.isNotBlank(defaultTime)){
res.setDefaultId(startId); res.setDefaultId(startId);
@ -180,7 +181,8 @@ public class ChartResultServiceImpl implements ChartResultService {
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId()); List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
//自己管理的和所有的部门交集 //自己管理的和所有的部门交集
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds)); log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds));
List<String> mandepartmentIds = assessService.roleDepartments(req.getStaffId()); //List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
List<String> mandepartmentIds = Collections.EMPTY_LIST;
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds)); log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
mandepartmentIds.retainAll(allDeparmentIds); mandepartmentIds.retainAll(allDeparmentIds);
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds)); log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
@ -220,17 +222,21 @@ public class ChartResultServiceImpl implements ChartResultService {
@Override @Override
public List<ChartStatistical> countAssessNumByFlowProcess(AssessDetailReq req) { public List<ChartStatistical> countAssessNumByFlowProcess(AssessDetailReq req) {
List<ChartStatistical> process = resultRecordMapper.countAssessNumByFlowProcess(req); List<ChartStatistical> process = resultRecordMapper.countAssessNumByFlowProcess(req);
List<ChartStatistical> data = buildProcess(process, req.getStartId()); //获取自己管理的部门
//List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
List<String> mandepartmentIds = Collections.EMPTY_LIST;
List<ChartStatistical> data = buildProcess(process, req.getStartId(),mandepartmentIds);
return data; return data;
} }
//构建流程默认人数 //构建流程默认人数
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId){ private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds){
List<ChartStatistical> data = new ArrayList<>(); List<ChartStatistical> data = new ArrayList<>();
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
int count = resultRecordService.count(new QueryWrapper<ResultRecord>() int count = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0) .eq("is_delete", 0)
.eq("start_id", startId)); .eq("start_id", startId)
.in("department_id",mandepartmentIds));
ChartStatistical all = new ChartStatistical(); ChartStatistical all = new ChartStatistical();
all.setDesc("参与人数"); all.setDesc("参与人数");

View File

@ -459,6 +459,13 @@
</foreach> </foreach>
) )
</if> </if>
<if test="req.departmentIds !=null and req.departmentIds.size()!=0">
and r.department_id in (
<foreach collection="req.departmentIds" item="department_id" separator=",">
#{department_id}
</foreach>
)
</if>
</select> </select>
<select id="countAssessNumByFlowProcess" resultType="com.lz.modules.performance.res.ChartStatistical"> <select id="countAssessNumByFlowProcess" resultType="com.lz.modules.performance.res.ChartStatistical">
@ -485,9 +492,9 @@
</foreach> </foreach>
) )
</if> </if>
<if test="departmentIds !=null and departmentIds.size()!=0"> <if test="req.departmentIds !=null and req.departmentIds.size()!=0">
and department_id in ( and department_id in (
<foreach collection="departmentIds" item="department_id" separator=","> <foreach collection="req.departmentIds" item="department_id" separator=",">
#{department_id} #{department_id}
</foreach> </foreach>
) )