过滤空值
This commit is contained in:
@@ -50,28 +50,6 @@ public class RabbitPublisher {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_REFUND_QUEUE, refundMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后付费订单打印消息
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @param before 0后付费/1先付费
|
||||
* @param status 订单状态 0未完成/1完成
|
||||
* @param placeNum 第几次下单
|
||||
* @param printOrder 是否打印结算单
|
||||
*/
|
||||
public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, boolean printOrder, String source) {
|
||||
log.info("订单打印消息, orderId:{},{},{},第:{}次下单,通知本地:{},source:{}",
|
||||
orderId, before == 0 ? "后付" : "先付", status == 0 ? "未完成" : "完成", placeNum, printOrder, source);
|
||||
String sendOrderId = orderId + "_" + before + "_" + status + "_" + placeNum;
|
||||
//本地打印机 消息通知
|
||||
if (printOrder) {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, sendOrderId);
|
||||
}
|
||||
//厨房单 printOrder 表示打不打结算单
|
||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", sendOrderId).fluentPut("printOrder", printOrder).toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品信息变动消息
|
||||
*
|
||||
@@ -137,15 +115,12 @@ public class RabbitPublisher {
|
||||
)));
|
||||
}
|
||||
|
||||
private void sendMsg(String queue, String msg) {
|
||||
log.info("开始发送mq消息,exchange:{}, queue: {}, msg: {}", activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 其它类型 打印消息
|
||||
* STOCK 出入库
|
||||
* DAY_REPORT 经营日报
|
||||
* DAY_ORDER 日结单
|
||||
* PRODUCT_REPORT 商品报表
|
||||
* RECHARGE 储值单
|
||||
* STOCK_CHECK 库存盘点
|
||||
@@ -155,23 +130,73 @@ public class RabbitPublisher {
|
||||
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
|
||||
*/
|
||||
public void sendOtherPrintMsg(Long shopId, Object data, String printType) {
|
||||
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
|
||||
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", shopId);
|
||||
jsonObject.put("data", data);
|
||||
jsonObject.put("printTypeEnum", printType);
|
||||
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString());
|
||||
sendMsg(RabbitConstants.Queue.OTHER_PRINT_QUEUE, jsonObject.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 后付费订单打印消息
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @param before 0后付费/1先付费
|
||||
* @param status 订单状态 0未完成/1完成
|
||||
* @param placeNum 第几次下单
|
||||
*/
|
||||
public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, String source) {
|
||||
log.info("订单打印消息, orderId:{},{},{},第:{}次下单,source:{}",
|
||||
orderId, before == 0 ? "后付" : "先付", status == 0 ? "未完成" : "完成", placeNum, source);
|
||||
String sendOrderId = orderId + "_" + before + "_" + status + "_" + placeNum;
|
||||
//厨房单
|
||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", sendOrderId).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地打印机 订单消息通知
|
||||
*
|
||||
* @param shopId 店铺Id
|
||||
* @param orderId
|
||||
* @param placeNum
|
||||
* @param printTypeEnum
|
||||
* @param data
|
||||
*/
|
||||
public void sendOrderPrintLocalMsg(Long shopId, Long orderId, Integer placeNum, String printTypeEnum, String data, String operator) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", shopId);
|
||||
jsonObject.put("orderId", orderId);
|
||||
jsonObject.put("placeNum", placeNum);
|
||||
jsonObject.put("printType", printTypeEnum);
|
||||
jsonObject.put("data", data);
|
||||
jsonObject.put("operator", operator);
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, jsonObject.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 其它类型 打印消息
|
||||
* STOCK 出入库
|
||||
* DAY_REPORT 经营日报
|
||||
* DAY_ORDER 日结单
|
||||
* PRODUCT_REPORT 商品报表
|
||||
* RECHARGE 储值单
|
||||
* STOCK_CHECK 库存盘点
|
||||
* HANDOVER 交班单
|
||||
* CALL 排队取号
|
||||
*
|
||||
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
|
||||
*/
|
||||
public void sendOtherPrintLocalMsg(Long shopId, String printType, Long dataId) {
|
||||
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
|
||||
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", shopId);
|
||||
jsonObject.put("dataId", dataId);
|
||||
jsonObject.put("printType", printType);
|
||||
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString());
|
||||
sendMsg(RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE, jsonObject.toString());
|
||||
}
|
||||
|
||||
|
||||
private void sendMsg(String queue, String msg) {
|
||||
log.info("开始发送mq消息,exchange:{}, queue: {}, msg: {}", activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user