From 24a8d17e007545f7426c48352109aa1a9c6587ee Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 06 五月 2020 12:02:09 +0800
Subject: [PATCH] IOS上线隐藏我的界面的banner与超级会员升级信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java |   73 +++++++++++++++++++++++++-----------
 1 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java
index d2a9893..f9aefe4 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/LostOrderServiceImpl.java
@@ -1,5 +1,6 @@
 package com.yeshi.fanli.service.impl.order;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -16,11 +17,15 @@
 import com.yeshi.fanli.entity.bus.user.HongBaoV2;
 import com.yeshi.fanli.entity.bus.user.LostOrder;
 import com.yeshi.fanli.entity.bus.user.Order;
+import com.yeshi.fanli.entity.order.CommonOrder;
+import com.yeshi.fanli.entity.order.HongBaoOrder;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
 import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
 import com.yeshi.fanli.service.inter.order.LostOrderService;
 import com.yeshi.fanli.service.inter.order.OrderService;
+import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
+import com.yeshi.fanli.service.inter.order.tb.TaoBaoPunishOrderService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.Utils;
 
@@ -42,6 +47,9 @@
 	@Resource
 	private UserOrderMsgNotificationService userOrderMsgNotificationService;
 
+	@Resource
+	private TaoBaoPunishOrderService taoBaoPunishOrderService;
+
 	@Transactional
 	@Override
 	public int addLostOrder(LostOrder lostOrder) {
@@ -50,6 +58,14 @@
 		if (type == null) { // 榛樿涓烘窐瀹濊鍗�
 			lostOrder.setType(1);
 			type = 1;
+		}
+
+		// 鏄惁澶勪簬杩濊璁㈠崟涓�
+		if (type == 1) {
+			int count = taoBaoPunishOrderService.countByTradeParentId(orderId);
+			if (count > 0) {
+				return -1001;
+			}
 		}
 
 		// 璁㈠崟鏄惁宸茬敵璇�
@@ -72,12 +88,12 @@
 		}
 
 		// 鏄惁涓哄垎浜禋璁㈠崟
-		if (hongBaoOrderService.countByOrderNoAndHongBaoType(orderId, HongBaoV2.TYPE_SHARE_GOODS) > 0)
+		if (hongBaoOrderService.countByOrderNoAndHongBaoType(orderId, HongBaoV2.TYPE_SHARE_GOODS, type) > 0)
 			return -5;
 
 		// 娆℃暟闄愬埗
 		long count = lostOrderMapper.countTodayAppeal(lostOrder.getUserInfo().getId());
-		String countMax = configService.get("order_appeal_count_day");
+		String countMax = configService.get(ConfigKeyEnum.orderAppealCountDay.getKey());
 		if (countMax != null && countMax.trim().length() > 0 && count >= Long.parseLong(countMax)) {
 			return -7;
 		}
@@ -105,7 +121,7 @@
 				lostOrderwriteLock.unlock();
 			}
 
-			Order or = orderService.getSystemOrderByUid(Constant.TAOBAO, lostOrder.getUserInfo().getId());
+			Order or = orderService.getSystemOrderByUid(type, lostOrder.getUserInfo().getId());
 			if (or != null) {
 				boolean b = Utils.isUserOrder(or.getOrderId(), lostOrder.getOrderId());
 				if (b) {
@@ -225,11 +241,22 @@
 				update.setId(lo.getId());
 				update.setResultCode(LostOrder.RESULT_CODE_SUCCESS);
 				lostOrderMapper.updateByPrimaryKeySelective(update);
-				Order order = orderService.findOrderByOrderIdAndType(orderId, Order.ORDER_TYPE_TAOBAO);
+				Order order = orderService.findOrderByOrderIdAndType(orderId, orderType);
+
+				List<HongBaoOrder> hongBaoOrderList = hongBaoOrderService.listDetailByOrderIdAndSourceType(orderId,
+						orderType);
+				int goodsCount = 0;
+				BigDecimal fanMoney = new BigDecimal(0);
+				for (HongBaoOrder hongBaoOrder : hongBaoOrderList) {
+					if (hongBaoOrder.getCommonOrder().getState() != CommonOrder.STATE_SX) {
+						goodsCount += hongBaoOrder.getCommonOrder().getCount();
+						fanMoney = fanMoney.add(hongBaoOrder.getHongBaoV2().getMoney());
+					}
+				}
+				
 				if (order != null)
-					// 娣诲姞閫氱煡
-					userOrderMsgNotificationService.orderFoundSuccess(lo.getUserInfo().getId(), lo.getOrderId(),
-							order.getMoney(), 1, new Date(lo.getHandleTime()));
+					userOrderMsgNotificationService.orderFoundSuccess(lo.getUserInfo().getId(), orderId, orderType,
+							Constant.TYPE_REBATE, order.getMoney(), fanMoney, goodsCount, new Date(lo.getCreateTime()));
 			}
 		}
 	}
