From 6671acfcc43f18761ac2e838b7fc3fe9cc305e25 Mon Sep 17 00:00:00 2001 From: ljw Date: Fri, 21 Nov 2025 14:08:22 +0800 Subject: [PATCH] 1 --- .../expense/contant/StationsScope.java | 19 +++++ .../pojo/entity/ExpenseItemsConfigEntity.java | 12 +++ .../pojo/entity/OrderExpenseItemsEntity.java | 12 +++ .../order/service/OrderInfoService.java | 83 ++++++++++++------- 4 files changed, 98 insertions(+), 28 deletions(-) create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/contant/StationsScope.java diff --git a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/contant/StationsScope.java b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/contant/StationsScope.java new file mode 100644 index 0000000..7db6eb5 --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/contant/StationsScope.java @@ -0,0 +1,19 @@ +package com.njzscloud.supervisory.expense.contant; + +import com.njzscloud.common.core.ienum.DictStr; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 字典代码:stations_scope + * 字典名称:站点范围 + */ +@Getter +@RequiredArgsConstructor +public enum StationsScope implements DictStr { + ALL("all", "所有站点"), + STATIONS("stations", "指定站点"), + ; + private final String val; + private final String txt; +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/pojo/entity/ExpenseItemsConfigEntity.java b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/pojo/entity/ExpenseItemsConfigEntity.java index 1273fd7..ab8c567 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/pojo/entity/ExpenseItemsConfigEntity.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/expense/pojo/entity/ExpenseItemsConfigEntity.java @@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler; import com.njzscloud.supervisory.biz.constant.BizObj; import com.njzscloud.supervisory.expense.contant.GoodsScope; import com.njzscloud.supervisory.expense.contant.Scope; +import com.njzscloud.supervisory.expense.contant.StationsScope; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -92,6 +93,17 @@ public class ExpenseItemsConfigEntity { @TableField(typeHandler = JsonTypeHandler.class) private List goodsIds; + /** + * 站点范围;字典代码:station_scope all -->所有站点 stations -->指定站点 + */ + private StationsScope stationScope; + + /** + * 站点ids + */ + @TableField(typeHandler = JsonTypeHandler.class) + private List stationIds; + /** * 计费类型 fixed -> 固定计费 elasticity -> 弹性计费 */ diff --git a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/pojo/entity/OrderExpenseItemsEntity.java b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/pojo/entity/OrderExpenseItemsEntity.java index 284ad77..ae79903 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/pojo/entity/OrderExpenseItemsEntity.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/pojo/entity/OrderExpenseItemsEntity.java @@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler; import com.njzscloud.supervisory.biz.constant.BizObj; import com.njzscloud.supervisory.expense.contant.GoodsScope; import com.njzscloud.supervisory.expense.contant.Scope; +import com.njzscloud.supervisory.expense.contant.StationsScope; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -97,6 +98,17 @@ public class OrderExpenseItemsEntity { @TableField(typeHandler = JsonTypeHandler.class) private List goodsIds; + /** + * 站点范围;字典代码:station_scope all -->所有站点 stations -->指定站点 + */ + private StationsScope stationScope; + + /** + * 站点ids + */ + @TableField(typeHandler = JsonTypeHandler.class) + private List stationIds; + /** * 计费类型 fixed -> 固定计费 elasticity -> 弹性计费 */ diff --git a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/service/OrderInfoService.java b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/service/OrderInfoService.java index 036cff9..a8b15df 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/service/OrderInfoService.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/supervisory/order/service/OrderInfoService.java @@ -34,10 +34,7 @@ import com.njzscloud.supervisory.constant.Constant; import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity; import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity; import com.njzscloud.supervisory.discount.service.DiscountManageService; -import com.njzscloud.supervisory.expense.contant.BillingType; -import com.njzscloud.supervisory.expense.contant.ExpenseItemCategory; -import com.njzscloud.supervisory.expense.contant.GoodsScope; -import com.njzscloud.supervisory.expense.contant.Scope; +import com.njzscloud.supervisory.expense.contant.*; import com.njzscloud.supervisory.expense.pojo.entity.ExpenseItemsConfigEntity; import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService; import com.njzscloud.supervisory.goods.contant.MoneyStrategy; @@ -1443,29 +1440,42 @@ public class OrderInfoService extends ServiceImpl extraItems = configs.stream() .filter(cfg -> { Scope scope = cfg.getScope(); GoodsScope goodsScope = cfg.getGoodsScope(); + StationsScope stationsScope = cfg.getStationScope(); List companyIds = cfg.getCompanyIds(); List goodsIds = cfg.getGoodsIds(); - boolean isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId)); - boolean isGoodsTrue = goodsIds != null && goodsId != null && goodsIds.contains(String.valueOf(goodsId)); - if (scope == Scope.ALL && goodsScope == GoodsScope.ALL) return true; - if (scope == Scope.ALL && goodsScope == GoodsScope.GOODS) { - return isGoodsTrue; + List stationsIds = cfg.getStationIds(); + + // 判断客户范围 + boolean isComTrue; + if (scope == Scope.ALL) { + isComTrue = true; // 所有客户都匹配 + } else { + isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId)); } - /*if (scope == Scope.CUSTOMER_TYPE) { - BizObj bizObj = cfg.getBizObj(); - return bizObj == BizObj.QiYe || bizObj == BizObj.GeTi; - }*/ - if (scope == Scope.CUSTOMER && goodsScope == GoodsScope.ALL) { - return isComTrue; + + // 判断产品范围 + boolean isGoodsTrue; + if (goodsScope == GoodsScope.ALL) { + isGoodsTrue = true; // 所有产品都匹配 + } else { + isGoodsTrue = goodsIds != null && goodsId != null && goodsIds.contains(String.valueOf(goodsId)); } - if (scope == Scope.CUSTOMER && goodsScope == GoodsScope.GOODS) { - return isComTrue && isGoodsTrue; + + // 判断站点范围 + boolean isStationsTrue; + if (stationsScope == StationsScope.ALL) { + isStationsTrue = true; // 所有站点都匹配 + } else { + isStationsTrue = stationsIds != null && stationId != null && stationsIds.contains(String.valueOf(stationId)); } - return false; + + // 只有当三个条件都为true时,才返回true + return isComTrue && isGoodsTrue && isStationsTrue; }) // 复制配置为订单付费项(数量口径与产品一致:按车=1,否则=settleWeight) .map(cfg -> new OrderExpenseItemsEntity() @@ -1842,25 +1852,42 @@ public class OrderInfoService extends ServiceImpl extraItems = configs.stream() .filter(cfg -> { Scope scope = cfg.getScope(); GoodsScope goodsScope = cfg.getGoodsScope(); + StationsScope stationsScope = cfg.getStationScope(); List companyIds = cfg.getCompanyIds(); List goodsIds = cfg.getGoodsIds(); - boolean isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId)); - boolean isGoodsTrue = goodsIds != null && goodsId != null && goodsIds.contains(String.valueOf(goodsId)); - if (scope == Scope.ALL && goodsScope == GoodsScope.ALL) return true; - if (scope == Scope.ALL && goodsScope == GoodsScope.GOODS) { - return isGoodsTrue; + List stationsIds = cfg.getStationIds(); + + // 判断客户范围 + boolean isComTrue; + if (scope == Scope.ALL) { + isComTrue = true; // 所有客户都匹配 + } else { + isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId)); } - if (scope == Scope.CUSTOMER && goodsScope == GoodsScope.ALL) { - return isComTrue; + + // 判断产品范围 + boolean isGoodsTrue; + if (goodsScope == GoodsScope.ALL) { + isGoodsTrue = true; // 所有产品都匹配 + } else { + isGoodsTrue = goodsIds != null && goodsId != null && goodsIds.contains(String.valueOf(goodsId)); } - if (scope == Scope.CUSTOMER && goodsScope == GoodsScope.GOODS) { - return isComTrue && isGoodsTrue; + + // 判断站点范围 + boolean isStationsTrue; + if (stationsScope == StationsScope.ALL) { + isStationsTrue = true; // 所有站点都匹配 + } else { + isStationsTrue = stationsIds != null && stationId != null && stationsIds.contains(String.valueOf(stationId)); } - return false; + + // 只有当三个条件都为true时,才返回true + return isComTrue && isGoodsTrue && isStationsTrue; }) // 复制配置为订单付费项(数量口径与产品一致:按车=1,否则=settleWeight) .map(cfg -> new OrderExpenseItemsEntity()