提交修改

This commit is contained in:
quyixiao 2020-11-10 15:38:44 +08:00
commit f786cb20ec
5 changed files with 49 additions and 29 deletions

View File

@ -91,7 +91,7 @@ public class ChartController extends AbstractController{
@RequestMapping("/own/result")
@PostMapping("/own/result")
@ApiOperation("获取个人成长曲线")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = OwnResultResp.class)})
public R ownResult(Long userId){

View File

@ -116,9 +116,15 @@ public class AssessManagerServiceImpl implements AssessManagerService {
res.setCycleTime(name.substring(0,name.lastIndexOf("绩效考核")));
}
//过滤非自己管理的人员
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds);
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId());
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "等人");
//没有管理的部门
if(mandepartmentIds!=null && mandepartmentIds.size()==0){
res.setJoinNum("0人");
}else {
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds);
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "等人");
}
data.add(res);
});
PageUtils pages = new PageUtils();
@ -136,6 +142,12 @@ public class AssessManagerServiceImpl implements AssessManagerService {
if(StringUtil.isNotBlank(req.getEvaluationIds())){
req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId()));
}
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
//没有管理的部门
if(mandepartmentIds!=null && mandepartmentIds.size()==0){
return new PageUtils();
}
req.setDepartmentIds(mandepartmentIds);
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> resultRecordMapper.selectAssessListByStartId(page,req)
);

View File

@ -9,6 +9,7 @@ import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
@ -38,6 +39,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author: djc
@ -93,6 +96,9 @@ public class ChartResultServiceImpl implements ChartResultService {
}
//自己管理的部门
List<String> mandepartmentIds = assessService.roleDepartments(staffId);
if(mandepartmentIds!=null && mandepartmentIds.size()==0){
return Lists.newArrayList();
}
List<ChartStatisticalRes> data = Lists.newArrayList();
ChartStatisticalRes res;
@ -120,24 +126,16 @@ public class ChartResultServiceImpl implements ChartResultService {
data.add(res);
//如果不是默认获得发起考核信息
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);
}
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);
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("start_id", startId)
.in(mandepartmentIds != null, "department_id", mandepartmentIds).select("staff_id"));
if(CollectionUtils.isEmpty(objects)){
return data;
}
List<String> collect = objects.stream().map(o -> String.valueOf(o)).collect(Collectors.toList());
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(collect);
res = new ChartStatisticalRes();
res.setType(2);
res.setStatisticals(buildDepStaffs(depstaff));
@ -187,12 +185,19 @@ public class ChartResultServiceImpl implements ChartResultService {
//自己管理的和所有的部门交集
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds));
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
mandepartmentIds.retainAll(allDeparmentIds);
if(mandepartmentIds!=null ){
if(mandepartmentIds.size()==0){
return new PageUtils();
}
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
mandepartmentIds.retainAll(allDeparmentIds);
if(mandepartmentIds.size()==0){
return new PageUtils();
}
}
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())
page -> resultRecordMapper.selectChartDetailList(page,mandepartmentIds,req.getStartId(),req.getScoreLevel())
);
return pageUtils;
}
@ -228,6 +233,9 @@ public class ChartResultServiceImpl implements ChartResultService {
req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId()));
//获取自己管理的部门
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
if(mandepartmentIds!=null && mandepartmentIds.size()==0){
return Lists.newArrayList();
}
req.setDepartmentIds(mandepartmentIds);
List<ChartStatistical> process = resultRecordMapper.countAssessNumByFlowProcess(req);
List<ChartStatistical> data = buildProcess(process, req.getStartId(),mandepartmentIds,req);

View File

@ -79,7 +79,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
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);
List<ResultRecord> selectChartDetailList(@Param("page") IPage page, @Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId,@Param("scoreLevel")Long scoreLevel);
int batchDeleteByStartId(@Param("startId")Long startId);

View File

@ -404,10 +404,10 @@
on r.staff_id = s.id
where r.is_delete =0 and s.is_delete=0
and r.start_id = #{startId}
<if test="staffIds!=null and staffIds.size()!=0">
and r.staff_id in (
<foreach collection="staffIds" item="staff_id" separator=",">
#{staff_id}
<if test="departmentIds!=null and departmentIds.size()!=0">
and r.department_id in (
<foreach collection="departmentIds" item="department_id" separator=",">
#{department_id}
</foreach>
)
</if>