From 607ce2c2ae229176f4a8a4171088f73729ef4567 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 18 五月 2020 11:20:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java | 65 +++++++++++++-------------------
1 files changed, 27 insertions(+), 38 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java
index da98543..09e46ee 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java
@@ -5,13 +5,14 @@
import java.util.List;
import java.util.Map;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-
import org.yeshi.utils.DateUtil;
import com.google.gson.Gson;
+import com.yeshi.fanli.dto.ChartTDO;
import com.yeshi.fanli.util.StringUtil;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
public class AdminUtils {
@@ -59,27 +60,28 @@
for (int i = 1; i <= 12; i++) {
dateList.add(i + ""); // 12涓湀
}
+ } else if (dateType == 3) {
+ for (int i = 2018; i <= 2030; i++) {
+ dateList.add(i + ""); // 10骞�
+ }
}
return dateList;
}
- public static Map<String, Object> yearsDataFactory(List<Map<String, Object>> list) {
+ public static Map<String, Object> yearsDataFactory(List<ChartTDO> list) {
List<Object> resultList = new ArrayList<Object>();
List<Object> listDate = new ArrayList<Object>();
if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- Map<String, Object> map = list.get(i);
- Object showValue = map.get("showValue");
- Object showDate = map.get("showDate");
-
+ for (ChartTDO chart: list) {
+ String showDate = chart.getShowDate();
+ String showValue = chart.getShowValue();
if (showValue == null) {
- showValue = 0;
+ showValue = "0";
}
-
resultList.add(showValue);
listDate.add(showDate);
}
@@ -95,43 +97,30 @@
public static List<Object> dayOrMonthDataFactory(Integer dateType, List<String> listDate ,
- List<Map<String, Object>> list) throws Exception {
-
+ List<ChartTDO> list) throws Exception {
List<Object> resultList = new ArrayList<Object>();
-
if (list != null && list.size() > 0) {
for (int i = 0; i < listDate.size(); i++) {
-
- Object showValue = null;
- if (list != null && list.size() > 0) {
- // 鏃ユ湡鍖归厤璧嬪��
- for (int j = 0; j < list.size(); j++) {
- Map<String, Object> map = list.get(j);
-
- String showDate = listDate.get(i);
- if (dateType == 2 && Integer.parseInt(showDate) < 10 ) {
- showDate = "0" + showDate;
- }
-
- Object reslutDate = map.get("showDate");
- String reslutTime = reslutDate.toString();
-
- if (showDate.equalsIgnoreCase(reslutTime)) {
- showValue = map.get("showValue");
- break;
- }
-
+ String showValue = null;
+ // 鏃ユ湡鍖归厤璧嬪��
+ for (ChartTDO chart: list) {
+ String showDate = listDate.get(i);
+ if (dateType == 2 && Integer.parseInt(showDate) < 10 ) {
+ showDate = "0" + showDate;
+ }
+ String reslutTime = chart.getShowDate();
+ if (showDate.equalsIgnoreCase(reslutTime)) {
+ showValue = chart.getShowValue();
+ break;
}
}
-
if (showValue == null) {
- showValue = 0;
+ showValue = "0";
}
resultList.add(showValue);
}
}
-
return resultList;
}
@@ -146,7 +135,7 @@
* @throws Exception
*/
public static JSONObject chartDataFactory(Integer dateType, String year, String startTime, String endTime,
- List<Map<String, Object>> list) throws Exception{
+ List<ChartTDO> list) throws Exception{
Object objectDate = null;
List<String> dateList = getDateList(dateType, startTime, endTime, year);
--
Gitblit v1.8.0