ljw 2025-11-21 14:08:22 +08:00
parent 38984e90fc
commit 6671acfcc4
4 changed files with 98 additions and 28 deletions

View File

@ -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;
}

View File

@ -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<String> goodsIds;
/**
* ;station_scope all --> stations -->
*/
private StationsScope stationScope;
/**
* ids
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> stationIds;
/**
* fixed -> elasticity ->
*/

View File

@ -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<String> goodsIds;
/**
* ;station_scope all --> stations -->
*/
private StationsScope stationScope;
/**
* ids
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> stationIds;
/**
* fixed -> elasticity ->
*/

View File

@ -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<OrderInfoMapper, OrderInfoEnti
Long transCompanyId = orderInfoEntity.getTransCompanyId();
Long goodsId = orderGoods.getOriginGoodsId();
Long stationId = orderInfoEntity.getStationId();
List<OrderExpenseItemsEntity> extraItems = configs.stream()
.filter(cfg -> {
Scope scope = cfg.getScope();
GoodsScope goodsScope = cfg.getGoodsScope();
StationsScope stationsScope = cfg.getStationScope();
List<String> companyIds = cfg.getCompanyIds();
List<String> 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<String> 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<OrderInfoMapper, OrderInfoEnti
Long transCompanyId = order.getTransCompanyId();
Long goodsId = entity.getOriginGoodsId();
Long stationId = order.getStationId();
List<OrderExpenseItemsEntity> extraItems = configs.stream()
.filter(cfg -> {
Scope scope = cfg.getScope();
GoodsScope goodsScope = cfg.getGoodsScope();
StationsScope stationsScope = cfg.getStationScope();
List<String> companyIds = cfg.getCompanyIds();
List<String> 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<String> 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()