|
@@ -25,14 +25,22 @@ import com.gexin.rp.sdk.base.payload.APNPayload;
|
|
|
import com.gexin.rp.sdk.exceptions.RequestException;
|
|
|
import com.gexin.rp.sdk.http.IGtPush;
|
|
|
import com.gexin.rp.sdk.template.TransmissionTemplate;
|
|
|
+import com.winnerlook.model.VoiceNotifyBody;
|
|
|
+import com.winnerlook.model.VoiceResponseResult;
|
|
|
+import com.winnerlook.service.VoiceSender;
|
|
|
+import com.winsea.svc.base.base.entity.CommonStaff;
|
|
|
+import com.winsea.svc.base.base.mapper.CommonStaffMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.CommonUser;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.CommonUserMapper;
|
|
|
+import org.apache.commons.codec.digest.DigestUtils;
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.io.*;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
+import java.net.URL;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Author:chengchangjiang
|
|
@@ -44,6 +52,8 @@ import java.util.Map;
|
|
|
public class GeTuiUtils {
|
|
|
@Autowired
|
|
|
private CommonUserMapper commonUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private CommonStaffMapper commonStaffMapper;
|
|
|
private static String appId = "q2frjgRYqt7RuC9Vjj6Va9";
|
|
|
private static String appKey = "L0gnzFQa2O8aFW15lPRzh2";
|
|
|
private static String masterSecret = "NhuCKHZJhp877ofHWtlQWA";
|
|
@@ -175,6 +185,53 @@ public class GeTuiUtils {
|
|
|
System.out.println("推送异常:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void callPhone(String userId) throws Exception {
|
|
|
+ // 电话信息
|
|
|
+
|
|
|
+ /*请修改为平台分配的accountId*/
|
|
|
+ String accountId="285481";
|
|
|
+ /*请修改为平台分配的token*/
|
|
|
+ String token="9e412526531a43f296d23bb29771c761";
|
|
|
+ VoiceNotifyBody message = new VoiceNotifyBody();
|
|
|
+ /*用户接收回执的服务器地址*/
|
|
|
+ message.setCallbackUrl("http://192.168.1.102:9780/voice/api/VoiceWeb/receiveRecord");
|
|
|
+ CommonStaff commonStaff= commonStaffMapper.selectById(userId);
|
|
|
+// message.setCalleeNumber("18840825257");
|
|
|
+ if(commonStaff != null){
|
|
|
+ message.setCalleeNumber(commonStaff.getStaffMobilePhone());
|
|
|
+ }
|
|
|
+ message.setReplayTimes(3);
|
|
|
+ message.setDisplayNumber("");
|
|
|
+
|
|
|
+ /*设置平台分配的模板ID*/
|
|
|
+ message.setTemplateId("401045");
|
|
|
+
|
|
|
+ LinkedHashMap<String,String> params = new LinkedHashMap<String,String>();
|
|
|
+ /*设置模板参数*/
|
|
|
+// params.put("{1}","八就二六五四三五一");
|
|
|
+ /*params.put("{2}","您好");
|
|
|
+ params.put("{3}","895621");*/
|
|
|
+ message.setTemplateArgs(params);
|
|
|
+
|
|
|
+ try {
|
|
|
+ VoiceResponseResult result = VoiceSender.httpsSendVoiceNotify(message, accountId, token);
|
|
|
+
|
|
|
+ System.out.println("result = " + result);
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ //Log.e(this.getClass(), " e = " + e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private static TransmissionTemplate genTransmissionTemplate(String content, String title) throws Exception {
|
|
|
TransmissionTemplate template = new TransmissionTemplate();
|
|
|
template.setAppId(appId);
|