|
@@ -142,14 +142,15 @@ public class CmCouponController extends BaseController {
|
|
|
}
|
|
|
|
|
|
//优惠券站内消息推送
|
|
|
- private void consumer(CmCoupon cmCoupon,List<Integer> clubIds){
|
|
|
- Jedis jedis=new Jedis("192.168.2.100", 6379);
|
|
|
+ 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) {
|
|
|
clubIds.forEach(clubIdb -> {
|
|
|
// 获取消息
|
|
|
String clubIdc = jedis.rpop(clubIdb.toString());
|
|
|
- Integer clubId= Integer.parseInt(clubIdc);
|
|
|
+ Integer clubId = Integer.parseInt(clubIdc);
|
|
|
if (clubId != null) {
|
|
|
Date date = new Date();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
@@ -159,7 +160,7 @@ public class CmCouponController extends BaseController {
|
|
|
String catego = "";
|
|
|
Integer ts = (date.compareTo(cmCoupon.getStartDate()));
|
|
|
if (ts >= 0) {
|
|
|
- if ("90".equals(user.getClubStatus()) && 0==cmCoupon.getCouponType()) {
|
|
|
+ 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);
|
|
@@ -174,21 +175,21 @@ 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);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(sendSms){
|
|
|
+ if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
jedis.del(clubIdc);
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
|
- if ("90".equals(user.getClubStatus()) && coumt == 0 && 1==cmCoupon.getCouponType()) {
|
|
|
+ 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);
|
|
@@ -209,14 +210,14 @@ 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);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(sendSms){
|
|
|
+ if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
@@ -224,7 +225,7 @@ public class CmCouponController extends BaseController {
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
|
- if (coumt == 0 && 2==cmCoupon.getCouponType()) {
|
|
|
+ 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);
|
|
@@ -241,14 +242,14 @@ 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);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(sendSms){
|
|
|
+ if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
@@ -257,7 +258,7 @@ public class CmCouponController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if ("90".equals(user.getClubStatus()) && coumt == 0 && 3==cmCoupon.getCouponType()) {
|
|
|
+ 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);
|
|
@@ -273,14 +274,14 @@ 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);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(sendSms){
|
|
|
+ if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
@@ -288,7 +289,7 @@ public class CmCouponController extends BaseController {
|
|
|
coumt++;
|
|
|
}
|
|
|
}
|
|
|
- if (coumt == 0 && 4==cmCoupon.getCouponType()) {
|
|
|
+ if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
|
|
|
CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
|
|
|
if (coupon != null) {
|
|
|
String startDate = sdf.format(coupon.getStartDate());
|
|
@@ -308,14 +309,14 @@ 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);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(sendSms){
|
|
|
+ if (sendSms) {
|
|
|
logger.info(">>>>>>>发送成功");
|
|
|
}
|
|
|
|
|
@@ -338,7 +339,7 @@ public class CmCouponController extends BaseController {
|
|
|
return form(cmCoupon, model);
|
|
|
}
|
|
|
List<Integer> clubIds = messageCenterDao.ClubIds();
|
|
|
- new Thread(() -> consumer(cmCoupon,clubIds)).start();
|
|
|
+ new Thread(() -> consumer(cmCoupon, clubIds)).start();
|
|
|
|
|
|
RedisLearn.producer(clubIds);
|
|
|
|
|
@@ -473,7 +474,7 @@ public class CmCouponController extends BaseController {
|
|
|
if ("1".equals(cmCoupon.getCouponsMode())) {
|
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/codeCouponList";
|
|
|
}
|
|
|
- if(null!=cmCoupon.getMoneyCouponFlag()&&1==(cmCoupon.getMoneyCouponFlag())){
|
|
|
+ if (null != cmCoupon.getMoneyCouponFlag() && 1 == (cmCoupon.getMoneyCouponFlag())) {
|
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?moneyCouponFlag=1&&couponType=5";
|
|
|
}
|
|
|
return "redirect:" + Global.getAdminPath() + "/coupon/cmCoupon/list?couponType=" + cmCoupon.getCouponType();
|
|
@@ -641,11 +642,11 @@ public class CmCouponController extends BaseController {
|
|
|
String wwwServer = Global.getConfig("wwwServer");
|
|
|
product.setMainImage(AppUtils.getImageURL("product", product.getMainImage(), 0, wwwServer));
|
|
|
//展示全部可用普通优惠券,不包含已领取兑换优惠券
|
|
|
- List<CmCoupon> ordinaryCoupons = cmCouponService.findClubCouponList(product, userId,2);
|
|
|
+ List<CmCoupon> ordinaryCoupons = cmCouponService.findClubCouponList(product, userId, 2);
|
|
|
//展示全部可用兑换优惠券
|
|
|
List<CmCoupon> redeemCoupons = cmCouponService.findNotRedeemedCoupon(product);
|
|
|
//展示全部可用价值优惠券
|
|
|
- List<CmCoupon> moneyCoupons = cmCouponService.findClubCouponList(product, userId,1);
|
|
|
+ List<CmCoupon> moneyCoupons = cmCouponService.findClubCouponList(product, userId, 1);
|
|
|
model.addAttribute("product", product);
|
|
|
model.addAttribute("ordinaryCoupons", ordinaryCoupons);
|
|
|
model.addAttribute("redeemCoupons", redeemCoupons);
|