Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
wulin 2020-10-22 18:01:49 +08:00
commit b3e7fc8d51
5 changed files with 115 additions and 44 deletions

View File

@ -3,6 +3,7 @@ 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.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;
@ -12,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;
@ -40,40 +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("绩效考核")));
}
res.setJoinNum("");
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")
@ -94,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();

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -82,4 +82,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
void batchDeleteByStaffIdsAndMonth(@Param("staffIds")List<String> staffIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
int countStartAndGroupNum(@Param("startId")Long startId);
ResultRecord selectOneByStartId(@Param("startId")Long startId);
}

View File

@ -368,5 +368,10 @@
<select id="countStartAndGroupNum" resultType="int">
select COUNT(1) from lz_result_record where is_delete = 0 and start_id = #{startId}
</select>
<select id="selectOneByStartId" resultType="int">
select * from lz_result_record where is_delete = 0 and start_id = #{startId} limit 1
</select>
</mapper>