57 lines
2.0 KiB
Plaintext
57 lines
2.0 KiB
Plaintext
package com.jysoft.igwmessage;
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
|
|
import com.aostarit.mobile.client.message.api.client.MsgQueryClient;
|
|
import com.aostarit.mobile.client.message.api.client.MsgRequestClient;
|
|
import com.aostarit.mobile.client.message.api.client.MsgSendClient;
|
|
import com.aostarit.mobile.client.message.api.config.WxMsgConfig;
|
|
|
|
public class MsgClientUtils {
|
|
|
|
|
|
|
|
|
|
|
|
private static MsgSendClient msgSendClient ;
|
|
|
|
|
|
|
|
private MsgClientUtils(){
|
|
|
|
}
|
|
public static MsgSendClient getInstance(){
|
|
if(msgSendClient==null){
|
|
//生产
|
|
|
|
String producerId = "d1c6e3b0f94742dc91a13f9a780941d6";
|
|
String sm2key = "041C2174BC0227F8F7F9342522AED537C277B3AA6217246D892156B874702041D5180D121845E75DF9D31B05DEA490632C9DD6F2AFBF40540740AAE21D32CAF9A6";
|
|
String sm4key = "13276439115248968552415895716389";
|
|
String baseUrl = "https://id.sgcc.com.cn:10443/mobile-message";
|
|
//测试
|
|
// String messageAppId = "0f4824416eca4c7e82753acaf222649e";
|
|
// String producerId = "d1c6e3b0f94742dc91a13f9a780941d6";
|
|
// String sm2key = "041C2174BC0227F8F7F9342522AED537C277B3AA6217246D892156B874702041D5180D121845E75DF9D31B05DEA490632C9DD6F2AFBF40540740AAE21D32CAF9A6";
|
|
// String sm4key = "13276439115248968552415895716389";
|
|
// String baseUrl = "https://igw.isgcc.net:18443/isgcc_message/server";
|
|
|
|
WxMsgConfig wxMsgConfig = new WxMsgConfig();
|
|
wxMsgConfig.setBaseUrl(baseUrl);
|
|
// TODO : 以下三个参数需要进行替换
|
|
wxMsgConfig.setProducerId(producerId);
|
|
wxMsgConfig.setSm4Key(sm4key);
|
|
wxMsgConfig.setSm2PublicKey(sm2key);
|
|
// 以下三个Bean 建议在项目中以单例形式存在
|
|
MsgRequestClient requestClient = new MsgRequestClient(wxMsgConfig);
|
|
// 消息中心查询client
|
|
// MsgQueryClient msgQueryClient = new MsgQueryClient(requestClient);
|
|
// 消息中心发送client
|
|
msgSendClient = new MsgSendClient(requestClient);
|
|
return msgSendClient;
|
|
}else{
|
|
return msgSendClient;
|
|
}
|
|
}
|
|
}
|