fix: 优化第一版
This commit is contained in:
parent
80277fecd6
commit
33cea1fd1e
@ -145,18 +145,12 @@ public class FishDraftDataController {
|
|||||||
public ResponseResult saveDraft(@RequestBody FishImportRowRequest request) {
|
public ResponseResult saveDraft(@RequestBody FishImportRowRequest request) {
|
||||||
String taskId = request.getTaskId();
|
String taskId = request.getTaskId();
|
||||||
ImportTask importTask = importTaskService.getById(taskId);
|
ImportTask importTask = importTaskService.getById(taskId);
|
||||||
String resultJson = importTask.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
FishImportResult importResult = null;
|
|
||||||
Map<String, String> imageFiles = null;
|
Map<String, String> imageFiles = null;
|
||||||
Map<String, String> videoFiles = null;
|
Map<String, String> videoFiles = null;
|
||||||
if (resultJson != null && !resultJson.isEmpty()) {
|
if (importResult != null) {
|
||||||
try {
|
imageFiles = importResult.getImageFiles();
|
||||||
importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
videoFiles = importResult.getVideoFiles();
|
||||||
imageFiles = importResult.getImageFiles();
|
|
||||||
videoFiles = importResult.getVideoFiles();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (importResult == null || importResult.getRows() == null) {
|
if (importResult == null || importResult.getRows() == null) {
|
||||||
@ -188,11 +182,10 @@ public class FishDraftDataController {
|
|||||||
if (importTask == null) {
|
if (importTask == null) {
|
||||||
return ResponseResult.error("导入任务不存在");
|
return ResponseResult.error("导入任务不存在");
|
||||||
}
|
}
|
||||||
String resultJson = importTask.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
List<FishDraftData> fishDraftDataList = batchSaveDraftRequest.getFishDraftDataList();
|
List<FishDraftData> fishDraftDataList = batchSaveDraftRequest.getFishDraftDataList();
|
||||||
if (resultJson != null && !resultJson.isEmpty()) {
|
if (importResult != null) {
|
||||||
try {
|
try {
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
ZipFileUtil.ZipContent content = new ZipFileUtil.ZipContent();
|
ZipFileUtil.ZipContent content = new ZipFileUtil.ZipContent();
|
||||||
content.images = importResult.getImageFiles();
|
content.images = importResult.getImageFiles();
|
||||||
content.videos = importResult.getVideoFiles();
|
content.videos = importResult.getVideoFiles();
|
||||||
@ -211,7 +204,6 @@ public class FishDraftDataController {
|
|||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// ignore parse error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,8 +486,8 @@ public class FishDraftDataController {
|
|||||||
importTaskService.updateStatus(taskId, status, result.getTempDir(), null);
|
importTaskService.updateStatus(taskId, status, result.getTempDir(), null);
|
||||||
importTaskService.updateProgress(taskId, result.getTotalCount(),
|
importTaskService.updateProgress(taskId, result.getTotalCount(),
|
||||||
result.getSuccessCount(), result.getFailedCount());
|
result.getSuccessCount(), result.getFailedCount());
|
||||||
String resultJson = objectMapper.writeValueAsString(result);
|
// String resultJson = objectMapper.writeValueAsString(result);
|
||||||
importTaskService.saveResultJson(taskId, resultJson);
|
importTaskService.saveResultJson(taskId, result);
|
||||||
log.info("异步解析完成, taskId: {}, 状态: {}", taskId, status);
|
log.info("异步解析完成, taskId: {}, 状态: {}", taskId, status);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("异步解析ZIP失败, taskId: {}", taskId, e);
|
log.error("异步解析ZIP失败, taskId: {}", taskId, e);
|
||||||
@ -533,13 +525,11 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("任务不存在");
|
return ResponseResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJson = task.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
if (resultJson == null || resultJson.isEmpty()) {
|
if (importResult == null) {
|
||||||
return ResponseResult.error("任务结果为空");
|
return ResponseResult.error("任务结果为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
|
|
||||||
Map<String, Object> previewData = new HashMap<>();
|
Map<String, Object> previewData = new HashMap<>();
|
||||||
previewData.put("tempDir", importResult.getTempDir());
|
previewData.put("tempDir", importResult.getTempDir());
|
||||||
previewData.put("excelFileName", importResult.getExcelFileName());
|
previewData.put("excelFileName", importResult.getExcelFileName());
|
||||||
@ -583,23 +573,14 @@ public class FishDraftDataController {
|
|||||||
@GetMapping("/previewFile")
|
@GetMapping("/previewFile")
|
||||||
@Operation(summary = "预览临时文件内容")
|
@Operation(summary = "预览临时文件内容")
|
||||||
public void previewFile(@RequestParam String taskId, @RequestParam String filename, @RequestParam String type, HttpServletRequest request, HttpServletResponse response) {
|
public void previewFile(@RequestParam String taskId, @RequestParam String filename, @RequestParam String type, HttpServletRequest request, HttpServletResponse response) {
|
||||||
// 解码 URL 编码的 filename(处理中文文件名)
|
|
||||||
String decodedFilename = URLDecoder.decode(filename, StandardCharsets.UTF_8);
|
String decodedFilename = URLDecoder.decode(filename, StandardCharsets.UTF_8);
|
||||||
log.debug("原始文件名: {}, 解码后: {}", filename, decodedFilename);
|
log.debug("原始文件名: {}, 解码后: {}", filename, decodedFilename);
|
||||||
|
|
||||||
ImportTask importTask = importTaskService.getById(taskId);
|
ImportTask importTask = importTaskService.getById(taskId);
|
||||||
String resultJson = importTask.getResultJson();
|
|
||||||
String filePath = null;
|
String filePath = null;
|
||||||
String dir = "1".equals(type) ? "images" : "videos";
|
String dir = "1".equals(type) ? "images" : "videos";
|
||||||
if (resultJson != null && !resultJson.isEmpty()) {
|
if (importTask != null && importTask.getTempDir() != null) {
|
||||||
try {
|
filePath = importTask.getTempDir() + File.separator + dir + File.separator + decodedFilename;
|
||||||
// FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
String tempDir = importTask.getTempDir();
|
|
||||||
filePath = tempDir + File.separator + dir + File.separator + decodedFilename;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
// ignore parse error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (filePath == null) {
|
if (filePath == null) {
|
||||||
writeErrorResponse(response, "文件路径不能为空");
|
writeErrorResponse(response, "文件路径不能为空");
|
||||||
@ -659,13 +640,12 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("任务不存在");
|
return ResponseResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJson = importTask.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
if (resultJson == null || resultJson.isEmpty()) {
|
if (importResult == null) {
|
||||||
return ResponseResult.error("任务结果为空");
|
return ResponseResult.error("任务结果为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (FishImportResult.FishImportRow row : importResult.getRows()) {
|
for (FishImportResult.FishImportRow row : importResult.getRows()) {
|
||||||
@ -723,8 +703,7 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("未找到对应的数据行");
|
return ResponseResult.error("未找到对应的数据行");
|
||||||
}
|
}
|
||||||
|
|
||||||
String updatedJson = objectMapper.writeValueAsString(importResult);
|
importTaskService.saveResultJson(taskId, importResult);
|
||||||
importTaskService.saveResultJson(taskId, updatedJson);
|
|
||||||
|
|
||||||
return ResponseResult.success("删除成功");
|
return ResponseResult.success("删除成功");
|
||||||
|
|
||||||
@ -814,7 +793,6 @@ public class FishDraftDataController {
|
|||||||
result.put("currentTask", null);
|
result.put("currentTask", null);
|
||||||
return ResponseResult.successData(result);
|
return ResponseResult.successData(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
String statusText = getStatusText(currentTask.getStatus());
|
String statusText = getStatusText(currentTask.getStatus());
|
||||||
boolean canImport = isTaskComplete(currentTask.getStatus());
|
boolean canImport = isTaskComplete(currentTask.getStatus());
|
||||||
|
|
||||||
@ -843,7 +821,8 @@ public class FishDraftDataController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTaskComplete(String status) {
|
private boolean isTaskComplete(String status) {
|
||||||
return "CONFIRMED".equals(status) || "FAILED".equals(status) || "CANCELLED".equals(status);
|
return "CONFIRMED".equals(status) || "CANCELLED".equals(status);
|
||||||
|
// return "CONFIRMED".equals(status) || "FAILED".equals(status) || "CANCELLED".equals(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getLastImportResult")
|
@GetMapping("/getLastImportResult")
|
||||||
@ -859,15 +838,7 @@ public class FishDraftDataController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
FishImportResult importResult = null;
|
FishImportResult importResult = importTaskService.buildImportResult(lastTask.getId());
|
||||||
if (lastTask.getResultJson() != null && !lastTask.getResultJson().isEmpty()) {
|
|
||||||
try {
|
|
||||||
importResult = objectMapper.readValue(lastTask.getResultJson(), FishImportResult.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
// ignore parse error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalCount = lastTask.getTotalCount() != null ? lastTask.getTotalCount() : 0;
|
int totalCount = lastTask.getTotalCount() != null ? lastTask.getTotalCount() : 0;
|
||||||
int successCount = lastTask.getSuccessCount() != null ? lastTask.getSuccessCount() : 0;
|
int successCount = lastTask.getSuccessCount() != null ? lastTask.getSuccessCount() : 0;
|
||||||
@ -962,13 +933,11 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("任务不存在");
|
return ResponseResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJson = task.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
if (resultJson == null || resultJson.isEmpty()) {
|
if (importResult == null) {
|
||||||
return ResponseResult.error("任务结果为空");
|
return ResponseResult.error("任务结果为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
|
|
||||||
FishImportResult.FishImportRow targetRow = null;
|
FishImportResult.FishImportRow targetRow = null;
|
||||||
int targetIndex = -1;
|
int targetIndex = -1;
|
||||||
for (int i = 0; i < importResult.getRows().size(); i++) {
|
for (int i = 0; i < importResult.getRows().size(); i++) {
|
||||||
@ -1016,8 +985,8 @@ public class FishDraftDataController {
|
|||||||
importResult.setSuccessCount(successCount);
|
importResult.setSuccessCount(successCount);
|
||||||
importResult.setFailedCount(failedCount);
|
importResult.setFailedCount(failedCount);
|
||||||
|
|
||||||
String updatedJson = objectMapper.writeValueAsString(importResult);
|
// String updatedJson = objectMapper.writeValueAsString(importResult);
|
||||||
importTaskService.saveResultJson(taskId, updatedJson);
|
importTaskService.saveResultJson(taskId, importResult);
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("success", true);
|
map.put("success", true);
|
||||||
@ -1052,13 +1021,11 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("任务不存在");
|
return ResponseResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJson = task.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
if (resultJson == null || resultJson.isEmpty()) {
|
if (importResult == null) {
|
||||||
return ResponseResult.error("任务结果为空");
|
return ResponseResult.error("任务结果为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
|
|
||||||
FishImportResult.FishImportRow targetRow = null;
|
FishImportResult.FishImportRow targetRow = null;
|
||||||
int targetIndex = -1;
|
int targetIndex = -1;
|
||||||
for (int i = 0; i < importResult.getRows().size(); i++) {
|
for (int i = 0; i < importResult.getRows().size(); i++) {
|
||||||
@ -1074,8 +1041,8 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("未找到对应的数据行");
|
return ResponseResult.error("未找到对应的数据行");
|
||||||
}
|
}
|
||||||
importResult.getRows().remove(targetIndex);
|
importResult.getRows().remove(targetIndex);
|
||||||
String updatedJson = objectMapper.writeValueAsString(importResult);
|
// String updatedJson = objectMapper.writeValueAsString(importResult);
|
||||||
importTaskService.saveResultJson(taskId, updatedJson);
|
importTaskService.saveResultJson(taskId, importResult);
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -1213,13 +1180,11 @@ public class FishDraftDataController {
|
|||||||
return ResponseResult.error("任务不存在");
|
return ResponseResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJson = task.getResultJson();
|
FishImportResult importResult = importTaskService.buildImportResult(taskId);
|
||||||
if (resultJson == null || resultJson.isEmpty()) {
|
if (importResult == null) {
|
||||||
return ResponseResult.error("任务结果为空");
|
return ResponseResult.error("任务结果为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
FishImportResult importResult = objectMapper.readValue(resultJson, FishImportResult.class);
|
|
||||||
|
|
||||||
FishImportResult.FishImportRow matchedRow = findMatchingRow(importResult, data.getId());
|
FishImportResult.FishImportRow matchedRow = findMatchingRow(importResult, data.getId());
|
||||||
|
|
||||||
FishImportResult.FishImportRow resultRow = new FishImportResult.FishImportRow();
|
FishImportResult.FishImportRow resultRow = new FishImportResult.FishImportRow();
|
||||||
|
|||||||
@ -96,9 +96,34 @@ public class ImportTask implements Serializable {
|
|||||||
private Date expireTime;
|
private Date expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入结果JSON(存储校验后的数据)
|
* 解析结果摘要
|
||||||
*/
|
*/
|
||||||
private String resultJson;
|
private String summary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果代码(0成功 1失败)
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果消息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未识别字段(逗号分隔)
|
||||||
|
*/
|
||||||
|
private String unrecognizedFields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片文件映射JSON
|
||||||
|
*/
|
||||||
|
private String imageFilesJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频文件映射JSON
|
||||||
|
*/
|
||||||
|
private String videoFilesJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
|||||||
@ -0,0 +1,104 @@
|
|||||||
|
package com.yfd.platform.data.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 导入任务行数据表(DATA_JSON 拆为独立字段,彻底消除 CLOB)
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("IMPORT_TASK_ROW")
|
||||||
|
public class ImportTaskRow implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String taskId;
|
||||||
|
|
||||||
|
private Integer rowIndex;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
// ========== FishDraftData 字段(原 DATA_JSON) ==========
|
||||||
|
|
||||||
|
private String dataId;
|
||||||
|
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
private String stnm;
|
||||||
|
|
||||||
|
private String rstcd;
|
||||||
|
|
||||||
|
private String ennm;
|
||||||
|
|
||||||
|
private String hbrvcd;
|
||||||
|
|
||||||
|
private String hbrvnm;
|
||||||
|
|
||||||
|
private String rvcd;
|
||||||
|
|
||||||
|
private String baseId;
|
||||||
|
|
||||||
|
private String baseName;
|
||||||
|
|
||||||
|
private Date strdt;
|
||||||
|
|
||||||
|
private String strdtStr;
|
||||||
|
|
||||||
|
private Date enddt;
|
||||||
|
|
||||||
|
private String ftp;
|
||||||
|
|
||||||
|
private String ftpName;
|
||||||
|
|
||||||
|
private Integer isfs;
|
||||||
|
|
||||||
|
private String direction;
|
||||||
|
|
||||||
|
private Integer fcnt;
|
||||||
|
|
||||||
|
private String fsz;
|
||||||
|
|
||||||
|
private String fwet;
|
||||||
|
|
||||||
|
private BigDecimal wt;
|
||||||
|
|
||||||
|
private String picpth;
|
||||||
|
|
||||||
|
private String vdpth;
|
||||||
|
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
|
private Integer mouth;
|
||||||
|
|
||||||
|
private Integer yr;
|
||||||
|
|
||||||
|
// ========== 校验相关 ==========
|
||||||
|
|
||||||
|
private String warnings;
|
||||||
|
|
||||||
|
private String unrecognizedFields;
|
||||||
|
|
||||||
|
private String vdpthListJson;
|
||||||
|
|
||||||
|
private String picpthListJson;
|
||||||
|
|
||||||
|
private String vdpthWarnings;
|
||||||
|
|
||||||
|
private String picpthWarnings;
|
||||||
|
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createdAt;
|
||||||
|
}
|
||||||
@ -40,11 +40,10 @@ public interface ImportTaskMapper extends BaseMapper<ImportTask> {
|
|||||||
|
|
||||||
@Select("SELECT * FROM (" +
|
@Select("SELECT * FROM (" +
|
||||||
"SELECT ID, IMPORT_NO, BIZ_TYPE, FILE_NAME, FILE_SIZE, FILE_PATH, TEMP_DIR, " +
|
"SELECT ID, IMPORT_NO, BIZ_TYPE, FILE_NAME, FILE_SIZE, FILE_PATH, TEMP_DIR, " +
|
||||||
"TOTAL_COUNT, SUCCESS_COUNT, FAIL_COUNT, STATUS, ERROR_MSG, " +
|
"TOTAL_COUNT, SUCCESS_COUNT, FAIL_COUNT, STATUS, ERROR_MSG " +
|
||||||
"UPLOAD_USER_ID, UPLOAD_TIME, EXPIRE_TIME, CREATED_AT, UPDATED_AT " +
|
|
||||||
"FROM IMPORT_TASK " +
|
"FROM IMPORT_TASK " +
|
||||||
"WHERE UPLOAD_USER_ID = #{uploadUserId} " +
|
"WHERE UPLOAD_USER_ID = #{uploadUserId} " +
|
||||||
"AND STATUS IN ('UPLOADED', 'PARSING', 'VALIDATED') " +
|
"AND STATUS IN ('UPLOADED', 'PARSING', 'VALIDATED','FAILED') " +
|
||||||
"ORDER BY CREATED_AT DESC" +
|
"ORDER BY CREATED_AT DESC" +
|
||||||
") WHERE ROWNUM = 1")
|
") WHERE ROWNUM = 1")
|
||||||
List<ImportTask> selectByUserIdAndStatuses(@Param("uploadUserId") String uploadUserId);
|
List<ImportTask> selectByUserIdAndStatuses(@Param("uploadUserId") String uploadUserId);
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.yfd.platform.data.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.yfd.platform.data.domain.ImportTaskRow;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 导入任务行数据表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface ImportTaskRowMapper extends BaseMapper<ImportTaskRow> {
|
||||||
|
|
||||||
|
List<ImportTaskRow> selectByTaskId(@Param("taskId") String taskId);
|
||||||
|
|
||||||
|
List<ImportTaskRow> selectByTaskIdAndStatus(@Param("taskId") String taskId, @Param("status") String status);
|
||||||
|
|
||||||
|
int deleteByTaskId(@Param("taskId") String taskId);
|
||||||
|
}
|
||||||
@ -2,7 +2,9 @@ package com.yfd.platform.data.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.yfd.platform.data.domain.FishImportResult;
|
||||||
import com.yfd.platform.data.domain.ImportTask;
|
import com.yfd.platform.data.domain.ImportTask;
|
||||||
|
import com.yfd.platform.data.domain.ImportTaskRow;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -79,12 +81,27 @@ public interface IImportTaskService extends IService<ImportTask> {
|
|||||||
ImportTask getCurrentTaskByUserId(String uploadUserId);
|
ImportTask getCurrentTaskByUserId(String uploadUserId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存导入结果JSON
|
* 保存导入结果(同时写入 IMPORT_TASK 汇总字段和 IMPORT_TASK_ROW 行数据)
|
||||||
*/
|
*/
|
||||||
boolean saveResultJson(String taskId, String resultJson);
|
boolean saveResultJson(String taskId, FishImportResult result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户最后一次导入结果(用于断点续传或查看历史)
|
* 获取用户最后一次导入结果(用于断点续传或查看历史)
|
||||||
*/
|
*/
|
||||||
ImportTask getLastImportResult(String uploadUserId);
|
ImportTask getLastImportResult(String uploadUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务ID查询行数据列表
|
||||||
|
*/
|
||||||
|
List<ImportTaskRow> getRowsByTaskId(String taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务ID和状态查询行数据列表
|
||||||
|
*/
|
||||||
|
List<ImportTaskRow> getRowsByTaskIdAndStatus(String taskId, String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务ID重建 FishImportResult 对象(从行表组装)
|
||||||
|
*/
|
||||||
|
FishImportResult buildImportResult(String taskId);
|
||||||
}
|
}
|
||||||
@ -6,33 +6,42 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.yfd.platform.data.domain.FishDraftData;
|
||||||
import com.yfd.platform.data.domain.FishImportResult;
|
import com.yfd.platform.data.domain.FishImportResult;
|
||||||
import com.yfd.platform.data.domain.ImportTask;
|
import com.yfd.platform.data.domain.ImportTask;
|
||||||
|
import com.yfd.platform.data.domain.ImportTaskRow;
|
||||||
import com.yfd.platform.data.mapper.ImportTaskMapper;
|
import com.yfd.platform.data.mapper.ImportTaskMapper;
|
||||||
|
import com.yfd.platform.data.mapper.ImportTaskRowMapper;
|
||||||
import com.yfd.platform.data.service.AttachmentUploadService;
|
import com.yfd.platform.data.service.AttachmentUploadService;
|
||||||
import com.yfd.platform.data.service.IImportTaskService;
|
import com.yfd.platform.data.service.IImportTaskService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 导入任务表 服务实现类
|
* 导入任务表 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportTask> implements IImportTaskService {
|
public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportTask> implements IImportTaskService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ImportTaskMapper importTaskMapper;
|
private ImportTaskMapper importTaskMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ImportTaskRowMapper importTaskRowMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
@Resource
|
@Resource
|
||||||
@ -148,6 +157,9 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
List<String> ids = expiredTasks.stream().map(ImportTask::getId).toList();
|
List<String> ids = expiredTasks.stream().map(ImportTask::getId).toList();
|
||||||
|
for (String id : ids) {
|
||||||
|
importTaskRowMapper.deleteByTaskId(id);
|
||||||
|
}
|
||||||
return this.removeByIds(ids);
|
return this.removeByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,29 +178,26 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String currentStatus = importTask.getStatus();
|
String currentStatus = importTask.getStatus();
|
||||||
if ("CONFIRMED".equals(currentStatus) || "FAILED".equals(currentStatus) || "CANCELLED".equals(currentStatus)) {
|
// if ("CONFIRMED".equals(currentStatus) || "FAILED".equals(currentStatus) || "CANCELLED".equals(currentStatus)) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ("CONFIRMED".equals(currentStatus) || "CANCELLED".equals(currentStatus)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String temp = importTask.getTempDir();
|
String temp = importTask.getTempDir();
|
||||||
if (StrUtil.isNotBlank( temp)) {
|
if (StrUtil.isNotBlank( temp)) {
|
||||||
FileUtil.del(temp);
|
FileUtil.del(temp);
|
||||||
}else{
|
}else{
|
||||||
ImportTask importTaskNew = this.getById(taskId);
|
FishImportResult importResult = buildImportResult(taskId);
|
||||||
if (importTaskNew.getResultJson() != null && !importTaskNew.getResultJson().isEmpty()) {
|
if (importResult != null && importResult.getTempDir() != null) {
|
||||||
try {
|
FileUtil.del(importResult.getTempDir());
|
||||||
FishImportResult importResult = objectMapper.readValue(importTaskNew.getResultJson(), FishImportResult.class);
|
|
||||||
String tempDir = importResult.getTempDir();
|
|
||||||
// del 方法会递归删除目录及其所有内容
|
|
||||||
FileUtil.del(tempDir);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
// ignore parse error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
importTask.setStatus("CANCELLED");
|
importTask.setStatus("CANCELLED");
|
||||||
importTask.setErrorMsg("用户取消: " + operatorId);
|
importTask.setErrorMsg("用户取消: " + operatorId);
|
||||||
importTask.setUpdatedAt(new Date());
|
importTask.setUpdatedAt(new Date());
|
||||||
|
importTaskRowMapper.deleteByTaskId(taskId);
|
||||||
return this.updateById(importTask);
|
return this.updateById(importTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,14 +213,103 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean saveResultJson(String taskId, String resultJson) {
|
public boolean saveResultJson(String taskId, FishImportResult importResult) {
|
||||||
ImportTask importTask = this.getById(taskId);
|
ImportTask importTask = this.getById(taskId);
|
||||||
if (importTask == null) {
|
if (importTask == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
importTask.setResultJson(resultJson);
|
|
||||||
|
// importTask.setResultJson(resultJson);
|
||||||
importTask.setUpdatedAt(new Date());
|
importTask.setUpdatedAt(new Date());
|
||||||
return this.updateById(importTask);
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
importTask.setSummary(importResult.getSummary());
|
||||||
|
importTask.setCode(importResult.getCode());
|
||||||
|
importTask.setMessage(importResult.getMessage());
|
||||||
|
if (importResult.getUnrecognizedFields() != null && !importResult.getUnrecognizedFields().isEmpty()) {
|
||||||
|
importTask.setUnrecognizedFields(String.join(",", importResult.getUnrecognizedFields()));
|
||||||
|
}
|
||||||
|
if (importResult.getImageFiles() != null && !importResult.getImageFiles().isEmpty()) {
|
||||||
|
importTask.setImageFilesJson(objectMapper.writeValueAsString(importResult.getImageFiles()));
|
||||||
|
}
|
||||||
|
if (importResult.getVideoFiles() != null && !importResult.getVideoFiles().isEmpty()) {
|
||||||
|
importTask.setVideoFilesJson(objectMapper.writeValueAsString(importResult.getVideoFiles()));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateById(importTask);
|
||||||
|
|
||||||
|
importTaskRowMapper.deleteByTaskId(taskId);
|
||||||
|
|
||||||
|
if (importResult.getRows() != null && !importResult.getRows().isEmpty()) {
|
||||||
|
List<ImportTaskRow> rows = new ArrayList<>();
|
||||||
|
for (FishImportResult.FishImportRow row : importResult.getRows()) {
|
||||||
|
ImportTaskRow taskRow = new ImportTaskRow();
|
||||||
|
taskRow.setTaskId(taskId);
|
||||||
|
taskRow.setRowIndex(row.getRowIndex());
|
||||||
|
taskRow.setStatus(row.getStatus());
|
||||||
|
|
||||||
|
FishDraftData data = row.getData();
|
||||||
|
if (data != null) {
|
||||||
|
taskRow.setDataId(data.getId());
|
||||||
|
taskRow.setStcd(data.getStcd());
|
||||||
|
taskRow.setStnm(data.getStnm());
|
||||||
|
taskRow.setRstcd(data.getRstcd());
|
||||||
|
taskRow.setEnnm(data.getEnnm());
|
||||||
|
taskRow.setHbrvcd(data.getHbrvcd());
|
||||||
|
taskRow.setHbrvnm(data.getHbrvnm());
|
||||||
|
taskRow.setRvcd(data.getRvcd());
|
||||||
|
taskRow.setBaseId(data.getBaseId());
|
||||||
|
taskRow.setBaseName(data.getBaseName());
|
||||||
|
taskRow.setStrdt(data.getStrdt());
|
||||||
|
taskRow.setStrdtStr(data.getStrdtStr());
|
||||||
|
taskRow.setEnddt(data.getEnddt());
|
||||||
|
taskRow.setFtp(data.getFtp());
|
||||||
|
taskRow.setFtpName(data.getFtpName());
|
||||||
|
taskRow.setIsfs(data.getIsfs());
|
||||||
|
taskRow.setDirection(data.getDirection());
|
||||||
|
taskRow.setFcnt(data.getFcnt());
|
||||||
|
taskRow.setFsz(data.getFsz());
|
||||||
|
taskRow.setFwet(data.getFwet());
|
||||||
|
taskRow.setWt(data.getWt());
|
||||||
|
taskRow.setPicpth(data.getPicpth());
|
||||||
|
taskRow.setVdpth(data.getVdpth());
|
||||||
|
taskRow.setTm(data.getTm());
|
||||||
|
taskRow.setSourceType(data.getSourceType());
|
||||||
|
taskRow.setMouth(data.getMouth());
|
||||||
|
taskRow.setYr(data.getYr());
|
||||||
|
}
|
||||||
|
if (row.getWarnings() != null && !row.getWarnings().isEmpty()) {
|
||||||
|
taskRow.setWarnings(String.join(",", row.getWarnings()));
|
||||||
|
}
|
||||||
|
if (row.getUnrecognizedFields() != null && !row.getUnrecognizedFields().isEmpty()) {
|
||||||
|
taskRow.setUnrecognizedFields(String.join(",", row.getUnrecognizedFields()));
|
||||||
|
}
|
||||||
|
if (row.getVdpthList() != null && !row.getVdpthList().isEmpty()) {
|
||||||
|
taskRow.setVdpthListJson(objectMapper.writeValueAsString(row.getVdpthList()));
|
||||||
|
}
|
||||||
|
if (row.getPicpthList() != null && !row.getPicpthList().isEmpty()) {
|
||||||
|
taskRow.setPicpthListJson(objectMapper.writeValueAsString(row.getPicpthList()));
|
||||||
|
}
|
||||||
|
if (row.getVdpthsWarnings() != null && !row.getVdpthsWarnings().isEmpty()) {
|
||||||
|
taskRow.setVdpthWarnings(String.join(",", row.getVdpthsWarnings()));
|
||||||
|
}
|
||||||
|
if (row.getPicpthsWarnings() != null && !row.getPicpthsWarnings().isEmpty()) {
|
||||||
|
taskRow.setPicpthWarnings(String.join(",", row.getPicpthsWarnings()));
|
||||||
|
}
|
||||||
|
taskRow.setCreatedAt(new Date());
|
||||||
|
rows.add(taskRow);
|
||||||
|
}
|
||||||
|
importTaskRowMapper.insert(rows);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("保存导入结果行数据失败, taskId: {}", taskId, e);
|
||||||
|
importTask.setErrorMsg("保存行数据失败: " + e.getMessage());
|
||||||
|
this.updateById(importTask);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -219,4 +317,128 @@ public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportT
|
|||||||
ImportTask importTask = importTaskMapper.selectLastByUserId(uploadUserId);
|
ImportTask importTask = importTaskMapper.selectLastByUserId(uploadUserId);
|
||||||
return importTask;
|
return importTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ImportTaskRow> getRowsByTaskId(String taskId) {
|
||||||
|
return importTaskRowMapper.selectByTaskId(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ImportTaskRow> getRowsByTaskIdAndStatus(String taskId, String status) {
|
||||||
|
return importTaskRowMapper.selectByTaskIdAndStatus(taskId, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FishImportResult buildImportResult(String taskId) {
|
||||||
|
ImportTask importTask = this.getById(taskId);
|
||||||
|
if (importTask == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
FishImportResult result = new FishImportResult();
|
||||||
|
result.setTaskId(taskId);
|
||||||
|
result.setTempDir(importTask.getTempDir());
|
||||||
|
result.setSummary(importTask.getSummary());
|
||||||
|
result.setCode(importTask.getCode());
|
||||||
|
result.setMessage(importTask.getMessage());
|
||||||
|
result.setTotalCount(importTask.getTotalCount() != null ? importTask.getTotalCount() : 0);
|
||||||
|
result.setSuccessCount(importTask.getSuccessCount() != null ? importTask.getSuccessCount() : 0);
|
||||||
|
result.setFailedCount(importTask.getFailCount() != null ? importTask.getFailCount() : 0);
|
||||||
|
|
||||||
|
if (importTask.getUnrecognizedFields() != null && !importTask.getUnrecognizedFields().isEmpty()) {
|
||||||
|
result.setUnrecognizedFields(Arrays.asList(importTask.getUnrecognizedFields().split(",")));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (importTask.getImageFilesJson() != null && !importTask.getImageFilesJson().isEmpty()) {
|
||||||
|
Map<String, String> imageFiles = objectMapper.readValue(
|
||||||
|
importTask.getImageFilesJson(), new TypeReference<Map<String, String>>() {});
|
||||||
|
result.setImageFiles(imageFiles);
|
||||||
|
}
|
||||||
|
if (importTask.getVideoFilesJson() != null && !importTask.getVideoFilesJson().isEmpty()) {
|
||||||
|
Map<String, String> videoFiles = objectMapper.readValue(
|
||||||
|
importTask.getVideoFilesJson(), new TypeReference<Map<String, String>>() {});
|
||||||
|
result.setVideoFiles(videoFiles);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解析文件映射JSON失败, taskId: {}", taskId, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ImportTaskRow> rows = importTaskRowMapper.selectByTaskId(taskId);
|
||||||
|
if (rows != null && !rows.isEmpty()) {
|
||||||
|
for (ImportTaskRow row : rows) {
|
||||||
|
FishImportResult.FishImportRow importRow = new FishImportResult.FishImportRow(row.getRowIndex());
|
||||||
|
importRow.setStatus(row.getStatus());
|
||||||
|
|
||||||
|
FishDraftData data = new FishDraftData();
|
||||||
|
data.setId(row.getDataId());
|
||||||
|
data.setStcd(row.getStcd());
|
||||||
|
data.setStnm(row.getStnm());
|
||||||
|
data.setRstcd(row.getRstcd());
|
||||||
|
data.setEnnm(row.getEnnm());
|
||||||
|
data.setHbrvcd(row.getHbrvcd());
|
||||||
|
data.setHbrvnm(row.getHbrvnm());
|
||||||
|
data.setRvcd(row.getRvcd());
|
||||||
|
data.setBaseId(row.getBaseId());
|
||||||
|
data.setBaseName(row.getBaseName());
|
||||||
|
data.setStrdt(row.getStrdt());
|
||||||
|
data.setStrdtStr(row.getStrdtStr());
|
||||||
|
data.setEnddt(row.getEnddt());
|
||||||
|
data.setFtp(row.getFtp());
|
||||||
|
data.setFtpName(row.getFtpName());
|
||||||
|
data.setIsfs(row.getIsfs());
|
||||||
|
data.setDirection(row.getDirection());
|
||||||
|
data.setFcnt(row.getFcnt());
|
||||||
|
data.setFsz(row.getFsz());
|
||||||
|
data.setFwet(row.getFwet());
|
||||||
|
data.setWt(row.getWt());
|
||||||
|
data.setPicpth(row.getPicpth());
|
||||||
|
data.setVdpth(row.getVdpth());
|
||||||
|
data.setTm(row.getTm());
|
||||||
|
data.setSourceType(row.getSourceType());
|
||||||
|
data.setMouth(row.getMouth());
|
||||||
|
data.setYr(row.getYr());
|
||||||
|
importRow.setData(data);
|
||||||
|
|
||||||
|
if (row.getWarnings() != null && !row.getWarnings().isEmpty()) {
|
||||||
|
importRow.setWarnings(Arrays.asList(row.getWarnings().split(",")));
|
||||||
|
}
|
||||||
|
if (row.getUnrecognizedFields() != null && !row.getUnrecognizedFields().isEmpty()) {
|
||||||
|
importRow.setUnrecognizedFields(Arrays.asList(row.getUnrecognizedFields().split(",")));
|
||||||
|
}
|
||||||
|
if (row.getVdpthListJson() != null && !row.getVdpthListJson().isEmpty()) {
|
||||||
|
try {
|
||||||
|
List<Map<String, String>> vdpthList = objectMapper.readValue(
|
||||||
|
row.getVdpthListJson(), new TypeReference<List<Map<String, String>>>() {});
|
||||||
|
importRow.setVdpthList(vdpthList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解析视频列表JSON失败, rowId: {}", row.getId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (row.getPicpthListJson() != null && !row.getPicpthListJson().isEmpty()) {
|
||||||
|
try {
|
||||||
|
List<Map<String, String>> picpthList = objectMapper.readValue(
|
||||||
|
row.getPicpthListJson(), new TypeReference<List<Map<String, String>>>() {});
|
||||||
|
importRow.setPicpthList(picpthList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解析图片列表JSON失败, rowId: {}", row.getId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (row.getVdpthWarnings() != null && !row.getVdpthWarnings().isEmpty()) {
|
||||||
|
importRow.setVdpthsWarnings(Arrays.asList(row.getVdpthWarnings().split(",")));
|
||||||
|
}
|
||||||
|
if (row.getPicpthWarnings() != null && !row.getPicpthWarnings().isEmpty()) {
|
||||||
|
importRow.setPicpthsWarnings(Arrays.asList(row.getPicpthWarnings().split(",")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("SUCCESS".equals(row.getStatus())) {
|
||||||
|
result.addSuccessRow(importRow);
|
||||||
|
} else {
|
||||||
|
result.addFailedRow(importRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.yfd.platform.data.mapper.ImportTaskRowMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.yfd.platform.data.domain.ImportTaskRow">
|
||||||
|
<id column="ID" property="id"/>
|
||||||
|
<result column="TASK_ID" property="taskId"/>
|
||||||
|
<result column="ROW_INDEX" property="rowIndex"/>
|
||||||
|
<result column="STATUS" property="status"/>
|
||||||
|
<result column="DATA_ID" property="dataId"/>
|
||||||
|
<result column="STCD" property="stcd"/>
|
||||||
|
<result column="STNM" property="stnm"/>
|
||||||
|
<result column="RSTCD" property="rstcd"/>
|
||||||
|
<result column="ENNM" property="ennm"/>
|
||||||
|
<result column="HBRVCD" property="hbrvcd"/>
|
||||||
|
<result column="HBRVNM" property="hbrvnm"/>
|
||||||
|
<result column="RVCD" property="rvcd"/>
|
||||||
|
<result column="BASE_ID" property="baseId"/>
|
||||||
|
<result column="BASE_NAME" property="baseName"/>
|
||||||
|
<result column="STRDT" property="strdt"/>
|
||||||
|
<result column="STRDT_STR" property="strdtStr"/>
|
||||||
|
<result column="ENDDT" property="enddt"/>
|
||||||
|
<result column="FTP" property="ftp"/>
|
||||||
|
<result column="FTP_NAME" property="ftpName"/>
|
||||||
|
<result column="ISFS" property="isfs"/>
|
||||||
|
<result column="DIRECTION" property="direction"/>
|
||||||
|
<result column="FCNT" property="fcnt"/>
|
||||||
|
<result column="FSZ" property="fsz"/>
|
||||||
|
<result column="FWET" property="fwet"/>
|
||||||
|
<result column="WT" property="wt"/>
|
||||||
|
<result column="PICPTH" property="picpth"/>
|
||||||
|
<result column="VDPTH" property="vdpth"/>
|
||||||
|
<result column="TM" property="tm"/>
|
||||||
|
<result column="SOURCE_TYPE" property="sourceType"/>
|
||||||
|
<result column="MOUTH" property="mouth"/>
|
||||||
|
<result column="YR" property="yr"/>
|
||||||
|
<result column="WARNINGS" property="warnings"/>
|
||||||
|
<result column="UNRECOGNIZED_FIELDS" property="unrecognizedFields"/>
|
||||||
|
<result column="VDPTH_LIST_JSON" property="vdpthListJson"/>
|
||||||
|
<result column="PICPTH_LIST_JSON" property="picpthListJson"/>
|
||||||
|
<result column="VDPTH_WARNINGS" property="vdpthWarnings"/>
|
||||||
|
<result column="PICPTH_WARNINGS" property="picpthWarnings"/>
|
||||||
|
<result column="CREATED_AT" property="createdAt"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM IMPORT_TASK_ROW
|
||||||
|
WHERE TASK_ID = #{taskId}
|
||||||
|
ORDER BY ROW_INDEX
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByTaskIdAndStatus" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM IMPORT_TASK_ROW
|
||||||
|
WHERE TASK_ID = #{taskId}
|
||||||
|
AND STATUS = #{status}
|
||||||
|
ORDER BY ROW_INDEX
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByTaskId">
|
||||||
|
DELETE FROM IMPORT_TASK_ROW WHERE TASK_ID = #{taskId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user