From 92c681fabac989d1a9f16fa13202d7f5ccac52d9 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 14 一月 2019 10:22:22 +0800
Subject: [PATCH] 订单优化 + 后台提现曲线图

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java
index 8756443..666a04a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java
@@ -7,20 +7,29 @@
 
 import javax.annotation.Resource;
 
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
 import com.yeshi.fanli.entity.admin.ReslutOrder;
+import com.yeshi.fanli.entity.bus.user.HongBaoV2;
 import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.RedisManager;
+import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
+import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
 
 @Service
 public class TaoBaoOrderServiceImpl implements TaoBaoOrderService {
 
 	@Resource
 	private TaoBaoOrderMapper taoBaoOrderMapper;
+
+	@Resource
+	private RedisManager redisManager;
 
 	@Override
 	public void addTaoBaoOrderList(List<TaoBaoOrder> list) {
@@ -30,7 +39,27 @@
 		Iterator<String> its = map.keySet().iterator();
 		while (its.hasNext()) {
 			String orderId = its.next();
+			String key = "addorder-" + orderId;
+			// redis鍋氶鐜囬檺鍒�
+			try {
+				if (Constant.IS_OUTNET) {
+					if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
+						continue;
+					}
+				}
+
+			} catch (Exception e) {
+
+			}
 			addTaoBaoOrder(orderId, map.get(orderId));
+			try {
+				// 6灏忔椂鍐呬笉鍐嶅鐞�
+				if (Constant.IS_OUTNET)
+					redisManager.cacheCommonString(key, "1", 60 * 60 * 6);
+			} catch (Exception e) {
+
+			}
+
 		}
 	}
 
@@ -61,31 +90,59 @@
 		}
 	}
 
-
 	@Override
 	public List<TaoBaoOrder> getTaoBaoOrderByOrderId(String orderId) {
 		return taoBaoOrderMapper.selectTaoBaoOrderByOrderId(orderId);
 	}
 
 	@Override
-	public List<ReslutOrder> queryJoinHongBao (int start, int count, String key,
-			String startTime,String endTime,Integer type,Integer days) throws Exception{
+	public List<ReslutOrder> queryJoinHongBao(int start, int count, String key, String startTime, String endTime,
+			Integer type, Integer days) throws Exception {
 		return taoBaoOrderMapper.queryJoinHongBao(start, count, key, startTime, endTime, type, days);
 	}
-	
+
 	@Override
-	public int countQueryJoinHongBao(String key, String startTime,String endTime,Integer type,Integer days)throws Exception {
+	public int countQueryJoinHongBao(String key, String startTime, String endTime, Integer type, Integer days)
+			throws Exception {
 		return taoBaoOrderMapper.countQueryJoinHongBao(key, startTime, endTime, type, days);
 	}
+
+	@Override
+	public double countEstimate(String date) throws Exception {
+		return taoBaoOrderMapper.countEstimate(date);
+	}
+
+	@Override
+	public List<TaoBaoOrder> getStateByOrderIdAndPayment(String orderId, String payment) throws Exception {
+		return taoBaoOrderMapper.getStateByOrderIdAndPayment(orderId, payment);
+	}
+
 	
 	@Override
-	public double countEstimate(String date)throws Exception {
-		return taoBaoOrderMapper.countEstimate(date);
+	public List<TaoBaoOrderVO> listQuery(int start, int count, String key, 
+			String startTime, String endTime, Integer state) throws Exception {
+		
+		List<TaoBaoOrderVO> listData = taoBaoOrderMapper.listQuery(start, count, key, startTime, endTime, state);
+		
+		for (TaoBaoOrderVO taoBaoOrderVO : listData) {
+			
+			String orderState = taoBaoOrderVO.getOrderState();
+			if ("璁㈠崟浠樻".equals(orderState)) {
+				taoBaoOrderVO.setOrderState("1");
+			}else if ("璁㈠崟缁撶畻".equals(orderState) || "璁㈠崟鎴愬姛".equals(orderState)) {
+				taoBaoOrderVO.setOrderState("2");
+			} else if ("璁㈠崟澶辨晥".equals(orderState)) {
+				taoBaoOrderVO.setOrderState("3");
+			}
+		}
+		
+		return listData;
 	}
 	
 	@Override
-	public List<TaoBaoOrder> getStateByOrderIdAndPayment(String orderId, String payment )throws Exception {
-		return taoBaoOrderMapper.getStateByOrderIdAndPayment(orderId, payment);
+	public long countQuery(String key, String startTime, String endTime, 
+			Integer state) throws Exception {
+		return taoBaoOrderMapper.countQuery(key, startTime, endTime, state);
 	}
 	
 }

--
Gitblit v1.8.0