From 85b08b045c79180a81abd43be0ac7fd2ae50cd46 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 08 一月 2019 16:41:14 +0800
Subject: [PATCH] 后台数据统计+ 订单接口统计类型调整

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java |  225 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 223 insertions(+), 2 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
index 2da03a5..96969f8 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
@@ -20,6 +20,7 @@
 import com.yeshi.fanli.entity.admin.OrderAdmin;
 import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
+import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
 import com.yeshi.fanli.service.inter.order.OrderService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
@@ -37,6 +38,9 @@
 
 	@Resource
 	private HongBaoV2CountService hongBaoV2CountService;
+	
+	@Resource
+	private CommonOrderCountService commonOrderCountService;
 
 	@RequestMapping(value = "getOrderList", method = RequestMethod.POST)
 	public void getOrderList(int pageIndex, String key, PrintWriter out) {
@@ -129,7 +133,7 @@
 					resultList = new ArrayList<Object>();
 				}
 				channelData.put("name", channel);
-				channelData.put("infos", resultList);
+				channelData.put("data_list", resultList);
 				array.add(channelData);
 			}
 
@@ -288,7 +292,7 @@
 				channel = "鎬昏";
 			}
 			channelData.put("name", channel);
-			channelData.put("infos", resultList);
+			channelData.put("data_list", resultList);
 			array.add(channelData);
 		}
 
@@ -298,4 +302,221 @@
 		return data;
 	}
 
+	
+	/**
+	 * 鍒嗙被鍨嬭鍗曟暟涓庢瘮渚� 
+	 * @param callback
+	 * @param dateType 鏃� -1 鏈�-2 骞�-3
+	 * @param type     杩斿埄璁㈠崟-1  鍒嗕韩璁㈠崟-2  閭�璇疯鍗�-3 
+	 * @param year
+	 * @param startTime
+	 * @param endTime
+	 * @param out
+	 */
+	@RequestMapping(value = "getTypeRate")
+	public void getTypeRate(String callback, Integer dateType, Integer type, String year,
+			String startTime, String endTime, PrintWriter out) {
+		
+		if (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime)) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨姝g‘鏃堕棿鍖洪棿"));
+			return;
+		}
+		
+		if (type == null || dateType ==null) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("瑙嗗浘绫诲瀷銆佽鍗曠被鍨嬩笉鑳戒负绌�"));
+			return;
+		}
+		
+		try {
+
+			List<Map<String, Object>> resultList = hongBaoV2CountService.getProportionByType(dateType,
+					type, year, startTime, endTime);
+			
+			if (resultList == null) {
+				resultList = new ArrayList<Map<String, Object>>();
+			}
+
+			JSONObject innerList = new JSONObject();
+			if (type == 1) {
+				innerList.put("name", "杩斿埄璁㈠崟");
+			} else if (type == 2) {
+				innerList.put("name", "鍒嗕韩璁㈠崟");
+			} else if (type == 3) {
+				innerList.put("name", "閭�璇疯鍗�");
+			}
+			innerList.put("data_list", resultList);
+			
+			JSONArray outList = new JSONArray();
+			outList.add(innerList);
+			
+			JSONObject data = new JSONObject();
+			data.put("result_list", outList);
+			
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 璁㈠崟璺熻釜鍑嗙‘鐜�(杩斿埄鍒哥敤鎴疯鍗�/娣樺疂鑱旂洘璁㈠崟)
+	 * @param callback
+	 * @param dateType
+	 * @param year
+	 * @param startTime
+	 * @param endTime
+	 * @param out
+	 */
+	@RequestMapping(value = "getTrackAccuracyRate")
+	public void getTrackAccuracyRate(String callback, Integer dateType, String year,
+			String startTime, String endTime, PrintWriter out) {
+		
+		if (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime)) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨姝g‘鏃堕棿鍖洪棿"));
+			return;
+		}
+		
+		try {
+
+			List<Map<String, Object>> resultList = commonOrderCountService.getTrackAccuracyRate(dateType,
+					 year, startTime, endTime);
+			
+			if (resultList == null) {
+				resultList = new ArrayList<Map<String, Object>>();
+			}
+			
+			JSONObject innerList = new JSONObject();
+			innerList.put("name", "鍑嗙‘鐜�");
+			innerList.put("data_list", resultList);
+			
+			JSONArray outList = new JSONArray();
+			outList.add(innerList);
+			
+			JSONObject data = new JSONObject();
+			data.put("result_list", outList);
+			
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	
+	/**
+	 * 褰撳墠鏈敹璐ц鍗曟暟
+	 * @param callback
+	 * @param type 璁㈠崟鐘舵��-鏆傛湭浣跨敤
+	 * @param out
+	 */
+	@RequestMapping(value = "getHistoryUnreceived")
+	public void getHistoryUnreceived(String callback, Integer type, PrintWriter out) {
+		try {
+			
+			Long total = commonOrderCountService.countByState(1);
+			if (total == null) {
+				total = 0L;
+			}
+			JSONObject data = new JSONObject();
+			data.put("total", total);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	
+	
+	/**
+	 * 缁存潈璁㈠崟鏁�
+	 * @param callback
+	 * @param dateType
+	 * @param year
+	 * @param startTime
+	 * @param endTime
+	 * @param out
+	 */
+	@RequestMapping(value = "getWeiQaunOrderNumber")
+	public void getWeiQaunOrderNumber(String callback, Integer dateType, String year,
+			String startTime, String endTime, PrintWriter out) {
+		
+		if (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime)) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨姝g‘鏃堕棿鍖洪棿"));
+			return;
+		}
+		try {
+
+			List<Map<String, Object>> resultList = commonOrderCountService.countWeiQaunOrderNumber(dateType,
+					 year, startTime, endTime);
+			
+			if (resultList == null) {
+				resultList = new ArrayList<Map<String, Object>>();
+			}
+
+			JSONObject innerList = new JSONObject();
+			innerList.put("name", "鏁伴噺");
+			innerList.put("data_list", resultList);
+			
+			JSONArray outList = new JSONArray();
+			outList.add(innerList);
+			
+			JSONObject data = new JSONObject();
+			data.put("result_list", outList);
+			
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	
+	/**
+	 * 缁存潈璁㈠崟閲戦
+	 * @param callback
+	 * @param dateType
+	 * @param year
+	 * @param startTime
+	 * @param endTime
+	 * @param out
+	 */
+	@RequestMapping(value = "getWeiQaunOrderMoney")
+	public void getWeiQaunOrderMoney(String callback, Integer dateType, String year,
+			String startTime, String endTime, PrintWriter out) {
+		
+		if (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime)) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇烽�夋嫨姝g‘鏃堕棿鍖洪棿"));
+			return;
+		}
+		try {
+
+			List<Map<String, Object>> resultList = commonOrderCountService.countWeiQaunOrderMoney(dateType,
+					 year, startTime, endTime);
+			
+			if (resultList == null) {
+				resultList = new ArrayList<Map<String, Object>>();
+			}
+
+			JSONObject innerList = new JSONObject();
+			innerList.put("name", "閲戦");
+			innerList.put("data_list", resultList);
+			
+			JSONArray outList = new JSONArray();
+			outList.add(innerList);
+			
+			JSONObject data = new JSONObject();
+			data.put("result_list", outList);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
 }

--
Gitblit v1.8.0