Browse Source

导出添加

傅行帆 3 years ago
parent
commit
db2627ee96

+ 15
- 15
src/main/java/com/yunzhi/marketing/excel/searchHouse/BuyRoom.java View File

@@ -15,68 +15,68 @@ public class BuyRoom {
15 15
     private String nickname;
16 16
 
17 17
     @ColumnWidth(15)
18
-    @ExcelProperty(value = "电话", index = 0)
18
+    @ExcelProperty(value = "电话", index = 1)
19 19
     private String phone;
20 20
 
21 21
     @ColumnWidth(15)
22
-    @ExcelProperty(value = "性别", index = 0)
22
+    @ExcelProperty(value = "性别", index = 2)
23 23
     private String gender;
24 24
 
25 25
     @ColumnWidth(15)
26
-    @ExcelProperty(value = "意向区域", index = 0)
26
+    @ExcelProperty(value = "意向区域", index = 3)
27 27
     private String intentArea;
28 28
 
29 29
 
30 30
     @ColumnWidth(15)
31
-    @ExcelProperty(value = "购房预算", index = 0)
31
+    @ExcelProperty(value = "购房预算", index = 4)
32 32
     private String maxPrice;
33 33
 
34 34
 
35 35
     @ColumnWidth(15)
36
-    @ExcelProperty(value = "房屋类型", index = 0)
36
+    @ExcelProperty(value = "房屋类型", index = 5)
37 37
     private String isNew;
38 38
 
39 39
 
40 40
     @ColumnWidth(15)
41
-    @ExcelProperty(value = "意向居室", index = 0)
41
+    @ExcelProperty(value = "意向居室", index = 6)
42 42
     private String layout;
43 43
 
44 44
 
45 45
     @ColumnWidth(15)
46
-    @ExcelProperty(value = "购房目的", index = 0)
46
+    @ExcelProperty(value = "购房目的", index = 7)
47 47
     private String purpose;
48 48
 
49 49
 
50 50
     @ColumnWidth(15)
51
-    @ExcelProperty(value = "侧重优势", index = 0)
51
+    @ExcelProperty(value = "侧重优势", index = 8)
52 52
     private String advantage;
53 53
 
54 54
     @ColumnWidth(15)
55
-    @ExcelProperty(value = "社区要求", index = 0)
55
+    @ExcelProperty(value = "社区要求", index = 9)
56 56
     private String facility;
57 57
 
58 58
     @ColumnWidth(15)
59
-    @ExcelProperty(value = "面积要求", index = 0)
59
+    @ExcelProperty(value = "面积要求", index = 10)
60 60
     private String area;
61 61
 
62 62
     @ColumnWidth(15)
63
-    @ExcelProperty(value = "朝向要求", index = 0)
63
+    @ExcelProperty(value = "朝向要求", index = 11)
64 64
     private String orientation;
65 65
 
66 66
     @ColumnWidth(15)
67
-    @ExcelProperty(value = "楼层要求", index = 0)
67
+    @ExcelProperty(value = "楼层要求", index = 12)
68 68
     private String isHigh;
69 69
 
70 70
     @ColumnWidth(15)
71
-    @ExcelProperty(value = "房龄要求", index = 0)
71
+    @ExcelProperty(value = "楼龄要求", index = 13)
72 72
     private String buildingAge;
73 73
 
74 74
     @ColumnWidth(15)
75
-    @ExcelProperty(value = "客户备注", index = 0)
75
+    @ExcelProperty(value = "客户备注", index = 14)
76 76
     private String remark;
77 77
 
78 78
     @ColumnWidth(15)
79
-    @ExcelProperty(value = "提交时间", index = 0)
79
+    @ExcelProperty(value = "提交时间", index = 15)
80 80
     private LocalDateTime createdTime;
81 81
 
82 82
 }

+ 24
- 25
src/main/java/com/yunzhi/marketing/xlk/controller/SearchHouseController.java View File

@@ -15,7 +15,10 @@ import com.yunzhi.marketing.common.StringUtils;
15 15
 import com.yunzhi.marketing.entity.*;
16 16
 import com.yunzhi.marketing.excel.IntentionUser;
17 17
 import com.yunzhi.marketing.excel.handler.CustomCellWriteHandler;
18
+import com.yunzhi.marketing.excel.searchHouse.AddedValue;
18 19
 import com.yunzhi.marketing.excel.searchHouse.BuyRoom;
20
+import com.yunzhi.marketing.excel.searchHouse.Overseas;
21
+import com.yunzhi.marketing.excel.searchHouse.Rent;
19 22
 import com.yunzhi.marketing.service.*;
20 23
 import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
