提交修改
This commit is contained in:
commit
54d0a4fb36
@ -24,10 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -80,6 +77,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartRoleService flowChartRoleService;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -129,13 +129,15 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
||||
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
||||
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
|
||||
) {
|
||||
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
|
||||
if(staffSimpleInfos.size() == 0){
|
||||
R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos)){
|
||||
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos, mustRole, selfMustRole)){
|
||||
|
||||
case 1:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核模板");
|
||||
@ -191,6 +193,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
|
||||
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
||||
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
||||
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
@ -202,7 +207,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(evaluationGroup, flowStart, staffManages, staffIds)){
|
||||
switch (start(evaluationGroup, flowStart, staffManages, staffIds, mustRole, selfMustRole)){
|
||||
|
||||
case 1:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
@ -220,7 +225,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
|
||||
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds){
|
||||
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds,
|
||||
Map<Long, List<FlowChartRole>> mustRole, Map<Long, List<FlowChartRole>> selfMustRole){
|
||||
|
||||
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
@ -317,8 +323,24 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
flowService.insertFlow(flow);
|
||||
FlowApprovalRole flowApprovalRole = null;
|
||||
List<FlowChartRole> flowChartRoles = null;
|
||||
//获取必备权限
|
||||
if(mustRole.containsKey(flow.getChartId())){
|
||||
flowChartRoles = mustRole.get(flow.getChartId());
|
||||
}else{
|
||||
flowChartRoles =
|
||||
flowChartRoleService.selectFlowChartRolesByChartIdAndType(flow.getChartId(), 1);
|
||||
mustRole.put(flow.getChartId(), flowChartRoles);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
|
||||
|
||||
|
||||
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
|
||||
|
||||
|
||||
for (String id:optIds
|
||||
) {
|
||||
|
||||
@ -334,6 +356,20 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//依次
|
||||
stepIndex++;
|
||||
}
|
||||
|
||||
if(flowChartRoles != null && flowChartRoles.size() > 0){//设置必备权限
|
||||
String roles = flowChartRoles.stream().map(new Function<FlowChartRole, String>() {
|
||||
@Override
|
||||
public String apply(FlowChartRole flowChartRole) {
|
||||
return flowChartRole.getRoleId().toString();
|
||||
}
|
||||
}).collect(Collectors.joining(","));
|
||||
if(flowApprovalRole.getRoleId() == null || flowApprovalRole.getRoleId().length() == 0){
|
||||
flowApprovalRole.setRoleId(roles);
|
||||
}else{
|
||||
flowApprovalRole.setRoleId(flowApprovalRole.getRoleId() + "," + roles);
|
||||
}
|
||||
}
|
||||
}
|
||||
//stepIndex++;
|
||||
if(flowApprovalRole != null){
|
||||
@ -341,6 +377,17 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
}else{
|
||||
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.SELF.getCode()) {//指定人员的
|
||||
//获取被考核人的必备权限
|
||||
if (selfMustRole.containsKey(flow.getChartId())) {
|
||||
flowChartRoles.addAll(selfMustRole.get(flow.getChartId()));
|
||||
} else {
|
||||
List<FlowChartRole> flowChartRoles1 =
|
||||
flowChartRoleService.selectFlowChartRolesByChartIdAndType(flow.getChartId(), 2);
|
||||
selfMustRole.put(flow.getChartId(), flowChartRoles1);
|
||||
flowChartRoles.addAll(flowChartRoles1);
|
||||
}
|
||||
}
|
||||
flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
@ -349,9 +396,25 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
|
||||
if(flowChartRoles != null && flowChartRoles.size() > 0){//设置必备权限
|
||||
String roles = flowChartRoles.stream().map(new Function<FlowChartRole, String>() {
|
||||
@Override
|
||||
public String apply(FlowChartRole flowChartRole) {
|
||||
return flowChartRole.getRoleId().toString();
|
||||
}
|
||||
}).collect(Collectors.joining(","));
|
||||
if(flowApprovalRole.getRoleId() == null || flowApprovalRole.getRoleId().length() == 0){
|
||||
flowApprovalRole.setRoleId(roles);
|
||||
}else{
|
||||
flowApprovalRole.setRoleId(flowApprovalRole.getRoleId() + "," + roles);
|
||||
}
|
||||
}
|
||||
|
||||
stepIndex++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//插入记录/flowChart/saveDetailProcs
|
||||
if(flowApprovalRoles.size() > 0){
|
||||
|
||||
@ -42,7 +42,8 @@ public class ChartController extends AbstractController{
|
||||
public R chartResult(@RequestParam(required = false) @ApiParam(name = "startId",value = "考核周期标识id") Long startId){
|
||||
List<ChartStatisticalRes> chartStatisticalRes = null;
|
||||
try {
|
||||
chartStatisticalRes = chartResultService.chartReport(startId);
|
||||
Long userId = getUserId();
|
||||
chartStatisticalRes = chartResultService.chartReport(startId,userId);
|
||||
} catch (Exception e) {
|
||||
log.error("获取绩效报表统计异常" ,e);
|
||||
return R.error();
|
||||
|
||||
@ -145,49 +145,15 @@ public class FlowChartController {
|
||||
if(flowChartDetailRecordListReq.getRecordSimpleDtos() != null && flowChartDetailRecordListReq.getRecordSimpleDtos().size() > 0){
|
||||
List<FlowChartDetailRecord> inserts = new ArrayList<>();
|
||||
List<FlowChartDetailRecord> updaes = new ArrayList<>();
|
||||
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
||||
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
||||
|
||||
int index = 0;
|
||||
for (FlowChartDetailRecordSimpleReq req:flowChartDetailRecordListReq.getRecordSimpleDtos()
|
||||
) {
|
||||
FlowChartDetailRecord flowChartDetailRecord = new FlowChartDetailRecord();
|
||||
BeanUtils.copyProperties(req, flowChartDetailRecord);
|
||||
flowChartDetailRecord.setChartId(flowChartDetailRecordListReq.getId());
|
||||
List<FlowChartRole> flowChartRoles = null;
|
||||
if(mustRole.containsKey(flowChartDetailRecordListReq.getId())){
|
||||
flowChartRoles = mustRole.get(flowChartDetailRecordListReq.getId());
|
||||
}else{
|
||||
flowChartRoles =
|
||||
flowChartRoleService.selectFlowChartRolesByChartIdAndType(flowChartDetailRecordListReq.getId(), 1);
|
||||
mustRole.put(flowChartDetailRecordListReq.getId(), flowChartRoles);
|
||||
}
|
||||
|
||||
if(flowChartDetailRecord.getOptType().intValue() == -1){//考核人是自己的
|
||||
//获取被考核人的必备权限
|
||||
if(selfMustRole.containsKey(flowChartDetailRecordListReq.getId())){
|
||||
flowChartRoles.addAll(selfMustRole.get(flowChartDetailRecordListReq.getId()));
|
||||
}else{
|
||||
List<FlowChartRole> flowChartRoles1 =
|
||||
flowChartRoleService.selectFlowChartRolesByChartIdAndType(flowChartDetailRecordListReq.getId(), 2);
|
||||
selfMustRole.put(flowChartDetailRecordListReq.getId(), flowChartRoles1);
|
||||
flowChartRoles.addAll(flowChartRoles1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(flowChartRoles != null && flowChartRoles.size() > 0){//设置必备权限
|
||||
String roles = flowChartRoles.stream().map(new Function<FlowChartRole, String>() {
|
||||
@Override
|
||||
public String apply(FlowChartRole flowChartRole) {
|
||||
return flowChartRole.getRoleId().toString();
|
||||
}
|
||||
}).collect(Collectors.joining(","));
|
||||
if(flowChartDetailRecord.getRoleIds() == null || flowChartDetailRecord.getRoleIds().length() == 0){
|
||||
flowChartDetailRecord.setRoleIds(roles);
|
||||
}else{
|
||||
flowChartDetailRecord.setRoleIds(flowChartDetailRecord.getRoleIds() + "," + roles);
|
||||
}
|
||||
}
|
||||
|
||||
flowChartDetailRecord.setEvaluationGroupId(flowChartDetailRecordListReq.getEvaluationGroupId());
|
||||
flowChartDetailRecord.setStepIndex(index);
|
||||
|
||||
@ -31,4 +31,6 @@ public class AssessDetailReq extends BasePage{
|
||||
//状态 确认 执行 结果录入。。。
|
||||
@ApiModelProperty(value = "状态 确认 执行 结果录入。。。",name = "flowProcess")
|
||||
private Integer flowProcess;
|
||||
|
||||
private List<String> departmentIds;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.lz.modules.equipment.entity.model.BasePage;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -19,4 +20,7 @@ public class AssessListReq extends BasePage {
|
||||
//组名称
|
||||
@ApiModelProperty(value = "考核名称",name = "name")
|
||||
private String name;
|
||||
|
||||
private Long staffId;
|
||||
|
||||
}
|
||||
|
||||
@ -22,4 +22,7 @@ public class ChartResultReq extends BasePage{
|
||||
|
||||
@ApiModelProperty(value = "等级",name = "scoreLevel")
|
||||
private Long scoreLevel;
|
||||
|
||||
private Long staffId;
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@ import java.util.List;
|
||||
@Data
|
||||
@ApiModel("考核详情列表实体")
|
||||
public class AssessManagerDetailRes {
|
||||
//头像
|
||||
@ApiModelProperty(value = "头像", name = "avatar")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "姓名",name = "staffName")
|
||||
private String staffName;
|
||||
|
||||
@ -17,9 +17,9 @@ public interface AssessService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param staffRole
|
||||
* @param staffId
|
||||
* @return null 为全部部门 size = 0 为没有部门
|
||||
*/
|
||||
List<Long> roleDepartment(StaffRole staffRole);
|
||||
List<String> roleDepartments(Long staffId);
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface ChartResultService {
|
||||
|
||||
List<ChartStatisticalRes> chartReport(Long startId);
|
||||
List<ChartStatisticalRes> chartReport(Long startId,Long staffId);
|
||||
|
||||
List<ChartStatistical> countDepartmentAndStaffNum(List<String>staffIds);
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.exception.RRException;
|
||||
@ -8,6 +9,7 @@ import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.StaffSimpleDto;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
@ -27,6 +29,7 @@ import com.lz.modules.performance.req.AssessToScoreReq;
|
||||
import com.lz.modules.performance.res.AssessManagerDetailRes;
|
||||
import com.lz.modules.performance.res.AssessManagerListRes;
|
||||
import com.lz.modules.performance.service.AssessManagerService;
|
||||
import com.lz.modules.performance.service.AssessService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
@ -71,6 +74,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
private EvaluationStartStaffMapper evaluationStartStaffMapper;
|
||||
@Autowired
|
||||
private FlowStartService flowStartService;
|
||||
@Autowired
|
||||
private AssessService assessService;
|
||||
|
||||
@Override
|
||||
public PageUtils assessList(AssessListReq req) {
|
||||
@ -80,8 +85,10 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
);
|
||||
List<FlowStart> list = pageUtils.getList();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
log.info("未找到考核发起数据");
|
||||
return pageUtils;
|
||||
}
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(req.getStaffId());
|
||||
list.forEach(flowStart -> {
|
||||
AssessManagerListRes res = new AssessManagerListRes();
|
||||
String name = flowStart.getName();
|
||||
@ -90,7 +97,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
if(name.contains("绩效考核")){
|
||||
res.setCycleTime(name.substring(0,name.lastIndexOf("绩效考核")));
|
||||
}
|
||||
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId());
|
||||
//过滤非自己管理的人员
|
||||
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds);
|
||||
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId());
|
||||
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "等人");
|
||||
data.add(res);
|
||||
@ -109,6 +117,12 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.selectAssessListByStartId(page,req)
|
||||
);
|
||||
List<AssessManagerDetailRes> list = pageUtils.getList();
|
||||
list.forEach(assessManagerDetailRes -> {
|
||||
StaffEntity staffEntity = staffService.selectStaffById(assessManagerDetailRes.getStaffId());
|
||||
assessManagerDetailRes.setAvatar(Optional.ofNullable(staffEntity.getAvatar()).orElse(StringUtil.EMPTY));
|
||||
});
|
||||
|
||||
return pageUtils;
|
||||
}
|
||||
|
||||
@ -227,8 +241,10 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
|
||||
List<Long> recordIds = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
|
||||
if(CollectionUtils.isEmpty(recordIds)){
|
||||
log.info("该考评组无数据 evaluationId:" + evaluation);
|
||||
continue;
|
||||
}
|
||||
log.info("本次评分更新操作 num: " + recordIds.size());
|
||||
recordIds.forEach(aLong -> {
|
||||
//更新流程绩效
|
||||
ApprovalDto approvalDto = new ApprovalDto();
|
||||
@ -236,7 +252,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
approvalDto.setResultRecordId(aLong);
|
||||
approvalDto.setMenuName("开始评分");
|
||||
try {
|
||||
resultRecordService.newApproval(approvalDto);
|
||||
R r = resultRecordService.newApproval(approvalDto);
|
||||
log.info("绩效id aLong :" + aLong + " ,res" + JSON.toJSONString(r));
|
||||
} catch (Exception e) {
|
||||
log.error("执行中状态跳过失败 recorId:" + aLong,e);
|
||||
}
|
||||
@ -248,7 +265,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
/* public static void main(String[] args) {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||
CompletableFuture<List<Long>> future = CompletableFuture.supplyAsync(()-> Arrays.asList(1L,2L),executorService);
|
||||
try {
|
||||
@ -259,6 +276,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
@ -8,10 +8,7 @@ import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.StaffRoleDepartment;
|
||||
import com.lz.modules.flow.service.FlowChangeService;
|
||||
import com.lz.modules.flow.service.FlowRecordService;
|
||||
import com.lz.modules.flow.service.StaffRoleDepartmentService;
|
||||
import com.lz.modules.flow.service.StaffRoleEvaluationGroupService;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.performance.dto.TaskListDto;
|
||||
import com.lz.modules.performance.req.AssessTaskReq;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
@ -49,6 +46,8 @@ public class AssessServiceImpl implements AssessService {
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
@Autowired
|
||||
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
|
||||
@Override
|
||||
public PageUtils userTaskList(AssessTaskReq req,Long userId) {
|
||||
@ -68,7 +67,7 @@ public class AssessServiceImpl implements AssessService {
|
||||
name = "您";
|
||||
}
|
||||
//根据状态拼接文案
|
||||
res.setTitle(name + "的" + taskListDto.getMonthTime() + "");
|
||||
res.setTitle(name + "的" + taskListDto.getMonthTime() + "绩效考核 ");
|
||||
res.setTime(DateUtils.format(taskListDto.getGmtModified(),DateUtils.DATE_TIME_PATTERN));
|
||||
//跳转绩效详情页
|
||||
res.setRecordId(taskListDto.getRecordId());
|
||||
@ -84,7 +83,8 @@ public class AssessServiceImpl implements AssessService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<Long> roleDepartment(StaffRole staffRole) {
|
||||
public List<String> roleDepartments(Long staffId) {
|
||||
StaffRole staffRole = staffRoleService.selectByStaffId(staffId);
|
||||
if(staffRole == null){
|
||||
log.info("staffRole 为空");
|
||||
return Collections.EMPTY_LIST;
|
||||
@ -103,7 +103,8 @@ public class AssessServiceImpl implements AssessService {
|
||||
allDepart.addAll(strings);
|
||||
});
|
||||
|
||||
List<Long> collect = allDepart.stream().distinct().map(s -> Long.valueOf(s)).collect(Collectors.toList());
|
||||
List<String> collect = allDepart.stream().distinct().collect(Collectors.toList());
|
||||
log.info("获取到权限对应的部门 " + JSON.toJSONString(collect));
|
||||
return collect;
|
||||
}
|
||||
log.info("未获取到用户权限对应的部门 roleID: " + staffRole.getId());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
@ -24,6 +25,7 @@ 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.AssessService;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
@ -62,15 +64,18 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
private DepartmentsService departmentsService;
|
||||
@Autowired
|
||||
private FlowChartService flowChartService;
|
||||
@Autowired
|
||||
private AssessService assessService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ChartStatisticalRes> chartReport(Long startId) {
|
||||
public List<ChartStatisticalRes> chartReport(Long startId,Long staffId) {
|
||||
String defaultTime = StringUtil.EMPTY;
|
||||
Integer defaultCycleType = null;
|
||||
FlowStart flowStart = null;
|
||||
if(startId==null){
|
||||
//取最近一条记录
|
||||
FlowStart flowStart = flowStartMapper.selectRecentlyLimt();
|
||||
flowStart = flowStartMapper.selectRecentlyLimt();
|
||||
if(flowStart!=null){
|
||||
log.info("首次进入,默认返回最新记录 flowStartId:" + flowStart.getId());
|
||||
startId = flowStart.getId();
|
||||
@ -80,10 +85,12 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
//自己管理的部门
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(staffId);
|
||||
List<ChartStatisticalRes> data = new ArrayList<>();
|
||||
ChartStatisticalRes res;
|
||||
|
||||
List<ChartStatistical> process = resultRecordService.countNumByFlowProcess(startId,null,null);
|
||||
List<ChartStatistical> process = resultRecordService.countNumByFlowProcess(startId,null,mandepartmentIds);
|
||||
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(0);
|
||||
@ -95,7 +102,7 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
}
|
||||
data.add(res);
|
||||
|
||||
List<ChartStatistical> scoreLevel = resultRecordService.countNumByScoreLevel(startId,null,null);
|
||||
List<ChartStatistical> scoreLevel = resultRecordService.countNumByScoreLevel(startId,null,mandepartmentIds);
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(1);
|
||||
res.setStatisticals(scoreLevel);
|
||||
@ -106,14 +113,24 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
}
|
||||
data.add(res);
|
||||
|
||||
FlowStart flowStart = flowStartMapper.selectFlowStartById(startId);
|
||||
//如果不是默认,获得发起考核信息
|
||||
if(flowStart == null){
|
||||
flowStart = flowStartMapper.selectFlowStartById(startId);
|
||||
}
|
||||
String[] split = flowStart.getGroupIds().split(",");
|
||||
Set<String> staffIds = new HashSet<>();
|
||||
for(String s:split){
|
||||
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(Long.valueOf(s));
|
||||
staffIds.addAll(strings);
|
||||
}
|
||||
List<String> all = new ArrayList<>(staffIds);
|
||||
log.info("chartReport 所有人员:" + JSON.toJSONString(staffIds));
|
||||
//自己管理的和发起的人员交集
|
||||
List<String> manstaffIds = staffService.staffsByAllDeparmentIds(mandepartmentIds);
|
||||
log.info("chartReport 管理人员:" + JSON.toJSONString(manstaffIds));
|
||||
manstaffIds.retainAll(staffIds);
|
||||
log.info("chartReport 交集人员:" + JSON.toJSONString(manstaffIds));
|
||||
|
||||
List<String> all = new ArrayList<>(manstaffIds);
|
||||
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(all);
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(2);
|
||||
@ -161,7 +178,13 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
@Override
|
||||
public PageUtils selectChartDetailList(ChartResultReq req) {
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
List<String> ids = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||
//自己管理的和所有的部门交集
|
||||
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds));
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(req.getStaffId());
|
||||
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
mandepartmentIds.retainAll(allDeparmentIds);
|
||||
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
List<String> ids = staffService.staffsByAllDeparmentIds(mandepartmentIds);
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.selectChartDetailList(page,ids,req.getStartId(),req.getScoreLevel())
|
||||
);
|
||||
|
||||
@ -73,15 +73,15 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<ChartStatistical> countNumByFlowProcess(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<Long> departmentIds);
|
||||
List<ChartStatistical> countNumByFlowProcess(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<String> departmentIds);
|
||||
|
||||
List<ChartStatistical> countNumByScoreLevel(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<Long> departmentIds);
|
||||
List<ChartStatistical> countNumByScoreLevel(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<String> departmentIds);
|
||||
|
||||
List<ResultRecord> selectChartDetailList(@Param("page") IPage page, @Param("staffIds") List<String> staffIds, @Param("startId")Long startId,@Param("scoreLevel")Long scoreLevel);
|
||||
|
||||
int batchDeleteByStartId(@Param("startId")Long startId);
|
||||
|
||||
int countStartAndGroupNum(@Param("startId")Long startId);
|
||||
int countStartAndGroupNum(@Param("startId")Long startId,@Param("departmentIds")List<String> departmentIds);
|
||||
|
||||
ResultRecord selectOneByStartId(@Param("startId")Long startId);
|
||||
|
||||
|
||||
@ -103,9 +103,9 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(Long staffId);
|
||||
|
||||
List<ChartStatistical> countNumByFlowProcess(Long startId,List<Long> evaluationIds,List<Long> departmentIds);
|
||||
List<ChartStatistical> countNumByFlowProcess(Long startId,List<Long> evaluationIds,List<String> departmentIds);
|
||||
|
||||
List<ChartStatistical> countNumByScoreLevel(Long startId,List<Long> evaluationIds,List<Long> departmentIds);
|
||||
List<ChartStatistical> countNumByScoreLevel(Long startId,List<Long> evaluationIds,List<String> departmentIds);
|
||||
|
||||
void batchDeleteByStaffIds(List<String> staffIds);
|
||||
|
||||
|
||||
@ -750,12 +750,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countNumByFlowProcess(Long startId,List<Long> evaluationIds,List<Long> departmentIds) {
|
||||
public List<ChartStatistical> countNumByFlowProcess(Long startId,List<Long> evaluationIds,List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByFlowProcess(startId,evaluationIds,departmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countNumByScoreLevel(Long startId,List<Long> evaluationIds,List<Long> departmentIds) {
|
||||
public List<ChartStatistical> countNumByScoreLevel(Long startId,List<Long> evaluationIds,List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByScoreLevel(startId,evaluationIds,departmentIds);
|
||||
}
|
||||
|
||||
|
||||
@ -420,6 +420,13 @@
|
||||
|
||||
<select id="countStartAndGroupNum" resultType="int">
|
||||
select COUNT(1) from lz_result_record where is_delete = 0 and start_id = #{startId}
|
||||
<if test="departmentIds !=null and departmentIds.size()!=0">
|
||||
and department_id in (
|
||||
<foreach collection="departmentIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectOneByStartId" resultType="com.lz.modules.sys.entity.app.ResultRecord">
|
||||
@ -478,6 +485,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="departmentIds !=null and departmentIds.size()!=0">
|
||||
and department_id in (
|
||||
<foreach collection="departmentIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY flow_process
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user