From 916f8851ccddff8ff764d950667b5fa86f77d7b2 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期五, 24 四月 2020 18:16:50 +0800
Subject: [PATCH] 后台状态切换

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java |  360 ++++++++++++++++++-----------------------------------------
 1 files changed, 110 insertions(+), 250 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 c521a41..05a06e3 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
@@ -17,15 +17,17 @@
 import org.yeshi.utils.JsonUtil;
 
 import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
 import com.yeshi.fanli.controller.admin.utils.AdminUtils;
 import com.yeshi.fanli.dto.ChartTDO;
+import com.yeshi.fanli.dto.common.CategoryInfoDTO;
 import com.yeshi.fanli.entity.bus.user.HongBaoV2;
+import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.money.UserMoneyDebt;
 import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
 import com.yeshi.fanli.entity.money.UserMoneyDetail;
 import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
 import com.yeshi.fanli.entity.order.CommonOrder;
+import com.yeshi.fanli.entity.order.CommonOrderGoods;
 import com.yeshi.fanli.entity.order.HongBaoOrder;
 import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
@@ -35,6 +37,7 @@
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
 import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService;
+import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
 import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
 import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
 import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
@@ -104,6 +107,9 @@
 
 	@Resource
 	private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService;
+	
+	@Resource
+	private CommonGoodsService commonGoodsService;
 
 	/**
 	 * 缁熻鍘嗗彶璁㈠崟-娣樺疂璁㈠崟
@@ -128,12 +134,9 @@
 
 			data.put("todayOrder", todayOrder);
 			data.put("yesterdayOrder", yesterdayOrder);
-
 			data.put("genzong", yesterdayOrder);
 			data.put("yesterdayOrder", yesterdayOrder);
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("缁熻澶辫触"));
 			e.printStackTrace();
@@ -219,8 +222,27 @@
 			long count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime,
 					sourceType, listShopId, listGoodsId, minTime, money, payment);
 
-			// 鏌ヨ鏄惁缁存潈
 			for (CommonOrderVO order : list) {
+				
+				CommonOrderGoods goods = order.getCommonOrderGoods();
+				if (goods != null) {
+					CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(Long.parseLong(goods.getGoodsId()),
+							goods.getGoodsType());
+					if (commonGoods != null) {
+						String categoryInfo = commonGoods.getCategoryInfo();
+						if (!StringUtil.isNullOrEmpty(categoryInfo)) {
+							JSONObject json = JSONObject.fromObject(categoryInfo);
+							CategoryInfoDTO otherDTO = (CategoryInfoDTO) JSONObject.toBean(json, CategoryInfoDTO.class);
+							if (otherDTO != null) {
+								goods.setCategory1(otherDTO.getCid1Name());
+								goods.setCategory2(otherDTO.getCid2Name());
+								goods.setCategory3(otherDTO.getCid3Name());
+							}
+						}
+					}
+				}
+				
+				
 				if (order.getUserId() == null)
 					continue;
 
@@ -298,9 +320,7 @@
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
 			data.put("result_list", list);
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (CommonOrderException e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
 		} catch (Exception e) {
@@ -378,249 +398,6 @@
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
-			e.printStackTrace();
-		}
-	}
-
-	
-	
-	
-	
-	
-	
-	/**
-	 * 缁熻鎻愮幇鐢宠鎬婚噾棰�
-	 * 
-	 * @param callback
-	 * @param channelArray
-	 *            娓犻亾鍚� 涓虹┖鏄粺璁℃墍鏈�
-	 * @param dateType
-	 *            鏄剧ず瑙嗗浘锛氭棩-1 銆佹湀-2銆� 骞�-3
-	 * @param state
-	 *            鐘舵�侊細 1-鏈埌璐� 2-宸插埌璐� 3-宸插け鏁�
-	 * @param year
-	 * @param startTime
-	 * @param endTime
-	 * @param out
-	 */
-	@RequestMapping(value = "getHongBaoMoney")
-	public void getHongBaoMoney(String callback, String channelArray, Integer dateType, Integer state, String year,
-			String startTime, String endTime, PrintWriter out) {
-
-		String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
-		if (validateMsg != null) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
-			return;
-		}
-
-		try {
-
-			JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 2);
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-		} catch (Exception e) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("绯荤粺寮傚父"));
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * 缁熻绾㈠寘淇℃伅
-	 * 
-	 * @param channelArray
-	 * @param dateType
-	 * @param state
-	 * @param year
-	 * @param startTime
-	 * @param endTime
-	 * @return
-	 * @throws Exception
-	 */
-	public JSONObject countHistoryHongBao(String channelArray, Integer dateType, Integer state, String year,
-			String startTime, String endTime, int countType) throws Exception {
-		if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
-			startTime = null;
-			endTime = null;
-		}
-
-		List<String> channelList = null;
-		if (channelArray != null && channelArray.trim().length() > 0) {
-			Gson gson = new Gson();
-			channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
-			}.getType());
-		}
-
-		if (channelList == null || channelList.size() == 0) {
-			channelList = new ArrayList<String>();
-			channelList.add("all");
-		}
-
-		if (dateType == 1 && year != null) {
-			year = null; // 璁剧疆涓虹┖
-		} else if (dateType == 2) {
-			if (startTime != null)
-				startTime = null;
-
-			if (endTime != null)
-				endTime = null;
-
-		} else if (dateType == 3) {
-			if (year != null)
-				year = null;
-
-			if (startTime != null)
-				startTime = null;
-
-			if (endTime != null)
-				endTime = null;
-		}
-
-		Gson gson = new Gson();
-		Object objectDate = null;
-		List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
-
-		JSONArray line_list = new JSONArray();
-		for (String channel : channelList) {
-			List<ChartTDO> list = null;
-			if (countType == 1) {
-				list = hongBaoV2CountService.countHongBaoNum(channel, dateType, state, year, startTime, endTime);
-			} else if (countType == 2) {
-				list = hongBaoV2CountService.countHongBaoMoney(channel, dateType, state, year, startTime, endTime);
-			}
-
-			if ("all".equalsIgnoreCase(channel)) {
-				channel = "鎬昏";
-			}
-
-			JSONObject innerList = new JSONObject();
-			innerList.put("name", channel);
-
-			if (dateType != 3) {
-				innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
-			} else {
-				// 骞磋鍥�
-				Map<String, Object> map = AdminUtils.yearsDataFactory(list);
-
-				if (objectDate == null) {
-					objectDate = map.get("date");
-				}
-				innerList.put("data", gson.toJson(map.get("value")));
-			}
-			line_list.add(innerList);
-		}
-
-		JSONObject data = new JSONObject();
-		if (objectDate != null) {
-			data.put("xAxis_list", gson.toJson(objectDate));
-		} else {
-			data.put("xAxis_list", gson.toJson(dateList));
-		}
-		data.put("line_list", line_list);
-		return data;
-	}
-
-	/**
-	 * 鍒嗙被鍨嬭鍗曟暟涓庢瘮渚�
-	 * 
-	 * @param callback
-	 * @param dateType
-	 *            鏃� -1 鏈�-2 骞�-3
-	 * @param type
-	 *            杩斿埄璁㈠崟-1 鍒嗕韩璁㈠崟-2 閭�璇疯鍗�-3
-	 * @param year
-	 * @param startTime
-	 * @param endTime
-	 * @param out
-	 */
-	@RequestMapping(value = "getTypeNumber")
-	public void getTypeNumber(String callback, Integer dateType, String typeArray, String year, String startTime,
-			String endTime, PrintWriter out) {
-		String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
-		if (validateMsg != null) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
-			return;
-		}
-
-		if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
-			startTime = null;
-			endTime = null;
-		}
-
-		List<Integer> channelList = null;
-		if (typeArray != null && typeArray.trim().length() > 0) {
-			Gson gson = new Gson();
-			channelList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {
-			}.getType());
-		}
-
-		if (channelList == null || channelList.size() == 0) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璁㈠崟绫诲瀷涓嶈兘涓虹┖"));
-			return;
-		}
-
-		if (dateType == 1 && year != null) {
-			year = null; // 璁剧疆涓虹┖
-		} else if (dateType == 2) {
-			if (startTime != null)
-				startTime = null;
-
-			if (endTime != null)
-				endTime = null;
-
-		} else if (dateType == 3) {
-			if (year != null)
-				year = null;
-
-			if (startTime != null)
-				startTime = null;
-
-			if (endTime != null)
-				endTime = null;
-		}
-
-		Gson gson = new Gson();
-		Object objectDate = null;
-		List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
-		try {
-			JSONArray line_list = new JSONArray();
-			for (Integer type : channelList) {
-				List<ChartTDO> list = hongBaoV2CountService.countHongBaoType(dateType, type, year, startTime, endTime);
-				JSONObject innerList = new JSONObject();
-				if (type == 1) {
-					innerList.put("name", "杩斿埄璁㈠崟");
-				} else if (type == 2) {
-					innerList.put("name", "鍒嗕韩璁㈠崟");
-				} else if (type == 3) {
-					innerList.put("name", "閭�璇疯鍗�");
-				}
-
-				if (dateType != 3) {
-					innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
-				} else {
-					// 骞磋鍥�
-					Map<String, Object> map = AdminUtils.yearsDataFactory(list);
-
-					if (objectDate == null) {
-						objectDate = map.get("date");
-					}
-					innerList.put("data", gson.toJson(map.get("value")));
-				}
-
-				line_list.add(innerList);
-			}
-
-			JSONObject data = new JSONObject();
-			if (objectDate != null) {
-				data.put("xAxis_list", gson.toJson(objectDate));
-			} else {
-				data.put("xAxis_list", gson.toJson(dateList));
-			}
-
-			data.put("line_list", line_list);
-
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
-		} catch (Exception e) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
 			e.printStackTrace();
 		}
 	}
