使用jdk1.8+java8编写的代码,使用springboot架构,在内网访问第三方接口报错
public Object UpdNotice(HttpServletRequest request) {
Msg msg = new Msg();
String apiURL = "https://****.****.****.****";
String tel = request.getParameter("tel");
String title = request.getParameter("title");
String text = request.getParameter("text");
String pid = request.getParameter("pid");
String mess = title + text;
String appid = "ynapp";
VsUser a = vsUserService.GetAcctoken(appid);
String token = a.getAcctoken();
long tim = System.currentTimeMillis();
String time = String.valueOf(tim);
String md= getMD5(tim);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
List<Map<String,String>> table =new ArrayList<>();
Map<String,String> map =new HashMap<>();
map.put("message",mess);
map.put("phone",tel);
table.add(map);
System.out.println(table);
Map<String, Object> requestParam = new HashMap<>();
requestParam.put("message_list", table);
requestParam.put("sign", md);
requestParam.put("timestamp", time);
requestParam.put("user_id", "53");
headers.set("Authorization", "Bearer " + token);
HttpEntity<Map<String, Object>> request1 = new HttpEntity<Map<String, Object>>(requestParam, headers);
ResponseEntity<String> entity = restTemplate.postForEntity(apiURL, request1, String.class);
String body = entity.getBody();
return body;
}
我的解答思路和尝试过的方法
我想要达到的结果