feat: 1.临时菜接口 2.购物车数量字段修改为decimal类型

This commit is contained in:
张松 2024-11-25 10:56:22 +08:00
parent be8c796254
commit 9b1352360d
25 changed files with 873 additions and 1118 deletions

View File

@ -51,7 +51,7 @@ public interface TableConstant {
public enum UseType { public enum UseType {
TAKEOUT("takeout"), TAKEOUT("takeout"),
DINE_IN_AFTER("dine-in-after"), DINE_IN_AFTER("dine-in-after"),
DINE_IN_BEFORE("dine-in-before"); DINE_IN_BEFORE("dine-in-before"), NONE_TABLE("dine-in");
private final String value; private final String value;
UseType(String value) { UseType(String value) {

View File

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.entity.OrderVo; import com.chaozhanggui.system.cashierservice.entity.OrderVo;
import com.chaozhanggui.system.cashierservice.entity.dto.AddTemporaryDishesDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO; import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnCartDTO; import com.chaozhanggui.system.cashierservice.entity.dto.ReturnCartDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.UpdateVipDTO; import com.chaozhanggui.system.cashierservice.entity.dto.UpdateVipDTO;
@ -18,6 +19,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
@RestController @RestController
@Slf4j @Slf4j
@ -45,6 +48,11 @@ public class OrderController {
cartVo.getIsPack(), cartVo.getUuid(), cartVo.getType(), cartVo.getTableId()); cartVo.getIsPack(), cartVo.getUuid(), cartVo.getType(), cartVo.getTableId());
} }
@PostMapping("/temporaryDishes")
public Result addTemporaryDishes(@Valid @RequestBody AddTemporaryDishesDTO temporaryDishesDTO) {
return Result.success(CodeEnum.SUCCESS, orderService.addTemporaryDishes(temporaryDishesDTO));
}
@GetMapping("/queryCart") @GetMapping("/queryCart")
public Result queryCart(@RequestHeader("token") String token, public Result queryCart(@RequestHeader("token") String token,
@RequestHeader("loginName") String loginName, @RequestHeader("loginName") String loginName,

View File

@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
public interface TbProductMapper { public interface TbProductMapper {
@ -46,13 +47,13 @@ public interface TbProductMapper {
List<ProConsSkuInfo> selectBySkuId(Integer skuId); List<ProConsSkuInfo> selectBySkuId(Integer skuId);
@Update("update tb_product set stock_number=stock_number+#{num} WHERE id=#{id}") @Update("update tb_product set stock_number=stock_number+#{num} WHERE id=#{id}")
int incrStock(String id, int num); int incrStock(String id, BigDecimal num);
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0") @Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
int decrStock(String id, int num); int decrStock(String id, BigDecimal num);
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}") @Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
int decrStockUnCheck(String id, int num); int decrStockUnCheck(String id, BigDecimal num);
@Select("select * from tb_product product where product.id=#{productId} and product.shop_id=#{shopId} and product.is_del=0") @Select("select * from tb_product product where product.id=#{productId} and product.shop_id=#{shopId} and product.is_del=0")
TbProduct selectByShopIdAndId(@Param("productId") Integer productId, @Param("shopId") Integer shopId); TbProduct selectByShopIdAndId(@Param("productId") Integer productId, @Param("shopId") Integer shopId);

View File

@ -19,8 +19,6 @@ public class OrderVo {
private Integer type; private Integer type;
private String sendType; private String sendType;
private String eatModel;
@Min(1) @Min(1)
private Integer seatNum; private Integer seatNum;
} }

View File

@ -1,10 +1,14 @@
package com.chaozhanggui.system.cashierservice.entity; package com.chaozhanggui.system.cashierservice.entity;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
@Data @Data
public class TbCashierCart implements Serializable { public class TbCashierCart implements Serializable {
@ -12,9 +16,9 @@ public class TbCashierCart implements Serializable {
private String masterId; private String masterId;
private String orderId; private Integer orderId;
private String refOrderId; private Integer refOrderId;
private BigDecimal totalAmount; private BigDecimal totalAmount;
@ -29,48 +33,62 @@ public class TbCashierCart implements Serializable {
private String name; private String name;
private BigDecimal salePrice; private BigDecimal salePrice;
private BigDecimal packFee;
private Integer number; private BigDecimal number;
private Integer totalNumber; private BigDecimal totalNumber;
private Integer refundNumber; private BigDecimal refundNumber;
private String categoryId; private String categoryId;
private String tradeDay;
private String status; private String status;
private Byte type; private Integer type;
private String merchantId; private String merchantId;
private String shopId; private String shopId;
private String isPack;
private String isGift;
private String skuName;
private String uuid;
private Long createdAt; private Long createdAt;
private Long pendingAt;
private Long updatedAt; private Long updatedAt;
private Integer userId; private Integer userId;
private String tableId; private String tableId;
private String useType;
private BigDecimal packFee;
private String tradeDay;
private String isPack;
private String isGift;
private Long pendingAt;
private String uuid;
private String skuName;
private Integer placeNum; private Integer placeNum;
private String note;
private String useType;
private String platformType; private String platformType;
private BigDecimal memberPrice; // 优惠券id
private Integer userCouponId;
private BigDecimal memberPrice = BigDecimal.ZERO;
private Integer isMember; private Integer isMember;
// 是否临时菜品
private Integer isTemporary;
private String unit;
private BigDecimal discountSaleAmount;
private String discountSaleNote;
private Boolean isPrint;
private String useCouponInfo;
@TableField(exist = false) public void copy(TbCashierCart source) {
private TbProductSpec tbProductSpec; BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}
@TableField(exist = false)
private String selectSpec="";
private static final long serialVersionUID = 1L;
/** /**
* 根据是否会员充值价格 * 根据是否会员充值价格
@ -81,12 +99,58 @@ public class TbCashierCart implements Serializable {
} }
if ("true".equals(isGift)) { if ("true".equals(isGift)) {
totalAmount = packFee; totalAmount = packFee;
}else { } else {
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) { if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
totalAmount = BigDecimal.valueOf(totalNumber).multiply(memberPrice).add(packFee); totalAmount = totalNumber.multiply(memberPrice).add(packFee);
}else { } else {
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee); totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee);
} }
} }
} }
/**
* 根据是否会员充值价格
*/
public void resetTotalAmount(BigDecimal discountRadio) {
if (discountRadio == null) {
discountRadio = BigDecimal.ONE;
}
if ("false".equals(isPack)) {
packFee = BigDecimal.ZERO;
}
if ("true".equals(isGift)) {
totalAmount = packFee;
} else {
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
totalAmount = totalNumber.multiply(memberPrice).add(packFee).multiply(discountRadio);
} else {
totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio);
}
}
}
/**
* 获取总价不包含打包费
*
*/
public BigDecimal getTotalAmountByNum(BigDecimal num, BigDecimal discountRadio) {
if (discountRadio == null) {
discountRadio = new BigDecimal("1");
}
if (num == null) {
num = totalNumber;
}
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
return num.multiply(memberPrice).multiply(discountRadio).add(packFee).setScale(2, RoundingMode.HALF_UP);
}else {
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
}
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
// return num.multiply(memberPrice);
// } else {
// return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice);
// }
}
} }

View File

@ -19,8 +19,8 @@ public class TbOrderDetail implements Serializable {
private Integer productSkuId; private Integer productSkuId;
private Integer num; private BigDecimal num;
private Integer returnNum; private BigDecimal returnNum;
private String productName; private String productName;
private String status; private String status;

View File

@ -15,12 +15,6 @@ public class TbProduct implements Serializable {
private Integer specId; private Integer specId;
private String sourcePath;
private Integer brandId;
private String merchantId;
private String shopId; private String shopId;
private String name; private String name;
@ -33,103 +27,34 @@ public class TbProduct implements Serializable {
private BigDecimal lowPrice; private BigDecimal lowPrice;
private BigDecimal lowMemberPrice;
private String unitId; private String unitId;
private String unitSnap;
private String coverImg; private String coverImg;
private String shareImg;
private String videoCoverImg;
private Integer sort; private Integer sort;
private Integer limitNumber;
private Integer productScore;
private Byte status; private Byte status;
private String failMsg; private String failMsg;
private Byte isRecommend;
private Byte isHot; private Byte isHot;
private Byte isNew;
private Byte isOnSale;
private Byte isShow;
private String typeEnum; private String typeEnum;
/**
* 是否共享库存
*/
private Byte isDistribute;
private Byte isDel; private Byte isDel;
private Byte isStock; private Byte isStock;
private Byte isPauseSale; private Byte isPauseSale;
private Byte isFreeFreight;
private Long freightId;
private String strategyType;
private Integer strategyId;
private Byte isVip;
private Byte isDelete;
private Long createdAt; private Long createdAt;
private Long updatedAt; private Long updatedAt;
private Double baseSalesNumber;
private Integer realSalesNumber; private Integer realSalesNumber;
private Integer salesNumber;
private Integer thumbCount;
private Integer storeCount;
private Integer furnishMeal;
private Integer furnishExpress;
private Integer furnishDraw;
private Integer furnishVir;
private Byte isCombo;
private Byte isShowCash;
private Byte isShowMall;
private Byte isNeedExamine;
private Byte showOnMallStatus;
private Long showOnMallTime;
private String showOnMallErrorMsg;
private Byte enableLabel;
private String taxConfigId;
private String specTableHeaders; private String specTableHeaders;
private Integer stockNumber; private Integer stockNumber;

View File

@ -0,0 +1,28 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
import javax.validation.constraints.*;
import java.math.BigDecimal;
@Data
public class AddTemporaryDishesDTO {
@NotEmpty
private String masterId;
@NotNull
private Integer shopId;
private String tableId;
@NotBlank(message = "菜品名不为空")
private String name;
@NotNull(message = "分类不为空")
private Integer categoryId;
@Min(value = 0, message = "价格最低为0")
private BigDecimal price;
@NotNull
@DecimalMin(value = "0.01")
private BigDecimal num;
@NotBlank(message = "单位不为空")
private String unit;
private String note;
private Integer vipUserId;
}

View File

@ -7,13 +7,24 @@ import lombok.Data;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
public class ShopEatTypeInfoDTO { public class ShopEatTypeInfoDTO {
// 是否外带
private boolean isTakeout; private boolean isTakeout;
// 是否快餐
private boolean isMunchies; private boolean isMunchies;
// 是否后付费
private boolean isDineInAfter; private boolean isDineInAfter;
// 是否先付费
private boolean isDineInBefore; private boolean isDineInBefore;
// 是否需要餐位费
private boolean needSeatFee; private boolean needSeatFee;
// 是否无桌台下单
private boolean isNoneTable;
// 是否增加masterId
private boolean isIncrMaterId;
private boolean isMemberPrice; private boolean isMemberPrice;
private TbShopInfo shopInfo; private TbShopInfo shopInfo;
private String useType; private String useType;
private Object shopId;
private String tableId;
private String sendType; private String sendType;
} }

View File

@ -2,9 +2,11 @@ package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data @Data
public class CartVo { public class CartVo {
@ -12,8 +14,9 @@ public class CartVo {
@NotNull @NotNull
private Integer shopId; private Integer shopId;
private Integer skuId; private Integer skuId;
@Min(1) @NotNull
private Integer number; @DecimalMin("0.01")
private BigDecimal number;
private String isPack; private String isPack;
private String isGift; private String isGift;
private String status; private String status;

View File

@ -19,6 +19,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -311,10 +312,10 @@ public class PrintMechineConsumer {
if (info != null) { if (info != null) {
isReturn = it.getNum() - Integer.parseInt(info) < 0; isReturn = it.getNum().intValue() - Integer.parseInt(info) < 0;
printerNum = it.getNum() - Integer.parseInt(info); printerNum = it.getNum().intValue() - Integer.parseInt(info);
} else { } else {
printerNum = it.getNum(); printerNum = it.getNum().intValue();
} }
log.info("已打印数量, {}, 未打印数量: {}", info, printerNum); log.info("已打印数量, {}, 未打印数量: {}", info, printerNum);
@ -331,7 +332,7 @@ public class PrintMechineConsumer {
redisTemplate.expire(printKey, 24, TimeUnit.HOURS); redisTemplate.expire(printKey, 24, TimeUnit.HOURS);
// 已打印不再打印 // 已打印不再打印
if (info != null && it.getNum() - Integer.parseInt(info) == 0) { if (info != null && it.getNum().intValue() - Integer.parseInt(info) == 0) {
return; return;
} }
@ -366,7 +367,8 @@ public class PrintMechineConsumer {
TbOrderDetail orderDetail = (TbOrderDetail) item; TbOrderDetail orderDetail = (TbOrderDetail) item;
String data = PrinterUtils.getPrintData("return", String data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(), StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null); // todo 修改为bigdecimal
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), orderDetail.getRemark(), null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
@ -432,9 +434,10 @@ public class PrintMechineConsumer {
printProductSet.forEach(item -> { printProductSet.forEach(item -> {
log.info("已删除订单,打印退款票据, {}", item); log.info("已删除订单,打印退款票据, {}", item);
TbOrderDetail orderDetail = (TbOrderDetail) item; TbOrderDetail orderDetail = (TbOrderDetail) item;
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("return", String data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(), StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null); DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), orderDetail.getRemark(), null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
@ -474,9 +477,10 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("", orderInfo.getMasterId(), String data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
it.getNum(), remark, null); it.getNum().intValue(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
} }
@ -502,8 +506,10 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ? String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ?
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark, null); orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum().intValue(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
} }
@ -524,7 +530,7 @@ public class PrintMechineConsumer {
if (info == null) { if (info == null) {
return false; return false;
} }
orderDetail.setNum(orderDetail.getNum() - Integer.parseInt(info)); orderDetail.setNum(orderDetail.getNum().subtract(new BigDecimal(info)));
return true; return true;
} }
@ -673,7 +679,7 @@ public class PrintMechineConsumer {
} }
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark); FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark);
} }
}); });
} }
@ -709,7 +715,7 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
for (int i = 0; i < it.getNumber(); i++) { for (int i = 0; i < it.getNumber().intValue(); i++) {
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark); FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
} }
} }

View File

@ -69,8 +69,10 @@ public class FeiPrinter extends PrinterHandler {
return; return;
} }
String remark = sku.getSpecSnap(); String remark = sku.getSpecSnap();
// todo 修改为bigdecimal
String[] resp = FeieyunPrintUtil.getPrintData(machine.getAddress(), orderInfo, String[] resp = FeieyunPrintUtil.getPrintData(machine.getAddress(), orderInfo,
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), remark); DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), remark);
shopPrintLogService.save(machine, "新订单", resp[0], resp[1]); shopPrintLogService.save(machine, "新订单", resp[0], resp[1]);
} }

View File

@ -47,7 +47,9 @@ public class LocalLabelPrinter extends PrinterHandler {
log.warn("打印菜品标签票失败 sku商品不存在: {}", orderDetail); log.warn("打印菜品标签票失败 sku商品不存在: {}", orderDetail);
return; return;
} }
for (int i = 0; i < orderDetail.getNum(); i++) { // todo 修改为bigdecimal
for (int i = 0; i < orderDetail.getNum().intValue(); i++) {
String[] resp = FeieyunPrintUtil.printLabelMsg(machine.getAddress(), orderInfo.getTableName(), orderDetail.getProductName(), String[] resp = FeieyunPrintUtil.printLabelMsg(machine.getAddress(), orderInfo.getTableName(), orderDetail.getProductName(),
1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), sku.getSalePrice().toPlainString(), sku.getSpecSnap()); 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), sku.getSalePrice().toPlainString(), sku.getSpecSnap());
shopPrintLogService.save(machine, "新订单", resp[0], resp[1]); shopPrintLogService.save(machine, "新订单", resp[0], resp[1]);

