空指针 问题
This commit is contained in:
@@ -12,9 +12,11 @@ import com.czg.order.entity.MqLog;
|
||||
import com.czg.order.entity.SysPrintData;
|
||||
import com.czg.order.service.MqLogService;
|
||||
import com.czg.order.service.SysPrintDataService;
|
||||
import com.czg.print.StockPrintDTO;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.order.print.PrintConfig;
|
||||
import com.czg.service.order.print.PrinterHandler;
|
||||
import com.czg.utils.FunUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
@@ -100,9 +102,11 @@ public class PrintMqListener {
|
||||
Long shopId = jsonObject.getLong("shopId");
|
||||
String printTypeEnum = jsonObject.getString("printTypeEnum");
|
||||
JSONObject data2 = jsonObject.getJSONObject("data");
|
||||
JSONArray data3 = null;
|
||||
JSONArray data3;
|
||||
if (data2 == null) {
|
||||
data3 = jsonObject.getJSONArray("data");
|
||||
} else {
|
||||
data3 = null;
|
||||
}
|
||||
PrinterHandler.PrintTypeEnum typeEnum = PrinterHandler.PrintTypeEnum.valueOf(printTypeEnum);
|
||||
if (typeEnum != PrinterHandler.PrintTypeEnum.HANDOVER) {
|
||||
@@ -117,6 +121,6 @@ public class PrintMqListener {
|
||||
printDataService.save(sysPrintData);
|
||||
rabbitPublisher.sendOtherPrintLocalMsg(shopId, printTypeEnum, sysPrintData.getId());
|
||||
}
|
||||
printConfig.otherHandler(shopId, data2, data3, typeEnum);
|
||||
FunUtils.asyncSafeRunVoid(() -> printConfig.otherHandler(shopId, data2, data3, typeEnum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,10 +554,11 @@ public interface PrinterImpl {
|
||||
List<StockPrintDTO.InStockItem> items = record.getItems();
|
||||
if (CollUtil.isNotEmpty(items)) {
|
||||
for (StockPrintDTO.InStockItem item : items) {
|
||||
String stockNumber = item.getStockNumber().stripTrailingZeros().toPlainString();
|
||||
String amount = item.getAmount().stripTrailingZeros().toPlainString();
|
||||
String stockNumber = bdToStr(item.getStockNumber());
|
||||
String amount = bdToStr(item.getAmount());
|
||||
|
||||
// 左对齐排版,保证列对齐
|
||||
String itemLine = key4(item.getConsName(), item.getUnit(), stockNumber, amount, 11, 9, 7);
|
||||
String itemLine = key4(item.getConsName(), StrUtil.isBlank(item.getUnit()) ? "" : item.getUnit(), stockNumber, amount, 11, 9, 7);
|
||||
builder.append(formatLabel(itemLine, signLabelInfo.s)).append(signLabelInfo.br);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user