| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/add/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "添加规划申请单") |
| | | @Transactional |
| | | public R add(@RequestParam Map<String, Object> param) { |
| | | // pre |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/update/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "更新规划申请单") |
| | | @Transactional |
| | | public R update(@RequestParam Map<String, Object> param){ |
| | | // String planNeed = null; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/delete/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "删除规划申请单") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | planService.deleteById(id); |
| | |
| | | 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("-"); |
| | |
| | | return ""; |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/delete/file/auth") |
| | | // @ManagerAuth |
| | | public R deleteFile(@RequestParam("planId") String planId,@RequestParam MultipartFile file){ |
| | | planId="上传文件-20"; |
| | | String[] split = planId.split("-"); |
| | | int id = Integer.parseInt(split[1]); |
| | | System.out.println("---开始---"); |
| | | String savePath = "D:/crm/plan/file/"+id+"/"+file.getName(); // 指定保存文件的路径 |
| | | try{ |
| | | FileSaveExampleUtil.deleteFilesInDirectory(savePath); |
| | | }catch (Exception e){ |
| | | return R.error(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | // @RequestMapping(value = "/plan/delete/file/auth") |
| | | //// @ManagerAuth |
| | | // public R deleteFile(@RequestParam("planId") String planId,@RequestParam MultipartFile file){ |
| | | // planId="上传文件-20"; |
| | | // String[] split = planId.split("-"); |
| | | // int id = Integer.parseInt(split[1]); |
| | | // System.out.println("---开始---"); |
| | | // String savePath = "D:/crm/plan/file/"+id+"/"+file.getName(); // 指定保存文件的路径 |
| | | // try{ |
| | | // FileSaveExampleUtil.deleteFilesInDirectory(savePath); |
| | | // }catch (Exception e){ |
| | | // return R.error(); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | |
| | | @RequestMapping(value = "/plan/view/file/auth") |
| | | // @ManagerAuth |
| | |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/plan/approval/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "审批申请单") |
| | | public R approval(@RequestParam Long planId, |
| | | @RequestParam(required = false) Long plannerId){ |
| | | Plan plan = planService.selectById(planId); |
| | |
| | | for (Plan plan : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", plan.getId()); |
| | | // map.put("value", plan.getName()+"---"+plan.getId()); |
| | | map.put("value", plan.getName()); |
| | | result.add(map); |
| | | } |