|
@@ -241,137 +241,6 @@ public class BidIvrController extends BaseController
|
|
|
bidMessageService.insertBidMessage(bidMessage);
|
|
|
}
|
|
|
|
|
|
- // 短信发送接口(专家)
|
|
|
- @PostMapping("/sendSmsExpert")
|
|
|
- public AjaxResult sendSmsExpert(SmsParam smsParam) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
|
|
- String[] param = new String[8];
|
|
|
- param[1] = smsParam.getYear();
|
|
|
- param[2] = smsParam.getMonth();
|
|
|
- param[3] = smsParam.getDay();
|
|
|
- param[4] = smsParam.getHour();
|
|
|
- param[5] = smsParam.getMinute();
|
|
|
- param[6] = smsParam.getPosition();
|
|
|
-
|
|
|
- List<String> list = smsParam.getjNameList();
|
|
|
- List<String> phoneList = smsParam.getPhoneList();
|
|
|
- List<BsExpert> expertList = smsParam.getExpertList();
|
|
|
- SubmitTemplateReq submitTemplateReq = new SubmitTemplateReq();
|
|
|
-
|
|
|
- for (int i = 0; i < expertList.size(); i++) {
|
|
|
- param[0] = expertList.get(i).getjName();
|
|
|
- submitTemplateReq.setApId("gm_bz");
|
|
|
- submitTemplateReq.setEcName("黑龙江省国辰工程项目管理有限责任公司");
|
|
|
- submitTemplateReq.setSecretKey("8Q@@Xmiu6");
|
|
|
- submitTemplateReq.setParams(JSON.toJSONString(param));
|
|
|
- submitTemplateReq.setMobiles(expertList.get(i).getjPhone());
|
|
|
- submitTemplateReq.setAddSerial("");
|
|
|
- submitTemplateReq.setSign("mQiMiDjdG");
|
|
|
- submitTemplateReq.setTemplateId("278bcc53103241acac4b0f787a31c275");
|
|
|
- StringBuffer stringBuffer = new StringBuffer();
|
|
|
- stringBuffer.append(submitTemplateReq.getEcName());
|
|
|
- stringBuffer.append(submitTemplateReq.getApId());
|
|
|
- stringBuffer.append(submitTemplateReq.getSecretKey());
|
|
|
- stringBuffer.append(submitTemplateReq.getTemplateId());
|
|
|
- stringBuffer.append(submitTemplateReq.getMobiles());
|
|
|
- stringBuffer.append(submitTemplateReq.getParams());
|
|
|
- stringBuffer.append(submitTemplateReq.getSign());
|
|
|
- stringBuffer.append(submitTemplateReq.getAddSerial());
|
|
|
- submitTemplateReq.setMac(MD5Utils.md5Hex(stringBuffer.toString().getBytes("UTF-8")).toLowerCase());
|
|
|
- String reqText = JSON.toJSONString(submitTemplateReq);
|
|
|
- String encode = Base64.encodeBase64String(reqText.getBytes());
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
- map.put("encode",encode);
|
|
|
-
|
|
|
- // 向远程地址发送短信发送请求
|
|
|
- try {
|
|
|
- URL url = new URL("http://112.33.46.17:37891/sms/tmpsubmit");
|
|
|
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
- conn.setRequestMethod("POST");
|
|
|
- conn.setDoOutput(true);
|
|
|
- String postParams = encode;
|
|
|
- byte[] outputInBytes = postParams.getBytes("UTF-8");
|
|
|
- OutputStream os = conn.getOutputStream();
|
|
|
- os.write(outputInBytes);
|
|
|
- os.close();
|
|
|
- int responseCode = conn.getResponseCode();
|
|
|
- System.out.println("POST Response Code :: " + responseCode);
|
|
|
- if (responseCode == HttpURLConnection.HTTP_OK) {
|
|
|
- // 处理服务器响应
|
|
|
- System.out.println("POST request succeeded");
|
|
|
- } else {
|
|
|
- System.out.println("POST request failed");
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- return toAjax(expertList.size());
|
|
|
- }
|
|
|
-
|
|
|
- // 短信发送接口 (供应商)
|
|
|
- @PostMapping("/sendSmsSupplier")
|
|
|
- public AjaxResult sendSmsSupplier(@RequestBody SmsParam smsParam) throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
|
|
- String[] param = new String[6];
|
|
|
- param[0] = smsParam.getCompany();
|
|
|
- param[1] = smsParam.getYear();
|
|
|
- param[2] = smsParam.getMonth();
|
|
|
- param[3] = smsParam.getDay();
|
|
|
- param[4] = smsParam.getMaterialName();
|
|
|
-
|
|
|
- List<String> phoneList = smsParam.getPhoneList();
|
|
|
- String mobiles = StringUtils.join(phoneList,",");
|
|
|
-
|
|
|
- SubmitTemplateReq submitTemplateReq = new SubmitTemplateReq();
|
|
|
- submitTemplateReq.setApId("gm_bz");
|
|
|
- submitTemplateReq.setEcName("黑龙江省国辰工程项目管理有限责任公司");
|
|
|
- submitTemplateReq.setSecretKey("8Q@@Xmiu6");
|
|
|
- submitTemplateReq.setParams(JSON.toJSONString(param));
|
|
|
- submitTemplateReq.setMobiles(mobiles);
|
|
|
- submitTemplateReq.setAddSerial("");
|
|
|
- submitTemplateReq.setSign("mQiMiDjdG");
|
|
|
- submitTemplateReq.setTemplateId("9ec1d4578ad6451ebec1486f229c92c4");
|
|
|
- StringBuffer stringBuffer = new StringBuffer();
|
|
|
- stringBuffer.append(submitTemplateReq.getEcName());
|
|
|
- stringBuffer.append(submitTemplateReq.getApId());
|
|
|
- stringBuffer.append(submitTemplateReq.getSecretKey());
|
|
|
- stringBuffer.append(submitTemplateReq.getTemplateId());
|
|
|
- stringBuffer.append(submitTemplateReq.getMobiles());
|
|
|
- stringBuffer.append(submitTemplateReq.getParams());
|
|
|
- stringBuffer.append(submitTemplateReq.getSign());
|
|
|
- stringBuffer.append(submitTemplateReq.getAddSerial());
|
|
|
- submitTemplateReq.setMac(MD5Utils.md5Hex(stringBuffer.toString().getBytes("UTF-8")).toLowerCase());
|
|
|
- String reqText = JSON.toJSONString(submitTemplateReq);
|
|
|
- String encode = Base64.encodeBase64String(reqText.getBytes());
|
|
|
-
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
- map.put("encode",encode);
|
|
|
-
|
|
|
- // 向远程地址发送短信发送请求
|
|
|
- try {
|
|
|
- URL url = new URL("http://112.33.46.17:37891/sms/tmpsubmit");
|
|
|
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
- conn.setRequestMethod("POST");
|
|
|
- conn.setDoOutput(true);
|
|
|
- String postParams = encode;
|
|
|
- byte[] outputInBytes = postParams.getBytes("UTF-8");
|
|
|
- OutputStream os = conn.getOutputStream();
|
|
|
- os.write(outputInBytes);
|
|
|
- os.close();
|
|
|
- int responseCode = conn.getResponseCode();
|
|
|
- System.out.println("POST Response Code :: " + responseCode);
|
|
|
- if (responseCode == HttpURLConnection.HTTP_OK) {
|
|
|
- // 处理服务器响应
|
|
|
- System.out.println("POST request succeeded");
|
|
|
- } else {
|
|
|
- System.out.println("POST request failed");
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- return toAjax(phoneList.size());
|
|
|
- }
|
|
|
-
|
|
|
// 短信发送方法
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
DyvmsUtil dyvmsUtil = new DyvmsUtil();
|