新增创建订单 切换就餐模式接口
This commit is contained in:
@@ -4,6 +4,7 @@ package com.chaozhanggui.system.cashierservice.controller;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
@@ -16,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@@ -113,7 +117,15 @@ public class ProductController {
|
||||
|
||||
@PostMapping("/choseEatModel")
|
||||
public Result choseEatModel(@Validated @RequestBody ChoseEatModelDTO choseEatModelDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, cartService.choseEatModel(choseEatModelDTO));
|
||||
List<TbCashierCart> cashierCartList = cartService.choseEatModel(choseEatModelDTO);
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
for (TbCashierCart item : cashierCartList) {
|
||||
amount = amount.add(item.getTotalAmount());
|
||||
}
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("amount", amount);
|
||||
data.put("info", cashierCartList);
|
||||
return Result.success(CodeEnum.SUCCESS, data);
|
||||
}
|
||||
|
||||
@PostMapping("cleanCart")
|
||||
|
||||
@@ -1581,7 +1581,7 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
|
||||
public Object choseEatModel(ChoseEatModelDTO choseEatModelDTO) {
|
||||
public List<TbCashierCart> choseEatModel(ChoseEatModelDTO choseEatModelDTO) {
|
||||
Integer userId = TokenUtil.getUserId();
|
||||
// 查询购物车所有信息
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
|
||||
Reference in New Issue
Block a user