| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.modules.dnc.entity.DocFile; |
| | |
| | | import org.jeecg.modules.dnc.response.QueryPageResponseResult; |
| | | import org.jeecg.modules.dnc.response.ResponseResult; |
| | | import org.jeecg.modules.dnc.service.IDocInfoService; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.jeecg.modules.dnc.utils.file.FileUtilS; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @AutoLog(value = "文档表-分页查询接口") |
| | | @ApiOperation(value = "文档表-分页查询接口", notes = "文档表-分页查询接口") |
| | | @GetMapping("/find/page/{page}/{size}") |
| | | public QueryPageResponseResult<DocInfo> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, DocInfoQueryRequest docQuery) { |
| | | public Result<?> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, DocInfoQueryRequest docQuery) { |
| | | return docInfoService.findPageList(page, size, docQuery); |
| | | } |
| | | |
| | |
| | | @GetMapping("/preview/{id}") |
| | | public QueryListResponseResult previewDocFile(@PathVariable("id") String id) { |
| | | DocFile docFile = docInfoService.previewDocFile(id); |
| | | if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) |
| | | // || !StrUtil.isEmpty(docFile.getFileSuffix()) |
| | | || !StrUtil.isEmpty(docFile.getFileEncodeName())) |
| | | if(!ValidateUtil.validateString(docFile.getFilePath()) || !ValidateUtil.validateString(docFile.getFileName()) |
| | | // || !ValidateUtil.validateString(docFile.getFileSuffix()) |
| | | || !ValidateUtil.validateString(docFile.getFileEncodeName())) |
| | | return new QueryListResponseResult(CommonCode.FAIL, null); |
| | | String filePath = docFile.getFilePath(); |
| | | String fileEncodeName = docFile.getFileEncodeName(); |
| | |
| | | @GetMapping("/preview/pdf/{id}") |
| | | public ResponseResult previewPdfDocFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) { |
| | | DocFile docFile = docInfoService.previewDocFile(id); |
| | | if(!StrUtil.isEmpty(docFile.getFilePath()) || !StrUtil.isEmpty(docFile.getFileName()) || |
| | | /*!StrUtil.isEmpty(docFile.getFileSuffix()) ||*/ !StrUtil.isEmpty(docFile.getFileEncodeName())) |
| | | if(!ValidateUtil.validateString(docFile.getFilePath()) || !ValidateUtil.validateString(docFile.getFileName()) || |
| | | /*!ValidateUtil.validateString(docFile.getFileSuffix()) ||*/ !ValidateUtil.validateString(docFile.getFileEncodeName())) |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | String fileName; |
| | | if(StrUtil.isEmpty(docFile.getFileSuffix())) { |
| | | if(ValidateUtil.validateString(docFile.getFileSuffix())) { |
| | | fileName = docFile.getFileName() + "." + docFile.getFileSuffix(); |
| | | }else { |
| | | fileName = docFile.getFileName(); |