From e6b5e8aad4766184cfe51867f50d218dc23a03d8 Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Mon, 16 Dec 2024 18:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E8=A1=8C=E4=BA=BA=E6=8A=8A=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E4=BA=BA=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lSun <15893999301@qq.com> --- .../evection/service/EvectionServiceImpl.java | 35 +++++++++++++++---- .../service/LeaveReportingServiceImpl.java | 33 +++++++++++++---- .../LeaveReporting/LeaveReportingMapper.xml | 9 ++--- .../mapper/evection/EvectionMapper.xml | 8 ++--- 4 files changed, 61 insertions(+), 24 deletions(-) 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')