Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
b2a48efa49
@ -6,6 +6,7 @@ import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.performance.dto.SimpleDepartmentDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -59,4 +60,9 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||
|
||||
int delDepartments(@Param("list") List<DepartmentsEntity> departmentsEntities);
|
||||
|
||||
List<SimpleDepartmentDto> selectSimpleDepartmentByDepartmentIds(@Param("depIds") List<String> depIds);
|
||||
|
||||
SimpleDepartmentDto selectSimpleDepartmentByDepartmentId(@Param("departmentId") String departmentId);
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -35,4 +36,6 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
|
||||
List<String> removeDimissionStaffByStaffIds(@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<StaffOccupationEntity> selectAll();
|
||||
|
||||
List<StaffTypeDto> selectStaffTypesByStaffIds(@Param("staffIds")List<Long> staffIds);
|
||||
}
|
||||
|
||||
@ -61,5 +61,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
||||
List<DepartmentsEntity> selectAll();
|
||||
|
||||
int delDepartments(List<DepartmentsEntity> departmentsEntities);
|
||||
|
||||
Map<Long,List<String>> selectDepartmentTreeByDepIds(List<String> depIds);
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -35,5 +36,7 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
|
||||
List<String> removeDimissionStaffByStaffIds(List<String> staffIds);
|
||||
|
||||
List<StaffOccupationEntity> selectAll();
|
||||
|
||||
List<StaffTypeDto> selectStaffTypesByStaffIds(List<Long> staffIds);
|
||||
}
|
||||
|
||||
|
||||
@ -1,27 +1,28 @@
|
||||
package com.lz.modules.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.Query;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||
import com.lz.modules.app.dao.StaffDao;
|
||||
import com.lz.modules.app.dto.DepartmentInfos;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
import com.lz.modules.app.dto.StaffDto;
|
||||
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.StaffService;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||
import com.lz.modules.performance.dto.SimpleDepartmentDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -305,5 +306,65 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
||||
public int delDepartments(List<DepartmentsEntity> departmentsEntities){
|
||||
return departmentsDao.delDepartments(departmentsEntities);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Long, List<String>> selectDepartmentTreeByDepIds(List<String> depIds) {
|
||||
Map<Long, List<String>> data = Maps.newHashMap();
|
||||
if(CollectionUtils.isEmpty(depIds)){
|
||||
return data;
|
||||
}
|
||||
|
||||
List<SimpleDepartmentDto> simpleDepartmentDtos = departmentsDao.selectSimpleDepartmentByDepartmentIds(depIds);
|
||||
List<String> depNames = Lists.newArrayList();
|
||||
//将数据分类
|
||||
Map<Long,SimpleDepartmentDto> dtos = Maps.newHashMap();
|
||||
for (SimpleDepartmentDto simpleDepartmentDto:simpleDepartmentDtos){
|
||||
dtos.put(Long.valueOf(simpleDepartmentDto.getDepartmentId()),simpleDepartmentDto);
|
||||
}
|
||||
|
||||
for (SimpleDepartmentDto simpleDepartmentDto:simpleDepartmentDtos) {
|
||||
List<String> names = recursiveToBuild(depNames, simpleDepartmentDto, dtos,simpleDepartmentDto.getLevel());
|
||||
data.put(Long.valueOf(simpleDepartmentDto.getDepartmentId()),names);
|
||||
}
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data 响应数据
|
||||
* @param departmentDto 当前部门信息
|
||||
* @param dtos 缓存,存在就不查数据库
|
||||
* @return
|
||||
*/
|
||||
private List<String> recursiveToBuild(List<String> data, SimpleDepartmentDto departmentDto,Map<Long,SimpleDepartmentDto> dtos, int level){
|
||||
if(departmentDto == null){
|
||||
logger.info("部门信息为空,截至当前数据data: " + JSON.toJSONString(data));
|
||||
return data;
|
||||
}
|
||||
data.add(departmentDto.getDepartmentName());
|
||||
if(level == 0){
|
||||
logger.info("部门级别为0,departmentId: " + departmentDto.getDepartmentId());
|
||||
return data;
|
||||
}
|
||||
if(level == data.size()){
|
||||
logger.info("数据填充结束,departmentId: " + departmentDto.getDepartmentId() + " ,level: " + level);
|
||||
return data;
|
||||
}
|
||||
SimpleDepartmentDto existSimpleDepartment = dtos.get(departmentDto.getDepartmentParentId());
|
||||
|
||||
if(existSimpleDepartment!=null){
|
||||
return recursiveToBuild(data,existSimpleDepartment,dtos,level);
|
||||
}
|
||||
else {
|
||||
SimpleDepartmentDto simpleDepartmentDto = departmentsDao.selectSimpleDepartmentByDepartmentId(departmentDto.getDepartmentParentId());
|
||||
if(simpleDepartmentDto!=null){
|
||||
dtos.put(Long.valueOf(departmentDto.getDepartmentParentId()),simpleDepartmentDto);
|
||||
}
|
||||
return recursiveToBuild(data,simpleDepartmentDto,dtos,level);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.lz.modules.app.dao.StaffOccupationDao;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.app.service.StaffOccupationService;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -77,4 +78,9 @@ public class StaffOccupationServiceImpl extends ServiceImpl<StaffOccupationDao,
|
||||
public List<StaffOccupationEntity> selectAll(){
|
||||
return staffOccupationDao.selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffTypeDto> selectStaffTypesByStaffIds(List<Long> staffIds) {
|
||||
return staffOccupationDao.selectStaffTypesByStaffIds(staffIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
package com.lz.modules.performance.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -35,40 +40,34 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/performance")
|
||||
@Slf4j
|
||||
@Api(value="导出excel接口", tags={"导出表格"})
|
||||
public class ExportController {
|
||||
@Autowired
|
||||
private ChartResultService chartResultService;
|
||||
|
||||
|
||||
@GetMapping("/export/levelDetail")
|
||||
public R levelDetail(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) ChartResultReq req,HttpServletResponse response){
|
||||
PageUtils pageUtils;
|
||||
@PostMapping("/export/levelDetail")
|
||||
@ApiOperation("导出等级详情")
|
||||
public void levelDetail(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) ChartResultReq req,HttpServletResponse response){
|
||||
List<LevelDetailExportRes> levelDetailExportRes = Lists.newArrayList();
|
||||
try {
|
||||
//Long userId = getUserId();
|
||||
Long userId = 313L;
|
||||
req.setLoginUserId(userId);
|
||||
pageUtils = chartResultService.selectChartDetailList(req);
|
||||
levelDetailExportRes = chartResultService.selectLevelDetailList(req);
|
||||
} catch (Exception e) {
|
||||
log.error("获取报表等级详情数据异常" ,e);
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
List list = pageUtils.getList();
|
||||
ExcelWriter writer = ExcelUtil.getWriter();
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
List<String> rowHead = CollUtil.newArrayList("序号", "工号", "员工姓名", "当月状态", "一级部门", "二级部门", "三级部门", "职位", "员工月度绩效考核评分","员工月度绩效考核结果等级");
|
||||
List<LevelDetailExportRes> data = Lists.newArrayList();
|
||||
|
||||
writer.addHeaderAlias("name", "姓名");
|
||||
writer.addHeaderAlias("age", "年龄");
|
||||
ExcelWriter writer = ExcelUtil.getWriter();
|
||||
buildData(LevelDetailExportRes.class,null,writer);
|
||||
writer.merge(1, "员工信息表");
|
||||
writer.write(list, true);
|
||||
writer.write(data, true);
|
||||
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||
String name = null;
|
||||
try {
|
||||
//name = new String("XXX国际贸易公司".getBytes("UTF-8"));
|
||||
name = new String("XXX国际贸易公司".getBytes("UTF-8"),"utf-8");
|
||||
System.out.println("-----" + name);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String name = "test测试";
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + name + ".xls");
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
@ -80,13 +79,14 @@ public class ExportController {
|
||||
writer.close();
|
||||
}
|
||||
IoUtil.close(out);
|
||||
return R.ok().put("data",pageUtils);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//对应实体属性名与表列名
|
||||
private void buildData(Class<?> data,List<String> tags,ExcelWriter writer){
|
||||
if(data == null || CollectionUtils.isEmpty(tags)){
|
||||
log.info("导出excel-实体属性或数据为空!");
|
||||
@ -97,11 +97,10 @@ public class ExportController {
|
||||
log.info("导出excel-实体属性与数据大小不一致!");
|
||||
return;
|
||||
}
|
||||
System.out.println(fields.length);
|
||||
for(int i=0; i<fields.length; i++){
|
||||
Field field = fields[i];
|
||||
field.setAccessible(true);
|
||||
System.out.println("属性名:" + field.getName());
|
||||
writer.addHeaderAlias(field.getName(), tags.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 16:37
|
||||
*/
|
||||
@Data
|
||||
public class SimpleDepartmentDto {
|
||||
//部门id
|
||||
private String departmentId;
|
||||
//上级部门id
|
||||
private String departmentParentId;
|
||||
//组织架构名称/部门名称
|
||||
private String departmentName;
|
||||
//第几级部门
|
||||
private Integer level;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 16:11
|
||||
*/
|
||||
@Data
|
||||
public class StaffTypeDto {
|
||||
//员工类型
|
||||
private int staffType;
|
||||
//员工id
|
||||
private Long staffId;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.lz.modules.performance.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 15:04
|
||||
*/
|
||||
@Data
|
||||
public class LevelDetailExportRes {
|
||||
//序号
|
||||
private Long id;
|
||||
//工号
|
||||
private String staffNo;
|
||||
//姓名
|
||||
private String staffName;
|
||||
//员工id
|
||||
private Long staffId;
|
||||
//当月状态
|
||||
private int staffType;
|
||||
//所属部门
|
||||
private Long departmentId;
|
||||
//一级部门
|
||||
private int departmentOne;
|
||||
//二级部门
|
||||
private int departmentTwo;
|
||||
//三级部门
|
||||
private int departmentThree;
|
||||
//职位
|
||||
private String departmentName;
|
||||
//员工月度绩效考核评分
|
||||
private String allScore;
|
||||
//员工月度绩效考核结果等级
|
||||
private String scoreLevel;
|
||||
|
||||
|
||||
}
|
||||
@ -8,6 +8,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.res.LevelDetailExportRes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -28,4 +29,6 @@ public interface ChartResultService {
|
||||
|
||||
List<ChartStatistical> countAssessNumByFlowProcess(AssessDetailReq req);
|
||||
|
||||
List<LevelDetailExportRes> selectLevelDetailList(ChartResultReq req);
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ 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.StaffOccupationService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.EvaluationGroupMapper;
|
||||
import com.lz.modules.flow.dao.FlowChartMapper;
|
||||
@ -23,6 +24,7 @@ import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.FlowChartService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import com.lz.modules.performance.enums.ResultFlowProcessEnum;
|
||||
import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
@ -30,6 +32,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.res.LevelDetailExportRes;
|
||||
import com.lz.modules.performance.service.AssessService;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
@ -75,6 +78,8 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
private AssessService assessService;
|
||||
@Autowired
|
||||
private EvaluationGroupMapper evaluationGroupMapper;
|
||||
@Autowired
|
||||
private StaffOccupationService staffOccupationService;
|
||||
|
||||
private static final Long processId = 1L;
|
||||
|
||||
@ -183,34 +188,7 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
|
||||
@Override
|
||||
public PageUtils selectChartDetailList(ChartResultReq req) {
|
||||
String departmentIds = req.getDepartmentIds();
|
||||
Set<String> allDepart = Sets.newHashSet();
|
||||
if(StringUtil.isNotBlank(departmentIds)){
|
||||
String[] split = departmentIds.split(",");
|
||||
for(String s:split){
|
||||
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
allDepart.addAll(deparmentIds);
|
||||
}
|
||||
}
|
||||
List<String> allDeparmentIds = new ArrayList<>(allDepart);
|
||||
//自己管理的和所有的部门交集
|
||||
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
|
||||
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();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//如果掌管所有部门,查询请求部门
|
||||
mandepartmentIds = allDeparmentIds;
|
||||
}
|
||||
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
List<String> mandepartmentIds = getMandepartmentIds(req.getDepartmentIds(), req.getLoginUserId());
|
||||
List<String> finalMandepartmentIds = mandepartmentIds;
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.selectChartDetailList(page, finalMandepartmentIds,req.getStartId(),req.getScoreLevel())
|
||||
@ -261,6 +239,27 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<LevelDetailExportRes> selectLevelDetailList(ChartResultReq req) {
|
||||
List<String> mandepartmentIds = getMandepartmentIds(req.getDepartmentIds(), req.getLoginUserId());
|
||||
List<LevelDetailExportRes> levelDetailExportRes = resultRecordMapper.selectLevelDetailList(mandepartmentIds, req.getStartId(), req.getScoreLevel());
|
||||
|
||||
if(CollectionUtils.isEmpty(levelDetailExportRes)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> staffIds = levelDetailExportRes.stream().map(LevelDetailExportRes::getStaffId).collect(Collectors.toList());
|
||||
List<String> depIds = levelDetailExportRes.stream().map(levelDetailExportRes1 -> levelDetailExportRes1.getDepartmentId().toString()).collect(Collectors.toList());
|
||||
|
||||
List<StaffTypeDto> staffTypeDtos = staffOccupationService.selectStaffTypesByStaffIds(staffIds);
|
||||
Map<Long, List<String>> map = departmentsService.selectDepartmentTreeByDepIds(depIds);
|
||||
|
||||
//TODO 整合数据
|
||||
|
||||
return levelDetailExportRes;
|
||||
|
||||
}
|
||||
|
||||
//构建流程默认人数
|
||||
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds,AssessDetailReq req){
|
||||
List<ChartStatistical> data = Lists.newArrayList();
|
||||
@ -314,4 +313,36 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
});
|
||||
return depStaffs;
|
||||
}
|
||||
|
||||
private List<String> getMandepartmentIds(String departmentIds,Long loginUserId){
|
||||
Set<String> allDepart = Sets.newHashSet();
|
||||
if(StringUtil.isNotBlank(departmentIds)){
|
||||
String[] split = departmentIds.split(",");
|
||||
for(String s:split){
|
||||
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
allDepart.addAll(deparmentIds);
|
||||
}
|
||||
}
|
||||
List<String> allDeparmentIds = new ArrayList<>(allDepart);
|
||||
//自己管理的和所有的部门交集
|
||||
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(loginUserId);
|
||||
if(mandepartmentIds!=null ){
|
||||
if(mandepartmentIds.size()==0){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
mandepartmentIds.retainAll(allDeparmentIds);
|
||||
if(mandepartmentIds.size()==0){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//如果掌管所有部门,查询请求部门
|
||||
mandepartmentIds = allDeparmentIds;
|
||||
}
|
||||
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
return mandepartmentIds;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.req.OwnResultReq;
|
||||
import com.lz.modules.performance.res.AssessManagerDetailRes;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -108,4 +109,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordsByStartId(Long startId);
|
||||
|
||||
List<LevelDetailExportRes> selectLevelDetailList(@Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId, @Param("scoreLevel")String scoreLevel);
|
||||
|
||||
|
||||
}
|
||||
@ -619,6 +619,29 @@
|
||||
and start_id = #{startId}
|
||||
</select>
|
||||
|
||||
<select id="selectLevelDetailList" resultType="com.lz.modules.performance.res.LevelDetailExportRes">
|
||||
SELECT r.id,all_score,department_id,staff_name,staff_id,score_level,job_number staffNo from lz_result_record r
|
||||
LEFT JOIN lz_staff s
|
||||
on r.staff_id = s.id
|
||||
where r.is_delete =0 and s.is_delete=0
|
||||
and r.start_id = #{startId}
|
||||
<if test="departmentIds!=null and departmentIds.size()!=0">
|
||||
and r.department_id in (
|
||||
<foreach collection="departmentIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="scoreLevel !=null">
|
||||
<if test="scoreLevel == ''">
|
||||
and r.score_level is null
|
||||
</if>
|
||||
<if test="scoreLevel != ''">
|
||||
and r.score_level = #{scoreLevel}
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY all_score desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -188,4 +188,22 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectSimpleDepartmentByDepartmentIds" resultType="com.lz.modules.performance.dto.SimpleDepartmentDto">
|
||||
select department_id,department_parent_id,department_name,level from lz_departments where
|
||||
is_delete = 0 and status = 1 and
|
||||
department_id in (
|
||||
<foreach collection="depIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectSimpleDepartmentByDepartmentId" resultType="com.lz.modules.performance.dto.SimpleDepartmentDto">
|
||||
select department_id,department_parent_id,department_name,level from lz_departments where
|
||||
is_delete = 0 and status = 1 and
|
||||
department_id =#{departmentId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -72,4 +72,14 @@
|
||||
select * from lz_staff_occupation where is_delete=0
|
||||
</select>
|
||||
|
||||
<select id="selectStaffTypesByStaffIds" resultType="com.lz.modules.performance.dto.StaffTypeDto">
|
||||
select staff_id,staff_type from lz_staff_occupation
|
||||
where is_delete = 0 and staff_status = 0 and
|
||||
staff_id in
|
||||
<foreach collection="staffIds" item="staff_id" open="(" close=")"
|
||||
separator=",">
|
||||
#{staff_id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user