diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/service/EvectionServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/service/EvectionServiceImpl.java index f02754e..7d103dc 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/service/EvectionServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/service/EvectionServiceImpl.java @@ -3,8 +3,10 @@ package com.bonus.system.evection.service; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.system.api.domain.MapVo; +import com.bonus.system.api.domain.SysRole; import com.bonus.system.evection.dao.EvectionDao; import com.bonus.system.evection.entity.EvectionBean; +import com.bonus.system.holiday.dao.WorkReportDao; import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import lombok.extern.log4j.Log4j2; import org.springframework.stereotype.Service; @@ -24,16 +26,37 @@ public class EvectionServiceImpl implements EvectionService { @Resource(name = "EvectionDao") private EvectionDao evectionDao; + @Resource(name = "WorkReportDao") + private WorkReportDao dao; + @Override public List getEvectionList(EvectionBean bean) { //只能查自己部门的人 - List orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); - if(!orgList.isEmpty()){ - ArrayList ids = new ArrayList<>(); - for (MapVo mapVo : orgList) { - ids.add(String.valueOf(mapVo.getId())); +// List orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); +// if(!orgList.isEmpty()){ +// ArrayList ids = new ArrayList<>(); +// for (MapVo mapVo : orgList) { +// ids.add(String.valueOf(mapVo.getId())); +// } +// bean.setOrgList(ids); +// } +// Map params = bean.getParams(); + //不是管理员,只能查自己 + Long userId = SecurityUtils.getUserId(); + List sysRoleList = dao.getRoleListByUserId(userId); + int roleCount = 0; + if(!sysRoleList.isEmpty()){ + for (SysRole sysRole : sysRoleList) { + if(sysRole.getRoleName().contains("管理员")){ + roleCount = 1; + break; + } } - bean.setOrgList(ids); + } + if(roleCount==1){ + + }else{ + bean.setUserId(userId); } Map params = bean.getParams(); return evectionDao.getEvectionList(bean,params); diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/service/LeaveReportingServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/service/LeaveReportingServiceImpl.java index f7e98fc..ba3e252 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/service/LeaveReportingServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/service/LeaveReportingServiceImpl.java @@ -15,6 +15,7 @@ import com.bonus.system.api.domain.SysRole; import com.bonus.system.att.entity.Holiday; import com.bonus.system.basic.domain.SysNotice; import com.bonus.system.basic.service.SysNoticeService; +import com.bonus.system.holiday.dao.WorkReportDao; import com.bonus.system.leaveReporting.dao.LeaveReportingDao; import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import com.bonus.system.leaveReporting.entity.LeaveReportingImportBean; @@ -48,16 +49,36 @@ public class LeaveReportingServiceImpl implements LeaveReportingService { @Resource(name = "LeaveReportingDao") private LeaveReportingDao leaveReportingDao; + @Resource(name = "WorkReportDao") + private WorkReportDao dao; + @Override public List getLeaveReportingList(LeaveReportingBean bean) { //只能查自己部门的人 - List orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); - if(!orgList.isEmpty()){ - ArrayList ids = new ArrayList<>(); - for (MapVo mapVo : orgList) { - ids.add(String.valueOf(mapVo.getId())); +// List orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); +// if(!orgList.isEmpty()){ +// ArrayList ids = new ArrayList<>(); +// for (MapVo mapVo : orgList) { +// ids.add(String.valueOf(mapVo.getId())); +// } +// bean.setOrgList(ids); +// } + //不是管理员,只能查自己 + Long userId = SecurityUtils.getUserId(); + List sysRoleList = dao.getRoleListByUserId(userId); + int roleCount = 0; + if(!sysRoleList.isEmpty()){ + for (SysRole sysRole : sysRoleList) { + if(sysRole.getRoleName().contains("管理员")){ + roleCount = 1; + break; + } } - bean.setOrgList(ids); + } + if(roleCount==1){ + + }else{ + bean.setUserId(userId); } return leaveReportingDao.getLeaveReportingList(bean); } diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/LeaveReporting/LeaveReportingMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/LeaveReporting/LeaveReportingMapper.xml index e9b497d..c169bbf 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/LeaveReporting/LeaveReportingMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/LeaveReporting/LeaveReportingMapper.xml @@ -89,12 +89,8 @@ LEFT JOIN sys_dict_data d on d.dict_code = p.post_id WHERE l.is_active = '1' AND l.leave_type = '休假报备' AND l.source = '1' - - and org_id in ( - - #{item} - - ) + + and l.user_id = #{params.userId} and date_format(l.leave_start_date,'%y%m%d') >= date_format(#{params.params.beginTime},'%y%m%d') @@ -138,6 +134,7 @@ l.leave_duration, GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName, l.host_user_id, + l.host_user_name, l.is_agree, l.location, l. remark as remark diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/evection/EvectionMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/evection/EvectionMapper.xml index 4458767..23b7d9c 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/evection/EvectionMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/evection/EvectionMapper.xml @@ -96,12 +96,8 @@ LEFT JOIN sys_dict_data d on d.dict_code = p.post_id WHERE l.is_active = '1' AND l.leave_type = '出差报备' AND l.source = '1' - - and org_id in ( - - #{item} - - ) + + and l.user_id = #{bean.userId} and date_format(l.leave_start_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')