1.代客下单 添加购物车新增单品备注
This commit is contained in:
parent
5c2b995d1f
commit
0f9c370118
|
|
@ -25,5 +25,5 @@ public class AddCartDTO {
|
|||
private boolean isPack;
|
||||
private boolean isGift;
|
||||
private Integer cartId;
|
||||
|
||||
private String note;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ public class TbCashierCart implements Serializable {
|
|||
private String skuName;
|
||||
@Column(name = "`place_num`")
|
||||
private Integer placeNum;
|
||||
@Column(name = "`note`")
|
||||
private String note;
|
||||
|
||||
public void copy(TbCashierCart source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
|
|
|
|||
|
|
@ -113,6 +113,9 @@ public class TbOrderDetail implements Serializable {
|
|||
@ApiModelProperty(value = "place_num")
|
||||
private Integer placeNum;
|
||||
|
||||
@Column(name = "`note`")
|
||||
private String note;
|
||||
|
||||
public void copy(TbOrderDetail source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import cn.ysk.cashier.enums.ShopWxMsgTypeEnum;
|
|||
import cn.ysk.cashier.enums.TableStateEnum;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||
import cn.ysk.cashier.mybatis.mapper.*;
|
||||
import cn.ysk.cashier.mybatis.service.MpShopTableService;
|
||||
import cn.ysk.cashier.pojo.TbShopPayType;
|
||||
|
|
@ -49,7 +48,6 @@ import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
|||
import cn.ysk.cashier.service.impl.TbPayServiceImpl;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.PendingCountVO;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
|
|
@ -72,12 +70,12 @@ import org.springframework.data.domain.Pageable;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
|
@ -437,9 +435,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
tbCashierCart.setTotalNumber(addCartDTO.getNum());
|
||||
tbCashierCart.setNumber(addCartDTO.getNum());
|
||||
tbCashierCart.setCategoryId(product.getCategoryId());
|
||||
tbCashierCart.setNote(addCartDTO.getNote());
|
||||
cashierCartRepository.save(tbCashierCart);
|
||||
|
||||
} else {
|
||||
tbCashierCart.setNote(addCartDTO.getNote());
|
||||
tbCashierCart.setTotalAmount(new BigDecimal(addCartDTO.getNum()).multiply(productSku.getSalePrice()));
|
||||
|
||||
if (!addCartDTO.isPack()) {
|
||||
|
|
@ -619,8 +619,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbCashierCart> getCart(Long tableId, Integer page,
|
||||
Integer size, Integer shopId, Integer vipUserId, String masterId) {
|
||||
public Map<String, Object> getCart(Long tableId, Integer page,
|
||||
Integer size, Integer shopId, Integer vipUserId, String masterId) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getTableId, tableId)
|
||||
.in(TbCashierCart::getStatus, "create", "refund", "return")
|
||||
|
|
@ -653,6 +653,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
});
|
||||
|
||||
|
||||
AtomicReference<TbCashierCart> mealCashierCart = new AtomicReference<>();
|
||||
if (!skuIds.isEmpty()) {
|
||||
List<TbProductSku> skuList = productSkuRepository.findAllById(skuIds);
|
||||
HashMap<String, TbProductSku> skuMap = new HashMap<>();
|
||||
|
|
@ -660,6 +661,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
|
||||
ArrayList<Map<String, Object>> infos = new ArrayList<>();
|
||||
records.forEach(item -> {
|
||||
if (item.getProductId().equals("-999")) {
|
||||
mealCashierCart.set(item);
|
||||
return;
|
||||
}
|
||||
Map<String, Object> map = BeanUtil.beanToMap(item, false, false);
|
||||
TbProductSku tbProductSku = skuMap.get(item.getSkuId());
|
||||
map.put("specSnap", tbProductSku != null ? tbProductSku.getSpecSnap() : null);
|
||||
|
|
@ -681,10 +686,12 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
list.add(item);
|
||||
});
|
||||
copyPage.setRecords(list);
|
||||
return copyPage;
|
||||
Map<String, Object> map = BeanUtil.beanToMap(copyPage, false, false);
|
||||
map.put("seatFee", mealCashierCart);
|
||||
return map;
|
||||
}
|
||||
|
||||
return cartPage;
|
||||
return BeanUtil.beanToMap(cartPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1051,6 +1058,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
orderDetail.setProductSkuName(productSku.getSpecSnap());
|
||||
}
|
||||
|
||||
orderDetail.setNote(cashierCart.getNote());
|
||||
orderDetail.setCreateTime(DateUtil.date().toTimestamp());
|
||||
orderDetail.setNum(cashierCart.getNumber());
|
||||
orderDetail.setPrice(cashierCart.getSalePrice());
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import cn.ysk.cashier.pojo.shop.TbShopTable;
|
|||
import cn.ysk.cashier.dto.shop.TbShopTableDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -105,7 +104,7 @@ public interface TbShopTableService {
|
|||
|
||||
void clearCart(ClearCartDTO clearCartDTO);
|
||||
|
||||
Page<TbCashierCart> getCart(Long tableId, Integer page, Integer size, Integer shopId, Integer vipUserId, String masterId);
|
||||
Map<String, Object> getCart(Long tableId, Integer page, Integer size, Integer shopId, Integer vipUserId, String masterId);
|
||||
|
||||
TbCashierCart updateCart(UpdateCartDTO updateCartDTO);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue