|
|
|
@ -45,9 +45,7 @@ import org.springblade.system.feign.IDeptClient;
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 仓库 服务实现类 |
|
|
|
@ -164,28 +162,31 @@ public class BasicdataWarehouseServiceImpl extends BaseServiceImpl<BasicdataWare
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<BasicdataWarehouseEntity> getMyWarehouseList() { |
|
|
|
|
|
|
|
|
|
Set<Long> deptIds = new HashSet<>(); |
|
|
|
|
// 获取当前登陆人
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
//查询出部门表
|
|
|
|
|
String deptId = user.getDeptId(); |
|
|
|
|
List<Dept> userDeptNode = deptClient.getUserDeptNode(Long.parseLong(deptId)); |
|
|
|
|
String[] split = deptId.split(","); |
|
|
|
|
for (String s : split) { |
|
|
|
|
List<Dept> userDeptNode = deptClient.getUserDeptNode(Long.parseLong(s)); |
|
|
|
|
if (Func.isEmpty(userDeptNode)) { |
|
|
|
|
continue; |
|
|
|
|
} else { |
|
|
|
|
userDeptNode.forEach(u -> { |
|
|
|
|
deptIds.add(u.getId()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> deptIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if (Func.isEmpty(userDeptNode)) { |
|
|
|
|
log.error("userDeptNode用户部门信息有误+{" + userDeptNode + "}"); |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
userDeptNode.forEach(u -> { |
|
|
|
|
deptIds.add(u.getId()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
List<BasicdataWarehouseEntity> warehouseEntityList = baseMapper.selectList(Wrappers.<BasicdataWarehouseEntity>query().lambda().in(BasicdataWarehouseEntity::getDepartment, deptIds)); |
|
|
|
|
// String json = redis.get(CacheNames.tenantKeyObj(user.getTenantId(), CacheNames.USER_WAREHOUSE_KEY, user.getUserId()));
|
|
|
|
|
if (warehouseEntityList.size() <= 1) { |
|
|
|
|
redis.setEx(CacheNames.tenantKeyObj(user.getTenantId(), CacheNames.USER_WAREHOUSE_KEY, user.getUserId()), warehouseEntityList.get(0), 30 * 24 * 60 * 60L); |
|
|
|
|
} |
|
|
|
|
// if (warehouseEntityList.size() <= 1) {
|
|
|
|
|
// redis.setEx(CacheNames.tenantKeyObj(user.getTenantId(), CacheNames.USER_WAREHOUSE_KEY, user.getUserId()), warehouseEntityList.get(0), 30 * 24 * 60 * 60L);
|
|
|
|
|
// }
|
|
|
|
|
return warehouseEntityList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -193,18 +194,31 @@ public class BasicdataWarehouseServiceImpl extends BaseServiceImpl<BasicdataWare
|
|
|
|
|
public BasicdataWarehouseEntity getMyWarehouseList(String deptId, String tenantId, Long userId) { |
|
|
|
|
|
|
|
|
|
//查询出部门表
|
|
|
|
|
List<Dept> userDeptNode = deptClient.getUserDeptNode(Long.parseLong(deptId)); |
|
|
|
|
// List<Dept> userDeptNode = deptClient.getUserDeptNode(Long.parseLong(deptId));
|
|
|
|
|
|
|
|
|
|
Set<Long> deptIds = new HashSet<>(); |
|
|
|
|
// String deptId = user.getDeptId();
|
|
|
|
|
String[] split = deptId.split(","); |
|
|
|
|
for (String s : split) { |
|
|
|
|
List<Dept> userDeptNode = deptClient.getUserDeptNode(Long.parseLong(s)); |
|
|
|
|
if (Func.isEmpty(userDeptNode)) { |
|
|
|
|
continue; |
|
|
|
|
} else { |
|
|
|
|
userDeptNode.forEach(u -> { |
|
|
|
|
deptIds.add(u.getId()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Long> deptIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if (Func.isEmpty(userDeptNode)) { |
|
|
|
|
log.error("userDeptNode用户部门信息有误+{" + userDeptNode + "}"); |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
userDeptNode.forEach(u -> { |
|
|
|
|
deptIds.add(u.getId()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// if (Func.isEmpty(userDeptNode)) {
|
|
|
|
|
// log.error("userDeptNode用户部门信息有误+{" + userDeptNode + "}");
|
|
|
|
|
// return null;
|
|
|
|
|
// } else {
|
|
|
|
|
// userDeptNode.forEach(u -> {
|
|
|
|
|
// deptIds.add(u.getId());
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
BasicdataWarehouseEntity warehouseEntity = null; |
|
|
|
|
List<BasicdataWarehouseEntity> warehouseEntityList = baseMapper.selectList(Wrappers.<BasicdataWarehouseEntity>query().lambda().in(BasicdataWarehouseEntity::getDepartment, deptIds)); |
|
|
|
|
// String json = redis.get(CacheNames.tenantKeyObj(user.getTenantId(), CacheNames.USER_WAREHOUSE_KEY, user.getUserId()));
|
|
|
|
|