|
@@ -668,10 +668,11 @@ public class ParkingWalletFeeService {
|
|
|
private BigDecimal calculateMaxPurchaseQuantity(KwtParkingChargeStrategy currentStrategy,
|
|
private BigDecimal calculateMaxPurchaseQuantity(KwtParkingChargeStrategy currentStrategy,
|
|
|
BigDecimal currentStrategyUnitFee,
|
|
BigDecimal currentStrategyUnitFee,
|
|
|
BigDecimal serviceFeeBalance) {
|
|
BigDecimal serviceFeeBalance) {
|
|
|
- if (!isChargeStrategySwitchOpen() || currentStrategy == null
|
|
|
|
|
|
|
+ boolean strategySwitchOpen = isChargeStrategySwitchOpen();
|
|
|
|
|
+ if (!strategySwitchOpen || currentStrategy == null
|
|
|
|| currentStrategyUnitFee.compareTo(ZERO_AMOUNT) <= 0) {
|
|
|| currentStrategyUnitFee.compareTo(ZERO_AMOUNT) <= 0) {
|
|
|
log.info("最大可购买数量未计算,原因:{}",
|
|
log.info("最大可购买数量未计算,原因:{}",
|
|
|
- !isChargeStrategySwitchOpen() ? "收费策略开关未开启"
|
|
|
|
|
|
|
+ !strategySwitchOpen ? "收费策略开关未开启"
|
|
|
: currentStrategy == null ? "未匹配到收费策略" : "策略单价<=0");
|
|
: currentStrategy == null ? "未匹配到收费策略" : "策略单价<=0");
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
@@ -716,7 +717,8 @@ public class ParkingWalletFeeService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询企业当前生效的收费策略(开启状态中 id 最大的一条,用于下单冻结/预估)
|
|
|
|
|
|
|
+ * 查询企业当前绑定的收费策略(id 最大的一条,用于下单冻结/预估)。
|
|
|
|
|
+ * 收费策略是否启用统一由 kwt_parking_strategy_switch.status 控制,不再使用策略表 status 判断。
|
|
|
*
|
|
*
|
|
|
* @param proEntId 采购企业id
|
|
* @param proEntId 采购企业id
|
|
|
* @return 生效策略;未匹配到则返回null
|
|
* @return 生效策略;未匹配到则返回null
|
|
@@ -731,7 +733,8 @@ public class ParkingWalletFeeService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询采购方当前最优收费策略(开启状态中单价最低的一条,用于订单完结扣费)
|
|
|
|
|
|
|
+ * 查询采购方当前最优收费策略(实际单价最低的一条,用于订单完结扣费)。
|
|
|
|
|
+ * 收费策略是否启用统一由 kwt_parking_strategy_switch.status 控制,不再使用策略表 status 判断。
|
|
|
*
|
|
*
|
|
|
* @param proEntId 采购企业id
|
|
* @param proEntId 采购企业id
|
|
|
* @return 最优策略;未匹配到则返回null
|
|
* @return 最优策略;未匹配到则返回null
|
|
@@ -750,9 +753,14 @@ public class ParkingWalletFeeService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询企业已绑定且处于开启状态的收费策略列表
|
|
|
|
|
|
|
+ * 查询企业已绑定的收费策略列表。
|
|
|
|
|
+ * 收费策略总开关统一以 kwt_parking_strategy_switch.status 为准,不再使用 kwt_parking_charge_strategy.status 过滤。
|
|
|
*/
|
|
*/
|
|
|
private List<KwtParkingChargeStrategy> listEnableStrategiesByProEntId(Long proEntId) {
|
|
private List<KwtParkingChargeStrategy> listEnableStrategiesByProEntId(Long proEntId) {
|
|
|
|
|
+ if (!isChargeStrategySwitchOpen()) {
|
|
|
|
|
+ log.info("收费策略总开关未开启,不查询企业收费策略绑定,proEntId:{}", proEntId);
|
|
|
|
|
+ return List.of();
|
|
|
|
|
+ }
|
|
|
List<KwtParkingChargeStrategyUnit> strategyUnitList = parkingChangeStrategyUnitRepository.list(
|
|
List<KwtParkingChargeStrategyUnit> strategyUnitList = parkingChangeStrategyUnitRepository.list(
|
|
|
Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
|
|
Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
|
|
|
.eq(KwtParkingChargeStrategyUnit::getEntId, proEntId)
|
|
.eq(KwtParkingChargeStrategyUnit::getEntId, proEntId)
|
|
@@ -782,9 +790,7 @@ public class ParkingWalletFeeService {
|
|
|
if (CollectionUtils.isEmpty(strategyList)) {
|
|
if (CollectionUtils.isEmpty(strategyList)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
- return strategyList.stream()
|
|
|
|
|
- .filter(item -> Objects.equals(item.getStatus(), STRATEGY_OPEN))
|
|
|
|
|
- .toList();
|
|
|
|
|
|
|
+ return strategyList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|