店铺管理-店铺配置:打印机设置相关接口

This commit is contained in:
谭凯凯 2024-10-12 10:42:45 +08:00 committed by Tankaikai
parent b7205fca9a
commit 3b77cfb33d
6 changed files with 263 additions and 223 deletions

View File

@ -77,6 +77,14 @@ public class TbPrintPCMachine implements Serializable {
*/
private String productId;
private String receiptSize;
private String classifyPrint;
private String tablePrint;
private String printQty;
private String printMethod;
private String printType;
private String printReceipt;
private Integer pageSize;
private Integer page;
@ -242,5 +250,60 @@ public class TbPrintPCMachine implements Serializable {
this.productId = productId;
}
public String getReceiptSize() {
return receiptSize;
}
public void setReceiptSize(String receiptSize) {
this.receiptSize = receiptSize;
}
public String getClassifyPrint() {
return classifyPrint;
}
public void setClassifyPrint(String classifyPrint) {
this.classifyPrint = classifyPrint;
}
public String getTablePrint() {
return tablePrint;
}
public void setTablePrint(String tablePrint) {
this.tablePrint = tablePrint;
}
public String getPrintQty() {
return printQty;
}
public void setPrintQty(String printQty) {
this.printQty = printQty;
}
public String getPrintMethod() {
return printMethod;
}
public void setPrintMethod(String printMethod) {
this.printMethod = printMethod;
}
public String getPrintType() {
return printType;
}
public void setPrintType(String printType) {
this.printType = printType;
}
public String getPrintReceipt() {
return printReceipt;
}
public void setPrintReceipt(String printReceipt) {
this.printReceipt = printReceipt;
}
}

View File

@ -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;

View File

@ -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":
@ -379,6 +373,7 @@ public class PrintMechineConsumer {
/**
* 打印退款订单
*
* @param orderId 订单id
* @param tbOrderDetails 现有订单
*/
@ -423,13 +418,10 @@ public class PrintMechineConsumer {
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"))) {
String printMethod = machine.getPrintMethod();
if (!"one".equals(printMethod)) {
continue;
}
}
log.info("-------------------商品数量{}", printProductSet.size());
printProductSet.forEach(item -> {
log.info("已删除订单,打印退款票据, {}", item);

View File

@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
@ -64,8 +65,6 @@ public class CloudPrinterService {
ShopUserDutyPayMapper shopUserDutyPayMapper;
public Result printReceipt(String type, String orderId, Boolean ispre) {
try {
@ -100,16 +99,11 @@ public class CloudPrinterService {
return;
}
JSONObject config = JSONObject.parseObject(tbPrintMachineWithBLOBs.getConfig());
String model = config.getString("model");
String model = tbPrintMachineWithBLOBs.getPrintMethod();
String printerNum = config.getString("printerNum");
String printerNum = StrUtil.isEmpty(tbPrintMachineWithBLOBs.getPrintQty()) ? "1" : tbPrintMachineWithBLOBs.getPrintQty().split("^")[1];
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(tbPrintMachineWithBLOBs.getCategoryList(),"[]"), CategoryInfo.class);
switch (tbPrintMachineWithBLOBs.getContentType()) {
case "yxyPrinter":
@ -131,10 +125,9 @@ public class CloudPrinterService {
}
/**
* 博时结云打印机
*
* @param tbPrintMachineWithBLOBs
* @param model
* @param orderInfo
@ -291,7 +284,6 @@ public class CloudPrinterService {
}
if ("return".equals(orderInfo.getOrderType())) {
List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
if (ObjectUtil.isNotEmpty(details) && details.size() > 0) {
@ -344,8 +336,6 @@ public class CloudPrinterService {
}
String data = PrinterUtils.getPrintData("", orderInfo.getOrderType().equals("miniapp") ?
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
@ -373,8 +363,6 @@ public class CloudPrinterService {
}
private Result fePrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos, String type, Boolean ispre) {
String orderId = orderInfo.getId().toString();
switch (tbPrintMachineWithBLOBs.getSubType()) {
@ -653,8 +641,6 @@ public class CloudPrinterService {
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(), "会员卡充值"));
List<Map<String, Object>> categries = shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
if (ObjectUtil.isNotEmpty(categries) && categries.size() > 0) {
productCategories = JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries), HandoverInfo.ProductCategory.class);
@ -687,19 +673,12 @@ public class CloudPrinterService {
PrinterUtils.printTickets(voiceJson, 1, 1, it.getAddress(), PrinterUtils.handoverprintData(handoverInfo));
});
return Result.success(CodeEnum.SUCCESS);
}
public Result printInvoice(String shopId, String content, String remark, String amount) {
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(shopId);
@ -732,5 +711,4 @@ public class CloudPrinterService {
}
}

View File

@ -273,8 +273,7 @@ public class DataService {
JSONObject config = JSONObject.parseObject(it.getConfig());
String model = config.getString("model");
String model = it.getPrintMethod();
if(!"normal".equals(model)){
log.error("打印机类型错误");
return;

View File

@ -21,11 +21,19 @@
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="vendorId" column="vendor_id" jdbcType="VARCHAR"/>
<result property="productId" column="product_id" jdbcType="VARCHAR"/>
<result column="receipt_size" jdbcType="VARCHAR" property="receiptSize" />
<result column="classify_print" jdbcType="VARCHAR" property="classifyPrint" />
<result column="table_print" jdbcType="VARCHAR" property="tablePrint" />
<result column="print_qty" jdbcType="VARCHAR" property="printQty" />
<result column="print_method" jdbcType="VARCHAR" property="printMethod" />
<result column="print_type" jdbcType="VARCHAR" property="printType" />
<result column="print_receipt" jdbcType="VARCHAR" property="printReceipt" />
</resultMap>
<sql id="Base_Column_List">
id
, name, type, connection_type, address, port, sub_type, status, shop_id, category_ids, content_type, config, created_at, updated_at, category_list, sort, vendor_id, product_id </sql>
, name, type, connection_type, address, port, sub_type, status, shop_id, category_ids, content_type, config, created_at, updated_at, category_list, sort, vendor_id, product_id, receipt_size, classify_print, table_print, print_qty, print_method, print_type, print_receipt </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbPrintMachineMap">