|
|
@@ -0,0 +1,62 @@
|
|
|
+package com.uas.platform.b2b.support;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+
|
|
|
+import com.uas.platform.b2b.dao.UserDao;
|
|
|
+import com.uas.platform.b2b.service.UserService;
|
|
|
+import com.uas.platform.core.model.Constant;
|
|
|
+import com.uas.platform.core.util.HttpUtil;
|
|
|
+import com.uas.platform.core.util.HttpUtil.Response;
|
|
|
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+public class BaiduPush {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * /**
|
|
|
+ * @param account 接受者账号(手机号)
|
|
|
+ * @param tittle 推送消息的标题
|
|
|
+ * @param content 推送消息的内容
|
|
|
+ * @param url 消息指定要打开的页面
|
|
|
+ * @param pageTitle webView标题
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static void pushSingleAccount(Long account, Long enuu, String title, String content, String url, String pageTitle){
|
|
|
+ HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ //params.put("master", master);//账套
|
|
|
+ params.put("userid","100254");//推送目标用户
|
|
|
+ params.put("title", title);//推送标题
|
|
|
+ params.put("content", content);//正文
|
|
|
+ params.put("enUU", enuu.toString());//UU号
|
|
|
+ params.put("masterId", "");//账套ID
|
|
|
+ params.put("url", url);//跳转链接地址
|
|
|
+ params.put("pageTitle", pageTitle);//页面标题
|
|
|
+ params.put("platform", "B2B");//系统名称,ERP或者B2B
|
|
|
+ System.out.println("push:");
|
|
|
+ //Constant.PUSH_WEBSITE;
|
|
|
+ try {
|
|
|
+ Response response = HttpUtil
|
|
|
+ .sendPostRequest(Constant.PUSH_WEBSITE+"/tigase/baiduPush",
|
|
|
+ params, false);
|
|
|
+ System.out.println(response.getResponseText());
|
|
|
+ if (response.getStatusCode() == HttpStatus.OK.value()) {
|
|
|
+ System.out.println(response.getResponseText());
|
|
|
+ Map<String, Object> backInfo = FlexJsonUtils.fromJson(
|
|
|
+ response.getResponseText(), HashMap.class);
|
|
|
+ if(backInfo.size()>0){
|
|
|
+ //System.out.println(backInfo.get("result"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|