提交修改
This commit is contained in:
commit
7e5452428c
48
src/main/java/com/lz/common/utils/ListUtils.java
Normal file
48
src/main/java/com/lz/common/utils/ListUtils.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.lz.common.utils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/9/27 14:48
|
||||
*/
|
||||
public class ListUtils { //list 分页
|
||||
|
||||
public static List startPage(List list, Integer pageNum,
|
||||
Integer pageSize) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
pageNum = pageNum<1?1:pageNum;
|
||||
Integer count = list.size(); // 记录总数
|
||||
Integer pageCount = 0; // 页数
|
||||
if (count % pageSize == 0) {
|
||||
pageCount = count / pageSize;
|
||||
} else {
|
||||
pageCount = count / pageSize + 1;
|
||||
}
|
||||
if(pageNum>pageCount){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,9 @@
|
||||
package com.lz.modules.app.controller;
|
||||
|
||||
import com.lz.common.utils.BigDecimalUtil;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.*;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
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;
|
||||
@ -18,17 +14,10 @@ import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.service.app.ChartService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -52,17 +41,11 @@ public class ReportResultController extends AbstractController{
|
||||
|
||||
|
||||
@RequestMapping("chart")
|
||||
public R reportChart(String selectMonthTime,String departmentId){
|
||||
if(StringUtil.isBlank(selectMonthTime)){
|
||||
selectMonthTime = YearMonth.now().toString();
|
||||
public R reportChart(ResultDistributionReq req){
|
||||
if(!chartService.hrOrBoss(getUserId())){
|
||||
return R.ok();
|
||||
}
|
||||
Long userId = getUserId();
|
||||
//是自己部门得领导
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectByStaffId(userId);
|
||||
if("1".equals(departmentsStaffRelateEntity.getIsLeader())){
|
||||
|
||||
}
|
||||
ReportChartResp reportChartResp = chartService.reportChart(selectMonthTime, departmentId);
|
||||
ReportChartResp reportChartResp = chartService.reportChart(req.getSelectMonthTime(), req.getDepartmentId());
|
||||
return R.ok().put("data",reportChartResp);
|
||||
}
|
||||
|
||||
@ -71,29 +54,40 @@ public class ReportResultController extends AbstractController{
|
||||
|
||||
@RequestMapping("/report")
|
||||
public R list(ReportListReq req){
|
||||
//获取部门下所有人员
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||
PageUtils pageUtils = chartService.resultReportList(req, staffIds);
|
||||
if(!chartService.leader(getUserId())){
|
||||
return R.ok();
|
||||
}
|
||||
PageUtils pageUtils = chartService.resultReportList(req);
|
||||
return R.ok().put("page",pageUtils);
|
||||
}
|
||||
|
||||
|
||||
// 未解决问题 部门负责人游离在外 无法统计
|
||||
@RequestMapping("/distribution")
|
||||
public R distribution(ResultDistributionReq req){
|
||||
req.setDepartmentId("1");
|
||||
if(!chartService.hrOrBoss(getUserId())){
|
||||
return R.ok();
|
||||
}
|
||||
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);
|
||||
public R departmentTreeByStaffId(){
|
||||
Long userId = getUserId();
|
||||
if(chartService.hrOrBoss(userId)){
|
||||
List<DepartmentsDto> data = departmentsService.getDepartmentTree();
|
||||
return R.ok().put("data",data);
|
||||
}
|
||||
if(chartService.leader(getUserId())){
|
||||
List<DepartmentsDto> data = departmentsService.getDepartmentTreeByStaffId(String.valueOf(userId),true);
|
||||
return R.ok().put("data",data);
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/own/result")
|
||||
|
||||
@ -26,7 +26,7 @@ public interface ChartService {
|
||||
*/
|
||||
List<GraphicsStatisticalDto> resultProgressDistribution(int type, String monthTime,String departmentId);
|
||||
|
||||
PageUtils resultReportList(ReportListReq req, List<String> staffIds);
|
||||
PageUtils resultReportList(ReportListReq req);
|
||||
|
||||
ReportChartResp reportChart(String selectMonthTime, String departmentId);
|
||||
|
||||
@ -35,6 +35,11 @@ public interface ChartService {
|
||||
String businessLineByStaffId(String staffId);
|
||||
|
||||
|
||||
boolean hrOrBoss(Long staffId);
|
||||
|
||||
boolean leader(Long staffId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ 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.ListUtils;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
@ -21,6 +22,8 @@ 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.flow.dao.StaffRoleMapper;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ChartService;
|
||||
@ -60,10 +63,13 @@ public class ChartServiceImpl implements ChartService {
|
||||
private StaffDao staffDao;
|
||||
@Autowired
|
||||
private DepartmentsDao departmentsDao;
|
||||
@Autowired
|
||||
private StaffRoleMapper staffRoleMapper;
|
||||
|
||||
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) {
|
||||
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
|
||||
@ -72,16 +78,20 @@ public class ChartServiceImpl implements ChartService {
|
||||
int total = staffService.staffsByAllDeparmentIds(allDeparmentIds).size();
|
||||
//已提交
|
||||
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
|
||||
.eq("is_delete", 0)
|
||||
.eq("is_delete", type==1?2:0)
|
||||
.eq("type", type)
|
||||
.like("month_time",monthTime)
|
||||
.ne("status", ResultRecordStatusEnum.CREATE.getStatus()));
|
||||
.ne("status", ResultRecordStatusEnum.CREATE.getStatus())
|
||||
.in("department_id",allDeparmentIds)
|
||||
.select("DISTINCT staff_id"));
|
||||
//已完成
|
||||
int finished = resultRecordService.count(new QueryWrapper<ResultRecord>()
|
||||
.eq("is_delete", 0)
|
||||
.eq("is_delete", type==1?2:0)
|
||||
.eq("type", type)
|
||||
.like("month_time",monthTime)
|
||||
.in("status", ResultRecordStatusEnum.REFUSE.getStatus(),ResultRecordStatusEnum.AGREE.getStatus(),ResultRecordStatusEnum.SUSPEND.getStatus()));
|
||||
.in("status", ResultRecordStatusEnum.REFUSE.getStatus(),ResultRecordStatusEnum.AGREE.getStatus(),ResultRecordStatusEnum.SUSPEND.getStatus())
|
||||
.in("department_id",allDeparmentIds)
|
||||
.select("DISTINCT staff_id"));
|
||||
|
||||
GraphicsStatisticalDto dto = new GraphicsStatisticalDto();
|
||||
if(total-commit>0){
|
||||
@ -144,9 +154,34 @@ public class ChartServiceImpl implements ChartService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils resultReportList(ReportListReq req, List<String> staffIds) {
|
||||
// 状态为0的数据存在两张表,单独处理
|
||||
if(!"0".equals(req.getStatus())){
|
||||
public PageUtils resultReportList(ReportListReq req) {
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
//获取部门下所有人员
|
||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||
List<String> copyStaffIds = Lists.newArrayList();
|
||||
ReportListReq copyReq = new ReportListReq();
|
||||
copyStaffIds.addAll(staffIds);
|
||||
|
||||
if(req.getStatus()!=null){
|
||||
if(req.getStatus() == ResultRecordStatusEnum.CREATE.getStatus()){ // 状态为0的数据存在两张表,单独处理
|
||||
//获取已提交人员
|
||||
List<String> commitStaffIds = new ArrayList<>();
|
||||
List<Object> collect=resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
||||
.eq("is_delete", req.getType()==1?2:0)
|
||||
.eq("type", req.getType())
|
||||
.like("month_time",req.getSelectMonthTime())
|
||||
.ne("status", ResultRecordStatusEnum.CREATE.getStatus())
|
||||
.in("department_id",allDeparmentIds)
|
||||
.in("staff_id",staffIds)
|
||||
.select(" DISTINCT staff_id"));
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
commitStaffIds = collect.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||
}
|
||||
//去除已经提交的
|
||||
staffIds.removeAll(commitStaffIds);
|
||||
return buildPageByStaffIds(req,staffIds);
|
||||
|
||||
}else {
|
||||
//获取真实状态
|
||||
List<Integer> groupStatus = ResultRecordStatusEnum.getGroupStatus(req.getStatus());
|
||||
req.setRealStatus(groupStatus);
|
||||
@ -155,43 +190,79 @@ public class ChartServiceImpl implements ChartService {
|
||||
page -> resultRecordMapper.targetReportList(req, staffIds, page)
|
||||
);
|
||||
return pageUtils;
|
||||
}
|
||||
|
||||
}else {
|
||||
//获取已提交人员
|
||||
}else{ // 查询所有,需要拼装数据 ,先查询已提交得剩余得 用未提交缺多少补多少
|
||||
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.targetReportList(req, staffIds, page)
|
||||
);
|
||||
List<ReportProgressListDto> list = pageUtils.getList();
|
||||
int totalPage = pageUtils.getTotalPage();
|
||||
|
||||
/*************************************数据拼接逻辑****************************************/
|
||||
if(list.size()<req.getPageSize()){
|
||||
List<String> commitStaffIds = new ArrayList<>();
|
||||
List<Object> collect=resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
||||
.eq("is_delete", 0)
|
||||
//已提交
|
||||
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
||||
.eq("is_delete", req.getType()==1?2:0)
|
||||
.eq("type", req.getType())
|
||||
.like("month_time", req.getSelectMonthTime())
|
||||
.ne("status", ResultRecordStatusEnum.CREATE.getStatus())
|
||||
.select("staff_id"));
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
commitStaffIds = collect.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||
.in("department_id", allDeparmentIds)
|
||||
.select("DISTINCT staff_id"));
|
||||
if(CollectionUtils.isNotEmpty(objects)){
|
||||
commitStaffIds = objects.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||
}
|
||||
//去除已经提交的
|
||||
staffIds.removeAll(commitStaffIds);
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page ->staffDao.getPositionByStaffIds(staffIds,page)
|
||||
);
|
||||
//本次分页数据
|
||||
List<ReportProgressListDto> dataList = pageUtils.getList();
|
||||
if(dataList.size()<1){
|
||||
if(CollectionUtils.isEmpty(staffIds)){
|
||||
return pageUtils;
|
||||
}
|
||||
//拿到用户数据查询部门信息封装
|
||||
List<String> selectStaffIds = dataList.stream().map(reportProgressListDto -> reportProgressListDto.getStaffId()).collect(Collectors.toList());
|
||||
List<ReportProgressListDto> departmentNameByStaffIds = departmentsStaffRelateDao.getDepartmentNameByStaffIds(selectStaffIds);
|
||||
Map<String,String> map = Maps.newHashMap();
|
||||
departmentNameByStaffIds.forEach(reportProgressListDto -> map.put(reportProgressListDto.getStaffId(),reportProgressListDto.getDepartmentName()));
|
||||
dataList.forEach(reportProgressListDto -> reportProgressListDto.setDepartmentName(map.get(reportProgressListDto.getStaffId())));
|
||||
return pageUtils;
|
||||
int addSize = req.getPageSize()-list.size();
|
||||
int addStart = req.getCurrPage() -totalPage;
|
||||
//如果相差大于0 则需找到最后一页得个数 补齐得时候减去这些个数
|
||||
if(addStart>0){
|
||||
|
||||
copyReq.setCurrPage(pageUtils.getTotalPage());
|
||||
copyReq.setPageSize(req.getPageSize());
|
||||
PageUtils ps = PageUtils.startPage(copyReq.getCurrPage(),copyReq.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.targetReportList(copyReq, copyStaffIds, page)
|
||||
);
|
||||
int sub = ps.getList().size();
|
||||
addStart = (addStart-1) * req.getPageSize() + (copyReq.getPageSize()-sub);
|
||||
}
|
||||
int addEnd = addSize + addStart;
|
||||
addEnd = addEnd>staffIds.size()?staffIds.size():addEnd;
|
||||
List<String> addList = staffIds.subList(addStart,addEnd);
|
||||
copyReq.setCurrPage(0);
|
||||
copyReq.setPageSize(addSize);
|
||||
PageUtils addResult = buildPageByStaffIds(copyReq, addList);
|
||||
staffIds.addAll(commitStaffIds);
|
||||
PageUtils data = new PageUtils();
|
||||
list.addAll(addResult.getList());
|
||||
data.setList(list);
|
||||
data.setPageSize(req.getPageSize());
|
||||
data.setCurrPage(req.getCurrPage());
|
||||
data.setTotalCount(copyStaffIds.size());
|
||||
data.setTotalPage(PageUtil.totalPage(copyStaffIds.size(),req.getPageSize()));
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
PageUtils data = new PageUtils();
|
||||
data.setList(list);
|
||||
data.setPageSize(req.getPageSize());
|
||||
data.setCurrPage(req.getCurrPage());
|
||||
data.setTotalCount(copyStaffIds.size());
|
||||
data.setTotalPage(PageUtil.totalPage(copyStaffIds.size(),req.getPageSize()));
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils reportDistribution(ResultDistributionReq req) {
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
/*List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||
// 去除存在子部门得id
|
||||
allDeparmentIds.removeIf(s -> {
|
||||
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectEntityByParentDepartmentId(s);
|
||||
@ -202,8 +273,25 @@ public class ChartServiceImpl implements ChartService {
|
||||
});
|
||||
|
||||
// 由于deparmentIds 递归所得无法分页 则list分页
|
||||
List<String> list = startPage(allDeparmentIds, req.getCurrPage(), req.getPageSize());
|
||||
return buildPages(list,req,allDeparmentIds.size());
|
||||
List<String> list = ListUtils.startPage(allDeparmentIds, req.getCurrPage(), req.getPageSize());
|
||||
return buildPages(list,req,allDeparmentIds.size());*/
|
||||
//获取一级目录
|
||||
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId("1");
|
||||
if(CollectionUtils.isEmpty(departmentsParentsList)){
|
||||
return new PageUtils();
|
||||
}
|
||||
List<DepartmentsDto> oneDepartmentsParentsList = Lists.newArrayList();
|
||||
departmentsParentsList.forEach(departmentsDto -> {
|
||||
List<DepartmentsDto> departmentsParentsList1 = departmentsDao.getDepartmentsByparentId(departmentsDto.getDepartmentId());
|
||||
oneDepartmentsParentsList.addAll(departmentsParentsList1);
|
||||
});
|
||||
|
||||
List<DepartmentsDto> list = ListUtils.startPage(oneDepartmentsParentsList, req.getCurrPage(), req.getPageSize());
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return new PageUtils();
|
||||
}
|
||||
List<String> collect = list.stream().map(DepartmentsDto::getDepartmentId).collect(Collectors.toList());
|
||||
return buildPages(collect,req,oneDepartmentsParentsList.size());
|
||||
}
|
||||
|
||||
|
||||
@ -214,6 +302,35 @@ public class ChartServiceImpl implements ChartService {
|
||||
return getBussinessLine(departmentId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hrOrBoss(Long staffId) {
|
||||
log.info("hrOrBoss判断 : " + staffId);
|
||||
//超级管理员
|
||||
if(1==staffId){
|
||||
return true;
|
||||
}
|
||||
StaffRole staffRole = staffRoleMapper.selectByStaffId(staffId);
|
||||
if(staffRole!=null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leader(Long staffId) {
|
||||
log.info("leader判断 : " + staffId);
|
||||
//超级管理员
|
||||
if(1==staffId){
|
||||
return true;
|
||||
}
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateDao.selectByStaffId(staffId);
|
||||
if(departmentsStaffRelateEntity!=null && "1".equals(departmentsStaffRelateEntity.getIsLeader())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getBussinessLine(String departmentId){
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentId);
|
||||
if("1".equals(departmentsEntity.getDepartmentParentId())){
|
||||
@ -231,8 +348,8 @@ public class ChartServiceImpl implements ChartService {
|
||||
}
|
||||
departments.forEach(s -> {
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(s);
|
||||
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectEntityByParentDepartmentId(departmentsEntity.getDepartmentParentId());
|
||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(Lists.newArrayList(s));
|
||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(req.getSelectMonthTime(),staffIds);
|
||||
Map<String,Integer> map = Maps.newHashMap();
|
||||
for (GraphicsStatisticalDto staffLevel : staffLevels) {
|
||||
@ -264,42 +381,22 @@ public class ChartServiceImpl implements ChartService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List startPage(List list, Integer pageNum,
|
||||
Integer pageSize) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
//根据用户组拼接未提交分页数据
|
||||
private PageUtils buildPageByStaffIds(ReportListReq req,List<String> staffIds){
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||
page ->staffDao.getPositionByStaffIds(staffIds,page)
|
||||
);
|
||||
//本次分页数据
|
||||
List<ReportProgressListDto> dataList = pageUtils.getList();
|
||||
if(dataList.size()<1){
|
||||
return pageUtils;
|
||||
}
|
||||
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;
|
||||
|
||||
//拿到用户数据查询部门信息封装
|
||||
List<String> selectStaffIds = dataList.stream().map(reportProgressListDto -> reportProgressListDto.getStaffId()).collect(Collectors.toList());
|
||||
List<ReportProgressListDto> departmentNameByStaffIds = departmentsStaffRelateDao.getDepartmentNameByStaffIds(selectStaffIds);
|
||||
Map<String,String> map = Maps.newHashMap();
|
||||
departmentNameByStaffIds.forEach(reportProgressListDto -> map.put(reportProgressListDto.getStaffId(),reportProgressListDto.getDepartmentName()));
|
||||
dataList.forEach(reportProgressListDto -> reportProgressListDto.setDepartmentName(map.get(reportProgressListDto.getStaffId())));
|
||||
return pageUtils;
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +294,10 @@
|
||||
SELECT max(r.id) id,r.staff_id ,staff_name,status,position,department_name from lz_result_record r
|
||||
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
|
||||
where r.is_delete=0 and o.is_delete=0
|
||||
<if test="req.type !=null ">
|
||||
and type = #{req.type}
|
||||
</if>
|
||||
<if test="staffIds !=null and staffIds.size() !=0">
|
||||
and r.staff_id in
|
||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
@ -307,22 +310,17 @@
|
||||
<if test="req.level !=null and req.level != ''">
|
||||
and r.score_level = #{req.level}
|
||||
</if>
|
||||
<if test="req.selectMonthTime !=null and req.selectMonthTime !=''">
|
||||
and month_time like CONCAT('', #{req.selectMonthTime}, '%')
|
||||
</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
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="resultReportList" resultType="com.lz.modules.app.dto.ReportProgressListDto">
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -293,16 +293,16 @@
|
||||
select ifnull(count(*),0) from equipment_info where is_delete = 0 and count =#{num} and depart_id is not null and depart_id > 0
|
||||
</select>
|
||||
|
||||
<update id="updateCoverEquipmentInfoByTypeId" parameterType="java.lang.Long">
|
||||
update equipment_info set type = #{type} where type_id=#{id}
|
||||
<update id="updateCoverEquipmentInfoByTypeId" >
|
||||
update equipment_info set type = #{type} where type_id=#{id} and is_delete=0
|
||||
</update>
|
||||
|
||||
<update id="updateCoverEquipmentInfoByBrandId" parameterType="java.lang.Long">
|
||||
update equipment_info set brand_name = #{brand} where type_id=#{id}
|
||||
<update id="updateCoverEquipmentInfoByBrandId" >
|
||||
update equipment_info set brand_name = #{brand} where brand_id=#{id} and is_delete=0
|
||||
</update>
|
||||
|
||||
<update id="updateCoverEquipmentInfoBySpecsId" parameterType="java.lang.Long">
|
||||
update equipment_info set spec_type = #{specs} where type_id=#{id}
|
||||
<update id="updateCoverEquipmentInfoBySpecsId" >
|
||||
update equipment_info set spec_type = #{specs} where specs_id=#{id} and is_delete=0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -63,7 +63,7 @@ public class MysqlMain {
|
||||
}
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("t_count"));
|
||||
list.add(new TablesBean("lz_staff_role"));
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user