|
|
@@ -1,18 +1,27 @@
|
|
|
package com.siwei.apply.controller.cadastre;
|
|
|
|
|
|
+import com.siwei.apply.domain.FzssFxrwrz;
|
|
|
import com.siwei.apply.domain.vo.CadastreFileFilterVo;
|
|
|
import com.siwei.apply.domain.vo.CheckInfoResultVo;
|
|
|
import com.siwei.apply.domain.vo.CompareResultVo;
|
|
|
import com.siwei.apply.domain.vo.IdsVo;
|
|
|
-import com.siwei.apply.domain.vo.ProjectFilterVo;
|
|
|
import com.siwei.apply.service.cadastre.CadastreManageService;
|
|
|
+import com.siwei.apply.service.cadastre.impl.FzssFxrwrzHandleService;
|
|
|
import com.siwei.common.core.domain.R;
|
|
|
import com.siwei.common.core.web.controller.BaseController;
|
|
|
import org.gdal.ogr.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.core.io.Resource;
|
|
|
+import org.springframework.core.io.ByteArrayResource;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/cadastre/manage")
|
|
|
@@ -23,14 +32,16 @@ public class CadastreManageController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CadastreManageService cadastreManageService;
|
|
|
+ @Autowired
|
|
|
+ private FzssFxrwrzHandleService fzssFxrwrzHandleService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
- * //1.先获取相关信息,进行入库
|
|
|
- * //2.日志记录写入
|
|
|
- * //3.读取文件进行录入
|
|
|
- * //4.质量进行检查
|
|
|
+ * //1.先获取相关信息,进行入库
|
|
|
+ * //2.日志记录写入
|
|
|
+ * //3.读取文件进行录入
|
|
|
+ * //4.质量进行检查
|
|
|
*
|
|
|
* @param theFileName
|
|
|
* @param theFilePath
|
|
|
@@ -39,9 +50,9 @@ public class CadastreManageController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/checkUploadDquality")
|
|
|
- public R<CheckInfoResultVo> checkData(String theFileName, String theFilePath, String fileType,String updateType) {
|
|
|
+ public R<CheckInfoResultVo> checkData(String theFileName, String theFilePath, String fileType, String updateType) {
|
|
|
try {
|
|
|
- CheckInfoResultVo res = cadastreManageService.checkFileData(theFileName, theFilePath, fileType,updateType);
|
|
|
+ CheckInfoResultVo res = cadastreManageService.checkFileData(theFileName, theFilePath, fileType, updateType);
|
|
|
return R.ok(res);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -49,7 +60,6 @@ public class CadastreManageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/getCompareData")
|
|
|
public R<CompareResultVo> compareData(String uploadId) {
|
|
|
try {
|
|
|
@@ -61,7 +71,6 @@ public class CadastreManageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/addBatchGdbData")
|
|
|
public R<String> addBatchGdbData(String uploadId) {
|
|
|
try {
|
|
|
@@ -74,7 +83,6 @@ public class CadastreManageController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取列表
|
|
|
*
|
|
|
@@ -109,6 +117,65 @@ public class CadastreManageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取任务日志
|
|
|
+ *
|
|
|
+ * @param bsm
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/GetLog")
|
|
|
+ public R<List<FzssFxrwrz>> GetLog(String bsm) {
|
|
|
+ try {
|
|
|
+ List<FzssFxrwrz> list = fzssFxrwrzHandleService.getLog(bsm);
|
|
|
+ return R.ok(list);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务日志文件,最终前端可以下载成txt内容,每一条数据作为txt的一行记录
|
|
|
+ *
|
|
|
+ * @param rwbsm
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/GetLogFile")
|
|
|
+ public ResponseEntity<Resource> GetLogFile(String rwbsm) {
|
|
|
+ List<FzssFxrwrz> list = fzssFxrwrzHandleService.getLog(rwbsm);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ for (FzssFxrwrz item : list) {
|
|
|
+ String time = item.getRzsj() != null ? sdf.format(item.getRzsj()) : "";
|
|
|
+ String line = String.join(" | ",
|
|
|
+ time,
|
|
|
+ Optional.ofNullable(item.getRwlx()).orElse(""),
|
|
|
+ Optional.ofNullable(item.getRzlx()).orElse(""),
|
|
|
+ Optional.ofNullable(item.getRzlr()).orElse(""));
|
|
|
+ sb.append(line).append("\n");
|
|
|
+ }
|
|
|
+ byte[] data = sb.toString().getBytes(StandardCharsets.UTF_8);
|
|
|
+ ByteArrayResource resource = new ByteArrayResource(data);
|
|
|
+ String fileName = "log_" + rwbsm + ".txt";
|
|
|
+ String encName;
|
|
|
+ try {
|
|
|
+ encName = URLEncoder.encode(fileName, "UTF-8");
|
|
|
+ } catch (Exception e) {
|
|
|
+ encName = fileName;
|
|
|
+ }
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + encName);
|
|
|
+ headers.setContentType(new MediaType("text", "plain", StandardCharsets.UTF_8));
|
|
|
+ return ResponseEntity
|
|
|
+ .ok()
|
|
|
+ .headers(headers)
|
|
|
+ .contentLength(data.length)
|
|
|
+ .body(resource);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|