Browse Source

积分商城

wangxiaoming 7 years ago
parent
commit
c2642da071

+ 1 - 1
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/coupon/CouponType.java

@@ -29,7 +29,7 @@ public class CouponType implements Serializable{
 	private Integer couponGetLimit;				//每人限领多少张
 	private Integer couponType;					//优惠券折扣类型
 	private Integer couponIsConcern;			//是否必须关注
-	private Integer couponIsPurchase;			//是否必须购买		1:是  2:否
+	private Integer couponIsPurchase;			//是否必须购买		1:是  2:否  3:其他优惠券     是否必须购买牙刷
 	private Integer couponConsumeEnough;		//消费总金额要求(满足这个条件才能领券)
 
 	private Integer couponReduce;				//减免率或者减免额

+ 1 - 1
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/couponItemMapper.xml

@@ -42,7 +42,7 @@
 				AND CI.COUPON_USE_STATUS IN (#{couponUseStatus},#{couponReduce})
 			</if>
 			<if test="beginDate != null and beginDate != ''">
-				AND CI.COUPON_USE_END_DATE<![CDATA[>]]>#{beginDate}
+				AND date_format(CI.COUPON_USE_END_DATE,'%Y-%m-%d') >= date_format(#{beginDate},'%Y-%m-%d')
 			</if>
 			<if test="endDate != null and endDate != ''">
 				AND CI.COUPON_USE_END_DATE<![CDATA[<]]>#{endDate}

+ 21 - 11
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/order/OrderHandler.java

@@ -1,9 +1,6 @@
 package com.iamberry.wechat.handles.order;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -224,11 +221,17 @@ public class OrderHandler {
 						flag = false;
 					}
 				}
-				Date couponUseEndDate = couponItemDto.getCouponUseEndDate();
-				/*控制是否过期*/
-				if((couponUseEndDate.getTime() < new Date().getTime())  ){
-					flag = false;
-				}
+//				Date couponUseEndDate = couponItemDto.getCouponUseEndDate();
+//				Calendar nowTime = Calendar.getInstance();
+//				nowTime.setTime(couponUseEndDate);
+//				nowTime.set(Calendar.HOUR_OF_DAY, 23);
+//				nowTime.set(Calendar.MINUTE, 59);
+//				nowTime.set(Calendar.SECOND, 59);
+//				couponUseEndDate = nowTime.getTime();
+//				/*控制是否过期*/
+//				if((couponUseEndDate.getTime() < new Date().getTime())  ){
+//					flag = false;
+//				}
 			}else{
 				flag = false;
 			}
@@ -460,7 +463,15 @@ public class OrderHandler {
 				msg.setMessage(ResultInfo.COUPON_INVALID); //优惠券无效
 				return msg;
 			}
-			if(couponItem.getCouponUseEndDate().getTime()<nowDate.getTime()){
+
+			Date couponUseEndDate = couponItem.getCouponUseEndDate();
+			Calendar nowTime = Calendar.getInstance();
+			nowTime.setTime(couponUseEndDate);
+			nowTime.set(Calendar.HOUR_OF_DAY, 23);
+			nowTime.set(Calendar.MINUTE, 59);
+			nowTime.set(Calendar.SECOND, 59);
+			couponUseEndDate = nowTime.getTime();
+			if(couponUseEndDate.getTime()<nowDate.getTime()){
 				msg.setMessage(ResultInfo.COUPON_OUTOFDATE); //优惠券过期
 				return msg;
 			}
@@ -470,7 +481,6 @@ public class OrderHandler {
 				msg.setMessage(ResultInfo.COUPON_CONSUME_NO_ENOUGH); //消费额度不足
 				return msg;
 			}
-
 				/*新人卷没有其他限制*/
 			if(couponItemDto.getCouponIsNewPeople() == 1){  //当券为新人券
 				if(member.getUserIdentity() != 1 || !brush1Flag || !brush2Flag){  //不为会员,或者没有牙刷刷头都无法使用