|
@@ -49,17 +49,57 @@ public class ShopMessTask {
|
|
|
private MessageSender messageSender;
|
|
|
|
|
|
@Scheduled(cron = "0 0 15 * * ?")
|
|
|
- public void Timesjf() {
|
|
|
+ public void outTimePutAwayFee() {
|
|
|
log.info("-------------------------------上架费过期推送开始-------------------------------");
|
|
|
putAwayFee(0);
|
|
|
- putAwayFee(6);
|
|
|
- putAwayFee(29);
|
|
|
+ putAwayFee(7);
|
|
|
+ putAwayFee(30);
|
|
|
log.info("-------------------------------上架费过期推送结束-------------------------------");
|
|
|
}
|
|
|
|
|
|
+ @Scheduled(cron = "0 0 11 * * ?")
|
|
|
+//@Scheduled(cron = "0 0/1 * * * ?")
|
|
|
+ public void outTimeQualification() {
|
|
|
+ log.info("---------------------------开始检测商品资质证书是否过期-------------------------------");
|
|
|
+ //1,7,30,90
|
|
|
+ qualification(0);
|
|
|
+ qualification(7);
|
|
|
+ qualification(30);
|
|
|
+ qualification(91);
|
|
|
+ log.info("---------------------------检测商品资质证书是否过期结束-------------------------------");
|
|
|
+ }
|
|
|
+
|
|
|
+ public void qualification(Integer day) {
|
|
|
+ StringBuilder productNames = new StringBuilder();
|
|
|
+ StringBuilder productIds = new StringBuilder();
|
|
|
+ List<QualificationPo> pro = messageCenterMapper.findOutTimeQualification(day);
|
|
|
+ String contentDay = 0 == day ? "今天" : 7 == day ? "7天" : 30 == day ? "一个月" : "三个月";
|
|
|
+ String content = "该商品的资质证书将于" + contentDay + "后失效,请及时登录采美网站上传新证书。";
|
|
|
+ String theme = "以下械字号商品的资质证书将于" + contentDay + "后失效,请及时提醒供应商更换证书。";
|
|
|
+ MessageCenterPo messageCenter = new MessageCenterPo();
|
|
|
+ messageCenter.userType(2).messageType(2).shopMessType(5).content(content);
|
|
|
+ pro.forEach(p -> {
|
|
|
+ productNames.append("(").append(p.productId()).append(")").append(p.productName());
|
|
|
+ productIds.append(p.productId()).append(",");
|
|
|
+ messageCenter.productId(p.productId());
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+ });
|
|
|
+ String names = productNames.toString();
|
|
|
+ String ids = productIds.toString();
|
|
|
+ names = names.endsWith(",") ? names.substring(0, names.lastIndexOf(",") - 1) : names;
|
|
|
+ ids = ids.endsWith(",") ? ids.substring(0, ids.lastIndexOf(",") - 1) : ids;
|
|
|
+ if (names.length() > 10) {
|
|
|
+ names = StringUtils.strip(names.substring(0, 11));
|
|
|
+ names += "...";
|
|
|
+ }
|
|
|
+ Notification notification = new Notification();
|
|
|
+ notification.theme(theme).shopContent(names).productId(ids);
|
|
|
+ messageCenterMapper.addNotification(notification);
|
|
|
+ }
|
|
|
+
|
|
|
public void putAwayFee(Integer day) {
|
|
|
List<ShopReceiptVo> shopIds = messageCenterMapper.findExpireShopId(day);
|
|
|
- String contentDay = day > 6 ? "30" : 6 == day ? "7" : "今";
|
|
|
+ String contentDay = day > 7 ? "30" : 7 == day ? "7" : "今";
|
|
|
StringBuilder shopNames = new StringBuilder();
|
|
|
StringBuilder shopsId = new StringBuilder();
|
|
|
String firsts = "尊敬的采美供应商用户,您的账号维护费用" + contentDay + "天后即将到期!";
|
|
@@ -94,7 +134,7 @@ public class ShopMessTask {
|
|
|
});
|
|
|
String s = shopNames.toString();
|
|
|
String sn = shopsId.toString();
|
|
|
- String shopDay = 0 == day ? "今天" : 6 == day ? "7天" : "一个月";
|
|
|
+ String shopDay = 0 == day ? "今天" : 7 == day ? "7天" : "一个月";
|
|
|
String theme = "以下供应商的上架费将于" + shopDay + "后到期,请及时提醒供应商续费。";
|
|
|
s = s.endsWith(",") ? s.substring(0, s.lastIndexOf(",") - 1) : s;
|
|
|
sn = sn.endsWith(",") ? sn.substring(0, sn.lastIndexOf(",") - 1) : sn;
|
|
@@ -171,8 +211,7 @@ public class ShopMessTask {
|
|
|
log.info("----------------------------优惠券七天后过期---------------------------------");
|
|
|
List<CmCouponPo> coupons = messageCenterMapper.findOutTimeCoupons(7);
|
|
|
MessageCenterPo messageCenter = new MessageCenterPo();
|
|
|
- String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
- messageCenter.userType(1).messageType(4).couponMessageType(3).content("7天").time(format);
|
|
|
+ messageCenter.userType(1).messageType(4).couponMessageType(3).content("7天");
|
|
|
coupons.forEach(c -> {
|
|
|
messageCenter.clubId(c.getClubId()).couponFee(c.getCouponAmount().doubleValue()).couponType(c.getCouponType());
|
|
|
messageCenterMapper.addMessageCenter(messageCenter);
|
|
@@ -195,8 +234,7 @@ public class ShopMessTask {
|
|
|
log.info("----------------------------优惠券一天后过期---------------------------------");
|
|
|
List<CmCouponPo> coupons = messageCenterMapper.findOutTimeCoupons(1);
|
|
|
MessageCenterPo messageCenter = new MessageCenterPo();
|
|
|
- String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
- messageCenter.userType(1).messageType(4).couponMessageType(3).content("7天").time(format);
|
|
|
+ messageCenter.userType(1).messageType(4).couponMessageType(3).content("7天");
|
|
|
coupons.forEach(c -> {
|
|
|
messageCenter.clubId(c.getClubId()).couponFee(c.getCouponAmount().doubleValue()).couponType(c.getCouponType());
|
|
|
messageCenterMapper.addMessageCenter(messageCenter);
|
|
@@ -212,8 +250,7 @@ public class ShopMessTask {
|
|
|
log.info("----------------------------优惠券三天后过期---------------------------------");
|
|
|
List<CmCouponPo> coupons = messageCenterMapper.findOutTimeCoupons(3);
|
|
|
MessageCenterPo messageCenter = new MessageCenterPo();
|
|
|
- String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
- messageCenter.userType(1).messageType(4).couponMessageType(3).content("3天").time(format);
|
|
|
+ messageCenter.userType(1).messageType(4).couponMessageType(3).content("3天");
|
|
|
coupons.forEach(c -> {
|
|
|
messageCenter.clubId(c.getClubId()).couponFee(c.getCouponAmount().doubleValue()).couponType(c.getCouponType());
|
|
|
messageCenterMapper.addMessageCenter(messageCenter);
|