View File

@ -62,10 +62,11 @@ public class YxyPrinter extends PrinterHandler {
@Override @Override
protected void returnDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) { protected void returnDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("return", getPickupNum(orderInfo), String data = PrinterUtils.getPrintData("return", getPickupNum(orderInfo),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
Math.abs(orderDetail.getNum()), orderDetail.getRemark(), orderDetail.getNote()); orderDetail.getNum().abs().intValue(), orderDetail.getRemark(), orderDetail.getNote());
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}"; // String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data); String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
@ -74,9 +75,11 @@ public class YxyPrinter extends PrinterHandler {
@Override @Override
protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) { protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("", getPickupNum(orderInfo), String data = PrinterUtils.getPrintData("", getPickupNum(orderInfo),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
orderDetail.getNum(), orderDetail.getRemark(), orderDetail.getNote()); orderDetail.getNum().intValue(), orderDetail.getRemark(), orderDetail.getNote());
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}"; // String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data); String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);

View File

@ -189,8 +189,10 @@ public class CloudPrinterService {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ? String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ?
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark, null); orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum().intValue(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
} }
@ -223,9 +225,10 @@ public class CloudPrinterService {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
String data = PrinterUtils.getPrintData("", orderInfo.getOrderType().equals("miniapp") ? String data = PrinterUtils.getPrintData("", orderInfo.getOrderType().equals("miniapp") ?
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark, null); orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}"; String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data); PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
@ -526,8 +529,9 @@ public class CloudPrinterService {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark); FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark);
} }
}); });
} }
@ -558,8 +562,9 @@ public class CloudPrinterService {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) { if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap(); remark = tbProductSkuWithBLOBs.getSpecSnap();
} }
// todo 修改为bigdecimal
for (int i = 0; i < it.getNumber(); i++) { for (int i = 0; i < it.getNumber().intValue(); i++) {
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark); FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
} }

View File

@ -84,7 +84,7 @@ public class ConsService {
flow.setConName(tbConsInfo.getConName()); flow.setConName(tbConsInfo.getConName());
flow.setProSkuId(proskuCon.getProductSkuId()); flow.setProSkuId(proskuCon.getProductSkuId());
if("create".equals(type)){ if("create".equals(type)){
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum())); amount=proskuCon.getSurplusStock().multiply(orderDetail.getNum());
flow.setAmount(amount); flow.setAmount(amount);
@ -96,7 +96,7 @@ public class ConsService {
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis())); tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
}else if("delete".equals(type)){ }else if("delete".equals(type)){
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum())).negate(); amount=proskuCon.getSurplusStock().multiply(orderDetail.getNum()).negate();
flow.setAmount(amount.abs()); flow.setAmount(amount.abs());
flow.setBizCode("cancelCart"); flow.setBizCode("cancelCart");

View File

@ -181,14 +181,16 @@ public class DutyService {
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail(); ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
shopUserDutyDetail.setDutyId(shopUserDuty.getId()); shopUserDutyDetail.setDutyId(shopUserDuty.getId());
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount()); shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
shopUserDutyDetail.setNum(orderDetail.getNum()); // todo 修改为bigdecimal
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId()); shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName()); shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
shopUserDutyDetail.setProductId(orderDetail.getProductId()); shopUserDutyDetail.setProductId(orderDetail.getProductId());
shopUserDutyDetail.setProductName(orderDetail.getProductName()); shopUserDutyDetail.setProductName(orderDetail.getProductName());
detaiList.add(shopUserDutyDetail); detaiList.add(shopUserDutyDetail);
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum()); // productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum()); // todo 修改为bigdecimal
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum().intValue());
} }
if (detaiList.size() > 0) { if (detaiList.size() > 0) {
shopUserDutyDetailMapper.batchInsert(detaiList); shopUserDutyDetailMapper.batchInsert(detaiList);
@ -214,14 +216,15 @@ public class DutyService {
for (TbOrderDetail orderDetail : list) { for (TbOrderDetail orderDetail : list) {
if (map.containsKey(orderDetail.getProductSkuId())) { if (map.containsKey(orderDetail.getProductSkuId())) {
ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId()); ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId());
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum()); // todo 修改为bigdecimal
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum().intValue());
shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount()))); shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount())));
shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail); shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail);
} else { } else {
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail(); ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
shopUserDutyDetail.setDutyId(shopUserDuty.getId()); shopUserDutyDetail.setDutyId(shopUserDuty.getId());
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount()); shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
shopUserDutyDetail.setNum(orderDetail.getNum()); shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId()); shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName()); shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
shopUserDutyDetail.setProductId(orderDetail.getProductId()); shopUserDutyDetail.setProductId(orderDetail.getProductId());
@ -230,7 +233,8 @@ public class DutyService {
} }
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum()); // productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum()); // todo 修改为bigdecimal
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum().intValue());
} }
if (detaiList.size() > 0) { if (detaiList.size() > 0) {
shopUserDutyDetailMapper.batchInsert(detaiList); shopUserDutyDetailMapper.batchInsert(detaiList);
@ -295,7 +299,9 @@ public class DutyService {
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail(); ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
shopUserDutyDetail.setDutyId(shopUserDuty.getId()); shopUserDutyDetail.setDutyId(shopUserDuty.getId());
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount()); shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
shopUserDutyDetail.setNum(orderDetail.getNum()); // todo 修改为bigdecimal
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId()); shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName()); shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
shopUserDutyDetail.setProductId(orderDetail.getProductId()); shopUserDutyDetail.setProductId(orderDetail.getProductId());
@ -326,14 +332,16 @@ public class DutyService {
for (TbOrderDetail orderDetail : list) { for (TbOrderDetail orderDetail : list) {
if (map.containsKey(orderDetail.getProductSkuId())) { if (map.containsKey(orderDetail.getProductSkuId())) {
ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId()); ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId());
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum()); // todo 修改为bigdecimal
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum().intValue());
shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount()))); shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount())));
shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail); shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail);
} else { } else {
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail(); ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
shopUserDutyDetail.setDutyId(shopUserDuty.getId()); shopUserDutyDetail.setDutyId(shopUserDuty.getId());
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount()); shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
shopUserDutyDetail.setNum(orderDetail.getNum()); // todo 修改为bigdecimal
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId()); shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName()); shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
shopUserDutyDetail.setProductId(orderDetail.getProductId()); shopUserDutyDetail.setProductId(orderDetail.getProductId());

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant; import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart; import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail; import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import java.util.List; import java.util.List;
@ -36,5 +37,21 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
*/ */
List<TbCashierCart> selectCart(String useType, String masterId, Integer orderId, Integer shopId, TableConstant.OrderInfo.Status... statusList); List<TbCashierCart> selectCart(String useType, String masterId, Integer orderId, Integer shopId, TableConstant.OrderInfo.Status... statusList);
/**
* 根据就餐信息查询购物车信息
* @param shopEatTypeInfoDTO 就餐信息
* @return 购物车信息
*/
TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp);
/**
* 根据店铺id和购物车id查询信息
* @param shopId 店铺id
* @param cartId 购物车id
* @param statuses 状态
*/
TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses);
} }

View File

@ -36,6 +36,6 @@ public interface MpOrderDetailService extends IService<TbOrderDetail> {
* 根据订单id删除详情 * 根据订单id删除详情
* @param orderId 订单id * @param orderId 订单id
*/ */
boolean removeByOrderId(String orderId); boolean removeByOrderId(Integer orderId);
} }

View File

