yujian
2019-03-12 f0fc7d2684ee50b885b7003bb06eb1663cfbaa7f
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushController.java
@@ -36,6 +36,7 @@
   public final static int ZNX = 4; // 站内推送
   public final static int WEEX = 5; // 站内推送
   public final static int BAICHUAN = 6; // 站内推送
   public final static int WELFARE_CENTER = 7; // 福利中心
   @Resource
   private PushRecordService pushRecordService;
@@ -54,7 +55,7 @@
   @Resource
   private PushService pushService;
   @Resource
   private UserSystemMsgService userSystemMsgService;
@@ -153,7 +154,7 @@
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("转链数据不能为空"));
         return;
      }
      try {
         String shortLink = org.yeshi.utils.HttpUtil.getShortLink(url);
@@ -161,17 +162,15 @@
         jsonData.put("url", url);
         jsonData.put("shortLink", shortLink);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonData));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("转换失败"));
         e.printStackTrace();
      }
   }
   /**
    * 商品推送  -(新后台)
    * 商品推送 -(新后台)
    * 
    * @param uId
    *            -用户ID 可为空
@@ -185,8 +184,9 @@
    * @throws Exception
    */
   @RequestMapping(value = "newPushGoodsAll")
   public void newPushGoodsAll(String callback, Long uid, String url, String title, String content, PrintWriter out) throws Exception {
   public void newPushGoodsAll(String callback, Long uid, String url, String title, String content, PrintWriter out)
         throws Exception {
      String auctionId = null;
      if (!StringUtil.isNullOrEmpty(url) && url.contains("id=")) {
         String[] sts = url.split("\\?")[1].split("&");
@@ -215,7 +215,7 @@
         e.printStackTrace();
      }
   }
   /**
    * 网页推送 -(新后台)
    * 
@@ -227,7 +227,7 @@
    */
   @RequestMapping(value = "newPushUrlAll")
   public void newPushUrlAll(String callback, String url, String title, String content, PrintWriter out) {
      if (StringUtil.isNullOrEmpty(url) || StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写链接,标题与内容"));
         return;
@@ -238,7 +238,7 @@
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("标题或内容过长,请删减后再试"));
         return;
      }
      try {
         pushService.pushUrl(null, url, title, content);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
@@ -247,7 +247,7 @@
         e.printStackTrace();
      }
   }
   /**
    * 
    * 方法说明: 站内信推送 -(新后台)
@@ -259,19 +259,19 @@
    */
   @RequestMapping(value = "newPushFanZNX")
   public void newPushFanZNX(String callback, String uids, String title, String content, PrintWriter out) {
      if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
         return;
      }
      try {
         String[] uidArray = null;
         if (uids != null) {
            uidArray = uids.split(",");
         }
         if (uidArray == null) {
            pushService.pushZNX(null, title, content);
         } else {
@@ -279,10 +279,9 @@
               String str_uid = uidArray[i];
               if (str_uid != null && str_uid.trim().length() > 0) {
                  pushService.pushZNX(Long.parseLong(str_uid), title, content);
                  userSystemMsgService.addUserSystemMsg(Long.parseLong(str_uid),
                        UserSystemMsgTypeEnum.question, title, content,
                        UserSystemMsg.TIME_TAG_EMERGENT, null);
                  userSystemMsgService.addUserSystemMsg(Long.parseLong(str_uid), UserSystemMsgTypeEnum.question,
                        title, content, UserSystemMsg.TIME_TAG_EMERGENT, null);
               }
            }
         }
@@ -295,7 +294,6 @@
      }
   }
   /**
    * 
    * 方法说明: 百川推送 -(新后台)
@@ -306,21 +304,20 @@
    * @throws Exception
    */
   @RequestMapping(value = "pushBaiChuan")
   public void pushBaiChuan(String callback, String uids, String title, String content, String url,
         PrintWriter out) {
   public void pushBaiChuan(String callback, String uids, String title, String content, String url, PrintWriter out) {
      if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
         return;
      }
      try {
         String[] uidArray = null;
         if (uids != null) {
            uidArray = uids.split(",");
         }
         if (uidArray == null) {
            pushService.pushBaiChuanUrl(null, title, content, url);
         } else {
@@ -332,7 +329,7 @@
            }
         }
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
      } catch (PushException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
@@ -340,5 +337,5 @@
         e.printStackTrace();
      }
   }
}