diff --git a/cash-common/cash-common-service/src/main/java/com/czg/order/entity/PrintMachineLog.java b/cash-common/cash-common-service/src/main/java/com/czg/order/entity/PrintMachineLog.java index 4e3a1e8af..b3295cb48 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/order/entity/PrintMachineLog.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/order/entity/PrintMachineLog.java @@ -31,38 +31,43 @@ public class PrintMachineLog implements Serializable { private static final long serialVersionUID = 1L; /** - * id + * 主键ID */ @Id(keyType = KeyType.Auto) - private Long id; + private Integer id; /** - * 打印机类型 本地打印机-local USB打印机-USB 云打印机-network + * 店铺Id */ - private String connectionType; + private Long shopId; /** - * 打印机品牌 云想印 = yxyPrinter飞鹅 = fePrinter 本地 = local USB = printer - */ - private String contentType; - - /** - * 打印小票 标签-label 出品-kitchen 小票-cash - */ - private String subType; - - /** - * 打印机名称 + * 设备名称 */ private String name; /** - * IP地址/打印机编号 + * 连接方式 USB、云打印、局域网 + */ + private String connectionType; + + /** + * 打印类型 label标签 cash小票 + */ + private String printType; + + /** + * 打印机品牌 飞鹅/云想印 + */ + private String brand; + + /** + * ip地址/MAC地址 */ private String address; /** - * 端口/打印机秘钥 + * 端口 */ private String port; @@ -72,34 +77,14 @@ public class PrintMachineLog implements Serializable { private String receiptSize; /** - * 分类打印 0-所以 1-部分分类 2-部分商品 + * 打印数量 */ - private String classifyPrint; + private Integer printNum; /** - * 桌台打印 0-所有 1-部分 + * 打印内容类型 */ - private String tablePrint; - - /** - * 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3=顾客2+商家1[3张] - */ - private String printQty; - - /** - * 打印方式 normal-普通出单 one-一菜一品 callTicket-排队取号 - */ - private String printMethod; - - /** - * 打印类型 JSON数组字符串数据 1-确认退款单 2-交班单 3-排队取号,如:[1,2,3] - */ - private String printType; - - /** - * 打印票据 0-全部打印 1-仅厨房 2-仅前台 - */ - private String printReceipt; + private String printContentType; /** * 打印内容 @@ -107,33 +92,7 @@ public class PrintMachineLog implements Serializable { private String printContent; /** - * 店铺id - */ - private String shopId; - - /** - * 业务类型 - */ - private String bizType; - - /** - * 打印人id - */ - private Long createUserId; - - /** - * 打印人名称 - */ - private String createUserName; - - /** - * 打印任务创建时间 - */ - @Column(onInsertValue = "now()") - private LocalDateTime createTime; - - /** - * 打印任务id,用于复查打印状态,云想印=orderId + * 打印任务id,用于复查打印状态 */ private String taskId; @@ -157,4 +116,15 @@ public class PrintMachineLog implements Serializable { */ private String respMsg; + /** + * 创建时间 + */ + @Column(onInsertValue = "now()") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @Column(onUpdateValue = "now()") + private LocalDateTime updateTime; } diff --git a/cash-common/cash-common-service/src/main/java/com/czg/order/service/PrintMachineLogService.java b/cash-common/cash-common-service/src/main/java/com/czg/order/service/PrintMachineLogService.java index 5449bec74..fcd6167de 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/order/service/PrintMachineLogService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/order/service/PrintMachineLogService.java @@ -1,8 +1,8 @@ package com.czg.order.service; import com.czg.account.entity.PrintMachine; -import com.mybatisflex.core.service.IService; import com.czg.order.entity.PrintMachineLog; +import com.mybatisflex.core.service.IService; /** * 店铺小票打印记录 服务层。 diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/mapper/PrintMachineLogMapper.java b/cash-service/order-service/src/main/java/com/czg/service/order/mapper/PrintMachineLogMapper.java index 3a8e17a5c..aef4cce38 100644 --- a/cash-service/order-service/src/main/java/com/czg/service/order/mapper/PrintMachineLogMapper.java +++ b/cash-service/order-service/src/main/java/com/czg/service/order/mapper/PrintMachineLogMapper.java @@ -1,7 +1,7 @@ package com.czg.service.order.mapper; -import com.mybatisflex.core.BaseMapper; import com.czg.order.entity.PrintMachineLog; +import com.mybatisflex.core.BaseMapper; /** * 店铺小票打印记录 映射层。 diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PrintMachineLogServiceImpl.java b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PrintMachineLogServiceImpl.java index e3a69fe6c..5e0fe2837 100644 --- a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PrintMachineLogServiceImpl.java +++ b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PrintMachineLogServiceImpl.java @@ -2,29 +2,22 @@ package com.czg.service.order.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONObject; import com.czg.account.entity.PrintMachine; -import com.czg.config.RedisCst; -import com.czg.market.service.OrderInfoService; -import com.czg.order.entity.OrderInfo; import com.czg.order.entity.PrintMachineLog; import com.czg.order.service.PrintMachineLogService; -import com.czg.service.RedisService; import com.czg.service.order.mapper.PrintMachineLogMapper; import com.czg.service.order.print.FeiPrinter; import com.czg.service.order.print.YxyPrinter; import com.mybatisflex.spring.service.impl.ServiceImpl; import jakarta.annotation.Resource; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import java.time.LocalDateTime; import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -41,19 +34,14 @@ import java.util.concurrent.atomic.AtomicReference; */ @Slf4j @Service -@RequiredArgsConstructor public class PrintMachineLogServiceImpl extends ServiceImpl implements PrintMachineLogService { - @Resource - private OrderInfoService orderInfoService; @Lazy @Resource private YxyPrinter yxyPrinter; @Lazy @Resource private FeiPrinter feiPrinter; - @Resource - private RedisService redisService; Map yxxStatusMap = Map.of( 0, "离线(设备上线后自动补打)", @@ -125,7 +113,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl checkPrintStatus(orderId, config, entity)); + ThreadUtil.execAsync(() -> checkPrintStatus(config, entity)); } /** @@ -150,11 +138,10 @@ public class PrintMachineLogServiceImpl extends ServiceImpl { - OrderInfo orderInfo = orderInfoService.getOne(query().select(OrderInfo::getPrintStatus).eq(OrderInfo::getId, orderId)); - if (orderInfo == null) { - orderInfo = new OrderInfo(); - } - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", config.getId()); - jsonObject.put("name", config.getName()); - jsonObject.put("time", LocalDateTimeUtil.formatNormal(LocalDateTime.now())); - orderInfo.upPrintStatus(jsonObject, isPrintSuccess); - orderInfoService.update(orderInfo, query().eq(OrderInfo::getId, orderId)); - return orderInfo; - }, RedisCst.getLockKey("UP_ORDER_PRINT", orderId)); - redisService.del("order:print:" + orderId); - } - /** * 统一更新打印日志实体 *