@@ -244,8 +271,7 @@
 				update.setResultCode(LostOrder.RESULT_CODE_FAIL);
 				lostOrderMapper.updateByPrimaryKeySelective(update);
 				// 娣诲姞閫氱煡
-				userOrderMsgNotificationService.orderFoundFail(order.getUserInfo().getId(), order.getOrderId(), null, 1,
-						new Date(order.getHandleTime()));
+				userOrderMsgNotificationService.orderFoundFail(order.getUserInfo().getId(), order.getOrderId());
 			}
 	}
 
@@ -262,8 +288,7 @@
 				update.setResultCode(LostOrder.RESULT_CODE_FAIL);
 				lostOrderMapper.updateByPrimaryKeySelective(update);
 				// 娣诲姞閫氱煡
-				userOrderMsgNotificationService.orderFoundFail(order.getUserInfo().getId(), order.getOrderId(), null, 1,
-						new Date(order.getHandleTime()));
+				userOrderMsgNotificationService.orderFoundFail(order.getUserInfo().getId(), order.getOrderId());
 			}
 	}
 
@@ -292,25 +317,24 @@
 	 * @return
 	 */
 	@Override
-	public List<LostOrder> listQuery(long start, int count, String key, Integer state, Integer handleType) {
-		return lostOrderMapper.listQuery(start, count, key, state, handleType);
+	public List<LostOrder> listQuery(long start, int count, String key, Integer state, Integer handleType,
+			Integer type) {
+		return lostOrderMapper.listQuery(start, count, key, state, handleType, type);
 	}
 
 	@Override
-	public long countQuery(String key, Integer state, Integer handleType) {
-		return lostOrderMapper.countQuery(key, state, handleType);
+	public long countQuery(String key, Integer state, Integer handleType, Integer type) {
+		return lostOrderMapper.countQuery(key, state, handleType, type);
 	}
 
 	@Override
-	public List<Map<String, Object>> countLostNum(Integer dateType, Integer resultCode, String year, String startTime,
-			String endTime) throws Exception {
-		return lostOrderMapper.countLostNum(dateType, resultCode, year, startTime, endTime);
+	public Integer countLostOrderNum(String preDay, int resultCode) {
+		return lostOrderMapper.countLostOrderNum(preDay, resultCode);
 	}
 
 	@Override
-	public List<Map<String, Object>> countAppealMoney(Integer dateType, String year, String startTime, String endTime)
-			throws Exception {
-		return lostOrderMapper.countAppealMoney(dateType, year, startTime, endTime);
+	public BigDecimal countAppealMoney(String preDay) {
+		return lostOrderMapper.countAppealMoney(preDay);
 	}
 
 	@Override
@@ -318,4 +342,9 @@
 		return lostOrderMapper.listByStateAndResultCode(state, resultCode, (page - 1) * pageSize, pageSize);
 	}
 
+	@Override
+	public void saveLostOrder(LostOrder lostOrder) {
+		lostOrderMapper.insertSelective(lostOrder);
+	}
+
 }

--
Gitblit v1.8.0