From 60477d72e953fc73744943db3c63f26d8eb94a19 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Mon, 22 Nov 2021 09:19:43 +0800
Subject: [PATCH] screen-api 增加获取柱状图表格数据的mock接口
---
screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelVO.java | 4
screen-api/src/main/java/com/moral/api/service/CityAqiDailyService.java | 4
screen-api/src/main/java/com/moral/api/controller/AqiController.java | 56 ++++++++++++++----
screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelVO.java | 2
screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartTableOfPollutionLevelVO.java | 53 +++++++++++++++++
screen-api/src/main/java/com/moral/api/service/impl/CityAqiDailyServiceImpl.java | 14 ++--
6 files changed, 107 insertions(+), 26 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/AqiController.java b/screen-api/src/main/java/com/moral/api/controller/AqiController.java
index f256e31..c3210a4 100644
--- a/screen-api/src/main/java/com/moral/api/controller/AqiController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/AqiController.java
@@ -1,7 +1,8 @@
package com.moral.api.controller;
-import com.moral.api.pojo.dto.cityAQI.BarChartOfPollutionLevelDTO;
-import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelDTO;
+import com.moral.api.pojo.dto.cityAQI.BarChartOfPollutionLevelVO;
+import com.moral.api.pojo.dto.cityAQI.BarChartTableOfPollutionLevelVO;
+import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelVO;
import com.moral.api.pojo.form.aqi.QueryPieChartOfPollutionLevelForm;
import com.moral.api.service.CityAqiDailyService;
@@ -16,10 +17,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import javax.servlet.http.HttpServletRequest;
@@ -106,14 +104,14 @@
return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
- PieChartOfPollutionLevelDTO dto = cityAqiDailyService.queryPieChartOfPollutionLevels(form);
- return ResultMessage.ok(dto);
+ PieChartOfPollutionLevelVO VO = cityAqiDailyService.queryPieChartOfPollutionLevels(form);
+ return ResultMessage.ok(VO);
}
@GetMapping("test1")
public ResultMessage test1(){
- List<PieChartOfPollutionLevelDTO> dtos = new ArrayList<>();
- PieChartOfPollutionLevelDTO dto = new PieChartOfPollutionLevelDTO();
+ List<PieChartOfPollutionLevelVO> dtos = new ArrayList<>();
+ PieChartOfPollutionLevelVO dto = new PieChartOfPollutionLevelVO();
dto.setTime("2021-11");
dto.setTotalDays(10);
List<Map<String,Object>> list = new ArrayList<>();
@@ -154,7 +152,7 @@
list.add(map5);
dto.setValues(list);
- PieChartOfPollutionLevelDTO dto1 = new PieChartOfPollutionLevelDTO();
+ PieChartOfPollutionLevelVO dto1 = new PieChartOfPollutionLevelVO();
dto1.setTime("2021-11");
List<Map<String,Object>> list1 = new ArrayList<>();
@@ -203,7 +201,7 @@
@GetMapping("queryBarChartOfPollutionLevel")
public ResultMessage queryBarChartOfPollutionLevel(){
- BarChartOfPollutionLevelDTO dto = new BarChartOfPollutionLevelDTO();
+ BarChartOfPollutionLevelVO dto = new BarChartOfPollutionLevelVO();
List<String> time = new ArrayList<>();
time.add("2021-10");
time.add("2021-11");
@@ -273,8 +271,8 @@
days6.add(0);
days6.add(0);
List<String> proportion6 = new ArrayList<>();
- proportion6.add("20%");
- proportion6.add("20%");
+ proportion6.add("0%");
+ proportion6.add("0%");
map6.put("days",days6);
map6.put("proportion",proportion6);
@@ -289,6 +287,35 @@
dto.setValues(values);
return ResultMessage.ok(dto);
+ }
+
+ @GetMapping("queryBarChatTableOfPollutionLevel")
+ public ResultMessage queryBarChatTableOfPollutionLevel(){
+ List<BarChartTableOfPollutionLevelVO> vos = new ArrayList<>();
+
+ BarChartTableOfPollutionLevelVO vo1 = new BarChartTableOfPollutionLevelVO();
+ BarChartTableOfPollutionLevelVO vo2 = new BarChartTableOfPollutionLevelVO();
+ vo1.setExcellent("4(40%)");
+ vo1.setGood("1(10%)");
+ vo1.setMild("1(10%)");
+ vo1.setMiddle("2(20%)");
+ vo1.setSerious("2(20%)");
+ vo1.setServer("0(0%)");
+ vo1.setTotal("10(100%)");
+ vo1.setTime("2021���10���");
+
+ vo2.setExcellent("6(60%)");
+ vo2.setGood("0(0%)");
+ vo2.setMild("0(0%)");
+ vo2.setMiddle("2(20%)");
+ vo2.setSerious("2(20%)");
+ vo2.setServer("0(0%)");
+ vo2.setTotal("10(100%)");
+ vo2.setTime("2021���11���");
+
+ vos.add(vo1);
+ vos.add(vo2);
+ return ResultMessage.ok(vos);
}
@GetMapping("provincialRanking")
@@ -333,4 +360,5 @@
List<Map<String, Object>> response = cityAqiService.rankingDetails(params);
return ResultMessage.ok(response);
}
+
}
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelDTO.java b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelVO.java
similarity index 84%
rename from screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelDTO.java
rename to screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelVO.java
index 83bc33c..33b8e5e 100644
--- a/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelDTO.java
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartOfPollutionLevelVO.java
@@ -13,7 +13,7 @@
* @Version TODO
**/
@Data
-public class BarChartOfPollutionLevelDTO {
+public class BarChartOfPollutionLevelVO {
/*������������*/
List<String> time;
@@ -21,6 +21,6 @@
* Map������������������
* pollution������������������
* days������������������
- * proportion������������������*/
+ * proportion���������������������������*/
List<Map<String,Object>> values;
}
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartTableOfPollutionLevelVO.java b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartTableOfPollutionLevelVO.java
new file mode 100644
index 0000000..3492c21
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/BarChartTableOfPollutionLevelVO.java
@@ -0,0 +1,53 @@
+package com.moral.api.pojo.dto.cityAQI;
+
+import lombok.Data;
+
+/**
+ * @ClassName BarChartTableOfPollutionLevelVO
+ * @Description ������������������������VO
+ * @Author ���������
+ * @Date 2021/11/22 9:05
+ * @Version TODO
+ **/
+@Data
+public class BarChartTableOfPollutionLevelVO {
+ /*
+ * ������
+ * */
+ private String time;
+
+ /*
+ * ���
+ * */
+ private String excellent;
+
+ /*
+ * ���
+ * */
+ private String good;
+
+ /*
+ * ������������
+ * */
+ private String mild;
+
+ /*
+ * ������������
+ * */
+ private String middle;
+
+ /*
+ * ������������
+ * */
+ private String serious;
+
+ /*
+ * ������������
+ * */
+ private String server;
+
+ /*
+ * ������
+ * */
+ private String total;
+}
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelDTO.java b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelVO.java
similarity index 94%
rename from screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelDTO.java
rename to screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelVO.java
index 3fb7158..f08dea9 100644
--- a/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelDTO.java
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/PieChartOfPollutionLevelVO.java
@@ -13,7 +13,7 @@
* @Version TODO
**/
@Data
-public class PieChartOfPollutionLevelDTO {
+public class PieChartOfPollutionLevelVO {
/*������������yyyy-MM-dd ��� yyyy-MM-dd*/
private String time;
diff --git a/screen-api/src/main/java/com/moral/api/service/CityAqiDailyService.java b/screen-api/src/main/java/com/moral/api/service/CityAqiDailyService.java
index 9a0f45f..046b3a7 100644
--- a/screen-api/src/main/java/com/moral/api/service/CityAqiDailyService.java
+++ b/screen-api/src/main/java/com/moral/api/service/CityAqiDailyService.java
@@ -2,7 +2,7 @@
import com.moral.api.entity.CityAqiDaily;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelDTO;
+import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelVO;
import com.moral.api.pojo.form.aqi.QueryPieChartOfPollutionLevelForm;
/**
@@ -22,6 +22,6 @@
* @Author: ���������
* @Date: 2021/11/9
*/
- PieChartOfPollutionLevelDTO queryPieChartOfPollutionLevels(QueryPieChartOfPollutionLevelForm form);
+ PieChartOfPollutionLevelVO queryPieChartOfPollutionLevels(QueryPieChartOfPollutionLevelForm form);
}
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/CityAqiDailyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/CityAqiDailyServiceImpl.java
index 5eb9d76..a360244 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/CityAqiDailyServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/CityAqiDailyServiceImpl.java
@@ -4,7 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.entity.CityAqiDaily;
import com.moral.api.mapper.CityAqiDailyMapper;
-import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelDTO;
+import com.moral.api.pojo.dto.cityAQI.PieChartOfPollutionLevelVO;
import com.moral.api.pojo.form.aqi.QueryPieChartOfPollutionLevelForm;
import com.moral.api.service.CityAqiDailyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -32,7 +32,7 @@
CityAqiDailyMapper cityAqiDailyMapper;
@Override
- public PieChartOfPollutionLevelDTO queryPieChartOfPollutionLevels(QueryPieChartOfPollutionLevelForm form) {
+ public PieChartOfPollutionLevelVO queryPieChartOfPollutionLevels(QueryPieChartOfPollutionLevelForm form) {
//������
Integer regionCode = form.getRegionCode();
Date startDate = form.getStartDate();
@@ -93,10 +93,10 @@
totalDays+=days;
}
//������������������
- PieChartOfPollutionLevelDTO dto = new PieChartOfPollutionLevelDTO();
- dto.setTime(time);
- dto.setValues(valueMap);
- dto.setTotalDays(totalDays);
- return dto;
+ PieChartOfPollutionLevelVO VO = new PieChartOfPollutionLevelVO();
+ VO.setTime(time);
+ VO.setValues(valueMap);
+ VO.setTotalDays(totalDays);
+ return VO;
}
}
--
Gitblit v1.8.0