tanbin 1 жил өмнө
parent
commit
c4ee365639

+ 136 - 0
device-api/src/main/java/com/xy/dto/DeviceDataDto.java

@@ -2,7 +2,11 @@ package com.xy.dto;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.NumberFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xy.convert.CustomFenToYuanConverter;
 import com.xy.utils.PageBean;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -470,12 +474,25 @@ public class DeviceDataDto {
 
     }
 
+
     @Data
     @Accessors(chain = true)
     public static class DeviceFlowCountDTO {
         @ApiModelProperty("分页对象")
         private PageBean page;
 
+        @ApiModelProperty("是否导出当前页")
+        private Boolean exportPage = true;
+
+        //size -1 不分页
+        public PageBean getPage() {
+            if (!this.exportPage) {
+                this.page.setSize(-1L);
+            }
+            return page;
+        }
+
+
         @ApiModelProperty(value = "设备ID")
         private Long deviceId;
 
@@ -509,6 +526,123 @@ public class DeviceDataDto {
 
     }
 
+
+    @Data
+    @Accessors(chain = true)
+    public static class DeviceFlowCountExcelVo {
+
+
+        @ExcelProperty("设备")
+        @ApiModelProperty(value = "设备")
+        private String deviceName;
+
+        @ExcelProperty("商户名称")
+        @ApiModelProperty(value = "商户名称")
+        private String mercName;
+
+
+        @ExcelProperty("设备点位")
+        @ApiModelProperty(value = "设备点位")
+        private String districtName;
+
+        @ExcelProperty("投放时间")
+        @ApiModelProperty(value = "投放时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime activeTime;
+
+
+        @ExcelProperty(value = "月平均流水", converter = CustomFenToYuanConverter.class)
+        @NumberFormat("#0.00")
+        @ApiModelProperty(value = "月平均流水")
+        private BigDecimal monthAvgMoney;
+
+        @ApiModelProperty(value = "总计流水")
+        @ExcelProperty(value = "总计流水", converter = CustomFenToYuanConverter.class)
+        @NumberFormat("#0.00")
+        private Integer totalMoney;
+
+        @ExcelIgnore
+        @ApiModelProperty(value = "月度流水列表")
+        List<DeviceFlowMonthVO> monthflowList;
+
+        @ExcelProperty(value = {"动态列"}, index = 0)
+        private String collectionFieldIndex0;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex1;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex2;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex3;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex4;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex5;
+
+        @ExcelProperty(value = {"动态列"}, index = 0)
+        private String collectionFieldIndex6;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex7;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex8;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex9;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex10;
+
+        @ExcelProperty(value = {"动态列"}, index = 1)
+        private String collectionFieldIndex11;
+
+        public void setCollectionField(List<String> collectionField) {
+            if (collectionField != null && !collectionField.isEmpty()) {
+                this.collectionFieldIndex0 = collectionField.get(0);
+                int size = collectionField.size();
+                if (size > 1) {
+                    this.collectionFieldIndex1 = collectionField.get(1);
+                    if(size > 2){
+                        this.collectionFieldIndex2 = collectionField.get(2);
+                    }
+                    if(size > 3){
+                        this.collectionFieldIndex3 = collectionField.get(3);
+                    }
+                    if(size > 4){
+                        this.collectionFieldIndex4 = collectionField.get(4);
+                    }
+                    if(size > 5){
+                        this.collectionFieldIndex5 = collectionField.get(5);
+                    }
+                    if(size > 6){
+                        this.collectionFieldIndex6 = collectionField.get(6);
+                    }
+                    if(size > 7){
+                        this.collectionFieldIndex2 = collectionField.get(7);
+                    }
+                    if(size > 8){
+                        this.collectionFieldIndex2 = collectionField.get(8);
+                    }
+                    if(size > 9){
+                        this.collectionFieldIndex2 = collectionField.get(9);
+                    }
+                    if(size > 10){
+                        this.collectionFieldIndex2 = collectionField.get(10);
+                    }
+                    if(size > 11){
+                        this.collectionFieldIndex2 = collectionField.get(11);
+                    }
+                }
+            }
+        }
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class DeviceFlowCountVO {
@@ -546,9 +680,11 @@ public class DeviceDataDto {
         @ApiModelProperty(value = "总计流水")
         private Integer totalMoney;
 
+
         @ApiModelProperty(value = "月度流水列表")
         List<DeviceFlowMonthVO> monthflowList;
 
+
     }
 
     /**