diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/DataController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/DataController.java index 7d78733..616f7e7 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/DataController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/DataController.java @@ -74,5 +74,10 @@ public class DataController { DataSearchValidate dataSearchValidate = JSON.parseObject(data,DataSearchValidate.class); dataService.exportsource(response, dataSearchValidate); } - + @NotPower + @PostMapping("exportcategory") + public void exportcategory(HttpServletResponse response, @RequestBody String data) throws IOException { + DataSearchValidate dataSearchValidate = JSON.parseObject(data,DataSearchValidate.class); + dataService.exportcategory(response, dataSearchValidate); + } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java index e69912a..654e8e2 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java @@ -461,4 +461,58 @@ public class DataService extends ServiceImpl { } } } + + public void exportcategory(HttpServletResponse response, DataSearchValidate dataSearchValidate) throws IOException { + List> head = new ArrayList<>(); + List> list = new ArrayList<>(); + List> data1 = new ArrayList<>(); + List variables = new ArrayList<>(); + list = getsourcelist(new Page<>(1, 10000),dataSearchValidate).getRecords(); + System.out.println(list); + Map item_one = list.get(0); + for (Map.Entry entry : item_one.entrySet()) { + // 获取键和值 + String key = entry.getKey(); + Object value = entry.getValue(); + // 打印键和值 + if (key.contains("name")&&!key.contains("second_dept_name")){ + variables.add(value.toString()); + } + } + head.add(List.of("局长信箱即接即办信件来源统计","单位名称","单位名称")); + head.add(List.of("局长信箱即接即办信件来源统计","信件总量","信件总量")); + for (int i = 0;i item : list){ + List list_item = new ArrayList<>(); + list_item.add(item.get("second_dept_name1")); + list_item.add(item.get("allcount1")); + for (int i = 0;i