21 24
 import com.yunzhi.marketing.xlk.dto.SearchHouseReplayDTO;
@@ -122,7 +125,7 @@ public class SearchHouseController extends BaseController {
122 125
                                     @RequestHeader("authorization") String token, HttpServletRequest request, HttpServletResponse response) throws IOException {
123 126
         response.setContentType("application/octet-stream");
124 127
         response.setCharacterEncoding("utf-8");
125
-        response.setHeader("Content-disposition", "attachment;filename=意向客户.xlsx");
128
+        response.setHeader("Content-disposition", "attachment;filename=帮我找房.xlsx");
126 129
         SearchHouseVO searchHouse = new SearchHouseVO();
127 130
         searchHouse.setOrgId(getOrgId(request));
128 131
         searchHouse.setType(type);
@@ -132,24 +135,22 @@ public class SearchHouseController extends BaseController {
132 135
         List<ExportSearchHouseVO> result = iSearchHouseService.selectExportHouseList(searchHouse);
133 136
 
134 137
         if (searchHouse.getType() == 4) {
135
-
136
-            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BuyRoom.class).registerWriteHandler(new CustomCellWriteHandler()).build();
138
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddedValue.class).registerWriteHandler(new CustomCellWriteHandler()).build();
137 139
             // 设置 sheet, 同一个sheet只需要设置一次
138
-            WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
139
-            List<BuyRoom> list = new ArrayList<>();
140
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
141
+            List<AddedValue> list = new ArrayList<>();
140 142
             result.forEach(e -> {
141
-                BuyRoom buyRoom = new BuyRoom();
142
-                BeanUtils.copyProperties(e,buyRoom);
143
-                list.add(buyRoom);
143
+                AddedValue addedValue = new AddedValue();
144
+                BeanUtils.copyProperties(e,addedValue);
145
+                list.add(addedValue);
144 146
             });
145 147
             excelWriter.write(list, writeSheet);
146 148
             // finish 会帮忙关闭流
147 149
             excelWriter.finish();
148 150
         }else if (searchHouse.getType() == 1) {
149
-
150 151
             ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BuyRoom.class).registerWriteHandler(new CustomCellWriteHandler()).build();
151 152
             // 设置 sheet, 同一个sheet只需要设置一次
152
-            WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
153
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
153 154
             List<BuyRoom> list = new ArrayList<>();
154 155
             result.forEach(e -> {
155 156
                 BuyRoom buyRoom = new BuyRoom();
@@ -160,29 +161,27 @@ public class SearchHouseController extends BaseController {
160 161
             // finish 会帮忙关闭流
161 162
             excelWriter.finish();
162 163
         }else if (searchHouse.getType() == 3) {
163
-
164
-            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BuyRoom.class).registerWriteHandler(new CustomCellWriteHandler()).build();
164
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), Overseas.class).registerWriteHandler(new CustomCellWriteHandler()).build();
165 165
             // 设置 sheet, 同一个sheet只需要设置一次
166
-            WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
167
-            List<BuyRoom> list = new ArrayList<>();
166
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
167
+            List<Overseas> list = new ArrayList<>();
168 168
             result.forEach(e -> {
169
-                BuyRoom buyRoom = new BuyRoom();
170
-                BeanUtils.copyProperties(e,buyRoom);
171
-                list.add(buyRoom);
169
+                Overseas overseas = new Overseas();
170
+                BeanUtils.copyProperties(e,overseas);
171
+                list.add(overseas);
172 172
             });
173 173
             excelWriter.write(list, writeSheet);
174 174
             // finish 会帮忙关闭流
175 175
             excelWriter.finish();
176
-        }else if (searchHouse.getType() == 3) {
177
-
178
-            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BuyRoom.class).registerWriteHandler(new CustomCellWriteHandler()).build();
176
+        }else if (searchHouse.getType() == 2) {
177
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), Rent.class).registerWriteHandler(new CustomCellWriteHandler()).build();
179 178
             // 设置 sheet, 同一个sheet只需要设置一次
180
-            WriteSheet writeSheet = EasyExcel.writerSheet("项目详情统计").build();
181
-            List<BuyRoom> list = new ArrayList<>();
179
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
180
+            List<Rent> list = new ArrayList<>();
182 181
             result.forEach(e -> {
183
-                BuyRoom buyRoom = new BuyRoom();
184
-                BeanUtils.copyProperties(e,buyRoom);
185
-                list.add(buyRoom);
182
+                Rent rent = new Rent();
183
+                BeanUtils.copyProperties(e,rent);
184
+                list.add(rent);
186 185
             });
187 186
             excelWriter.write(list, writeSheet);
188 187
             // finish 会帮忙关闭流