master
parent
38984e90fc
commit
6671acfcc4
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
|
||||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||||
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
||||||
import com.njzscloud.supervisory.expense.contant.Scope;
|
import com.njzscloud.supervisory.expense.contant.Scope;
|
||||||
|
import com.njzscloud.supervisory.expense.contant.StationsScope;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
@ -92,6 +93,17 @@ public class ExpenseItemsConfigEntity {
|
||||||
@TableField(typeHandler = JsonTypeHandler.class)
|
@TableField(typeHandler = JsonTypeHandler.class)
|
||||||
private List<String> goodsIds;
|
private List<String> goodsIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点范围;字典代码:station_scope all -->所有站点 stations -->指定站点
|
||||||
|
*/
|
||||||
|
private StationsScope stationScope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点ids
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonTypeHandler.class)
|
||||||
|
private List<String> stationIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计费类型 fixed -> 固定计费 elasticity -> 弹性计费
|
* 计费类型 fixed -> 固定计费 elasticity -> 弹性计费
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
|
||||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||||
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
||||||
import com.njzscloud.supervisory.expense.contant.Scope;
|
import com.njzscloud.supervisory.expense.contant.Scope;
|
||||||
|
import com.njzscloud.supervisory.expense.contant.StationsScope;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
@ -97,6 +98,17 @@ public class OrderExpenseItemsEntity {
|
||||||
@TableField(typeHandler = JsonTypeHandler.class)
|
@TableField(typeHandler = JsonTypeHandler.class)
|
||||||
private List<String> goodsIds;
|
private List<String> goodsIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点范围;字典代码:station_scope all -->所有站点 stations -->指定站点
|
||||||
|
*/
|
||||||
|
private StationsScope stationScope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点ids
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonTypeHandler.class)
|
||||||
|
private List<String> stationIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计费类型 fixed -> 固定计费 elasticity -> 弹性计费
|
* 计费类型 fixed -> 固定计费 elasticity -> 弹性计费
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,7 @@ import com.njzscloud.supervisory.constant.Constant;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||||
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
import com.njzscloud.supervisory.expense.contant.BillingType;
|
import com.njzscloud.supervisory.expense.contant.*;
|
||||||
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.pojo.entity.ExpenseItemsConfigEntity;
|
import com.njzscloud.supervisory.expense.pojo.entity.ExpenseItemsConfigEntity;
|
||||||
import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService;
|
import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService;
|
||||||
import com.njzscloud.supervisory.goods.contant.MoneyStrategy;
|
import com.njzscloud.supervisory.goods.contant.MoneyStrategy;
|
||||||
|
|
@ -1443,29 +1440,42 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Long transCompanyId = orderInfoEntity.getTransCompanyId();
|
Long transCompanyId = orderInfoEntity.getTransCompanyId();
|
||||||
Long goodsId = orderGoods.getOriginGoodsId();
|
Long goodsId = orderGoods.getOriginGoodsId();
|
||||||
|
Long stationId = orderInfoEntity.getStationId();
|
||||||
List<OrderExpenseItemsEntity> extraItems = configs.stream()
|
List<OrderExpenseItemsEntity> extraItems = configs.stream()
|
||||||
.filter(cfg -> {
|
.filter(cfg -> {
|
||||||
Scope scope = cfg.getScope();
|
Scope scope = cfg.getScope();
|
||||||
GoodsScope goodsScope = cfg.getGoodsScope();
|
GoodsScope goodsScope = cfg.getGoodsScope();
|
||||||
|
StationsScope stationsScope = cfg.getStationScope();
|
||||||
List<String> companyIds = cfg.getCompanyIds();
|
List<String> companyIds = cfg.getCompanyIds();
|
||||||
List<String> goodsIds = cfg.getGoodsIds();
|
List<String> goodsIds = cfg.getGoodsIds();
|
||||||
boolean isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId));
|
List<String> stationsIds = cfg.getStationIds();
|
||||||
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) {
|
boolean isComTrue;
|
||||||
return isGoodsTrue;
|
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;
|
boolean isGoodsTrue;
|
||||||
}*/
|
if (goodsScope == GoodsScope.ALL) {
|
||||||
if (scope == Scope.CUSTOMER && goodsScope == GoodsScope.ALL) {
|
isGoodsTrue = true; // 所有产品都匹配
|
||||||
return isComTrue;
|
} 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)
|
// 复制配置为订单付费项(数量口径与产品一致:按车=1,否则=settleWeight)
|
||||||
.map(cfg -> new OrderExpenseItemsEntity()
|
.map(cfg -> new OrderExpenseItemsEntity()
|
||||||
|
|
@ -1842,25 +1852,42 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Long transCompanyId = order.getTransCompanyId();
|
Long transCompanyId = order.getTransCompanyId();
|
||||||
Long goodsId = entity.getOriginGoodsId();
|
Long goodsId = entity.getOriginGoodsId();
|
||||||
|
Long stationId = order.getStationId();
|
||||||
List<OrderExpenseItemsEntity> extraItems = configs.stream()
|
List<OrderExpenseItemsEntity> extraItems = configs.stream()
|
||||||
.filter(cfg -> {
|
.filter(cfg -> {
|
||||||
Scope scope = cfg.getScope();
|
Scope scope = cfg.getScope();
|
||||||
GoodsScope goodsScope = cfg.getGoodsScope();
|
GoodsScope goodsScope = cfg.getGoodsScope();
|
||||||
|
StationsScope stationsScope = cfg.getStationScope();
|
||||||
List<String> companyIds = cfg.getCompanyIds();
|
List<String> companyIds = cfg.getCompanyIds();
|
||||||
List<String> goodsIds = cfg.getGoodsIds();
|
List<String> goodsIds = cfg.getGoodsIds();
|
||||||
boolean isComTrue = companyIds != null && transCompanyId != null && companyIds.contains(String.valueOf(transCompanyId));
|
List<String> stationsIds = cfg.getStationIds();
|
||||||
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) {
|
boolean isComTrue;
|
||||||
return isGoodsTrue;
|
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)
|
// 复制配置为订单付费项(数量口径与产品一致:按车=1,否则=settleWeight)
|
||||||
.map(cfg -> new OrderExpenseItemsEntity()
|
.map(cfg -> new OrderExpenseItemsEntity()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue