|
|
@@ -57,9 +57,6 @@ public class EdsExtra {
|
|
|
return;
|
|
|
}
|
|
|
long randomLong = RandomUtil.randomLong(5, 50);
|
|
|
- //GovExecPool.PROGRESS_EXC.execute(() -> {
|
|
|
- // edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 1, 4, randomLong + "", ""));
|
|
|
- //});
|
|
|
//取包文件名
|
|
|
String filename = dto.getFileName();
|
|
|
//计算解压目录并解压
|
|
|
@@ -67,7 +64,6 @@ public class EdsExtra {
|
|
|
Path zipEtrDir = zipPathParent.resolve(filename.substring(0, filename.length() - Eds.ZIP.length()));
|
|
|
if (!Eds.unBcpZip(zipPath, zipEtrDir.toString(), filename)) {
|
|
|
String errMsg = StrUtil.format("数据包[{}]无法解析:压缩包损坏无法解压。", filename);
|
|
|
- //edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 3, 5, "100", errMsg));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -76,7 +72,6 @@ public class EdsExtra {
|
|
|
//确认索引文件存在
|
|
|
if (!Files.exists(xmlPath)) {
|
|
|
String errMsg = StrUtil.format("数据包[{}]无法解析:基本信息文件不存在。", filename);
|
|
|
- //edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 3, 5, "100", errMsg));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -84,15 +79,10 @@ public class EdsExtra {
|
|
|
Message xmlMessage = (Message) xStream.fromXML(xmlPath.toFile());
|
|
|
xmlMessage.setBcpDirPath(zipEtrDir);
|
|
|
xmlMessage.setSeparator("`");
|
|
|
- //GovExecPool.PROGRESS_EXC.execute(() -> {
|
|
|
- // edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 1, 4, "55", ""));
|
|
|
- //});
|
|
|
-
|
|
|
//读取基础信息数据
|
|
|
List<EdsMforensics010100> baseInfoList = xmlMessage.getBcpDataByCls(PojoConstant.EDS_010100_CLASS);
|
|
|
if (CollUtil.isEmpty(baseInfoList)) {
|
|
|
String errMsg = StrUtil.format("数据包[{}]无法解析:基本信息转换错误。", filename);
|
|
|
- //edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 3, 5, "100", errMsg));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -100,7 +90,6 @@ public class EdsExtra {
|
|
|
String ctId = wm0101.getCollectTargetId();
|
|
|
if (StrUtil.isBlank(ctId)) {
|
|
|
String errMsg = StrUtil.format("数据包[{}]无法解析:采集编号不存在。", filename);
|
|
|
- //edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 3, 5, "100", errMsg));
|
|
|
return;
|
|
|
}
|
|
|
//清洗采集编号
|
|
|
@@ -108,7 +97,6 @@ public class EdsExtra {
|
|
|
//校验采集编号
|
|
|
if (!verifyProcessStep(baseInfoList.size(), ctId, dto.getCaseId())) {
|
|
|
String errMsg = StrUtil.format("数据包[{}]:采集编号异常或数据包已提取。", filename);
|
|
|
- //edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 3, 5, "100", errMsg));
|
|
|
return;
|
|
|
}
|
|
|
dto.setCti(ctId);
|
|
|
@@ -119,14 +107,6 @@ public class EdsExtra {
|
|
|
xmlMessage.setCaseId(dto.getCaseId());
|
|
|
xmlMessage.setEfd(dto);
|
|
|
long randomLong1 = RandomUtil.randomLong(56, 70);
|
|
|
- //GlobalPool.PROGRESS_EXC.execute(() -> {
|
|
|
- // edsImportListMapper.updateById(new EdsImportList(dto.getImportId(), 1, 4, randomLong1 + "", ""));
|
|
|
- //});
|
|
|
-// // 非结构数据上传
|
|
|
-// EdsImportList data = new EdsImportList();
|
|
|
-// data.setFilename(zipEtrDir.toString());
|
|
|
-// data.setEdsCti(ctId);
|
|
|
-// messageOperations.addMessage("UNSTRUCTURED_DATA_STORAGE", data);
|
|
|
//解析数据并批量入库
|
|
|
Long dataCount = dataStorage(xmlMessage);
|
|
|
}
|
|
|
@@ -142,8 +122,6 @@ public class EdsExtra {
|
|
|
stringRedisTemplate.opsForValue().set(key, String.valueOf(dataInfoSize));
|
|
|
int progress = 70;
|
|
|
ExtraFileDTO efd = xmlMessage.getEfd();
|
|
|
-
|
|
|
-// EdsImportList importList = messageOperations.readMessage("UNSTRUCTURED_DATA_STORAGE");
|
|
|
//逐个数据集提取
|
|
|
for (DataInfo dataInfo : dataInfoList) {
|
|
|
log.info("开始提取bcp数据:{}", dataInfo.getTableName());
|
|
|
@@ -181,7 +159,6 @@ public class EdsExtra {
|
|
|
//逐文件读取解析
|
|
|
for (Path path : bcpList) {
|
|
|
try {
|
|
|
-// if(!path.toString().contains("090300")) continue;
|
|
|
readFile(path, dataProcess);
|
|
|
} catch (Exception e) {
|
|
|
log.error("提取文件[{}],错误", path, e);
|
|
|
@@ -213,15 +190,12 @@ public class EdsExtra {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public boolean verifyProcessStep(Integer num, String ctId, Long caseId) {
|
|
|
|
|
|
//校验采集编号长度与基础信息数量
|
|
|
if (ctId.length() < 37 || ctId.length() > 69 || num == 0) {
|
|
|
log.error("包:{},基本信息采集编号异常或基本信息表不存在, 无法解析", ctId);
|
|
|
return false;
|
|
|
- //moveAndClearErrorZip(zipFile, zipExtractDir, filename,importList, "基本信息采集编号异常, 无法解析", errorDir);
|
|
|
}
|
|
|
|
|
|
//确认采集编号未被导入
|
|
|
@@ -230,10 +204,8 @@ public class EdsExtra {
|
|
|
return count <= 0;
|
|
|
} catch (Exception e) {
|
|
|
log.error("包:{},基本信息采集编号异常或基本信息表不存在, 无法解析", ctId);
|
|
|
- return false;
|
|
|
}
|
|
|
-
|
|
|
- //return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -244,7 +216,6 @@ public class EdsExtra {
|
|
|
*/
|
|
|
public void finish(ExtraFileDTO dto) {
|
|
|
Eds.delZip(dto.getBcpDir(), dto.getZipPath());
|
|
|
- //GovExecPool.EXC.execute(() -> Bcp.createZip(dto.getBcpDir(), dto.getUserAcnt()));
|
|
|
String errMsg = StrUtil.format("数据包[{}]:已提取完成。", dto.getFileName());
|
|
|
String dataCnt = EtlRedisKey.BCP_DATA_CNT + dto.getCti();
|
|
|
String dataSet = EtlRedisKey.BCP_DATA_SET + dto.getCti();
|