消息提醒

Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
lSun 2024-12-19 19:08:18 +08:00
parent 870381457b
commit 097e271be9
4 changed files with 49 additions and 42 deletions

View File

@ -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<SysRole> 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);

View File

@ -26,8 +26,7 @@ public class EvectionServiceImpl implements EvectionService {
@Resource(name = "EvectionDao")
private EvectionDao evectionDao;
@Resource(name = "WorkReportDao")
private WorkReportDao dao;
@Override
public List<EvectionBean> getEvectionList(EvectionBean bean) {
@ -41,23 +40,6 @@ public class EvectionServiceImpl implements EvectionService {
// 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;
}
}
}
if(roleCount==1){
}else{
bean.setUserId(userId);
}
Map<String, Object> params = bean.getParams();
return evectionDao.getEvectionList(bean,params);
}

View File

@ -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<SysRole> 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);

View File

@ -49,8 +49,7 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
@Resource(name = "LeaveReportingDao")
private LeaveReportingDao leaveReportingDao;
@Resource(name = "WorkReportDao")
private WorkReportDao dao;
@Override
public List<LeaveReportingBean> getLeaveReportingList(LeaveReportingBean bean) {
@ -63,23 +62,6 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
// }
// 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;
}
}
}
if(roleCount==1){
}else{
bean.setUserId(userId);
}
return leaveReportingDao.getLeaveReportingList(bean);
}