|
@@ -113,7 +113,7 @@ public class DemServerImpl extends BaseServerImpl implements DemServer {
|
|
|
|
|
|
// 创建目录
|
|
|
String time = DateUtil.format(new DateTime(), "yyyyMMdd_HHmmss");
|
|
|
- String filePath = INPUT_PATH + time + "/";
|
|
|
+ String filePath = INPUT_PATH + time;
|
|
|
FileUtils.createDir(filePath);
|
|
|
log.info("filePath: {}", filePath);
|
|
|
|
|
@@ -125,7 +125,7 @@ public class DemServerImpl extends BaseServerImpl implements DemServer {
|
|
|
sb.append(filename).append(",");
|
|
|
|
|
|
try {
|
|
|
- FileUtils.bigFileWrite(f.getInputStream(), filePath + filename);
|
|
|
+ FileUtils.bigFileWrite(f.getInputStream(), filePath + "/" + filename);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -139,7 +139,7 @@ public class DemServerImpl extends BaseServerImpl implements DemServer {
|
|
|
FileUtils.createDir(outPath);
|
|
|
outPath = outPath + time + ".vrt";
|
|
|
String cmd = Command.DEM_BUILD;
|
|
|
- cmd = cmd.replace("@inputFile", filePath + "*.tif");
|
|
|
+ cmd = cmd.replace("@inputFile", filePath + "/*.tif");
|
|
|
cmd = cmd.replace("@outputFile", outPath);
|
|
|
log.warn("cmd: {}", cmd);
|
|
|
Integer integer = CmdUtil.exeCmdSingle(cmd);
|
|
@@ -248,6 +248,66 @@ public class DemServerImpl extends BaseServerImpl implements DemServer {
|
|
|
return new R(200, entity);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重写 deleteById
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public R deleteById(Long id) {
|
|
|
+ log.info("run deleteById: {}", id);
|
|
|
+ Optional<OutputFileEntity> o = outputFileRepository.findById(id);
|
|
|
+
|
|
|
+ OutputFileEntity entity = null;
|
|
|
+ FileEntity fileEntity = null;
|
|
|
+
|
|
|
+ boolean flag = false;
|
|
|
+ if (o.isPresent()) {
|
|
|
+ entity = o.get();
|
|
|
+ entity.setResStatus(1);
|
|
|
+ outputFileRepository.save(entity);
|
|
|
+
|
|
|
+ Optional<FileEntity> oFile = fileRepository.findById(entity.getUploadId());
|
|
|
+ if (oFile.isPresent()) {
|
|
|
+ fileEntity = oFile.get();
|
|
|
+ fileEntity.setResStatus(1);
|
|
|
+ fileRepository.save(fileEntity);
|
|
|
+
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flag) {
|
|
|
+ asyncTask.deleteById(entity, outputFileRepository, fileRepository);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ log.info("end deleteById: {}", id);
|
|
|
+ return new R(200, MsgCode.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+// FileUtils.createDir("F:\\test\\test123");
|
|
|
+// FileUtils.createDir("F:\\test\\test1234\\1.txt");
|
|
|
+// FileUtils.delFolder("F:\\test\\test1234\\1.txt");
|
|
|
+ FileUtils.delFolder("F:\\test\\test1234");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // log.info("run deleteFile: {}", fileId);
|
|
|
+// OutputFileEntity entity = modelServer.findById(fileId);
|
|
|
+// entity.setResStatus(1);
|
|
|
+// modelServer.save(entity);
|
|
|
+//
|
|
|
+// FileEntity fileEntity = modelServer.findByInputFileId(entity.getUploadId());
|
|
|
+// fileEntity.setResStatus(1);
|
|
|
+// modelServer.saveInputFile(fileEntity);
|
|
|
+//
|
|
|
+// asyncTask.modelDelete(fileId, modelServer);
|
|
|
+
|
|
|
// @Override
|
|
|
// public R deleteById(Long fileId) {
|
|
|
// // 删除服务器文件
|