Ver código fonte

推送版本

Duan_xu 2 anos atrás
pai
commit
277e2c17ae

+ 1 - 179
src/main/java/com/caimei365/commodity/service/impl/CouponServiceImpl.java

@@ -157,9 +157,6 @@ public class CouponServiceImpl implements CouponService {
                 return ResponseJson.error("未成为超级会员无法领取超级会员券!");
             }
         }
-        Timerw(couponsDto.getUserId());
-        Timeto(couponsDto.getUserId());
-        Timeth(couponsDto.getUserId());
         CouponClubPo couponClub = new CouponClubPo();
         BeanUtils.copyProperties(couponsDto, couponClub);
         couponClub.setStatus("1");
@@ -169,187 +166,11 @@ public class CouponServiceImpl implements CouponService {
         return ResponseJson.success("领取成功");
     }
 
-    /**
-     * 每天12点推送
-     */
-    private Void Timerw(Integer userId) throws ParseException {
-        //1.获取下午3点的时间
-        SimpleDateFormat dnf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        Calendar time = Calendar.getInstance();
-        time.set(Calendar.HOUR_OF_DAY, 12);
-        time.set(Calendar.MINUTE, 00);
-        time.set(Calendar.SECOND, 00);
 
-        String times = dnf.format(time.getTime());
-        System.out.println(times);
-        //2.某天的日期
-        Date date = dnf.parse(times);
-        //与当前时间的毫秒数相减得到相差的毫秒用于定时
-        Long h = (date.getTime() - date.getTime());
-        //这里如果当前时间大于下午三点会出现负数所以就不推送
-        if (h > 0) {
-            ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
-            executorService.schedule(new Runnable() {
-                @SneakyThrows
-                @Override
-                public void run() {
-                    if (userId != null) {
-                        UserVo user = messageCenterMapper.clubList(userId);
-                        CouponVo coupon = messageCenterMapper.CouponList(userId);
-                        String contractMobile=messageCenterMapper.contractMobile(userId);
-                        Date date = new Date();
-                        Date d = coupon.getStartDate();
-                        //1.日期格式
-                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-                        String endTime = sdf.format(coupon.getEndDate());
-                        //2.某天的日期
-                        Date da1 = sdf.parse(endTime);
-                        Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
-                        Long t = (date.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                        String current = dateFormat.format(new Date());
-                        MessageCenter messageCenter = new MessageCenter();
-                        //推送信息中心-账户通知
-                        if (s > 15) {
-                            if (t == 7) {
-                                messageCenter.setShopID(null);
-                                messageCenter.setClubID(user.getClubId());
-                                messageCenter.setUserType(1);
-                                messageCenter.setMessageType(4);
-                                messageCenter.setCouponType(2);
-                                messageCenter.setContent(t + "天后过期");
-                                messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                                messageCenter.setTime(current);
-                                messageCenterMapper.addMessageCenter(messageCenter);
-                                String content = "短信模板:【采美365】您有"+coupon.getCouponAmount()+"元优惠券将于7日后过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                                boolean sendSms = getSendSms(2, contractMobile, content);
-                            }
-                        }
-                    }
-                }
-            }, h, TimeUnit.MILLISECONDS);
-        }
-        return null;
-    }
 
-    /**
-     * 每天10点判断
-     */
-    private Void Timeto(Integer userId) throws ParseException {
-        //1.获取下午3点的时间
-        SimpleDateFormat dnf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        Calendar time = Calendar.getInstance();
-        time.set(Calendar.HOUR_OF_DAY, 10);
-        time.set(Calendar.MINUTE, 00);
-        time.set(Calendar.SECOND, 00);
-        String contractMobile=messageCenterMapper.contractMobile(userId);
-        String times = dnf.format(time.getTime());
-        System.out.println(times);
-        //2.某天的日期
-        Date date = dnf.parse(times);
-        //与当前时间的毫秒数相减得到相差的毫秒用于定时
-        Long h = (date.getTime() - date.getTime());
-        //这里如果当前时间大于下午三点会出现负数所以就不推送
-        if (h > 0) {
-            ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
-            executorService.schedule(new Runnable() {
-                @SneakyThrows
-                @Override
-                public void run() {
-                    if (userId != null) {
-                        UserVo user = messageCenterMapper.clubList(userId);
-                        CouponVo coupon = messageCenterMapper.CouponList(userId);
-                        Date d = new Date();
-                        //1.日期格式
-                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-                        String endTime = sdf.format(coupon.getEndDate());
-                        //2.某天的日期
-                        Date da1 = sdf.parse(endTime);
-                        Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                        String current = dateFormat.format(new Date());
-                        MessageCenter messageCenter = new MessageCenter();
-                        //推送信息中心-账户通知
-                        if (s == 1) {
-
-                            messageCenter.setShopID(null);
-                            messageCenter.setClubID(user.getClubId());
-                            messageCenter.setUserType(1);
-                            messageCenter.setMessageType(4);
-                            messageCenter.setCouponType(2);
-                            messageCenter.setContent(null);
-                            messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                            messageCenter.setTime(current);
-                            messageCenterMapper.addMessageCenter(messageCenter);
-                            String content = "短信模板:【采美365】您有"+coupon.getCouponAmount()+"元优惠券今日过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                            boolean sendSms = getSendSms(2, contractMobile, content);
-                        }
-                    }
-                }
-            }, h, TimeUnit.MILLISECONDS);
-        }
-        return null;
-
-    }
 
 
-    private Void Timeth(Integer userId) throws ParseException {
-        //1.获取下午3点的时间
-        SimpleDateFormat dnf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        Calendar time = Calendar.getInstance();
-        time.set(Calendar.HOUR_OF_DAY, 15);
-        time.set(Calendar.MINUTE, 00);
-        time.set(Calendar.SECOND, 00);
-        String contractMobile=messageCenterMapper.contractMobile(userId);
-        String times = dnf.format(time.getTime());
-        System.out.println(times);
-        //2.某天的日期
-        Date date = dnf.parse(times);
-        //与当前时间的毫秒数相减得到相差的毫秒用于定时
-        Long h = (date.getTime() - date.getTime());
-        //这里如果当前时间大于下午三点会出现负数所以就不推送
-        if (h > 0) {
-            ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
-            executorService.schedule(new Runnable() {
-                @SneakyThrows
-                @Override
-                public void run() {
-                    if (userId != null) {
-                        UserVo user = messageCenterMapper.clubList(userId);
-                        CouponVo coupon = messageCenterMapper.CouponList(userId);
-                        Date date = new Date();
-                        Date d = coupon.getStartDate();
-                        //1.日期格式
-                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-                        String endTime = sdf.format(coupon.getEndDate());
-                        //2.某天的日期
-                        Date da1 = sdf.parse(endTime);
-                        Long s = (da1.getTime() - d.getTime()) / 24 / 60 / 60 / 1000;
-                        Long t = (date.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                        String current = dateFormat.format(new Date());
-                        MessageCenter messageCenter = new MessageCenter();
-                        //推送信息中心-账户通知
-                        if (t == 3) {
-                            messageCenter.setShopID(null);
-                            messageCenter.setClubID(user.getClubId());
-                            messageCenter.setUserType(1);
-                            messageCenter.setMessageType(4);
-                            messageCenter.setCouponType(2);
-                            messageCenter.setContent(t + "天后下架");
-                            messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                            messageCenter.setTime(current);
-                            messageCenterMapper.addMessageCenter(messageCenter);
-                            String content = "短信模板:【采美365】您有"+coupon.getCouponAmount()+"元优惠券3日后过期,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台查看使用吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                            boolean sendSms = getSendSms(2, contractMobile, content);
-                        }
 
-                    }
-                }
-            }, h, TimeUnit.MILLISECONDS);
-        }
-        return null;
-    }
 
 
     @Transactional(rollbackFor = Exception.class)
@@ -543,6 +364,7 @@ public class CouponServiceImpl implements CouponService {
             list.add("13100721916");
             list.add("15113936829");
             list.add("18175515644");
+            list.add("18476937515");
             if ("prod".equals(profile) || list.contains(mobile)) {
                 if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
                     String regex = "^(1[3-9]\\d{9}$)";

+ 2 - 2
src/main/resources/mapper/ShopMapper.xml

@@ -85,7 +85,7 @@
             qualificationTime,
         </if>
 
-        updateTime,validFlag,newProductType,showFlag
+        updateTime,validFlag,newProductType,showFlag,newvalidFlag
         ) values (
         #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
         #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber},
@@ -168,7 +168,7 @@
         <if test="qualificationTime != null and  qualificationTime != ''">
             #{qualificationTime},
         </if>
-        #{updateTime}, #{validFlag},#{newProductType},#{showFlag}
+        #{updateTime}, #{validFlag},#{newProductType},#{showFlag},3
         )
     </insert>
     <update id="updateProduct">