|  |  |  | 
|---|
|  |  |  | public R insertFile(@RequestParam("planId") String planId,@RequestParam MultipartFile file){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | InputStream inputStream = file.getInputStream(); | 
|---|
|  |  |  | // 获取文件的内容类型 | 
|---|
|  |  |  | String contentType = file.getContentType(); | 
|---|
|  |  |  | String suffix = getFileSuffix(file.getOriginalFilename()); | 
|---|
|  |  |  | //            String url = ossService.upload(inputStream, suffix); | 
|---|
|  |  |  | String url = "http://tjdt.oss-cn-hangzhou.aliyuncs.com/"+file.getOriginalFilename(); | 
|---|
|  |  |  | String url = ossService.upload(inputStream, suffix,contentType); | 
|---|
|  |  |  | //            String url = "http://tjdt.oss-cn-hangzhou.aliyuncs.com/"+file.getOriginalFilename(); | 
|---|
|  |  |  | String[] names = url.split("com/"); | 
|---|
|  |  |  | String name= names[1]; | 
|---|
|  |  |  | String[] split = planId.split("-"); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/plan/download/file/auth") | 
|---|
|  |  |  | //    @ManagerAuth | 
|---|
|  |  |  | public void downloadFile(@RequestParam("downloadUrl") String downloadUrl,HttpServletResponse response){ | 
|---|
|  |  |  | public R downloadFile(@RequestParam("downloadUrl") String downloadUrl,HttpServletResponse response){ | 
|---|
|  |  |  | //        System.out.println("---开始---"); | 
|---|
|  |  |  | //        MultipartFile | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | 
|---|
|  |  |  | String name= names[1]; | 
|---|
|  |  |  | //            ResponseEntity<Resource> resourceResponseEntity = FileSaveExampleUtil.downloadFile(downloadUrl, response); | 
|---|
|  |  |  | //            return R.ok(resourceResponseEntity); | 
|---|
|  |  |  | ossService.download(name); | 
|---|
|  |  |  | String download = ossService.download(name); | 
|---|
|  |  |  | return R.ok().add(download); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Plan plan : page.getRecords()){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", plan.getId()); | 
|---|
|  |  |  | map.put("value", plan.getName()); | 
|---|
|  |  |  | map.put("value", plan.getName()+"---"+plan.getId()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|