From 651a15c78f668bef3859d9ed1bb7ad0b669d3600 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 03 七月 2020 17:52:07 +0800
Subject: [PATCH] 多APP优化

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java |  299 ++++++++++++-----------------------------------------------
 1 files changed, 61 insertions(+), 238 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 05a06e3..b0c2c8c 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
@@ -10,15 +10,13 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.yeshi.fanli.entity.accept.AdminAcceptData;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.yeshi.utils.JsonUtil;
 
-import com.google.gson.Gson;
-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;
@@ -56,15 +54,12 @@
 import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
 import com.yeshi.fanli.vo.order.CommonOrderVO;
 
-import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 
 @Controller
 @RequestMapping("admin/new/api/v1/order")
 public class OrderAdminController {
 
-	@Resource
-	private OrderService orderService;
 
 	@Resource
 	private HongBaoV2CountService hongBaoV2CountService;
@@ -75,8 +70,6 @@
 	@Resource
 	private CommonOrderService commonOrderService;
 
-	@Resource
-	private TaoBaoOrderService taoBaoOrderService;
 
 	@Resource
 	private TaoBaoOrderCountService taoBaoOrderCountService;
@@ -98,9 +91,6 @@
 
 	@Resource
 	private UserMoneyDebtService userMoneyDebtService;
-
-	@Resource
-	private UserSystemCouponRecordService userSystemCouponRecordService;
 
 	@Resource
 	private ConfigService configService;
@@ -149,19 +139,17 @@
 	 * @param callback
 	 * @param pageIndex
 	 * @param pageSize
-	 * @param uid
 	 * @param state
 	 * @param type
 	 * @param orderState
-	 * @param orderNo
 	 * @param startTime
 	 * @param endTime
 	 * @param out
 	 */
 	@RequestMapping(value = "getUserOrderList")
-	public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType, String key,
-			Integer state, Integer type, Integer orderState, String startTime, String endTime, Integer sourceType,
-			Integer riskType, BigDecimal payment, PrintWriter out) {
+	public void getUserOrderList(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, Integer keyType, String key,
+								 Integer state, Integer type, Integer orderState, String startTime, String endTime, Integer sourceType,
+								 Integer riskType, BigDecimal payment, PrintWriter out) {
 
 		if (pageIndex == null || pageIndex < 1) {
 			pageIndex = 1;
@@ -196,14 +184,14 @@
 
 				if (riskType == 1) {
 					listGoodsId = commonOrderCountService.getSameGoodsOrderByUidAndHongBaoType(typeList, uid,
-							Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey())));
+							Integer.parseInt(configService.getValue(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey(),acceptData.getSystem())));
 					if (listGoodsId == null || listGoodsId.isEmpty()) {
 						JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鍚屽晢鍝佽鍗�"));
 						return;
 					}
 				} else if (riskType == 2) {
 					listShopId = commonOrderCountService.getSameShopOrderByUidAndHongBaoType(typeList, uid,
-							Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey())));
+							Integer.parseInt(configService.getValue(ConfigKeyEnum.adminMinSameShopOrderCount.getKey(),acceptData.getSystem())));
 					if (listShopId == null || listShopId.isEmpty()) {
 						JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鍚屽簵閾鸿鍗�"));
 						return;
@@ -427,145 +415,7 @@
 			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) {
-
-		String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
-		if (validateMsg != null) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
-			return;
-		}
-
-		try {
-			JSONObject data = countWeiQaunOrder(dateType, year, startTime, endTime, 1);
-			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) {
-
-		String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
-		if (validateMsg != null) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
-			return;
-		}
-
-		try {
-			JSONObject data = countWeiQaunOrder(dateType, 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 countWeiQaunOrder(Integer dateType, String year, String startTime, String endTime, int countType)
-			throws Exception {
-
-		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;
-		}
-
-		Gson gson = new Gson();
-		Object objectDate = null;
-		List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
-
-		JSONArray line_list = new JSONArray();
-		List<ChartTDO> list = null;
-		if (countType == 1) {
-			list = commonOrderCountService.countWeiQaunOrderNumber(dateType, year, startTime, endTime);
-		} else if (countType == 2) {
-			list = commonOrderCountService.countWeiQaunOrderMoney(dateType, year, startTime, endTime);
-		}
-
-		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);
-
-		return data;
-	}
+	
 
 	@RequestMapping(value = "uploadTaoBaoWeiQuanOrder")
 	public void uploadWeiQuanOrder(String callback, HttpServletRequest request, PrintWriter out) {
@@ -586,87 +436,60 @@
 		}
 	}
 	
-	/**
-	 * 璁㈠崟璺熻釜鍑嗙‘鐜�(鏉挎牀蹇渷鐢ㄦ埛璁㈠崟/娣樺疂鑱旂洘璁㈠崟)
-	 * 
-	 * @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();
-		}
+	
+	@RequestMapping(value = "countOrderInfo")
+	public void countOrderInfo(String callback, Long uid, PrintWriter out) {
+		JSONObject data = new JSONObject();
+		
+		/* ---------  鏈湀绱 ------------*/
+		JSONObject month = new JSONObject();
+		// 鑷喘宸插埌璐�
+		month.put("selfNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 1, 1));
+		// 鍒嗕韩宸插埌璐�
+		month.put("shareNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 2, 1));
+		// 閭�璇峰凡鍒拌处
+		month.put("inviteNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 3, 1));
+		// 鑷喘鏈埌璐�
+		month.put("selfNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 1, 1));
+		// 鍒嗕韩鏈埌璐�
+		month.put("shareNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 2, 1));
+		// 閭�璇锋湭鍒拌处
+		month.put("inviteNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 3, 1));
+		data.put("month", month);
+		
+		
+		/* ---------  鍘嗗彶绱 ------------*/
+		JSONObject history = new JSONObject();
+		// 鑷喘宸插埌璐�
+		history.put("selfNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 1, null));
+		// 鍒嗕韩宸插埌璐�
+		history.put("shareNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 2, null));
+		// 閭�璇峰凡鍒拌处
+		history.put("inviteNumEnd", hongBaoV2CountService.countOrderByCashArrival(uid, null, 3, null));
+		// 鑷喘鏈埌璐�
+		history.put("selfNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 1, null));
+		// 鍒嗕韩鏈埌璐�
+		history.put("shareNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 2, null));
+		// 閭�璇锋湭鍒拌处
+		history.put("inviteNum", hongBaoV2CountService.countOrderByCashNotArrival(uid, null, 3, null));
+		data.put("history", history);
+		
+		
+		/* ---------  浠樻閲戦澶т簬1 ------------*/
+		// 鑷喘宸插埌璐�
+		long selfAccountEnd = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY, 1);
+		// 鍒嗕韩宸插埌璐�
+		long shareAccountEnd = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY, 2);
+		// 鑷喘鏈埌璐�
+		long selfAccount = hongBaoV2CountService.countOrderByCashNotArrival(uid, Constant.VIP_ORDER_PAY, 1, null);
+		// 鍒嗕韩鏈埌璐�
+		long shareAccount = hongBaoV2CountService.countOrderByCashNotArrival(uid, Constant.VIP_ORDER_PAY, 2, null);
+		data.put("selfAccountEnd", selfAccountEnd);
+		data.put("shareAccountEnd", shareAccountEnd);
+		data.put("selfAccount", selfAccount);
+		data.put("shareAccount", shareAccount);
+		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
 	}
+	
 
 }

--
Gitblit v1.8.0