From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java |   58 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
index 486dc1d..54c039d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -14,10 +14,12 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.NumberUtil;
 
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.order.ESOrder;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.exception.order.CommonOrderException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -110,7 +112,7 @@
 		
 		// 鎼滅储鍐呭銆佽鍗曞彿
 		if (!StringUtil.isNullOrEmpty(orderNo) && VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) {
-			searchOrder(orderNo, page, uid, out);
+			searchOrder(acceptData, orderNo, page, uid, out);
 			return;
 		}
 		
@@ -180,18 +182,23 @@
 			endTime += " 23:59:59";
 		}
 
+		List<Integer> listSource = new ArrayList<>();
+		if (goodsType != null) {
+			listSource.add(goodsType);
+		} 
+		
 		try {
 			// 绛涢�夌粨鏋滈《閮ㄧ粺璁�
 			String validMoney = "0.00";
 			String invalidMoney = "0.00";
 			if (page == 1) {
 				BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 1,
-						orderNo, state, goodsType, startTime, endTime);
+						orderNo, state, startTime, endTime, listSource);
 				if (predictMoney != null) 
 					validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
 				
 				BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 2,
-						orderNo, state, goodsType, startTime, endTime);
+						orderNo, state, startTime, endTime, listSource);
 				if (postSaleMoney != null) 
 					invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
 				
@@ -206,23 +213,23 @@
 						
 			// 鏌ヨ鍒楄〃
 			List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState,
-					orderNo, startTime, endTime, dateType, goodsType);
+					orderNo, startTime, endTime, dateType, listSource);
 			// 缁熻鎬绘暟
 			long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime,
-					endTime, dateType, goodsType);
+					endTime, dateType, listSource);
 
 			// 鍒ゆ柇鏄惁闇�瑕佹樉绀鸿鍗曟壘鍥炴彁绀�   8绉掑唴璇锋眰3娆¤Е鍙�
 			String orderFindUrl = null;
 			if (state ==null && page == 1) {
 				if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4)||count==0L) {
-					orderFindUrl = configService.get("order_find_notify_url");
+					orderFindUrl = configService.get(ConfigKeyEnum.orderFindNotifyUrl.getKey());
 				}
 			}
 			
 			JSONObject data = new JSONObject();
 			data.put("count", count);
 			data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
-			data.put("helpUrl", configService.get("order_list_help"));
+			data.put("helpUrl", configService.get(ConfigKeyEnum.orderListHelp.getKey()));
 			data.put("validMoney", "楼 " + validMoney);
 			data.put("invalidMoney", "楼 " + invalidMoney);
 			data.put("findOrderHelpUrl", orderFindUrl);
@@ -240,15 +247,22 @@
 	 * @param key
 	 * @param out
 	 */
-	private void searchOrder(String key, Integer page, Long uid, PrintWriter out) {
+	private void searchOrder(AcceptData acceptData, String key, Integer page, Long uid, PrintWriter out) {
 		try {
 			long count = 0;
 			List<CommonOrderVO> list = null;
-			List<ESOrder> listES = esOrderService.query(key, uid.toString());
+			if (NumberUtil.isNumeric(key.replace("-", ""))) {
+				list = commonOrderService.getOrderByUid(acceptData, page, uid, null, null, null, key, null, null, null, null);
+			} 
 			
-			if (listES.size() != 0) {
-				list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES);
-				count = commonOrderService.countSearchOrderByUid(uid, listES);
+			if (list == null || list.size() == 0) {
+				List<ESOrder> listES = esOrderService.query(key, uid.toString(), null);
+				if (listES.size() != 0) {
+					list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES);
+					count = commonOrderService.countSearchOrderByUid(uid, listES);
+				}
+			} else {
+				count = list.size();
 			}
 			
 			if (list == null) {
@@ -273,6 +287,7 @@
 	 * @param acceptData
 	 * @param uid
 	 *            鐢ㄦ埛id
+	 *    type 绫诲瀷锛�0鍏ㄩ儴銆�1娣樺疂 2浜笢銆佹嫾澶氬
 	 * @param out
 	 */
 	@RequestMapping(value = "getOrderCount", method = RequestMethod.POST)
@@ -298,8 +313,9 @@
 			JSONObject data = new JSONObject();
 			data.put("userInfo", userInfo);
 			
+			List<Integer> listSource = new ArrayList<>();
 			if (type == null || type == 0) {
-				OrderCountVO total = commonOrderService.getOrderCount(uid, null, type);
+				OrderCountVO total = commonOrderService.getOrderCount(uid, null, null);
 				data.put("total", total.getSelf() + total.getShared() + total.getInvite());
 				data.put("self", total.getSelf());
 				data.put("shared", total.getShared());
@@ -309,19 +325,21 @@
 				data.put("self", 0);
 				data.put("shared", 0);
 				data.put("invite", 0);
+				
+				listSource.add(type);
 			}
 						
 			// 浠婂ぉ
-			OrderCountVO today = commonOrderService.getOrderCount(uid, 1, type);
+			OrderCountVO today = commonOrderService.getOrderCount(uid, 1, listSource);
 			today.setTotal(today.getSelf() + today.getShared() + today.getInvite());
 			// 鏄ㄥぉ
-			OrderCountVO yesterday = commonOrderService.getOrderCount(uid, 2, type);
+			OrderCountVO yesterday = commonOrderService.getOrderCount(uid, 2, listSource);
 			yesterday.setTotal(yesterday.getSelf() + yesterday.getShared() + yesterday.getInvite());
 			// 鏈湀
-			OrderCountVO thisMonth = commonOrderService.getOrderCount(uid, 3, type);
+			OrderCountVO thisMonth = commonOrderService.getOrderCount(uid, 3, listSource);
 			thisMonth.setTotal(thisMonth.getSelf() + thisMonth.getShared() + thisMonth.getInvite());
 			// 涓婃湀
-			OrderCountVO lastMonth = commonOrderService.getOrderCount(uid, 4, type);
+			OrderCountVO lastMonth = commonOrderService.getOrderCount(uid, 4, listSource);
 			lastMonth.setTotal(lastMonth.getSelf() + lastMonth.getShared() + lastMonth.getInvite());
 
 			data.put("today", today);
@@ -368,9 +386,9 @@
 			show = hongBaoV2CountService.getHongBaoCount(uid, null) > 0;
 		}
 		
-		BigDecimal selfMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 1);
-		BigDecimal shareMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 2);
-		BigDecimal inviteMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 3);
+		BigDecimal selfMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 1, null);
+		BigDecimal shareMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 2, null);
+		BigDecimal inviteMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 3, null);
 		
 		JSONObject data = new JSONObject();
 		data.put("show", show);

--
Gitblit v1.8.0