Commit cbf43f52 by 徐康

Merge remote-tracking branch 'origin/develop' into develop

parents f4d98146 b4bc2021
......@@ -1651,6 +1651,11 @@ public class OrderAdapter {
productBean.getComboProduct().forEach(product -> setMealProducts.add(convent2ProductVo(product)));
productVo.setSetMealProducts(setMealProducts);
}
if (ObjectUtils.equals(ProductTypeEnum.MATERIAL_PRODUCT.getCode(), productBean.getProductType())) {
List<ProductVo> setMaterialProducts = new ArrayList<>();
productBean.getMaterialProduct().forEach(product -> setMaterialProducts.add(convent2ProductVo(product)));
productVo.setSetMaterialProducts(setMaterialProducts);
}
productVos.add(productVo);
}
productVos.sort(Comparator.comparing(ProductVo::getSequence));
......
......@@ -36,5 +36,13 @@ public class PurchasePaidRequestDto {
* 用户ID
*/
private String memberId;
/**
* 推广门店Id
*/
private String promoteStoreId;
/**
* 推广门店名称
*/
private String promoteStoreName;
}
......@@ -152,4 +152,6 @@ public class ProductVo {
private List<InventedParentActivityVo> InventedParentActivitiesVo;
private List<ProductVo> setMaterialProducts;
}
......@@ -8,7 +8,7 @@
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.3.11.RELEASE</version>
<version>1.4.32-SNAPSHOT</version>
<artifactId>ordercenter-sdk</artifactId>
<dependencies>
......
......@@ -3,77 +3,25 @@
| 版本号 | 版本说明 | 更新人 | 更新时间 |
| ------------ | ---------------- | ------ | ---------- |
| 1.0.0-SNAPSHOT | 迁移后包明改为cn.freemud开头第一版 | wuping | 2019-12-16 |
| 1.1.0.RELEASE| 1.9.8需求打包release版本 | 侯书虎 | 2019-12-26 |
| 1.1.1.RELEASE| 1.9.9需求打包release版本 | 丁凯 | 2020-01-08 |
| 1.1.2.RELEASE| 农工商订单submit | 侯书虎 | 2020-01-13 |
| 1.1.3.RELEASE| 开放平台创建订单 | 姜海波 | 2020-02-24 |
| 1.1.4-SNAPSHOT | 优化活动订单 | 胡超 | 2020-02-10 |
| 1.1.6-SNAPSHOT | OrderExtInfo新增formId | wuping | 2020-02-27 |
| 1.1.6.RELEASE | 升级RELEASE | wuping | 2020-03-04 |
| 1.1.7-SNAPSHOT | 预约单支付成功接口增加预约任务 | wuping | 2020-03-10 |
| 1.1.8-SNAPSHOT | 预约单接单接口增加预约任务 | wuping | 2020-03-17 |
| 1.1.8.RELEASE | 预约单升级RELEASE | wuping | 2020-03-18 |
| 1.1.9.RELEASE | 满额减配送费RELEASE | dingkai | 2020-03-26 |
| 1.2.0.RELEASE | 新增订单商品汇总下载接口 | 侯书虎 | 2020-04-07 |
| 1.2.1.RELEASE | oms接单 | 侯书虎 | 2020-04-13 |
| 1.2.2.RELEASE | 新增真实配送费 | 海波 | 2020-04-27 |
| 1.2.2.RELEASE | ES查询增加异常单状态 | 李小二 | 2020-04-27 |
| 1.2.3.RELEASE | 配送费实际金额 | 胡超 | 2020-05-11 |
| 1.2.4.RELEASE | 发送pos消息中心新增字段 | 侯书虎 | 2020-05-11 |
| 1.2.5.RELEASE | 取消接口新增超时时间字段 | wuping | 2020-05-12 |
| 1.2.6.RELEASE | 增加售后阶段 | 海波 | 2020-05-14 |
| 1.2.7.RELEASE | 全单退增加是否退配送费 | 海波 | 2020-05-14 |
| 1.3.3-SNAPSHOT | 创建售后单接口增加任务 | wuping | 2020-04-27 |
| 1.3.4-SNAPSHOT | 取消订单增加任务 | wuping | 2020-04-28 |
| 1.1.9-SNAPSHOT | 创建订单增加appid字段 | wuping | 2020-05-08 |
| 1.3.3-SNAPSHOT | 创建售后单接口增加任务 | wuping | 2020-04-27 |
| 1.3.4-SNAPSHOT | 取消订单增加任务 | wuping | 2020-04-28 |
| 1.4.12-SNAPSHOT | 增加新接口:新增结算信息 | wuping | 2020-05-28 |
| 1.4.13-SNAPSHOT | 用户订单和es综合查询接口新增订单业务类型集合 | wuping | 2020-06-01 |
| 1.4.14-SNAPSHOT | 增加非码微店类型 | 梁崇福 | 2020-06-05 |
| 1.3.13-SNAPSHOT | 预约单任务删除 | wuping | 2020-06-05 |
| 1.1.9-SNAPSHOT | 创建订单增加appid字段 | wuping | 2020-05-08 |
| 1.2.8.RELEASE | 1.1.9-SNAPSHOT升RELEASE版本 | wuping | 2020-05-18 |
| 1.2.9.RELEASE | 规范orderExtInfoDto | 侯书虎 | 2020-05-19 |
| 1.3.3-SNAPSHOT | 创建售后单接口增加任务 | wuping | 2020-04-27 |
| 1.3.4-SNAPSHOT | 取消订单增加任务 | wuping | 2020-04-28 |
| 1.2.10.RELEASE | 增加售后单任务 | wuping | 2020-05-21 |
| 1.2.11.RELEASE | 增加订单支付方式 | 海波 | 2020-05-25 |
| 1.3.1.RELEASE | 增加下游订单号 | 海波 | 2020-06-01 |
| 1.3.2.RELEASE | 增加非码微店类型 | 梁崇福 | 2020-06-05 |
| 1.4.12-SNAPSHOT | 增加新接口:新增结算信息 | wuping | 2020-05-28 |
| 1.4.13-SNAPSHOT | 用户订单和es综合查询接口新增订单业务类型集合 | wuping | 2020-06-01 |
| 1.3.3.RELEASE | 买券订单修改升级RELEASE | wuping | 2020-06-10 |
| 1.3.13-SNAPSHOT | 预约单任务删除 | wuping | 2020-06-05 |
| 1.3.4.RELEASE | 预约单任务删除RELEASE | wuping | 2020-06-15 |
| 1.3.5.RELEASE | 围餐 | dingkai | 2020-06-16 |
| 1.3.6.RELEASE | 小助手营业额统计 | 梁崇福 | 2020-06-22 |
| 1.3.7.RELEASE | 停车场sdk | dingkai | 2020-06-22 |
| 1.3.8.RELEASE | 增加小程序场景值 | 李小二 | 2020-07-01 |
| 1.3.9.RELEASE | 增加支付渠道编号 | 李小二 | 2020-07-08 |
| 1.3.10.RELEASE | OrderExtInfoDto新增parkingAreaName | wuping | 2020-07-13 |
| 1.3.14-SNAPSHOT | es综合查询新增appId查询条件 | wuping | 2020-06-30 |
|1.4.31-SNAPSHOT | 增加手动录单,和完成订单接口 |张虹旺| 2020-07-18|
|1.4.32-SNAPSHOT | 商品加料 |梁崇福| 2020-07-27 |
| 1.1.9.RELEASE | 满额减配送费RELEASE | dingkai | 2020-03-26 |
| 1.2.0.RELEASE | 新增订单商品汇总下载接口 | 侯书虎 | 2020-04-07 |
| 1.2.1.RELEASE | oms接单 | 侯书虎 | 2020-04-13 |
| 1.2.2.RELEASE | 新增真实配送费 | 海波 | 2020-04-27 |
| 1.2.2.RELEASE | ES查询增加异常单状态 | 李小二 | 2020-04-27 |
| 1.2.3.RELEASE | 配送费实际金额 | 胡超 | 2020-05-11 |
| 1.2.4.RELEASE | 发送pos消息中心新增字段 | 侯书虎 | 2020-05-11 |
| 1.2.5.RELEASE | 取消接口新增超时时间字段 | wuping | 2020-05-12 |
| 1.2.6.RELEASE | 增加售后阶段 | 海波 | 2020-05-14 |
| 1.2.7.RELEASE | 全单退增加是否退配送费 | 海波 | 2020-05-14 |
| 1.1.9-SNAPSHOT | 创建订单增加appid字段 | wuping | 2020-05-08 |
| 1.2.8.RELEASE | 1.1.9-SNAPSHOT升RELEASE版本 | wuping | 2020-05-18 |
| 1.2.9.RELEASE | 规范orderExtInfoDto | 侯书虎 | 2020-05-19 |
| 1.3.3-SNAPSHOT | 创建售后单接口增加任务 | wuping | 2020-04-27 |
| 1.3.4-SNAPSHOT | 取消订单增加任务 | wuping | 2020-04-28 |
| 1.2.10.RELEASE | 增加售后单任务 | wuping | 2020-05-21 |
| 1.2.11.RELEASE | 增加订单支付方式 | 海波 | 2020-05-25 |
| 1.3.1.RELEASE | 增加下游订单号 | 海波 | 2020-06-01 |
| 1.3.2.RELEASE | 增加非码微店类型 | 梁崇福 | 2020-06-05 |
| 1.4.12-SNAPSHOT | 增加新接口:新增结算信息 | wuping | 2020-05-28 |
| 1.4.13-SNAPSHOT | 用户订单和es综合查询接口新增订单业务类型集合 | wuping | 2020-06-01 |
| 1.3.3.RELEASE | 买券订单修改升级RELEASE | wuping | 2020-06-10 |
| 1.3.13-SNAPSHOT | 预约单任务删除 | wuping | 2020-06-05 |
| 1.3.4.RELEASE | 预约单任务删除RELEASE | wuping | 2020-06-15 |
| 1.3.5.RELEASE | 围餐 | dingkai | 2020-06-16 |
| 1.3.6.RELEASE | 小助手营业额统计 | 梁崇福 | 2020-06-22 |
| 1.3.7.RELEASE | 停车场sdk | dingkai | 2020-06-22 |
| 1.3.8.RELEASE | 增加小程序场景值 | 李小二 | 2020-07-01 |
| 1.3.9.RELEASE | 增加支付渠道编号 | 李小二 | 2020-07-08 |
| 1.3.10.RELEASE | OrderExtInfoDto新增parkingAreaName | wuping | 2020-07-13 |
| 1.3.11.RELEASE | 新增常量类转化 | 张志恒 | 2020-08-04 |
\ No newline at end of file
|1.4.31-SNAPSHOT | 增加手动录单,和完成订单接口 |张虹旺| 2020-07-18
|1.4.32-SNAPSHOT | 最新快照版本| 李小二 |2020-08-05
\ No newline at end of file
......@@ -98,7 +98,7 @@ public class WebAspect {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
List<String> unauthorizedUrls = Arrays.asList(getNotFilterUrl(CommonRedisKeyConstant.SAAS_NOT_AUTHORIZED_URL, NOT_AUTHORIZED_KEY).split(","));
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId())) {
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId()) && !requestUrl.contains("MCoffee")) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
} else {
......
......@@ -2,7 +2,9 @@ package cn.freemud.controller;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.vo.*;
import cn.freemud.enums.ResponseResult;
import cn.freemud.service.impl.mcoffee.ShoppingCartMCoffeeServiceImpl;
import cn.freemud.utils.ResponseUtil;
import com.freemud.application.sdk.api.log.ApiAnnotation;
import com.freemud.application.sdk.api.log.LogParams;
import io.swagger.annotations.Api;
......@@ -72,5 +74,14 @@ public class MCoffeeShoppingCartController {
return shoppingCartMCoffeeService.clear(request);
}
/**
* 获取购物车均摊详情,点 "去支付" 时调用
*/
@ApiAnnotation(logMessage = "getShoppingCartGoodsApportion")
@PostMapping(value = "/getShoppingCartGoodsApportion")
public BaseResponse getShoppingCartGoodsApportion(@Validated @LogParams @RequestBody GetShoppingCartGoodsApportionRequestVo requestVo) {
return shoppingCartMCoffeeService.getShoppingCartGoods(requestVo);
}
}
......@@ -41,7 +41,6 @@ import java.util.List;
@Service
public class AssortmentSdkService {
/**
* 调用聚合sdk获取单个商品行信息
*
......@@ -129,8 +128,7 @@ public class AssortmentSdkService {
return JSONArray.parseArray(JSONObject.toJSONString(baseResponse.getResult()), CartGoods.class);
}
@Value("${shopping.cart.check.action}")
private String shoppingCartCheckAction;
/**
* 调用SDK校验购物车
......
......@@ -269,6 +269,8 @@ public class BuySendPromotionService implements IPromotionService {
cartGoods.setClassificationId(cartGood.getClassificationId());
cartGoods.setClassificationName(cartGood.getClassificationName());
cartGoods.setQty(sendGoods.getSendNumber() > 0 ? sendGoods.getSendNumber() : SEND_NUMBER);
//赠品不允许有加料
cartGood.setProductMaterialList(new ArrayList());
newCartGoodsList.add(cartGoods);
}
......
......@@ -46,7 +46,9 @@ public class MaterialPromotionService implements IPromotionService {
HashMap<String, MaterialApportion> map = getApportionGoodsDetail(calculationDiscountResult);
if (map != null && !map.isEmpty()) {
for (CartGoods cartGoods : cartGoodsList) {
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) continue;
//非正常商品
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList()) || !cartGoods.getGoodsType().equals(GoodsTypeEnum.COMMON_GOODS))
continue;
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
MaterialApportion apportion = map.get(materialGoods.getSpuId());
//设置小料行单价和行总价
......@@ -58,7 +60,8 @@ public class MaterialPromotionService implements IPromotionService {
long materialAmount = 0L, materialOriginal = 0L;
for (CartGoods cartGoods : cartGoodsList) {
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) continue;
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList()) || !cartGoods.getGoodsType().equals(GoodsTypeEnum.COMMON_GOODS))
continue;
materialAmount = 0L;
materialOriginal = 0L;
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
......@@ -86,7 +89,8 @@ public class MaterialPromotionService implements IPromotionService {
if (map == null && map.isEmpty()) return;
List<ShoppingCartGoodsDto.CartGoodsDetailDto> products = shoppingCartGoodsDto.getProducts();
for (ShoppingCartGoodsDto.CartGoodsDetailDto product : products) {
if (CollectionUtils.isEmpty(product.getMaterialList())) continue;
if (CollectionUtils.isEmpty(product.getMaterialList()) || !product.getProductType().equals(GoodsTypeEnum.COMMON_GOODS))
continue;
for (ShoppingCartGoodsDto.CartGoodsDetailDto.MaterialGoods materialGoods : product.getMaterialList()) {
MaterialApportion material = map.get(materialGoods.getSpuId());
if (material.getApportionAmount().intValue() == 0) continue;
......@@ -128,20 +132,11 @@ public class MaterialPromotionService implements IPromotionService {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getApportionGoods())) {
return null;
}
/*
HashMap<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material> hashMap = new HashMap<>();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods apportionGood : calculationDiscountResult.getApportionGoods()) {
if (CollectionUtils.isEmpty(apportionGood.getSmallMaterial())) continue;
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material : apportionGood.getSmallMaterial()) {
hashMap.put(material.getGoodsId(), material);
}
}
return hashMap;
*/
HashMap<String, MaterialApportion> mApportion = new HashMap<>();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods apportionGood : calculationDiscountResult.getApportionGoods()) {
if (CollectionUtils.isEmpty(apportionGood.getSmallMaterial())) continue;
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods.Material material : apportionGood.getSmallMaterial()) {
if (material.getApportionAmount() == 0) continue;
if (mApportion.get(material.getGoodsId()) == null) {
MaterialApportion materialApportion = new MaterialApportion();
materialApportion.setSalePrice(material.getNowPrice());
......@@ -149,10 +144,12 @@ public class MaterialPromotionService implements IPromotionService {
materialApportion.setApportionAmount(material.getApportionAmount() * material.getGoodsQuantity());
materialApportion.setGoodsId(material.getGoodsId());
ApportionDetails apportionDetails = new ApportionDetails();
apportionDetails.setActivityCode(material.getApportionDetails().get(0).getActivityCode());
apportionDetails.setActivityName(material.getApportionDetails().get(0).getActivityName());
apportionDetails.setActivityType(material.getApportionDetails().get(0).getActivityType());
materialApportion.setDetails(apportionDetails);
if (CollectionUtils.isNotEmpty(material.getApportionDetails())) {
apportionDetails.setActivityCode(material.getApportionDetails().get(0).getActivityCode());
apportionDetails.setActivityName(material.getApportionDetails().get(0).getActivityName());
apportionDetails.setActivityType(material.getApportionDetails().get(0).getActivityType());
materialApportion.setDetails(apportionDetails);
}
mApportion.put(material.getGoodsId(), materialApportion);
continue;
}
......
......@@ -35,6 +35,7 @@ import cn.freemud.service.thirdparty.*;
import cn.freemud.utils.PromotionFactory;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerStoreDeliveryConfig;
......@@ -789,6 +790,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
activityCalculationDiscountRequestDto.setIsMember(isMember);
ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto;
try {
System.out.println("start discount");
System.out.println(JSON.toJSONString(activityCalculationDiscountRequestDto));
activityCalculationDiscountResponseDto = activityClient.calculationDiscount(activityCalculationDiscountRequestDto);
} catch (Exception ex) {
ErrorLog.printErrorLog("calculation_discount_error", "/calculation/discount", activityCalculationDiscountRequestDto, ex);
......
......@@ -6,10 +6,8 @@ import cn.freemud.entities.dto.BenefitBeanDto;
import cn.freemud.entities.dto.PromotionMessageDto;
import cn.freemud.entities.dto.activity.ActivityQueryDto;
import cn.freemud.entities.dto.activity.ActivityQueryResponseDto;
import cn.freemud.entities.vo.ActivityList;
import cn.freemud.entities.vo.ActivityTip;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.*;
import cn.freemud.enums.ActivityTypeEnum;
import cn.freemud.service.ActivityService;
import cn.freemud.utils.WebUtil;
......@@ -121,6 +119,13 @@ public class FullPromotionCalculation {
shoppingCartGoodsResponseVo.setProductsCount(allCartGoodsList.size());
}
/**
* 商品均摊
*/
public void updateShoppingCartGoodsApportion(ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, ShoppingCartGoodsDto shoppingCartGoodsDto, CreateOrderVo.PremiumExchangeActivity premiumExchangeActivity, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo){
}
......@@ -242,6 +247,16 @@ public class FullPromotionCalculation {
activityList.add(noSatisfy);
}
public ActivityQueryDto getActivityQueryDto(String partnerId, String storeId, String userId, String appId, Integer orderType) {
return ActivityQueryDto.builder()
.partnerId(partnerId)
.storeId(storeId)
.userId(userId)
.appId(appId)
.orderType(orderType)
.build();
}
}
package cn.freemud.service.impl.mcoffee.calculation;
import cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
import cn.freemud.enums.ActivityTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
......@@ -34,7 +39,7 @@ public class TimeSaleCalculation {
*
* @return
*/
public void TimeSaleUpdateShoppingCartGoodsDiscount(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) {
public void updateShoppingCartGoodsDiscount(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())
|| !calculationDiscountResult.getDiscounts().stream().anyMatch(discount -> (ActivityTypeEnum.TYPE_2.getCode().equals(discount.getType()) || (ActivityTypeEnum.TYPE_21.getCode().equals(discount.getType()))))) {
return;
......@@ -85,6 +90,55 @@ public class TimeSaleCalculation {
}
/**
* 商品均摊
*/
public void updateShoppingCartGoodsApportion(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, ShoppingCartGoodsDto shoppingCartGoodsDto){
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts()) || !calculationDiscountResult.getDiscounts().stream().anyMatch(discount -> (ActivityTypeEnum.TYPE_2.getCode().equals(discount.getType()) || ActivityTypeEnum.TYPE_21.getCode().equals(discount.getType())))) {
return;
}
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods> goodsList = calculationDiscountResult.getGoods();
if (CollectionUtils.isEmpty(goodsList)) {
return;
}
// 商品实际享受优惠的数量: key:skuId; value:实际数量
Map<String, Integer> numberMap = new HashMap<>();
Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods> goodsMap = goodsList.parallelStream()
.collect(Collectors.toMap(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods::getGoodsId, Function.identity(), (k1, k2) -> k1));
for (ShoppingCartGoodsDto.CartGoodsDetailDto cartGoods : shoppingCartGoodsDto.getProducts()) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods;
// 特价商品没有匹配 或 加价购商品 直接跳出循环
if ((goods = goodsMap.get(cartGoods.getSkuId())) == null || ObjectUtils.equals(ActivityTypeEnum.TYPE_81.getCode(), cartGoods.getActivityType())) {
continue;
}
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = getGoodsDiscount(goods.getDiscounts(), Arrays.asList(ActivityTypeEnum.TYPE_21.getCode(), ActivityTypeEnum.TYPE_2.getCode()));
if (goodsDiscount == null) {
continue;
}
if (numberMap.get(cartGoods.getSkuId()) == null) {
numberMap.put(cartGoods.getSkuId(), goods.getActualGoodsNumber());
}
Integer actualGoodsNumber = numberMap.get(cartGoods.getSkuId());
if (actualGoodsNumber > 0) {
Long totalDiscountAmount = cartGoods.getQty() > actualGoodsNumber ? goods.getDiscountAmount() * actualGoodsNumber / goods.getActualGoodsNumber() : goods.getDiscountAmount() * cartGoods.getQty() / goods.getActualGoodsNumber();
ActivityDiscountsDto activityDiscountsDto = new ActivityDiscountsDto();
activityDiscountsDto.setActivityCode(goodsDiscount.getActivityCode());
activityDiscountsDto.setActivityName(goodsDiscount.getActivityName());
activityDiscountsDto.setActivityType(ActivityTypeEnum.TYPE_2.getCode());
activityDiscountsDto.setDiscountAmount(totalDiscountAmount.intValue());
cartGoods.getActivityDiscountsDtos().add(activityDiscountsDto);
cartGoods.setTotalDiscountAmount(cartGoods.getTotalDiscountAmount() + totalDiscountAmount.intValue());
numberMap.put(cartGoods.getSkuId(), actualGoodsNumber - cartGoods.getQty());
} else {
cartGoods.setTotalDiscountAmount(0);
}
}
}
/**
* 获取指定促销类型的GoodsDiscount
......
package cn.freemud.service.impl.mcoffee.entity;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CouponAvailableReq
* @Package cn.freemud.service.impl.mcoffee
* @Description:
* @author: ping1.wu
* @date: 2020/8/4 16:10
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class CouponAvailableReq {
//渠道id
private String providerId;
//商户号
private String merchantId;
private String city;
private String storeId;
//组织机构id列表(校验渠道限制)
private List<String> channelIdList;
//组织机构code列表(校验渠道限制)
private List<String> channelCodeList;
//券码列表
private List<String> couponCodes;
private Integer totalAmount;
//核销渠道 枚举: mocoffee_wx : 麦咖啡微信小程序 mocoffee_zfb : 麦咖啡支付宝小程序
private String redeemChannel;
//购物车商品列表
private List<CouponProductVo> productList;
private String stationId;
private String operatorId;
}
package cn.freemud.service.impl.mcoffee.entity;
import com.freemud.card.sdk.vo.coupon.CouponStateVo;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CouponAvailableResp
* @Package cn.freemud.service.impl.mcoffee
* @Description:
* @author: ping1.wu
* @date: 2020/8/4 16:10
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class CouponAvailableResp {
private Integer result;
private String msg;
private List<CouponState> couponStateList;
}
package cn.freemud.service.impl.mcoffee.entity;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CouponProductVo
* @Package cn.freemud.service.impl.mcoffee
* @Description:
* @author: ping1.wu
* @date: 2020/8/4 16:14
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class CouponProductVo {
private String keyProductCode;
private String productId;
private Integer amount;
private Integer quantity;
private String categoryCode;
}
package cn.freemud.service.impl.mcoffee.entity;
import com.freemud.card.sdk.vo.coupon.Product;
import lombok.Data;
import java.util.List;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CouponState
* @Package cn.freemud.service.impl.mcoffee.entity
* @Description:
* @author: ping1.wu
* @date: 2020/8/5 18:53
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class CouponState {
private String couponCode;
private Integer type;
private Integer state;
private String message;
private Integer minAmount;
private Integer amount;
private Integer priceDiscount;
private Integer originalPrice;
private Integer discount;
private String limitType;
private List<Product> productList;
private String actName;
private String actDesc;
}
......@@ -13,12 +13,14 @@
package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.*;
import cn.freemud.service.impl.mcoffee.entity.CouponAvailableReq;
import cn.freemud.service.impl.mcoffee.entity.CouponAvailableResp;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
// 测试http://115.159.65.101:8002 线上http://10.51.0.37:8002
@FeignClient(name = "COUPON",url="${saas.couponclient.feign.url}")
@FeignClient(name = "COUPON",url="${saas.couponadapterclient.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface CouponClient {
......@@ -53,5 +55,11 @@ public interface CouponClient {
@PostMapping("/coupon/verification/notice")
CouponBaseResponseDto verifyNotice(VerifyNoticeRequestDto verifyNoticeRequestDto);
/**
* 麦咖啡校验券是否可用
*/
@PostMapping("/mccafe/getCouponsAvailable")
CouponAvailableResp getCouponsAvailable(CouponAvailableReq req);
}
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