Commit d090d5a0 by ping.wu

Merge branches 'feature/20211027_餐盒费规则保存订单_wuping' and 'qa' of…

Merge branches 'feature/20211027_餐盒费规则保存订单_wuping' and 'qa' of http://gitlab.freemud.com/order-group-application/order-group into qa

# Conflicts:
#	order-application-service/src/main/java/cn/freemud/service/thirdparty/MicroOpenplatformClient.java
#	shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/calculate/SendGoods.java
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/AdditionSharingService.java
parents 3d07ca58 31053505
...@@ -41,6 +41,11 @@ public class ShoppingCartGoodsDto { ...@@ -41,6 +41,11 @@ public class ShoppingCartGoodsDto {
private Long packageAmount; private Long packageAmount;
/** /**
* 包装费 收费规则 1= 商品级别 2=订单级别
*/
private String packageAmountCollectType;
/**
* 积分扣减金额 * 积分扣减金额
*/ */
private Long scoreReduceAmount; private Long scoreReduceAmount;
......
...@@ -2715,6 +2715,9 @@ public class OrderServiceImpl implements Orderservice { ...@@ -2715,6 +2715,9 @@ public class OrderServiceImpl implements Orderservice {
if (null != shoppingCartGoodsDto && null != shoppingCartGoodsDto.getTotalScore()) { if (null != shoppingCartGoodsDto && null != shoppingCartGoodsDto.getTotalScore()) {
orderExtInfoDto.setTotalScore(shoppingCartGoodsDto.getTotalScore()); orderExtInfoDto.setTotalScore(shoppingCartGoodsDto.getTotalScore());
} }
if (null != shoppingCartGoodsDto && null != shoppingCartGoodsDto.getPackageAmountCollectType()) {
orderExtInfoDto.setPackageAmountCollectType(shoppingCartGoodsDto.getPackageAmountCollectType());
}
orderExtInfoDto.setUnDistribution(createOrderVo.getUnDistribution()); orderExtInfoDto.setUnDistribution(createOrderVo.getUnDistribution());
return orderExtInfoDto; return orderExtInfoDto;
......
...@@ -2,11 +2,8 @@ package cn.freemud.service.thirdparty; ...@@ -2,11 +2,8 @@ package cn.freemud.service.thirdparty;
import cn.freemud.annotations.LogIgnoreFeign; import cn.freemud.annotations.LogIgnoreFeign;
import cn.freemud.base.entity.BaseResponse; import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.dto.delivery.GetFilterPartnerResponse;
import cn.freemud.entities.dto.openplatform.OrderGetPartnerRequest;
import cn.freemud.entities.dto.openplatform.QueryInvoiceConfigRequest; import cn.freemud.entities.dto.openplatform.QueryInvoiceConfigRequest;
import cn.freemud.entities.dto.order.OrderInvoiceResponse; import cn.freemud.entities.dto.order.OrderInvoiceResponse;
import cn.freemud.entities.vo.SendOrderCountsMsg;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -23,25 +20,25 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -23,25 +20,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public interface MicroOpenplatformClient { public interface MicroOpenplatformClient {
/** // /**
* 上报微信 有数 统计数据 // * 上报微信 有数 统计数据
* // *
* @param orderCounts // * @param orderCounts
* @return // * @return
*/ // */
@LogIgnoreFeign(logMessage="addOrderSum") // @LogIgnoreFeign(logMessage="addOrderSum")
@PostMapping("/thirdApp/order/addOrderSum") // @PostMapping("/thirdApp/order/addOrderSum")
BaseResponse addOrderSum(@RequestBody SendOrderCountsMsg orderCounts); // BaseResponse addOrderSum(@RequestBody SendOrderCountsMsg orderCounts);
//
//
/** // /**
* 获取需要 上报腾讯有数的 商户号 // * 获取需要 上报腾讯有数的 商户号
* // *
* @return // * @return
*/ // */
@LogIgnoreFeign(logMessage="getFilterPartner") // @LogIgnoreFeign(logMessage="getFilterPartner")
@PostMapping("/thirdApp/getFilterPartner") // @PostMapping("/thirdApp/getFilterPartner")
BaseResponse<GetFilterPartnerResponse> getFilterPartner(@RequestBody OrderGetPartnerRequest request); // BaseResponse<GetFilterPartnerResponse> getFilterPartner(@RequestBody OrderGetPartnerRequest request);
/** /**
* 获取需要 上报腾讯有数的 商户号 * 获取需要 上报腾讯有数的 商户号
......
...@@ -215,4 +215,10 @@ public class OrderExtInfoDto { ...@@ -215,4 +215,10 @@ public class OrderExtInfoDto {
* 1 表示不分账 ,其他情况 不传值 给基础服务 * 1 表示不分账 ,其他情况 不传值 给基础服务
*/ */
private Integer unDistribution; private Integer unDistribution;
/**
* 包装费 收费规则 1= 商品级别 2=订单级别
*/
private String packageAmountCollectType;
} }
...@@ -9,6 +9,9 @@ public class PackAmountConfig { ...@@ -9,6 +9,9 @@ public class PackAmountConfig {
private List<CollectType> collectType; private List<CollectType> collectType;
//自定义字段,非缓存对象
private Long newPackAmount;
@Data @Data
public static class CollectType { public static class CollectType {
......
...@@ -60,6 +60,11 @@ public class ShoppingCartGoodsDto { ...@@ -60,6 +60,11 @@ public class ShoppingCartGoodsDto {
* 购物车总包装费 * 购物车总包装费
*/ */
private Long packageAmount; private Long packageAmount;
/**
* 包装费 收费规则 1= 商品级别 2=订单级别
*/
private String packageAmountCollectType;
/** /**
* 积分扣减金额 * 积分扣减金额
*/ */
......
...@@ -59,6 +59,11 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV ...@@ -59,6 +59,11 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
private Long newPackAmount; private Long newPackAmount;
/** /**
* 包装费 收费规则 1= 商品级别 2=订单级别
*/
private Integer packageAmountCollectType;
/**
* 优惠券折扣 * 优惠券折扣
*/ */
private Long couponDiscount; private Long couponDiscount;
......
...@@ -37,19 +37,22 @@ public class CommonFunctionHandle { ...@@ -37,19 +37,22 @@ public class CommonFunctionHandle {
/** /**
* 查询配置,比较配送费 * 查询配置,比较配送费
*/ */
public Long packAmountConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) { public PackAmountConfig getPackAmountByOrderConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, PackAmountConfig newPackAmountConfig,Long totalAmount) {
if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode()) if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())
|| Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) { || Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) {
String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null; String redisKey = RedisUtil.packAmountConfig + shoppingCartInfoRequestVo.getPartnerId() + "_" + null;
String value = redisCache.hashGet(redisKey, "packAmountType"); String value = redisCache.hashGet(redisKey, "packAmountType");
if(StringUtils.isEmpty(value)){ if(StringUtils.isEmpty(value)){
return newPackAmount; return newPackAmountConfig;
} }
Long newPackAmount = newPackAmountConfig.getNewPackAmount();
ApiLog.printLog("查询订单餐盒费配置", String.valueOf(newPackAmount), String.valueOf(totalAmount), value); ApiLog.printLog("查询订单餐盒费配置", String.valueOf(newPackAmount), String.valueOf(totalAmount), value);
PackAmountConfig packAmountConfig = JSONObject.parseObject(value, PackAmountConfig.class); PackAmountConfig packAmountConfig = JSONObject.parseObject(value, PackAmountConfig.class);
//按商品级别收取餐盒费
if(packAmountConfig == null || CollectionUtils.isEmpty(packAmountConfig.getCollectType())){ if(packAmountConfig == null || CollectionUtils.isEmpty(packAmountConfig.getCollectType())){
return newPackAmount; return newPackAmountConfig;
} }
//按订单级别收取餐盒费
List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType(); List<PackAmountConfig.CollectType> collectTypes = packAmountConfig.getCollectType();
collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount()); collectTypes.sort((p1, p2) -> p2.getOrderAmount() - p1.getOrderAmount());
newPackAmount = 0L; newPackAmount = 0L;
...@@ -59,8 +62,10 @@ public class CommonFunctionHandle { ...@@ -59,8 +62,10 @@ public class CommonFunctionHandle {
break; break;
} }
} }
newPackAmountConfig.setNewPackAmount(newPackAmount);
newPackAmountConfig.setCollectType(collectTypes);
} }
return newPackAmount; return newPackAmountConfig;
} }
/** /**
...@@ -70,11 +75,15 @@ public class CommonFunctionHandle { ...@@ -70,11 +75,15 @@ public class CommonFunctionHandle {
* @param newPackAmount * @param newPackAmount
* @return 外卖 true 打包带走 false null 为其他业务问题 不进入需求 * @return 外卖 true 打包带走 false null 为其他业务问题 不进入需求
*/ */
public Long getPackAmountByStoreConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) { public PackAmountConfig getPackAmountByStoreConfig(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, Long newPackAmount,Long totalAmount) {
PackAmountConfig newPackAmountConfig = new PackAmountConfig();
newPackAmountConfig.setNewPackAmount(newPackAmount);
if (Objects.isNull(shoppingCartInfoRequestVo)) { if (Objects.isNull(shoppingCartInfoRequestVo)) {
return newPackAmount; return newPackAmountConfig;
} }
newPackAmount = packAmountConfig(shoppingCartInfoRequestVo, newPackAmount, totalAmount); //查询餐盒费配置,按订单金额或商品配置
newPackAmountConfig = getPackAmountByOrderConfig(shoppingCartInfoRequestVo, newPackAmountConfig, totalAmount);
newPackAmount = newPackAmountConfig.getNewPackAmount();
Boolean isTakeOut = null; Boolean isTakeOut = null;
if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())) { if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())) {
isTakeOut = true; isTakeOut = true;
...@@ -83,10 +92,12 @@ public class CommonFunctionHandle { ...@@ -83,10 +92,12 @@ public class CommonFunctionHandle {
} }
ApiLog.printLog("自提根据模板配置计算餐具包装费", String.valueOf(newPackAmount), String.valueOf(isTakeOut), null); ApiLog.printLog("自提根据模板配置计算餐具包装费", String.valueOf(newPackAmount), String.valueOf(isTakeOut), null);
if (Objects.isNull(newPackAmount) || newPackAmount.compareTo(0L) == 0) { if (Objects.isNull(newPackAmount) || newPackAmount.compareTo(0L) == 0) {
return 0L; newPackAmountConfig.setNewPackAmount(0L);
return newPackAmountConfig;
} }
//isTakeOut 非外卖或到店自提,直接返回
if (Objects.isNull(isTakeOut)) { if (Objects.isNull(isTakeOut)) {
return newPackAmount; return newPackAmountConfig;
} }
GetStoreMixRequest request = GetStoreMixRequest.builder().partnerId(shoppingCartInfoRequestVo.getPartnerId()).storeCode(shoppingCartInfoRequestVo.getShopId()).build(); GetStoreMixRequest request = GetStoreMixRequest.builder().partnerId(shoppingCartInfoRequestVo.getPartnerId()).storeCode(shoppingCartInfoRequestVo.getShopId()).build();
// 查询 业务设置信息数据 // 查询 业务设置信息数据
...@@ -101,18 +112,20 @@ public class CommonFunctionHandle { ...@@ -101,18 +112,20 @@ public class CommonFunctionHandle {
// 外卖 是否计算 包装费 // 外卖 是否计算 包装费
if (Objects.nonNull(expandFields.getDeliveryPackageFeeSwitch()) if (Objects.nonNull(expandFields.getDeliveryPackageFeeSwitch())
&& ExpandFieldsDTO.STR_FALSE.equals(expandFields.getDeliveryPackageFeeSwitch())) { && ExpandFieldsDTO.STR_FALSE.equals(expandFields.getDeliveryPackageFeeSwitch())) {
return 0L; newPackAmountConfig.setNewPackAmount(0L);
return newPackAmountConfig;
} }
} else { } else {
// 打包带走 是否计算包装费 // 打包带走 是否计算包装费
if (Objects.nonNull(expandFields.getPickupPackageFeeSwitch()) if (Objects.nonNull(expandFields.getPickupPackageFeeSwitch())
&& ExpandFieldsDTO.STR_FALSE.equals(expandFields.getPickupPackageFeeSwitch())) { && ExpandFieldsDTO.STR_FALSE.equals(expandFields.getPickupPackageFeeSwitch())) {
return 0L; newPackAmountConfig.setNewPackAmount(0L);
return newPackAmountConfig;
} }
} }
} }
} }
return newPackAmount; return newPackAmountConfig;
} }
} }
...@@ -33,6 +33,7 @@ import cn.freemud.entities.dto.activity.DiscountSharingDto; ...@@ -33,6 +33,7 @@ import cn.freemud.entities.dto.activity.DiscountSharingDto;
import cn.freemud.entities.dto.calculate.*; import cn.freemud.entities.dto.calculate.*;
import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto; import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto;
import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto; import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto;
import cn.freemud.entities.dto.order.PackAmountConfig;
import cn.freemud.entities.dto.pay.*; import cn.freemud.entities.dto.pay.*;
import cn.freemud.entities.dto.product.CheckCartRequest; import cn.freemud.entities.dto.product.CheckCartRequest;
import cn.freemud.entities.dto.shoppingCart.PromotionResultVO; import cn.freemud.entities.dto.shoppingCart.PromotionResultVO;
...@@ -2342,8 +2343,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2342,8 +2343,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} else if ((Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode()) } else if ((Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())
|| Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode()))) { || Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode()))) {
//fisherman 【ID1033456】自提根据模板配置计算餐具包装费 //fisherman 【ID1033456】自提根据模板配置计算餐具包装费
Long packAmount = commonFunctionHandle.getPackAmountByStoreConfig(shoppingCartInfoRequestVo, shoppingCartGoodsResponseVo.getNewPackAmount(),shoppingCartGoodsResponseVo.getTotalAmount()); PackAmountConfig packAmountByStoreConfig = commonFunctionHandle.getPackAmountByStoreConfig(shoppingCartInfoRequestVo, shoppingCartGoodsResponseVo.getNewPackAmount(),shoppingCartGoodsResponseVo.getTotalAmount());
Long packAmount = packAmountByStoreConfig.getNewPackAmount();
shoppingCartGoodsResponseVo.setNewPackAmount(packAmount); shoppingCartGoodsResponseVo.setNewPackAmount(packAmount);
shoppingCartGoodsResponseVo.setPackageAmountCollectType(CollectionUtils.isEmpty(packAmountByStoreConfig.getCollectType()) ? 1 : 2);
if (Objects.equals(shoppingCartInfoRequestVo.getFlag(), SubmitPageEnum.YES.getCode())) { if (Objects.equals(shoppingCartInfoRequestVo.getFlag(), SubmitPageEnum.YES.getCode())) {
Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount() + packAmount; Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount() + packAmount;
Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount() + packAmount; Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount() + packAmount;
......
...@@ -8,6 +8,7 @@ import cn.freemud.entities.dto.GetPaidRuleRequestDto; ...@@ -8,6 +8,7 @@ import cn.freemud.entities.dto.GetPaidRuleRequestDto;
import cn.freemud.entities.dto.GetPaidRuleResponseDto; import cn.freemud.entities.dto.GetPaidRuleResponseDto;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto; import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
import cn.freemud.entities.dto.calculate.*; import cn.freemud.entities.dto.calculate.*;
import cn.freemud.entities.dto.order.PackAmountConfig;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto; import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.CartGoods; import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo; import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
...@@ -105,7 +106,9 @@ public class CalculationCommonService { ...@@ -105,7 +106,9 @@ public class CalculationCommonService {
shoppingCartGoodsResponseVo.setShoppingCartGoodsAmount(shoppingCartGoodsResponseVo.getTotalAmount()); shoppingCartGoodsResponseVo.setShoppingCartGoodsAmount(shoppingCartGoodsResponseVo.getTotalAmount());
shoppingCartGoodsResponseVo.setShoppingCartOriginalGoodsAmount(shoppingCartGoodsResponseVo.getOriginalTotalAmount()); shoppingCartGoodsResponseVo.setShoppingCartOriginalGoodsAmount(shoppingCartGoodsResponseVo.getOriginalTotalAmount());
//fisherman 【ID1033456】自提根据模板配置计算餐具包装费 新算价一起处理 //fisherman 【ID1033456】自提根据模板配置计算餐具包装费 新算价一起处理
shoppingCartGoodsResponseVo.setNewPackAmount(commonFunctionHandle.getPackAmountByStoreConfig(shoppingCartInfoRequestVo,totalPackageAmount,shoppingCartGoodsResponseVo.getTotalAmount())); PackAmountConfig packAmountByStoreConfig = commonFunctionHandle.getPackAmountByStoreConfig(shoppingCartInfoRequestVo, totalPackageAmount, shoppingCartGoodsResponseVo.getTotalAmount());
shoppingCartGoodsResponseVo.setNewPackAmount(packAmountByStoreConfig.getNewPackAmount());
shoppingCartGoodsResponseVo.setPackageAmountCollectType(CollectionUtils.isEmpty(packAmountByStoreConfig.getCollectType()) ? 1 : 2);
// fisehrman 总优惠金额 需要+配送券的优惠金额 // fisehrman 总优惠金额 需要+配送券的优惠金额
if (discountResult == null) { if (discountResult == null) {
shoppingCartGoodsResponseVo.setTotalDiscountAmount(0L); shoppingCartGoodsResponseVo.setTotalDiscountAmount(0L);
......
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