diff --git a/src/main/java/com/lz/modules/app/controller/ReportResultController.java b/src/main/java/com/lz/modules/app/controller/ReportResultController.java index c9e0d6df..ef9a4e30 100644 --- a/src/main/java/com/lz/modules/app/controller/ReportResultController.java +++ b/src/main/java/com/lz/modules/app/controller/ReportResultController.java @@ -52,14 +52,11 @@ public class ReportResultController extends AbstractController{ @RequestMapping("chart") - public R reportChart(String selectMonthTime,String departmentId){ - /* if(!chartService.hrOrBoss(getUserId())){ + public R reportChart(ResultDistributionReq req){ + if(!chartService.hrOrBoss(getUserId())){ return R.ok(); - }*/ - if(StringUtil.isBlank(selectMonthTime)){ - selectMonthTime = YearMonth.now().toString(); } - ReportChartResp reportChartResp = chartService.reportChart(selectMonthTime, departmentId); + ReportChartResp reportChartResp = chartService.reportChart(req.getSelectMonthTime(), req.getDepartmentId()); return R.ok().put("data",reportChartResp); } @@ -68,9 +65,9 @@ public class ReportResultController extends AbstractController{ @RequestMapping("/report") public R list(ReportListReq req){ - /* if(!chartService.leader(getUserId())){ + if(!chartService.leader(getUserId())){ return R.ok(); - }*/ + } PageUtils pageUtils = chartService.resultReportList(req); return R.ok().put("page",pageUtils); } @@ -78,9 +75,9 @@ public class ReportResultController extends AbstractController{ @RequestMapping("/distribution") public R distribution(ResultDistributionReq req){ - /* if(!chartService.hrOrBoss(getUserId())){ + if(!chartService.hrOrBoss(getUserId())){ return R.ok(); - }*/ + } PageUtils pageUtils = chartService.reportDistribution(req); return R.ok().put("page",pageUtils); @@ -89,7 +86,7 @@ public class ReportResultController extends AbstractController{ @RequestMapping("/departmentTreeByStaffId") public R departmentTreeByStaffId(){ - /*Long userId = getUserId(); + Long userId = getUserId(); if(chartService.hrOrBoss(userId)){ List data = departmentsService.getDepartmentTree(); return R.ok().put("data",data); @@ -98,9 +95,7 @@ public class ReportResultController extends AbstractController{ List data = departmentsService.getDepartmentTreeByStaffId(String.valueOf(userId),true); return R.ok().put("data",data); } - return R.ok();*/ - List data = departmentsService.getDepartmentTree(); - return R.ok().put("data",data); + return R.ok(); diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ChartServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ChartServiceImpl.java index 54ce7356..090e1755 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ChartServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ChartServiceImpl.java @@ -78,7 +78,7 @@ public class ChartServiceImpl implements ChartService { int total = staffService.staffsByAllDeparmentIds(allDeparmentIds).size(); //已提交 int commit = resultRecordService.count(new QueryWrapper() - .eq("is_delete", 0) + .eq("is_delete", type==1?2:0) .eq("type", type) .like("month_time",monthTime) .ne("status", ResultRecordStatusEnum.CREATE.getStatus()) @@ -86,7 +86,7 @@ public class ChartServiceImpl implements ChartService { .select("DISTINCT staff_id")); //已完成 int finished = resultRecordService.count(new QueryWrapper() - .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()) @@ -167,7 +167,7 @@ public class ChartServiceImpl implements ChartService { //获取已提交人员 List commitStaffIds = new ArrayList<>(); List collect=resultRecordService.listObjs(new QueryWrapper() - .eq("is_delete", 0) + .eq("is_delete", req.getType()==1?2:0) .eq("type", req.getType()) .like("month_time",req.getSelectMonthTime()) .ne("status", ResultRecordStatusEnum.CREATE.getStatus()) @@ -193,6 +193,7 @@ public class ChartServiceImpl implements ChartService { } }else{ // 查询所有,需要拼装数据 ,先查询已提交得剩余得 用未提交缺多少补多少 + PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect( page -> resultRecordMapper.targetReportList(req, staffIds, page) ); @@ -204,7 +205,7 @@ public class ChartServiceImpl implements ChartService { List commitStaffIds = new ArrayList<>(); //已提交 List objects = resultRecordService.listObjs(new QueryWrapper() - .eq("is_delete", 0) + .eq("is_delete", req.getType()==1?2:0) .eq("type", req.getType()) .like("month_time", req.getSelectMonthTime()) .in("department_id", allDeparmentIds) @@ -243,20 +244,16 @@ public class ChartServiceImpl implements ChartService { 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; } @@ -308,6 +305,11 @@ public class ChartServiceImpl implements ChartService { @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; @@ -317,6 +319,11 @@ public class ChartServiceImpl implements ChartService { @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; diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index 06297a06..ae49e988 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -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 + + and type = #{req.type} + and r.staff_id in