@@ -808,5 +585,88 @@
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏇存柊澶辫触"));
 		}
 	}
+	
+	/**
+	 * 璁㈠崟璺熻釜鍑嗙‘鐜�(鏉挎牀蹇渷鐢ㄦ埛璁㈠崟/娣樺疂鑱旂洘璁㈠崟)
+	 * 
+	 * @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,
+			int sourceType, PrintWriter out) {
+
+		if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
+			startTime = null;
+			endTime = null;
+		}
+
+		if (dateType == 1 && year != null) {
+			year = null; // 璁剧疆涓虹┖
+		} else if (dateType == 2) {
+			if (startTime != null)
+				startTime = null;
+
+			if (endTime != null)
+				endTime = null;
+
+		} else if (dateType == 3) {
+			if (year != null)
+				year = null;
+
+			if (startTime != null)
+				startTime = null;
+
+			if (endTime != null)
+				endTime = null;
+		}
+
+		try {
+
+			Gson gson = new Gson();
+			Object objectDate = null;
+			List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
+
+			JSONArray line_list = new JSONArray();
+
+			List<ChartTDO> list = commonOrderCountService.getTrackAccuracyRate(dateType, year, startTime, endTime,
+					sourceType);
+
+			JSONObject innerList = new JSONObject();
+			innerList.put("name", "鎬昏");
+
+			if (dateType != 3) {
+				innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
+			} else {
+				// 骞磋鍥�
+				Map<String, Object> map = AdminUtils.yearsDataFactory(list);
+
+				if (objectDate == null) {
+					objectDate = map.get("date");
+				}
+				innerList.put("data", gson.toJson(map.get("value")));
+			}
+
+			line_list.add(innerList);
+
+			JSONObject data = new JSONObject();
+			if (objectDate != null) {
+				data.put("xAxis_list", gson.toJson(objectDate));
+			} else {
+				data.put("xAxis_list", gson.toJson(dateList));
+			}
+
+			data.put("line_list", line_list);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
 
 }

--
Gitblit v1.8.0