店铺管理-店铺配置:打印机设置相关接口
This commit is contained in:
@@ -152,8 +152,8 @@ public class PrintConsumer {
|
||||
}
|
||||
|
||||
list = list.stream()
|
||||
.filter(item -> StrUtil.isNotBlank(item.getConfig())
|
||||
&& model.equals(JSONObject.parseObject(item.getConfig()).getString("model"))).collect(Collectors.toList());
|
||||
.filter(item -> StrUtil.isNotBlank(item.getPrintMethod())
|
||||
&& model.equals(item.getPrintMethod())).collect(Collectors.toList());
|
||||
log.info("打印机列表: {}", list);
|
||||
return list;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
@@ -18,9 +17,10 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -103,16 +103,10 @@ public class PrintMechineConsumer {
|
||||
log.error("打印机状态异常:{},{}", it.getAddress(), it.getStatus());
|
||||
return;
|
||||
}
|
||||
String model = StrUtil.isEmpty(it.getPrintMethod()) ? "normal" : it.getPrintMethod();
|
||||
String printerNum = StrUtil.isEmpty(it.getPrintQty()) ? "1" : it.getPrintQty().split("^")[1];
|
||||
|
||||
JSONObject config = JSONObject.parseObject(it.getConfig());
|
||||
String model = config.getString("model");
|
||||
|
||||
String printerNum = config.getString("printerNum");
|
||||
|
||||
String feet = config.getString("feet");
|
||||
|
||||
String autoCut = config.getString("autoCut");
|
||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(config.getJSONArray("categoryList").toString(), CategoryInfo.class);
|
||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(StrUtil.emptyToDefault(it.getCategoryList(), "[]"), CategoryInfo.class);
|
||||
|
||||
switch (it.getContentType()) {
|
||||
case "yxyPrinter":
|
||||
@@ -313,7 +307,7 @@ public class PrintMechineConsumer {
|
||||
if (info != null) {
|
||||
isReturn = it.getNum() - Integer.parseInt(info) < 0;
|
||||
printerNum = it.getNum() - Integer.parseInt(info);
|
||||
}else {
|
||||
} else {
|
||||
printerNum = it.getNum();
|
||||
}
|
||||
|
||||
@@ -379,7 +373,8 @@ public class PrintMechineConsumer {
|
||||
|
||||
/**
|
||||
* 打印退款订单
|
||||
* @param orderId 订单id
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @param tbOrderDetails 现有订单
|
||||
*/
|
||||
public void printReturnTicket(Integer orderId, List<TbOrderDetail> tbOrderDetails) {
|
||||
@@ -416,19 +411,16 @@ public class PrintMechineConsumer {
|
||||
for (Object o : printProductSetCopy) {
|
||||
redisTemplate.opsForSet().add(printKey, o);
|
||||
}
|
||||
}else if (tbOrderDetails != null) {
|
||||
} else if (tbOrderDetails != null) {
|
||||
redisTemplate.delete(printKey);
|
||||
}
|
||||
|
||||
log.info("-------------------打印机数量{}", list.size());
|
||||
for (TbPrintMachine machine : list) {
|
||||
|
||||
String config = machine.getConfig();
|
||||
if (config != null) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(config);
|
||||
if (!"one".equals(jsonObject.getString("model"))) {
|
||||
continue;
|
||||
}
|
||||
String printMethod = machine.getPrintMethod();
|
||||
if (!"one".equals(printMethod)) {
|
||||
continue;
|
||||
}
|
||||
log.info("-------------------商品数量{}", printProductSet.size());
|
||||
printProductSet.forEach(item -> {
|
||||
@@ -619,7 +611,7 @@ public class PrintMechineConsumer {
|
||||
|
||||
String data = PrinterUtils.getCashPrintData(detailPO, printType, "return");
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
PrinterUtils.printTickets(voiceJson, 1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user