货物类型查询修改 查询币值添加

This commit is contained in:
zhaoqing
2026-06-03 18:42:55 +08:00
parent fd4aebd8b1
commit c467931fd6
4 changed files with 83 additions and 1 deletions
@@ -280,9 +280,11 @@ public class StockShelfOrderApplicationService {
for (ShelfMaterialDetailPO shelfMaterialDetailPO : shelfMaterialDetailPOList) {
MaterialBaseInfoPO materialBaseInfoPO = materialBaseInfoMap.get(shelfMaterialDetailPO.getMaterialBaseInfoId());
shelfMaterialDetailPO.setCopyCode(materialBaseInfoPO != null ? materialBaseInfoPO.getCopyCode() : null);
shelfMaterialDetailPO.setCurrency(materialBaseInfoPO != null ? materialBaseInfoPO.getCurrency() : null);
for (ShelfMaterialDetailPO child : shelfMaterialDetailPO.getChildren()) {
MaterialBaseInfoPO materialBaseInfoPOChild = materialBaseInfoMap.get(child.getMaterialBaseInfoId());
child.setCopyCode(materialBaseInfoPOChild != null ? materialBaseInfoPOChild.getCopyCode() : null);
child.setCurrency(materialBaseInfoPOChild != null ? materialBaseInfoPOChild.getCurrency() : null);
}
}
@@ -2796,4 +2798,70 @@ public class StockShelfOrderApplicationService {
stockShelfOrderMapper.updateById(entity);
}
public List<StockShelfOrderPO> queryList1(StockShelfOrderDO stockShelfOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockShelfOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
stockShelfOrderDO.setOrganizationId(frontendOrganizationId);
stockShelfOrderDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
stockShelfOrderDO.setOrganizationId(null);
stockShelfOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
stockShelfOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockShelfOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (stockShelfOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockShelfOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
stockShelfOrderDO.setTopOrganizationId(2827L);
}
}
try {
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (associationWarehouseCacheDO != null) {
// 如果前端没有传仓库ID,则使用关联仓库ID;前端传了则以前端为准
if (stockShelfOrderDO.getWarehouseId() == null && associationWarehouseCacheDO.getWarehouseId() != null) {
stockShelfOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
} catch (Exception e) {
// 如果获取仓库信息失败,记录日志但不影响查询(允许查询所有仓库)
log.warn("获取用户关联仓库信息失败,将查询所有仓库数据,用户ID:{},错误:{}", loginUser.getUserid(), e.getMessage());
}
}
return stockShelfOrderDomainService.queryList(stockShelfOrderDO);
}
}
@@ -383,4 +383,8 @@ public class ShelfMaterialDetailPO extends BaseVOEntity {
@ApiModelProperty("批次号")
@Excel(name = "批次号")
private String batchNo;
@ApiModelProperty("币制")
@Excel(name = "币制")
private String currency;
}
@@ -135,6 +135,11 @@ public class StockShelfOrderPO extends StockInOrderBasePO {
@ApiModelProperty("推送人姓名")
private String pushByName;
@ApiModelProperty("货物类型 0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("批次号")
@Excel(name = "批次号")
private String batchNo;
@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="pushTime" column="push_time" />
<result property="pushBy" column="push_by" />
<result property="pushByName" column="push_by_name" />
<result property="goodsType" column="goods_type" />
</resultMap>
@@ -38,7 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.in_order_number, a.receipt_order_number,a.receipt_task_number, a.shelf_order_number,a.status, a.receipt_quantity, a.shelves_quantity, a.material_quantity,
a.shelves_material_quantity, a.abnormal,a.task_distribution, a.task_distribution_time, a.operators_by, a.remark, a.create_time, a.create_by,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
,a.push_status,a.push_time,a.push_by,a.push_by_name
,a.push_status,a.push_time,a.push_by,a.push_by_name,
(SELECT m.goods_type FROM shelf_material_detail d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.shelf_order_number = a.shelf_order_number AND d.level = 1
LIMIT 1) AS goods_type
</sql>
<sql id="selectStockShelfOrderPo1">