diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/controller/EvectionController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/controller/EvectionController.java index 0059066..33d7d6c 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/controller/EvectionController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/evection/controller/EvectionController.java @@ -6,13 +6,17 @@ import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.common.log.annotation.Log; import com.bonus.common.log.enums.BusinessType; import com.bonus.common.security.annotation.RequiresPermissions; +import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.domain.SysRole; import com.bonus.system.evection.entity.EvectionBean; import com.bonus.system.evection.service.EvectionService; +import com.bonus.system.holiday.dao.WorkReportDao; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.List; /** * 出差报备 @@ -27,6 +31,9 @@ public class EvectionController extends BaseController { @Resource(name = "EvectionService") private EvectionService evectionService; + @Resource(name = "WorkReportDao") + private WorkReportDao dao; + /** * 获取出差报备列表(表格) */ @@ -36,8 +43,23 @@ public class EvectionController extends BaseController { public TableDataInfo list(EvectionBean bean) { try{ startPage(); - //只能查询自己的或自己导入的 -// bean.setUserId(SecurityUtils.getLoginUser().getSysUser().getUserId()); + //不是管理员,只能查自己 + 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; + } + } + } + if(roleCount==1){ + + }else{ + bean.setUserId(userId); + } return getDataTable(evectionService.getEvectionList(bean)); }catch (Exception e){ log.error(e.toString(),e); 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 7d103dc..8e095c2 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 @@ -26,8 +26,7 @@ public class EvectionServiceImpl implements EvectionService { @Resource(name = "EvectionDao") private EvectionDao evectionDao; - @Resource(name = "WorkReportDao") - private WorkReportDao dao; + @Override public List getEvectionList(EvectionBean bean) { @@ -41,23 +40,6 @@ public class EvectionServiceImpl implements EvectionService { // 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; - } - } - } - 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/controller/LeaveReportingController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/controller/LeaveReportingController.java index 84a1903..d654fc8 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/controller/LeaveReportingController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/leaveReporting/controller/LeaveReportingController.java @@ -7,6 +7,8 @@ import com.bonus.common.log.annotation.Log; import com.bonus.common.log.enums.BusinessType; import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.domain.SysRole; +import com.bonus.system.holiday.dao.WorkReportDao; import com.bonus.system.holiday.entity.HolidayBean; import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import com.bonus.system.leaveReporting.service.LeaveReportingService; @@ -15,6 +17,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.List; /** * 休假报备 @@ -29,6 +32,9 @@ public class LeaveReportingController extends BaseController { @Resource(name = "LeaveReportingService") private LeaveReportingService leaveReportingService; + @Resource(name = "WorkReportDao") + private WorkReportDao dao; + /** * 获取休假报备列表(表格) */ @@ -38,8 +44,23 @@ public class LeaveReportingController extends BaseController { public TableDataInfo list(LeaveReportingBean bean) { try{ startPage(); - //只能查询自己的或自己导入的 -// bean.setUserId(SecurityUtils.getLoginUser().getSysUser().getUserId()); + //不是管理员,只能查自己 + 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; + } + } + } + if(roleCount==1){ + + }else{ + bean.setUserId(userId); + } return getDataTable(leaveReportingService.getLeaveReportingList(bean)); }catch (Exception e){ log.error(e.toString(),e); 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 ba3e252..ed74b40 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 @@ -49,8 +49,7 @@ public class LeaveReportingServiceImpl implements LeaveReportingService { @Resource(name = "LeaveReportingDao") private LeaveReportingDao leaveReportingDao; - @Resource(name = "WorkReportDao") - private WorkReportDao dao; + @Override public List getLeaveReportingList(LeaveReportingBean bean) { @@ -63,23 +62,6 @@ public class LeaveReportingServiceImpl implements LeaveReportingService { // } // 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; - } - } - } - if(roleCount==1){ - - }else{ - bean.setUserId(userId); - } return leaveReportingDao.getLeaveReportingList(bean); }