fix
This commit is contained in:
parent
e2e5bf581e
commit
76d4a18cb8
@ -1,5 +1,6 @@
|
|||||||
package com.lz.modules.app.controller;
|
package com.lz.modules.app.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.lz.common.utils.PageUtils;
|
import com.lz.common.utils.PageUtils;
|
||||||
import com.lz.common.utils.R;
|
import com.lz.common.utils.R;
|
||||||
import com.lz.common.utils.StringUtil;
|
import com.lz.common.utils.StringUtil;
|
||||||
@ -13,14 +14,19 @@ import com.lz.modules.app.resp.ReportChartResp;
|
|||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||||
import com.lz.modules.app.service.StaffService;
|
import com.lz.modules.app.service.StaffService;
|
||||||
|
import com.lz.modules.flow.entity.StaffRole;
|
||||||
|
import com.lz.modules.flow.service.StaffRoleService;
|
||||||
import com.lz.modules.sys.controller.AbstractController;
|
import com.lz.modules.sys.controller.AbstractController;
|
||||||
import com.lz.modules.sys.service.app.ChartService;
|
import com.lz.modules.sys.service.app.ChartService;
|
||||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: djc
|
* @Author: djc
|
||||||
@ -40,6 +46,8 @@ public class ReportResultController extends AbstractController{
|
|||||||
private StaffService staffService;
|
private StaffService staffService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ChartService chartService;
|
private ChartService chartService;
|
||||||
|
@Autowired
|
||||||
|
private StaffRoleService staffRoleService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("chart")
|
@RequestMapping("chart")
|
||||||
@ -119,6 +127,7 @@ public class ReportResultController extends AbstractController{
|
|||||||
return R.ok().put("data",ownResultResp);
|
return R.ok().put("data",ownResultResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,30 @@
|
|||||||
package com.lz.modules.app.controller;
|
package com.lz.modules.app.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.lz.common.utils.R;
|
||||||
|
import com.lz.common.utils.StringUtil;
|
||||||
import com.lz.modules.app.dao.DepartmentsDao;
|
import com.lz.modules.app.dao.DepartmentsDao;
|
||||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||||
import com.lz.modules.app.entity.StaffEntity;
|
import com.lz.modules.app.entity.StaffEntity;
|
||||||
|
import com.lz.modules.app.enums.ResultRecordStatusEnum;
|
||||||
import com.lz.modules.app.resp.Step;
|
import com.lz.modules.app.resp.Step;
|
||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||||
import com.lz.modules.app.service.StaffService;
|
import com.lz.modules.app.service.StaffService;
|
||||||
|
import com.lz.modules.flow.entity.RecordAuth;
|
||||||
|
import com.lz.modules.flow.entity.StaffRole;
|
||||||
import com.lz.modules.flow.model.FlowModel;
|
import com.lz.modules.flow.model.FlowModel;
|
||||||
|
import com.lz.modules.flow.service.RecordAuthService;
|
||||||
|
import com.lz.modules.flow.service.StaffRoleService;
|
||||||
|
import com.lz.modules.sys.dao.SysUserDao;
|
||||||
|
import com.lz.modules.sys.entity.SysUserEntity;
|
||||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||||
|
import com.lz.modules.sys.service.SysUserService;
|
||||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -23,7 +35,10 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
public class TestController {
|
public class TestController {
|
||||||
|
|
||||||
@ -42,6 +57,14 @@ public class TestController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||||
|
@Autowired
|
||||||
|
private StaffRoleService staffRoleService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserDao sysUserDao;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private RecordAuthService recordAuthService;
|
||||||
|
|
||||||
@RequestMapping("/test/xx")
|
@RequestMapping("/test/xx")
|
||||||
public void test(){
|
public void test(){
|
||||||
@ -153,4 +176,54 @@ public class TestController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("/test/init")
|
||||||
|
public void testinit(){
|
||||||
|
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId("1");
|
||||||
|
//获取部门下所有人员
|
||||||
|
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||||
|
List<Object> collect=resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.eq("type", 2)
|
||||||
|
.like("month_time","2020-09")
|
||||||
|
.in("department_id",allDeparmentIds)
|
||||||
|
.in("staff_id",staffIds)
|
||||||
|
.select(" DISTINCT staff_id"));
|
||||||
|
List<String> collect1 = new ArrayList<>();
|
||||||
|
if(CollectionUtils.isNotEmpty(collect)){
|
||||||
|
collect1 = collect.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
staffIds.removeAll(collect1);
|
||||||
|
staffIds.forEach(new Consumer<String>() {
|
||||||
|
@Override
|
||||||
|
public void accept(String s) {
|
||||||
|
List<RecordAuth> listAuth = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
ResultRecord resultRecord = resultRecordService.initResult(Long.valueOf(s), 2, 8l);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("失败账户" + s);
|
||||||
|
log.error("" ,e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//ResultRecord resultRecord = resultRecordService.createResultRecord(Long.valueOf(s), 1, 7l);
|
||||||
|
System.out.println();
|
||||||
|
/* DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectByStaffId(Long.valueOf(s));
|
||||||
|
DepartmentsEntity departmentsEntity = departmentsService.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||||
|
StaffEntity staffEntity = staffService.selectStaffById(Long.valueOf(s));
|
||||||
|
ResultRecord resultRecord = new ResultRecord();
|
||||||
|
resultRecord.setStaffId(Long.valueOf(s));
|
||||||
|
resultRecord.setType(2);
|
||||||
|
resultRecord.setDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||||
|
resultRecord.setDepartmentName(departmentsEntity.getDepartmentName());
|
||||||
|
resultRecord.setStaffName(staffEntity.getName());
|
||||||
|
//resultRecord.setFlowStaffIdRole();
|
||||||
|
resultRecordService.insertResultRecord(resultRecord);*/
|
||||||
|
}
|
||||||
|
});
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.lz.modules.app.dto.*;
|
import com.lz.modules.app.dto.*;
|
||||||
import com.lz.modules.app.entity.StaffEntity;
|
import com.lz.modules.app.entity.StaffEntity;
|
||||||
|
import com.lz.modules.app.req.ReportListReq;
|
||||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -78,5 +79,5 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
|||||||
|
|
||||||
List<StaffEntity> selectAll();
|
List<StaffEntity> selectAll();
|
||||||
|
|
||||||
List<ReportProgressListDto> getPositionByStaffIds(@Param("staffIds") List<String> staffIds,@Param("page") IPage page);
|
List<ReportProgressListDto> getPositionByStaffIds(@Param("req") ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户
|
* 系统用户
|
||||||
@ -46,4 +47,6 @@ public interface SysUserDao extends BaseMapper<SysUserEntity> {
|
|||||||
|
|
||||||
|
|
||||||
List<Long> queryMenuIdListByRoleId(@Param("roleId") Long roleId);
|
List<Long> queryMenuIdListByRoleId(@Param("roleId") Long roleId);
|
||||||
|
|
||||||
|
List<Long> queryMenuIdListByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
|||||||
|
|
||||||
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
|
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
|
||||||
|
|
||||||
List<ReportProgressListDto> targetReportList(@Param("req")ReportListReq req, @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);
|
||||||
|
|
||||||
ResultRecord selectLastResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
|
ResultRecord selectLastResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
|
||||||
}
|
}
|
||||||
@ -15,6 +15,7 @@ import org.apache.catalina.User;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,4 +67,6 @@ public interface SysUserService extends IService<SysUserEntity> {
|
|||||||
boolean updatePassword(SysUserEntity user, String password, String newPassword);
|
boolean updatePassword(SysUserEntity user, String password, String newPassword);
|
||||||
|
|
||||||
List<Long> queryMenuIdListByRoleId(Long roleId);
|
List<Long> queryMenuIdListByRoleId(Long roleId);
|
||||||
|
|
||||||
|
List<Long> queryMenuIdListByRoleIds(Set<Long> roleIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,21 +161,26 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
|
||||||
//获取部门下所有人员
|
//获取部门下所有人员
|
||||||
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
List<String> staffIds = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||||
List<String> copyStaffIds = Lists.newArrayList();
|
//获取真实状态
|
||||||
|
List<Integer> groupStatus = ResultRecordStatusEnum.getGroupStatus(req.getStatus());
|
||||||
|
req.setRealStatus(groupStatus);
|
||||||
|
//获取处理过业绩目标的人员
|
||||||
|
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||||
|
page -> this.targetReportList(req, staffIds, page)
|
||||||
|
);
|
||||||
|
return pageUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
List<String> copyStaffIds = Lists.newArrayList();
|
||||||
ReportListReq copyReq = new ReportListReq();
|
ReportListReq copyReq = new ReportListReq();
|
||||||
copyStaffIds.addAll(staffIds);
|
copyStaffIds.addAll(staffIds);
|
||||||
|
|
||||||
if(req.getStatus()!=null){
|
|
||||||
|
if(req.getStatus()!=null){
|
||||||
|
|
||||||
if(req.getStatus() != ResultRecordStatusEnum.CREATE.getStatus()){
|
if(req.getStatus() != ResultRecordStatusEnum.CREATE.getStatus()){
|
||||||
//获取真实状态
|
|
||||||
List<Integer> groupStatus = ResultRecordStatusEnum.getGroupStatus(req.getStatus());
|
|
||||||
req.setRealStatus(groupStatus);
|
|
||||||
//获取处理过业绩目标的人员
|
|
||||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
|
||||||
page -> this.targetReportList(req, staffIds, page)
|
|
||||||
);
|
|
||||||
return pageUtils;
|
|
||||||
|
|
||||||
}else { // 状态为0的数据存在两张表,单独处理
|
}else { // 状态为0的数据存在两张表,单独处理
|
||||||
|
|
||||||
@ -212,61 +217,64 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
copyList.addAll(list);
|
copyList.addAll(list);
|
||||||
int totalPage = pageUtils.getTotalPage();
|
int totalPage = pageUtils.getTotalPage();
|
||||||
|
|
||||||
/*************************************数据拼接逻辑****************************************/
|
if(StringUtil.isNotBlank(req.getLevel()) || StringUtil.isNotBlank(req.getStaffName())){
|
||||||
if(list.size()<req.getPageSize()){
|
*//*************************************数据拼接逻辑****************************************//*
|
||||||
List<String> commitStaffIds = new ArrayList<>();
|
if(list.size()<req.getPageSize()){
|
||||||
//已提交
|
List<String> commitStaffIds = new ArrayList<>();
|
||||||
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
//已提交
|
||||||
.eq("is_delete", req.getType()==1?2:0)
|
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
|
||||||
.eq("type", req.getType())
|
.eq("is_delete", req.getType()==1?2:0)
|
||||||
.like("month_time", req.getSelectMonthTime())
|
.eq("type", req.getType())
|
||||||
.in("department_id", allDeparmentIds)
|
.like("month_time", req.getSelectMonthTime())
|
||||||
.select("DISTINCT staff_id"));
|
.in("department_id", allDeparmentIds)
|
||||||
if(CollectionUtils.isNotEmpty(objects)){
|
.select("DISTINCT staff_id"));
|
||||||
commitStaffIds = objects.stream().map(o -> o.toString()).collect(Collectors.toList());
|
if(CollectionUtils.isNotEmpty(objects)){
|
||||||
}
|
commitStaffIds = objects.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||||
//去除已提交的
|
}
|
||||||
staffIds.removeAll(commitStaffIds);
|
//去除已提交的
|
||||||
//防止真实状态为未提交的 又重新拼接
|
staffIds.removeAll(commitStaffIds);
|
||||||
if(CollectionUtils.isNotEmpty(list)){
|
//防止真实状态为未提交的 又重新拼接
|
||||||
List<String> collect = list.stream().map(reportProgressListDto -> reportProgressListDto.getStaffId()).collect(Collectors.toList());
|
if(CollectionUtils.isNotEmpty(list)){
|
||||||
staffIds.removeAll(collect);
|
List<String> collect = list.stream().map(reportProgressListDto -> reportProgressListDto.getStaffId()).collect(Collectors.toList());
|
||||||
}
|
staffIds.removeAll(collect);
|
||||||
|
}
|
||||||
|
|
||||||
if(CollectionUtils.isEmpty(staffIds)){
|
if(CollectionUtils.isEmpty(staffIds)){
|
||||||
return pageUtils;
|
return pageUtils;
|
||||||
}
|
}
|
||||||
int addSize = req.getPageSize()-list.size();
|
int addSize = req.getPageSize()-list.size();
|
||||||
int addStart = req.getCurrPage() -totalPage;
|
int addStart = req.getCurrPage() -totalPage;
|
||||||
//如果相差大于0 则需找到最后一页得个数 补齐得时候减去这些个数
|
//如果相差大于0 则需找到最后一页得个数 补齐得时候减去这些个数
|
||||||
if(addStart>0){
|
if(addStart>0){
|
||||||
|
|
||||||
copyReq.setCurrPage(pageUtils.getTotalPage());
|
copyReq.setCurrPage(pageUtils.getTotalPage());
|
||||||
copyReq.setPageSize(req.getPageSize());
|
copyReq.setPageSize(req.getPageSize());
|
||||||
PageUtils ps = PageUtils.startPage(copyReq.getCurrPage(),copyReq.getPageSize()).doSelect(
|
PageUtils ps = PageUtils.startPage(copyReq.getCurrPage(),copyReq.getPageSize()).doSelect(
|
||||||
page -> this.targetReportList(copyReq, copyStaffIds, page)
|
page -> this.targetReportList(copyReq, copyStaffIds, page)
|
||||||
);
|
);
|
||||||
int sub = ps.getList().size();
|
int sub = ps.getList().size();
|
||||||
addStart = (addStart-1) * req.getPageSize() + (copyReq.getPageSize()-sub);
|
addStart = (addStart-1) * req.getPageSize() + (copyReq.getPageSize()-sub);
|
||||||
|
}
|
||||||
|
int addEnd = addSize + addStart;
|
||||||
|
addEnd = addEnd>staffIds.size()?staffIds.size():addEnd;
|
||||||
|
addStart = addStart>staffIds.size()?0:addStart;
|
||||||
|
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();
|
||||||
|
copyList.addAll(addResult.getList());
|
||||||
|
data.setList(copyList);
|
||||||
|
data.setPageSize(req.getPageSize());
|
||||||
|
data.setCurrPage(req.getCurrPage());
|
||||||
|
data.setTotalCount(copyStaffIds.size());
|
||||||
|
data.setTotalPage(PageUtil.totalPage(copyStaffIds.size(),req.getPageSize()));
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
int addEnd = addSize + addStart;
|
|
||||||
addEnd = addEnd>staffIds.size()?staffIds.size():addEnd;
|
|
||||||
addStart = addStart>staffIds.size()?0:addStart;
|
|
||||||
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();
|
|
||||||
copyList.addAll(addResult.getList());
|
|
||||||
data.setList(copyList);
|
|
||||||
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();
|
PageUtils data = new PageUtils();
|
||||||
data.setList(list);
|
data.setList(list);
|
||||||
data.setPageSize(req.getPageSize());
|
data.setPageSize(req.getPageSize());
|
||||||
@ -275,7 +283,8 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
data.setTotalPage(PageUtil.totalPage(copyStaffIds.size(),req.getPageSize()));
|
data.setTotalPage(PageUtil.totalPage(copyStaffIds.size(),req.getPageSize()));
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -353,7 +362,7 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ReportProgressListDto> targetReportList(ReportListReq req, List<String> staffIds, IPage page) {
|
public List<ReportProgressListDto> targetReportList(ReportListReq req, List<String> staffIds, IPage page) {
|
||||||
List<ReportProgressListDto> reportProgressListDtos = resultRecordMapper.targetReportList(req, staffIds, page);
|
List<ReportProgressListDto> reportProgressListDtos = resultRecordMapper.targetReportList(req, staffIds,page);
|
||||||
//由于使用了 maxId 需要拿到id 获取最新数据
|
//由于使用了 maxId 需要拿到id 获取最新数据
|
||||||
if(CollectionUtils.isNotEmpty(reportProgressListDtos)){
|
if(CollectionUtils.isNotEmpty(reportProgressListDtos)){
|
||||||
reportProgressListDtos.forEach(reportProgressListDto -> {
|
reportProgressListDtos.forEach(reportProgressListDto -> {
|
||||||
@ -432,7 +441,7 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
//根据用户组拼接未提交分页数据
|
//根据用户组拼接未提交分页数据
|
||||||
private PageUtils buildPageByStaffIds(ReportListReq req,List<String> staffIds){
|
private PageUtils buildPageByStaffIds(ReportListReq req,List<String> staffIds){
|
||||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
|
||||||
page ->staffDao.getPositionByStaffIds(staffIds,page)
|
page ->staffDao.getPositionByStaffIds(req,staffIds,page)
|
||||||
);
|
);
|
||||||
//本次分页数据
|
//本次分页数据
|
||||||
List<ReportProgressListDto> dataList = pageUtils.getList();
|
List<ReportProgressListDto> dataList = pageUtils.getList();
|
||||||
|
|||||||
@ -10,6 +10,8 @@ package com.lz.modules.sys.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.lz.common.utils.Constant;
|
import com.lz.common.utils.Constant;
|
||||||
import com.lz.common.utils.MapUtils;
|
import com.lz.common.utils.MapUtils;
|
||||||
import com.lz.modules.flow.entity.FlowDepartment;
|
import com.lz.modules.flow.entity.FlowDepartment;
|
||||||
@ -22,11 +24,13 @@ import com.lz.modules.sys.entity.SysUserEntity;
|
|||||||
import com.lz.modules.sys.service.SysMenuService;
|
import com.lz.modules.sys.service.SysMenuService;
|
||||||
import com.lz.modules.sys.service.SysRoleMenuService;
|
import com.lz.modules.sys.service.SysRoleMenuService;
|
||||||
import com.lz.modules.sys.service.SysUserService;
|
import com.lz.modules.sys.service.SysUserService;
|
||||||
|
import com.lz.modules.sys.service.app.ChartService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
@Service("sysMenuService")
|
@Service("sysMenuService")
|
||||||
@ -42,6 +46,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuDao, SysMenuEntity> i
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StaffRoleService staffRoleService;
|
private StaffRoleService staffRoleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChartService chartService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList) {
|
public List<SysMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList) {
|
||||||
List<SysMenuEntity> menuList = queryListParentId(parentId);
|
List<SysMenuEntity> menuList = queryListParentId(parentId);
|
||||||
@ -88,7 +95,16 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuDao, SysMenuEntity> i
|
|||||||
roleId = 14l;
|
roleId = 14l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menuIdList = sysUserService.queryMenuIdListByRoleId(roleId);
|
Set<Long> roleIds = Sets.newHashSet(roleId);
|
||||||
|
if(chartService.hrOrBoss(user.getUserId())){
|
||||||
|
roleIds.add(19L);
|
||||||
|
roleIds.add(20L);
|
||||||
|
}
|
||||||
|
if(chartService.leader(user.getUserId())){
|
||||||
|
roleIds.add(20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
menuIdList = sysUserService.queryMenuIdListByRoleIds(roleIds);
|
||||||
}
|
}
|
||||||
return getAllMenuList(menuIdList);
|
return getAllMenuList(menuIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,6 +151,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> queryMenuIdListByRoleIds(Set<Long> roleIds) {
|
||||||
|
return baseMapper.queryMenuIdListByRoleIds(roleIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查角色是否越权
|
* 检查角色是否越权
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -3,9 +3,9 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://rm-bp1xhc66ruz72t68p.mysql.rds.aliyuncs.com:3306/lz_manger?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.157.238:3306/lz_management?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||||
username: lz_manger
|
username: ldd_biz
|
||||||
password: N8zfBwhOC
|
password: Hello1234
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
max-active: 100
|
max-active: 100
|
||||||
min-idle: 10
|
min-idle: 10
|
||||||
|
|||||||
@ -457,6 +457,8 @@
|
|||||||
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="req.staffName != null and req.staffName !=''">
|
||||||
|
and name LIKE CONCAT('%',#{req.staffName},'%')
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -66,4 +66,17 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryMenuIdListByRoleIds" resultType="java.lang.Long">
|
||||||
|
select distinct rm.menu_id from sys_user_role ur
|
||||||
|
LEFT JOIN sys_role_menu rm on ur.role_id = rm.role_id
|
||||||
|
<if test="roleIds !=null and roleIds.size()>0">
|
||||||
|
where ur.role_id in
|
||||||
|
<foreach collection="roleIds" item="item" index="index" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user