|
@@ -90,171 +90,6 @@ public class NotificationController extends BaseController {
|
|
|
return "modules/sys/Notification";
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * constraint加入缓存
|
|
|
- */
|
|
|
- @Scheduled(cron = "0 0 23 * * ?")
|
|
|
- public void Open() {
|
|
|
- Jedis jedis = new Jedis("192.168.2.100", 6379);
|
|
|
- if(domain.contains("-b")){
|
|
|
- jedis=new Jedis("47.119.112.46", 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.lpush("constraint", "0");
|
|
|
- }
|
|
|
-
|
|
|
- @Scheduled(cron = "0 0 11 * * ?")
|
|
|
-//@Scheduled(cron = "0 0/10 * * * ?")
|
|
|
- public void mess() throws Exception {
|
|
|
- Date date = new Date();
|
|
|
- String name = "";
|
|
|
- Integer count = 0;
|
|
|
- List<Product> pro = notificationDao.productTypeCount(3);
|
|
|
- List<Product> pro1 = notificationDao.productTypeCount(1);
|
|
|
- List<Product> pro2 = notificationDao.productTypeCount1(7);
|
|
|
- List<Product> pro3 = notificationDao.productTypeCount1(1);
|
|
|
- for (int i = 0; i < pro.size(); i++) {
|
|
|
- name = pro.get(i).getName();
|
|
|
- if (name.length() > 10) {
|
|
|
- name = StringUtils.strip(name.substring(0, 11));
|
|
|
- name += "...";
|
|
|
- }
|
|
|
-
|
|
|
- logger.info("**************************质证书失效消息推送************************************");
|
|
|
- try {
|
|
|
- Integer userID = messageCenterDao.userID(pro.get(i).getShopID());
|
|
|
- String shopName = messageCenterDao.shopName(pro.get(i).getShopID());
|
|
|
- String unionid = newShopOrderDao.UnionId(userID);
|
|
|
- List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
- String qualificationNo = pro.get(i).getQualificationNo();
|
|
|
- String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
- String pagePath = "";
|
|
|
- for (String openid : openidList) {
|
|
|
- weChatService.messteme(accessToken, openid, shopName, qualificationNo, time, name, pagePath);
|
|
|
- count++;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
|
|
|
- }
|
|
|
- if (count <= 0) {
|
|
|
- String bindMobile = messageCenterDao.Mobile(pro.get(i).getShopID());
|
|
|
- String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于3个月后失效,请及时登录采美网站上传新证书。";
|
|
|
- boolean sendSms = SMSUtils.sendSms(1, bindMobile, content);
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>资质证书将于3个月后失效短信推送成功");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < pro1.size(); i++) {
|
|
|
- name = pro1.get(i).getName();
|
|
|
- if (name.length() > 10) {
|
|
|
- name = StringUtils.strip(name.substring(0, 11));
|
|
|
- name += "...";
|
|
|
- }
|
|
|
-
|
|
|
- logger.info("**************************质证书失效消息推送************************************");
|
|
|
- try {
|
|
|
- Integer userID = messageCenterDao.userID(pro1.get(i).getShopID());
|
|
|
- String shopName = messageCenterDao.shopName(pro1.get(i).getShopID());
|
|
|
- String unionid = newShopOrderDao.UnionId(userID);
|
|
|
- List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
- String qualificationNo = pro1.get(i).getQualificationNo();
|
|
|
- String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
- String pagePath = "";
|
|
|
- for (String openid : openidList) {
|
|
|
- weChatService.messteme(accessToken, openid, shopName, qualificationNo, time, name, pagePath);
|
|
|
- count++;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
|
|
|
- }
|
|
|
- if (count <= 0) {
|
|
|
- String bindMobile = messageCenterDao.Mobile(pro1.get(i).getShopID());
|
|
|
- String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于1个月后失效,请及时登录采美网站上传新证书。";
|
|
|
- boolean sendSms = SMSUtils.sendSms(1, bindMobile, content);
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>资质证书将于1个月后失效短信推送成功");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < pro2.size(); i++) {
|
|
|
- name = pro2.get(i).getName();
|
|
|
- if (name.length() > 10) {
|
|
|
- name = StringUtils.strip(name.substring(0, 11));
|
|
|
- name += "...";
|
|
|
- }
|
|
|
-
|
|
|
- logger.info("**************************质证书失效消息推送************************************");
|
|
|
- try {
|
|
|
- Integer userID = messageCenterDao.userID(pro2.get(i).getShopID());
|
|
|
- String shopName = messageCenterDao.shopName(pro2.get(i).getShopID());
|
|
|
- String unionid = newShopOrderDao.UnionId(userID);
|
|
|
- List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
- String qualificationNo = pro2.get(i).getQualificationNo();
|
|
|
- String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
- String pagePath = "";
|
|
|
- for (String openid : openidList) {
|
|
|
- weChatService.messteme(accessToken, openid, shopName, qualificationNo, time, name, pagePath);
|
|
|
- count++;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
|
|
|
- }
|
|
|
- if (count <= 0) {
|
|
|
- String bindMobile = messageCenterDao.Mobile(pro2.get(i).getShopID());
|
|
|
- String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于7天后失效,请及时登录采美网站上传新证书。";
|
|
|
- boolean sendSms = SMSUtils.sendSms(1, bindMobile, content);
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>资质证书将于7天后失效短信推送成功");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < pro3.size(); i++) {
|
|
|
- name = pro3.get(i).getName();
|
|
|
- if (name.length() > 10) {
|
|
|
- name = StringUtils.strip(name.substring(0, 11));
|
|
|
- name += "...";
|
|
|
- }
|
|
|
- logger.info("**************************质证书失效消息推送************************************");
|
|
|
- try {
|
|
|
- Integer userID = messageCenterDao.userID(pro3.get(i).getShopID());
|
|
|
- String shopName = messageCenterDao.shopName(pro3.get(i).getShopID());
|
|
|
- String unionid = newShopOrderDao.UnionId(userID);
|
|
|
- List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
|
|
|
- String accessToken = weChatService.getAccessToken();
|
|
|
- String qualificationNo = pro3.get(i).getQualificationNo();
|
|
|
- String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
|
|
|
- String pagePath = "";
|
|
|
- for (String openid : openidList) {
|
|
|
- weChatService.messteme(accessToken, openid, shopName, qualificationNo, time, name, pagePath);
|
|
|
- count++;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
|
|
|
- }
|
|
|
- if (count <= 0) {
|
|
|
- String bindMobile = messageCenterDao.Mobile(pro3.get(i).getShopID());
|
|
|
- String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于今天后失效,请及时登录采美网站上传新证书。";
|
|
|
- boolean sendSms = SMSUtils.sendSms(1, bindMobile, content);
|
|
|
- if (sendSms) {
|
|
|
- logger.info(">>>>>>>资质证书将于今天后后失效短信推送成功");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@RequestMapping(value = {"update"})
|
|
|
public String update(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
notificationDao.Upnotification(notification);
|
|
@@ -292,133 +127,6 @@ public class NotificationController extends BaseController {
|
|
|
return "redirect:" + Global.getAdminPath() + "/sys/Notification/list";
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "0 0 11 * * ?")
|
|
|
-//@Scheduled(cron = "0 0/1 * * * ?")
|
|
|
- public void nottime() {
|
|
|
- logger.info("》》》》》》》》》》》开始检测商品资质证书和上架费是否过期");
|
|
|
- //械字号资质证书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);
|
|
|
- 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.setProductId(pro.get(i).getProductID());
|
|
|
- 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.setProductId(pro1.get(i).getProductID());
|
|
|
- messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
- if (i != 0) {
|
|
|
- name += ",";
|
|
|
- productID += ",";
|
|
|
- }
|
|
|
- name += "(" + pro1.get(i).getProductID().toString() + ")" + pro1.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.setProductId(pro2.get(i).getProductID());
|
|
|
- messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
- if (i != 0) {
|
|
|
- name += ",";
|
|
|
- productID += ",";
|
|
|
- }
|
|
|
- name += "(" + pro2.get(i).getProductID().toString() + ")" + pro2.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.setProductId(pro3.get(i).getProductID());
|
|
|
- messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
|
|
|
- messageCenter.setTime(curDateStr);
|
|
|
- messageCenterDao.addMessageCenter(messageCenter);
|
|
|
- if (i != 0) {
|
|
|
- name += ",";
|
|
|
- productID += ",";
|
|
|
- }
|
|
|
- name += "(" + pro3.get(i).getProductID().toString() + ")" + pro3.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 = "";
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|