From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java |  599 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 290 insertions(+), 309 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java
index c44ede6..27edf6d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java
@@ -1,309 +1,290 @@
-package com.yeshi.fanli.util.push;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-
-import org.json.simple.parser.ParseException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.yeshi.utils.JsonUtil;
-
-import com.xiaomi.xmpush.server.Constants;
-import com.xiaomi.xmpush.server.Message;
-import com.xiaomi.xmpush.server.Message.Builder;
-import com.xiaomi.xmpush.server.Result;
-import com.xiaomi.xmpush.server.Sender;
-import com.yeshi.fanli.entity.xinge.MessageInfo;
-import com.yeshi.fanli.entity.xinge.PushRecord;
-import com.yeshi.fanli.log.LogHelper;
-import com.yeshi.fanli.log.PushLogHelper;
-import com.yeshi.fanli.service.inter.config.BusinessSystemService;
-import com.yeshi.fanli.util.Constant;
-import com.yeshi.fanli.util.PropertiesUtil;
-
-import net.sf.json.JSONObject;
-
-@Component
-public class XiaoMiPushUtil {
-
-	private static XiaoMiPushUtil xiaoMiPushUtil;
-
-	@Autowired
-	private BusinessSystemService businessSystemService;
-
-	@PostConstruct
-	public void init() {
-		xiaoMiPushUtil = this;
-		xiaoMiPushUtil.businessSystemService = this.businessSystemService;
-	}
-
-	// AppKey
-	private static String XIAOMI_F_ANDROID_APP_KEY = PropertiesUtil.getMap().get("xiaomi_f_android_app_key");
-
-	// AppSecert
-	private static String XIAOMI_F_ANDROID_APP_SECERT = PropertiesUtil.getMap().get("xiaomi_f_android_app_secert");
-
-	/**
-	 * 
-	 * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佸畨鍗擄紙鍏ㄦ帹锛�
-	 * 
-	 * @author mawurui createTime 2018骞�3鏈�7鏃� 涓婂崍9:57:56
-	 * @param info
-	 * @param params
-	 * @param system
-	 * @return
-	 */
-	public static String allPushAndroidForXM(MessageInfo info, Map<String, Object> map) {
-		if (Constant.IS_TEST)
-			return null;
-
-		String name = info.getPackageName();
-		if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
-				&& !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
-			return null;
-		}
-
-		// 浠巌nfo涓彇椤甸潰浼犳潵鐨勫��
-		Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
-		String PackageName = info.getPackageName();
-		Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 鐢宠鐨凙ppSecert
-		String title = info.getTitle();
-		String payload = info.getContent();
-		String description = info.getContent();
-
-		Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
-		Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
-				.notifyId((int) (Math.random() * Integer.MAX_VALUE))
-				.description(description).passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp,
-															// 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
-				.notifyType(1); // 璁剧疆閫氱煡绫诲瀷, type绫诲瀷(1-榛樿鎻愮ず闊�, 2-浣跨敤榛樿闇囧姩鎻愮ず,
-								// 3-浣跨敤榛樿led鐏厜鎻愮ず)
-		// 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
-		if (map != null) {
-			for (String key : map.keySet()) {
-				builder.extra(key, map.get(key).toString());
-			}
-		}
-		message = builder.build();
-		try {
-			Result result = sender.broadcastAll(message, 3);
-			return result.getMessageId();// 鎴愬姛 杩斿洖娑堟伅鐨処d锛� 澶辫触杩斿洖null
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	/**
-	 * 鎵归噺鎺ㄩ��
-	 * 
-	 * @param info
-	 * @param map
-	 * @param regList
-	 *            鏈�澶т釜鏁颁负1000
-	 * @return
-	 */
-	public static String pushBatchAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regList) {
-		if (Constant.IS_TEST)
-			return null;
-		if (regList == null || regList.size() == 0)
-			return "";
-
-		String name = info.getPackageName();
-		if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
-				&& !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
-			return null;
-		}
-
-		// 浠巌nfo涓彇椤甸潰浼犳潵鐨勫��
-		Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
-		String PackageName = info.getPackageName();
-		Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 鐢宠鐨凙ppSecert
-		String title = info.getTitle();
-		String payload = info.getContent();
-		String description = info.getContent();
-
-		Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
-		Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
-				.notifyId((int) (Math.random() * Integer.MAX_VALUE))
-				.description(description).passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp,
-															// 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
-				.notifyType(1); // 璁剧疆閫氱煡绫诲瀷, type绫诲瀷(1-榛樿鎻愮ず闊�, 2-浣跨敤榛樿闇囧姩鎻愮ず,
-								// 3-浣跨敤榛樿led鐏厜鎻愮ず)
-		// 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
-		if (map != null) {
-			for (String key : map.keySet()) {
-				builder.extra(key, map.get(key).toString());
-			}
-		}
-		message = builder.build();
-		try {
-			Result result = sender.send(message, regList, 3);
-			return result.getMessageId();// 鎴愬姛 杩斿洖娑堟伅鐨処d锛� 澶辫触杩斿洖null
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	/**
-	 * 
-	 * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佸畨鍗擄紙鍗曟帹锛�
-	 * 
-	 * @author mawurui createTime 2018骞�3鏈�7鏃� 涓嬪崍5:09:18
-	 * @param info
-	 * @param params
-	 * @param system
-	 * @return
-	 */
-	public static String singlePushAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regIds,
-			System system) {
-		String name = info.getPackageName();
-		if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
-				&& !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
-			return null;
-		}
-		Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
-		String PackageName = info.getPackageName();
-		Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT);
-		String title = info.getTitle();
-		String content = info.getContent();
-		String uId = info.getAlias();
-
-		Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
-		Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).description(content)
-				.passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp, 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
-				.notifyId((int) (Math.random() * Integer.MAX_VALUE)).notifyType(1); // 璁剧疆閫氱煡绫诲瀷,
-																					// type绫诲瀷(1-榛樿鎻愮ず闊�,
-																					// 2-浣跨敤榛樿闇囧姩鎻愮ず,
-		// 3-浣跨敤榛樿led鐏厜鎻愮ず)
-		// 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
-		if (map != null) {
-			for (String key : map.keySet()) {
-				builder.extra(key, map.get(key).toString());
-			}
-		}
-		message = builder.build();
-		try {
-			Result result = sender.send(message, regIds, 3); // sender.sendToAlias(message,
-																// uId, 3);
-			PushLogHelper.xmInfo("鎺ㄩ�佺粨鏋�:" + result.getReason());
-			return result.getMessageId();
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	/**
-	 * 
-	 * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佺孩鍖�
-	 * 
-	 * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍9:55:14
-	 * @param info
-	 */
-	public static void pushByHongBao(List<String> regIds, System system) {
-		MessageInfo info = new MessageInfo();
-		info.setTitle("鏂板埌绾㈠寘");
-		info.setDescription("绾㈠寘鍒版潵浜�...");
-		JSONObject jsonObject = new JSONObject();
-		jsonObject.put("type", "hongbao");
-		XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
-	}
-
-	/**
-	 * 
-	 * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佹彁鐜扮敵璇�
-	 * 
-	 * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍10:00:16
-	 * @param info
-	 */
-	public static void pushByApply(List<String> regIds, System system) {
-		MessageInfo info = new MessageInfo();
-		info.setTitle("鎻愮幇鐢宠");
-		info.setDescription("鎻愮幇瀹℃牳涓�...");
-		JSONObject jsonObject = new JSONObject();
-		jsonObject.put("type", "cash");
-		XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
-	}
-
-	/**
-	 * 
-	 * 鏂规硶璇存槑: 鎺ㄩ�佹彁鐜扮姸鎬�
-	 * 
-	 * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍10:26:34
-	 * @param alias
-	 * @param state
-	 * @param system
-	 */
-	public static void pushByExtract(List<String> regIds, int state, System system) {
-		MessageInfo info = new MessageInfo();
-		if (state == 0) {
-			info.setTitle("鎻愮幇鎴愬姛");
-			info.setDescription("鎮ㄦ湁涓�绗斾氦鏄擄紝宸叉彁鐜版垚鍔燂紒");
-		} else if (state == 1) {
-			info.setTitle("鎻愮幇澶辫触");
-			info.setDescription("鎮ㄦ湁涓�绗斾氦鏄擄紝鎻愮幇澶辫触锛�");
-		} else {
-			info.setTitle("鎻愮幇澶辫触");
-			info.setDescription("鎻愮幇琚嫆缁�");
-		}
-		JSONObject jsonObject = new JSONObject();
-		jsonObject.put("type", "cash");
-		XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
-	}
-
-	/**
-	 * 
-	 * @param info
-	 * @param params
-	 * @param pushRecord
-	 * @return 1:閮芥垚鍔� 2锛氫粎android 鎴愬姛 3.浠匢OS鎴愬姛 4.閮藉け璐�
-	 */
-	private static int pushApp(MessageInfo info, JSONObject json, PushRecord pushRecord, System b_android) {
-		// jsonXm 杞崲涓� map
-		JSONObject mapXm = JSONObject.fromObject(json);
-		String android = allPushAndroidForXM(info, mapXm);
-		LogHelper.userInfo("灏忕背鎺ㄩ�侊細" + android);
-		pushRecord.setAndroidPushId(android);
-		if (android != null) {
-			return 1;
-		} else {
-			return 4;
-		}
-	}
-
-	public static void pushZNX(List<String> regIds, String title, String content, String msgId) {
-		// 灏忕背寮�濮嬫帹閫�
-		MessageInfo info = new MessageInfo();
-		info.setActivty(
-				String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
-		info.setTitle(title);
-		info.setContent(content);
-		info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
-		JSONObject json = new JSONObject();
-		json.put("type", "ZNX");
-		json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
-				Constant.systemCommonConfig.getAndroidBaseactivityName()));
-
-		JSONObject contentJson = new JSONObject();
-		contentJson.put("id", msgId);
-		contentJson.put("title", title);
-		contentJson.put("content", content);
-		contentJson.put("isOpen", 0);
-		contentJson.put("createTime", java.lang.System.currentTimeMillis());
-		json.put("content", contentJson);
-		JSONObject mapXm = JSONObject.fromObject(json);
-		XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, regIds, null);
-	}
-
-}
+package com.yeshi.fanli.util.push;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import org.json.simple.parser.ParseException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.yeshi.utils.JsonUtil;
+
+import com.xiaomi.xmpush.server.Constants;
+import com.xiaomi.xmpush.server.Message;
+import com.xiaomi.xmpush.server.Message.Builder;
+import com.xiaomi.xmpush.server.Result;
+import com.xiaomi.xmpush.server.Sender;
+import com.yeshi.fanli.entity.xinge.MessageInfo;
+import com.yeshi.fanli.entity.xinge.PushRecord;
+import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.log.PushLogHelper;
+import com.yeshi.fanli.service.inter.config.BusinessSystemService;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.PropertiesUtil;
+
+import net.sf.json.JSONObject;
+
+@Component
+public class XiaoMiPushUtil {
+
+    private static XiaoMiPushUtil xiaoMiPushUtil;
+
+    @Autowired
+    private BusinessSystemService businessSystemService;
+
+    @PostConstruct
+    public void init() {
+        xiaoMiPushUtil = this;
+        xiaoMiPushUtil.businessSystemService = this.businessSystemService;
+    }
+
+    // AppKey
+    private static String XIAOMI_F_ANDROID_APP_KEY = PropertiesUtil.getMap().get("xiaomi_f_android_app_key");
+
+    // AppSecert
+    private static String XIAOMI_F_ANDROID_APP_SECERT = PropertiesUtil.getMap().get("xiaomi_f_android_app_secert");
+
+    /**
+     * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佸畨鍗擄紙鍏ㄦ帹锛�
+     *
+     * @param info
+     * @param params
+     * @param system
+     * @return
+     * @author mawurui createTime 2018骞�3鏈�7鏃� 涓婂崍9:57:56
+     */
+    public static String allPushAndroidForXM(MessageInfo info, Map<String, Object> map) {
+        if (Constant.IS_TEST)
+            return null;
+
+        String name = info.getPackageName();
+        // 浠巌nfo涓彇椤甸潰浼犳潵鐨勫��
+        Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
+        String PackageName = info.getPackageName();
+        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 鐢宠鐨凙ppSecert
+        String title = info.getTitle();
+        String payload = info.getContent();
+        String description = info.getContent();
+
+        Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
+        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
+                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
+                .description(description).passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp,
+                // 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
+                .notifyType(1); // 璁剧疆閫氱煡绫诲瀷, type绫诲瀷(1-榛樿鎻愮ず闊�, 2-浣跨敤榛樿闇囧姩鎻愮ず,
+        // 3-浣跨敤榛樿led鐏厜鎻愮ず)
+        // 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
+        if (map != null) {
+            for (String key : map.keySet()) {
+                builder.extra(key, map.get(key).toString());
+            }
+        }
+        message = builder.build();
+        try {
+            Result result = sender.broadcastAll(message, 3);
+            return result.getMessageId();// 鎴愬姛 杩斿洖娑堟伅鐨処d锛� 澶辫触杩斿洖null
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 鎵归噺鎺ㄩ��
+     *
+     * @param info
+     * @param map
+     * @param regList 鏈�澶т釜鏁颁负1000
+     * @return
+     */
+    public static String pushBatchAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regList) {
+        if (Constant.IS_TEST)
+            return null;
+        if (regList == null || regList.size() == 0)
+            return "";
+
+        String name = info.getPackageName();
+
+        // 浠巌nfo涓彇椤甸潰浼犳潵鐨勫��
+        Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
+        String PackageName = info.getPackageName();
+        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 鐢宠鐨凙ppSecert
+        String title = info.getTitle();
+        String payload = info.getContent();
+        String description = info.getContent();
+
+        Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
+        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
+                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
+                .description(description).passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp,
+                // 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
+                .notifyType(1); // 璁剧疆閫氱煡绫诲瀷, type绫诲瀷(1-榛樿鎻愮ず闊�, 2-浣跨敤榛樿闇囧姩鎻愮ず,
+        // 3-浣跨敤榛樿led鐏厜鎻愮ず)
+        // 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
+        if (map != null) {
+            for (String key : map.keySet()) {
+                builder.extra(key, map.get(key).toString());
+            }
+        }
+        message = builder.build();
+        try {
+            Result result = sender.send(message, regList, 3);
+            return result.getMessageId();// 鎴愬姛 杩斿洖娑堟伅鐨処d锛� 澶辫触杩斿洖null
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佸畨鍗擄紙鍗曟帹锛�
+     *
+     * @param info
+     * @param params
+     * @param system
+     * @return
+     * @author mawurui createTime 2018骞�3鏈�7鏃� 涓嬪崍5:09:18
+     */
+    public static String singlePushAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regIds,
+                                                System system) {
+        String name = info.getPackageName();
+
+        Constants.useOfficial(); // 鍚姩鎺ㄩ�佹柟娉�
+        String PackageName = info.getPackageName();
+        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT);
+        String title = info.getTitle();
+        String content = info.getContent();
+        String uId = info.getAlias();
+
+        Message message = null; // 鍋氬惊鐜紶鏉ョ殑key
+        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).description(content)
+                .passThrough(0) // 璁剧疆娑堟伅鏄惁閫氳繃閫忎紶鏂瑰紡鑷矨pp, 1琛ㄧず閫忎紶锛�0琛ㄧず閫氱煡鏍忔秷鎭紙榛樿锛�
+                .notifyId((int) (Math.random() * Integer.MAX_VALUE)).notifyType(1); // 璁剧疆閫氱煡绫诲瀷,
+        // type绫诲瀷(1-榛樿鎻愮ず闊�,
+        // 2-浣跨敤榛樿闇囧姩鎻愮ず,
+        // 3-浣跨敤榛樿led鐏厜鎻愮ず)
+        // 灏唀xtra鏀惧叆MessageInfo瀵硅薄涓紝 寰幆閬嶅巻extra涓殑key 鍜� value
+        if (map != null) {
+            for (String key : map.keySet()) {
+                builder.extra(key, map.get(key).toString());
+            }
+        }
+        message = builder.build();
+        try {
+            Result result = sender.send(message, regIds, 3); // sender.sendToAlias(message,
+            // uId, 3);
+            PushLogHelper.xmInfo("鎺ㄩ�佺粨鏋�:" + result.getReason());
+            return result.getMessageId();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佺孩鍖�
+     *
+     * @param info
+     * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍9:55:14
+     */
+    public static void pushByHongBao(List<String> regIds, System system) {
+        MessageInfo info = new MessageInfo();
+        info.setTitle("鏂板埌绾㈠寘");
+        info.setDescription("绾㈠寘鍒版潵浜�...");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("type", "hongbao");
+        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
+    }
+
+    /**
+     * 鏂规硶璇存槑: 灏忕背鎺ㄩ�佹彁鐜扮敵璇�
+     *
+     * @param info
+     * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍10:00:16
+     */
+    public static void pushByApply(List<String> regIds, System system) {
+        MessageInfo info = new MessageInfo();
+        info.setTitle("鎻愮幇鐢宠");
+        info.setDescription("鎻愮幇瀹℃牳涓�...");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("type", "cash");
+        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
+    }
+
+    /**
+     * 鏂规硶璇存槑: 鎺ㄩ�佹彁鐜扮姸鎬�
+     *
+     * @param alias
+     * @param state
+     * @param system
+     * @author mawurui createTime 2018骞�3鏈�8鏃� 涓婂崍10:26:34
+     */
+    public static void pushByExtract(List<String> regIds, int state, System system) {
+        MessageInfo info = new MessageInfo();
+        if (state == 0) {
+            info.setTitle("鎻愮幇鎴愬姛");
+            info.setDescription("鎮ㄦ湁涓�绗斾氦鏄擄紝宸叉彁鐜版垚鍔燂紒");
+        } else if (state == 1) {
+            info.setTitle("鎻愮幇澶辫触");
+            info.setDescription("鎮ㄦ湁涓�绗斾氦鏄擄紝鎻愮幇澶辫触锛�");
+        } else {
+            info.setTitle("鎻愮幇澶辫触");
+            info.setDescription("鎻愮幇琚嫆缁�");
+        }
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("type", "cash");
+        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
+    }
+
+    /**
+     * @param info
+     * @param params
+     * @param pushRecord
+     * @return 1:閮芥垚鍔� 2锛氫粎android 鎴愬姛 3.浠匢OS鎴愬姛 4.閮藉け璐�
+     */
+    private static int pushApp(MessageInfo info, JSONObject json, PushRecord pushRecord, System b_android) {
+        // jsonXm 杞崲涓� map
+        JSONObject mapXm = JSONObject.fromObject(json);
+        String android = allPushAndroidForXM(info, mapXm);
+        LogHelper.userInfo("灏忕背鎺ㄩ�侊細" + android);
+        pushRecord.setAndroidPushId(android);
+        if (android != null) {
+            return 1;
+        } else {
+            return 4;
+        }
+    }
+
+    public static void pushZNX(List<String> regIds, String title, String content, String msgId, String androidPackageName, String androidBaseActivityName) {
+        // 灏忕背寮�濮嬫帹閫�
+        MessageInfo info = new MessageInfo();
+        info.setActivty(
+                String.format("%s.ui.BrowserActivity", androidBaseActivityName));
+        info.setTitle(title);
+        info.setContent(content);
+        info.setPackageName(androidPackageName);
+        JSONObject json = new JSONObject();
+        json.put("type", "ZNX");
+        json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
+                androidBaseActivityName));
+
+        JSONObject contentJson = new JSONObject();
+        contentJson.put("id", msgId);
+        contentJson.put("title", title);
+        contentJson.put("content", content);
+        contentJson.put("isOpen", 0);
+        contentJson.put("createTime", java.lang.System.currentTimeMillis());
+        json.put("content", contentJson);
+        JSONObject mapXm = JSONObject.fromObject(json);
+        XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, regIds, null);
+    }
+
+}

--
Gitblit v1.8.0