File file = new File(tm + ".jpg");//生成
ImageIO.write(resizeImageHintPng, "png", file);
FileSystemResource resource = new FileSystemResource(file);
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("appId", appid);
map.add("timeStamp", tm);
map.add("authSign", authSign);
map.add("image", resource);
RestTemplate restTemplate = new RestTemplate();
// 发送请求,设置请求返回数据格式为String(去除上面方法中使用的httpEntity)
Integer sid=savePixelImage(file);//存储转换后的图片到服务器上
ResponseEntity<Object> responseEntity = restTemplate.postForEntity(
posturl, map, Object.class);
file.delete();
System.out.println(responseEntity.getStatusCode()+" body:"+responseEntity.getBody());