解决冲突
This commit is contained in:
commit
8b562bd684
@ -34,6 +34,9 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
|
||||
|
||||
R deleteEvaluationGroupById(Long id);
|
||||
|
||||
//获取参与考核的所有人员
|
||||
List<String> selectAllStaffIdsByGroupId(Long id);
|
||||
|
||||
|
||||
PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req);
|
||||
}
|
||||
@ -5,14 +5,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.ISelect;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.EvaluationGroupMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -29,6 +31,8 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
|
||||
@Autowired
|
||||
private EvaluationGroupMapper evaluationGroupMapper;
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
|
||||
|
||||
@ -73,4 +77,32 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
return pageUtils;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> selectAllStaffIdsByGroupId(Long id) {
|
||||
EvaluationGroup evaluationGroup = this.selectEvaluationGroupById(id);
|
||||
String depIds = evaluationGroup.getDepIds();
|
||||
Set<String> allDeparmentIds = new HashSet<>();
|
||||
if(StringUtils.isNotBlank(depIds)){
|
||||
String[] split = depIds.split(",");
|
||||
for(String s:split){
|
||||
List<String> strings = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
allDeparmentIds.addAll(strings);
|
||||
}
|
||||
}
|
||||
List<String> depStaffIds = staffService.staffsByAllDeparmentIds(new ArrayList<>(allDeparmentIds));
|
||||
|
||||
String staffIds = evaluationGroup.getStaffIds();
|
||||
if(StringUtils.isNotBlank(staffIds)){
|
||||
String[] split = staffIds.split(",");
|
||||
depStaffIds.addAll(Arrays.asList(split));
|
||||
}
|
||||
String outIds = evaluationGroup.getOutIds();
|
||||
if(StringUtils.isNotBlank(outIds)){
|
||||
String[] split = outIds.split(",");
|
||||
depStaffIds.removeAll(Arrays.asList(split));
|
||||
}
|
||||
//去重
|
||||
return new ArrayList<>(new HashSet(depStaffIds));
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.lz.modules.performance.res.TaskListRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -29,20 +31,13 @@ import java.util.List;
|
||||
public class ChartController extends AbstractController{
|
||||
@Autowired
|
||||
private ChartResultService chartResultService;
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@PostMapping("chart/result")
|
||||
@ApiOperation("获取绩效报表统计")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)})
|
||||
public R chartResult(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) ChartResultReq req){
|
||||
List<ChartStatisticalRes> data = new ArrayList<>();
|
||||
chartResultService.chartReport(req);
|
||||
EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(1L);
|
||||
String depIds = evaluationGroup.getDepIds();
|
||||
String staffIds = evaluationGroup.getStaffIds();
|
||||
String outIds = evaluationGroup.getOutIds();
|
||||
return R.ok();
|
||||
List<ChartStatisticalRes> chartStatisticalRes = chartResultService.chartReport(req);
|
||||
return R.ok().put("data",chartStatisticalRes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.lz.modules.performance.res;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "报表统计实体")
|
||||
public class ChartStatistical {
|
||||
@ApiModelProperty(value = "描述",name = "desc")
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty(value = "人数",name = "num")
|
||||
private int num;
|
||||
}
|
||||
@ -14,19 +14,10 @@ import java.util.List;
|
||||
@Data
|
||||
@ApiModel(value = "绩效报表统计实体")
|
||||
public class ChartStatisticalRes {
|
||||
@ApiModelProperty(value = "类型 0:节点统计 1:人数统计 2:等级统计",name = "type")
|
||||
@ApiModelProperty(value = "类型 0:节点统计 1:等级统计 2:人数统计 ",name = "type")
|
||||
private int type;
|
||||
|
||||
private List<ChartStatistical> data;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "报表统计实体")
|
||||
class ChartStatistical {
|
||||
@ApiModelProperty(value = "描述",name = "desc")
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty(value = "人数",name = "num")
|
||||
private int num;
|
||||
}
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
package com.lz.modules.performance.service;
|
||||
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -8,5 +13,9 @@ import com.lz.modules.performance.req.ChartResultReq;
|
||||
* @Date: 2020/10/14 16:52
|
||||
*/
|
||||
public interface ChartResultService {
|
||||
void chartReport(ChartResultReq req);
|
||||
|
||||
List<ChartStatisticalRes> chartReport(ChartResultReq req);
|
||||
|
||||
List<ChartStatistical> countDepartmentAndStaffNum(List<String>staffIds);
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,25 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -18,14 +28,63 @@ import java.util.List;
|
||||
*/
|
||||
@Service("chartResultService")
|
||||
public class ChartResultServiceImpl implements ChartResultService {
|
||||
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
@Override
|
||||
public void chartReport(ChartResultReq req) {
|
||||
AssessListReq query = new AssessListReq();
|
||||
BeanUtils.copyProperties(req,query);
|
||||
List<ChartStatisticalRes> chartStatisticalRes = resultRecordService.countNumByFlowProcess(query);
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@Override
|
||||
public List<ChartStatisticalRes> chartReport(ChartResultReq req) {
|
||||
List<ChartStatisticalRes> data = new ArrayList<>();
|
||||
AssessListReq query = new AssessListReq();
|
||||
ChartStatisticalRes res = null;
|
||||
BeanUtils.copyProperties(req,query);
|
||||
List<ChartStatistical> process = resultRecordService.countNumByFlowProcess(query);
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(0);
|
||||
res.setData(process);
|
||||
List<ChartStatistical> scoreLevel = resultRecordService.countNumByScoreLevel(query);
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(1);
|
||||
res.setData(scoreLevel);
|
||||
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(1L);
|
||||
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(strings);
|
||||
res = new ChartStatisticalRes();
|
||||
res.setType(2);
|
||||
res.setData(depstaff);
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countDepartmentAndStaffNum(List<String> staffIds) {
|
||||
if(CollectionUtils.isEmpty(staffIds)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<ChartStatistical> data = new ArrayList<>();
|
||||
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
|
||||
.eq("is_delete", 0)
|
||||
.in("staff_id", staffIds));
|
||||
Map<String,Integer> map = Maps.newHashMap();
|
||||
for(DepartmentsStaffRelateEntity entity:list){
|
||||
String departmentId = entity.getDepartmentId();
|
||||
Integer count = map.get(departmentId);
|
||||
if(null != count){
|
||||
map.put(departmentId,count + 1);
|
||||
}else {
|
||||
map.put(departmentId,1);
|
||||
}
|
||||
}
|
||||
for(String s:map.keySet()){
|
||||
ChartStatistical statistical = new ChartStatistical();
|
||||
statistical.setDesc(s);
|
||||
statistical.setNum(map.get(s));
|
||||
data.add(statistical);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -72,6 +73,8 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<ChartStatisticalRes> countNumByFlowProcess(@Param("req") AssessListReq req);
|
||||
List<ChartStatistical> countNumByFlowProcess(@Param("req") AssessListReq req);
|
||||
|
||||
List<ChartStatistical> countNumByScoreLevel(@Param("req") AssessListReq req);
|
||||
|
||||
}
|
||||
@ -15,6 +15,7 @@ import com.lz.modules.app.utils.t.TwoTuple;
|
||||
import com.lz.modules.flow.entity.Flow;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
@ -103,5 +104,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(Long staffId);
|
||||
|
||||
List<ChartStatisticalRes> countNumByFlowProcess(AssessListReq req);
|
||||
List<ChartStatistical> countNumByFlowProcess(AssessListReq req);
|
||||
|
||||
List<ChartStatistical> countNumByScoreLevel(AssessListReq req);
|
||||
}
|
||||
@ -28,6 +28,7 @@ import com.lz.modules.flow.model.TypeRoleDto;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.job.business.DingtalkBusiness;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
@ -733,7 +734,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatisticalRes> countNumByFlowProcess(AssessListReq req) {
|
||||
public List<ChartStatistical> countNumByFlowProcess(AssessListReq req) {
|
||||
return resultRecordMapper.countNumByFlowProcess(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countNumByScoreLevel(AssessListReq req) {
|
||||
return resultRecordMapper.countNumByScoreLevel(req);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,9 +338,12 @@
|
||||
select * from lz_result_record where staff_id = #{staffId}
|
||||
</select>
|
||||
|
||||
<select id="countNumByFlowProcess" resultType="com.lz.modules.performance.res.ChartStatisticalRes">
|
||||
<select id="countNumByFlowProcess" resultType="com.lz.modules.performance.res.ChartStatistical">
|
||||
SELECT count(flow_process) num,flow_process type from lz_result_record where is_delete=0 GROUP BY flow_process
|
||||
</select>
|
||||
<select id="countNumByScoreLevel" resultType="com.lz.modules.performance.res.ChartStatistical">
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user