From 6dfb4599cee5c19f4d1c5cc344a4f84de1c1633c Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 16 十二月 2019 15:26:57 +0800
Subject: [PATCH] 冲突信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java |   95 ++++++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
index 166faa4..a6075af 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -52,6 +52,7 @@
 import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
 import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
 import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
+import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
 import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
@@ -121,6 +122,9 @@
 
 	@Resource
 	private UserVIPInfoService userVIPInfoService;
+
+	@Resource
+	private UserInfoService userInfoService;
 
 	// 濂栧姳璁㈠崟鍥剧墖
 	public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
@@ -200,10 +204,9 @@
 
 		// 鏁版嵁鍔犲伐閲嶆柊缁勭粐
 		orderVOFactory(acceptData, listOrder, listGoods, uid);
-		
+
 		return listOrder;
 	}
-
 
 	/**
 	 * 璁㈠崟淇℃伅鍔犲伐
@@ -269,11 +272,11 @@
 					order.setVipOrder(false);
 			} else
 				order.setVipOrder(false);
-			
-			if(order.isVipOrder())
+
+			if (order.isVipOrder())
 				order.setVipOrderDesc("璁㈠崟鏉ユ簮锛氱敱瓒呯骇浼氬憳鐨勭矇涓濅骇鐢�");
 		}
-		
+
 		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
 		SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
 		// 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭�
@@ -489,7 +492,7 @@
 				}
 			}
 			order.setSignList(signList);
-			
+
 			String hongBaoDate = null;
 			String hongBaoState_Str = "";
 			String hongbaoInfoFontColor = "#E5005C";
@@ -549,21 +552,21 @@
 			hongBaoMap.put("content", hongbaoInfo + " 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
 			hongBaoMap.put("fontColor", hongbaoInfoFontColor);
 			order.setHongBaoInfo(hongBaoMap);
-			
+
 			// 鏄剧ず杩斿埄銆佸厤鍗曡鎯�
 			if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
 				// 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍
 				if (sourceType == null) {
 					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
-					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
-							listRecordTB, uid, vip, acceptData);
+					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip,
+							acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_JD) {
-					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
-							listRecordJD, uid, vip, acceptData);
+					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip,
+							acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_PDD) {
-					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
-							listRecordPDD, uid, vip, acceptData);
+					couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip,
+							acceptData);
 				}
 			}
 
@@ -575,8 +578,7 @@
 			}
 		}
 	}
-	
-	
+
 	/**
 	 * 璁㈠崟锛� 鍏嶅崟鏍囪瘑 濂栧姳鏍囪瘑
 	 * 
@@ -586,21 +588,21 @@
 	 * @param list
 	 * @param signList
 	 */
