前端处理
let file = new FormData()
file.append('ossFilePath', '/lessee1/testToHtml2.docx')
file.append('type', '2html')
toHtml(file).then(res => {
export function toHtml(file) {
return request({
url: '/iot/api/public/wordsToHTML',
method: 'post',
data: file,
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}
})
}
后台接口
public static final String bucketName = "hyiotoss"; @RequestMapping(path = "/wordsToHTML", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseDTO wordsToHTML(@RequestParam(name="file",required = false) MultipartFile multipartFile, @RequestParam(name="ossFilePath", required = false) String ossFilePath, @RequestParam(name="type") String type, HttpServletResponse response) throws IOException { JSONObject jsonObject = new JSONObject();