|
@@ -6,6 +6,7 @@ import com.alibaba.excel.support.ExcelTypeEnum;
|
6
|
6
|
import com.alibaba.fastjson.JSONObject;
|
7
|
7
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
8
|
8
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
9
|
+import com.baomidou.mybatisplus.extension.api.R;
|
9
|
10
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
10
|
11
|
import com.huiju.welcome.common.base.BaseController;
|
11
|
12
|
import com.huiju.welcome.common.base.ResponseBean;
|
|
@@ -19,6 +20,7 @@ import org.apache.http.HttpStatus;
|
19
|
20
|
import org.slf4j.Logger;
|
20
|
21
|
import org.slf4j.LoggerFactory;
|
21
|
22
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
23
|
+import org.springframework.format.annotation.DateTimeFormat;
|
22
|
24
|
import org.springframework.web.bind.annotation.*;
|
23
|
25
|
|
24
|
26
|
import javax.servlet.ServletOutputStream;
|
|
@@ -301,6 +303,55 @@ public class TaMainUsherRecordController extends BaseController {
|
301
|
303
|
e.printStackTrace();
|
302
|
304
|
}
|
303
|
305
|
}
|
|
306
|
+
|
|
307
|
+ /**
|
|
308
|
+ * 导出接口的参数必须要跟列表查询的参数一致
|
|
309
|
+ */
|
|
310
|
+ @RequestMapping(value="/excel/usherListExcel",method= RequestMethod.GET)
|
|
311
|
+ public void exportCustomerExcel(@RequestParam(value = "personName" ,required = false)String personName,
|
|
312
|
+ @RequestParam(value = "startTime",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startTime,
|
|
313
|
+ @RequestParam(value = "endTime",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endTime,
|
|
314
|
+ @RequestParam(value = "customerType" ,required = false)String customerType,
|
|
315
|
+ @RequestParam(value = "customerSource" ,required = false)String customerSource,
|
|
316
|
+ @RequestParam(value = "receiver" ,required = false)String receiver,
|
|
317
|
+ @RequestParam(value = "phone" ,required = false)String phone,
|
|
318
|
+ HttpServletResponse response) {
|
|
319
|
+ List<UsherRecordExcel> result = iTaMainUsherRecordService.getCustomersEqualCustomerPageExcel(personName,phone,receiver,customerType,customerSource,startTime,endTime);
|
|
320
|
+
|
|
321
|
+ try {
|
|
322
|
+ ServletOutputStream out = response.getOutputStream();
|
|
323
|
+
|
|
324
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
|
|
325
|
+ String fileName = LocalDateTime.now().format(formatter);
|
|
326
|
+
|
|
327
|
+ response.setContentType("multipart/form-data");
|
|
328
|
+ response.setCharacterEncoding("utf-8");
|
|
329
|
+ response.setHeader("Content-disposition", "attachment;filename="+fileName+".xlsx");
|
|
330
|
+ ExcelWriter writer = new ExcelWriter(out, ExcelTypeEnum.XLSX, true);
|
|
331
|
+ Sheet sheet1 = new Sheet(1, 0, CustomerExcel.class);
|
|
332
|
+ writer.write(result, sheet1);
|
|
333
|
+ writer.finish();
|
|
334
|
+
|
|
335
|
+ out.flush();
|
|
336
|
+ } catch (IOException e) {
|
|
337
|
+ e.printStackTrace();
|
|
338
|
+ }
|
|
339
|
+ }
|
|
340
|
+
|
|
341
|
+ @RequestMapping(value="/usherRecords",method= RequestMethod.GET)
|
|
342
|
+ public ResponseBean usherRecords(@RequestParam(defaultValue = "1") int pageNum,
|
|
343
|
+ @RequestParam(defaultValue = "10") int pageSize,
|
|
344
|
+ @RequestParam(value = "personName" ,required = false)String personName,
|
|
345
|
+ @RequestParam(value = "startTime",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startTime,
|
|
346
|
+ @RequestParam(value = "endTime",required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endTime,
|
|
347
|
+ @RequestParam(value = "customerType" ,required = false)String customerType,
|
|
348
|
+ @RequestParam(value = "customerSource" ,required = false)String customerSource,
|
|
349
|
+ @RequestParam(value = "receiver" ,required = false)String receiver,
|
|
350
|
+ @RequestParam(value = "phone" ,required = false)String phone){
|
|
351
|
+ ResponseBean result = new ResponseBean();
|
|
352
|
+ result.addSuccess(iTaMainUsherRecordService.usherRecords(personName,phone,receiver,customerType,customerSource,startTime,endTime,pageNum,pageSize));
|
|
353
|
+ return result;
|
|
354
|
+ }
|
304
|
355
|
|
305
|
356
|
/**
|
306
|
357
|
* 修改对象
|