fix
This commit is contained in:
parent
b776c8418e
commit
8cdd665768
@ -69,7 +69,7 @@ public class ShiroConfig {
|
||||
filterMap.put("/dtlg/jump", "anon");
|
||||
filterMap.put("/luck/getLuckById", "anon");
|
||||
filterMap.put("/luck/updateLuck", "anon");
|
||||
filterMap.put("/report/**","anon");
|
||||
filterMap.put("/result/**","anon");
|
||||
filterMap.put("/**", "oauth2");
|
||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.enums.ResultRecordStatusEnum;
|
||||
import com.lz.modules.app.enums.ResultRecordTypeEnum;
|
||||
import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultDistributionReq;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.app.resp.ReportChartResp;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
@ -49,13 +50,17 @@ public class ReportResultController extends AbstractController{
|
||||
@Autowired
|
||||
private ChartService chartService;
|
||||
|
||||
static final String[] levels = new String[]{"3.25","3.5-","3.5","3.5+","3.75-","3.75","3.75+","4"};
|
||||
|
||||
|
||||
@RequestMapping("chart")
|
||||
public R reportChart(String selectMonthTime,String departmentId){
|
||||
if(StringUtil.isBlank(selectMonthTime)){
|
||||
selectMonthTime = YearMonth.now().toString();
|
||||
}
|
||||
Long userId = getUserId();
|
||||
//是自己部门得领导
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectByStaffId(userId);
|
||||
if("1".equals(departmentsStaffRelateEntity.getIsLeader())){
|
||||
|
||||
}
|
||||
ReportChartResp reportChartResp = chartService.reportChart(selectMonthTime, departmentId);
|
||||
return R.ok().put("data",reportChartResp);
|
||||
@ -74,6 +79,22 @@ public class ReportResultController extends AbstractController{
|
||||
}
|
||||
|
||||
|
||||
// 未解决问题 部门负责人游离在外 无法统计
|
||||
@RequestMapping("/distribution")
|
||||
public R distribution(ResultDistributionReq req){
|
||||
req.setDepartmentId("1");
|
||||
PageUtils pageUtils = chartService.reportDistribution(req);
|
||||
return R.ok().put("page",pageUtils);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/departmentTreeByStaffId")
|
||||
public R departmentTreeByStaffId(ResultDistributionReq req){
|
||||
//Long userId = getUserId();
|
||||
List<DepartmentsDto> data = departmentsService.getDepartmentTreeByStaffId("303",true);
|
||||
return R.ok().put("data",data);
|
||||
}
|
||||
|
||||
@RequestMapping("/own/result")
|
||||
public R ownResult(Long userId){
|
||||
@ -89,21 +110,7 @@ public class ReportResultController extends AbstractController{
|
||||
|
||||
|
||||
|
||||
//是在这个地方查询出所有的部门选择 还是 通过关键字搜索
|
||||
/* @RequestMapping("underDepartment")
|
||||
public R underDepartment(){
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectByStaffId(null);
|
||||
if(departmentsStaffRelateEntity == null){
|
||||
|
||||
}
|
||||
if(departmentsStaffRelateEntity.getIsLeader().equals(1)){
|
||||
//如果是leader 查询负责几个部门
|
||||
List<DepartmentsDto> departmentsDtos = departmentsService.selectByParentDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
@ -133,26 +140,3 @@ public class ReportResultController extends AbstractController{
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 0人是否需要展示
|
||||
/* List<GraphicsStatisticalDto> sortStaffLevels = new ArrayList<>();
|
||||
Map<String,Integer> map = Maps.newHashMap();
|
||||
for (GraphicsStatisticalDto staffLevel : staffLevels) {
|
||||
map.put(staffLevel.getCategory(),staffLevel.getNumber());
|
||||
}
|
||||
// 默认等级赋予默认值并排序
|
||||
for (String level : levels) {
|
||||
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
|
||||
dto.setCategory(level);
|
||||
if(!map.containsKey(level)){
|
||||
dto.setNumber(0);
|
||||
}else {
|
||||
dto.setNumber(map.get(level));
|
||||
}
|
||||
sortStaffLevels.add(dto);
|
||||
}*/
|
||||
@ -1,5 +1,6 @@
|
||||
package com.lz.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.lz.modules.app.dto.DepartmentInfos;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
@ -45,4 +46,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
||||
|
||||
List<String> selectDepartmentIdsByparentIds(@Param("parentIds") List parentIds);
|
||||
|
||||
List<String> selectDepartmentIdsByparentIds(@Param("parentIds") List parentIds, @Param("page") IPage page);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/9/24 16:31
|
||||
*/
|
||||
@Data
|
||||
public class ReportDistributionDto {
|
||||
//序号
|
||||
private String departmentId;
|
||||
//业务线
|
||||
private String businessLine;
|
||||
//部门
|
||||
private String departmentName;
|
||||
//3.25
|
||||
private int level1;
|
||||
//3.5-
|
||||
private int level2;
|
||||
//3.5
|
||||
private int level3;
|
||||
//3.5+
|
||||
private int level4;
|
||||
//3.75-
|
||||
private int level5;
|
||||
//3.75
|
||||
private int level6;
|
||||
//3.75+
|
||||
private int level7;
|
||||
//4
|
||||
private int level8;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/9/25 14:24
|
||||
*/
|
||||
public class StaffDepartmentsDto {
|
||||
//父级部门名称
|
||||
private String departmentName;
|
||||
|
||||
//父级部门id
|
||||
private String departmentId;
|
||||
|
||||
//管理得所有部门
|
||||
List<DepartmentsDto> departmentsDtos;
|
||||
|
||||
}
|
||||
@ -1,5 +1,9 @@
|
||||
package com.lz.modules.app.enums;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
@ -11,7 +15,13 @@ public enum ResultRecordStatusEnum {
|
||||
REFUSE(2,"拒绝"),
|
||||
WAIT_COMMIT(3,"侍提交"),
|
||||
AGREE(4,"审批通过"),
|
||||
REJECT(5,"驳回");
|
||||
REJECT(5,"驳回"),
|
||||
APPEAL(6,"申述"),
|
||||
SUSPEND(7,"流程中止"),
|
||||
|
||||
//组合状态
|
||||
PROCESS(108,"审核中"),
|
||||
FINISH(109,"已完成");
|
||||
|
||||
private int status;
|
||||
private String desc;
|
||||
@ -21,6 +31,22 @@ public enum ResultRecordStatusEnum {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static List<Integer> getGroupStatus(Integer status){
|
||||
if(status ==null){
|
||||
return null;
|
||||
}
|
||||
if(status == PROCESS.getStatus()){
|
||||
return Lists.newArrayList(AUDIT.getStatus(),WAIT_COMMIT.getStatus(),REJECT.getStatus(),APPEAL.getStatus());
|
||||
}
|
||||
if(status == FINISH.getStatus()){
|
||||
return Lists.newArrayList(REFUSE.getStatus(),AGREE.getStatus(),SUSPEND.getStatus());
|
||||
}
|
||||
return Lists.newArrayList(status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.lz.modules.equipment.entity.model.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -12,15 +13,23 @@ import java.time.YearMonth;
|
||||
*/
|
||||
@Data
|
||||
public class ReportListReq extends BasePage {
|
||||
String departmentId;
|
||||
|
||||
private String departmentId;
|
||||
|
||||
private String selectMonthTime = YearMonth.now().toString();
|
||||
//提交审核状态
|
||||
private Integer status;
|
||||
//真是查询得状态
|
||||
private List<Integer> realStatus;
|
||||
//目标还是结果
|
||||
private int type =1;
|
||||
|
||||
private String staffName;
|
||||
|
||||
private String level;
|
||||
|
||||
|
||||
//String startMonthTime;
|
||||
|
||||
//String endMonthTime;
|
||||
|
||||
String selectMonthTime = YearMonth.now().toString();
|
||||
//提交审核状态
|
||||
int status =0;
|
||||
//目标还是结果
|
||||
int type =1;
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.lz.modules.app.req;
|
||||
|
||||
import com.lz.modules.equipment.entity.model.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/9/25 9:30
|
||||
*/
|
||||
@Data
|
||||
public class ResultDistributionReq extends BasePage {
|
||||
private String departmentId = "1";
|
||||
|
||||
private String selectMonthTime = YearMonth.now().toString();
|
||||
}
|
||||
@ -45,5 +45,13 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
||||
|
||||
Map<String,String> selectUserAllDepartmentInFo(String departmentId);
|
||||
|
||||
/**
|
||||
* 获取自己管理得部门列表
|
||||
* @param staffId 人员id
|
||||
* @param containSelf 是否包含本身
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
|
||||
//查询部门下的所有子部门
|
||||
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
|
||||
|
||||
//统计部门下的人
|
||||
List<String> staffsByAllDeparmentIds(List<String> deparmentIds);
|
||||
|
||||
|
||||
@ -8,16 +8,21 @@ 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.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.job.model.responseBo.DepartmentInfosBo;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -30,6 +35,8 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
||||
|
||||
@Resource
|
||||
DepartmentsDao departmentsDao;
|
||||
@Resource
|
||||
DepartmentsStaffRelateDao departmentsStaffRelateDao;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
@ -200,4 +207,24 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateDao.selectByStaffId(Long.valueOf(staffId));
|
||||
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
getDepartmentTreeList(departmentsParentsList);
|
||||
if(containSelf){
|
||||
List<DepartmentsDto> result = new ArrayList<>();
|
||||
DepartmentsDto departmentsDto = new DepartmentsDto();
|
||||
departmentsDto.setDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
departmentsDto.setDepartmentName(departmentsEntity.getDepartmentName());
|
||||
departmentsDto.setMemberCount(departmentsEntity.getMemberCount());
|
||||
departmentsDto.setList(departmentsParentsList);
|
||||
result.add(departmentsDto);
|
||||
return result;
|
||||
}
|
||||
return departmentsParentsList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -392,14 +392,15 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
}
|
||||
List<String> parentsIds = Lists.newArrayList(departmentId);
|
||||
List<String> departmentsList = new ArrayList<>();
|
||||
departmentsList.addAll(parentsIds);
|
||||
List<String> childs = departmentsDao.selectDepartmentIdsByparentIds(parentsIds);
|
||||
if(CollectionUtils.isEmpty(childs)){
|
||||
departmentsList.addAll(parentsIds);
|
||||
return departmentsList;
|
||||
}
|
||||
departmentsList.addAll(childs);
|
||||
List<String> allChilds = getAllChilds(departmentsList, childs);
|
||||
return allChilds;
|
||||
allChilds.remove("1");
|
||||
return allChilds.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -408,7 +409,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
if(CollectionUtils.isEmpty(deparmentIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
//获取所有子部门
|
||||
//获取所有人员
|
||||
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
|
||||
.select("staff_id")
|
||||
.eq("is_delete", 0)
|
||||
|
||||
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.dto.ReportProgressListDto;
|
||||
import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
@ -59,5 +60,5 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
|
||||
|
||||
List<ReportProgressListDto> targetReportList(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds,@Param("page") IPage page);
|
||||
List<ReportProgressListDto> targetReportList(@Param("req")ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package com.lz.modules.sys.service.app;
|
||||
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.dto.ReportDistributionDto;
|
||||
import com.lz.modules.app.dto.ReportProgressListDto;
|
||||
import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultDistributionReq;
|
||||
import com.lz.modules.app.resp.ReportChartResp;
|
||||
|
||||
import java.util.List;
|
||||
@ -27,6 +30,11 @@ public interface ChartService {
|
||||
|
||||
ReportChartResp reportChart(String selectMonthTime, String departmentId);
|
||||
|
||||
PageUtils reportDistribution(ResultDistributionReq req);
|
||||
|
||||
String businessLineByStaffId(String staffId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,25 +1,31 @@
|
||||
package com.lz.modules.sys.service.app.impl;
|
||||
|
||||
import cn.hutool.core.util.PageUtil;
|
||||
import com.alibaba.druid.sql.PagerUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
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.CharBarDto;
|
||||
import com.lz.modules.app.dto.GraphicsDto;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.dto.ReportProgressListDto;
|
||||
import com.lz.modules.app.dto.*;
|
||||
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.enums.ResultRecordStatusEnum;
|
||||
import com.lz.modules.app.enums.ResultRecordTypeEnum;
|
||||
import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultDistributionReq;
|
||||
import com.lz.modules.app.resp.ReportChartResp;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ChartService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.sun.org.apache.regexp.internal.RE;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,8 +34,10 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -50,6 +58,11 @@ public class ChartServiceImpl implements ChartService {
|
||||
private DepartmentsStaffRelateDao departmentsStaffRelateDao;
|
||||
@Autowired
|
||||
private StaffDao staffDao;
|
||||
@Autowired
|
||||
private DepartmentsDao departmentsDao;
|
||||
|
||||
static final String[] levels = new String[]{"3.25","3.5-","3.5","3.5+","3.75-","3.75","3.75+","4"};
|
||||
|
||||
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime,String departmentId) {
|
||||
@ -68,7 +81,7 @@ public class ChartServiceImpl implements ChartService {
|
||||
.eq("is_delete", 0)
|
||||
.eq("type", type)
|
||||
.like("month_time",monthTime)
|
||||
.in("status", ResultRecordStatusEnum.REFUSE.getStatus(),ResultRecordStatusEnum.AGREE.getStatus()));
|
||||
.in("status", ResultRecordStatusEnum.REFUSE.getStatus(),ResultRecordStatusEnum.AGREE.getStatus(),ResultRecordStatusEnum.SUSPEND.getStatus()));
|
||||
|
||||
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
|
||||
if(total-commit>0){
|
||||
@ -133,13 +146,14 @@ public class ChartServiceImpl implements ChartService {
|
||||
@Override
|
||||
public PageUtils resultReportList(ReportListReq req, List<String> staffIds) {
|
||||
// 状态为0的数据存在两张表,单独处理
|
||||
if(req.getStatus()!=0){
|
||||
if(!"0".equals(req.getStatus())){
|
||||
//获取真实状态
|
||||
List<Integer> groupStatus = ResultRecordStatusEnum.getGroupStatus(req.getStatus());
|
||||
req.setRealStatus(groupStatus);
|
||||
//获取处理过业绩目标的人员
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.targetReportList(req.getSelectMonthTime(), staffIds, page)
|
||||
page -> resultRecordMapper.targetReportList(req, staffIds, page)
|
||||
);
|
||||
List<ReportProgressListDto> list = pageUtils.getList();
|
||||
|
||||
return pageUtils;
|
||||
|
||||
}else {
|
||||
@ -152,7 +166,7 @@ public class ChartServiceImpl implements ChartService {
|
||||
.ne("status", ResultRecordStatusEnum.CREATE.getStatus())
|
||||
.select("staff_id"));
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
commitStaffIds = collect.stream().map((Function<Object, String>) o -> o.toString()).collect(Collectors.toList());
|
||||
commitStaffIds = collect.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||
}
|
||||
//去除已经提交的
|
||||
staffIds.removeAll(commitStaffIds);
|
||||
@ -173,4 +187,119 @@ public class ChartServiceImpl implements ChartService {
|
||||
return pageUtils;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils reportDistribution(ResultDistributionReq req) {
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
// 去除存在子部门得id
|
||||
allDeparmentIds.removeIf(s -> {
|
||||
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectEntityByParentDepartmentId(s);
|
||||
if(CollectionUtils.isNotEmpty(departmentsEntities)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// 由于deparmentIds 递归所得无法分页 则list分页
|
||||
List<String> list = startPage(allDeparmentIds, req.getCurrPage(), req.getPageSize());
|
||||
return buildPages(list,req,allDeparmentIds.size());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String businessLineByStaffId(String staffId) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateDao.selectByStaffId(Long.valueOf(staffId));
|
||||
String departmentId = departmentsStaffRelateEntity.getDepartmentId();
|
||||
return getBussinessLine(departmentId);
|
||||
}
|
||||
|
||||
private String getBussinessLine(String departmentId){
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentId);
|
||||
if("1".equals(departmentsEntity.getDepartmentParentId())){
|
||||
return departmentsEntity.getDepartmentName();
|
||||
}
|
||||
return getBussinessLine(departmentsEntity.getDepartmentParentId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private PageUtils buildPages( List<String> departments,ResultDistributionReq req, int totalSize){
|
||||
List<ReportDistributionDto> data = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(departments)){
|
||||
return new PageUtils();
|
||||
}
|
||||
departments.forEach(s -> {
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(s);
|
||||
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectEntityByParentDepartmentId(departmentsEntity.getDepartmentParentId());
|
||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(Lists.newArrayList(s));
|
||||
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(req.getSelectMonthTime(),staffIds);
|
||||
Map<String,Integer> map = Maps.newHashMap();
|
||||
for (GraphicsStatisticalDto staffLevel : staffLevels) {
|
||||
map.put(staffLevel.getCategory(),staffLevel.getNumber());
|
||||
}
|
||||
ReportDistributionDto dto = new ReportDistributionDto();
|
||||
dto.setDepartmentId(s);
|
||||
dto.setDepartmentName(departmentsEntity.getDepartmentName());
|
||||
dto.setBusinessLine(getBussinessLine(s));
|
||||
dto.setLevel1(map.get(levels[0])==null?0:map.get(levels[0]));
|
||||
dto.setLevel2(map.get(levels[1])==null?0:map.get(levels[1]));
|
||||
dto.setLevel3(map.get(levels[2])==null?0:map.get(levels[2]));
|
||||
dto.setLevel4(map.get(levels[3])==null?0:map.get(levels[3]));
|
||||
dto.setLevel5(map.get(levels[4])==null?0:map.get(levels[4]));
|
||||
dto.setLevel6(map.get(levels[5])==null?0:map.get(levels[5]));
|
||||
dto.setLevel7(map.get(levels[6])==null?0:map.get(levels[6]));
|
||||
dto.setLevel8(map.get(levels[7])==null?0:map.get(levels[7]));
|
||||
data.add(dto);
|
||||
|
||||
});
|
||||
|
||||
PageUtils result = new PageUtils();
|
||||
result.setList(data);
|
||||
result.setTotalCount(totalSize);
|
||||
result.setCurrPage(req.getCurrPage());
|
||||
result.setPageSize(req.getPageSize());
|
||||
result.setTotalPage(PageUtil.totalPage(totalSize,req.getPageSize()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List startPage(List list, Integer pageNum,
|
||||
Integer pageSize) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer count = list.size(); // 记录总数
|
||||
Integer pageCount = 0; // 页数
|
||||
if (count % pageSize == 0) {
|
||||
pageCount = count / pageSize;
|
||||
} else {
|
||||
pageCount = count / pageSize + 1;
|
||||
}
|
||||
|
||||
int fromIndex = 0; // 开始索引
|
||||
int toIndex = 0; // 结束索引
|
||||
|
||||
if (!Objects.equals(pageNum, pageCount)) {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = fromIndex + pageSize;
|
||||
} else {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = count;
|
||||
}
|
||||
|
||||
List pageList = list.subList(fromIndex, toIndex);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
private boolean hasPermissions(Long staffId){
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,10 +267,12 @@
|
||||
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
|
||||
SELECT count(score_level) number ,score_level category from lz_result_record where
|
||||
is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime}
|
||||
and staff_id in
|
||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="staffIds !=null and staffIds.size()>0">
|
||||
and staff_id in
|
||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY score_level
|
||||
</select>
|
||||
|
||||
@ -287,10 +289,27 @@
|
||||
LEFT JOIN lz_staff_occupation o
|
||||
on r.staff_id = o.staff_id
|
||||
where r.is_delete=0 and o.is_delete=0 and type = 1
|
||||
and r.staff_id in
|
||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="staffIds !=null and staffIds.size() !=0">
|
||||
and r.staff_id in
|
||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.staffName !=null and req.staffName != ''">
|
||||
and r.staff_name like concat('%',#{req.staffName},'%')
|
||||
</if>
|
||||
<if test="req.level !=null and req.level != ''">
|
||||
and r.score_level = #{req.level}
|
||||
</if>
|
||||
<if test="req.realStatus !=null and req.realStatus.size() !=0">
|
||||
and r.status in
|
||||
<foreach collection="req.realStatus" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.selectMonthTime !=null">
|
||||
|
||||
</if>
|
||||
GROUP BY r.staff_id
|
||||
|
||||
|
||||
|
||||
@ -119,11 +119,15 @@
|
||||
|
||||
|
||||
<select id="selectDepartmentIdsByparentIds" resultType="String">
|
||||
select department_id from lz_departments where is_delete=0 and department_parent_id IN
|
||||
<foreach collection="parentIds" item="id" open="(" close=")"
|
||||
separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
select department_id from lz_departments where is_delete=0
|
||||
<if test="parentIds !=null and parentIds.size>0">
|
||||
and department_parent_id IN
|
||||
<foreach collection="parentIds" item="id" open="(" close=")"
|
||||
separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user