|
@@ -10,6 +10,7 @@ import com.caimei.modules.order.service.NewOrderService;
|
|
|
import com.caimei.modules.order.service.WeChatService;
|
|
|
import com.caimei.modules.product.entity.Product;
|
|
|
import com.caimei.modules.product.service.ProductService;
|
|
|
+import com.caimei.modules.sys.utils.SMSUtils;
|
|
|
import com.caimei.modules.user.dao.CmUserDao;
|
|
|
import com.caimei.modules.user.dao.MessageCenterDao;
|
|
|
import com.caimei.modules.user.dao.NewCmClubDao;
|
|
@@ -26,6 +27,7 @@ import com.thinkgem.jeesite.common.web.BaseController;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
@@ -40,8 +42,12 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
|
|
|
|
/**
|
|
|
* 优惠券管理Controller
|
|
@@ -94,6 +100,7 @@ public class CmCouponController extends BaseController {
|
|
|
if (null == cmCoupon.getMoneyCouponFlag()) {
|
|
|
cmCoupon.setMoneyCouponFlag(2);
|
|
|
}
|
|
|
+
|
|
|
Page<CmCoupon> page = cmCouponService.findPage(new Page<CmCoupon>(request, response), cmCoupon);
|
|
|
model.addAttribute("page", page);
|
|
|
if (0 == cmCoupon.getCouponType()) {
|
|
@@ -104,9 +111,11 @@ public class CmCouponController extends BaseController {
|
|
|
return "modules/coupon/couponCategoryList";
|
|
|
} else if (2 == cmCoupon.getCouponType()) {
|
|
|
//用户专享券
|
|
|
+
|
|
|
return "modules/coupon/couponUserExclusiveList";
|
|
|
} else if (3 == cmCoupon.getCouponType()) {
|
|
|
//店铺券
|
|
|
+
|
|
|
return "modules/coupon/couponShopList";
|
|
|
} else if (4 == cmCoupon.getCouponType()) {
|
|
|
//新用户券
|
|
@@ -154,184 +163,82 @@ public class CmCouponController extends BaseController {
|
|
|
//优惠券站内消息推送
|
|
|
private void consumer(CmCoupon cmCoupon, List<Integer> clubIds) {
|
|
|
// 消费消息
|
|
|
- while (true) {
|
|
|
clubIds.forEach(clubIdb -> {
|
|
|
- Jedis jedis = null;
|
|
|
- String constraint = "";
|
|
|
- if (domain.contains("-b")) {
|
|
|
- jedis = new Jedis("172.31.165.27", 6379);
|
|
|
- jedis.auth("6#xsI%b4o@5c3RoE");
|
|
|
- } else if (domain.contains("localhost")) {
|
|
|
- jedis = new Jedis("192.168.2.100", 6379);
|
|
|
- } else {
|
|
|
- jedis = new Jedis("172.31.165.23", 6379);
|
|
|
- }
|
|
|
- // 获取消息
|
|
|
- String clubIdc = jedis.rpop("mess" + 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()) && 0 == cmCoupon.getCouponType()) {
|
|
|
- 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);
|
|
|
- String content = "【采美365】采美平台送您" + coupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
- boolean sendSms = false;
|
|
|
- try {
|
|
|
- sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>发送成功");
|
|
|
- }
|
|
|
- jedis.del("mess" + clubIdc);
|
|
|
- coumt++;
|
|
|
- }
|
|
|
- }
|
|
|
- if ("90".equals(user.getClubStatus()) && coumt == 0 && 1 == cmCoupon.getCouponType()) {
|
|
|
- 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);
|
|
|
- String content = "【采美365】采美平台" + catego + "类商品大优惠,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
- boolean sendSms = false;
|
|
|
- try {
|
|
|
- sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>发送成功");
|
|
|
- }
|
|
|
-
|
|
|
- jedis.del("mess" + clubIdc);
|
|
|
- coumt++;
|
|
|
- }
|
|
|
+ Jedis jedis = null;
|
|
|
+ String constraint = "";
|
|
|
+ if (domain.contains("-b")) {
|
|
|
+ jedis = new Jedis("172.31.165.27", 6379);
|
|
|
+ jedis.auth("6#xsI%b4o@5c3RoE");
|
|
|
+ } else if (domain.contains("localhost")) {
|
|
|
+ jedis = new Jedis("192.168.2.100", 6379);
|
|
|
+ } else {
|
|
|
+ jedis = new Jedis("172.31.165.23", 6379);
|
|
|
}
|
|
|
- if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
|
|
|
- CmCoupon coupon = messageCenterDao.CouponList(2);//查询优惠券信息
|
|
|
- if (coupon != null) {
|
|
|
- if(coupon.getUserId()!=null){
|
|
|
- Integer clubc=messageCenterDao.clubIdCule(coupon.getUserId());
|
|
|
- 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(clubc);
|
|
|
- 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);
|
|
|
- }
|
|
|
- String content = "【采美365】为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
- boolean sendSms = false;
|
|
|
- try {
|
|
|
- sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>发送成功");
|
|
|
+ // 获取消息
|
|
|
+ String clubIdc = jedis.rpop("mess" + clubIdb.toString());
|
|
|
+ Integer clubId = clubIdb;
|
|
|
+ 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()) && 0 == cmCoupon.getCouponType()) {
|
|
|
+ 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(clubIdb);
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
+ messageCenter.setContent(null);
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
+ messageCenter.setCouponType(0);
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
+ messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
+ String content = "采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ boolean sendSms = false;
|
|
|
+ try {
|
|
|
+ sendSms = SMSUtils.sendSms(user.getBindMobile(), content);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (sendSms) {
|
|
|
+ logger.info(">>>>>>>发送成功");
|
|
|
+ }
|
|
|
+ jedis.del("mess" + clubIdc);
|
|
|
+ coumt++;
|
|
|
}
|
|
|
-
|
|
|
- jedis.del("mess" + clubIdc);
|
|
|
- coumt++;
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
|
|
|
- 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);
|
|
|
-
|
|
|
- String content = "【采美365】采美平台为了回馈客户,赠送您" + coupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
- boolean sendSms = false;
|
|
|
- try {
|
|
|
- sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>发送成功");
|
|
|
- }
|
|
|
-
|
|
|
- jedis.del("mess" + clubIdc);
|
|
|
- coumt++;
|
|
|
- }
|
|
|
- }
|
|
|
- if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
|
|
|
- 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) {
|
|
|
+ if ("90".equals(user.getClubStatus()) && coumt == 0 && 1 == cmCoupon.getCouponType()) {
|
|
|
+ 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.setClubId(clubIdb);
|
|
|
messageCenter.setUserType(1);
|
|
|
messageCenter.setMessageType(4);
|
|
|
- messageCenter.setContent(null);
|
|
|
+ if (cmCoupon != null && "1".equals(cmCoupon.getCategoryType())) {
|
|
|
+ catego = "产品";
|
|
|
+ }
|
|
|
+ if (cmCoupon != null && "2".equals(cmCoupon.getCategoryType())) {
|
|
|
+ catego = "仪器";
|
|
|
+ }
|
|
|
+ messageCenter.setContent(catego);
|
|
|
messageCenter.setTime(curDateStr);
|
|
|
- messageCenter.setCouponType(4);
|
|
|
+ messageCenter.setCouponType(1);
|
|
|
messageCenter.setCouponMessageType(1);
|
|
|
- messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
+ messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
-
|
|
|
- String content = "【采美365】恭喜成功注册采美平台。采美平台赠送您" + coupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "采美平台" + catego + "类商品大优惠,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
- sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
|
+ sendSms = SMSUtils.sendSms(user.getBindMobile(), content);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -343,28 +250,144 @@ public class CmCouponController extends BaseController {
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
|
+ if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(2);//查询用户专享优惠券信息
|
|
|
+ if (coupon != null && cmCoupon.getUserId() != null) {
|
|
|
+ if (coupon.getUserId().equals(cmCoupon.getUserId())) {
|
|
|
+ Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
+
|
|
|
+
|
|
|
+ jedis.del("mess" + clubIdc);
|
|
|
+ coumt++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(3);//查询店铺优惠券信息
|
|
|
+ if (coupon.getShopId() != null) {
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
+ String shopName = messageCenterDao.shopName(cmCoupon.getShopId());
|
|
|
+ Integer userID = messageCenterDao.userID(coupon.getShopId());
|
|
|
+ Integer clubID = messageCenterDao.clubIdCule(userID);
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ messageCenter.setShopId(null);
|
|
|
+ messageCenter.setClubId(clubIdb);
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
+ messageCenter.setContent(shopName);
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
+ messageCenter.setCouponType(3);
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
+ messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
+ String content = "采美平台为了回馈客户,赠送您" + cmCoupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ boolean sendSms = false;
|
|
|
+ try {
|
|
|
+ sendSms = SMSUtils.sendSms(user.getBindMobile(), content);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (sendSms) {
|
|
|
+ logger.info(">>>>>>>发送成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ jedis.del("mess" + clubIdc);
|
|
|
+ coumt++;
|
|
|
+ }
|
|
|
+ if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
|
|
|
+ CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
|
|
|
+ if (coupon != null) {
|
|
|
+ String startDate = sdf.format(coupon.getStartDate());
|
|
|
+ Calendar calendars = Calendar.getInstance();
|
|
|
+ Date receiptime = new Date();
|
|
|
+ try {
|
|
|
+ receiptime = sdf.parse(user.getRegisterTime());
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ calendars.setTime(receiptime);
|
|
|
+ calendars.add(Calendar.HOUR, -6);
|
|
|
+ String hTimes=sdf.format(calendars.getTime());
|
|
|
+ int num = startDate.compareTo(hTimes);
|
|
|
+ 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(clubIdb);
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
+ messageCenter.setContent(null);
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
+ messageCenter.setCouponType(4);
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
+ messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
+
|
|
|
+ String content = "恭喜成功注册采美平台。采美平台赠送您" + cmCoupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ boolean sendSms = false;
|
|
|
+ try {
|
|
|
+ sendSms = SMSUtils.sendSms(user.getBindMobile(), content);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (sendSms) {
|
|
|
+ logger.info(">>>>>>>发送成功");
|
|
|
+ }
|
|
|
+ jedis.del("mess" + clubIdc);
|
|
|
+ coumt++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
jedis.del("mess" + clubIdc);
|
|
|
System.out.println(jedis.rpop("mess" + clubIdc));
|
|
|
});
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
@RequestMapping(value = "save")
|
|
|
public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) throws ParseException {
|
|
|
if (!beanValidator(model, cmCoupon)) {
|
|
|
return form(cmCoupon, model);
|
|
|
}
|
|
|
+ Date date=new Date();
|
|
|
+ String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
+// ExecutorService pool = Executors.newFixedThreadPool(3);
|
|
|
List<Integer> clubIds = messageCenterDao.ClubIds();
|
|
|
- new Thread(() -> consumer(cmCoupon, clubIds)).start();
|
|
|
+
|
|
|
+// new Thread(() -> consumer(cmCoupon, clubIds)).start();
|
|
|
+ consumer(cmCoupon, clubIds);
|
|
|
+
|
|
|
RedisLearn.producer(clubIds);
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ if (cmCoupon.getUserId() != null) {
|
|
|
+ Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
|
|
|
+ CmUser user = messageCenterDao.clubList(clubc);
|
|
|
+ messageCenter.setShopId(null);
|
|
|
+ messageCenter.setClubId(clubc);
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(4);
|
|
|
+ messageCenter.setContent(null);
|
|
|
+ messageCenter.setTime(curDateStr);
|
|
|
+ messageCenter.setCouponType(2);
|
|
|
+ messageCenter.setCouponMessageType(1);
|
|
|
+ messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
|
|
|
+ messageCenterDao.addMessageCenter(messageCenter);
|
|
|
+ String content = "为了答谢您对采美平台的支持,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ boolean sendSms = false;
|
|
|
+ try {
|
|
|
+ sendSms = SMSUtils.sendSms( user.getBindMobile(), content);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (sendSms) {
|
|
|
+ logger.info(">>>>>>>发送成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
cmCouponService.save(cmCoupon);
|
|
|
addMessage(redirectAttributes, "保存优惠券成功");
|