装置文件夹新建删除功能
This commit is contained in:
@@ -88,4 +88,38 @@ public class DeviceFtpController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/createFolder")
|
||||||
|
@ApiOperation("创建文件")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||||
|
@ApiImplicitParam(name = "path", value = "文件路径", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<String> createFolder(@RequestParam("nDid") String nDid, @RequestParam("path") String path){
|
||||||
|
String methodDescribe = getMethodDescribe("createFolder");
|
||||||
|
boolean result = deviceFtpService.createFile(nDid,path);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/deleteFolder")
|
||||||
|
@ApiOperation("删除文件")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||||
|
@ApiImplicitParam(name = "path", value = "文件路径", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<String> deleteFolder(@RequestParam("nDid") String nDid, @RequestParam("path") String path){
|
||||||
|
String methodDescribe = getMethodDescribe("deleteFolder");
|
||||||
|
boolean result = deviceFtpService.deleteFile(nDid,path);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,9 @@ public interface DeviceFtpService {
|
|||||||
List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type);
|
List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type);
|
||||||
|
|
||||||
String downloadFile(String nDid, String name, Integer size, String fileCheck);
|
String downloadFile(String nDid, String name, Integer size, String fileCheck);
|
||||||
|
|
||||||
|
boolean createFile(String nDid, String path);
|
||||||
|
|
||||||
|
boolean deleteFile(String nDid, String path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
}
|
}
|
||||||
Object object = redisUtil.getObjectByKey("downloadFilePath:"+name);
|
Object object = redisUtil.getObjectByKey("downloadFilePath:"+name);
|
||||||
if (Objects.nonNull(object)) {
|
if (Objects.nonNull(object)) {
|
||||||
result = fileStorageUtil.getFileUrl((String) object);
|
result = (String) object;
|
||||||
redisUtil.delete("downloadFilePath:"+name);
|
redisUtil.delete("downloadFilePath:"+name);
|
||||||
redisUtil.delete("fileCheck"+name);
|
redisUtil.delete("fileCheck"+name);
|
||||||
redisUtil.delete("fileDowning");
|
redisUtil.delete("fileDowning");
|
||||||
@@ -121,6 +121,40 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createFile(String nDid, String path) {
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
askDeviceDataFeignClient.createFolder(nDid,path);
|
||||||
|
Thread.sleep(3000);
|
||||||
|
String key = "createDir"+ nDid;
|
||||||
|
Integer value = Integer.parseInt(redisUtil.getObjectByKey(key).toString());
|
||||||
|
if (Objects.equals(value,200)) {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteFile(String nDid, String path) {
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
askDeviceDataFeignClient.deleteFolder(nDid,path);
|
||||||
|
Thread.sleep(3000);
|
||||||
|
String key = "deleteDir"+ nDid;
|
||||||
|
Integer value = Integer.parseInt(redisUtil.getObjectByKey(key).toString());
|
||||||
|
if (Objects.equals(value,200)) {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void processObject(List<MakeUpVo> result, Object object, String type) {
|
private void processObject(List<MakeUpVo> result, Object object, String type) {
|
||||||
if ("dir".equals(type)) {
|
if ("dir".equals(type)) {
|
||||||
List<FileDto.DirInfo> projectInfoList = channelObjectUtil.objectToList(object, FileDto.DirInfo.class);
|
List<FileDto.DirInfo> projectInfoList = channelObjectUtil.objectToList(object, FileDto.DirInfo.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user