Merge remote-tracking branch 'origin/test' into dev

This commit is contained in:
Tankaikai
2024-12-09 10:11:03 +08:00
7 changed files with 59 additions and 17 deletions

View File

@@ -259,12 +259,16 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(), balance,
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null,
"0", detailList, orderInfo.getRemark(), totalDiscountAmount,
orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
detailPO.setOutNumber(orderInfo.getOutNumber());
@@ -616,13 +620,17 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(),
"普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId())
? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(),
balance, orderInfo.getPayType(), "0",
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(),
detailList, orderInfo.getRemark(), totalDiscountAmount,
orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
String printType = "退款单";
@@ -680,7 +688,11 @@ public class PrintMechineConsumer {
}
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", originAmount.toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", originAmount.toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
String printType = "结算单";
if ("return".equals(orderInfo.getOrderType())) {

View File

@@ -1,6 +1,7 @@
package com.chaozhanggui.system.cashierservice.rabbit.print;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@@ -81,12 +82,16 @@ public class FeiPrinter extends PrinterHandler {
protected void returnOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId());
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(), balance,
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
"0", detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
String printType = "退款单";
log.error("打印数据3>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
String printerNum = "1";
@@ -102,12 +107,16 @@ public class FeiPrinter extends PrinterHandler {
protected void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId());
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(), balance,
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
"0", detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
String printType = "结算单";
log.error("打印数据1>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
String printerNum = "1";

View File

@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.rabbit.print;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -110,12 +111,16 @@ public class YxyPrinter extends PrinterHandler {
protected void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
getPickupNum(orderInfo),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(), balance,
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null,
"0", detailList, orderInfo.getRemark(), totalDiscountAmount,
orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
detailPO.setOutNumber(orderInfo.getOutNumber());
String printType = "结算单";

View File

@@ -298,11 +298,15 @@ public class CloudPrinterService {
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(), balance, orderInfo.getPayType(), "0",
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
detailPO.setOutNumber(orderInfo.getOutNumber());
String printType = "退款单";
@@ -371,12 +375,16 @@ public class CloudPrinterService {
}
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(),
balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0",
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null, orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
String printType = "结算单";
detailPO.setOutNumber(orderInfo.getOutNumber());
@@ -492,12 +500,16 @@ public class CloudPrinterService {
}
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = NumberUtil.null2Zero(orderInfo.getDiscountAmount());
BigDecimal fullCouponDiscountAmount = NumberUtil.null2Zero(orderInfo.getFullCouponDiscountAmount());
BigDecimal pointsDiscountAmount = NumberUtil.null2Zero(orderInfo.getPointsDiscountAmount());
String totalDiscountAmount = NumberUtil.add(discountAmount, fullCouponDiscountAmount, pointsDiscountAmount).toPlainString();
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
"【POS-1】001", originAmount.toPlainString(),
balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
"0", detailList, orderInfo.getRemark(), totalDiscountAmount, orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
String printType = "结算单";
if (ispre) {
printType = "预结算单";

View File

@@ -282,7 +282,7 @@ public class FeieyunPrintUtil {
}
data.append(StrUtil.format("余额:{}<BR>", toPlainStr(detailPO.getBalance())));
data.append("--------------------------------<BR>");
if (ObjectUtil.isNotEmpty(detailPO.getRemark()) && ObjectUtil.isNotNull(detailPO.getRemark())) {
if (StrUtil.isNotBlank(detailPO.getRemark())) {
data.append(StrUtil.format("<L><BOLD>备注:{}</BOLD></L><BR>", detailPO.getRemark()));
}
data.append("打印时间:" + DateUtils.getTime(new Date()) + "<BR>");

View File

@@ -178,7 +178,9 @@ public class PrinterUtils {
}
data.append(StrUtil.format("<S>余额:{}</S><BR>", toPlainStr(detailPO.getBalance())));
data.append("<S>--------------------------------</S><BR>");
if (StrUtil.isNotBlank(detailPO.getRemark())) {
data.append(StrUtil.format("<L><BOLD>备注:{}</BOLD></L><BR>", detailPO.getRemark()));
}
if (Objects.nonNull(detailPO.getOutNumber())) {
data.append("<QR>".concat(detailPO.getOutNumber()).concat("</QR><BR>"));
}

View File

@@ -48,6 +48,8 @@
<result column="table_name" jdbcType="VARCHAR" property="tableName"/>
<result column="out_number" jdbcType="VARCHAR" property="outNumber"/>
<result column="use_type" jdbcType="VARCHAR" property="useType"/>
<result column="full_coupon_discount_amount" jdbcType="DECIMAL" property="fullCouponDiscountAmount"/>
<result column="points_discount_amount" jdbcType="DECIMAL" property="pointsDiscountAmount"/>
</resultMap>
@@ -57,7 +59,7 @@
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,remark,master_id,`table_name`,out_number, use_type
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,remark,master_id,`table_name`,out_number, use_type, full_coupon_discount_amount, points_discount_amount
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select