-	private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon,	Integer hongBaoState,
-			Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception{
+	private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType,
+			List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception {
 
 		// 鏄惁鍏嶅崟鍟嗗搧
 		boolean freeOrder = false;
 		// 鏄惁濂栧姳鎴愬姛
 		boolean rewardSuccess = false;
 		boolean version2_1 = VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion());
-		
+
 		if (list != null && list.size() > 0) {
 			for (UserSystemCouponRecord couponRecord : list) {
 				int goodSource = couponRecord.getGoodSource();
 				if (goodSource == 0)
 					goodSource = 1;
-					
+
 				if (order.getOrderNo().equals(couponRecord.getOrderNo()) && goodSource == order.getSourceType()) {
 					Integer state = couponRecord.getState();
 					String systemCouponType = couponRecord.getCouponType();
@@ -634,7 +636,7 @@
 				}
 			}
 		}
-		
+
 		// 鍏嶅崟璇︽儏
 		if (freeOrder) {
 			ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
@@ -658,19 +660,19 @@
 			rewardMap.put("jump", jump);
 			order.setRewardDetail(rewardMap);
 		}
-		
+
 		// 宸蹭娇鐢ㄥ鍔卞埜
 		if (rewardSuccess) {
 			ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
 			rewardStyleVO.setColor("#E5005C");
 			rewardStyleVO.setBottomColor("#FFDCEA");
-			
+
 			if (version2_1) {
 				rewardStyleVO.setContent("宸蹭娇鐢ㄥ鍔卞埜 >");
 			} else {
 				rewardStyleVO.setContent("杩斿埄濂栧姳 >");
 			}
-			
+
 			Map<String, Object> rewardMap = new HashMap<String, Object>();
 			rewardMap.put("text", rewardStyleVO);
 			Map<String, Object> jumpLink = new HashMap<String, Object>();
@@ -678,15 +680,15 @@
 			jumpLink.put("goodsType", order.getSourceType() + "");
 
 			Map<String, Object> jump = new HashMap<String, Object>();
-			jump.put("type", 1); // 1 甯歌璺宠浆椤甸潰 
+			jump.put("type", 1); // 1 甯歌璺宠浆椤甸潰
 			jump.put("params", jumpLink);
 			jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
 			rewardMap.put("jump", jump);
 			order.setRewardDetail(rewardMap);
 		}
-				
+
 		// 鏄惁鍙娇鐢ㄥ鍔卞埜
-		if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType 
+		if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
 				&& HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) {
 			// 涓嬪崟鏃堕棿
 			Date thirdCreateTime = order.getThirdCreateTime();
@@ -694,11 +696,11 @@
 			Date accountTime = order.getAccountTime();
 			if (thirdCreateTime == null || accountTime == null)
 				return;
-			
+
 			// 涓嬪崟鏃ユ湡鏄惁鏄鍚堜笂绾挎棩鏈�
-			long downOrderTime = thirdCreateTime.getTime();
+			long downOrderTime = thirdCreateTime.getTime();
 			long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
-			if (downOrderTime > limitDate)  {
+			if (downOrderTime > limitDate)  {
 				// 2.1 寮�濮嬫柊鐗�
 				rewardCounponLimitTime(order, accountTime);
 			} else if (hasRewardCoupon) {
@@ -707,16 +709,16 @@
 				rewardStyleVO.setColor("#E5005C");
 				rewardStyleVO.setBottomColor("#FFDCEA");
 				rewardStyleVO.setContent("杩斿埄濂栧姳 >");
-				
+
 				Map<String, Object> jumpLink = new HashMap<String, Object>();
 				jumpLink.put("orderNo", order.getOrderNo());
 				jumpLink.put("goodsType", order.getSourceType() + "");
-				
+
 				Map<String, Object> jump = new HashMap<String, Object>();
 				jump.put("type", 2); // 寮规
 				jump.put("params", jumpLink);
 				jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
-				
+
 				Map<String, Object> rewardMap = new HashMap<String, Object>();
 				rewardMap.put("text", rewardStyleVO);
 				rewardMap.put("jump", jump);
@@ -725,13 +727,13 @@
 		}
 	}
 
-	private void rewardCounponLimitTime(CommonOrderVO order,Date accountTime) throws Exception {
+	private void rewardCounponLimitTime(CommonOrderVO order, Date accountTime) throws Exception {
 		// 鍊掕鏃堕獙璇�
 		Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
 		long currentTime = java.lang.System.currentTimeMillis();
 		if (endDay.getTime() <= currentTime)
 			return;
-					
+
 		String num = null;
 		String unit = null;
 		boolean canUse = false;
@@ -762,16 +764,16 @@
 		}
 
 		// 宸茬粡瓒呮椂
-		if (!canUse) 
+		if (!canUse)
 			return;
-		
+
 		Map<String, Object> rewardMap = new HashMap<String, Object>();
 		ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
 		rewardStyleVO.setColor("#E5005C");
 		rewardStyleVO.setBottomColor("#FFDCEA");
 		rewardStyleVO.setContent("浣跨敤濂栧姳鍒�");
 		rewardMap.put("text", rewardStyleVO);
-		
+
 		ClientTextStyleVO txt1 = new ClientTextStyleVO();
 		txt1.setContent("鍓�");
 		txt1.setColor("#666666");
@@ -804,13 +806,12 @@
 		rewardMap.put("jump", jump);
 		order.setRewardDetail(rewardMap);
 	}
-	
-	
+
 	@Override
 	public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
 		return commonOrderMapper.countHistoryOrder(uid, day, source);
 	}
-	
+
 	@Override
 	public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
 		return commonOrderMapper.getOrderCount(uid, day, source);
@@ -1093,6 +1094,16 @@
 		if (oldCommonOrder == null)// 鏂板
 		{
 			commonOrder.setCreateTime(new Date());
+			// 鏌ヨ鏄惁涓簐ip
+			boolean isVIP = userVIPInfoService.isVIP(commonOrder.getUserInfo().getId());
+			if (isVIP)
+				commonOrder.setUrank(100);// VIP璁㈠崟
+			else {
+				UserInfo user = userInfoService.selectAvailableByPrimaryKey(commonOrder.getUserInfo().getId());
+				if (user != null)
+					commonOrder.setUrank(user.getRank());
+			}
+
 			commonOrderMapper.insertSelective(commonOrder);
 			// 鎻掑叆鏄犲皠锛屼繚璇佷氦鏄揑D鐨勫畬鏁存��
 			commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
@@ -1527,8 +1538,8 @@
 		JSONObject map = new JSONObject();
 		// 璁㈠崟鏍囪瘑
 		List<String> signList = new ArrayList<String>();
-		//signList.add(CommonOrder.TYPE_FANLI);
-		//signList.add(PIC_REWARD); // 鍔犲叆濂栧姳鎴愬姛鍥剧墖
+		// signList.add(CommonOrder.TYPE_FANLI);
+		// signList.add(PIC_REWARD); // 鍔犲叆濂栧姳鎴愬姛鍥剧墖
 		map.put("signList", signList);
 
 		ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();

--
Gitblit v1.8.0