|
@@ -9,6 +9,7 @@ import java.util.*;
|
|
|
import com.iamberry.wechat.core.entity.activity.ActivityDate;
|
|
|
import com.iamberry.wechat.core.entity.admin.FullReduction;
|
|
|
import com.iamberry.wechat.core.entity.coupon.CouponItem;
|
|
|
+import com.iamberry.wechat.core.entity.coupon.CouponItemDto;
|
|
|
import com.iamberry.wechat.core.entity.coupon.CouponType;
|
|
|
import com.iamberry.wechat.core.entity.thanksgiving.ThanksGiving;
|
|
|
import com.iamberry.wechat.face.coupon.CouponItemService;
|
|
@@ -497,24 +498,33 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
if (fromUserName == null) {
|
|
|
return NameUtils.getConfig("FEMALE_LADY_ERROR");
|
|
|
}
|
|
|
-
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date = new Date();
|
|
|
Calendar endCalendar = Calendar.getInstance();
|
|
|
- endCalendar.set(2019,6,18,23,59,59);
|
|
|
+ endCalendar.set(2019,5,18,23,59,59);
|
|
|
Date endDate = endCalendar.getTime();
|
|
|
+ logger.info("活动截止时间:"+formatter.format(endCalendar.getTime()) );
|
|
|
if(endDate.before(date)){//date>endDate?true:false
|
|
|
- return "活动已过期,请稍后重试!";
|
|
|
+ return ResultInfo.eventExpiredMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ CouponItemDto couponItemDto = new CouponItemDto();
|
|
|
+ couponItemDto.setUseropenid(fromUserName); //useropenid
|
|
|
+ couponItemDto.setCouponId(10002);
|
|
|
+ Integer count = couponItemService.getCouponItemCount(couponItemDto);
|
|
|
+ if(count > 0){
|
|
|
+ return ResultInfo.repeatCollectionMsg;
|
|
|
}
|
|
|
|
|
|
Integer couponId = 10002;
|
|
|
CouponType couponType = couponTypeService.getCouponTypeById(couponId);
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.set(Calendar.YEAR, 2019);
|
|
|
- calendar.set(Calendar.MONTH, 6);
|
|
|
+ calendar.set(Calendar.MONTH, 5);
|
|
|
calendar.set(Calendar.DAY_OF_MONTH, 18);
|
|
|
calendar.set(Calendar.HOUR_OF_DAY,23);
|
|
|
calendar.set(Calendar.MINUTE,59);
|
|
|
- calendar.set(Calendar.SECOND,59);
|
|
|
+ calendar.set(Calendar.SECOND,50);
|
|
|
CouponItem couponItem = new CouponItem();
|
|
|
String uuidStr = StrUtils.getUUID();
|
|
|
couponItem.setCouponItemId(uuidStr);
|
|
@@ -526,7 +536,7 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
couponItem.setCouponItemRemark(couponType.getCouponRemark());
|
|
|
Integer flag = couponItemService.insertCouponItem(couponItem);
|
|
|
if(flag < 1){
|
|
|
- return "领取优惠券失败,请稍后重试!";
|
|
|
+ return ResultInfo.failedReceiveMsg;
|
|
|
}
|
|
|
|
|
|
// 推送信息
|
|
@@ -537,12 +547,12 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
"有效期至2019-06-18",
|
|
|
"可在“会员中心—券包”查看,请尽快使用。",
|
|
|
fromUserName,
|
|
|
- ResultInfo.SERVICE_PUSH_URL);
|
|
|
+ ResultInfo.INDEX_URL);
|
|
|
}catch (Exception e){
|
|
|
logger.info("推送消息失败,失败openId:"+fromUserName);
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return "";
|
|
|
+ return ResultInfo.successReceiveMsg;
|
|
|
}
|
|
|
|
|
|
/**
|