出行人把申请人自动带入

Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
lSun 2024-12-16 18:28:20 +08:00
parent a595d6a538
commit e6b5e8aad4
4 changed files with 61 additions and 24 deletions

View File

@ -3,8 +3,10 @@ package com.bonus.system.evection.service;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.api.domain.MapVo; 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.dao.EvectionDao;
import com.bonus.system.evection.entity.EvectionBean; import com.bonus.system.evection.entity.EvectionBean;
import com.bonus.system.holiday.dao.WorkReportDao;
import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -24,16 +26,37 @@ public class EvectionServiceImpl implements EvectionService {
@Resource(name = "EvectionDao") @Resource(name = "EvectionDao")
private EvectionDao evectionDao; private EvectionDao evectionDao;
@Resource(name = "WorkReportDao")
private WorkReportDao dao;
@Override @Override
public List<EvectionBean> getEvectionList(EvectionBean bean) { public List<EvectionBean> getEvectionList(EvectionBean bean) {
//只能查自己部门的人 //只能查自己部门的人
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); // List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList();
if(!orgList.isEmpty()){ // if(!orgList.isEmpty()){
ArrayList<String> ids = new ArrayList<>(); // ArrayList<String> ids = new ArrayList<>();
for (MapVo mapVo : orgList) { // for (MapVo mapVo : orgList) {
ids.add(String.valueOf(mapVo.getId())); // ids.add(String.valueOf(mapVo.getId()));
// }
// bean.setOrgList(ids);
// }
// Map<String, Object> params = bean.getParams();
//不是管理员只能查自己
Long userId = SecurityUtils.getUserId();
List<SysRole> 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<String, Object> params = bean.getParams(); Map<String, Object> params = bean.getParams();
return evectionDao.getEvectionList(bean,params); return evectionDao.getEvectionList(bean,params);

View File

@ -15,6 +15,7 @@ import com.bonus.system.api.domain.SysRole;
import com.bonus.system.att.entity.Holiday; import com.bonus.system.att.entity.Holiday;
import com.bonus.system.basic.domain.SysNotice; import com.bonus.system.basic.domain.SysNotice;
import com.bonus.system.basic.service.SysNoticeService; 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.dao.LeaveReportingDao;
import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
import com.bonus.system.leaveReporting.entity.LeaveReportingImportBean; import com.bonus.system.leaveReporting.entity.LeaveReportingImportBean;
@ -48,16 +49,36 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
@Resource(name = "LeaveReportingDao") @Resource(name = "LeaveReportingDao")
private LeaveReportingDao leaveReportingDao; private LeaveReportingDao leaveReportingDao;
@Resource(name = "WorkReportDao")
private WorkReportDao dao;
@Override @Override
public List<LeaveReportingBean> getLeaveReportingList(LeaveReportingBean bean) { public List<LeaveReportingBean> getLeaveReportingList(LeaveReportingBean bean) {
//只能查自己部门的人 //只能查自己部门的人
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); // List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList();
if(!orgList.isEmpty()){ // if(!orgList.isEmpty()){
ArrayList<String> ids = new ArrayList<>(); // ArrayList<String> ids = new ArrayList<>();
for (MapVo mapVo : orgList) { // for (MapVo mapVo : orgList) {
ids.add(String.valueOf(mapVo.getId())); // ids.add(String.valueOf(mapVo.getId()));
// }
// bean.setOrgList(ids);
// }
//不是管理员只能查自己
Long userId = SecurityUtils.getUserId();
List<SysRole> 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); return leaveReportingDao.getLeaveReportingList(bean);
} }

View File

@ -89,12 +89,8 @@
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE WHERE
l.is_active = '1' AND l.leave_type = '休假报备' AND l.source = '1' l.is_active = '1' AND l.leave_type = '休假报备' AND l.source = '1'
<if test='params.orgList != null and params.orgList.size() > 0'> <if test='params.userId != null '>
and org_id in ( and l.user_id = #{params.userId}
<foreach collection="params.orgList" item="item" separator=",">
#{item}
</foreach>
)
</if> </if>
<if test="params.params.beginTime != null and params.params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.params.beginTime != null and params.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{params.params.beginTime},'%y%m%d') and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{params.params.beginTime},'%y%m%d')
@ -138,6 +134,7 @@
l.leave_duration, l.leave_duration,
GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName, GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName,
l.host_user_id, l.host_user_id,
l.host_user_name,
l.is_agree, l.is_agree,
l.location, l.location,
l. remark as remark l. remark as remark

View File

@ -96,12 +96,8 @@
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE WHERE
l.is_active = '1' AND l.leave_type = '出差报备' AND l.source = '1' l.is_active = '1' AND l.leave_type = '出差报备' AND l.source = '1'
<if test='bean.orgList != null and bean.orgList.size() > 0'> <if test='bean.userId != null '>
and org_id in ( and l.user_id = #{bean.userId}
<foreach collection="bean.orgList" item="item" separator=",">
#{item}
</foreach>
)
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"> <if test="params.beginTime != null and params.beginTime != ''">
and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')