From be812198b1c18cf5b79f2cdc69d2f7c3c70eff51 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 20 六月 2023 14:23:43 +0800 Subject: [PATCH] “文件管理“ 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java | 87 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 77 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java index 7e545d4..914d3da 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java @@ -9,10 +9,17 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.smartor.domain.PatArchive; +import com.smartor.domain.PatArchiveReq; +import com.smartor.domain.PatImportInfoVO; import com.smartor.domain.PatUpInfoVO; import com.smartor.service.IPatArchiveService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -25,6 +32,7 @@ * @author smartor * @date 2023-03-04 */ +@Api(description = "鎮h�呮。妗�") @RestController @RequestMapping("/smartor/patarchive") public class PatArchiveController extends BaseController { @@ -34,6 +42,7 @@ /** * 鏌ヨ鎮h�呮。妗堝垪琛� */ + @ApiOperation("鏌ヨ鎮h�呮。妗堝垪琛�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:list')") @GetMapping("/list") public TableDataInfo list(PatArchive patArchive) { @@ -45,6 +54,7 @@ /** * 瀵煎嚭鎮h�呮。妗堝垪琛� */ + @ApiOperation("瀵煎嚭鎮h�呮。妗堝垪琛�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:export')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.EXPORT) @PostMapping("/export") @@ -57,15 +67,18 @@ /** * 鑾峰彇鎮h�呮。妗堣缁嗕俊鎭� */ + @ApiOperation("鑾峰彇鎮h�呮。妗堣缁嗕俊鎭�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:query')") @GetMapping(value = "/{patid}") - public AjaxResult getInfo(@PathVariable("patid") Long patid) { + @ApiImplicitParam(name = "patid", value = "鎮h�卛d") + public AjaxResult getInfo(@PathVariable(name = "patid") Long patid) { return success(patArchiveService.selectPatArchiveByPatid(patid)); } /** * 鏂板鎮h�呮。妗� */ + @ApiOperation("鏂板鎮h�呮。妗�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:add')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.INSERT) @PostMapping @@ -76,6 +89,7 @@ /** * 淇敼鎮h�呮。妗� */ + @ApiOperation("淇敼鎮h�呮。妗�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:edit')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.UPDATE) @PutMapping @@ -86,29 +100,42 @@ /** * 鍒犻櫎鎮h�呮。妗� */ + @ApiOperation("鍒犻櫎鎮h�呮。妗�") @PreAuthorize("@ss.hasPermi('smartor:patarchive:remove')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.DELETE) @DeleteMapping("/{patids}") + @ApiImplicitParam(name = "patids", value = "鎮h�卛d闆嗗悎", dataType = "long", dataTypeClass = Long.class) public AjaxResult remove(@PathVariable Long[] patids) { return toAjax(patArchiveService.deletePatArchiveByPatids(patids)); } /** - * 鎮h�呮枃浠跺鐞� + * 瀵煎叆鎮h�呮枃浠跺鐞� * * @param multipartFile */ + @ApiOperation("瀵煎叆鎮h�呮枃浠跺鐞�") @PostMapping("/importFilehandle") - public AjaxResult importFilehandle(@RequestParam("multipartFile") MultipartFile multipartFile) { + @ApiImplicitParams({@ApiImplicitParam(name = "tags", value = "鏍囩"), @ApiImplicitParam(name = "multipartFile", value = "涓婁紶鏂囦欢")}) + public AjaxResult importFilehandle(@RequestParam("tags") String tags, @RequestParam("multipartFile") MultipartFile multipartFile) { //鑾峰彇褰撳墠鐧婚檰浜� LoginUser loginUser = getLoginUser(); SysUser user = loginUser.getUser(); - String userName = user.getUserName(); - - PatUpInfoVO patUpInfoVO = patArchiveService.importFilehandle(userName, multipartFile); - + PatUpInfoVO patUpInfoVO = patArchiveService.importFilehandle(user, tags, multipartFile); return success(patUpInfoVO); + } + + /** + * 瀵煎叆鎮h�呬俊鎭ā鏉� + * + * @param response + */ + @ApiOperation("鎮h�呬俊鎭鍏ユā鏉�") + @PostMapping("/patImportTemplate") + public void patImportTemplate(HttpServletResponse response) { + ExcelUtil<PatImportInfoVO> util = new ExcelUtil<PatImportInfoVO>(PatImportInfoVO.class); + util.importTemplateExcel(response, "鎮h�呬俊鎭鍏�"); } /** @@ -116,11 +143,51 @@ * * @param patArchiveList */ - @PostMapping("/exportErrPatInfo") - public AjaxResult exportErrPatInfo(@RequestBody List<PatArchive> patArchiveList) { + @ApiOperation("瀵煎嚭鎮h�呴敊璇俊鎭�") + @PostMapping(value = "/exportErrPatInfo") + public void exportErrPatInfo(HttpServletResponse response, @RequestBody List<PatImportInfoVO> patArchiveList) { - return success(patArchiveService.exportErrPatInfo(patArchiveList)); + ExcelUtil<PatImportInfoVO> util = new ExcelUtil<PatImportInfoVO>(PatImportInfoVO.class); + util.exportExcel(response, patArchiveList, "瀵煎嚭鎮h�呴敊璇俊鎭�"); } + /** + * 鏌ヨ鎮h�呭垪琛� + */ + @ApiOperation("鏌ヨ鎮h�呭垪琛�") + @PostMapping("/patInfoByContion") + public TableDataInfo patInfoByCondition(@RequestBody PatArchiveReq patArchive) { + startPage(); + return getDataTable(patArchiveService.patInfoByContion(patArchive)); + } + + +// /** +// * 鎮h�呮爣绛剧鐞� +// */ +// @ApiOperation("鎮h�呮爣绛剧鐞�") +// @PostMapping("/patTagByContion") +// public TableDataInfo patTagByContion(@RequestBody List<Long> tagids) { +// startPage(); +// return getDataTable(patArchiveService.patTagByContion(tagids)); +// } + + + /** + * 瀵煎嚭鎮h�呭垪琛ㄦ牴鎹潯浠� + */ + @ApiOperation("瀵煎嚭鎮h�呭垪琛ㄦ牴鎹潯浠�") + @PostMapping("/exportPatInfo") + public void exportPpatInfo(HttpServletResponse response, @RequestBody PatArchiveReq patArchive) { + startPage(); + List<PatArchive> patArchives = patArchiveService.patInfoByContion(patArchive); + if (!CollectionUtils.isEmpty(patArchives)) { + for (int i = 0; i < patArchives.size(); i++) { + patArchives.get(i).setTag(patArchives.get(i).getTagList().toString()); + } + } + ExcelUtil<PatArchive> util = new ExcelUtil<PatArchive>(PatArchive.class); + util.exportExcel(response, patArchives, "鎮h�呮。妗堟暟鎹�"); + } } -- Gitblit v1.9.3