Commit 8d258eb0 by hanghang.wang

Merge branch 'feature/20210714_一元买虚拟商品特殊处理活动下架,删除特殊增加字段_wanghanghang'

parents dc803552 251f7f70
......@@ -9,6 +9,9 @@
* @version V1.0
* @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*
* 改动原因:将订单聚合层的OrderChannelType同步到SDK中OrderChannelType。
* 不知道对外提供此sdk有没有使用此枚举类,不敢删除。怕怕的
*/
package com.freemud.sdk.api.assortment.order.enums;
......@@ -16,7 +19,16 @@ public enum OrderChannelType {
SAAS("saas", "saas小程序"),
IMG("img", "爱马哥小程序");
IMG("img", "爱马哥小程序"),
IWC("iwc","i围餐"),
SAASMALL("saasmall", "微商城"),
BEAUTIFUL("beautiful", "美业"),
APP("app", "APP");
private String code;
......
......@@ -61,15 +61,15 @@ public class ActivityTip {
* 1.5.5版本添加
* 每单可以参与买一赠一商品总数
*/
private Integer activityQty;
// private Integer activityQty;
/**
* 1.5.5版本添加
* 购物车中参与买一赠一商品个数
*/
private Integer activityCartQty;
// private Integer activityCartQty;
/**
* 1.5.5版本添加
* 购物车中属于买一赠一商品的数据
*/
private List<String> activitySpuIds;
// private List<String> activitySpuIds;
}
......@@ -4,6 +4,7 @@ import ch.qos.logback.classic.Level;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.redis.RedisCache;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.couponcenter.online.domain.*;
......@@ -209,7 +210,9 @@ public interface ShoppingCartBaseService {
try {
ValidateShopProductRequest validateShopProductRequest = shoppingCartAdapter.getValidateShopProductRequest(checkCartRequest);
com.freemud.application.sdk.api.base.BaseResponse<ValiadShopProductResponse> valiadResponse = productService.validateShopProduct(validateShopProductRequest);
ShoppingSdkLogUtil.infoLog("替换购物车数据检验结果 1 --> validateShopProductRequest:{} valiadResponse:{}", validateShopProductRequest,valiadResponse);
// ShoppingSdkLogUtil.infoLog("替换购物车数据检验结果 1 --> validateShopProductRequest:{} valiadResponse:{}", validateShopProductRequest,valiadResponse);
ApiLog.printLog("addGoods validateShopProductRequest ---> validateShopProductRequest:{} valiadResponse:{}", JSONObject.toJSONString(validateShopProductRequest),JSON.toJSONString(valiadResponse),null);
if (valiadResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(valiadResponse.getCode()) || valiadResponse.getData()==null) {
checkCartRequest.getCartGoodsList().clear();
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
......
package cn.freemud.enums;
/**
* @author wanghanghang
* @title: QueryHeardServiceImpl
* @projectName order_group
* @description: 订单BizType枚举类
* @date 2021/7/15下午10:50
*/
public enum BizTypeEnum {
APP_COUPON(6, "APP买券"),
//字段6代表卖券订单。
//蜜雪APP和平台通用。
//后续使用此字段需注意。名称APP_COUPON取得有些误导,由于有地方使用,暂时不更改
APP_COUPON(6, "卖券订单"),
ORDINARY(1, "普通订单"),
VIRTUAL(2, "虚拟订单"),
MEMBERS(3, "会员订单"),
INTEGRAL_MALL(4, "积分商城订单"),
SVC(5, "储值卡订单"),
LGS_SELF_HELP_PARKING(97, "农工商停车自助积分订单"),
LGS_MANUAL_RECORD_PARKING(98, "农工商停车手工录单"),
LGS_PARKING(99, "农工商停车订单");
APP_PRO(1, "未知(目前暂不支持),后续可能预留给正常商品");
private Integer bizType;
private String desc;
......
......@@ -1700,9 +1700,10 @@ public class OrderServiceImpl implements Orderservice {
// TODO: 2019/9/10 删除订单通知
backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
//取消支付时,清理key.此处不做校验是否限制次数的单子,卖券订单直接清理
if(Objects.equals(BizTypeEnum.APP_COUPON.getBizType(),orderBean.getBizType())){
buyProductOnceManager.removeCheckBuyProductOnceKey(orderBean.getCompanyId(),orderBean.getUserId(),orderBean.getProductList().get(0).getProductId());
}
//【P0】【业务 / 米食】【B端 / 万象 / 活动下架】商户618活动:一元买虚拟商品特殊处理活动下架,删除特殊增加字段 7.13 wanghanghang
// if(Objects.equals(BizTypeEnum.APP_COUPON.getBizType(),orderBean.getBizType())){
// buyProductOnceManager.removeCheckBuyProductOnceKey(orderBean.getCompanyId(),orderBean.getUserId(),orderBean.getProductList().get(0).getProductId());
// }
return ResponseUtil.success();
}
......@@ -1750,9 +1751,10 @@ public class OrderServiceImpl implements Orderservice {
// TODO: 2019/9/10 删除订单通知
backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
//取消支付时,清理key.此处不做校验是否限制次数的单子,卖券订单直接清理
if(Objects.equals(BizTypeEnum.APP_COUPON.getBizType(),orderBean.getBizType())){
buyProductOnceManager.removeCheckBuyProductOnceKey(orderBean.getCompanyId(),orderBean.getUserId(),orderBean.getProductList().get(0).getProductId());
}
//【P0】【业务 / 米食】【B端 / 万象 / 活动下架】商户618活动:一元买虚拟商品特殊处理活动下架,删除特殊增加字段 wanghanghang
// if(Objects.equals(BizTypeEnum.APP_COUPON.getBizType(),orderBean.getBizType())){
// buyProductOnceManager.removeCheckBuyProductOnceKey(orderBean.getCompanyId(),orderBean.getUserId(),orderBean.getProductList().get(0).getProductId());
// }
return ResponseUtil.success();
}
......
......@@ -15,10 +15,7 @@ import cn.freemud.entities.vo.GetMemberCouponRequestVo;
import cn.freemud.entities.vo.NgsSellCouponCreateOrderVo;
import cn.freemud.entities.vo.PaysuccessNoticeMessage;
import cn.freemud.entities.vo.SellCouponCreateOrderVo;
import cn.freemud.enums.BusinessTypeEnum;
import cn.freemud.enums.OrderBeanType;
import cn.freemud.enums.ResponseResult;
import cn.freemud.enums.UserLoginChannelEnum;
import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.manager.BuyProductOnceManager;
import cn.freemud.redis.RedisCache;
......@@ -44,6 +41,7 @@ import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.log.ThirdPartyLog;
import com.freemud.application.sdk.api.ordercenter.enums.*;
import com.freemud.application.sdk.api.ordercenter.enums.OrderType;
import com.freemud.application.sdk.api.ordercenter.request.OrderChangeStateReq;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.request.create.*;
......@@ -185,6 +183,8 @@ public class SellCouponOrderServiceImpl {
}
//通过商户号配置进阿波罗,识别哪些商户走仅限一次卖券业务 wanghanghang 0610
//【P0】【业务 / 米食】【B端 / 万象 / 活动下架】商户618活动:一元买虚拟商品特殊处理活动下架,删除特殊增加字段 wanghanghang
//处理方式,阿波罗配置商户改成空。没必要删除代码。保留后续此类活动还可继续使用
if (buyProductOncePartnerIds != null && buyProductOncePartnerIds.contains(partnerId)) {
try {
ResponseResult checkRequest = buyProductOnceManager.checkBuyProductOnce(productInfosDto.getData().getProducts(),partnerId,userId);
......@@ -224,7 +224,8 @@ public class SellCouponOrderServiceImpl {
AfterSalesType.SYSTEM_CANCEL, "商品库存不足", "", null);
BaseOrderResponse orderResponse = orderCenterSdkService.orderCancel(cancelOrderRequest);
//异常清理掉key
buyProductOnceManager.removeCheckBuyProductOnceKey(partnerId,userId,orderBean.getProductList().get(0).getProductId());
// //【P0】【业务 / 米食】【B端 / 万象 / 活动下架】商户618活动:一元买虚拟商品特殊处理活动下架,删除特殊增加字段 7.13 wanghanghang
// buyProductOnceManager.removeCheckBuyProductOnceKey(partnerId,userId,orderBean.getProductList().get(0).getProductId());
return ResponseUtil.error(baseResponse.getCode(),"商品库存不足");
}
}
......@@ -315,7 +316,7 @@ public class SellCouponOrderServiceImpl {
GetProductInfoRequest request = new GetProductInfoRequest();
request.setChannel(menuType);
request.setPartnerId(partnerId);
request.setProductInfoType(2);
request.setProductInfoType(ProductInfoType.ALL.getCode());
request.setShopId(storeId);
request.setProductIds(productIds);
//获取商品(里面的活动)
......
......@@ -39,6 +39,7 @@ import cn.freemud.utils.LogUtil;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.productcenter.constant.ResponseConstant;
import com.freemud.application.sdk.api.productcenter.request.product.valid.ValidateShopProductRequest;
......@@ -954,10 +955,16 @@ public class CouponServiceImpl implements CouponService {
if (!productValid) {
return null;
}
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用)
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用) 注意点1
List<String> couponStoreIds = Lists.newArrayList();
for (GetCouponDetailResponseDto.Details detail : couponDetailResponseDto.getDetails()) {
if (!CouponStatus.STATUS_0.getCode().equals(detail.getStatus()) && !CouponStatus.STATUS_2.getCode().equals(detail.getStatus())) continue;
ApiLog.printLog("addGoods calculationDiscountResult", JSONObject.toJSONString(detail)," 10",null);
for (GetCouponDetailResponseDto.ActiveRestrictionVOS activeRestrictionVO : detail.getActiveRestrictionVOS()) {
couponStoreIds.add(activeRestrictionVO.getStoreIdPartner());
}
......
......@@ -415,6 +415,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (calculationDiscountResult != null && CollectionUtils.isNotEmpty(calculationDiscountResult.getSendGoods())) {
sendGoodsQtyCheck(productsCount, appId, partnerId, userId, storeId, tableNumber, oldCartGoodsList, shoppingCartBaseService, calculationDiscountResult.getSendGoods());
}
// 当商品数量被设为0时
if (Objects.equals(cartGoods.getQty(), 0)) {
assortmentSdkService.updateGoodsQtyBySdk(partnerId, userId, storeId, cartGoods.getCartGoodsUid(), 0, "", shoppingCartBaseService);
......@@ -1446,9 +1447,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 换购券传给促销要带code
String goodsId = StringUtils.isEmpty(checkSpqInfoResponseDto.getSkuId()) ? checkSpqInfoResponseDto.getSpuId() : checkSpqInfoResponseDto.getSkuId();
if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, 1, checkSpqInfoResponseDto.getPrice(), 100, cartGoodsUid, cartGoods.getSpuId());
this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, cartGoods.getQty(), checkSpqInfoResponseDto.getPrice(), 100, cartGoodsUid, cartGoods.getSpuId());
} else {
this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, 1, checkSpqInfoResponseDto.getPrice(), 100, cartGoodsUid);
this.addCalculationDiscountGoods(calculationDiscountGoodsList, goodsId, cartGoods.getQty(), checkSpqInfoResponseDto.getPrice(), 100, cartGoodsUid);
}
}
}
......@@ -1468,6 +1469,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
calculationDiscountGoodsList.removeIf(calculationDiscountGoods -> (calculationDiscountGoods.getGoodsQuantity().equals(0)));
if (CollectionUtils.isEmpty(calculationDiscountGoodsList)) {
return null;
}
......@@ -1487,7 +1489,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
try {
// ApiLog.debug("activityClient discount :{}", JSON.toJSONString(activityCalculationDiscountRequestDto));
ApiLog.printLog("activityClient discount :{}", JSON.toJSONString(activityCalculationDiscountRequestDto),null,null);
ApiLog.printLog("activityClient discount :{}", JSON.toJSONString(activityCalculationDiscountRequestDto),null,null);
activityCalculationDiscountResponseDto = activityClient.calculationDiscount(activityCalculationDiscountRequestDto);
} catch (Exception ex) {
// ErrorLog.printErrorLog("calculation_discount_error", "/calculation/discount", activityCalculationDiscountRequestDto, ex);
......@@ -1655,6 +1657,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} else {
calculationDiscountGoodsList.add(calculationDiscountGoods);
}
}
/**
......@@ -1970,6 +1973,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CheckCartRequest checkCartRequest = assortmentSdkService.checkShoppingCartSdk(oldAllCartGoodsList, addShoppingCartGoodsRequestVo.getPartnerId(),
addShoppingCartGoodsRequestVo.getShopId(), shoppingCartGoodsResponseVo, addShoppingCartGoodsRequestVo.getOrderType(),
"", addShoppingCartGoodsRequestVo.getMenuType(),shoppingCartBaseService);
if (checkCartRequest.getShoppingCartGoodsResponseVo() != null) {
shoppingCartGoodsResponseVo.setToastMsg(checkCartRequest.getShoppingCartGoodsResponseVo().getToastMsg());
shoppingCartGoodsResponseVo.setChanged(checkCartRequest.getShoppingCartGoodsResponseVo().getChanged());
......@@ -1985,6 +1989,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
nowCartGoodsList.add(oldCartGoods);
}
});
// 重新set购物车信息到缓存中
assortmentSdkService.setShoppingCart(addShoppingCartGoodsRequestVo.getPartnerId(), addShoppingCartGoodsRequestVo.getShopId(),
userId, nowCartGoodsList, addShoppingCartGoodsRequestVo.getSessionId(), addShoppingCartGoodsRequestVo.getTableNumber(), this.shoppingCartBaseService);
......@@ -2057,7 +2062,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
setToastMsgIfNotExist(shoppingCartGoodsResponseVo, ShoppingCartConstant.HAS_OTHER_ACTIVITY_WHEN_ADD_GOODS_COUPON);
}
//校验合法性,更新缓存中购物车信息
LogUtil.info("updateCartGoodsLegal", JSON.toJSONString(cartGoods),JSON.toJSONString(allCartGoodsList));
ApiLog.printLog("updateCartGoodsLegal",JSONObject.toJSONString(cartGoods),JSON.toJSONString(allCartGoodsList),null);
updateCartGoodsLegal(cartGoods, userId, shoppingCartGoodsResponseVo, addShoppingCartGoodsRequestVo, allCartGoodsList);
......@@ -2495,7 +2500,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if(customerInfoVo == null) throw new ServiceException(ResponseResult.NOT_LOGIN);
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
LogUtil.debug("customerInfoVo",sessionId,customerInfoVo);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
......
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