From 309a22d0624e8fec46f4b6722ed6135fe0a2ea3d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 27 二月 2019 15:43:51 +0800
Subject: [PATCH] 免单商品的红包处理

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java
index 22286a1..7c51f69 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java
@@ -1,5 +1,6 @@
 package com.yeshi.fanli.service.impl.user;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.Resource;
@@ -8,15 +9,15 @@
 
 import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper;
 import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
+import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
 
 @Service
 public class UserSystemCouponRecordServiceImpl implements UserSystemCouponRecordService {
-	
+
 	@Resource
 	private UserSystemCouponRecordMapper userSystemCouponRecordMapper;
 
-	
 	@Override
 	public int insertSelective(UserSystemCouponRecord record) {
 		return userSystemCouponRecordMapper.insertSelective(record);
@@ -36,14 +37,14 @@
 	public int updateByPrimaryKey(UserSystemCouponRecord record) {
 		return userSystemCouponRecordMapper.updateByPrimaryKey(record);
 	}
-	
+
 	@Override
-	public List<UserSystemCouponRecord>  getRecordByState(Long uid, Integer state) {
+	public List<UserSystemCouponRecord> getRecordByState(Long uid, Integer state) {
 		return userSystemCouponRecordMapper.getRecordByState(uid, state);
 	}
 
 	@Override
-	public UserSystemCouponRecord  getRecordByOrderNo(String orderNo, Integer state) {
+	public UserSystemCouponRecord getRecordByOrderNo(String orderNo, Integer state) {
 		return userSystemCouponRecordMapper.getRecordByOrderNo(orderNo, state);
 	}
 
@@ -51,10 +52,26 @@
 	public List<UserSystemCouponRecord> getRecordByOrderNoList(List<String> list) {
 		return userSystemCouponRecordMapper.getRecordByOrderNoList(list);
 	}
-	
+
 	@Override
 	public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, long seconds) {
 		return userSystemCouponRecordMapper.getCouponByUsingTimeOut(uid, seconds);
 	}
 
+	@Override
+	public boolean isSuccessMianDan(String orderId) {
+		List<String> orderList = new ArrayList<>();
+		orderList.add(orderId);
+		List<UserSystemCouponRecord> list = getRecordByOrderNoList(orderList);
+		for (UserSystemCouponRecord record : list) {
+			if (record.getCouponType().equalsIgnoreCase(CouponTypeEnum.freeCoupon.name())
+					|| record.getCouponType().equalsIgnoreCase(CouponTypeEnum.welfareFreeCoupon.name())) {
+				if (record.getState() == UserSystemCouponRecord.STATE_FREE_ON
+						|| record.getState() == UserSystemCouponRecord.STATE_SUCCESS)
+					return true;
+			}
+		}
+		return false;
+	}
+
 }

--
Gitblit v1.8.0