1.代客下单相关接口修改

This commit is contained in:
2024-08-20 13:23:13 +08:00
parent 46133d7d16
commit 796f43299f
11 changed files with 232 additions and 60 deletions

View File

@@ -6,12 +6,15 @@ import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.annotation.MyLog;
import com.chaozhanggui.system.cashierservice.bean.LogTag;
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
import com.chaozhanggui.system.cashierservice.entity.dto.UpdateVipDTO;
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
import com.chaozhanggui.system.cashierservice.service.OrderService;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@CrossOrigin(origins = "*")
@@ -24,6 +27,14 @@ public class OrderController {
@Autowired
private OrderService orderService;
@PutMapping("/updateVip")
@MyLog(value = "代客下单 修改会员", tag = LogTag.PLACE)
public ResponseEntity<Object> updateVip(
@Validated @RequestBody UpdateVipDTO updateVipDTO
) {
return ResponseEntity.ok(orderService.updateVip(updateVipDTO));
}
@PostMapping("/createCart")
public Result createCart(@RequestHeader("token") String token,
@RequestHeader("loginName") String loginName,
@@ -34,7 +45,7 @@ public class OrderController {
String userId = jsonObject.getString("accountId");
return orderService.createCart(cartVo.getMasterId(),cartVo.getProductId(),cartVo.getShopId(),
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType());
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType(), cartVo.getVipUserId(), cartVo.getTableId());
}
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
@@ -44,12 +55,13 @@ public class OrderController {
@RequestHeader("clientType") String clientType,
@RequestParam(value = "masterId", required = false) String masterId,
@RequestParam(required = false) String tableId,
@RequestParam(required = false) Integer vipUserId,
@RequestParam("shopId") String shopId
){
if (tableId == null && StrUtil.isBlank(masterId)) {
return Result.fail("masterId和tableId不能同时为空");
}
return orderService.queryCart(masterId,shopId);
return orderService.queryCart(masterId,shopId, vipUserId, tableId);
}
@@ -90,7 +102,8 @@ public class OrderController {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userId = jsonObject.getString("accountId");
String code = jsonObject.getString("code");
return orderService.cartStatus(Integer.valueOf(cartVo.getShopId()),cartVo.getMasterId(),cartVo.getStatus(),userId,cartVo.getUuid(),clientType);
return orderService.cartStatus(Integer.valueOf(cartVo.getShopId()),cartVo.getMasterId(),
cartVo.getStatus(),userId,cartVo.getUuid(),clientType, cartVo.getVipUserId(), cartVo.getTableId());
}
@PostMapping("/createOrder")
public Result createOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,