Commit 40219f22 authored by 罗林杰's avatar 罗林杰

修改门店权限

parent 63327e70
...@@ -8,13 +8,18 @@ import org.rcisoft.bus.custinfo.dao.CustInfoRepository; ...@@ -8,13 +8,18 @@ import org.rcisoft.bus.custinfo.dao.CustInfoRepository;
import org.rcisoft.bus.custinfo.entity.CustInfo; import org.rcisoft.bus.custinfo.entity.CustInfo;
import org.rcisoft.bus.custinfo.service.CustInfoService; import org.rcisoft.bus.custinfo.service.CustInfoService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -26,6 +31,10 @@ import lombok.extern.slf4j.Slf4j; ...@@ -26,6 +31,10 @@ import lombok.extern.slf4j.Slf4j;
public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo> implements CustInfoService { public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo> implements CustInfoService {
@Value("${cy.init.adminRole}")
private String[] adminRoleIds;
/** /**
* 保存 客户信息表 * 保存 客户信息表
* @param custInfo * @param custInfo
...@@ -102,6 +111,21 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo ...@@ -102,6 +111,21 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo
@Override @Override
public IPage<CustInfo> findAllByPagination(CyPageInfo<CustInfo> paginationUtility, public IPage<CustInfo> findAllByPagination(CyPageInfo<CustInfo> paginationUtility,
CustInfo custInfo){ CustInfo custInfo){
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = Arrays.stream(adminRoleIds)
.anyMatch(userRoles::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin) {
custInfo.setStoreId(CyUserUtil.getAuthenDept());
}
return baseMapper.queryCustInfosPaged(paginationUtility,custInfo); return baseMapper.queryCustInfosPaged(paginationUtility,custInfo);
} }
......
...@@ -15,13 +15,18 @@ import org.rcisoft.bus.custrecharge.service.CustRechargeService; ...@@ -15,13 +15,18 @@ import org.rcisoft.bus.custrecharge.service.CustRechargeService;
import org.rcisoft.core.service.CyBaseService; import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -33,6 +38,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -33,6 +38,9 @@ import lombok.extern.slf4j.Slf4j;
public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository,CustRecharge> implements CustRechargeService { public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository,CustRecharge> implements CustRechargeService {
@Value("${cy.init.adminRole}")
private String[] adminRoleIds;
/** /**
* 保存 客户消费表 * 保存 客户消费表
* @param custRecharge * @param custRecharge
...@@ -108,6 +116,21 @@ public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository, ...@@ -108,6 +116,21 @@ public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository,
@Override @Override
public IPage<CustRecharge> findAllByPagination(CyPageInfo<CustRecharge> paginationUtility, public IPage<CustRecharge> findAllByPagination(CyPageInfo<CustRecharge> paginationUtility,
CustRecharge custRecharge){ CustRecharge custRecharge){
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = Arrays.stream(adminRoleIds)
.anyMatch(userRoles::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin) {
custRecharge.setStoreId(CyUserUtil.getAuthenDept());
}
return baseMapper.queryCustRechargesPaged(paginationUtility,custRecharge); return baseMapper.queryCustRechargesPaged(paginationUtility,custRecharge);
} }
......
...@@ -22,6 +22,7 @@ import org.rcisoft.core.model.CyPersistModel; ...@@ -22,6 +22,7 @@ import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -29,9 +30,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -29,9 +30,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
/** /**
* Created by cy on 2024年5月29日 下午1:21:49. * Created by cy on 2024年5月29日 下午1:21:49.
...@@ -52,6 +52,9 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -52,6 +52,9 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Autowired @Autowired
private StoreGoodsStockRepository storeGoodsStockRepository; private StoreGoodsStockRepository storeGoodsStockRepository;
@Value("${cy.init.adminRole}")
private String[] adminRoleIds;
/** /**
* 保存 商品申请表 * 保存 商品申请表
* *
...@@ -78,6 +81,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -78,6 +81,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
BeanUtils.copyProperties(addwmsGoodsApply, storeGoodsApply); BeanUtils.copyProperties(addwmsGoodsApply, storeGoodsApply);
storeGoodsApply.setIoType("0"); storeGoodsApply.setIoType("0");
storeGoodsApply.setDealStatus("0"); storeGoodsApply.setDealStatus("0");
storeGoodsApply.setStoreId(CyUserUtil.getAuthenDept());
baseMapper.insert(storeGoodsApply); baseMapper.insert(storeGoodsApply);
// 空 // 空
if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList())) { if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList())) {
...@@ -133,6 +137,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -133,6 +137,7 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
BeanUtils.copyProperties(addwmsGoodsApply, storeGoodsApplyOut); BeanUtils.copyProperties(addwmsGoodsApply, storeGoodsApplyOut);
storeGoodsApplyOut.setIoType("1"); storeGoodsApplyOut.setIoType("1");
storeGoodsApplyOut.setDealStatus("1"); storeGoodsApplyOut.setDealStatus("1");
storeGoodsApplyOut.setStoreId(CyUserUtil.getAuthenDept());
baseMapper.insert(storeGoodsApplyOut); baseMapper.insert(storeGoodsApplyOut);
// 2. 遍历 // 2. 遍历
...@@ -274,6 +279,19 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -274,6 +279,19 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Override @Override
public IPage<StoreGoodsApply> findAllByPagination(CyPageInfo<StoreGoodsApply> paginationUtility, public IPage<StoreGoodsApply> findAllByPagination(CyPageInfo<StoreGoodsApply> paginationUtility,
StoreGoodsApply storeGoodsApply) { StoreGoodsApply storeGoodsApply) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = Arrays.stream(adminRoleIds)
.anyMatch(userRoles::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin) {
storeGoodsApply.setStoreId(CyUserUtil.getAuthenDept());
}
return baseMapper.queryWmsGoodsApplysPaged(paginationUtility, storeGoodsApply); return baseMapper.queryWmsGoodsApplysPaged(paginationUtility, storeGoodsApply);
} }
...@@ -281,6 +299,19 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos ...@@ -281,6 +299,19 @@ public class StoreGoodsApplyServiceImpl extends ServiceImpl<StoreGoodsApplyRepos
@Override @Override
public IPage<StoreGoodsApply> OutfindAllByPagination(CyPageInfo<StoreGoodsApply> paginationUtility, public IPage<StoreGoodsApply> OutfindAllByPagination(CyPageInfo<StoreGoodsApply> paginationUtility,
StoreGoodsApply storeGoodsApply) { StoreGoodsApply storeGoodsApply) {
// 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = Arrays.stream(adminRoleIds)
.anyMatch(userRoles::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin) {
storeGoodsApply.setStoreId(CyUserUtil.getAuthenDept());
}
return baseMapper.queryWmsGoodsApplysOutPaged(paginationUtility, storeGoodsApply); return baseMapper.queryWmsGoodsApplysOutPaged(paginationUtility, storeGoodsApply);
} }
......
...@@ -18,12 +18,16 @@ import org.rcisoft.core.model.CyPageInfo; ...@@ -18,12 +18,16 @@ import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* Created by cy on 2024年5月29日 下午1:21:49. * Created by cy on 2024年5月29日 下午1:21:49.
...@@ -36,6 +40,9 @@ public class StoreGoodsStockServiceImpl extends ServiceImpl<StoreGoodsStockRepos ...@@ -36,6 +40,9 @@ public class StoreGoodsStockServiceImpl extends ServiceImpl<StoreGoodsStockRepos
@Autowired @Autowired
StoreGoodsLogRepository wmsGoodsLogRepository; StoreGoodsLogRepository wmsGoodsLogRepository;
@Value("${cy.init.adminRole}")
private String[] adminRoleIds;
/** /**
* 保存 库存管理表 * 保存 库存管理表
* @param storeGoodsStock * @param storeGoodsStock
...@@ -130,8 +137,20 @@ public class StoreGoodsStockServiceImpl extends ServiceImpl<StoreGoodsStockRepos ...@@ -130,8 +137,20 @@ public class StoreGoodsStockServiceImpl extends ServiceImpl<StoreGoodsStockRepos
@Override @Override
public IPage<StoreGoodsStockPageResultsDto> findAllByPagination(CyPageInfo<StoreGoodsStockPageResultsDto> paginationUtility, public IPage<StoreGoodsStockPageResultsDto> findAllByPagination(CyPageInfo<StoreGoodsStockPageResultsDto> paginationUtility,
StoreGoodsStockPageResultsDto storeGoodsStock){ StoreGoodsStockPageResultsDto storeGoodsStock){
return baseMapper.queryWmsGoodsStocksPaged(paginationUtility,storeGoodsStock); // 获取当前用户的角色ID
String roleIds = CyUserUtil.getAuthenRoleIds();
// 将角色ID字符串分割成数组,并去除每个ID前后的空白字符
Set<String> userRoles = Arrays.stream(roleIds.split(","))
.map(String::trim)
.collect(Collectors.toSet());
// 检查当前用户是否有管理员权限
boolean isAdmin = Arrays.stream(adminRoleIds)
.anyMatch(userRoles::contains);
// 根据是否是管理员调整查询条件
if (!isAdmin) {
storeGoodsStock.setStoreId(CyUserUtil.getAuthenDept());
}
return baseMapper.queryWmsGoodsStocksPaged(paginationUtility, storeGoodsStock);
} }
/** /**
......
...@@ -18,8 +18,7 @@ cy: ...@@ -18,8 +18,7 @@ cy:
init: init:
admin: admin:
- "1" - "1"
adminRole: adminRole: "1"
- "1"
permission: permission:
- "44" - "44"
- "51" - "51"
......
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