fix
This commit is contained in:
parent
88bb449061
commit
246ee43638
@ -13,6 +13,7 @@ import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.res.AssessManagerDetailRes;
|
||||
import com.lz.modules.performance.res.AssessManagerListRes;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.service.AssessManagerService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -41,41 +42,13 @@ public class AssessManagerController {
|
||||
@Autowired
|
||||
private FlowStartMapper flowStartMapper;
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
@Autowired
|
||||
private ResultRecordMapper resultRecordMapper;
|
||||
private AssessManagerService assessManagerService;
|
||||
|
||||
|
||||
@RequestMapping("assess/manager/list")
|
||||
public R assessList(@RequestBody AssessListReq req){
|
||||
List<AssessManagerListRes> data = new ArrayList<>();
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> flowStartMapper.selectListByTime(page,req.getCycleType(),req.getName())
|
||||
);
|
||||
List<FlowStart> list = pageUtils.getList();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return R.ok().put("data",pageUtils);
|
||||
}
|
||||
list.forEach(flowStart -> {
|
||||
AssessManagerListRes res = new AssessManagerListRes();
|
||||
String name = flowStart.getName();
|
||||
res.setId(flowStart.getId());
|
||||
res.setName(name);
|
||||
if(name.contains("绩效考核")){
|
||||
res.setCycleTime(name.substring(0,name.lastIndexOf("绩效考核")));
|
||||
}
|
||||
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId());
|
||||
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId());
|
||||
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "人");
|
||||
data.add(res);
|
||||
});
|
||||
PageUtils pages = new PageUtils();
|
||||
pages.setTotalPage(pageUtils.getTotalPage());
|
||||
pages.setTotalCount(pageUtils.getTotalCount());
|
||||
pages.setCurrPage(req.getCurrPage());
|
||||
pages.setPageSize(req.getPageSize());
|
||||
pages.setList(data);
|
||||
return R.ok().put("data",pages);
|
||||
PageUtils pageUtils = assessManagerService.assessList(req);
|
||||
return R.ok().put("data",pageUtils);
|
||||
}
|
||||
|
||||
@RequestMapping("assess/manager/detail")
|
||||
@ -96,20 +69,7 @@ public class AssessManagerController {
|
||||
if(flowStart == null){
|
||||
return R.error("没有此条记录");
|
||||
}
|
||||
String[] split = flowStart.getGroupIds().split(",");
|
||||
List<Long> collect = Arrays.asList(split).stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(collect);
|
||||
if(CollectionUtils.isEmpty(evaluationGroups)){
|
||||
return R.ok();
|
||||
}
|
||||
Set<String> staffIds = new HashSet<>();
|
||||
evaluationGroups.stream().forEach(evaluationGroup -> {
|
||||
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(evaluationGroup.getId());
|
||||
staffIds.addAll(strings);
|
||||
});
|
||||
List<String> distStaffIds = new ArrayList<>(staffIds);
|
||||
// 批量删除
|
||||
resultRecordMapper.batchDeleteByStaffIdsAndMonth(distStaffIds,"","");
|
||||
assessManagerService.assessDelete(flowStart);
|
||||
return R.ok();
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package com.lz.modules.performance.service;
|
||||
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/10/22 17:27
|
||||
*/
|
||||
public interface AssessManagerService {
|
||||
|
||||
PageUtils assessList(AssessListReq req);
|
||||
|
||||
void assessDelete(FlowStart flowStart);
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.res.AssessManagerListRes;
|
||||
import com.lz.modules.performance.service.AssessManagerService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.sun.org.apache.regexp.internal.RE;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/10/22 17:28
|
||||
*/
|
||||
public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
@Autowired
|
||||
private FlowStartMapper flowStartMapper;
|
||||
@Autowired
|
||||
private ResultRecordMapper resultRecordMapper;
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@Override
|
||||
public PageUtils assessList(AssessListReq req) {
|
||||
List<AssessManagerListRes> data = new ArrayList<>();
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> flowStartMapper.selectListByTime(page,req.getCycleType(),req.getName())
|
||||
);
|
||||
List<FlowStart> list = pageUtils.getList();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return pageUtils;
|
||||
}
|
||||
list.forEach(flowStart -> {
|
||||
AssessManagerListRes res = new AssessManagerListRes();
|
||||
String name = flowStart.getName();
|
||||
res.setId(flowStart.getId());
|
||||
res.setName(name);
|
||||
if(name.contains("绩效考核")){
|
||||
res.setCycleTime(name.substring(0,name.lastIndexOf("绩效考核")));
|
||||
}
|
||||
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId());
|
||||
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId());
|
||||
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "人");
|
||||
data.add(res);
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assessDelete(FlowStart flowStart) {
|
||||
String[] split = flowStart.getGroupIds().split(",");
|
||||
List<Long> collect = Arrays.asList(split).stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(collect);
|
||||
if(CollectionUtils.isEmpty(evaluationGroups)){
|
||||
return ;
|
||||
}
|
||||
Set<String> staffIds = new HashSet<>();
|
||||
evaluationGroups.stream().forEach(evaluationGroup -> {
|
||||
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(evaluationGroup.getId());
|
||||
staffIds.addAll(strings);
|
||||
});
|
||||
List<String> distStaffIds = new ArrayList<>(staffIds);
|
||||
// 批量删除
|
||||
resultRecordMapper.batchDeleteByStaffIdsAndMonth(distStaffIds,"","");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user