From 1e5efa36908873c31b609fdbefc49c292ae969f2 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 15 一月 2019 10:36:09 +0800
Subject: [PATCH] 后台曲线统计

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java |   65 ++++++++------------------------
 1 files changed, 17 insertions(+), 48 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java
index 6d743a3..0f22393 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java
@@ -1,8 +1,7 @@
 package com.yeshi.fanli.service.impl.count;
 
-import java.text.SimpleDateFormat;
+import java.text.DecimalFormat;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -77,11 +76,7 @@
 			}
 			mapObject.put("showValue", total);
 
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-			SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
-			Date parseDate = sdf.parse(plusDay.toString());
-
-			mapObject.put("showDate", sdf2.format(parseDate));
+			mapObject.put("showDate", plusDay);
 
 			listObject.add(mapObject);
 
@@ -115,8 +110,12 @@
 				total = 0;
 			}
 			mapObject.put("showValue", total);
-
-			mapObject.put("showDate", i + "鏈�");
+			
+			if (i <10) {
+				mapObject.put("showDate", "0"+ i);
+			} else {
+				mapObject.put("showDate", i);
+			}
 
 			listObject.add(mapObject);
 		}
@@ -175,15 +174,16 @@
 				break;
 		}
 		
+		DecimalFormat df = new DecimalFormat("#.00");
 		
 		for (int i = 0; i < result_list.size(); i++) {
 			
-			float proportion = 0;
+			double proportion = 0;
 			Map<String, Object> resultMap = result_list.get(i);
 			
 			Object showDate = resultMap.get("showDate");
 			for (int j = 0; j < listTotal.size(); j++) {
-				Map<String, Object> innerMap = result_list.get(j);
+				Map<String, Object> innerMap = listTotal.get(j);
 				Object innerDate = innerMap.get("showDate");
 				
 				if (innerDate != null && innerDate.toString().equals(showDate.toString())) {
@@ -194,14 +194,14 @@
 					long showData = Long.parseLong(showValue.toString());
 					
 					if (showData > 0) {
-						proportion =  innerData/showData;
+						proportion =  innerData/(double)showData;
 					}
 					
 					break; // 缁撴潫鍐呴儴寰幆
 				}
 			}
 			
-			resultMap.put("showValue", proportion);
+			resultMap.put("showValue", Double.parseDouble(df.format(proportion *100)));
 		}
 		
 		return result_list;
@@ -210,49 +210,18 @@
 	@Override
 	public List<Map<String, Object>> countWeiQaunOrderMoney(Integer dateType, String year, String startTime,
 			String endTime) throws Exception{
-		
-		List<Map<String, Object>> listTotal = taoBaoWeiQuanOrderMapper.countWeiQaunOrderMoney(dateType,
-				year, startTime, endTime);
-		
-		if (listTotal == null || listTotal.size() == 0) {
-			return null;
-		} 
-		
-		switch (dateType){
-			case 1: // 鎸夊ぉ澶勭悊
-				return dayFactory(startTime, endTime, listTotal);
-			case 2: // 鎸夋湀澶勭悊
-				return monthFactory(listTotal);
-			case 3: 
-				return yearFactory(listTotal);
-			default: 
-				return null;
-		}
+		return taoBaoWeiQuanOrderMapper.countWeiQaunOrderMoney(dateType, year, startTime, endTime);
 	}
 	
 	
 	@Override
 	public List<Map<String, Object>> countWeiQaunOrderNumber(Integer dateType, String year, String startTime,
 			String endTime) throws Exception{
+		return taoBaoWeiQuanOrderMapper.countWeiQaunOrderNumber(dateType, year, startTime, endTime);
 		
-		List<Map<String, Object>> listTotal = taoBaoWeiQuanOrderMapper.countWeiQaunOrderNumber(dateType,
-				year, startTime, endTime);
-		
-		if (listTotal == null || listTotal.size() == 0) {
-			return null;
-		} 
-		
-		switch (dateType){
-			case 1: // 鎸夊ぉ澶勭悊
-				return dayFactory(startTime, endTime, listTotal);
-			case 2: // 鎸夋湀澶勭悊
-				return monthFactory(listTotal);
-			case 3: 
-				return yearFactory(listTotal);
-			default: 
-				return null;
-		}
 	}
 	
 	
+	
+	
 }

--
Gitblit v1.8.0