From a844123e43f715f38e4eb68633e34e97dcd40c98 Mon Sep 17 00:00:00 2001 From: zhangbaojian <1065122561@qq.com> Date: Thu, 20 Apr 2023 11:35:38 +0800 Subject: [PATCH] =?UTF-8?q?zbj//1.=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../njcn/system/pojo/po/Resinformation.java | 5 ++ .../ResourceAdministrationController.java | 20 +++--- .../IResourceAdministrationService.java | 6 +- .../ResourceAdministrationServiceImpl.java | 69 ++++++++++++------- 4 files changed, 63 insertions(+), 37 deletions(-) diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/Resinformation.java b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/Resinformation.java index 03fb4c56b..70c8dde7d 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/Resinformation.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/Resinformation.java @@ -72,4 +72,9 @@ public class Resinformation { @TableField(value = "type") private String type; + /** + * 资源类型 + */ + @TableField(value = "filename") + private String fileName; } diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ResourceAdministrationController.java b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ResourceAdministrationController.java index 9d93c0272..c40213a06 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ResourceAdministrationController.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ResourceAdministrationController.java @@ -45,10 +45,10 @@ public class ResourceAdministrationController extends BaseController { public HttpResult uploadFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile, @ApiParam(value = "资源名称", required = true) String name, @ApiParam(value = "资源类型", required = true) String type, - @ApiParam(value = "资源描述", required = false) String describe, - @ApiParam(value = "系统类型Guid", required = true) String systemType) { + @ApiParam(value = "资源描述", required = true) String description, + @ApiParam(value = "系统类型Guid", required = false) String systemType) { String methodDescribe = getMethodDescribe("uploadFile"); - Boolean flag = iResourceAdministrationService.uploadFile(multipartFile, name, type, describe, systemType); + Boolean flag = iResourceAdministrationService.uploadFile(multipartFile, name, type, description, systemType); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); } @@ -58,10 +58,10 @@ public class ResourceAdministrationController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/queryData") @ApiOperation("查询数据") - @ApiImplicitParam(name = "baseParam", value = "查询数据", required = true) - public HttpResult> queryData(@RequestBody @Validated BaseParam baseParam) { + @ApiImplicitParam(name = "resinformation", value = "查询数据", required = true) + public HttpResult> queryData(@RequestBody Resinformation resinformation) { String methodDescribe = getMethodDescribe("queryData"); - List result = iResourceAdministrationService.queryData(baseParam); + List result = iResourceAdministrationService.queryData(resinformation); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } @@ -71,14 +71,14 @@ public class ResourceAdministrationController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/updateFile") @ApiOperation("修改资源") - public HttpResult updateFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile, + public HttpResult updateFile(@ApiParam(value = "文件", required = false) MultipartFile multipartFile, @ApiParam(value = "id", required = true) String id, @ApiParam(value = "资源名称", required = true) String name, @ApiParam(value = "资源类型", required = true) String type, - @ApiParam(value = "资源描述", required = false) String describe, - @ApiParam(value = "系统类型Guid", required = true) String systemType) { + @ApiParam(value = "资源描述", required = true) String description, + @ApiParam(value = "系统类型Guid", required = false) String systemType) { String methodDescribe = getMethodDescribe("updateFile"); - Boolean flag = iResourceAdministrationService.updateFile(multipartFile, id, name, type, describe, systemType); + Boolean flag = iResourceAdministrationService.updateFile(multipartFile, id, name, type, description, systemType); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); } diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/IResourceAdministrationService.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/IResourceAdministrationService.java index 4c0a75c7d..19a01cb6e 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/service/IResourceAdministrationService.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/IResourceAdministrationService.java @@ -18,11 +18,11 @@ import java.util.List; */ public interface IResourceAdministrationService extends IService { - Boolean uploadFile(MultipartFile multipartFile, String name, String type, String describe, String systemType); + Boolean uploadFile(MultipartFile multipartFile, String name, String type, String description, String systemType); - List queryData(BaseParam baseParam); + List queryData(Resinformation resinformation); - Boolean updateFile(MultipartFile multipartFile, String id, String name, String type, String describe, String systemType); + Boolean updateFile(MultipartFile multipartFile, String id, String name, String type, String description, String systemType); Boolean deleteFile(String id); diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/ResourceAdministrationServiceImpl.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/ResourceAdministrationServiceImpl.java index 6ef63e261..c65821163 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/ResourceAdministrationServiceImpl.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/ResourceAdministrationServiceImpl.java @@ -45,15 +45,13 @@ public class ResourceAdministrationServiceImpl extends ServiceImpl queryData(BaseParam baseParam) { - if (!StringUtils.isBlank(baseParam.getSearchValue())) { + public List queryData(Resinformation resinformation) { + + if (StringUtils.isNotBlank(resinformation.getType()) && StringUtils.isNotBlank(resinformation.getSystemType())) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Resinformation::getType, baseParam.getSearchValue()); - return resourceAdministrationMapper.selectPage(new Page<>(baseParam.getPageNum(), baseParam.getPageSize()), wrapper).getRecords(); + //type + wrapper.eq(Resinformation::getType, resinformation.getType()); + //sysType + wrapper.eq(Resinformation::getSystemType, resinformation.getSystemType()); + return resourceAdministrationMapper.selectList(wrapper); + + } else if (StringUtils.isBlank(resinformation.getType()) && StringUtils.isBlank(resinformation.getSystemType())) { + + return this.list(); + + } else if (StringUtils.isNotBlank(resinformation.getType()) && StringUtils.isBlank(resinformation.getSystemType())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + //type + wrapper.eq(Resinformation::getType, resinformation.getType()); + return resourceAdministrationMapper.selectList(wrapper); } else { - return this.page(new Page<>(baseParam.getPageNum(), baseParam.getPageSize())).getRecords(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + //sysType + wrapper.eq(Resinformation::getSystemType, resinformation.getSystemType()); + return resourceAdministrationMapper.selectList(wrapper); } } @Override - public Boolean updateFile(MultipartFile multipartFile, String id, String name, String type, String describe, String systemType) { + public Boolean updateFile(MultipartFile multipartFile, String id, String name, String type, String description, String systemType) { Resinformation resinformation = resourceAdministrationMapper.selectById(id); - //删除文件 - fileStorageUtil.deleteFile(resinformation.getUrl()); - //获取路径 - String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION); - resinformation.setUrl(url); - resinformation.setName(name); - if (StringUtils.isNotBlank(describe)) { - resinformation.setDescription(describe); + if (null != multipartFile && !multipartFile.isEmpty()) { + //删除文件 + fileStorageUtil.deleteFile(resinformation.getUrl()); + //获取路径 + String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION); + resinformation.setUrl(url); + resinformation.setFileName(multipartFile.getOriginalFilename()); } + resinformation.setName(name); + resinformation.setDescription(description); //获取用户id - //String userIndex = RequestUtil.getUserIndex(); - String userIndex = "123456"; + String userIndex = RequestUtil.getUserIndex(); + //String userIndex = "123456"; resinformation.setUpdateUser(userIndex); resinformation.setUpdateTime(LocalDateTime.now()); resinformation.setState(1); - resinformation.setSystemType(systemType); + if (StringUtils.isNotBlank(systemType)) { + resinformation.setSystemType(systemType); + } resinformation.setType(type); int i = resourceAdministrationMapper.updateById(resinformation); return i > 0; @@ -112,10 +133,10 @@ public class ResourceAdministrationServiceImpl extends ServiceImpl