From 39794d3cd1b4569f82528fbad23f048d9d1be398 Mon Sep 17 00:00:00 2001
From: fangyuan <527392886@qq.com>
Date: 星期三, 11 一月 2023 13:55:52 +0800
Subject: [PATCH] 导出接口
---
ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java | 36 ++++++++++++++++++++++++++++++++----
ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java | 12 ++++++++++++
ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulShopDto.java | 9 +++++++++
3 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java b/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java
index 2bfb1af..084a6b8 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java
@@ -5,16 +5,17 @@
import com.ycl.annotation.LogSave;
import com.ycl.api.CommonResult;
import com.ycl.controller.BaseController;
+import com.ycl.dto.caseHandler.QueryForViolationParam;
import com.ycl.dto.statistics.UnlawfulDto;
import com.ycl.dto.statistics.UnlawfulShopDto;
+import com.ycl.utils.EasyExcelUtils;
+import com.ycl.vo.casePool.QueryForViolationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
@@ -129,4 +130,31 @@
return CommonResult.success(page);
}
+ @PostMapping("/export/unlawful")
+ @ApiOperation("鎸夊悇绉嶇粺璁℃柟寮�-瀵煎嚭")
+ public void export(HttpServletResponse response) {
+ String sheetName = "鎸夌粺璁℃柟寮�";
+ EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, ls);
+ }
+
+ @PostMapping("/export/shop")
+ @ApiOperation("闂ㄥ墠涓夊寘-瀵煎嚭")
+ public void exportShop(HttpServletResponse response) {
+ List<UnlawfulShopDto> ls = new ArrayList<>();
+ ls.add(new UnlawfulShopDto("搴楅摵1", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵2", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵3", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵4", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵5", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵6", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵7", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵8", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵9", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵10", 100, 10, 1, 20, 5, 20, 0.6));
+ ls.add(new UnlawfulShopDto("搴楅摵11", 100, 10, 1, 20, 5, 20, 0.7));
+ ls.add(new UnlawfulShopDto("搴楅摵12", 100, 10, 1, 20, 5, 20, 0.8));
+ ls.add(new UnlawfulShopDto("搴楅摵13", 100, 10, 1, 20, 5, 20, 0.9));
+ String sheetName = "闂ㄥ墠涓夊寘";
+ EasyExcelUtils.export(response, sheetName, UnlawfulShopDto.class, ls);
+ }
}
diff --git a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java
index 705bcce..bcd8e99 100644
--- a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java
+++ b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java
@@ -1,5 +1,6 @@
package com.ycl.dto.statistics;
+import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -20,55 +21,66 @@
/**
* 绫诲瀷鍚嶇О
*/
+ @ExcelProperty(value = "绫诲瀷鍚嶇О", index = 0)
private String name;
/**
* 浜嬩欢鎬绘暟
*/
+ @ExcelProperty(value = "浜嬩欢鎬绘暟", index = 1)
private Integer count;
/**
* 鍗犳瘮
*/
+ @ExcelProperty(value = "鍗犳瘮", index = 2)
private Double ratio;
/**
* 绔嬫
*/
+ @ExcelProperty(value = "绔嬫", index = 3)
private Integer register;
/**
* 鏆備笉绔嬫
*/
+ @ExcelProperty(value = "鏆備笉绔嬫", index = 4)
private Integer notRegister;
/**
* 缁撴
*/
+ @ExcelProperty(value = "缁撴", index = 5)
private Integer closing;
/**
* 鍐嶅涔�
*/
+ @ExcelProperty(value = "鍐嶅涔�", index = 6)
private Integer relearn;
/**
* 宸插鏍�
*/
+ @ExcelProperty(value = "宸插鏍�", index = 7)
private Integer checked;
/**
* 瀹℃牳鐜�
*/
+ @ExcelProperty(value = "瀹℃牳鐜�", index = 8)
private Double checkedRatio;
/**
* 绔嬫鐜�
*/
+ @ExcelProperty(value = "绔嬫鐜�", index = 9)
private Double registerRatio;
/**
* 鍑嗙‘鐜�
*/
+ @ExcelProperty(value = "鍑嗙‘鐜�", index = 10)
private Double accuracyRatio;
}
diff --git a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulShopDto.java b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulShopDto.java
index 008bc80..2bc9b9e 100644
--- a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulShopDto.java
+++ b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulShopDto.java
@@ -1,5 +1,6 @@
package com.ycl.dto.statistics;
+import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -20,42 +21,50 @@
/**
* 鍟嗘埛鍚嶇О
*/
+ @ExcelProperty(value = "鍟嗘埛鍚嶇О", index = 0)
private String name;
/**
* 浜嬩欢鎬绘暟
*/
+ @ExcelProperty(value = "浜嬩欢鎬绘暟", index = 1)
private Integer count;
/**
* 鍖呭崼鐢�
*/
+ @ExcelProperty(value = "鍖呭崼鐢�", index = 2)
private Integer sanitation;
/**
* 鍖呯З缁�
*/
+ @ExcelProperty(value = "鍖呯З缁�", index = 3)
private Integer orderliness;
/**
* 鍖呰鏂�
*/
+ @ExcelProperty(value = "鍖呰鏂�", index = 4)
private Integer facility;
/**
* 绔嬫
*/
+ @ExcelProperty(value = "绔嬫", index = 5)
private Integer register;
/**
* 宸插鏍�
*/
+ @ExcelProperty(value = "宸插鏍�", index = 6)
private Integer checked;
/**
* 绔嬫鐜�
*/
+ @ExcelProperty(value = "绔嬫鐜�", index = 7)
private Double registerRatio;
}
--
Gitblit v1.8.0