| | |
| | | public CommonResult<List<Map<String,Object>>> available(){ return success(service.seals(true)); } |
| | | @PostMapping("/upload") @PreAuthorize("@ss.hasPermission('mes:pd-seal:manage')") |
| | | public CommonResult<Long> upload(@RequestParam String name,@RequestParam MultipartFile file) throws Exception { return success(service.upload(name,file,getLoginUserId())); } |
| | | @PutMapping("/update") @PreAuthorize("@ss.hasPermission('mes:pd-seal:manage')") |
| | | public CommonResult<Boolean> update(@RequestParam long id,@RequestParam String name,@RequestParam(required=false) MultipartFile file) throws Exception { service.update(id,name,file); return success(true); } |
| | | @DeleteMapping("/delete") @PreAuthorize("@ss.hasPermission('mes:pd-seal:manage')") |
| | | public CommonResult<Boolean> delete(@RequestParam long id){ service.delete(id); return success(true); } |
| | | @PutMapping("/enabled") @PreAuthorize("@ss.hasPermission('mes:pd-seal:manage')") |
| | | public CommonResult<Boolean> enabled(@RequestParam long id,@RequestParam boolean enabled){service.setEnabled(id,enabled);return success(true);} |
| | | public record ApplyReq(Long projectId, Long sealId, String reason) {} |
| | |
| | | } |
| | | @GetMapping("/applications") @PreAuthorize("@ss.hasPermission('mes:pd-project:export')") |
| | | public CommonResult<List<Map<String,Object>>> applications(@RequestParam(required=false) Long projectId){ return success(service.applications(getLoginUserId(),projectId)); } |
| | | /** 审批详情使用:登录即可访问,可见范围在 Service 内按申请人/审批人/管理权限校验 */ |
| | | @GetMapping("/application") |
| | | public CommonResult<Map<String,Object>> application(@RequestParam long id){ return success(service.applicationDetail(id,getLoginUserId())); } |
| | | @GetMapping("/application/image") |
| | | public void applicationImage(@RequestParam long id,HttpServletResponse response) throws java.io.IOException { |
| | | byte[] image=service.applicationImage(id,getLoginUserId()); |
| | | response.setContentType("image/png"); |
| | | response.setHeader("Cache-Control","no-store, private"); |
| | | response.setHeader("X-Content-Type-Options","nosniff"); |
| | | response.getOutputStream().write(image); |
| | | } |
| | | @GetMapping("/download") @PreAuthorize("@ss.hasPermission('mes:pd-project:export')") |
| | | public void download(@RequestParam long id,HttpServletResponse response) throws Exception {byte[] bytes=service.download(id,getLoginUserId()); response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); response.setHeader("Content-Disposition","attachment; filename=tracking.docx"); response.getOutputStream().write(bytes);} |
| | | } |