出入库异常未按照仓库过滤
This commit is contained in:
+22
-8
@@ -32,18 +32,32 @@ public class InOrderAbnormalApplicationService {
|
||||
|
||||
public List<InOrderAbnormalPO> queryList(InOrderAbnormalDO inOrderAbnormalDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
inOrderAbnormalDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
// 请求未带 warehouseId 时用用户关联仓库;带了则以请求为准(与出库异常一致)
|
||||
if (inOrderAbnormalDO.getWarehouseId() == null) {
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
AssociationWarehouseCacheDO cache =
|
||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (cache != null && cache.getWarehouseId() != null) {
|
||||
if (inOrderAbnormalDO.getWarehouseId() == null && cache != null
|
||||
&& cache.getWarehouseId() != null) {
|
||||
inOrderAbnormalDO.setWarehouseId(cache.getWarehouseId());
|
||||
}
|
||||
if (inOrderAbnormalDO.getTopOrganizationId() == null) {
|
||||
Long top = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (top == null || Long.valueOf(1L).equals(top)) {
|
||||
if (cache != null) {
|
||||
top = cache.getTopOrganizationId();
|
||||
}
|
||||
}
|
||||
if (top != null && !Long.valueOf(1L).equals(top)) {
|
||||
inOrderAbnormalDO.setTopOrganizationId(top);
|
||||
}
|
||||
}
|
||||
if (inOrderAbnormalDO.getOrganizationId() == null) {
|
||||
Long orgId = loginUser.getUserPo().getOrganizationId();
|
||||
if (orgId == null && cache != null) {
|
||||
orgId = cache.getOrganizationId();
|
||||
}
|
||||
if (orgId != null) {
|
||||
inOrderAbnormalDO.setOrganizationId(orgId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return inOrderAbnormalDomainService.queryList(inOrderAbnormalDO);
|
||||
|
||||
+23
-8
@@ -32,18 +32,33 @@ public class OutOrderAbnormalApplicationService {
|
||||
|
||||
public List<OutOrderAbnormalPO> queryList(OutOrderAbnormalDO outOrderAbnormalDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
outOrderAbnormalDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
// 请求未带 warehouseId 时用用户关联仓库;带了则以请求为准(与入库异常一致)
|
||||
if (outOrderAbnormalDO.getWarehouseId() == null) {
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
// 请求带仓库时也会读关联缓存,用于补全「会话里为空的组织」(UserPo 常见无 organizationId)
|
||||
AssociationWarehouseCacheDO cache =
|
||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (cache != null && cache.getWarehouseId() != null) {
|
||||
if (outOrderAbnormalDO.getWarehouseId() == null && cache != null
|
||||
&& cache.getWarehouseId() != null) {
|
||||
outOrderAbnormalDO.setWarehouseId(cache.getWarehouseId());
|
||||
}
|
||||
if (outOrderAbnormalDO.getTopOrganizationId() == null) {
|
||||
Long top = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (top == null || Long.valueOf(1L).equals(top)) {
|
||||
if (cache != null) {
|
||||
top = cache.getTopOrganizationId();
|
||||
}
|
||||
}
|
||||
if (top != null && !Long.valueOf(1L).equals(top)) {
|
||||
outOrderAbnormalDO.setTopOrganizationId(top);
|
||||
}
|
||||
}
|
||||
if (outOrderAbnormalDO.getOrganizationId() == null) {
|
||||
Long orgId = loginUser.getUserPo().getOrganizationId();
|
||||
if (orgId == null && cache != null) {
|
||||
orgId = cache.getOrganizationId();
|
||||
}
|
||||
if (orgId != null) {
|
||||
outOrderAbnormalDO.setOrganizationId(orgId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outOrderAbnormalDomainService.queryList(outOrderAbnormalDO);
|
||||
|
||||
Reference in New Issue
Block a user