This commit is contained in:
杜建超 2020-09-28 16:55:29 +08:00
parent c873d0569c
commit 5745c24f6c
3 changed files with 28 additions and 23 deletions

View File

@ -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<DepartmentsDto> data = departmentsService.getDepartmentTree();
return R.ok().put("data",data);
@ -98,9 +95,7 @@ public class ReportResultController extends AbstractController{
List<DepartmentsDto> data = departmentsService.getDepartmentTreeByStaffId(String.valueOf(userId),true);
return R.ok().put("data",data);
}
return R.ok();*/
List<DepartmentsDto> data = departmentsService.getDepartmentTree();
return R.ok().put("data",data);
return R.ok();

View File

@ -78,7 +78,7 @@ 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())
@ -86,7 +86,7 @@ public class ChartServiceImpl implements ChartService {
.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())
@ -167,7 +167,7 @@ public class ChartServiceImpl implements ChartService {
//获取已提交人员
List<String> commitStaffIds = new ArrayList<>();
List<Object> collect=resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
.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<String> commitStaffIds = new ArrayList<>();
//已提交
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
.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;

View File

@ -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=")">