get请求:data为参数,但当数据量大时,会报404
传的快,但是参数有要求
RestTemplate restTemplate = new RestTemplate();
restTemplate.postForObject("http://192.168.3.49:8081/Page/Home/OEE/OEE.ashx?operatetype=InsertEMEquipmentOEE&data={data}", null, String.class, data);
post请求
参数无要求
String url = "http://192.168.3.49:8081/Page/Home/OEE/OEE.ashx";
RestTemplate client = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<String, Object>();
// 参数
params.add("operatetype", "InsertEMEquipmentOEE");
params.add("data", data);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new
HttpEntity<MultiValueMap<String, Object>>(params, headers);
//执行HTTP请求
ResponseEntity<String> response = client.exchange(url, HttpMethod.POST, requestEntity,
String.class);
spring boot定时任务
在程序入口写上@EnableScheduling
在需要定时任务方法上 @Scheduled(fixedRate = 10000) fixedRate 是时间(毫秒)