Duan_xu 2 years ago
parent
commit
21022b75ed
1 changed files with 222 additions and 222 deletions
  1. 222 222
      src/main/java/com/caimei/modules/sys/web/NotificationController.java

+ 222 - 222
src/main/java/com/caimei/modules/sys/web/NotificationController.java

@@ -61,226 +61,226 @@ public class NotificationController extends BaseController {
     public String list( Notification notifi,HttpServletRequest request, HttpServletResponse response, Model model) {
 
 
-        //械字号资质证书3个月后过期
-        Integer count=0;
-        String name="";
-        String productID="";
-        String shopID="";
-        Date date=new Date();
-        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-        //资质证书
-       List<Product>pro=notificationDao.productTypeCount(3);
-        List<Product>pro1=notificationDao.productTypeCount(1);
-        List<Product>pro2=notificationDao.productTypeCount1(7);
-        List<Product>pro3=notificationDao.productTypeCount1(1);
-        //上架费
-        List<Product>product=notificationDao.productTypeCount2(3);
-        List<Product>product1=notificationDao.productTypeCount2(1);
-        List<Product>product2=notificationDao.productTypeCount3(7);
-        List<Product>product3=notificationDao.productTypeCount3(1);
+//        //械字号资质证书3个月后过期
+//        Integer count=0;
+//        String name="";
+//        String productID="";
+//        String shopID="";
+//        Date date=new Date();
+//        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+//        //资质证书
+//       List<Product>pro=notificationDao.productTypeCount(3);
+//        List<Product>pro1=notificationDao.productTypeCount(1);
+//        List<Product>pro2=notificationDao.productTypeCount1(7);
+//        List<Product>pro3=notificationDao.productTypeCount1(1);
+//        //上架费
+//        List<Product>product=notificationDao.productTypeCount2(3);
+//        List<Product>product1=notificationDao.productTypeCount2(1);
+//        List<Product>product2=notificationDao.productTypeCount3(7);
+//        List<Product>product3=notificationDao.productTypeCount3(1);
+////
+//        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);
+//        }
 //
-        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(!"1".equals(jedis.rpop("constraint"))){
-            jedis.lpush("constraint","0");
-
-        }
-        constraint=jedis.rpop("constraint");
-        System.out.println(jedis.rpop("constraint"));
-      if("0".equals(constraint)){
-       for (int i=0;i<pro.size();i++){
-           MessageCenter messageCenter = new MessageCenter();
-           messageCenter.setShopId(pro.get(i).getShopID());
-           messageCenter.setClubId(null);
-           messageCenter.setUserType(2);
-           messageCenter.setMessageType(2);
-           messageCenter.setShopMessType(5);
-           messageCenter.setContent("该商品的资质证书将于3个月后失效,请及时登录采美网站上传新证书。");
-           messageCenter.setTime(curDateStr);
-           messageCenterDao.addMessageCenter(messageCenter);
-
-           if(i!=0){
-               name+=",";
-               productID+=",";
-           }
-          name +="("+pro.get(i).getProductID().toString()+")"+pro.get(i).getName();
-           productID+=pro.get(i).getProductID().toString();
-    }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下械字号商品的资质证书将于3个月后失效,请及时提醒供应商更换证书。");
-            notification.setShopContent(name);
-            notification.setPorductID(productID);
-            notificationDao.addNotification(notification);
-            name="";
-            productID="";
-        }
-        //械字号资质证书1个月后过期
-        for (int i=0;i<pro1.size();i++){
-
-            MessageCenter messageCenter = new MessageCenter();
-            messageCenter.setShopId(pro1.get(i).getShopID());
-            messageCenter.setClubId(null);
-            messageCenter.setUserType(2);
-            messageCenter.setMessageType(2);
-            messageCenter.setShopMessType(5);
-            messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
-            messageCenter.setTime(curDateStr);
-            messageCenterDao.addMessageCenter(messageCenter);
-            if(i!=0){
-                name+=",";
-                productID+=",";
-            }
-            name +="("+pro1.get(i).getProductID().toString()+")"+pro.get(i).getName();
-            productID+=pro1.get(i).getProductID().toString();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下械字号商品的资质证书将于1个月后失效,请及时提醒供应商更换证书。");
-            notification.setShopContent(name);
-            notification.setPorductID(productID);
-            notificationDao.addNotification(notification);
-            name="";
-            productID="";
-        }
-//械字号资质证书7日后过期
-        for (int i=0;i<pro2.size();i++){
-
-            MessageCenter messageCenter = new MessageCenter();
-            messageCenter.setShopId(pro2.get(i).getShopID());
-            messageCenter.setClubId(null);
-            messageCenter.setUserType(2);
-            messageCenter.setMessageType(2);
-            messageCenter.setShopMessType(5);
-            messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
-            messageCenter.setTime(curDateStr);
-            messageCenterDao.addMessageCenter(messageCenter);
-            if(i!=0){
-                name+=",";
-                productID+=",";
-            }
-            name +="("+pro2.get(i).getProductID().toString()+")"+pro.get(i).getName();
-            productID+=pro2.get(i).getProductID().toString();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下械字号商品的资质证书将于7天后失效,请及时提醒供应商更换证书。");
-            notification.setShopContent(name);
-            notification.setPorductID(productID);
-            notificationDao.addNotification(notification);
-            name="";
-            productID="";
-        }
-//械字号资质证书今日后过期
-        for (int i=0;i<pro3.size();i++){
-            MessageCenter messageCenter = new MessageCenter();
-            messageCenter.setShopId(pro3.get(i).getShopID());
-            messageCenter.setClubId(null);
-            messageCenter.setUserType(2);
-            messageCenter.setMessageType(2);
-            messageCenter.setShopMessType(5);
-            messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
-            messageCenter.setTime(curDateStr);
-            messageCenterDao.addMessageCenter(messageCenter);
-            if(i!=0){
-                name+=",";
-                productID+=",";
-            }
-            name +="("+pro3.get(i).getProductID().toString()+")"+pro.get(i).getName();
-            productID+=pro3.get(i).getProductID().toString();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下械字号商品的资质证书将于今天后失效,请及时提醒供应商更换证书。");
-            notification.setShopContent(name);
-            notification.setPorductID(productID);
-            notificationDao.addNotification(notification);
-            name="";
-            productID="";
-        }
-        //上架费
-        for (int i=0;i<product.size();i++){
-            if(i!=0){
-                name+=",";
-                shopID+=",";
-            }
-            name +=product.get(i).getShopName();
-            shopID+=product.get(i).getShopID();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下供应商的上架费将于3个月后到期,请及时提醒供应商续费。");
-            notification.setShopContent(name);
-            notification.setShopID(shopID);
-            notificationDao.addNotification(notification);
-            name="";
-            shopID="";
-        }
-        //上架费1个月后过期
-        for (int i=0;i<product1.size();i++){
-            if(i!=0){
-                name+=",";
-                shopID+=",";
-            }
-            name +=product1.get(i).getShopName();
-            shopID+=product1.get(i).getShopID();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下供应商的上架费将于1个月后到期,请及时提醒供应商续费。");
-            notification.setShopContent(name);
-            notification.setShopID(shopID);
-            notificationDao.addNotification(notification);
-            name="";
-            shopID="";
-        }
-//上架费7日后过期
-        for (int i=0;i<product2.size();i++){
-            if(i!=0){
-                name+=",";
-                shopID+=",";
-            }
-            name +=product2.get(i).getShopName();
-            shopID+=product2.get(i).getShopID();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下供应商的上架费将于7天后到期,请及时提醒供应商续费。");
-            notification.setShopContent(name);
-            notification.setShopID(shopID);
-            notificationDao.addNotification(notification);
-            name="";
-            shopID="";
-        }
-//上架费今日后过期
-        for (int i=0;i<product3.size();i++){
-            if(i!=0){
-                name+=",";
-                shopID+=",";
-            }
-            name +=product3.get(i).getShopName();
-            shopID+=product3.get(i).getShopID();
-        }
-        if(!"".equals(name)){
-            Notification notification=new Notification();
-            notification.setTheme("以下供应商的上架费将于今天后到期,请及时提醒供应商续费。");
-            notification.setShopContent(name);
-            notification.setShopID(shopID);
-            notificationDao.addNotification(notification);
-            name="";
-            shopID="";
-        }
-      }
-        jedis.lpush("constraint","1");
+//        if(!"1".equals(jedis.rpop("constraint"))){
+//            jedis.lpush("constraint","0");
+//
+//        }
+//        constraint=jedis.rpop("constraint");
+//        System.out.println(jedis.rpop("constraint"));
+//      if("0".equals(constraint)){
+//       for (int i=0;i<pro.size();i++){
+//           MessageCenter messageCenter = new MessageCenter();
+//           messageCenter.setShopId(pro.get(i).getShopID());
+//           messageCenter.setClubId(null);
+//           messageCenter.setUserType(2);
+//           messageCenter.setMessageType(2);
+//           messageCenter.setShopMessType(5);
+//           messageCenter.setContent("该商品的资质证书将于3个月后失效,请及时登录采美网站上传新证书。");
+//           messageCenter.setTime(curDateStr);
+//           messageCenterDao.addMessageCenter(messageCenter);
+//
+//           if(i!=0){
+//               name+=",";
+//               productID+=",";
+//           }
+//          name +="("+pro.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//           productID+=pro.get(i).getProductID().toString();
+//    }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于3个月后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+//        //械字号资质证书1个月后过期
+//        for (int i=0;i<pro1.size();i++){
+//
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro1.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro1.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro1.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于1个月后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+////械字号资质证书7日后过期
+//        for (int i=0;i<pro2.size();i++){
+//
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro2.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro2.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro2.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于7天后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+////械字号资质证书今日后过期
+//        for (int i=0;i<pro3.size();i++){
+//            MessageCenter messageCenter = new MessageCenter();
+//            messageCenter.setShopId(pro3.get(i).getShopID());
+//            messageCenter.setClubId(null);
+//            messageCenter.setUserType(2);
+//            messageCenter.setMessageType(2);
+//            messageCenter.setShopMessType(5);
+//            messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
+//            messageCenter.setTime(curDateStr);
+//            messageCenterDao.addMessageCenter(messageCenter);
+//            if(i!=0){
+//                name+=",";
+//                productID+=",";
+//            }
+//            name +="("+pro3.get(i).getProductID().toString()+")"+pro.get(i).getName();
+//            productID+=pro3.get(i).getProductID().toString();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下械字号商品的资质证书将于今天后失效,请及时提醒供应商更换证书。");
+//            notification.setShopContent(name);
+//            notification.setPorductID(productID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            productID="";
+//        }
+//        //上架费
+//        for (int i=0;i<product.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product.get(i).getShopName();
+//            shopID+=product.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于3个月后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+//        //上架费1个月后过期
+//        for (int i=0;i<product1.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product1.get(i).getShopName();
+//            shopID+=product1.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于1个月后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+////上架费7日后过期
+//        for (int i=0;i<product2.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product2.get(i).getShopName();
+//            shopID+=product2.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于7天后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+////上架费今日后过期
+//        for (int i=0;i<product3.size();i++){
+//            if(i!=0){
+//                name+=",";
+//                shopID+=",";
+//            }
+//            name +=product3.get(i).getShopName();
+//            shopID+=product3.get(i).getShopID();
+//        }
+//        if(!"".equals(name)){
+//            Notification notification=new Notification();
+//            notification.setTheme("以下供应商的上架费将于今天后到期,请及时提醒供应商续费。");
+//            notification.setShopContent(name);
+//            notification.setShopID(shopID);
+//            notificationDao.addNotification(notification);
+//            name="";
+//            shopID="";
+//        }
+//      }
+//        jedis.lpush("constraint","1");
       List<String> content=new ArrayList<>();
         Page<Notification> page = notificationService.notificationPagen(new Page<Notification>(request, response), notifi);
 
@@ -500,7 +500,7 @@ if(count<=0){
         notificationDao.hides();
         return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
     }
-    @Scheduled(cron = "0 0/15 * * * ?")
+    @Scheduled(cron = "0 0 11 * * ?")
 //@Scheduled(cron = "0 0/3 * * * ?")
     public void time(){
         logger.info("》》》》》》》》》》》开始检测商品资质证书和上架费是否过期");
@@ -539,7 +539,7 @@ if(count<=0){
         }
         constraint=jedis.rpop("constraint");
         System.out.println(jedis.rpop("constraint"));
-//        if("0".equals(constraint)){
+        if("0".equals(constraint)){
             for (int i=0;i<pro.size();i++){
 
                 MessageCenter messageCenter = new MessageCenter();
@@ -727,7 +727,7 @@ if(count<=0){
                 name="";
                 shopID="";
             }
-//        }
+        }
         jedis.lpush("constraint","1");
         }