@ -16,10 +16,7 @@ import com.chaozhanggui.system.cashierservice.bean.*;
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant; import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO; import com.chaozhanggui.system.cashierservice.entity.dto.*;
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnCartDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.UpdateVipDTO;
import com.chaozhanggui.system.cashierservice.entity.po.CartPo; import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
import com.chaozhanggui.system.cashierservice.entity.po.OrderPo; import com.chaozhanggui.system.cashierservice.entity.po.OrderPo;
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo; import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
@ -145,7 +142,39 @@ public class OrderService {
this.mpCashierCartService = mpCashierCartService; this.mpCashierCartService = mpCashierCartService;
} }
private ShopEatTypeInfoDTO checkEatModel(Integer shopId, String eatModel) { /**
* 校验就餐模式是否存在并返回就餐类型信息
*
* @param tableId 台桌id
* @param shopId 店铺id
* @return 就餐类型信息
*/
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) {
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
return getShopEatTypeInfoDTO(shopId, eatModel, tableId);
}
/**
* 校验就餐模式是否存在并返回就餐类型信息
*
* @param tableId 台桌id
* @param shopId 店铺id
* @return 就餐类型信息
*/
public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) {
String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
return getShopEatTypeInfoDTO(shopId, eatModel, tableId);
}
/**
* 通过店铺id和就餐模式获取当前店铺的就餐类型信息
*
* @param shopId 店铺id
* @param eatModel 就餐模式
* @param tableId 台桌id
* @return just餐类型信息
*/
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) {
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>() TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
.eq(TbShopInfo::getId, shopId) .eq(TbShopInfo::getId, shopId)
.eq(TbShopInfo::getStatus, 1)); .eq(TbShopInfo::getStatus, 1));
@ -153,38 +182,42 @@ public class OrderService {
throw new MsgException("店铺信息不存在"); throw new MsgException("店铺信息不存在");
} }
if (!"take-out".equals(eatModel) && !shopInfo.getEatModel().contains(eatModel)) { if (!shopInfo.getEatModel().contains(eatModel)) {
throw new MsgException("当前店铺未开启此就餐模式"); throw new MsgException("当前店铺未开启此就餐模式");
} }
boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel);
// 是否是快餐版/先付费 // 是否是快餐版/先付费
boolean isMunchies = StrUtil.isNotBlank(shopInfo.getRegisterType()) && boolean isMunchies = StrUtil.isNotBlank(shopInfo.getRegisterType()) &&
ShopInfoRegisterlEnum.MUNCHIES.getValue().equals(shopInfo.getRegisterType()); ShopInfoRegisterlEnum.MUNCHIES.getValue().equals(shopInfo.getRegisterType());
boolean isDineInAfter = !isMunchies && !isTakeout; boolean hasTable = StrUtil.isNotBlank(tableId);
boolean isDineInBefore = isMunchies && !isTakeout; // 是否先付费
boolean needSeatFee = !isTakeout && (shopInfo.getIsTableFee() == null || shopInfo.getIsTableFee() == 0); boolean isDineInAfter = hasTable && !isMunchies && !isTakeout;
// 是否后付费
boolean isDineInBefore = hasTable && isMunchies && !isTakeout;
// 是否无台桌
boolean isNoneTable = !hasTable && !isTakeout;
boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1; boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1;
return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, needSeatFee, isMemberPrice, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() : boolean needSeatFee = !isTakeout && (shopInfo.getIsTableFee() == null || shopInfo.getIsTableFee() == 0);
isMunchies ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : OrderUseTypeEnum.DINE_IN_AFTER.getValue(), isTakeout ? OrderSendTypeEnums.TAKE_SELF.getValue() : OrderSendTypeEnums.TABLE.getValue()); boolean isIncrMasterId = isTakeout || isNoneTable;
return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, needSeatFee, isNoneTable, isIncrMasterId, isMemberPrice, shopInfo, isTakeout ? TableConstant.OrderInfo.UseType.TAKEOUT.getValue() :
isDineInBefore ? TableConstant.OrderInfo.UseType.DINE_IN_BEFORE.getValue() : isNoneTable ? TableConstant.OrderInfo.UseType.NONE_TABLE.getValue() : TableConstant.OrderInfo.UseType.DINE_IN_AFTER.getValue(),
shopId, tableId, isTakeout ? OrderSendTypeEnums.TAKE_SELF.getValue() : OrderSendTypeEnums.TABLE.getValue());
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result createCart(String masterId, Integer productId, Integer shopId, Integer skuId, Integer number, public Result createCart(String masterId, Integer productId, Integer shopId, Integer skuId, BigDecimal number,
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type, String tableId) { String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type, String tableId) {
if (productId == null || skuId == null || number == null) { if (number == null) {
return Result.fail(CodeEnum.PARAM); return Result.fail(CodeEnum.PARAM);
} }
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, tableId);
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, eatModel);
// 台桌点单 // 台桌点单
boolean isSeatCart = TableConstant.CashierCart.ID.equals(productId.toString()); boolean isSeatCart = productId != null && TableConstant.CashierCart.ID.equals(productId.toString());
if ((StrUtil.isNotBlank(tableId))) { if ((StrUtil.isNotBlank(tableId))) {
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>() TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, tableId) .eq(TbShopTable::getQrcode, tableId)
@ -193,17 +226,19 @@ public class OrderService {
if (shopTable == null) { if (shopTable == null) {
return Result.fail("台桌不处于开台或空闲状态"); return Result.fail("台桌不处于开台或空闲状态");
} }
if (shopEatTypeInfoDTO.isNeedSeatFee() && number > shopTable.getMaxCapacity() && isSeatCart) { if (shopEatTypeInfoDTO.isNeedSeatFee() && number.intValue() > shopTable.getMaxCapacity() && isSeatCart) {
return Result.fail("当前台桌最大人数未: " + shopTable.getMaxCapacity()); return Result.fail("当前台桌最大人数未: " + shopTable.getMaxCapacity());
} }
} }
LambdaQueryWrapper<TbCashierCart> cartQuery = new LambdaQueryWrapper<TbCashierCart>() LambdaQueryWrapper<TbCashierCart> cartQuery = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, shopId) .eq(TbCashierCart::getShopId, shopId)
.eq(TbCashierCart::getSkuId, skuId)
.eq(TbCashierCart::getProductId, productId)
.in(TbCashierCart::getStatus, "create") .in(TbCashierCart::getStatus, "create")
.eq(TbCashierCart::getId, cartId); .eq(TbCashierCart::getId, cartId);
if (productId != null) {
cartQuery.eq(TbCashierCart::getProductId, productId)
.eq(TbCashierCart::getSkuId, skuId);
}
TbCashierCart cart = mpCashierCartMapper.selectOne(cartQuery); TbCashierCart cart = mpCashierCartMapper.selectOne(cartQuery);
@ -213,7 +248,7 @@ public class OrderService {
} }
TbProduct product = null; TbProduct product = null;
TbProductSkuWithBLOBs skuWithBLOBs = null; TbProductSkuWithBLOBs skuWithBLOBs = null;
if (!isSeatCart) { if (!isSeatCart && productId != null) {
product = mpProductMapper.selectOne(new LambdaQueryWrapper<TbProduct>() product = mpProductMapper.selectOne(new LambdaQueryWrapper<TbProduct>()
.eq(TbProduct::getId, productId) .eq(TbProduct::getId, productId)
.eq(TbProduct::getStatus, 1)); .eq(TbProduct::getStatus, 1));
@ -235,11 +270,11 @@ public class OrderService {
// 首次加入购物车并且拥有起售数设置为起售数 // 首次加入购物车并且拥有起售数设置为起售数
if (cart == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) { if (cart == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
number = skuWithBLOBs.getSuit(); number = BigDecimal.valueOf(skuWithBLOBs.getSuit());
// 低于起售删除商品 // 低于起售删除商品
} else if (cart != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()) { } else if (cart != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number.compareTo(BigDecimal.valueOf(skuWithBLOBs.getSuit())) < 0) {
delCart(masterId, cartId); delCart(masterId, cartId);
if (StrUtil.isNotBlank(cart.getOrderId()) && StrUtil.isNotBlank(cart.getTableId())) { if (cart.getOrderId() != null && StrUtil.isNotBlank(cart.getTableId())) {
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>() LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending") .notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending")
.eq(TbCashierCart::getShopId, cart.getShopId()); .eq(TbCashierCart::getShopId, cart.getShopId());
@ -270,7 +305,8 @@ public class OrderService {
// 校验库存 // 校验库存
if ("1".equals(product.getIsStock().toString())) { if ("1".equals(product.getIsStock().toString())) {
if (product.getStockNumber() - number < 0) { // todo 数量为浮点数库存目前整数, 待同一
if (product.getStockNumber() - number.intValue() < 0) {
return Result.fail(CodeEnum.STOCKERROR); return Result.fail(CodeEnum.STOCKERROR);
} }
} }
@ -294,47 +330,15 @@ public class OrderService {
if (Objects.nonNull(cart)) { if (Objects.nonNull(cart)) {
//查询现有规格商品 //查询现有规格商品
if ("edit".equals(type) && !cart.getSkuId().equals(skuId.toString())) { cart.setNumber(number);
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId.toString(), shopId.toString(), skuId.toString(), DateUtils.getDay(), uuid, tableId); cart.setIsGift(isGift);
if (Objects.nonNull(cashierCart)) { cart.setIsPack(isPack);
cashierCart.setNumber(cashierCart.getNumber() + number); cart.setTotalNumber(number);
cashierCart.setTotalNumber(cashierCart.getNumber() + number); cart.resetTotalAmount();
cashierCart.setUpdatedAt(System.currentTimeMillis()); cart.setUuid(uuid);
cashierCartMapper.updateByPrimaryKey(cashierCart); cashierCartMapper.updateByPrimaryKeySelective(cart);
cashierCartMapper.deleteByPrimaryKey(cart.getId());
cart = cashierCart;
}
} else {
cart.setSkuId(skuId.toString());
cart.setNumber(number);
cart.setIsGift(isGift);
cart.setIsPack(isPack);
if (isPack.equals("false")) {
cart.setPackFee(BigDecimal.ZERO);
} else {
if (!isSeatCart) {
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
}else{
cart.setPackFee(BigDecimal.ZERO);
}
}
if (isGift.equals("false")) {
if (!isSeatCart) {
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
}else {
cart.setTotalAmount(new BigDecimal(number).multiply(cart.getSalePrice()).add(cart.getPackFee()));
}
} else {
cart.setTotalAmount(BigDecimal.ZERO);
}
cart.setTotalNumber(number);
cart.setUuid(uuid);
cashierCartMapper.updateByPrimaryKeySelective(cart);
}
} else { } else {
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create"); List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
TbCashierCart cashierCart = getCashierInfo(shopId, skuId, productId, tableId, masterId, shopEatTypeInfoDTO); TbCashierCart cashierCart = getCashierInfo(shopId, skuId, productId, tableId, masterId, shopEatTypeInfoDTO);
// 不存在新增 // 不存在新增
if (Objects.isNull(cashierCart)) { if (Objects.isNull(cashierCart)) {
@ -350,7 +354,7 @@ public class OrderService {
cashierCart.setMasterId(masterId); cashierCart.setMasterId(masterId);
cashierCart.setUuid(uuid); cashierCart.setUuid(uuid);
cashierCart.setMerchantId(userId); cashierCart.setMerchantId(userId);
cashierCart.setProductId(productId.toString()); cashierCart.setProductId(productId == null ? null : productId.toString());
if (skuWithBLOBs != null) { if (skuWithBLOBs != null) {
cashierCart.setSalePrice(skuWithBLOBs.getSalePrice()); cashierCart.setSalePrice(skuWithBLOBs.getSalePrice());
cashierCart.setSkuId(skuWithBLOBs.getId().toString()); cashierCart.setSkuId(skuWithBLOBs.getId().toString());
@ -365,9 +369,9 @@ public class OrderService {
cashierCart.setIsGift(isGift); cashierCart.setIsGift(isGift);
if (isGift.equals("false")) { if (isGift.equals("false")) {
if (isSeatCart) { if (isSeatCart) {
cashierCart.setTotalAmount(new BigDecimal(number).multiply(cashierCart.getSalePrice())); cashierCart.setTotalAmount(number.multiply(cashierCart.getSalePrice()));
}else { } else {
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice())); cashierCart.setTotalAmount(number.multiply(skuWithBLOBs.getSalePrice()));
} }
} else { } else {
cashierCart.setTotalAmount(BigDecimal.ZERO); cashierCart.setTotalAmount(BigDecimal.ZERO);
@ -376,7 +380,7 @@ public class OrderService {
cashierCart.setPackFee(BigDecimal.ZERO); cashierCart.setPackFee(BigDecimal.ZERO);
} else { } else {
if (!isSeatCart) { if (!isSeatCart) {
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee())); cashierCart.setPackFee(number.multiply(product.getPackFee()));
} }
cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee())); cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee()));
@ -391,18 +395,12 @@ public class OrderService {
mpCashierCartMapper.insert(cashierCart); mpCashierCartMapper.insert(cashierCart);
} else { } else {
if (type.equals("add")) { if (type.equals("add")) {
cashierCart.setNumber(cashierCart.getNumber() + number); cashierCart.setNumber(cashierCart.getNumber().add(number));
} else { } else {
cashierCart.setNumber(number); cashierCart.setNumber(number);
} }
if (isPack.equals("false")) {
cashierCart.setPackFee(BigDecimal.ZERO); cashierCart.resetTotalAmount();
} else {
if (!isSeatCart) {
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
}
}
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getNumber()).multiply(skuWithBLOBs.getSalePrice()).add(cashierCart.getPackFee()));
mpCashierCartMapper.updateById(cashierCart); mpCashierCartMapper.updateById(cashierCart);
} }
@ -500,8 +498,7 @@ public class OrderService {
return Result.fail(CodeEnum.SHOPINFONOEXIST); return Result.fail(CodeEnum.SHOPINFONOEXIST);
} }
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), tableId);
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), eatModel);
String day = DateUtils.getDay(); String day = DateUtils.getDay();
String finalMasterId1 = masterId; String finalMasterId1 = masterId;
@ -522,7 +519,7 @@ public class OrderService {
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper); List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper);
AtomicReference<TbCashierCart> mealCashierCart = new AtomicReference<>(); AtomicReference<TbCashierCart> mealCashierCart = new AtomicReference<>();
ArrayList<TbCashierCart> returnCashierCarts = new ArrayList<>(); ArrayList<TbCashierCart> returnCashierCarts = new ArrayList<>();
String orderId = null; Integer orderId = null;
for (TbCashierCart cart : list) { for (TbCashierCart cart : list) {
if (cart.getOrderId() != null) { if (cart.getOrderId() != null) {
orderId = cart.getOrderId(); orderId = cart.getOrderId();
@ -531,7 +528,7 @@ public class OrderService {
returnCashierCarts.add(cart); returnCashierCarts.add(cart);
} }
cart.setPlaceNum(cart.getPlaceNum() == null ? 0 : cart.getPlaceNum()); cart.setPlaceNum(cart.getPlaceNum() == null ? 0 : cart.getPlaceNum());
if (cart.getProductId().equals("-999")) { if (cart.getProductId() != null && cart.getProductId().equals("-999")) {
mealCashierCart.set(cart); mealCashierCart.set(cart);
} }
} }
@ -543,18 +540,18 @@ public class OrderService {
// mpCashierCartService.updateStateByIds(Integer.valueOf(shopId), cartIds, TableConstant.Status.CLOSED); // mpCashierCartService.updateStateByIds(Integer.valueOf(shopId), cartIds, TableConstant.Status.CLOSED);
// mpOrderDetailService.updateStateByCartIds(Integer.valueOf(shopId), cartIds, TableConstant.Status.CLOSED); // mpOrderDetailService.updateStateByCartIds(Integer.valueOf(shopId), cartIds, TableConstant.Status.CLOSED);
mpOrderDetailService.removeByCartIds(cartIds); mpOrderDetailService.removeByCartIds(cartIds);
if (StrUtil.isNotBlank(orderId)) { if (orderId != null) {
mpOrderInfoService.removeById(orderId); mpOrderInfoService.removeById(orderId);
// mpOrderInfoService.updateStateById(Integer.valueOf(shopId), Integer.valueOf(orderId), TableConstant.Status.CANCELLED); // mpOrderInfoService.updateStateById(Integer.valueOf(shopId), Integer.valueOf(orderId), TableConstant.Status.CANCELLED);
} }
String finalMasterId = masterId; String finalMasterId = masterId;
return Result.success(CodeEnum.SUCCESS, new HashMap<String, Object>(){{ return Result.success(CodeEnum.SUCCESS, new HashMap<String, Object>() {{
put("list", new ArrayList<>()); put("list", new ArrayList<>());
put("masterId", finalMasterId); put("masterId", finalMasterId);
put("num", 0); put("num", 0);
put("seatFee", null); put("seatFee", null);
put("amount", new HashMap<String, Object>(){{ put("amount", new HashMap<String, Object>() {{
put("packAmount", 0); put("packAmount", 0);
put("productNum", 0); put("productNum", 0);
put("productSum", 0); put("productSum", 0);
@ -586,7 +583,8 @@ public class OrderService {
HashMap<String, Object> productNumMap = new HashMap<>(); HashMap<String, Object> productNumMap = new HashMap<>();
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
productNumMap.putIfAbsent(cashierCart.getProductId() + cashierCart.getSkuId(), 1); productNumMap.putIfAbsent(cashierCart.getProductId() + cashierCart.getSkuId(), 1);
productSum += cashierCart.getNumber(); // todo 数量为浮点数
productSum += cashierCart.getNumber().intValue();
if (StrUtil.isNotBlank(cashierCart.getMasterId())) { if (StrUtil.isNotBlank(cashierCart.getMasterId())) {
masterId = cashierCart.getMasterId(); masterId = cashierCart.getMasterId();
} }
@ -597,18 +595,23 @@ public class OrderService {
if (cashierCart.getIsPack().equals("true") && !isReturn) { if (cashierCart.getIsPack().equals("true") && !isReturn) {
packAmount = packAmount.add(cashierCart.getPackFee()); packAmount = packAmount.add(cashierCart.getPackFee());
} }
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
if (Objects.nonNull(skuWithBLOBs)) { if (cashierCart.getIsTemporary() == null || cashierCart.getIsTemporary() == 0) {
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap()); TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
} if (Objects.nonNull(skuWithBLOBs)) {
TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
if (Objects.nonNull(tbProduct)) { }
cashierCart.setSelectSpec(tbProduct.getSelectSpec());
if (tbProduct.getSpecId() != null) { TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(tbProduct.getSpecId()); if (Objects.nonNull(tbProduct)) {
cashierCart.setTbProductSpec(tbProductSpec); // cashierCart.setSelectSpec(tbProduct.getSelectSpec());
if (tbProduct.getSpecId() != null) {
TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(tbProduct.getSpecId());
// cashierCart.setTbProductSpec(tbProductSpec);
}
} }
} }
} }
map.put("masterId", masterId); map.put("masterId", masterId);
@ -631,8 +634,7 @@ public class OrderService {
return Result.fail(CARTEXIST); return Result.fail(CARTEXIST);
} }
String eatModel = StrUtil.isBlank(cashierCart.getTableId()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(cashierCart.getShopId()), cashierCart.getTableId());
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(cashierCart.getShopId()), eatModel);
// 校验是否是代客下单往期订单 // 校验是否是代客下单往期订单
if (shopEatTypeInfoDTO.isDineInAfter() && cashierCart.getPlaceNum() != null) { if (shopEatTypeInfoDTO.isDineInAfter() && cashierCart.getPlaceNum() != null) {
@ -643,24 +645,24 @@ public class OrderService {
return Result.success(CodeEnum.SUCCESS, returnCart(dto)); return Result.success(CodeEnum.SUCCESS, returnCart(dto));
} }
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); if (cashierCart.getIsTemporary() == null || cashierCart.getIsTemporary() == 0) {
if (ObjectUtil.isEmpty(product)) { TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
return Result.fail(CodeEnum.PRODUCTINFOERROR); if (ObjectUtil.isEmpty(product)) {
return Result.fail(CodeEnum.PRODUCTINFOERROR);
}
// 数量减少, 返还库存
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
if (message != null) {
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), new BigDecimal(message));
}
} }
// 数量减少, 返还库存
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
if (message != null) {
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
}
List<String> skuIds = new ArrayList<>();
skuIds.add(cashierCart.getSkuId());
cashierCartMapper.deleteByPrimaryKey(cartId); cashierCartMapper.deleteByPrimaryKey(cartId);
if (StrUtil.isNotBlank(cashierCart.getOrderId()) && StrUtil.isNotBlank(cashierCart.getTableId())) { if (cashierCart.getOrderId() != null && StrUtil.isNotBlank(cashierCart.getTableId())) {
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>() LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending") .notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending")
.eq(TbCashierCart::getShopId, cashierCart.getShopId()); .eq(TbCashierCart::getShopId, cashierCart.getShopId());
@ -684,8 +686,8 @@ public class OrderService {
if (list.isEmpty()) { if (list.isEmpty()) {
ThreadUtil.execute(() -> { ThreadUtil.execute(() -> {
log.info("购物车数量改变,开始校验订单是否为空"); log.info("购物车数量改变,开始校验订单是否为空");
printMechineConsumer.printReturnTicket(Integer.valueOf(cashierCart.getOrderId()), null); printMechineConsumer.printReturnTicket(cashierCart.getOrderId(), null);
tbOrderInfoMapper.deleteByPrimaryKey(Integer.valueOf(cashierCart.getOrderId())); tbOrderInfoMapper.deleteByPrimaryKey(cashierCart.getOrderId());
}); });
} }
} }
@ -752,11 +754,9 @@ public class OrderService {
throw new MsgException("店铺信息不存在"); throw new MsgException("店铺信息不存在");
} }
ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId());
orderVo.setEatModel(StrUtil.isBlank(orderVo.getTableId()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue()); if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(eatTypeInfoDTO.getUseType()) && StrUtil.isBlank(eatTypeInfoDTO.getUseType())) {
ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getEatModel());
if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(orderVo.getEatModel()) && StrUtil.isBlank(orderVo.getEatModel())) {
throw new MsgException("店内就餐必须选择桌码"); throw new MsgException("店内就餐必须选择桌码");
} }
@ -827,12 +827,12 @@ public class OrderService {
Integer orderId = null; Integer orderId = null;
int cartCount = 0; int cartCount = 0;
for (TbCashierCart cart : list) { for (TbCashierCart cart : list) {
if (StrUtil.isNotBlank(cart.getOrderId())) { if (cart.getOrderId() != null) {
orderId = Integer.valueOf(cart.getOrderId()); orderId = cart.getOrderId();
} }
cashierIds.add(cart.getId()); cashierIds.add(cart.getId());
if ("-999".equals(cart.getProductId())) { if ("-999".equals(cart.getProductId())) {
mealNum = cart.getNumber(); mealNum = cart.getNumber().intValue();
} }
if (TableConstant.OrderInfo.Status.CREATE.equalsVals(cart.getStatus()) && !TableConstant.CashierCart.ID.equals(cart.getProductId())) { if (TableConstant.OrderInfo.Status.CREATE.equalsVals(cart.getStatus()) && !TableConstant.CashierCart.ID.equals(cart.getProductId())) {
@ -874,24 +874,24 @@ public class OrderService {
} }
TbOrderDetail orderDetail = null; TbOrderDetail orderDetail = null;
if (StrUtil.isNotBlank(cashierCart.getOrderId())) { if (cashierCart.getOrderId() != null) {
orderDetail = oldOrderDetailMap.get(cashierCart.getOrderId() + cashierCart.getId()); orderDetail = oldOrderDetailMap.get(cashierCart.getOrderId().toString() + cashierCart.getId());
} }
if (orderDetail == null) { if (orderDetail == null) {
orderDetail = new TbOrderDetail(); orderDetail = new TbOrderDetail();
// 已经加入修改了库存数量返还或减少库存 // 已经加入修改了库存数量返还或减少库存
addOrderDetailList.add(orderDetail); addOrderDetailList.add(orderDetail);
if (!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) { if (!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) {
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber()); productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber());
} }
} else { } else {
if (!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) { if (!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) {
int subVal = cashierCart.getNumber() - orderDetail.getNum(); BigDecimal subVal = cashierCart.getNumber().subtract(orderDetail.getNum());
// 减少了数量 // 减少了数量
if (subVal < 0) { if (subVal.compareTo(BigDecimal.ZERO) < 0) {
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Math.abs(subVal)); productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), subVal.abs());
} else if (subVal > 0) { } else if (subVal.compareTo(BigDecimal.ZERO) > 0) {
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), subVal); productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), subVal);
} }
} }
@ -900,22 +900,26 @@ public class OrderService {
if (orderDetail.getPlaceNum() == null) { if (orderDetail.getPlaceNum() == null) {
orderDetail.setPlaceNum(currentPlaceNum); orderDetail.setPlaceNum(currentPlaceNum);
} }
TbProductSkuWithBLOBs tbProduct = null;
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); TbProductWithBLOBs product = null;
if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) { if (cashierCart.getIsTemporary() == 0) {
if (Objects.nonNull(product.getPackFee())) { product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
packAMount = packAMount.add(product.getPackFee()); if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) {
orderDetail.setPackAmount(product.getPackFee()); if (Objects.nonNull(product.getPackFee())) {
packAMount = packAMount.add(product.getPackFee());
orderDetail.setPackAmount(product.getPackFee());
}
} }
tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
if (Objects.nonNull(tbProduct)) {
saleAmount = saleAmount.add(tbProduct.getSalePrice());
}
orderDetail.setProductSkuName(tbProduct == null ? null : tbProduct.getSpecSnap());
} }
TbProductSkuWithBLOBs tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
totalAmount = totalAmount.add(cashierCart.getTotalAmount()); totalAmount = totalAmount.add(cashierCart.getTotalAmount());
feeAmount = cashierCart.getPackFee(); feeAmount = cashierCart.getPackFee();
if (Objects.nonNull(tbProduct)) {
saleAmount = saleAmount.add(tbProduct.getSalePrice());
}
if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) { if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) {
saleAmount = saleAmount.add(shopInfo.getTableFee()); saleAmount = saleAmount.add(shopInfo.getTableFee());
@ -926,17 +930,18 @@ public class OrderService {
orderDetail.setNum(cashierCart.getNumber()); orderDetail.setNum(cashierCart.getNumber());
orderDetail.setPrice(cashierCart.getSalePrice()); orderDetail.setPrice(cashierCart.getSalePrice());
orderDetail.setPriceAmount(cashierCart.getTotalAmount()); orderDetail.setPriceAmount(cashierCart.getTotalAmount());
orderDetail.setProductId(Integer.valueOf(cashierCart.getProductId())); if (cashierCart.getIsTemporary() == 0) {
orderDetail.setProductSkuId(Integer.valueOf(cashierCart.getSkuId())); orderDetail.setProductId(Integer.valueOf(cashierCart.getProductId()));
orderDetail.setProductSkuName(tbProduct == null ? null : tbProduct.getSpecSnap()); orderDetail.setProductSkuId(Integer.valueOf(cashierCart.getSkuId()));
}
orderDetail.setProductName(cashierCart.getName()); orderDetail.setProductName(cashierCart.getName());
orderDetail.setShopId(orderVo.getShopId()); orderDetail.setShopId(orderVo.getShopId());
orderDetail.setStatus("unpaid"); orderDetail.setStatus("unpaid");
orderDetail.setProductImg(cashierCart.getCoverImg()); orderDetail.setProductImg(cashierCart.getCoverImg());
orderDetail.setUseType(cashierCart.getUseType()); orderDetail.setUseType(cashierCart.getUseType());
orderDetail.setCartId(cashierCart.getId()); orderDetail.setCartId(cashierCart.getId());
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) { if (cashierCart.getOrderId() != null) {
orderId = Integer.valueOf(cashierCart.getOrderId()); orderId = cashierCart.getOrderId();
} }
orderDetail.setIsMember(cashierCart.getIsMember()); orderDetail.setIsMember(cashierCart.getIsMember());
@ -944,8 +949,11 @@ public class OrderService {
// 库存预警校验 // 库存预警校验
if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) { if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && cashierCart.getIsTemporary() == 0) {
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(tbProduct, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber())); // todo 修改为bigdecimal
TbProductSkuWithBLOBs finalTbProduct = tbProduct;
TbProductWithBLOBs finalProduct = product;
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(finalTbProduct, finalProduct, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber().intValue()));
} }
} }
@ -1271,10 +1279,10 @@ public class OrderService {
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId())); TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
if ("true".equals(cartVo.getStatus())) { if ("true".equals(cartVo.getStatus())) {
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(product.getPackFee()))); cashierCart.setTotalAmount(cashierCart.getTotalNumber().multiply(cashierCart.getSalePrice().add(product.getPackFee())));
cashierCart.setPackFee(new BigDecimal(cashierCart.getTotalNumber()).multiply(product.getPackFee())); cashierCart.setPackFee(cashierCart.getTotalNumber().multiply(product.getPackFee()));
} else { } else {
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice())); cashierCart.setTotalAmount(cashierCart.getTotalNumber().multiply(cashierCart.getSalePrice()));
cashierCart.setPackFee(BigDecimal.ZERO); cashierCart.setPackFee(BigDecimal.ZERO);
} }
cashierCart.setIsPack(cartVo.getStatus()); cashierCart.setIsPack(cartVo.getStatus());
@ -1287,8 +1295,7 @@ public class OrderService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result clearCart(CartVo cartVo) { public Result clearCart(CartVo cartVo) {
String day = DateUtils.getDay(); String day = DateUtils.getDay();
String eatModel = StrUtil.isBlank(cartVo.getTableId()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(cartVo.getShopId(), cartVo.getTableId());
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(cartVo.getShopId(), eatModel);
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>() LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, cartVo.getShopId()) .eq(TbCashierCart::getShopId, cartVo.getShopId())
@ -1321,8 +1328,8 @@ public class OrderService {
ArrayList<Integer> ids = new ArrayList<>(); ArrayList<Integer> ids = new ArrayList<>();
TbCashierCart cart = null; TbCashierCart cart = null;
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
if (StrUtil.isNotBlank(cashierCart.getOrderId())) { if (cashierCart.getOrderId() != null) {
orderId = Integer.parseInt(cashierCart.getOrderId()); orderId = cashierCart.getOrderId();
cart = cashierCart; cart = cashierCart;
} }
@ -1331,7 +1338,7 @@ public class OrderService {
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId()); String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId()); redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
if (message != null) { if (message != null) {
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message)); productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), new BigDecimal(message));
} }
} }
@ -1493,7 +1500,7 @@ public class OrderService {
TbOrderDetail orderDetail = orderDetailMapper.selectByOrderIdAndSkuId(orderId, Integer.valueOf(cashierCart.getSkuId())); TbOrderDetail orderDetail = orderDetailMapper.selectByOrderIdAndSkuId(orderId, Integer.valueOf(cashierCart.getSkuId()));
if (Objects.nonNull(orderDetail)) { if (Objects.nonNull(orderDetail)) {
orderDetail.setNum(orderDetail.getNum() + cashierCart.getNumber()); orderDetail.setNum(orderDetail.getNum().add(cashierCart.getNumber()));
orderDetail.setPriceAmount(orderDetail.getPriceAmount().add(cashierCart.getTotalAmount())); orderDetail.setPriceAmount(orderDetail.getPriceAmount().add(cashierCart.getTotalAmount()));
orderDetail.setPackAmount(orderDetail.getPackAmount().add(cashierCart.getPackFee())); orderDetail.setPackAmount(orderDetail.getPackAmount().add(cashierCart.getPackFee()));
modityOrderDetails.add(orderDetail); modityOrderDetails.add(orderDetail);
@ -1512,8 +1519,8 @@ public class OrderService {
orderDetail.setStatus("unpaid"); orderDetail.setStatus("unpaid");
orderDetail.setProductImg(cashierCart.getCoverImg()); orderDetail.setProductImg(cashierCart.getCoverImg());
masterId = cashierCart.getMasterId(); masterId = cashierCart.getMasterId();
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) { if (cashierCart.getOrderId() != null) {
orderId = Integer.valueOf(cashierCart.getOrderId()); orderId = cashierCart.getOrderId();
} }
} }
orderDetails.add(orderDetail); orderDetails.add(orderDetail);
@ -1571,10 +1578,10 @@ public class OrderService {
} }
boolean flag = true; boolean flag = true;
for (TbCashierCart cashierCart : list) { for (TbCashierCart cashierCart : list) {
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) { if (cashierCart.getOrderId() != null) {
flag = false; flag = false;
} }
cashierCart.setOrderId(orderId + ""); cashierCart.setOrderId(orderId);
cashierCart.setStatus("closed"); cashierCart.setStatus("closed");
cashierCart.setUpdatedAt(System.currentTimeMillis()); cashierCart.setUpdatedAt(System.currentTimeMillis());
cashierCartMapper.updateByPrimaryKeySelective(cashierCart); cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
@ -1835,7 +1842,7 @@ public class OrderService {
public Object choseCount(ChoseCountDTO choseCountDTO) { public Object choseCount(ChoseCountDTO choseCountDTO) {
return Utils.runFunAndCheckKey(() -> { return Utils.runFunAndCheckKey(() -> {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(choseCountDTO.getShopId(), ShopInfoEatModelEnum.DINE_IN.getValue()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(choseCountDTO.getShopId(), "八嘎");
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(choseCountDTO.getShopId()); TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(choseCountDTO.getShopId());
if (shopInfo == null) throw new NotPrintException("店铺信息不存在"); if (shopInfo == null) throw new NotPrintException("店铺信息不存在");
@ -1880,15 +1887,15 @@ public class OrderService {
tbCashierCart.setProductId("-999"); tbCashierCart.setProductId("-999");
tbCashierCart.setSkuId("-999"); tbCashierCart.setSkuId("-999");
tbCashierCart.setPackFee(BigDecimal.ZERO); tbCashierCart.setPackFee(BigDecimal.ZERO);
tbCashierCart.setNumber(choseCountDTO.getNum()); tbCashierCart.setNumber(BigDecimal.valueOf(choseCountDTO.getNum()));
tbCashierCart.setTotalNumber(choseCountDTO.getNum()); tbCashierCart.setTotalNumber(BigDecimal.valueOf(choseCountDTO.getNum()));
tbCashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue()); tbCashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue());
tbCashierCart.setUseType(shopEatTypeInfoDTO.getUseType()); tbCashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
mpCashierCartMapper.insert(tbCashierCart); mpCashierCartMapper.insert(tbCashierCart);
} else { } else {
tbCashierCart.setTotalAmount(new BigDecimal(choseCountDTO.getNum()).multiply(shopInfo.getTableFee())); tbCashierCart.setTotalAmount(new BigDecimal(choseCountDTO.getNum()).multiply(shopInfo.getTableFee()));
tbCashierCart.setNumber(choseCountDTO.getNum()); tbCashierCart.setNumber(BigDecimal.valueOf(choseCountDTO.getNum()));
tbCashierCart.setTotalNumber(choseCountDTO.getNum()); tbCashierCart.setTotalNumber(BigDecimal.valueOf(choseCountDTO.getNum()));
mpCashierCartMapper.updateById(tbCashierCart); mpCashierCartMapper.updateById(tbCashierCart);
} }
@ -2025,4 +2032,64 @@ public class OrderService {
.set(TbShopTable::getUpdatedAt, System.currentTimeMillis()) .set(TbShopTable::getUpdatedAt, System.currentTimeMillis())
); );
} }
/**
* 临时菜添加
*
* @param temporaryDishesDTO 临时菜信息
*/
public Object addTemporaryDishes(AddTemporaryDishesDTO temporaryDishesDTO) {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(temporaryDishesDTO.getShopId(), temporaryDishesDTO.getTableId());
TbCashierCart tbCashierCart = mpCashierCartService.selectOneCartByShopEatType(shopEatTypeInfoDTO, temporaryDishesDTO.getMasterId(), null, null, false, true);
// 首次加入
if (tbCashierCart == null) {
tbCashierCart = new TbCashierCart();
tbCashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
tbCashierCart.setCreatedAt(System.currentTimeMillis());
tbCashierCart.setIsSku("0");
if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) {
tbCashierCart.setTableId(shopEatTypeInfoDTO.getTableId());
}
tbCashierCart.setName(temporaryDishesDTO.getName());
tbCashierCart.setSalePrice(temporaryDishesDTO.getPrice());
tbCashierCart.setMasterId(temporaryDishesDTO.getMasterId());
tbCashierCart.setShopId(String.valueOf(temporaryDishesDTO.getShopId()));
tbCashierCart.setTradeDay(DateUtils.getDay());
tbCashierCart.setStatus("create");
tbCashierCart.setIsPack("false");
tbCashierCart.setIsGift("false");
tbCashierCart.setTotalAmount(temporaryDishesDTO.getNum().multiply(temporaryDishesDTO.getPrice()));
tbCashierCart.setPackFee(BigDecimal.ZERO);
tbCashierCart.setTotalNumber(temporaryDishesDTO.getNum());
tbCashierCart.setNumber(temporaryDishesDTO.getNum());
tbCashierCart.setCategoryId(String.valueOf(temporaryDishesDTO.getCategoryId()));
tbCashierCart.setNote(temporaryDishesDTO.getNote());
tbCashierCart.setPlatformType(OrderPlatformTypeEnum.PC.getValue());
tbCashierCart.setIsMember(shopEatTypeInfoDTO.isMemberPrice() && temporaryDishesDTO.getVipUserId() != null ? 1 : 0);
tbCashierCart.setIsTemporary(1);
tbCashierCart.setUnit(temporaryDishesDTO.getUnit());
mpCashierCartService.save(tbCashierCart);
} else {
tbCashierCart.setIsMember(temporaryDishesDTO.getVipUserId() == null ? 0 : 1);
tbCashierCart.setNote(temporaryDishesDTO.getNote());
tbCashierCart.setTotalAmount(temporaryDishesDTO.getNum().multiply(temporaryDishesDTO.getPrice()));
tbCashierCart.setPackFee(BigDecimal.ZERO);
tbCashierCart.setIsPack("false");
tbCashierCart.setIsGift("false");
tbCashierCart.setTotalNumber(temporaryDishesDTO.getNum());
tbCashierCart.setNumber(temporaryDishesDTO.getNum());
tbCashierCart.setUpdatedAt(DateUtil.date().getTime());
tbCashierCart.setIsTemporary(1);
tbCashierCart.setUnit(temporaryDishesDTO.getUnit());
mpCashierCartService.updateById(tbCashierCart);
}
if (StrUtil.isNotBlank(temporaryDishesDTO.getTableId())) {
setRedisTableCartInfo(temporaryDishesDTO.getTableId(), temporaryDishesDTO.getShopId().toString(), Collections.singletonList(tbCashierCart), true);
}
return tbCashierCart;
}
} }

