不续检时清空原始数据和结果数据
This commit is contained in:
@@ -42,6 +42,7 @@ import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
|||||||
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
|
import com.njcn.gather.storage.service.TableGenService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
@@ -82,6 +83,7 @@ public class SocketDevResponseService {
|
|||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
private final IPqSourceService pqSourceService;
|
private final IPqSourceService pqSourceService;
|
||||||
private final IResultService resultService;
|
private final IResultService resultService;
|
||||||
|
private final TableGenService tableGenService;
|
||||||
|
|
||||||
@Value("${dataCheck.enable}")
|
@Value("${dataCheck.enable}")
|
||||||
private Boolean dataCheck;
|
private Boolean dataCheck;
|
||||||
@@ -1178,6 +1180,7 @@ public class SocketDevResponseService {
|
|||||||
sourceIssues = groupedIssues.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
sourceIssues = groupedIssues.values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||||
if (!param.isResumeFormal() && CollUtil.isNotEmpty(sourceIssues)) {
|
if (!param.isResumeFormal() && CollUtil.isNotEmpty(sourceIssues)) {
|
||||||
iPqDevService.clearFormalProgressForNewRun(param.getDevIds());
|
iPqDevService.clearFormalProgressForNewRun(param.getDevIds());
|
||||||
|
tableGenService.clearAdData(param.getCode());
|
||||||
}
|
}
|
||||||
SocketManager.addSourceList(sourceIssues);
|
SocketManager.addSourceList(sourceIssues);
|
||||||
Map<String, Long> sourceIssueMap = sourceIssues.stream()
|
Map<String, Long> sourceIssueMap = sourceIssues.stream()
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ public interface TableGenService {
|
|||||||
|
|
||||||
void genTable(String code, boolean isContrast);
|
void genTable(String code, boolean isContrast);
|
||||||
|
|
||||||
|
void clearAdData(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除表 (包括谐波表、谐波结果表、非谐波表、非谐波结果表)
|
* 批量删除表 (包括谐波表、谐波结果表、非谐波表、非谐波结果表)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ public class TableGenServiceImpl implements TableGenService {
|
|||||||
|
|
||||||
private final TableGenMapper tableGenMapper;
|
private final TableGenMapper tableGenMapper;
|
||||||
|
|
||||||
|
private static final String[] AD_TABLE_PREFIXES = {
|
||||||
|
"ad_non_harmonic_result_",
|
||||||
|
"ad_harmonic_result_",
|
||||||
|
"ad_non_harmonic_",
|
||||||
|
"ad_harmonic_"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void genTable(String code, boolean isContrast) {
|
public void genTable(String code, boolean isContrast) {
|
||||||
@@ -94,6 +101,20 @@ public class TableGenServiceImpl implements TableGenService {
|
|||||||
tableGenMapper.genAdHarmonicTable("CREATE INDEX idx_ad_harmonic_result_" + code + "_dev_monitor_id" + " ON ad_harmonic_result_" + code + " (Dev_Monitor_Id);");
|
tableGenMapper.genAdHarmonicTable("CREATE INDEX idx_ad_harmonic_result_" + code + "_dev_monitor_id" + " ON ad_harmonic_result_" + code + " (Dev_Monitor_Id);");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearAdData(String code) {
|
||||||
|
checkTableSuffix(code);
|
||||||
|
for (String prefix : AD_TABLE_PREFIXES) {
|
||||||
|
tableGenMapper.genAdHarmonicTable("DELETE FROM " + prefix + code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkTableSuffix(String code) {
|
||||||
|
if (code == null || !code.matches("[A-Za-z0-9_]+")) {
|
||||||
|
throw new IllegalArgumentException("Invalid table suffix: " + code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteTable(List<String> codeList) {
|
public void deleteTable(List<String> codeList) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user