|
|
@@ -1657,7 +1657,7 @@ public class KwoTradeOrderService {
|
|
|
private void applyProxyScopeToTradeOrderQuery(TradeOrderListSelectDTO dto) {
|
|
|
// 1. 获取当前登录上下文中的企业ID
|
|
|
Long currentEntId = LoginUserHolder.getEntId();
|
|
|
-
|
|
|
+
|
|
|
// 2. 校验企业ID有效性,若为空则强制查询结果为空,确保数据安全
|
|
|
if (Objects.isNull(currentEntId)) {
|
|
|
log.warn("贸易订单代理关系过滤失败,当前登录企业ID为空");
|
|
|
@@ -1669,12 +1669,12 @@ public class KwoTradeOrderService {
|
|
|
// 3. 远程调用获取当前企业的类型信息列表
|
|
|
// 使用 Collections.singleton 包装单个ID以符合接口参数要求
|
|
|
List<EntTypeResDto> entTypeList = remoteSystemService.queryEntTypeByIds(Collections.singleton(currentEntId));
|
|
|
-
|
|
|
+
|
|
|
// 4. 构建代理关系可见的企业ID集合
|
|
|
// 传入一个Supplier lambda表达式,仅在需要时(即当前企业为供应商时)才查询其关联的代理商ID,优化性能
|
|
|
Set<Long> proxyScopeEntIds = buildProxyScopeEntIds(currentEntId, entTypeList,
|
|
|
() -> remoteContractService.queryProxyEntIdsBySupplyId(currentEntId));
|
|
|
-
|
|
|
+
|
|
|
// 5. 若存在有效的可见范围,则设置到DTO中
|
|
|
if (CollUtil.isNotEmpty(proxyScopeEntIds)) {
|
|
|
dto.setProxyScopeEntIds(new ArrayList<>(proxyScopeEntIds));
|
|
|
@@ -1682,7 +1682,7 @@ public class KwoTradeOrderService {
|
|
|
}
|
|
|
// 注意:若proxyScopeEntIds为空,表示当前企业不属于供应商或代理商角色,
|
|
|
// 此时不设置proxyScopeEntIds,后续逻辑将依赖常规的数据权限过滤。
|
|
|
-
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
// 6. 异常处理:记录错误日志,并强制查询结果为空,避免在系统异常时暴露全量数据
|
|
|
log.error("贸易订单代理关系过滤范围查询失败,currentEntId={}", currentEntId, e);
|
|
|
@@ -2302,7 +2302,7 @@ public class KwoTradeOrderService {
|
|
|
|
|
|
// 3. 根据供应方企业ID查询其是否具备代理属性
|
|
|
Integer agentFlag = querySupplyAgentFlag(supplyEntId);
|
|
|
-
|
|
|
+
|
|
|
log.debug("贸易合同代理属性查询完成,tradeContractId={}, agentFlag={}", tradeContractId, agentFlag);
|
|
|
return agentFlag;
|
|
|
|
|
|
@@ -2344,7 +2344,7 @@ public class KwoTradeOrderService {
|
|
|
|
|
|
// 判断该企业是否具有供应代理属性
|
|
|
boolean isAgent = hasSupplyAgentAttribute(entTypeList, supplyEntId);
|
|
|
-
|
|
|
+
|
|
|
// 记录结果日志
|
|
|
log.debug("供应单位代理属性查询完成,supplyEntId={}, isAgent={}", supplyEntId, isAgent);
|
|
|
|
|
|
@@ -2478,7 +2478,6 @@ public class KwoTradeOrderService {
|
|
|
throw new BusinessException("商品发货地址信息不存在");
|
|
|
}
|
|
|
order.setSettlement(tradeContractResDto.getSettlement());
|
|
|
- order.setIsAgent(tradeOrderParam.getIsAgent());
|
|
|
kwoTradeOrderMapper.insert(order);//贸易订单
|
|
|
// walletFreeze.setTTradeOrderId(order.getId());
|
|
|
|