Commit 55c9f988 authored by 方建宇's avatar 方建宇

修改导出权限

parent 26645fc9
......@@ -150,6 +150,22 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo
*/
@Override
public List<CustInfo> export(CustInfo custInfo) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
boolean adminKey = adminProperties.getAdmin().contains(CyUserUtil.getAuthenBusinessId());
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = userRoles.stream()
.anyMatch(adminProperties.getAdminRole()::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin || !adminKey) {
custInfo.setStoreId(CyUserUtil.getAuthenDept());
}
List<CustInfo> custInfoList = baseMapper.queryCustInfos(custInfo);
return custInfoList;
}
......
......@@ -123,7 +123,7 @@ public class CustRechargeController extends CyPaginationController<CustRecharge>
custRechargeServiceImpl.findAllByPagination(getPaginationUtility(), custRecharge);
return getGridModelResponse();
}
//@PreAuthorize("@cyPerm.hasPerm('sys:recharge:export')")
@CyOpeLogAnno(title = "system-客户消费表管理-查询客户消费表", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出客户消费表信息", notes = "导出客户消费表信息")
@GetMapping(value = "/export")
......
......@@ -153,6 +153,22 @@ public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository,
*/
@Override
public List<CustRecharge> export(CustRecharge custRecharge) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
boolean adminKey = adminProperties.getAdmin().contains(CyUserUtil.getAuthenBusinessId());
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = userRoles.stream()
.anyMatch(adminProperties.getAdminRole()::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin || !adminKey) {
custRecharge.setStoreId(CyUserUtil.getAuthenDept());
}
List<CustRecharge> custRechargeList = baseMapper.queryCustRecharges(custRecharge);
return custRechargeList;
}
......
......@@ -361,6 +361,22 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
*/
@Override
public List<StoreGoodsApply> export(StoreGoodsApply storeGoodsApply) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
boolean adminKey = adminProperties.getAdmin().contains(CyUserUtil.getAuthenBusinessId());
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = userRoles.stream()
.anyMatch(adminProperties.getAdminRole()::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin || !adminKey) {
storeGoodsApply.setStoreId(CyUserUtil.getAuthenDept());
}
List<StoreGoodsApply> storeGoodsApplyList = baseMapper.queryWmsGoodsApplys(storeGoodsApply);
return storeGoodsApplyList;
}
......
......@@ -3,6 +3,7 @@ package org.rcisoft.bus.storegoodslog.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bean.AdminProperties;
import org.rcisoft.bus.storegoodsapply.entity.StoreGoodsApply;
import org.rcisoft.bus.storegoodsapply.service.StoreGoodsApplyService;
import org.rcisoft.bus.storegoodslog.dao.StoreGoodsLogRepository;
......@@ -20,7 +21,10 @@ import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created by cy on 2024年5月29日 下午1:21:49.
......@@ -30,6 +34,9 @@ import java.util.List;
@Slf4j
public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepository, StoreGoodsLog> implements StoreGoodsLogService {
@Autowired
protected AdminProperties adminProperties;
@Autowired
private StoreGoodsLogService storeGoodsLogServiceImpl;
......@@ -164,6 +171,22 @@ public class StoreGoodsLogServiceImpl extends ServiceImpl<StoreGoodsLogRepositor
*/
@Override
public List<StoreGoodsLog> export(StoreGoodsLog storeGoodsLog) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
boolean adminKey = adminProperties.getAdmin().contains(CyUserUtil.getAuthenBusinessId());
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = userRoles.stream()
.anyMatch(adminProperties.getAdminRole()::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin || !adminKey) {
storeGoodsLog.setStoreId(CyUserUtil.getAuthenDept());
}
List<StoreGoodsLog> storeGoodsLogList = baseMapper.queryWmsGoodsLogs(storeGoodsLog);
return storeGoodsLogList;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment