Commit 3adc44bf by dingkai

商城统一saasmall

parent c8cc1b85
......@@ -369,8 +369,8 @@ public class OrderSdkAdapter {
if ("meals".equals(queryOrdersRequest.getSource()[i])) {
orderClients.add(OrderClientType.WAI_MEAL.getIndex());
}
if ("mall".equals(queryOrdersRequest.getSource()[i])) {
orderClients.add(OrderClientType.MALL.getIndex());
if ("saasmall".equals(queryOrdersRequest.getSource()[i])) {
orderClients.add(OrderClientType.SAASMALL.getIndex());
}
}
orderConditionsReq.setOrderClients(orderClients);
......@@ -1136,7 +1136,7 @@ public class OrderSdkAdapter {
case "meal":
orderClientType = 19;
break;
case "mall":
case "saasmall":
orderClientType = 23;
break;
default:
......@@ -1177,7 +1177,7 @@ public class OrderSdkAdapter {
name = "meals";
break;
case 23:
name = "mall";
name = "saasmall";
break;
default:
name = orderClientType.toString();
......@@ -2612,6 +2612,7 @@ public class OrderSdkAdapter {
/**
* 计算所有商品的重量 单位g
* 称重菜的重量单位是斤
*/
private Double sumOrderWeight(List<CreateOrderProductRequest> products) {
Double totalWeight = 0D;
......@@ -2621,11 +2622,22 @@ public class OrderSdkAdapter {
for (CreateOrderProductRequest productRequest : products) {
if (ObjectUtils.equals(ProductTypeEnum.SETMEAL_PRODUCT.getCode(), productRequest.getProductType()) || ObjectUtils.equals(ProductTypeEnum.SETMEAL_UPPRICE_PRODUCT.getCode(), productRequest.getProductType())) {
if (CollectionUtils.isNotEmpty(productRequest.getComboProduct())) {
productRequest.getComboProduct().stream().map(t -> {
Double productWeight = t.getWeight() == null ? 0D : t.getWeight();
if (ProductTypeEnum.WEIGHT_PRODUCT.getCode().equals(t.getProductType())) {
productWeight = productWeight * 500;
}
return productWeight;
}).reduce(0D, Double::sum);
Double comboProductTotalWeight = productRequest.getComboProduct().stream().map(t -> t.getWeight() == null ? 0D : t.getWeight()).reduce(0D, Double::sum);
totalWeight += comboProductTotalWeight;
}
} else {
Double productWeight = productRequest.getWeight() == null ? 0D : productRequest.getWeight();
if (ProductTypeEnum.WEIGHT_PRODUCT.getCode().equals(productRequest.getProductType())) {
productWeight = productWeight * 500;
}
totalWeight += productWeight;
}
}
......
......@@ -32,7 +32,10 @@ public enum OrderSourceType {
POS("pos_order", "线下 POS"),
MEAL("meal", "i围餐");
MEAL("meal", "i围餐"),
SAASMALL("saasmall", "微商城"),
;
private String code;
......
......@@ -61,12 +61,12 @@ public class RedisKeyConstant {
/**
* 用户购物车在redis的key前缀(商城购物车)
*/
public final static String SAAS_MALL_SHOPPINGCART_KEY_PREFIX = "saas:user:info:mall:cart:goods:";
public final static String SAAS_MALL_SHOPPINGCART_KEY_PREFIX = "saas:user:info:saasmall:cart:goods:";
/**
* 用户购物车总价在redis的key前缀(商城购物车)
*/
public final static String SAAS_MALL_SHOPPINGCART_AMOUNT_PREFIX = "saas:user:info:mall:cart:amount:goods:";
public final static String SAAS_MALL_SHOPPINGCART_AMOUNT_PREFIX = "saas:user:info:saasmall:cart:amount:goods:";
/**
* 点餐门店绑定的商城门店redis的key前缀
......
......@@ -128,9 +128,9 @@ public class MallOrderAdapter {
createOrderDto.setLongitude(userDeliveryInfoDto.getUserLongitude());
createOrderDto.setOrderType(QueryOrderType.TAKE_OUT);
createOrderDto.setPayType(QueryPayType.ONLINE_PAY);
createOrderDto.setSource(OrderSourceType.MALL.getCode());
createOrderDto.setSourceName(OrderSourceType.MALL.getDesc());
createOrderDto.setOrderClientType(OrderClientType.MALL);
createOrderDto.setSource(OrderSourceType.SAASMALL.getCode());
createOrderDto.setSourceName(OrderSourceType.SAASMALL.getDesc());
createOrderDto.setOrderClientType(OrderClientType.SAASMALL);
createOrderDto.setRemark(remark);
createOrderDto.setGmtExpect(null);
BaseCreateOrderRequest.DeliveryTypeInfo deliveryTypeInfo = new BaseCreateOrderRequest.DeliveryTypeInfo();
......
......@@ -16,7 +16,6 @@ import cn.freemud.base.log.LogTreadLocal;
import cn.freemud.base.util.DateUtil;
import cn.freemud.constant.CustomerScoreConstant;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.QueryOrdersResponseDto.DataBean.OrderBean.ProductBean;
import cn.freemud.entities.dto.activity.ShareDiscountActivityDto;
import cn.freemud.entities.dto.order.*;
import cn.freemud.entities.dto.order.CreateOrderAccountDto;
......@@ -749,8 +748,8 @@ public class OrderAdapter {
if(OrderChannelType.IWC.getCode().equals(channelType)) {
queryOrdersDto.setSource(new String[]{"meals"});
} else if(OrderChannelType.MALL.getCode().equals(channelType)) {
queryOrdersDto.setSource(new String[]{"mall"});
} else if(OrderChannelType.SAASMALL.getCode().equals(channelType)) {
queryOrdersDto.setSource(new String[]{"saasmall"});
} else {
queryOrdersDto.setSource(new String[]{"saas"});
}
......@@ -790,7 +789,7 @@ public class OrderAdapter {
queryOrdersDto.setStatus(statuses);
}
if (OrderChannelType.MALL.getCode().equals(channelType)) {
if (OrderChannelType.SAASMALL.getCode().equals(channelType)) {
Integer[] statuses = new Integer[]{OrderStatus.COMPLETE.getCode(), OrderStatus.CALCEL.getCode()};
queryOrdersDto.setStatus(statuses);
queryOrdersDto.setType(new Integer[]{});
......
......@@ -55,7 +55,7 @@ public class QueryOrderVo {
private String endDate;
/**
* 渠道信息 1:saas 2:img 3:iwc;4:mall
* 渠道信息 saas; img; iwc; saasmall
*/
private String channelType;
......
......@@ -20,7 +20,7 @@ public enum OrderChannelType {
IWC("iwc","i围餐"),
MALL("mall", "商城");
SAASMALL("saasmall", "微商城");
private String code;
......
......@@ -28,7 +28,10 @@ public enum OrderSourceType {
MALL("mall", "非码Mall"),
SAAS("saas", "saas 点餐");
SAAS("saas", "saas 点餐"),
SAASMALL("saasmall", "微商城"),
;
private String code;
......
......@@ -13,8 +13,6 @@
package cn.freemud.service.impl;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.db.OpenPlatformIappWxappConfig;
import cn.freemud.entities.db.OpenPlatformPartnerStoreDeliveryConfig;
import cn.freemud.entities.dto.StoreDeliveryInfoDto;
import cn.freemud.entities.dto.UserDeliveryInfoDto;
import cn.freemud.entities.dto.UserLoginInfoDto;
......@@ -28,15 +26,8 @@ import cn.freemud.enums.CouponFlag;
import cn.freemud.enums.OrderChannelType;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.ThirdDeliveryService;
import cn.freemud.service.delivery.ThirdDeliveryServiceImpl;
import cn.freemud.service.thirdparty.ShoppingCartClient;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse;
import com.freemud.application.sdk.api.membercenter.service.MemberCenterService;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
......@@ -98,7 +89,7 @@ public class CheckMallOrder {
.reachStoreType(createOrderVo.getReachStoreType())
.flag(CouponFlag.NO.getCode())
.useCustomerScore(createOrderVo.getUseCustomerScore())
.channelType(OrderChannelType.MALL.getCode())
.channelType(OrderChannelType.SAASMALL.getCode())
.build();
// 通过购物车获取优惠信息
GetShoppingCartGoodsApportionDto requestDto = new GetShoppingCartGoodsApportionDto();
......
......@@ -41,12 +41,10 @@ import com.freemud.application.sdk.api.deliverycenter.service.DeliveryService;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.enums.AfterSalesType;
import com.freemud.application.sdk.api.ordercenter.enums.OrderType;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtendedReq;
import com.freemud.application.sdk.api.ordercenter.request.POSOrderOperationBaseReq;
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.structure.request.PushMessageNoticeDto;
import com.freemud.sdk.api.assortment.order.entities.OrderExtInfoDTO;
import com.freemud.sdk.api.assortment.order.request.order.*;
import com.freemud.sdk.api.assortment.order.response.order.*;
......@@ -167,7 +165,7 @@ public class MallOrderServiceImpl implements MallOrderService {
return ResponseUtil.error(ResponseResult.ORDER_HAS_CANCELED);
}
//非商城订单不允许操作
if(!OrderSourceType.MALL.getCode().equals(orderBean.getSource())) {
if(!OrderSourceType.SAASMALL.getCode().equals(orderBean.getSource())) {
return ResponseUtil.error(ResponseResult.ORDER_MALL_NOT_MATCH);
}
......@@ -446,7 +444,7 @@ public class MallOrderServiceImpl implements MallOrderService {
newShoppingCartClearDto.setAppId(wxappid);
newShoppingCartClearDto.setSessionId(sessionId);
newShoppingCartClearDto.setOperationType(1);
newShoppingCartClearDto.setChannelType(OrderChannelType.MALL.getCode());
newShoppingCartClearDto.setChannelType(OrderChannelType.SAASMALL.getCode());
shoppingCartClient.clearShoppingCart(newShoppingCartClearDto);
// 埋点支付行为
......
......@@ -75,7 +75,7 @@ public class OrderAdapterServiceImpl implements OrderAdapterService {
/**
* 商城订单
*/
if(OrderChannelType.MALL.getCode().equals(createOrderVo.getChannelType())) {
if(OrderChannelType.SAASMALL.getCode().equals(createOrderVo.getChannelType())) {
return mallOrderService.createOrder(createOrderVo);
}
......
......@@ -307,7 +307,7 @@ public class OrderServiceImpl implements Orderservice {
return orderCommonService.paySuccessCallback(message);
}
// 商城订单处理
if(OrderSourceType.MALL.getCode().equals(orderBean.getSource())) {
if(OrderSourceType.SAASMALL.getCode().equals(orderBean.getSource())) {
return mallOrderService.paySuccessCallback(message, confirmOrderDto, orderBeans);
}
String oid = StringUtils.isNotEmpty(orderBean.getParentCode()) && !"0".equals(orderBean.getParentCode()) ? orderBean.getParentCode() : orderBean.getOid();
......@@ -2073,8 +2073,8 @@ public class OrderServiceImpl implements Orderservice {
String channelType = OrderChannelType.SAAS.getCode();
if(IappIdType.WC_XCX.getCode().equals(userLoginInfoDto.getIappId())) {
channelType = OrderChannelType.IWC.getCode();
} else if(OrderChannelType.MALL.getCode().equals(queryOrderVo.getChannelType())) {
channelType = OrderChannelType.MALL.getCode();
} else if(OrderChannelType.SAASMALL.getCode().equals(queryOrderVo.getChannelType())) {
channelType = OrderChannelType.SAASMALL.getCode();
}
return channelType;
}
......
......@@ -55,7 +55,7 @@ public class MallOrderServiceImplTest {
requestVO.setPartnerId("1864");
requestVO.setShopId("8899");
requestVO.setSessionId("123123");
requestVO.setChannelType("mall");
requestVO.setChannelType("saasmall");
requestVO.setOid("16303606485084241800003");
mallOrderService.orderAffirm(requestVO);
}
......
......@@ -33,7 +33,7 @@ public enum OrderClientType {
JUBAOPEN(20, "美团聚宝盆"),
DIANPING(21, "美团点评"),
KOUBEI(22, "口碑"),
MALL(23, "商城"),
SAASMALL(23, "微商城"),
;
......
......@@ -141,7 +141,7 @@ public class ShoppingCartController {
private ShoppingCartNewService getInstanceByRequest(BaseRequestVo requestVo) {
if(requestVo.getChannelType() != null && OrderChannelType.MALL.getCode().equals(requestVo.getChannelType())) {
if(requestVo.getChannelType() != null && OrderChannelType.SAASMALL.getCode().equals(requestVo.getChannelType())) {
return SDKCommonBaseContextWare.getBean(ShoppingCartMallServiceImpl.class);
} else {
return getInstanceBySessionId(requestVo.getSessionId());
......
......@@ -18,7 +18,7 @@ public enum OrderChannelType {
IMG("img", "爱马哥小程序"),
MALL("mall", "商城");
SAASMALL("saasmall", "商城");
private String code;
......
......@@ -28,7 +28,10 @@ public enum OrderSourceType {
MALL("mall", "非码Mall"),
SAAS("saas", "saas 点餐");
SAAS("saas", "saas 点餐"),
SAASMALL("saasmall", "微商城"),
;
private String code;
......
......@@ -55,7 +55,7 @@ public class ShoppingCartControllerMallTest {
public void addGoods() {
String str = "{\"spuId\":\"154916516745371156\",\"skuId\":\"\",\"qty\":10,\"categoryId\":\"0101\",\"categoryName\":\"1分钱\"," +
"\"productComboList\":[],\"productGroupList\":[],\"channelType\":\"mall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\"," +
"\"productComboList\":[],\"productGroupList\":[],\"channelType\":\"saasmall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\"," +
"\"sessionId\":\"testMallUser\",\"orderType\":\"\",\"shopId\":\"0000622\"}";
try {
mockMvc.perform(post("/shoppingCart/addGoods").content(str).
......@@ -71,7 +71,7 @@ public class ShoppingCartControllerMallTest {
*/
@Test
public void updateGoodsQty() {
String requestJson = "{\"shopId\":\"0000622\",\"cartGoodsUid\":\"3c6c126b-ce1a-4489-930d-28940c4edb0a\",\"qty\":3,\"channelType\":\"mall\"," +
String requestJson = "{\"shopId\":\"0000622\",\"cartGoodsUid\":\"3c6c126b-ce1a-4489-930d-28940c4edb0a\",\"qty\":3,\"channelType\":\"saasmall\"," +
"\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\",\"sessionId\":\"testMallUser\",\"orderType\":\"\"}";
try {
mockMvc.perform(post("/shoppingCart/updateGoodsQty").content(requestJson).
......@@ -85,7 +85,7 @@ public class ShoppingCartControllerMallTest {
@Test
public void listCartGoods() {
String requestJson = "{\"shopId\":\"0000622\",\"useCustomerScore\":0,\"couponCode\":\"\",\"activityCode\":\"\",\"flag\":\"\",\"sendGoods\":[]," +
"\"buyMemberCard\":null,\"channelType\":\"mall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\",\"sessionId\":\"testMallUser\",\"orderType\":\"\"}";
"\"buyMemberCard\":null,\"channelType\":\"saasmall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\",\"sessionId\":\"testMallUser\",\"orderType\":\"\"}";
try {
mockMvc.perform(post("/shoppingCart/listCartGoods").content(requestJson).
contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON_UTF8)).andDo(print()).
......@@ -102,7 +102,7 @@ public class ShoppingCartControllerMallTest {
*/
@Test
public void clearCartGoods() {
String str = "{\"channelType\":\"mall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\",\"sessionId\":\"testMallUser\",\"orderType\":\"\",\"shopId\":\"0000622\"}";
String str = "{\"channelType\":\"saasmall\",\"partnerId\":\"1864\",\"appId\":\"wxb78fb7c6218cb52c\",\"sessionId\":\"testMallUser\",\"orderType\":\"\",\"shopId\":\"0000622\"}";
try {
mockMvc.perform(post("/shoppingCart/clearCartGoods").content(str).
contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON_UTF8)).andDo(print()).
......
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