View File

@ -1151,313 +1151,314 @@ public class PayService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result returnOrder(List<TbOrderDetail> list, String token, String pwd, boolean isOnline) { public Result returnOrder(List<TbOrderDetail> list, String token, String pwd, boolean isOnline) {
if (ObjectUtil.isEmpty(list) || list.size() <= 0) { // if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
return Result.fail(CodeEnum.PARAM); // return Result.fail(CodeEnum.PARAM);
}
Integer orderId = list.get(0).getOrderId();
String remark = list.get(0).getRemark();
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(orderId);
if (ObjectUtil.isEmpty(orderInfo) || orderInfo.getStatus().equals("refund")) {
return Result.fail(CodeEnum.ORDERSTATUSERROR);
}
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
if ("1".equals(shopInfo.getIsReturn())) {
if (ObjectUtil.isEmpty(pwd)) {
return Result.fail(CodeEnum.PARAM);
}
String accountId = TokenUtil.parseParamFromToken(token).getString("accountId");
TbmerchantAccount account = tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
if (Objects.isNull(account)) {
return Result.fail(CodeEnum.ACCOUNTEIXST);
}
if (Objects.isNull(account.getPwd()) || ObjectUtil.isEmpty(account.getPwd())) {
return Result.fail(CodeEnum.PWDNOSET);
}
if (!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))) {
return Result.fail(CodeEnum.PWDERROE);
}
}
List<TbOrderDetail> orderDetails = tbOrderDetailMapper.selectAllByOrderIdAndStatus(list, orderId.toString());
String merchantId = orderInfo.getMerchantId();
String shopId = orderInfo.getShopId();
String day = DateUtils.getDay();
String masterId = orderInfo.getMasterId();
String payType = orderInfo.getPayType();
String orderNo = generateReturnOrderNumber();
if (!isOnline) {
orderNo = "XX" + orderNo;
}
BigDecimal orderAmount = orderInfo.getPayAmount();
BigDecimal totalAmount = BigDecimal.ZERO;
BigDecimal packAMount = BigDecimal.ZERO;
BigDecimal saleAmount = BigDecimal.ZERO;
BigDecimal feeAmount = BigDecimal.ZERO;
BigDecimal payAmount = BigDecimal.ZERO;
List<OrderDetailPo> detailPos = new ArrayList<>();
// //判断是否全量退款
// if(list.size()==orderDetails.size()){
// //修改主单状态
// orderInfo.setStatus("rhandoverprintDataefund");
// orderInfo.setUpdatedAt(System.currentTimeMillis());
// tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
// } // }
List<TbOrderDetail> returnDetail = new ArrayList<>();
// List<ReturnWTZInfo.ReturnDetail> details=new ArrayList<>();
Map<Integer, Integer> map1 = new HashMap<>();
for (TbOrderDetail orderDetail : list) {
if (Objects.isNull(orderDetail.getNum())) {
map1.put(orderDetail.getId(), 0);
} else {
map1.put(orderDetail.getId(), orderDetail.getNum());
}
}
for (TbOrderDetail it : orderDetails) {
it = tbOrderDetailMapper.selectByPrimaryKey(it.getId());
if (it.getStatus().equals("closed")) {
if (it.getStatus().equals("refund")) {
continue;
}
if (map1.get(it.getId()) > it.getNum() - it.getReturnNum()) {
return Result.fail("可退数量:" + (it.getNum() - it.getReturnNum()));
}
if (map1.get(it.getId()) == 0) {
map1.put(it.getId(), it.getNum());
}
OrderDetailPo detailPo = new OrderDetailPo();
// totalAmount = totalAmount.add(it.getPriceAmount());
totalAmount = totalAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
saleAmount = saleAmount.add(it.getPrice());
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN)
.multiply(new BigDecimal(map1.get(it.getId()))));
// //
// payAmount=payAmount.add(it.getPriceAmount()); //
packAMount = packAMount.add(it.getPackAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId())))); // Integer orderId = list.get(0).getOrderId();
//
detailPo.setId(it.getId()); // String remark = list.get(0).getRemark();
if (map1.get(it.getId()) + it.getReturnNum() >= it.getNum()) { //
detailPo.setStatus("refund"); // TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(orderId);
} else { // if (ObjectUtil.isEmpty(orderInfo) || orderInfo.getStatus().equals("refund")) {
detailPo.setStatus("closed"); // return Result.fail(CodeEnum.ORDERSTATUSERROR);
// }
} //
BigDecimal returnAmount = it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))); //
// TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
detailPo.setReturnNum(map1.get(it.getId())); //
detailPos.add(detailPo); //
it.setNum(map1.get(it.getId())); // if ("1".equals(shopInfo.getIsReturn())) {
it.setReturnNum(0); // if (ObjectUtil.isEmpty(pwd)) {
it.setPriceAmount(returnAmount); // return Result.fail(CodeEnum.PARAM);
it.setStatus("closed"); // }
it.setCreateTime(new Date()); // String accountId = TokenUtil.parseParamFromToken(token).getString("accountId");
it.setUpdateTime(null); //
returnDetail.add(it); // TbmerchantAccount account = tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
// if (Objects.isNull(account)) {
// details.add(new ReturnWTZInfo.ReturnDetail(it.getId()+"",it.getProductSkuId()+"",it.getNum()+"")); // return Result.fail(CodeEnum.ACCOUNTEIXST);
} // }
} // if (Objects.isNull(account.getPwd()) || ObjectUtil.isEmpty(account.getPwd())) {
// return Result.fail(CodeEnum.PWDNOSET);
// }
TbOrderInfo newOrderInfo = new TbOrderInfo(orderNo, totalAmount, packAMount, totalAmount, saleAmount, totalAmount, feeAmount, orderInfo.getTableId(), // if (!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))) {
"table", "return", merchantId, shopId, // return Result.fail(CodeEnum.PWDERROE);
"", (byte) 1, day, masterId, "refund", payAmount, orderInfo.getPayType(), orderInfo.getTableName()); // }
// }
// 线上退款 //
if (isOnline) { // List<TbOrderDetail> orderDetails = tbOrderDetailMapper.selectAllByOrderIdAndStatus(list, orderId.toString());
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) { //
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId)); //
MsgException.checkNull(thirdApply, "支付参数配置错误"); // String merchantId = orderInfo.getMerchantId();
// String shopId = orderInfo.getShopId();
if ("ysk".equals(thirdPayType)) { // String day = DateUtils.getDay();
ReturnOrderReq req = new ReturnOrderReq(); // String masterId = orderInfo.getMasterId();
req.setAppId(thirdApply.getAppId()); // String payType = orderInfo.getPayType();
req.setTimestamp(System.currentTimeMillis()); // String orderNo = generateReturnOrderNumber();
req.setOrderNumber(orderInfo.getPayOrderNo()); // if (!isOnline) {
req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN))); // orderNo = "XX" + orderNo;
req.setMercRefundNo(orderInfo.getOrderNo()); // }
req.setRefundReason("退货"); // BigDecimal orderAmount = orderInfo.getPayAmount();
req.setPayPassword(thirdApply.getPayPassword()); //
Map<String, Object> map = BeanUtil.transBean2Map(req); //
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true)); // BigDecimal totalAmount = BigDecimal.ZERO;
log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req)); // BigDecimal packAMount = BigDecimal.ZERO;
ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class); // BigDecimal saleAmount = BigDecimal.ZERO;
log.info("merchantOrderReturn:{}", response.getBody()); // BigDecimal feeAmount = BigDecimal.ZERO;
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) { // BigDecimal payAmount = BigDecimal.ZERO;
JSONObject object = JSONObject.parseObject(response.getBody()); //
if (!object.get("code").equals("0")) { // List<OrderDetailPo> detailPos = new ArrayList<>();
MsgException.check(true, "退款渠道调用失败"); //// //判断是否全量退款
} //// if(list.size()==orderDetails.size()){
// newOrderInfo.setPayOrderNo(object.getJSONObject("data").getString("refundOrderNumber")); //// //修改主单状态
} //// orderInfo.setStatus("rhandoverprintDataefund");
} else { //// orderInfo.setUpdatedAt(System.currentTimeMillis());
//// tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(String.valueOf(orderId)); //// }
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), //
newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款", // List<TbOrderDetail> returnDetail = new ArrayList<>();
newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken()); //
//// List<ReturnWTZInfo.ReturnDetail> details=new ArrayList<>();
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) { //
if ("000000".equals(publicResp.getCode())) { // Map<Integer, BigDecimal> map1 = new HashMap<>();
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) { // for (TbOrderDetail orderDetail : list) {
MsgException.check(true, "退款渠道调用失败"); // if (Objects.isNull(orderDetail.getNum())) {
} // map1.put(orderDetail.getId(), 0);
} else { // } else {
MsgException.check(true, "退款渠道调用失败"); // map1.put(orderDetail.getId(), orderDetail.getNum());
} // }
} // }
// for (TbOrderDetail it : orderDetails) {
} // it = tbOrderDetailMapper.selectByPrimaryKey(it.getId());
// if (it.getStatus().equals("closed")) {
} else if ("deposit".equals(payType)) { // if (it.getStatus().equals("refund")) {
TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(), orderInfo.getShopId()); // continue;
if (ObjectUtil.isNull(user) || ObjectUtil.isEmpty(user)) { // }
user = tbShopUserMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMemberId())); // if (map1.get(it.getId()).compareTo(it.getNum().subtract(it.getReturnNum())) < 0) {
} // return Result.fail("可退数量:" + (it.getNum().subtract(it.getReturnNum())));
// }
// if (map1.get(it.getId()) == 0) {
if (ObjectUtil.isNull(user) || ObjectUtil.isEmpty(user)) { // map1.put(it.getId(), it.getNum());
return Result.fail(ACCOUNTEIXST); // }
} // OrderDetailPo detailPo = new OrderDetailPo();
//// totalAmount = totalAmount.add(it.getPriceAmount());
if (!user.getShopId().equals(orderInfo.getShopId())) { // totalAmount = totalAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
return Result.fail(ACCOUNTEIXST); // saleAmount = saleAmount.add(it.getPrice());
} //
// payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN)
// .multiply(new BigDecimal(map1.get(it.getId()))));
newOrderInfo.setMemberId(orderInfo.getMemberId()); ////
newOrderInfo.setUserId(orderInfo.getUserId()); //// payAmount=payAmount.add(it.getPriceAmount());
// packAMount = packAMount.add(it.getPackAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
user.setAmount(user.getAmount().add(newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN))); //
user.setConsumeAmount(user.getConsumeAmount().subtract(newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN))); // detailPo.setId(it.getId());
user.setUpdatedAt(System.currentTimeMillis()); // if (map1.get(it.getId()) + it.getReturnNum() >= it.getNum()) {
tbShopUserMapper.updateByPrimaryKeySelective(user); // detailPo.setStatus("refund");
// } else {
// detailPo.setStatus("closed");
TbShopUserFlow flow = new TbShopUserFlow(); //
flow.setShopUserId(user.getId()); // }
flow.setBizCode("accountReturnPay"); // BigDecimal returnAmount = it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId())));
flow.setBizName("会员储值卡退款"); //
flow.setType("+"); // detailPo.setReturnNum(map1.get(it.getId()));
flow.setAmount(newOrderInfo.getPayAmount()); // detailPos.add(detailPo);
flow.setBalance(user.getAmount()); // it.setNum(map1.get(it.getId()));
flow.setCreateTime(new Date()); // it.setReturnNum(0);
flow.setIsReturn("0"); // it.setPriceAmount(returnAmount);
tbShopUserFlowMapper.insert(flow); // it.setStatus("closed");
// it.setCreateTime(new Date());
// it.setUpdateTime(null);
JSONObject baObj = new JSONObject(); // returnDetail.add(it);
baObj.put("userId", user.getUserId()); //
baObj.put("shopId", user.getShopId()); //// details.add(new ReturnWTZInfo.ReturnDetail(it.getId()+"",it.getProductSkuId()+"",it.getNum()+""));
baObj.put("amount", newOrderInfo.getPayAmount()); // }
baObj.put("balance", user.getAmount()); // }
baObj.put("type", "退款"); //
baObj.put("time", flow.getCreateTime()); //
producer.balance(baObj.toString()); // TbOrderInfo newOrderInfo = new TbOrderInfo(orderNo, totalAmount, packAMount, totalAmount, saleAmount, totalAmount, feeAmount, orderInfo.getTableId(),
// "table", "return", merchantId, shopId,
} // "", (byte) 1, day, masterId, "refund", payAmount, orderInfo.getPayType(), orderInfo.getTableName());
} //
// // 线上退款
//判断是否修改主单状态 // if (isOnline) {
BigDecimal returnAmount = tbOrderDetailMapper.selectByOrderId(orderId.toString()); // if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
if (N.egt(returnAmount.add(payAmount), orderAmount)) { // TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId));
orderInfo.setStatus("refund"); // MsgException.checkNull(thirdApply, "支付参数配置错误");
} //
// if ("ysk".equals(thirdPayType)) {
// ReturnOrderReq req = new ReturnOrderReq();
orderInfo.setRemark(remark); // req.setAppId(thirdApply.getAppId());
orderInfo.setUpdatedAt(System.currentTimeMillis()); // req.setTimestamp(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo); // req.setOrderNumber(orderInfo.getPayOrderNo());
// req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
//添加退单数据 // req.setMercRefundNo(orderInfo.getOrderNo());
newOrderInfo.setSource(orderId); // req.setRefundReason("退货");
tbOrderInfoMapper.insert(newOrderInfo); // req.setPayPassword(thirdApply.getPayPassword());
// Map<String, Object> map = BeanUtil.transBean2Map(req);
//更新子单表 // req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
if (ObjectUtil.isNotEmpty(detailPos) && detailPos.size() > 0) { // log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req));
tbOrderDetailMapper.updateBatchOrderDetail(detailPos); // ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class);
} // log.info("merchantOrderReturn:{}", response.getBody());
// if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
//添加子表信息 // JSONObject object = JSONObject.parseObject(response.getBody());
if (ObjectUtil.isNotEmpty(returnDetail) && returnDetail.size() > 0) { // if (!object.get("code").equals("0")) {
tbOrderDetailMapper.batchInsert(returnDetail, newOrderInfo.getId().toString()); // MsgException.check(true, "退款渠道调用失败");
} // }
//// newOrderInfo.setPayOrderNo(object.getJSONObject("data").getString("refundOrderNumber"));
// }
JSONObject jsonObject = new JSONObject(); // } else {
jsonObject.put("token", token); //
jsonObject.put("type", "return"); // TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(String.valueOf(orderId));
jsonObject.put("orderId", 0); // PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(),
jsonObject.put("amount", newOrderInfo.getPayAmount()); // newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款",
// jsonObject.put("data",new ReturnWTZInfo(orderId+"",newOrderInfo.getPayAmount(),details)); // newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
producer.putOrderCollect(jsonObject.toJSONString()); //
// if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
// if ("000000".equals(publicResp.getCode())) {
producer.printMechine(newOrderInfo.getId().toString()); // if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
// MsgException.check(true, "退款渠道调用失败");
// }
//修改耗材数据 // } else {
JSONObject jsonObject1 = new JSONObject(); // MsgException.check(true, "退款渠道调用失败");
jsonObject1.put("orderId", newOrderInfo.getId()); // }
jsonObject1.put("type", "delete"); // }
producer.cons(jsonObject1.toString()); //
// }
// 更新商品库存 //
for (TbOrderDetail detail : returnDetail) { // } else if ("deposit".equals(payType)) {
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId()); // TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(), orderInfo.getShopId());
// if (ObjectUtil.isNull(user) || ObjectUtil.isEmpty(user)) {
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId()); // user = tbShopUserMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMemberId()));
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId()); // }
//
TbProductStockDetail tbProductStockDetail = new TbProductStockDetail(); //
tbProductStockDetail.setCreatedAt(System.currentTimeMillis()); // if (ObjectUtil.isNull(user) || ObjectUtil.isEmpty(user)) {
tbProductStockDetail.setUpdatedAt(System.currentTimeMillis()); // return Result.fail(ACCOUNTEIXST);
tbProductStockDetail.setShopId(detail.getShopId().toString()); // }
tbProductStockDetail.setSourcePath("NORMAL"); //
tbProductStockDetail.setType("退单"); // if (!user.getShopId().equals(orderInfo.getShopId())) {
tbProductStockDetail.setSubType((byte) 1); // return Result.fail(ACCOUNTEIXST);
tbProductStockDetail.setRemark("退单: " + detail.getOrderId()); // }
tbProductStockDetail.setOrderId(String.valueOf(detail.getOrderId())); //
//
if (ObjectUtil.isNotEmpty(product)) { // newOrderInfo.setMemberId(orderInfo.getMemberId());
TbShopUnit shopUnit = shopUnitMapper.selectByPrimaryKey(Integer.valueOf(product.getUnitId())); // newOrderInfo.setUserId(orderInfo.getUserId());
//
tbProductStockDetail.setProductName(product.getName()); // user.setAmount(user.getAmount().add(newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
tbProductStockDetail.setIsStock(product.getIsStock()); // user.setConsumeAmount(user.getConsumeAmount().subtract(newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
tbProductStockDetail.setStockSnap(product.getSelectSpec()); // user.setUpdatedAt(System.currentTimeMillis());
tbProductStockDetail.setUnitName(shopUnit.getName()); // tbShopUserMapper.updateByPrimaryKeySelective(user);
tbProductStockDetail.setProductId(product.getId().toString()); //
//
productMapper.updateStockById(product.getId(), detail.getReturnNum() * -1); // TbShopUserFlow flow = new TbShopUserFlow();
// flow.setShopUserId(user.getId());
tbProductStockDetail.setLeftNumber(product.getStockNumber()); // flow.setBizCode("accountReturnPay");
tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum())); // flow.setBizName("会员储值卡退款");
productSkuMapper.decrRealSalesNumber(productSku.getId(), detail.getReturnNum()); // flow.setType("+");
} // flow.setAmount(newOrderInfo.getPayAmount());
// flow.setBalance(user.getAmount());
productStockDetailMapper.insert(tbProductStockDetail); // flow.setCreateTime(new Date());
} // flow.setIsReturn("0");
redisUtil.del("SHOP:CODE:USER:" + "pc" + ":" + orderInfo.getShopId() + ":" + DateUtils.getDay() + TokenUtil.parseParamFromToken(token).getString("accountId")); // tbShopUserFlowMapper.insert(flow);
//
//
return Result.success(CodeEnum.SUCCESS); // JSONObject baObj = new JSONObject();
// baObj.put("userId", user.getUserId());
// baObj.put("shopId", user.getShopId());
// baObj.put("amount", newOrderInfo.getPayAmount());
// baObj.put("balance", user.getAmount());
// baObj.put("type", "退款");
// baObj.put("time", flow.getCreateTime());
// producer.balance(baObj.toString());
//
// }
// }
//
// //判断是否修改主单状态
// BigDecimal returnAmount = tbOrderDetailMapper.selectByOrderId(orderId.toString());
// if (N.egt(returnAmount.add(payAmount), orderAmount)) {
// orderInfo.setStatus("refund");
// }
//
//
// orderInfo.setRemark(remark);
// orderInfo.setUpdatedAt(System.currentTimeMillis());
// tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
//
// //添加退单数据
// newOrderInfo.setSource(orderId);
// tbOrderInfoMapper.insert(newOrderInfo);
//
// //更新子单表
// if (ObjectUtil.isNotEmpty(detailPos) && detailPos.size() > 0) {
// tbOrderDetailMapper.updateBatchOrderDetail(detailPos);
// }
//
// //添加子表信息
// if (ObjectUtil.isNotEmpty(returnDetail) && returnDetail.size() > 0) {
// tbOrderDetailMapper.batchInsert(returnDetail, newOrderInfo.getId().toString());
// }
//
//
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("token", token);
// jsonObject.put("type", "return");
// jsonObject.put("orderId", 0);
// jsonObject.put("amount", newOrderInfo.getPayAmount());
//// jsonObject.put("data",new ReturnWTZInfo(orderId+"",newOrderInfo.getPayAmount(),details));
// producer.putOrderCollect(jsonObject.toJSONString());
//
//
// producer.printMechine(newOrderInfo.getId().toString());
//
//
// //修改耗材数据
// JSONObject jsonObject1 = new JSONObject();
// jsonObject1.put("orderId", newOrderInfo.getId());
// jsonObject1.put("type", "delete");
// producer.cons(jsonObject1.toString());
//
// // 更新商品库存
// for (TbOrderDetail detail : returnDetail) {
// detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
//
// TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
// TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId());
//
// TbProductStockDetail tbProductStockDetail = new TbProductStockDetail();
// tbProductStockDetail.setCreatedAt(System.currentTimeMillis());
// tbProductStockDetail.setUpdatedAt(System.currentTimeMillis());
// tbProductStockDetail.setShopId(detail.getShopId().toString());
// tbProductStockDetail.setSourcePath("NORMAL");
// tbProductStockDetail.setType("退单");
// tbProductStockDetail.setSubType((byte) 1);
// tbProductStockDetail.setRemark("退单: " + detail.getOrderId());
// tbProductStockDetail.setOrderId(String.valueOf(detail.getOrderId()));
//
// if (ObjectUtil.isNotEmpty(product)) {
// TbShopUnit shopUnit = shopUnitMapper.selectByPrimaryKey(Integer.valueOf(product.getUnitId()));
//
// tbProductStockDetail.setProductName(product.getName());
// tbProductStockDetail.setIsStock(product.getIsStock());
// tbProductStockDetail.setStockSnap(product.getSelectSpec());
// tbProductStockDetail.setUnitName(shopUnit.getName());
// tbProductStockDetail.setProductId(product.getId().toString());
//
// productMapper.updateStockById(product.getId(), detail.getReturnNum() * -1);
//
// tbProductStockDetail.setLeftNumber(product.getStockNumber());
// tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum()));
// productSkuMapper.decrRealSalesNumber(productSku.getId(), detail.getReturnNum());
// }
//
// productStockDetailMapper.insert(tbProductStockDetail);
// }
// redisUtil.del("SHOP:CODE:USER:" + "pc" + ":" + orderInfo.getShopId() + ":" + DateUtils.getDay() + TokenUtil.parseParamFromToken(token).getString("accountId"));
//
//
// return Result.success(CodeEnum.SUCCESS);
return null;
} }
public Result quickPay(String token, String amount, String authCode, String payType) { public Result quickPay(String token, String amount, String authCode, String payType) {

View File

@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
@Service @Service
@ -147,11 +148,11 @@ public class ProductService {
return Result.success(CodeEnum.SUCCESS,pageInfo); return Result.success(CodeEnum.SUCCESS,pageInfo);
} }
public void incrStock(String productId, String skuId, int addNum) { public void incrStock(String productId, String skuId, BigDecimal addNum) {
tbProductMapper.incrStock(productId, addNum); tbProductMapper.incrStock(productId, addNum);
} }
public void decrStock(String productId, String skuId, int decrNum) { public void decrStock(String productId, String skuId, BigDecimal decrNum) {
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId)); TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
if (product.getIsStock() == 1) { if (product.getIsStock() == 1) {
if (tbProductMapper.decrStock(productId, decrNum) < 1) { if (tbProductMapper.decrStock(productId, decrNum) < 1) {

View File

@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.service.impl; package com.chaozhanggui.system.cashierservice.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant; import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart; import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail; import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper; import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper;
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper; import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
import com.chaozhanggui.system.cashierservice.service.MpCashierCartService; import com.chaozhanggui.system.cashierservice.service.MpCashierCartService;
@ -59,5 +61,43 @@ public class MpCashierCartServiceImpl extends ServiceImpl<MPCashierCartMapper, T
} }
return list(query); return list(query);
} }
@Override
public TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp) {
LambdaQueryWrapper<TbCashierCart> query = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
.isNull(TbCashierCart::getPlaceNum)
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
.eq(TbCashierCart::getStatus, "create")
.eq(TbCashierCart::getIsGift, isGift)
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
if (isTemp) {
query.isNull(TbCashierCart::getProductId).isNull(TbCashierCart::getSkuId).eq(TbCashierCart::getIsTemporary, 1);
}else {
query.eq(TbCashierCart::getProductId, productId)
.eq(TbCashierCart::getSkuId, skuId);
}
// 外带只查询pc和收银机商品
if (shopEatTypeInfoDTO.isTakeout()) {
query.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
.in(TbCashierCart::getPlatformType, "pc", "cash");
} else {
query.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
}
return getOne(query);
}
@Override
public TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses) {
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, shopId)
.eq(TbCashierCart::getId, cartId);
if (statuses.length != 0) {
queryWrapper.in(TbCashierCart::getStatus, CollUtil.newArrayList(statuses));
}
return getOne(queryWrapper);
}
} }

