bug调整
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -81,18 +80,21 @@ public class DeviceFtpController extends BaseController {
|
||||
})
|
||||
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
||||
String methodDescribe = getMethodDescribe("downloadFile");
|
||||
String result = deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
redisUtil.delete("downloadFilePath:"+name);
|
||||
redisUtil.delete("fileCheck"+name);
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
if (Objects.isNull(result)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
} else {
|
||||
int step = (int) Math.ceil((double) size / 51200);
|
||||
String json = "{fileName:"+name+",allStep:"+ step +",nowStep:"+ step +"}";
|
||||
publisher.send("/Web/Progress/" + nDid, new Gson().toJson(json), 1, false);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDownloadFilePath")
|
||||
@ApiOperation("获取文件下载路径")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "name", value = "文件路径名", required = true)
|
||||
})
|
||||
public HttpResult<String> getDownloadFilePath(@RequestParam("nDid") String nDid, @RequestParam("name") String name){
|
||||
String methodDescribe = getMethodDescribe("getDownloadFilePath");
|
||||
String result = deviceFtpService.getDownloadFilePath(nDid,name);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
Reference in New Issue
Block a user