|
@@ -3,6 +3,7 @@ package com.caimei.modules.coupon.web;
|
|
import com.caimei.modules.coupon.entity.CmCoupon;
|
|
import com.caimei.modules.coupon.entity.CmCoupon;
|
|
import com.caimei.modules.coupon.entity.CmCouponAssociate;
|
|
import com.caimei.modules.coupon.entity.CmCouponAssociate;
|
|
import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
|
|
import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
|
|
|
|
+import com.caimei.modules.coupon.redis.RedisLearn;
|
|
import com.caimei.modules.coupon.service.CmCouponService;
|
|
import com.caimei.modules.coupon.service.CmCouponService;
|
|
import com.caimei.modules.product.entity.Product;
|
|
import com.caimei.modules.product.entity.Product;
|
|
import com.caimei.modules.product.service.ProductService;
|
|
import com.caimei.modules.product.service.ProductService;
|
|
@@ -16,6 +17,7 @@ import com.caimei.modules.user.entity.NewCmShop;
|
|
import com.caimei.utils.AppUtils;
|
|
import com.caimei.utils.AppUtils;
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
|
|
+import com.thinkgem.jeesite.common.utils.JedisUtils;
|
|
import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
import com.thinkgem.jeesite.common.web.BaseController;
|
|
import com.thinkgem.jeesite.common.web.BaseController;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
+import redis.clients.jedis.Jedis;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -129,129 +132,265 @@ public class CmCouponController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //优惠券站内消息推送
|
|
|
|
+ private void consumer(CmCoupon cmCoupon,List<Integer> clubIds) {
|
|
|
|
+ Jedis jedis = new Jedis("127.0.0.1", 6379);
|
|
|
|
+ // 消费消息
|
|
|
|
+ while (true) {
|
|
|
|
+ clubIds.forEach(clubIdb -> {
|
|
|
|
+ // 获取消息
|
|
|
|
+ String clubIdc = jedis.rpop(clubIdb.toString());
|
|
|
|
+ Integer clubId= Integer.parseInt(clubIdc);
|
|
|
|
+ if (clubId != null) {
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
+
|
|
|
|
+ CmUser user = messageCenterDao.clubList(clubId);
|
|
|
|
+ int coumt = 0;//计数五种消息只推送一条
|
|
|
|
+ String catego = "";
|
|
|
|
+ Integer ts = (date.compareTo(cmCoupon.getStartDate()));
|
|
|
|
+ if (ts >= 0) {
|
|
|
|
+ if ("90".equals(user.getClubStatus())) {
|
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(0);//查询优惠券信息
|
|
|
|
+ if (coupon != null) {
|
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(clubId);
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
|
+ messageCenter.setContent(null);
|
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
|
+ messageCenter.setCouponType(0);
|
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
|
+ messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+ jedis.del(clubIdc);
|
|
|
|
+ coumt++;
|
|
|
|
+ }
|
|
|
|
+ } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(1);//查询优惠券信息
|
|
|
|
+ if (coupon != null) {
|
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(clubId);
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
|
+ if (coupon != null && "1".equals(coupon.getCategoryType())) {
|
|
|
|
+ catego = "产品";
|
|
|
|
+ }
|
|
|
|
+ if (coupon != null && "2".equals(coupon.getCategoryType())) {
|
|
|
|
+ catego = "仪器";
|
|
|
|
+ }
|
|
|
|
+ messageCenter.setContent(catego);
|
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
|
+ messageCenter.setCouponType(1);
|
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
|
+ messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+ jedis.del(clubIdc);
|
|
|
|
+ coumt++;
|
|
|
|
+ }
|
|
|
|
+ } else if (coumt == 0) {
|
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(2);//查询优惠券信息
|
|
|
|
+ if (coupon != null) {
|
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(clubId);
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
|
+ messageCenter.setContent(null);
|
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
|
+ messageCenter.setCouponType(2);
|
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
|
+ messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+ jedis.del(clubIdc);
|
|
|
|
+ coumt++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(3);//查询优惠券信息
|
|
|
|
+ if (coupon != null) {
|
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(clubId);
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
|
+ messageCenter.setContent(user.getName());
|
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
|
+ messageCenter.setCouponType(3);
|
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
|
+ messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+ jedis.del(clubIdc);
|
|
|
|
+ coumt++;
|
|
|
|
+ }
|
|
|
|
+ } else if (coumt == 0) {
|
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
|
|
|
|
+ if (coupon != null) {
|
|
|
|
+ String startDate = sdf.format(coupon.getStartDate());
|
|
|
|
+ int num = startDate.compareTo(user.getRegisterTime());
|
|
|
|
+ if (num > 0) {
|
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+ if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
+ messageCenter.setShopId(null);
|
|
|
|
+ messageCenter.setClubId(clubId);
|
|
|
|
+ messageCenter.setUserType(1);
|
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
|
+ messageCenter.setContent(null);
|
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
|
+ messageCenter.setCouponType(4);
|
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
|
+ messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+ jedis.del(clubIdc);
|
|
|
|
+ coumt++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@RequestMapping(value = "save")
|
|
@RequestMapping(value = "save")
|
|
public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) throws ParseException {
|
|
public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) throws ParseException {
|
|
if (!beanValidator(model, cmCoupon)) {
|
|
if (!beanValidator(model, cmCoupon)) {
|
|
return form(cmCoupon, model);
|
|
return form(cmCoupon, model);
|
|
}
|
|
}
|
|
|
|
+ List<Integer> clubIds = messageCenterDao.ClubIds();
|
|
|
|
+ new Thread(() -> consumer(cmCoupon,clubIds)).start();
|
|
|
|
+ // 生产者
|
|
|
|
+ RedisLearn.producer(clubIds);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 站内消息-优惠券推送
|
|
|
|
- */
|
|
|
|
- Date date = new Date();
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
- //登入的日期
|
|
|
|
- List<Integer> clubIds=messageCenterDao.ClubIds();
|
|
|
|
- clubIds.forEach(clubId->{
|
|
|
|
- CmUser user = messageCenterDao.clubList(clubId);
|
|
|
|
- int coumt = 0;//计数五种消息只推送一条
|
|
|
|
- String catego = "";
|
|
|
|
- Integer ts=(date.compareTo(cmCoupon.getStartDate()));
|
|
|
|
- if(ts>=0){
|
|
|
|
- if ("90".equals(user.getClubStatus())) {
|
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(0);//查询优惠券信息
|
|
|
|
- if(coupon!=null){
|
|
|
|
- String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(clubId);
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(4);
|
|
|
|
- messageCenter.setContent(null);
|
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
|
- messageCenter.setCouponType(0);
|
|
|
|
- messageCenter.setCouponMessageType(1);
|
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
- coumt++;
|
|
|
|
- }
|
|
|
|
- } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(1);//查询优惠券信息
|
|
|
|
- if(coupon!=null) {
|
|
|
|
- String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(clubId);
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(4);
|
|
|
|
- if (coupon != null && "1".equals(coupon.getCategoryType())) {
|
|
|
|
- catego = "产品";
|
|
|
|
- }
|
|
|
|
- if (coupon != null && "2".equals(coupon.getCategoryType())) {
|
|
|
|
- catego = "仪器";
|
|
|
|
- }
|
|
|
|
- messageCenter.setContent(catego);
|
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
|
- messageCenter.setCouponType(1);
|
|
|
|
- messageCenter.setCouponMessageType(1);
|
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
- coumt++;
|
|
|
|
- }
|
|
|
|
- } else if (coumt == 0) {
|
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(2);//查询优惠券信息
|
|
|
|
- if(coupon!=null){
|
|
|
|
- String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(clubId);
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(4);
|
|
|
|
- messageCenter.setContent(null);
|
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
|
- messageCenter.setCouponType(2);
|
|
|
|
- messageCenter.setCouponMessageType(1);
|
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
- coumt++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(3);//查询优惠券信息
|
|
|
|
- if(coupon!=null) {
|
|
|
|
- String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(clubId);
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(4);
|
|
|
|
- messageCenter.setContent(user.getName());
|
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
|
- messageCenter.setCouponType(3);
|
|
|
|
- messageCenter.setCouponMessageType(1);
|
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
- coumt++;
|
|
|
|
- }
|
|
|
|
- } else if (coumt == 0) {
|
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
|
|
|
|
- if(coupon!=null){
|
|
|
|
- String startDate = sdf.format(coupon.getStartDate());
|
|
|
|
- int num = startDate.compareTo(user.getRegisterTime());
|
|
|
|
- if (num > 0) {
|
|
|
|
- String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
- MessageCenter messageCenter = new MessageCenter();
|
|
|
|
- if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
- messageCenter.setShopId(null);
|
|
|
|
- messageCenter.setClubId(clubId);
|
|
|
|
- messageCenter.setUserType(1);
|
|
|
|
- messageCenter.setMessageType(4);
|
|
|
|
- messageCenter.setContent(null);
|
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
|
- messageCenter.setCouponType(4);
|
|
|
|
- messageCenter.setCouponMessageType(1);
|
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
- coumt++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+// /**
|
|
|
|
+// * 站内消息-优惠券推送
|
|
|
|
+// */
|
|
|
|
+// Date date = new Date();
|
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
+// //登入的日期
|
|
|
|
+// List<Integer> clubIds=messageCenterDao.ClubIds();
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// clubIds.forEach(clubId->{
|
|
|
|
+// RedisLearn.producer(clubId.toString(),clubId.toString());
|
|
|
|
+// CmUser user = messageCenterDao.clubList(clubId);
|
|
|
|
+// int coumt = 0;//计数五种消息只推送一条
|
|
|
|
+// String catego = "";
|
|
|
|
+// Integer ts=(date.compareTo(cmCoupon.getStartDate()));
|
|
|
|
+// if(ts>=0){
|
|
|
|
+// if ("90".equals(user.getClubStatus())) {
|
|
|
|
+// CmCoupon coupon = messageCenterDao.CouponList(0);//查询优惠券信息
|
|
|
|
+// if(coupon!=null){
|
|
|
|
+// String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+// messageCenter.setShopId(null);
|
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
|
+// messageCenter.setUserType(1);
|
|
|
|
+// messageCenter.setMessageType(4);
|
|
|
|
+// messageCenter.setContent(null);
|
|
|
|
+// messageCenter.setTime(curDateStr);
|
|
|
|
+// messageCenter.setCouponType(0);
|
|
|
|
+// messageCenter.setCouponMessageType(1);
|
|
|
|
+// messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+// messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+// coumt++;
|
|
|
|
+// }
|
|
|
|
+// } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
+// CmCoupon coupon = messageCenterDao.CouponList(1);//查询优惠券信息
|
|
|
|
+// if(coupon!=null) {
|
|
|
|
+// String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+// messageCenter.setShopId(null);
|
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
|
+// messageCenter.setUserType(1);
|
|
|
|
+// messageCenter.setMessageType(4);
|
|
|
|
+// if (coupon != null && "1".equals(coupon.getCategoryType())) {
|
|
|
|
+// catego = "产品";
|
|
|
|
+// }
|
|
|
|
+// if (coupon != null && "2".equals(coupon.getCategoryType())) {
|
|
|
|
+// catego = "仪器";
|
|
|
|
+// }
|
|
|
|
+// messageCenter.setContent(catego);
|
|
|
|
+// messageCenter.setTime(curDateStr);
|
|
|
|
+// messageCenter.setCouponType(1);
|
|
|
|
+// messageCenter.setCouponMessageType(1);
|
|
|
|
+// messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+// messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+// coumt++;
|
|
|
|
+// }
|
|
|
|
+// } else if (coumt == 0) {
|
|
|
|
+// CmCoupon coupon = messageCenterDao.CouponList(2);//查询优惠券信息
|
|
|
|
+// if(coupon!=null){
|
|
|
|
+// String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+// if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
+// messageCenter.setShopId(null);
|
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
|
+// messageCenter.setUserType(1);
|
|
|
|
+// messageCenter.setMessageType(4);
|
|
|
|
+// messageCenter.setContent(null);
|
|
|
|
+// messageCenter.setTime(curDateStr);
|
|
|
|
+// messageCenter.setCouponType(2);
|
|
|
|
+// messageCenter.setCouponMessageType(1);
|
|
|
|
+// messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+// messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+// coumt++;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// } else if ("90".equals(user.getClubStatus()) && coumt == 0) {
|
|
|
|
+// CmCoupon coupon = messageCenterDao.CouponList(3);//查询优惠券信息
|
|
|
|
+// if(coupon!=null) {
|
|
|
|
+// String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+// messageCenter.setShopId(null);
|
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
|
+// messageCenter.setUserType(1);
|
|
|
|
+// messageCenter.setMessageType(4);
|
|
|
|
+// messageCenter.setContent(user.getName());
|
|
|
|
+// messageCenter.setTime(curDateStr);
|
|
|
|
+// messageCenter.setCouponType(3);
|
|
|
|
+// messageCenter.setCouponMessageType(1);
|
|
|
|
+// messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+// messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+// coumt++;
|
|
|
|
+// }
|
|
|
|
+// } else if (coumt == 0) {
|
|
|
|
+// CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
|
|
|
|
+// if(coupon!=null){
|
|
|
|
+// String startDate = sdf.format(coupon.getStartDate());
|
|
|
|
+// int num = startDate.compareTo(user.getRegisterTime());
|
|
|
|
+// if (num > 0) {
|
|
|
|
+// String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
|
+// if (coupon != null && coupon.getUserId() != null) {
|
|
|
|
+// messageCenter.setShopId(null);
|
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
|
+// messageCenter.setUserType(1);
|
|
|
|
+// messageCenter.setMessageType(4);
|
|
|
|
+// messageCenter.setContent(null);
|
|
|
|
+// messageCenter.setTime(curDateStr);
|
|
|
|
+// messageCenter.setCouponType(4);
|
|
|
|
+// messageCenter.setCouponMessageType(1);
|
|
|
|
+// messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
|
+// messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
+// coumt++;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// });
|
|
cmCouponService.save(cmCoupon);
|
|
cmCouponService.save(cmCoupon);
|
|
addMessage(redirectAttributes, "保存优惠券成功");
|
|
addMessage(redirectAttributes, "保存优惠券成功");
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
|