View File

@ -46,7 +46,7 @@ public class MpOrderDetailServiceImpl extends ServiceImpl<MPOrderDetailMapper, T
} }
@Override @Override
public boolean removeByOrderId(String orderId) { public boolean removeByOrderId(Integer orderId) {
return remove(new LambdaQueryWrapper<TbOrderDetail>() return remove(new LambdaQueryWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getOrderId, orderId)); .eq(TbOrderDetail::getOrderId, orderId));
} }

View File

@ -5,87 +5,46 @@
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="category_id" jdbcType="VARCHAR" property="categoryId" /> <result column="category_id" jdbcType="VARCHAR" property="categoryId" />
<result column="spec_id" jdbcType="INTEGER" property="specId" /> <result column="spec_id" jdbcType="INTEGER" property="specId" />
<result column="source_path" jdbcType="VARCHAR" property="sourcePath" />
<result column="brand_id" jdbcType="INTEGER" property="brandId" />
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" /> <result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="short_title" jdbcType="VARCHAR" property="shortTitle" /> <result column="short_title" jdbcType="VARCHAR" property="shortTitle" />
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type" />
<result column="pack_fee" jdbcType="DECIMAL" property="packFee" /> <result column="pack_fee" jdbcType="DECIMAL" property="packFee" />
<result column="low_price" jdbcType="DECIMAL" property="lowPrice" /> <result column="low_price" jdbcType="DECIMAL" property="lowPrice" />
<result column="low_member_price" jdbcType="DECIMAL" property="lowMemberPrice" />
<result column="unit_id" jdbcType="VARCHAR" property="unitId" /> <result column="unit_id" jdbcType="VARCHAR" property="unitId" />
<result column="unit_snap" jdbcType="VARCHAR" property="unitSnap" />
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
<result column="share_img" jdbcType="VARCHAR" property="shareImg" />
<result column="video_cover_img" jdbcType="VARCHAR" property="videoCoverImg" />
<result column="sort" jdbcType="INTEGER" property="sort" /> <result column="sort" jdbcType="INTEGER" property="sort" />
<result column="limit_number" jdbcType="INTEGER" property="limitNumber" />
<result column="product_score" jdbcType="INTEGER" property="productScore" />
<result column="status" jdbcType="TINYINT" property="status" /> <result column="status" jdbcType="TINYINT" property="status" />
<result column="fail_msg" jdbcType="VARCHAR" property="failMsg" /> <result column="fail_msg" jdbcType="VARCHAR" property="failMsg" />
<result column="is_recommend" jdbcType="TINYINT" property="isRecommend" />
<result column="is_hot" jdbcType="TINYINT" property="isHot" /> <result column="is_hot" jdbcType="TINYINT" property="isHot" />
<result column="is_new" jdbcType="TINYINT" property="isNew" />
<result column="is_on_sale" jdbcType="TINYINT" property="isOnSale" />
<result column="is_show" jdbcType="TINYINT" property="isShow" />
<result column="type_enum" jdbcType="VARCHAR" property="typeEnum" /> <result column="type_enum" jdbcType="VARCHAR" property="typeEnum" />
<result column="is_distribute" jdbcType="TINYINT" property="isDistribute" />
<result column="is_del" jdbcType="TINYINT" property="isDel" /> <result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="is_stock" jdbcType="TINYINT" property="isStock" /> <result column="is_stock" jdbcType="TINYINT" property="isStock" />
<result column="is_pause_sale" jdbcType="TINYINT" property="isPauseSale" /> <result column="is_pause_sale" jdbcType="TINYINT" property="isPauseSale" />
<result column="is_free_freight" jdbcType="TINYINT" property="isFreeFreight" />
<result column="freight_id" jdbcType="BIGINT" property="freightId" />
<result column="strategy_type" jdbcType="VARCHAR" property="strategyType" />
<result column="strategy_id" jdbcType="INTEGER" property="strategyId" />
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
<result column="created_at" jdbcType="BIGINT" property="createdAt" /> <result column="created_at" jdbcType="BIGINT" property="createdAt" />
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" /> <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
<result column="base_sales_number" jdbcType="DOUBLE" property="baseSalesNumber" />
<result column="real_sales_number" jdbcType="INTEGER" property="realSalesNumber" /> <result column="real_sales_number" jdbcType="INTEGER" property="realSalesNumber" />
<result column="sales_number" jdbcType="INTEGER" property="salesNumber" />
<result column="thumb_count" jdbcType="INTEGER" property="thumbCount" />
<result column="store_count" jdbcType="INTEGER" property="storeCount" />
<result column="furnish_meal" jdbcType="INTEGER" property="furnishMeal" />
<result column="furnish_express" jdbcType="INTEGER" property="furnishExpress" />
<result column="furnish_draw" jdbcType="INTEGER" property="furnishDraw" />
<result column="furnish_vir" jdbcType="INTEGER" property="furnishVir" />
<result column="is_combo" jdbcType="TINYINT" property="isCombo" />
<result column="is_show_cash" jdbcType="TINYINT" property="isShowCash" />
<result column="is_show_mall" jdbcType="TINYINT" property="isShowMall" />
<result column="is_need_examine" jdbcType="TINYINT" property="isNeedExamine" />
<result column="show_on_mall_status" jdbcType="TINYINT" property="showOnMallStatus" />
<result column="show_on_mall_time" jdbcType="BIGINT" property="showOnMallTime" />
<result column="show_on_mall_error_msg" jdbcType="VARCHAR" property="showOnMallErrorMsg" />
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" /> <result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" /> <result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
<result column="warn_line" jdbcType="INTEGER" property="warnLine" /> <result column="warn_line" jdbcType="INTEGER" property="warnLine" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
<result column="images" jdbcType="LONGVARCHAR" property="images" /> <result column="images" jdbcType="LONGVARCHAR" property="images" />
<result column="video" jdbcType="LONGVARCHAR" property="video" />
<result column="notice" jdbcType="LONGVARCHAR" property="notice" />
<result column="group_snap" jdbcType="LONGVARCHAR" property="groupSnap" /> <result column="group_snap" jdbcType="LONGVARCHAR" property="groupSnap" />
<result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" /> <result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" />
<result column="select_spec" jdbcType="LONGVARCHAR" property="selectSpec" /> <result column="select_spec" jdbcType="LONGVARCHAR" property="selectSpec" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title, id, category_id, spec_id, shop_id, name, short_title,
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img, type, pack_fee, low_price, unit_id, cover_img,
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend, sort, status, fail_msg,
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock, is_hot, type_enum, is_del, is_stock,
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete, is_pause_sale,
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count, created_at, updated_at, real_sales_number,
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo, spec_table_headers, stock_number,warn_line
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers, stock_number,warn_line
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
images, video, notice, group_snap, spec_info, select_spec images, group_snap, spec_info, select_spec
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
select select
@ -101,49 +60,35 @@
</delete> </delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs"> <insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
insert into tb_product (id, category_id, spec_id, insert into tb_product (id, category_id, spec_id,
source_path, brand_id, merchant_id,
shop_id, name, short_title, shop_id, name, short_title,
type, pack_fee, low_price, type, pack_fee, low_price,
low_member_price, unit_id, unit_snap, unit_id,
cover_img, share_img, video_cover_img, cover_img,
sort, limit_number, product_score, sort, status, fail_msg,
status, fail_msg, is_recommend, is_hot,
is_hot, is_new, is_on_sale, type_enum,
is_show, type_enum, is_distribute,
is_del, is_stock, is_pause_sale, is_del, is_stock, is_pause_sale,
is_free_freight, freight_id, strategy_type, created_at, updated_at,
strategy_id, is_vip, is_delete, real_sales_number,
created_at, updated_at, base_sales_number, spec_table_headers,
real_sales_number, sales_number, thumb_count, images,
store_count, furnish_meal, furnish_express,
furnish_draw, furnish_vir, is_combo,
is_show_cash, is_show_mall, is_need_examine,
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
enable_label, tax_config_id, spec_table_headers,
images, video, notice,
group_snap, spec_info, select_spec, stock_number,warn_line group_snap, spec_info, select_spec, stock_number,warn_line
) )
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
#{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{packFee,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL}, #{type,jdbcType=VARCHAR}, #{packFee,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL},
#{lowMemberPrice,jdbcType=DECIMAL}, #{unitId,jdbcType=VARCHAR}, #{unitSnap,jdbcType=VARCHAR}, #{unitId,jdbcType=VARCHAR},
#{coverImg,jdbcType=VARCHAR}, #{shareImg,jdbcType=VARCHAR}, #{videoCoverImg,jdbcType=VARCHAR}, #{coverImg,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{limitNumber,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
#{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR}, #{isRecommend,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR},
#{isHot,jdbcType=TINYINT}, #{isNew,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT}, #{isHot,jdbcType=TINYINT}, #{isNew,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT},
#{isShow,jdbcType=TINYINT}, #{typeEnum,jdbcType=VARCHAR}, #{isDistribute,jdbcType=TINYINT}, #{typeEnum,jdbcType=VARCHAR},
#{isDel,jdbcType=TINYINT}, #{isStock,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT}, #{isDel,jdbcType=TINYINT}, #{isStock,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT},
#{isFreeFreight,jdbcType=TINYINT}, #{freightId,jdbcType=BIGINT}, #{strategyType,jdbcType=VARCHAR}, #{strategyId,jdbcType=INTEGER},
#{strategyId,jdbcType=INTEGER}, #{isVip,jdbcType=TINYINT}, #{isDelete,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{baseSalesNumber,jdbcType=DOUBLE}, #{realSalesNumber,jdbcType=INTEGER},
#{realSalesNumber,jdbcType=INTEGER}, #{salesNumber,jdbcType=INTEGER}, #{thumbCount,jdbcType=INTEGER}, #{specTableHeaders,jdbcType=VARCHAR},
#{storeCount,jdbcType=INTEGER}, #{furnishMeal,jdbcType=INTEGER}, #{furnishExpress,jdbcType=INTEGER}, #{images,jdbcType=LONGVARCHAR},
#{furnishDraw,jdbcType=INTEGER}, #{furnishVir,jdbcType=INTEGER}, #{isCombo,jdbcType=TINYINT},
#{isShowCash,jdbcType=TINYINT}, #{isShowMall,jdbcType=TINYINT}, #{isNeedExamine,jdbcType=TINYINT},
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR}, #{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR},
#{stockNumber,jdbcType=INTEGER},#{warnLine,jdbcType=INTEGER} #{stockNumber,jdbcType=INTEGER},#{warnLine,jdbcType=INTEGER}
) )
@ -160,15 +105,7 @@
<if test="specId != null"> <if test="specId != null">
spec_id, spec_id,
</if> </if>
<if test="sourcePath != null">
source_path,
</if>
<if test="brandId != null">
brand_id,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="shopId != null"> <if test="shopId != null">
shop_id, shop_id,
</if> </if>
@ -187,60 +124,34 @@
<if test="lowPrice != null"> <if test="lowPrice != null">
low_price, low_price,
</if> </if>
<if test="lowMemberPrice != null">
low_member_price,
</if>
<if test="unitId != null"> <if test="unitId != null">
unit_id, unit_id,
</if> </if>
<if test="unitSnap != null">
unit_snap,
</if>
<if test="coverImg != null"> <if test="coverImg != null">
cover_img, cover_img,
</if> </if>
<if test="shareImg != null">
share_img,
</if>
<if test="videoCoverImg != null">
video_cover_img,
</if>
<if test="sort != null"> <if test="sort != null">
sort, sort,
</if> </if>
<if test="limitNumber != null">
limit_number,
</if>
<if test="productScore != null">
product_score,
</if>
<if test="status != null"> <if test="status != null">
status, status,
</if> </if>
<if test="failMsg != null"> <if test="failMsg != null">
fail_msg, fail_msg,
</if> </if>
<if test="isRecommend != null">
is_recommend,
</if>
<if test="isHot != null"> <if test="isHot != null">
is_hot, is_hot,
</if> </if>
<if test="isNew != null">
is_new,
</if>
<if test="isOnSale != null">
is_on_sale,
</if>
<if test="isShow != null">
is_show,
</if>
<if test="typeEnum != null"> <if test="typeEnum != null">
type_enum, type_enum,
</if> </if>
<if test="isDistribute != null">
is_distribute,
</if>
<if test="isDel != null"> <if test="isDel != null">
is_del, is_del,
</if> </if>
@ -250,96 +161,23 @@
<if test="isPauseSale != null"> <if test="isPauseSale != null">
is_pause_sale, is_pause_sale,
</if> </if>
<if test="isFreeFreight != null">
is_free_freight,
</if>
<if test="freightId != null">
freight_id,
</if>
<if test="strategyType != null">
strategy_type,
</if>
<if test="strategyId != null">
strategy_id,
</if>
<if test="isVip != null">
is_vip,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="createdAt != null"> <if test="createdAt != null">
created_at, created_at,
</if> </if>
<if test="updatedAt != null"> <if test="updatedAt != null">
updated_at, updated_at,
</if> </if>
<if test="baseSalesNumber != null">
base_sales_number,
</if>
<if test="realSalesNumber != null"> <if test="realSalesNumber != null">
real_sales_number, real_sales_number,
</if> </if>
<if test="salesNumber != null">
sales_number,
</if>
<if test="thumbCount != null">
thumb_count,
</if>
<if test="storeCount != null">
store_count,
</if>
<if test="furnishMeal != null">
furnish_meal,
</if>
<if test="furnishExpress != null">
furnish_express,
</if>
<if test="furnishDraw != null">
furnish_draw,
</if>
<if test="furnishVir != null">
furnish_vir,
</if>
<if test="isCombo != null">
is_combo,
</if>
<if test="isShowCash != null">
is_show_cash,
</if>
<if test="isShowMall != null">
is_show_mall,
</if>
<if test="isNeedExamine != null">
is_need_examine,
</if>
<if test="showOnMallStatus != null">
show_on_mall_status,
</if>
<if test="showOnMallTime != null">
show_on_mall_time,
</if>
<if test="showOnMallErrorMsg != null">
show_on_mall_error_msg,
</if>
<if test="enableLabel != null">
enable_label,
</if>
<if test="taxConfigId != null">
tax_config_id,
</if>
<if test="specTableHeaders != null"> <if test="specTableHeaders != null">
spec_table_headers, spec_table_headers,
</if> </if>
<if test="images != null"> <if test="images != null">
images, images,
</if> </if>
<if test="video != null">
video,
</if>
<if test="notice != null">
notice,
</if>
<if test="groupSnap != null"> <if test="groupSnap != null">
group_snap, group_snap,
</if> </if>
@ -366,15 +204,8 @@
<if test="specId != null"> <if test="specId != null">
#{specId,jdbcType=INTEGER}, #{specId,jdbcType=INTEGER},
</if> </if>
<if test="sourcePath != null">
#{sourcePath,jdbcType=VARCHAR},
</if>
<if test="brandId != null">
#{brandId,jdbcType=INTEGER},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=VARCHAR},
</if>
<if test="shopId != null"> <if test="shopId != null">
#{shopId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
</if> </if>
@ -393,30 +224,19 @@
<if test="lowPrice != null"> <if test="lowPrice != null">
#{lowPrice,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL},
</if> </if>
<if test="lowMemberPrice != null">
#{lowMemberPrice,jdbcType=DECIMAL},
</if>
<if test="unitId != null"> <if test="unitId != null">
#{unitId,jdbcType=VARCHAR}, #{unitId,jdbcType=VARCHAR},
</if> </if>
<if test="unitSnap != null">
#{unitSnap,jdbcType=VARCHAR},
</if>
<if test="coverImg != null"> <if test="coverImg != null">
#{coverImg,jdbcType=VARCHAR}, #{coverImg,jdbcType=VARCHAR},
</if> </if>
<if test="shareImg != null">
#{shareImg,jdbcType=VARCHAR},
</if>
<if test="videoCoverImg != null">
#{videoCoverImg,jdbcType=VARCHAR},
</if>
<if test="sort != null"> <if test="sort != null">
#{sort,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
</if> </if>
<if test="limitNumber != null">
#{limitNumber,jdbcType=INTEGER},
</if>
<if test="productScore != null"> <if test="productScore != null">
#{productScore,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
</if> </if>
@ -426,9 +246,7 @@
<if test="failMsg != null"> <if test="failMsg != null">
#{failMsg,jdbcType=VARCHAR}, #{failMsg,jdbcType=VARCHAR},
</if> </if>
<if test="isRecommend != null">
#{isRecommend,jdbcType=TINYINT},
</if>
<if test="isHot != null"> <if test="isHot != null">
#{isHot,jdbcType=TINYINT}, #{isHot,jdbcType=TINYINT},
</if> </if>
@ -438,15 +256,11 @@
<if test="isOnSale != null"> <if test="isOnSale != null">
#{isOnSale,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT},
</if> </if>
<if test="isShow != null">
#{isShow,jdbcType=TINYINT},
</if>
<if test="typeEnum != null"> <if test="typeEnum != null">
#{typeEnum,jdbcType=VARCHAR}, #{typeEnum,jdbcType=VARCHAR},
</if> </if>
<if test="isDistribute != null">
#{isDistribute,jdbcType=TINYINT},
</if>
<if test="isDel != null"> <if test="isDel != null">
#{isDel,jdbcType=TINYINT}, #{isDel,jdbcType=TINYINT},
</if> </if>
@ -456,96 +270,28 @@
<if test="isPauseSale != null"> <if test="isPauseSale != null">
#{isPauseSale,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT},
</if> </if>
<if test="isFreeFreight != null">
#{isFreeFreight,jdbcType=TINYINT},
</if>
<if test="freightId != null">
#{freightId,jdbcType=BIGINT},
</if>
<if test="strategyType != null">
#{strategyType,jdbcType=VARCHAR},
</if>
<if test="strategyId != null"> <if test="strategyId != null">
#{strategyId,jdbcType=INTEGER}, #{strategyId,jdbcType=INTEGER},
</if> </if>
<if test="isVip != null">
#{isVip,jdbcType=TINYINT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=TINYINT},
</if>
<if test="createdAt != null"> <if test="createdAt != null">
#{createdAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT},
</if> </if>
<if test="updatedAt != null"> <if test="updatedAt != null">
#{updatedAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
</if> </if>
<if test="baseSalesNumber != null">
#{baseSalesNumber,jdbcType=DOUBLE},
</if>
<if test="realSalesNumber != null"> <if test="realSalesNumber != null">
#{realSalesNumber,jdbcType=INTEGER}, #{realSalesNumber,jdbcType=INTEGER},
</if> </if>
<if test="salesNumber != null">
#{salesNumber,jdbcType=INTEGER},
</if>
<if test="thumbCount != null">
#{thumbCount,jdbcType=INTEGER},
</if>
<if test="storeCount != null">
#{storeCount,jdbcType=INTEGER},
</if>
<if test="furnishMeal != null">
#{furnishMeal,jdbcType=INTEGER},
</if>
<if test="furnishExpress != null">
#{furnishExpress,jdbcType=INTEGER},
</if>
<if test="furnishDraw != null">
#{furnishDraw,jdbcType=INTEGER},
</if>
<if test="furnishVir != null">
#{furnishVir,jdbcType=INTEGER},
</if>
<if test="isCombo != null">
#{isCombo,jdbcType=TINYINT},
</if>
<if test="isShowCash != null">
#{isShowCash,jdbcType=TINYINT},
</if>
<if test="isShowMall != null">
#{isShowMall,jdbcType=TINYINT},
</if>
<if test="isNeedExamine != null">
#{isNeedExamine,jdbcType=TINYINT},
</if>
<if test="showOnMallStatus != null">
#{showOnMallStatus,jdbcType=TINYINT},
</if>
<if test="showOnMallTime != null">
#{showOnMallTime,jdbcType=BIGINT},
</if>
<if test="showOnMallErrorMsg != null">
#{showOnMallErrorMsg,jdbcType=VARCHAR},
</if>
<if test="enableLabel != null">
#{enableLabel,jdbcType=TINYINT},
</if>
<if test="taxConfigId != null">
#{taxConfigId,jdbcType=VARCHAR},
</if>
<if test="specTableHeaders != null"> <if test="specTableHeaders != null">
#{specTableHeaders,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
</if> </if>
<if test="images != null"> <if test="images != null">
#{images,jdbcType=LONGVARCHAR}, #{images,jdbcType=LONGVARCHAR},
</if> </if>
<if test="video != null">
#{video,jdbcType=LONGVARCHAR},
</if>
<if test="notice != null">
#{notice,jdbcType=LONGVARCHAR},
</if>
<if test="groupSnap != null"> <if test="groupSnap != null">
#{groupSnap,jdbcType=LONGVARCHAR}, #{groupSnap,jdbcType=LONGVARCHAR},
</if> </if>
@ -572,15 +318,7 @@
<if test="specId != null"> <if test="specId != null">
spec_id = #{specId,jdbcType=INTEGER}, spec_id = #{specId,jdbcType=INTEGER},
</if> </if>
<if test="sourcePath != null">
source_path = #{sourcePath,jdbcType=VARCHAR},
</if>
<if test="brandId != null">
brand_id = #{brandId,jdbcType=INTEGER},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId,jdbcType=VARCHAR},
</if>
<if test="shopId != null"> <if test="shopId != null">
shop_id = #{shopId,jdbcType=VARCHAR}, shop_id = #{shopId,jdbcType=VARCHAR},
</if> </if>
@ -599,60 +337,35 @@
<if test="lowPrice != null"> <if test="lowPrice != null">
low_price = #{lowPrice,jdbcType=DECIMAL}, low_price = #{lowPrice,jdbcType=DECIMAL},
</if> </if>
<if test="lowMemberPrice != null">
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
</if>
<if test="unitId != null"> <if test="unitId != null">
unit_id = #{unitId,jdbcType=VARCHAR}, unit_id = #{unitId,jdbcType=VARCHAR},
</if> </if>
<if test="unitSnap != null">
unit_snap = #{unitSnap,jdbcType=VARCHAR},
</if>
<if test="coverImg != null"> <if test="coverImg != null">
cover_img = #{coverImg,jdbcType=VARCHAR}, cover_img = #{coverImg,jdbcType=VARCHAR},
</if> </if>
<if test="shareImg != null">
share_img = #{shareImg,jdbcType=VARCHAR},
</if>
<if test="videoCoverImg != null">
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
</if>
<if test="sort != null"> <if test="sort != null">
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
</if> </if>
<if test="limitNumber != null">
limit_number = #{limitNumber,jdbcType=INTEGER},
</if>
<if test="productScore != null">
product_score = #{productScore,jdbcType=INTEGER},
</if>
<if test="status != null"> <if test="status != null">
status = #{status,jdbcType=TINYINT}, status = #{status,jdbcType=TINYINT},
</if> </if>
<if test="failMsg != null"> <if test="failMsg != null">
fail_msg = #{failMsg,jdbcType=VARCHAR}, fail_msg = #{failMsg,jdbcType=VARCHAR},
</if> </if>
<if test="isRecommend != null">
is_recommend = #{isRecommend,jdbcType=TINYINT},
</if>
<if test="isHot != null"> <if test="isHot != null">
is_hot = #{isHot,jdbcType=TINYINT}, is_hot = #{isHot,jdbcType=TINYINT},
</if> </if>
<if test="isNew != null">
is_new = #{isNew,jdbcType=TINYINT},
</if>
<if test="isOnSale != null">
is_on_sale = #{isOnSale,jdbcType=TINYINT},
</if>
<if test="isShow != null">
is_show = #{isShow,jdbcType=TINYINT},
</if>
<if test="typeEnum != null"> <if test="typeEnum != null">
type_enum = #{typeEnum,jdbcType=VARCHAR}, type_enum = #{typeEnum,jdbcType=VARCHAR},
</if> </if>
<if test="isDistribute != null">
is_distribute = #{isDistribute,jdbcType=TINYINT},
</if>
<if test="isDel != null"> <if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT}, is_del = #{isDel,jdbcType=TINYINT},
</if> </if>
@ -662,96 +375,24 @@
<if test="isPauseSale != null"> <if test="isPauseSale != null">
is_pause_sale = #{isPauseSale,jdbcType=TINYINT}, is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
</if> </if>
<if test="isFreeFreight != null">
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
</if>
<if test="freightId != null">
freight_id = #{freightId,jdbcType=BIGINT},
</if>
<if test="strategyType != null">
strategy_type = #{strategyType,jdbcType=VARCHAR},
</if>
<if test="strategyId != null">
strategy_id = #{strategyId,jdbcType=INTEGER},
</if>
<if test="isVip != null">
is_vip = #{isVip,jdbcType=TINYINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=TINYINT},
</if>
<if test="createdAt != null"> <if test="createdAt != null">
created_at = #{createdAt,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=BIGINT},
</if> </if>
<if test="updatedAt != null"> <if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=BIGINT}, updated_at = #{updatedAt,jdbcType=BIGINT},
</if> </if>
<if test="baseSalesNumber != null">
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
</if>
<if test="realSalesNumber != null"> <if test="realSalesNumber != null">
real_sales_number = #{realSalesNumber,jdbcType=INTEGER}, real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
</if> </if>
<if test="salesNumber != null">
sales_number = #{salesNumber,jdbcType=INTEGER},
</if>
<if test="thumbCount != null">
thumb_count = #{thumbCount,jdbcType=INTEGER},
</if>
<if test="storeCount != null">
store_count = #{storeCount,jdbcType=INTEGER},
</if>
<if test="furnishMeal != null">
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
</if>
<if test="furnishExpress != null">
furnish_express = #{furnishExpress,jdbcType=INTEGER},
</if>
<if test="furnishDraw != null">
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
</if>
<if test="furnishVir != null">
furnish_vir = #{furnishVir,jdbcType=INTEGER},
</if>
<if test="isCombo != null">
is_combo = #{isCombo,jdbcType=TINYINT},
</if>
<if test="isShowCash != null">
is_show_cash = #{isShowCash,jdbcType=TINYINT},
</if>
<if test="isShowMall != null">
is_show_mall = #{isShowMall,jdbcType=TINYINT},
</if>
<if test="isNeedExamine != null">
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
</if>
<if test="showOnMallStatus != null">
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
</if>
<if test="showOnMallTime != null">
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
</if>
<if test="showOnMallErrorMsg != null">
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
</if>
<if test="enableLabel != null">
enable_label = #{enableLabel,jdbcType=TINYINT},
</if>
<if test="taxConfigId != null">
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
</if>
<if test="specTableHeaders != null"> <if test="specTableHeaders != null">
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}, spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
</if> </if>
<if test="images != null"> <if test="images != null">
images = #{images,jdbcType=LONGVARCHAR}, images = #{images,jdbcType=LONGVARCHAR},
</if> </if>
<if test="video != null">
video = #{video,jdbcType=LONGVARCHAR},
</if>
<if test="notice != null">
notice = #{notice,jdbcType=LONGVARCHAR},
</if>
<if test="groupSnap != null"> <if test="groupSnap != null">
group_snap = #{groupSnap,jdbcType=LONGVARCHAR}, group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
</if> </if>
@ -774,66 +415,27 @@
update tb_product update tb_product
set category_id = #{categoryId,jdbcType=VARCHAR}, set category_id = #{categoryId,jdbcType=VARCHAR},
spec_id = #{specId,jdbcType=INTEGER}, spec_id = #{specId,jdbcType=INTEGER},
source_path = #{sourcePath,jdbcType=VARCHAR},
brand_id = #{brandId,jdbcType=INTEGER},
merchant_id = #{merchantId,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR}, shop_id = #{shopId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
short_title = #{shortTitle,jdbcType=VARCHAR}, short_title = #{shortTitle,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR},
pack_fee = #{packFee,jdbcType=DECIMAL}, pack_fee = #{packFee,jdbcType=DECIMAL},
low_price = #{lowPrice,jdbcType=DECIMAL}, low_price = #{lowPrice,jdbcType=DECIMAL},
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
unit_id = #{unitId,jdbcType=VARCHAR}, unit_id = #{unitId,jdbcType=VARCHAR},
unit_snap = #{unitSnap,jdbcType=VARCHAR},
cover_img = #{coverImg,jdbcType=VARCHAR}, cover_img = #{coverImg,jdbcType=VARCHAR},
share_img = #{shareImg,jdbcType=VARCHAR},
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
limit_number = #{limitNumber,jdbcType=INTEGER},
product_score = #{productScore,jdbcType=INTEGER},
status = #{status,jdbcType=TINYINT}, status = #{status,jdbcType=TINYINT},
fail_msg = #{failMsg,jdbcType=VARCHAR}, fail_msg = #{failMsg,jdbcType=VARCHAR},
is_recommend = #{isRecommend,jdbcType=TINYINT},
is_hot = #{isHot,jdbcType=TINYINT}, is_hot = #{isHot,jdbcType=TINYINT},
is_new = #{isNew,jdbcType=TINYINT},
is_on_sale = #{isOnSale,jdbcType=TINYINT},
is_show = #{isShow,jdbcType=TINYINT},
type_enum = #{typeEnum,jdbcType=VARCHAR}, type_enum = #{typeEnum,jdbcType=VARCHAR},
is_distribute = #{isDistribute,jdbcType=TINYINT},
is_del = #{isDel,jdbcType=TINYINT}, is_del = #{isDel,jdbcType=TINYINT},
is_stock = #{isStock,jdbcType=TINYINT}, is_stock = #{isStock,jdbcType=TINYINT},
is_pause_sale = #{isPauseSale,jdbcType=TINYINT}, is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
freight_id = #{freightId,jdbcType=BIGINT},
strategy_type = #{strategyType,jdbcType=VARCHAR},
strategy_id = #{strategyId,jdbcType=INTEGER},
is_vip = #{isVip,jdbcType=TINYINT},
is_delete = #{isDelete,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=BIGINT}, updated_at = #{updatedAt,jdbcType=BIGINT},
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
real_sales_number = #{realSalesNumber,jdbcType=INTEGER}, real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
sales_number = #{salesNumber,jdbcType=INTEGER},
thumb_count = #{thumbCount,jdbcType=INTEGER},
store_count = #{storeCount,jdbcType=INTEGER},
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
furnish_express = #{furnishExpress,jdbcType=INTEGER},
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
furnish_vir = #{furnishVir,jdbcType=INTEGER},
is_combo = #{isCombo,jdbcType=TINYINT},
is_show_cash = #{isShowCash,jdbcType=TINYINT},
is_show_mall = #{isShowMall,jdbcType=TINYINT},
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
enable_label = #{enableLabel,jdbcType=TINYINT},
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}, spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
images = #{images,jdbcType=LONGVARCHAR}, images = #{images,jdbcType=LONGVARCHAR},
video = #{video,jdbcType=LONGVARCHAR},
notice = #{notice,jdbcType=LONGVARCHAR},
group_snap = #{groupSnap,jdbcType=LONGVARCHAR}, group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
spec_info = #{specInfo,jdbcType=LONGVARCHAR}, spec_info = #{specInfo,jdbcType=LONGVARCHAR},
select_spec = #{selectSpec,jdbcType=LONGVARCHAR}, select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
@ -845,62 +447,25 @@
update tb_product update tb_product
set category_id = #{categoryId,jdbcType=VARCHAR}, set category_id = #{categoryId,jdbcType=VARCHAR},
spec_id = #{specId,jdbcType=INTEGER}, spec_id = #{specId,jdbcType=INTEGER},
source_path = #{sourcePath,jdbcType=VARCHAR},
brand_id = #{brandId,jdbcType=INTEGER},
merchant_id = #{merchantId,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR}, shop_id = #{shopId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
short_title = #{shortTitle,jdbcType=VARCHAR}, short_title = #{shortTitle,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR},
pack_fee = #{packFee,jdbcType=DECIMAL}, pack_fee = #{packFee,jdbcType=DECIMAL},
low_price = #{lowPrice,jdbcType=DECIMAL}, low_price = #{lowPrice,jdbcType=DECIMAL},
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
unit_id = #{unitId,jdbcType=VARCHAR}, unit_id = #{unitId,jdbcType=VARCHAR},
unit_snap = #{unitSnap,jdbcType=VARCHAR},
cover_img = #{coverImg,jdbcType=VARCHAR}, cover_img = #{coverImg,jdbcType=VARCHAR},
share_img = #{shareImg,jdbcType=VARCHAR},
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
limit_number = #{limitNumber,jdbcType=INTEGER},
product_score = #{productScore,jdbcType=INTEGER},
status = #{status,jdbcType=TINYINT}, status = #{status,jdbcType=TINYINT},
fail_msg = #{failMsg,jdbcType=VARCHAR}, fail_msg = #{failMsg,jdbcType=VARCHAR},
is_recommend = #{isRecommend,jdbcType=TINYINT},
is_hot = #{isHot,jdbcType=TINYINT}, is_hot = #{isHot,jdbcType=TINYINT},
is_new = #{isNew,jdbcType=TINYINT},
is_on_sale = #{isOnSale,jdbcType=TINYINT},
is_show = #{isShow,jdbcType=TINYINT},
type_enum = #{typeEnum,jdbcType=VARCHAR}, type_enum = #{typeEnum,jdbcType=VARCHAR},
is_distribute = #{isDistribute,jdbcType=TINYINT},
is_del = #{isDel,jdbcType=TINYINT}, is_del = #{isDel,jdbcType=TINYINT},
is_stock = #{isStock,jdbcType=TINYINT}, is_stock = #{isStock,jdbcType=TINYINT},
is_pause_sale = #{isPauseSale,jdbcType=TINYINT}, is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
freight_id = #{freightId,jdbcType=BIGINT},
strategy_type = #{strategyType,jdbcType=VARCHAR},
strategy_id = #{strategyId,jdbcType=INTEGER},
is_vip = #{isVip,jdbcType=TINYINT},
is_delete = #{isDelete,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=BIGINT}, updated_at = #{updatedAt,jdbcType=BIGINT},
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
real_sales_number = #{realSalesNumber,jdbcType=INTEGER}, real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
sales_number = #{salesNumber,jdbcType=INTEGER},
thumb_count = #{thumbCount,jdbcType=INTEGER},
store_count = #{storeCount,jdbcType=INTEGER},
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
furnish_express = #{furnishExpress,jdbcType=INTEGER},
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
furnish_vir = #{furnishVir,jdbcType=INTEGER},
is_combo = #{isCombo,jdbcType=TINYINT},
is_show_cash = #{isShowCash,jdbcType=TINYINT},
is_show_mall = #{isShowMall,jdbcType=TINYINT},
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
enable_label = #{enableLabel,jdbcType=TINYINT},
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}, spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
stock_number = #{stockNumber,jdbcType=INTEGER}, stock_number = #{stockNumber,jdbcType=INTEGER},
warn_line = #{warnLine,jdbcType=INTEGER} warn_line = #{warnLine,jdbcType=INTEGER}
@ -908,7 +473,7 @@
</update> </update>
<select id="selectByShopId" resultMap="ResultMapWithBLOBs"> <select id="selectByShopId" resultMap="ResultMapWithBLOBs">
select * from tb_product where shop_id=#{shopId} and status=1 and is_show_cash = 1 and type_enum in ('normal','sku','currentPrice','weight') select * from tb_product where shop_id=#{shopId} and status=1 and type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and name like CONCAT('%',#{commdityName},'%') and name like CONCAT('%',#{commdityName},'%')
</if> </if>
@ -918,7 +483,7 @@
<select id="selectByShopIdAndCheckGrounding" resultMap="ResultMapWithBLOBs"> <select id="selectByShopIdAndCheckGrounding" resultMap="ResultMapWithBLOBs">
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status=1 and a.type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')
</if> </if>
@ -929,7 +494,7 @@
<select id="selectByShopIdAndShopType" resultMap="ResultMapWithBLOBs"> <select id="selectByShopIdAndShopType" resultMap="ResultMapWithBLOBs">
select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and is_show_cash = 1 and type_enum in ('normal','sku','currentPrice','weight') select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and name like CONCAT('%',#{commdityName},'%') and name like CONCAT('%',#{commdityName},'%')
@ -943,7 +508,7 @@
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')
@ -955,7 +520,7 @@
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status=1 and a.type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')