Commit 0ad857fa by ping.wu

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

parent 509e0b82
......@@ -38,26 +38,29 @@ public class CommonFunctionHandle {
* 查询配置,比较配送费
*/
public Long packAmountConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) {
if(newPackAmount == 0){
return newPackAmount;
}
String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null;
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())){
return newPackAmount;
}
List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType();
collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount());
newPackAmount = 0L;
for (PackAmountConfig.CollectType collectType: collectTypes){
if(totalAmount > collectType.getOrderAmount()){
newPackAmount = collectType.getFee().longValue();
break;
if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())
|| Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) {
if(newPackAmount == 0){
return newPackAmount;
}
String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null;
String value = redisCache.hashGet(redisKey, "packAmountType");
if(StringUtils.isEmpty(value)){
return newPackAmount;
}
ApiLog.printLog("查询订单餐盒费配置", String.valueOf(newPackAmount), String.valueOf(totalAmount), value);
PackAmountConfig packAmountConfig = JSONObject.parseObject(value, PackAmountConfig.class);
if(packAmountConfig == null || CollectionUtils.isEmpty(packAmountConfig.getCollectType())){
return newPackAmount;
}
List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType();
collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount());
newPackAmount = 0L;
for (PackAmountConfig.CollectType collectType: collectTypes){
if(totalAmount > collectType.getOrderAmount()){
newPackAmount = collectType.getFee().longValue();
break;
}
}
}
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