Commit e075d22e by 孙昱

sunyu::new api::about getCartInfoByUser

parent bf63ad93
...@@ -66,6 +66,13 @@ public class MCoffeeShoppingCartController { ...@@ -66,6 +66,13 @@ public class MCoffeeShoppingCartController {
return shoppingCartMCoffeeService.getGoodsList(request); return shoppingCartMCoffeeService.getGoodsList(request);
} }
@ApiAnnotation(logMessage = "getCartInfoByUser")
@PostMapping(value = "/getCartInfoByUser")
public BaseResponse getCartInfoByUser(@Validated @LogParams @RequestBody QueryCartInfoRequestVo requestVo){
return shoppingCartMCoffeeService.getCartInfoByUser(requestVo);
}
/** /**
* 查询购物车可使用优惠券 * 查询购物车可使用优惠券
*/ */
......
package cn.freemud.entities.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: QueryCartInfoRequestVo
* @Package cn.freemud.entities.vo
* @Description: 简单描述下这个类是做什么用的
* @author: yu.sun
* @date: 2020/9/11 10:35
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class QueryCartInfoRequestVo {
@ApiModelProperty(value = "用户Id",required = true)
@NotEmpty(message = "用户Id不可为空")
private String userId;
@ApiModelProperty(value = "商户Id",required = true)
@NotEmpty(message = "商户Id不可为空")
private String partnerId;
@ApiModelProperty(value = "门店id",required = true)
@NotEmpty(message = "门店id不可为空")
private String storeId;
}
\ No newline at end of file
...@@ -108,6 +108,27 @@ public class AssortmentSdkService { ...@@ -108,6 +108,27 @@ public class AssortmentSdkService {
} }
/** /**
* 调用聚合sdk获取缓存中购物车信息
*
* @param partnerId
* @param storeId
* @param useId
* @return
*/
public List<CartGoods> getShoppingCartForCoupon(String partnerId, String storeId, String useId, String tableNumber, ShoppingCartBaseService shoppingCartService) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto = getCartParamDto(partnerId, storeId, useId);
cartParamDto.setTableNumber(tableNumber);
// 根据不同点餐类型获取不同购物车实例
BaseResponse<List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods>> baseResponse = shoppingCartService.getCartGoodsList(cartParamDto, LogThreadLocal.getTrackingNo());
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || CollectionUtils.isEmpty(baseResponse.getResult())) {
return new ArrayList<>();
}
return JSONArray.parseArray(JSONObject.toJSONString(baseResponse.getResult()), CartGoods.class);
}
/**
* 调用聚合sdk设置缓存中购物车信息 * 调用聚合sdk设置缓存中购物车信息
* *
* @param partnerId * @param partnerId
......
...@@ -316,6 +316,13 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -316,6 +316,13 @@ public class ShoppingCartMCoffeeServiceImpl {
} }
public BaseResponse getCartInfoByUser(QueryCartInfoRequestVo requestVo){
// 获取购物车商品
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCartForCoupon(requestVo.getPartnerId(), requestVo.getStoreId(), requestVo.getUserId(), "", shoppingCartBaseService);
return ResponseUtil.success(cartGoodsList);
}
/** /**
* 查询购物车可用券 * 查询购物车可用券
*/ */
......
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