- 上传的临时素材为什么中文文件名乱码?
@Override public JSONObject updloadTemporaryPicture(MultipartFile file, String fileName, String type) { RestTemplate restTemplate = new RestTemplate(); // 获取请求url WxParam wxParam = null; String url = ""; url = url.replace("{ACCESS_TOKEN}",token).replace("TYPE",type); HttpHeaders headers = new HttpHeaders(); MediaType mediaType = MediaType.parseMediaType("multipart/form-data"); headers.setContentType(mediaType); // headers.setContentDispositionFormData("media",file.getName()); MultiValueMap<String,Object> param = new LinkedMultiValueMap<>(); File file1 = new File(file.getOriginalFilename()); try { FileUtils.copyInputStreamToFile(file.getInputStream(),file1); } catch (IOException e) { e.printStackTrace(); } FileSystemResource resource = new FileSystemResource(file1); param.add("file",resource); HttpEntity<MultiValueMap<String,Object>> formEntity = new HttpEntity<>(param, headers); ResponseEntity<String> data = restTemplate.postForEntity(url, formEntity, String.class); JSONObject jsonObject = JSONObject.parseObject(data.getBody()); if (file1.exists()){ file1.delete(); } LogUtil.info(getClass(),"上传企业微信临时文件updloadTemporaryPictureFile返回信息:" + jsonObject); return jsonObject; }
2022-09-26 - 利用公众号发送模板消息中设置内容字体颜色,为啥会出现这样的状况?
[图片]
2022-05-18