فهرست منبع

fixed 小票打印-商品规格显示

fushengqian 1 ماه پیش
والد
کامیت
d955372aa6
1فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 15 1
      fuint-application/src/main/java/com/fuint/common/service/impl/PrinterServiceImpl.java

+ 15 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/PrinterServiceImpl.java

@@ -3,6 +3,7 @@ package com.fuint.common.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fuint.common.dto.GoodsSpecValueDto;
 import com.fuint.common.dto.OrderGoodsDto;
 import com.fuint.common.dto.UserOrderDto;
 import com.fuint.common.enums.*;
@@ -204,7 +205,20 @@ public class PrinterServiceImpl extends ServiceImpl<MtPrinterMapper, MtPrinter>
             // 商品列表
             if (orderInfo.getGoods() != null && orderInfo.getGoods().size() > 0) {
                 for (OrderGoodsDto goodsDto : orderInfo.getGoods()) {
-                     printContent.append(NoteFormatter.formatPrintOrderItemForNewLine80(goodsDto.getName(), goodsDto.getNum(), Double.parseDouble(goodsDto.getPrice())));
+                     List<GoodsSpecValueDto> specList = goodsDto.getSpecList();
+                     String name = goodsDto.getName();
+                     List<String> specValue = new ArrayList<>();
+                     if (specList != null && specList.size() > 0) {
+                         for (GoodsSpecValueDto spec : specList) {
+                              if (StringUtil.isNotEmpty(spec.getSpecValue())) {
+                                  specValue.add(spec.getSpecValue());
+                              }
+                         }
+                         if (specValue.size() > 0) {
+                             name = name + "(" + String.join(",", specValue) + ")";
+                         }
+                     }
+                     printContent.append(NoteFormatter.formatPrintOrderItemForNewLine80(name, goodsDto.getNum(), Double.parseDouble(goodsDto.getPrice())));
                 }
             }