From bd8213ddfe04f41b7ad0f4c6377afbe39a44b4af Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 18 一月 2019 15:54:43 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/count/CommonOrderCountServiceImpl.java |   67 +++++++++------------------------
 1 files changed, 19 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..1d0294f 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);
 		}
@@ -148,12 +147,14 @@
 		
 		List<Map<String, Object>> result_list = null;
 		
+		// 鐢ㄦ埛璁㈠崟
 		List<Map<String, Object>> listTotal = commonOrderCountMapper.countOrderNumber(dateType, year,
 				startTime, endTime);
 		if (listTotal == null || listTotal.size() == 0) {
 			return result_list;
 		} 
 		
+		// 娣樺疂鑱旂洘
 		List<Map<String, Object>> type_list = taoBaoOrderMapper.countOrderNumber(dateType, year, 
 				startTime, endTime);
 		
@@ -175,15 +176,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 +196,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 +212,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