Quellcode durchsuchen

商品、订单列表导出增加序列号

yzc vor 2 Jahren
Ursprung
Commit
13633513c2

+ 22 - 19
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/GoodsListExport.java

@@ -21,61 +21,64 @@ public class GoodsListExport implements Serializable {
     @Serial
     private static final long serialVersionUID = 6833195135537265912L;
 
-    @ExcelProperty(value = "上架状态", index = 0)
+    @ExcelProperty(value = "序号" )
+    private String serialNumber;
+
+    @ExcelProperty(value = "上架状态")
     private String statusLabel;
 
-    @ExcelProperty(value = "商品名称", index = 1)
+    @ExcelProperty(value = "商品名称")
     private String name;
 
-    @ExcelProperty(value = "商品类别", index = 2)
+    @ExcelProperty(value = "商品类别")
     private String goodsTypeLabel;
 
-    @ExcelProperty(value = "计量单位", index = 3)
+    @ExcelProperty(value = "计量单位")
     private String unitLabel;
 
-    @ExcelProperty(value = "规格尺寸", index = 4)
+    @ExcelProperty(value = "规格尺寸")
     private String spec;
 
-    @ExcelProperty(value = "发票税率", index = 5)
+    @ExcelProperty(value = "发票税率")
     private String taxRateLabel;
 
-    @ExcelProperty(value = "库存数量", index = 6)
+    @ExcelProperty(value = "库存数量")
     private String amount;
 
-    @ExcelProperty(value = "交易方式", index = 7)
+    @ExcelProperty(value = "交易方式")
     private String tradingLabel;
 
-    @ExcelProperty(value = "最低单价", index = 8)
+    @ExcelProperty(value = "最低单价")
     private String highestPrice;
 
-    @ExcelProperty(value = "最高单价", index = 9)
+    @ExcelProperty(value = "最高单价")
     private String lowestPrice;
 
-    @ExcelProperty(value = "仓储地址", index = 10)
+    @ExcelProperty(value = "仓储地址")
     private String address;
 
-    @ExcelProperty(value = "客户经理", index = 11)
+    @ExcelProperty(value = "客户经理")
     private String manageName;
 
-    @ExcelProperty(value = "联系电话", index = 12)
+    @ExcelProperty(value = "联系电话")
     private String phone;
 
-    @ExcelProperty(value = "上架时间", index = 13)
+    @ExcelProperty(value = "上架时间")
     private String addedTime;
 
-    @ExcelProperty(value = "下架时间", index = 14)
+    @ExcelProperty(value = "下架时间")
     private String shelfTime;
 
-    @ExcelProperty(value = "供应企业", index = 15)
+    @ExcelProperty(value = "供应企业")
     private String supplyEnt;
 
-    @ExcelProperty(value = "创建人", index = 16)
+    @ExcelProperty(value = "创建人")
     private String createByName;
 
-    @ExcelProperty(value = "创建时间", index = 17)
+    @ExcelProperty(value = "创建时间")
     private String createTime;
 
-    @ExcelProperty(value = "备注", index = 18)
+    @ExcelProperty(value = "备注")
     private String remark;
 
 }

+ 9 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -544,9 +545,16 @@ public class KwpGoodsService {
             return Collections.emptyList();
         }
         List<GoodsListExport> list = new ArrayList<>();
+        AtomicInteger i = new AtomicInteger(1);
         goodsLists.forEach(e -> {
             GoodsListExport export = BeanUtils.copyProperties(e, GoodsListExport.class);
-            export.setHighestPrice(Objects.isNull(e.getHighestPrice()) ? null : String.valueOf(e.getHighestPrice())).setLowestPrice(Objects.isNull(e.getLowestPrice()) ? null : String.valueOf(e.getLowestPrice())).setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime())).setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime())).setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
+            export.setSerialNumber(String.valueOf(i.getAndIncrement()))
+                    .setAmount(Objects.isNull(e.getAmount()) ? null : String.valueOf(e.getAmount()))
+                    .setHighestPrice(Objects.isNull(e.getHighestPrice()) ? null : String.valueOf(e.getHighestPrice()))
+                    .setLowestPrice(Objects.isNull(e.getLowestPrice()) ? null : String.valueOf(e.getLowestPrice()))
+                    .setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime()))
+                    .setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()))
+                    .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
             list.add(export);
         });
         return list;

+ 4 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -24,6 +24,7 @@ import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
@@ -260,9 +261,11 @@ public class KwOrderService {
             return Collections.emptyList();
         }
         List<TradeOrderListExport> list = new ArrayList<>();
+        AtomicInteger i = new AtomicInteger(1);
         orders.forEach(e -> {
             TradeOrderListExport export = BeanUtils.copyProperties(e, TradeOrderListExport.class);
-            export.setStatus(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
+            export.setSerialNumber(String.valueOf(i.getAndIncrement()))
+                    .setStatus(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
                     .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
                     .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setPickupType(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))

+ 3 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/TradeOrderListExport.java

@@ -20,6 +20,9 @@ public class TradeOrderListExport implements Serializable {
     @Serial
     private static final long serialVersionUID = -5895230502149598364L;
 
+    @ExcelProperty(value = "序号" )
+    private String serialNumber;
+
     @ExcelProperty(value = "上架状态" )
     private String status;