zbj//1.资源管理 修改
This commit is contained in:
@@ -72,4 +72,9 @@ public class Resinformation {
|
|||||||
@TableField(value = "type")
|
@TableField(value = "type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "filename")
|
||||||
|
private String fileName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ public class ResourceAdministrationController extends BaseController {
|
|||||||
public HttpResult<Boolean> uploadFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile,
|
public HttpResult<Boolean> uploadFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile,
|
||||||
@ApiParam(value = "资源名称", required = true) String name,
|
@ApiParam(value = "资源名称", required = true) String name,
|
||||||
@ApiParam(value = "资源类型", required = true) String type,
|
@ApiParam(value = "资源类型", required = true) String type,
|
||||||
@ApiParam(value = "资源描述", required = false) String describe,
|
@ApiParam(value = "资源描述", required = true) String description,
|
||||||
@ApiParam(value = "系统类型Guid", required = true) String systemType) {
|
@ApiParam(value = "系统类型Guid", required = false) String systemType) {
|
||||||
String methodDescribe = getMethodDescribe("uploadFile");
|
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);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +58,10 @@ public class ResourceAdministrationController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryData")
|
@PostMapping("/queryData")
|
||||||
@ApiOperation("查询数据")
|
@ApiOperation("查询数据")
|
||||||
@ApiImplicitParam(name = "baseParam", value = "查询数据", required = true)
|
@ApiImplicitParam(name = "resinformation", value = "查询数据", required = true)
|
||||||
public HttpResult<List<Resinformation>> queryData(@RequestBody @Validated BaseParam baseParam) {
|
public HttpResult<List<Resinformation>> queryData(@RequestBody Resinformation resinformation) {
|
||||||
String methodDescribe = getMethodDescribe("queryData");
|
String methodDescribe = getMethodDescribe("queryData");
|
||||||
List<Resinformation> result = iResourceAdministrationService.queryData(baseParam);
|
List<Resinformation> result = iResourceAdministrationService.queryData(resinformation);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,14 +71,14 @@ public class ResourceAdministrationController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/updateFile")
|
@PostMapping("/updateFile")
|
||||||
@ApiOperation("修改资源")
|
@ApiOperation("修改资源")
|
||||||
public HttpResult<Boolean> updateFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile,
|
public HttpResult<Boolean> updateFile(@ApiParam(value = "文件", required = false) MultipartFile multipartFile,
|
||||||
@ApiParam(value = "id", required = true) String id,
|
@ApiParam(value = "id", required = true) String id,
|
||||||
@ApiParam(value = "资源名称", required = true) String name,
|
@ApiParam(value = "资源名称", required = true) String name,
|
||||||
@ApiParam(value = "资源类型", required = true) String type,
|
@ApiParam(value = "资源类型", required = true) String type,
|
||||||
@ApiParam(value = "资源描述", required = false) String describe,
|
@ApiParam(value = "资源描述", required = true) String description,
|
||||||
@ApiParam(value = "系统类型Guid", required = true) String systemType) {
|
@ApiParam(value = "系统类型Guid", required = false) String systemType) {
|
||||||
String methodDescribe = getMethodDescribe("updateFile");
|
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);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IResourceAdministrationService extends IService<Resinformation> {
|
public interface IResourceAdministrationService extends IService<Resinformation> {
|
||||||
|
|
||||||
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<Resinformation> queryData(BaseParam baseParam);
|
List<Resinformation> 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);
|
Boolean deleteFile(String id);
|
||||||
|
|
||||||
|
|||||||
@@ -45,15 +45,13 @@ public class ResourceAdministrationServiceImpl extends ServiceImpl<ResourceAdmin
|
|||||||
//private final GeneralInfo generalInfo;
|
//private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean uploadFile(MultipartFile multipartFile, String name, String type, String describe, String systemType) {
|
public Boolean uploadFile(MultipartFile multipartFile, String name, String type, String description, String systemType) {
|
||||||
//通过封装好的文件工具类来传入文件和文件夹名称来获取文件路径
|
//通过封装好的文件工具类来传入文件和文件夹名称来获取文件路径
|
||||||
String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION);
|
String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION);
|
||||||
//创建对象
|
//创建对象
|
||||||
Resinformation resinformation = new Resinformation();
|
Resinformation resinformation = new Resinformation();
|
||||||
resinformation.setName(name);
|
resinformation.setName(name);
|
||||||
if (StringUtils.isNotBlank(describe)) {
|
resinformation.setDescription(description);
|
||||||
resinformation.setDescription(describe);
|
|
||||||
}
|
|
||||||
resinformation.setUrl(url);
|
resinformation.setUrl(url);
|
||||||
//获取用户id
|
//获取用户id
|
||||||
String userIndex = RequestUtil.getUserIndex();
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
@@ -61,41 +59,64 @@ public class ResourceAdministrationServiceImpl extends ServiceImpl<ResourceAdmin
|
|||||||
resinformation.setUpdateUser(userIndex);
|
resinformation.setUpdateUser(userIndex);
|
||||||
resinformation.setUpdateTime(LocalDateTime.now());
|
resinformation.setUpdateTime(LocalDateTime.now());
|
||||||
resinformation.setState(1);
|
resinformation.setState(1);
|
||||||
resinformation.setSystemType(systemType);
|
resinformation.setFileName(multipartFile.getOriginalFilename());
|
||||||
|
if (StringUtils.isNotBlank(systemType)) {
|
||||||
|
resinformation.setSystemType(systemType);
|
||||||
|
}
|
||||||
resinformation.setType(type);
|
resinformation.setType(type);
|
||||||
return this.save(resinformation);
|
return this.save(resinformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Resinformation> queryData(BaseParam baseParam) {
|
public List<Resinformation> queryData(Resinformation resinformation) {
|
||||||
if (!StringUtils.isBlank(baseParam.getSearchValue())) {
|
|
||||||
|
if (StringUtils.isNotBlank(resinformation.getType()) && StringUtils.isNotBlank(resinformation.getSystemType())) {
|
||||||
LambdaQueryWrapper<Resinformation> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Resinformation> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Resinformation::getType, baseParam.getSearchValue());
|
//type
|
||||||
return resourceAdministrationMapper.selectPage(new Page<>(baseParam.getPageNum(), baseParam.getPageSize()), wrapper).getRecords();
|
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<Resinformation> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
//type
|
||||||
|
wrapper.eq(Resinformation::getType, resinformation.getType());
|
||||||
|
return resourceAdministrationMapper.selectList(wrapper);
|
||||||
} else {
|
} else {
|
||||||
return this.page(new Page<>(baseParam.getPageNum(), baseParam.getPageSize())).getRecords();
|
LambdaQueryWrapper<Resinformation> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
//sysType
|
||||||
|
wrapper.eq(Resinformation::getSystemType, resinformation.getSystemType());
|
||||||
|
return resourceAdministrationMapper.selectList(wrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
Resinformation resinformation = resourceAdministrationMapper.selectById(id);
|
||||||
//删除文件
|
if (null != multipartFile && !multipartFile.isEmpty()) {
|
||||||
fileStorageUtil.deleteFile(resinformation.getUrl());
|
//删除文件
|
||||||
//获取路径
|
fileStorageUtil.deleteFile(resinformation.getUrl());
|
||||||
String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION);
|
//获取路径
|
||||||
resinformation.setUrl(url);
|
String url = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEADMINISTRATION);
|
||||||
resinformation.setName(name);
|
resinformation.setUrl(url);
|
||||||
if (StringUtils.isNotBlank(describe)) {
|
resinformation.setFileName(multipartFile.getOriginalFilename());
|
||||||
resinformation.setDescription(describe);
|
|
||||||
}
|
}
|
||||||
|
resinformation.setName(name);
|
||||||
|
resinformation.setDescription(description);
|
||||||
//获取用户id
|
//获取用户id
|
||||||
//String userIndex = RequestUtil.getUserIndex();
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
String userIndex = "123456";
|
//String userIndex = "123456";
|
||||||
resinformation.setUpdateUser(userIndex);
|
resinformation.setUpdateUser(userIndex);
|
||||||
resinformation.setUpdateTime(LocalDateTime.now());
|
resinformation.setUpdateTime(LocalDateTime.now());
|
||||||
resinformation.setState(1);
|
resinformation.setState(1);
|
||||||
resinformation.setSystemType(systemType);
|
if (StringUtils.isNotBlank(systemType)) {
|
||||||
|
resinformation.setSystemType(systemType);
|
||||||
|
}
|
||||||
resinformation.setType(type);
|
resinformation.setType(type);
|
||||||
int i = resourceAdministrationMapper.updateById(resinformation);
|
int i = resourceAdministrationMapper.updateById(resinformation);
|
||||||
return i > 0;
|
return i > 0;
|
||||||
@@ -112,10 +133,10 @@ public class ResourceAdministrationServiceImpl extends ServiceImpl<ResourceAdmin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadFile(String id,HttpServletResponse response) throws IOException {
|
public void downloadFile(String id, HttpServletResponse response) throws IOException {
|
||||||
Resinformation resinformation = resourceAdministrationMapper.selectById(id);
|
Resinformation resinformation = resourceAdministrationMapper.selectById(id);
|
||||||
//下载文件
|
//下载文件
|
||||||
fileStorageUtil.downloadStream(response,resinformation.getUrl());
|
fileStorageUtil.downloadStream(response, resinformation.getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user