|
@@ -25,6 +25,8 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
|
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.Scheduled;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
@@ -67,6 +69,8 @@ public class CmCouponController extends BaseController {
|
|
|
private NewShopOrderDao newShopOrderDao;
|
|
|
@Autowired
|
|
|
private WeChatService weChatService;
|
|
|
+ @Value("${wwwServer}")
|
|
|
+ private String domain;
|
|
|
|
|
|
@ModelAttribute
|
|
|
public CmCoupon get(@RequestParam(required = false) String id) {
|
|
@@ -81,6 +85,8 @@ public class CmCouponController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@RequiresPermissions("coupon:cmCoupon:view")
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
@@ -140,21 +146,231 @@ public class CmCouponController extends BaseController {
|
|
|
return "modules/coupon/couponNewUserForm";
|
|
|
}
|
|
|
}
|
|
|
+ @Scheduled(cron = "0 0/3 * * * ?")
|
|
|
+public void ConSumertime(){
|
|
|
+ logger.info("》》》》》》》》》》》开始检测优惠券是否生效");
|
|
|
+ List<CmCoupon>coupons=messageCenterDao.couponTime();
|
|
|
+ coupons.forEach(cmCoupon->{
|
|
|
+ List<Integer> clubIds = messageCenterDao.ClubIds();
|
|
|
+ new Thread(() -> 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++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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 && 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) {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
+ System.out.println(jedis.rpop("mess"+clubIdc));
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
//优惠券站内消息推送
|
|
|
private void consumer(CmCoupon cmCoupon, List<Integer> clubIds) {
|
|
|
- Jedis jedis = new Jedis("172.31.165.27", 6379);
|
|
|
- jedis.auth("6#xsI%b4o@5c3RoE");
|
|
|
// 消费消息
|
|
|
- while (true) {
|
|
|
+// 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(clubIdb.toString());
|
|
|
+ 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 = "";
|
|
@@ -175,7 +391,7 @@ public class CmCouponController extends BaseController {
|
|
|
messageCenter.setCouponMessageType(1);
|
|
|
messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
- String content = "短信模板:【采美365】采美平台送您" + coupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "【采美365】采美平台送您" + coupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
@@ -185,7 +401,7 @@ public class CmCouponController extends BaseController {
|
|
|
if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
- jedis.del(clubIdc);
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
@@ -210,7 +426,7 @@ public class CmCouponController extends BaseController {
|
|
|
messageCenter.setCouponMessageType(1);
|
|
|
messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
- String content = "短信模板:【采美365】采美平台" + catego + "类商品大优惠,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "【采美365】采美平台" + catego + "类商品大优惠,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
@@ -221,7 +437,7 @@ public class CmCouponController extends BaseController {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
|
- jedis.del(clubIdc);
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
@@ -242,7 +458,7 @@ public class CmCouponController extends BaseController {
|
|
|
messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
|
|
- String content = "短信模板:【采美365】为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "【采美365】为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
@@ -253,7 +469,7 @@ public class CmCouponController extends BaseController {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
|
- jedis.del(clubIdc);
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
@@ -274,7 +490,7 @@ public class CmCouponController extends BaseController {
|
|
|
messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
|
|
- String content = "短信模板:【采美365】采美平台为了回馈客户,赠送您" + coupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "【采美365】采美平台为了回馈客户,赠送您" + coupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
@@ -285,7 +501,7 @@ public class CmCouponController extends BaseController {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
|
- jedis.del(clubIdc);
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
@@ -309,7 +525,7 @@ public class CmCouponController extends BaseController {
|
|
|
messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
|
|
|
messageCenterDao.addMessageCenter(messageCenter);
|
|
|
|
|
|
- String content = "短信模板:【采美365】恭喜成功注册采美平台。采美平台赠送您" + coupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
+ String content = "【采美365】恭喜成功注册采美平台。采美平台赠送您" + coupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
|
|
|
boolean sendSms = false;
|
|
|
try {
|
|
|
sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
|
|
@@ -320,7 +536,7 @@ public class CmCouponController extends BaseController {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
|
- jedis.del(clubIdc);
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
@@ -328,9 +544,13 @@ public class CmCouponController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ jedis.del("mess"+clubIdc);
|
|
|
+ System.out.println(jedis.rpop("mess"+clubIdc));
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+// }
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "save")
|
|
@@ -340,128 +560,8 @@ public class CmCouponController extends BaseController {
|
|
|
}
|
|
|
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->{
|
|
|
-// 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);
|
|
|
addMessage(redirectAttributes, "保存优惠券成功");
|
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
|