Commit 0ad857fa by ping.wu

查询订单餐盒费配置增加外卖和打包带走判断

parent 509e0b82
...@@ -38,26 +38,29 @@ public class CommonFunctionHandle { ...@@ -38,26 +38,29 @@ public class CommonFunctionHandle {
* 查询配置,比较配送费 * 查询配置,比较配送费
*/ */
public Long packAmountConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) { public Long packAmountConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) {
if(newPackAmount == 0){ if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())
return newPackAmount; || Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) {
} if(newPackAmount == 0){
String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null; return newPackAmount;
String value = redisCache.hashGet(redisKey, "packAmountType"); }
if(StringUtils.isEmpty(value)){ String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null;
return newPackAmount; String value = redisCache.hashGet(redisKey, "packAmountType");
} if(StringUtils.isEmpty(value)){
return newPackAmount;
PackAmountConfig packAmountConfig = JSONObject.parseObject(value, PackAmountConfig.class); }
if(packAmountConfig == null || CollectionUtils.isEmpty(packAmountConfig.getCollectType())){ ApiLog.printLog("查询订单餐盒费配置", String.valueOf(newPackAmount), String.valueOf(totalAmount), value);
return newPackAmount; PackAmountConfig packAmountConfig = JSONObject.parseObject(value, PackAmountConfig.class);
} if(packAmountConfig == null || CollectionUtils.isEmpty(packAmountConfig.getCollectType())){
List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType(); return newPackAmount;
collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount()); }
newPackAmount = 0L; List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType();
for (PackAmountConfig.CollectType collectType: collectTypes){ collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount());
if(totalAmount > collectType.getOrderAmount()){ newPackAmount = 0L;
newPackAmount = collectType.getFee().longValue(); for (PackAmountConfig.CollectType collectType: collectTypes){
break; if(totalAmount > collectType.getOrderAmount()){
newPackAmount = collectType.getFee().longValue();
break;
}
} }
} }
return newPackAmount; return newPackAmount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment