Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -49,6 +49,9 @@ public abstract class PrinterHandler {
|
|||||||
@Setter
|
@Setter
|
||||||
protected PrinterHandler nextPrinter;
|
protected PrinterHandler nextPrinter;
|
||||||
protected String printerBrand;
|
protected String printerBrand;
|
||||||
|
// 创建 ThreadLocal 变量
|
||||||
|
private static final ThreadLocal<String> ERR_MSG = ThreadLocal.withInitial(() -> "");
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected OrderDetailService orderDetailService;
|
protected OrderDetailService orderDetailService;
|
||||||
@@ -175,7 +178,7 @@ public abstract class PrinterHandler {
|
|||||||
* @param printTypeEnum order returnOrder preOrder one call handover
|
* @param printTypeEnum order returnOrder preOrder one call handover
|
||||||
*/
|
*/
|
||||||
public void handler(String data, PrintTypeEnum printTypeEnum) {
|
public void handler(String data, PrintTypeEnum printTypeEnum) {
|
||||||
Long shopId = null;
|
Long shopId;
|
||||||
String printMethod = "";
|
String printMethod = "";
|
||||||
String printType = "";
|
String printType = "";
|
||||||
Object obj;
|
Object obj;
|
||||||
@@ -280,11 +283,11 @@ public abstract class PrinterHandler {
|
|||||||
item.setReturnNum(item.getReturnNum() == null ? BigDecimal.ZERO : item.getReturnNum());
|
item.setReturnNum(item.getReturnNum() == null ? BigDecimal.ZERO : item.getReturnNum());
|
||||||
PrintDetailInfo printDetailInfo = o != null ? JSONObject.parseObject((String) o, PrintDetailInfo.class) : null;
|
PrintDetailInfo printDetailInfo = o != null ? JSONObject.parseObject((String) o, PrintDetailInfo.class) : null;
|
||||||
if (printDetailInfo != null) {
|
if (printDetailInfo != null) {
|
||||||
if (item.getNum().compareTo(printDetailInfo.getPrintNum()) <= 0) {
|
if (item.getNum().compareTo(BigDecimal.ZERO) != 0 && item.getNum().compareTo(printDetailInfo.getPrintNum()) <= 0) {
|
||||||
log.info("此菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
log.info("此菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getReturnNum().compareTo(printDetailInfo.getPrintReturnNum()) <= 0) {
|
if (item.getReturnNum().compareTo(BigDecimal.ZERO) != 0 && item.getReturnNum().compareTo(printDetailInfo.getPrintReturnNum()) <= 0) {
|
||||||
log.info("此退菜菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
log.info("此退菜菜品已打印, {} {} {}", item.getProductName(), item.getSkuName(), printDetailInfo);
|
||||||
}
|
}
|
||||||
item.setNum(item.getNum().subtract(printDetailInfo.getPrintNum()));
|
item.setNum(item.getNum().subtract(printDetailInfo.getPrintNum()));
|
||||||
@@ -383,6 +386,9 @@ public abstract class PrinterHandler {
|
|||||||
Map<Long, OrderDetail> detailMap = tbOrderDetailList.stream().map(item -> BeanUtil.copyProperties(item, OrderDetail.class)).collect(Collectors.toMap(OrderDetail::getId, i -> i));
|
Map<Long, OrderDetail> detailMap = tbOrderDetailList.stream().map(item -> BeanUtil.copyProperties(item, OrderDetail.class)).collect(Collectors.toMap(OrderDetail::getId, i -> i));
|
||||||
tbOrderDetailList = getCanPrintOrderDetails("1".equals(machine.getClassifyPrint()), orderInfo.getId(), tbOrderDetailList, categoryIds);
|
tbOrderDetailList = getCanPrintOrderDetails("1".equals(machine.getClassifyPrint()), orderInfo.getId(), tbOrderDetailList, categoryIds);
|
||||||
tbOrderDetailList.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(item -> {
|
tbOrderDetailList.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(item -> {
|
||||||
|
if (item.getNum().compareTo(BigDecimal.ZERO) <= 0 && item.getReturnNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
log.info("开始打印菜品,商品名:{}", item.getProductName());
|
log.info("开始打印菜品,商品名:{}", item.getProductName());
|
||||||
Integer isWaitCall = ObjectUtil.defaultIfNull(item.getIsWaitCall(), 0);
|
Integer isWaitCall = ObjectUtil.defaultIfNull(item.getIsWaitCall(), 0);
|
||||||
if (isWaitCall == 1) {
|
if (isWaitCall == 1) {
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
|
|
||||||
Map<Integer, String> yxxStatusMap = MapUtil.builder(0, "离线(设备上线后自动补打)").put(1, "在线").put(2, "获取失败").put(3, "未激活").put(4, "设备已禁用").build();
|
Map<Integer, String> yxxStatusMap = MapUtil.builder(0, "离线(设备上线后自动补打)").put(1, "在线").put(2, "获取失败").put(3, "未激活").put(4, "设备已禁用").build();
|
||||||
// 云想印
|
// 云想印
|
||||||
if ("yxyPrinter".equals(config.getContentType())) {
|
if ("云享印".equals(config.getContentType())) {
|
||||||
cn.hutool.json.JSONObject resp = JSONUtil.parseObj(respJson);
|
cn.hutool.json.JSONObject resp = JSONUtil.parseObj(respJson);
|
||||||
int code = resp.getInt("code");
|
int code = resp.getInt("code");
|
||||||
cn.hutool.json.JSONObject data = resp.getJSONObject("data").getJSONObject("data");
|
cn.hutool.json.JSONObject data = resp.getJSONObject("data").getJSONObject("data");
|
||||||
@@ -203,7 +203,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
entity.setTaskId(taskId);
|
entity.setTaskId(taskId);
|
||||||
}
|
}
|
||||||
// 飞鹅云打印机暂时没有适配,先return不做打印记录
|
// 飞鹅云打印机暂时没有适配,先return不做打印记录
|
||||||
} else if ("fePrinter".equals(config.getContentType())) {
|
} else if ("飞鹅".equals(config.getContentType())) {
|
||||||
cn.hutool.json.JSONObject resp = JSONUtil.parseObj(respJson);
|
cn.hutool.json.JSONObject resp = JSONUtil.parseObj(respJson);
|
||||||
int ret = resp.getInt("ret");
|
int ret = resp.getInt("ret");
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -235,7 +235,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
super.save(entity);
|
super.save(entity);
|
||||||
|
|
||||||
// 云想印
|
// 云想印
|
||||||
if ("yxyPrinter".equals(config.getContentType())) {
|
if ("云享印".equals(config.getContentType())) {
|
||||||
// 延迟3ms,复查打印状态 (用户可以根据设备信息查询到当前设备的在线情况(注:该接口只能提供参考,设备的离线状态是在设备离线3分钟后才会生效))
|
// 延迟3ms,复查打印状态 (用户可以根据设备信息查询到当前设备的在线情况(注:该接口只能提供参考,设备的离线状态是在设备离线3分钟后才会生效))
|
||||||
ThreadUtil.safeSleep(1000 * 5);
|
ThreadUtil.safeSleep(1000 * 5);
|
||||||
String jsonStr = checkPrintStatus(config.getAddress(), entity.getTaskId());
|
String jsonStr = checkPrintStatus(config.getAddress(), entity.getTaskId());
|
||||||
@@ -269,7 +269,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
|
|||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
}
|
}
|
||||||
// 飞鹅云打印机
|
// 飞鹅云打印机
|
||||||
} else if ("fePrinter".equals(config.getContentType())) {
|
} else if ("飞鹅".equals(config.getContentType())) {
|
||||||
ThreadUtil.safeSleep(1000 * 5);
|
ThreadUtil.safeSleep(1000 * 5);
|
||||||
Boolean success = checkFPrintStatus(entity.getTaskId());
|
Boolean success = checkFPrintStatus(entity.getTaskId());
|
||||||
if (success == null) {
|
if (success == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user