Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -115,7 +115,7 @@ public class TbCashierCart implements Serializable {
|
||||
} else {
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
}
|
||||
totalAmount = totalNumber.multiply(subtract.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : subtract).add(packFee);
|
||||
totalAmount = totalNumber.multiply(subtract.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : subtract).add(packFee).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ public class TbCashierCart implements Serializable {
|
||||
BigDecimal subtract;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
subtract = memberPrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
totalAmount = totalNumber.multiply(subtract).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
} else {
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract)
|
||||
.add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
.add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,9 +165,9 @@ public class TbCashierCart implements Serializable {
|
||||
}
|
||||
|
||||
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);
|
||||
return num.multiply(memberPrice).multiply(discountRadio).add(packFee).setScale(2, RoundingMode.DOWN);
|
||||
}else {
|
||||
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// return num.multiply(memberPrice);
|
||||
|
||||
@@ -380,7 +380,6 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
@@ -396,99 +395,86 @@ public class OrderService {
|
||||
}
|
||||
|
||||
|
||||
if (Objects.nonNull(cart) && cart.getGroupType() != null && cart.getGroupType() == 0) {
|
||||
//查询现有规格商品
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
cart.setTotalNumber(number);
|
||||
cart.resetTotalAmount();
|
||||
cart.setUuid(uuid);
|
||||
cart.setIsPrint(isPrint);
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
|
||||
TbCashierCart cashierCart = getCashierInfo(shopId, skuId, productId, tableId, masterId, shopEatTypeInfoDTO);
|
||||
if (type.equals("add") || cashierCart == null || (cart != null && cart.getGroupType() != null && cart.getGroupType() == 1)) {
|
||||
cashierCart = new TbCashierCart();
|
||||
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
||||
if (product != null) {
|
||||
cashierCart.setCoverImg(product.getCoverImg());
|
||||
cashierCart.setIsSku(product.getTypeEnum());
|
||||
cashierCart.setName(product.getName());
|
||||
cashierCart.setCategoryId(product.getCategoryId());
|
||||
cashierCart.setTypeEnum(product.getTypeEnum());
|
||||
cashierCart.setGroupType(product.getGroupType());
|
||||
}
|
||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||
cashierCart.setMasterId(masterId);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setMerchantId(userId);
|
||||
cashierCart.setProductId(productId == null ? null : productId.toString());
|
||||
if (skuWithBLOBs != null) {
|
||||
cashierCart.setSalePrice(skuWithBLOBs.getSalePrice());
|
||||
cashierCart.setSkuId(skuWithBLOBs.getId().toString());
|
||||
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
||||
cashierCart.setMemberPrice(skuWithBLOBs.getMemberPrice());
|
||||
cashierCart.setIsMember(0);
|
||||
}
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.setShopId(shopId.toString());
|
||||
cashierCart.setTradeDay(DateUtils.getDay());
|
||||
cashierCart.setStatus("create");
|
||||
cashierCart.setIsPack(isPack);
|
||||
cashierCart.setIsGift(isGift);
|
||||
if (isGift.equals("false")) {
|
||||
if (isSeatCart) {
|
||||
cashierCart.setTotalAmount(number.multiply(cashierCart.getSalePrice()));
|
||||
} else {
|
||||
cashierCart.setTotalAmount(number.multiply(skuWithBLOBs.getSalePrice()));
|
||||
}
|
||||
} else {
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (isPack.equals("false")) {
|
||||
cashierCart.setPackFee(BigDecimal.ZERO);
|
||||
} else {
|
||||
if (!isSeatCart) {
|
||||
cashierCart.setPackFee(number.multiply(product == null ? BigDecimal.ZERO : product.getPackFee()));
|
||||
}
|
||||
cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee()));
|
||||
|
||||
}
|
||||
cashierCart.setTotalNumber(number);
|
||||
cashierCart.setUserId(Integer.valueOf(userId));
|
||||
cashierCart.setNumber(number);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setTableId(tableId);
|
||||
cashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue());
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cashierCart);
|
||||
}
|
||||
list.add(cashierCart);
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
}else {
|
||||
cashierCart.setNumber(number);
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cashierCart);
|
||||
}
|
||||
cashierCart.setTotalNumber(number);
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.setIsPack(isPack);
|
||||
cashierCart.resetTotalAmount();
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.resetTotalAmount();
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cart);
|
||||
}
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = getCashierInfo(shopId, skuId, productId, tableId, masterId, shopEatTypeInfoDTO);
|
||||
// 不存在新增
|
||||
if (Objects.isNull(cashierCart) || (cart != null && cart.getGroupType() != null && cart.getGroupType() == 1)) {
|
||||
cashierCart = new TbCashierCart();
|
||||
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
||||
if (product != null) {
|
||||
cashierCart.setCoverImg(product.getCoverImg());
|
||||
cashierCart.setIsSku(product.getTypeEnum());
|
||||
cashierCart.setName(product.getName());
|
||||
cashierCart.setCategoryId(product.getCategoryId());
|
||||
cashierCart.setTypeEnum(product.getTypeEnum());
|
||||
cashierCart.setGroupType(product.getGroupType());
|
||||
}
|
||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||
cashierCart.setMasterId(masterId);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setMerchantId(userId);
|
||||
cashierCart.setProductId(productId == null ? null : productId.toString());
|
||||
if (skuWithBLOBs != null) {
|
||||
cashierCart.setSalePrice(skuWithBLOBs.getSalePrice());
|
||||
cashierCart.setSkuId(skuWithBLOBs.getId().toString());
|
||||
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
||||
cashierCart.setMemberPrice(skuWithBLOBs.getMemberPrice());
|
||||
cashierCart.setIsMember(0);
|
||||
}
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.setShopId(shopId.toString());
|
||||
cashierCart.setTradeDay(DateUtils.getDay());
|
||||
cashierCart.setStatus("create");
|
||||
cashierCart.setIsPack(isPack);
|
||||
cashierCart.setIsGift(isGift);
|
||||
if (isGift.equals("false")) {
|
||||
if (isSeatCart) {
|
||||
cashierCart.setTotalAmount(number.multiply(cashierCart.getSalePrice()));
|
||||
} else {
|
||||
cashierCart.setTotalAmount(number.multiply(skuWithBLOBs.getSalePrice()));
|
||||
}
|
||||
} else {
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (isPack.equals("false")) {
|
||||
cashierCart.setPackFee(BigDecimal.ZERO);
|
||||
} else {
|
||||
if (!isSeatCart) {
|
||||
cashierCart.setPackFee(number.multiply(product == null ? BigDecimal.ZERO : product.getPackFee()));
|
||||
}
|
||||
cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee()));
|
||||
|
||||
}
|
||||
cashierCart.setTotalNumber(number);
|
||||
cashierCart.setUserId(Integer.valueOf(userId));
|
||||
cashierCart.setNumber(number);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setTableId(tableId);
|
||||
cashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue());
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cashierCart);
|
||||
}
|
||||
list.add(cashierCart);
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
} else {
|
||||
if (type.equals("add")) {
|
||||
cashierCart.setNumber(cashierCart.getNumber().add(number));
|
||||
} else {
|
||||
cashierCart.setNumber(number);
|
||||
}
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cashierCart);
|
||||
}
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.resetTotalAmount();
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
|
||||
cart = cashierCart;
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
|
||||
|
||||
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), true);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
|
||||
Reference in New Issue
Block a user