feat(icd): 实现标准ICD新增时自动设置自身为参照源功能

- 在添加标准ICD路径时自动填充referenceIcdId字段为自身ID
- 添加fillSelfReferenceForStandardIcd方法处理标准类型ICD的自参照逻辑
- 增加isStandardType方法判断ICD类型是否为标准类型
- 添加单元测试验证手动录入标准ICD和上游解析标准ICD的自参照功能
- 修改应用配置文件中的文件存储路径
- 新增ai-report模块及其子模块的Maven配置
- 移除数据校验服务中已废弃的单个监测点ID字段,统一使用监测点ID列表
- 更新相关实体类、参数类和返回类的数据结构定义
- 修正测试代码中的字段引用和字符编码问题
This commit is contained in:
2026-06-25 07:59:08 +08:00
parent 646b5f3283
commit 0ea686d3cb
44 changed files with 270 additions and 53 deletions

View File

@@ -16,9 +16,6 @@ public class SteadyChecksquareQueryParam implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("监测点 ID")
private String lineId;
@ApiModelProperty("监测点 ID 列表")
private List<String> lineIds;

View File

@@ -23,9 +23,6 @@ public class SteadyChecksquareQueryVO implements Serializable {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("监测点 ID")
private String lineId;
@ApiModelProperty("监测点 ID 列表")
private List<String> lineIds = new ArrayList<String>();

View File

@@ -23,9 +23,6 @@ public class SteadyChecksquareTaskVO implements Serializable {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("监测点 ID")
private String lineId;
@ApiModelProperty("监测点 ID 列表")
private List<String> lineIds;

View File

@@ -195,7 +195,6 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
SteadyChecksquareQueryVO result = new SteadyChecksquareQueryVO();
result.setTaskId(task.getId());
result.setTaskNo(task.getTaskNo());
result.setLineId(task.getLineId());
result.setLineIds(readTaskLineIds(task));
result.setLineName(task.getLineName());
result.setTimeStart(formatTime(task.getTimeStart()));
@@ -328,7 +327,6 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
indicatorCodes = parseTextListSearchValue(task.getIndicatorCodesText());
}
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId(lineIds.isEmpty() ? task.getLineId() : lineIds.get(0));
param.setLineIds(lineIds);
param.setIndicatorCodes(indicatorCodes);
param.setTimeStart(formatTime(task.getTimeStart()));
@@ -392,7 +390,6 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
Map<String, AddLedgerLinePathVO> linePathMap = requireLinePaths(lineIds);
int intervalMinutes = resolveIntervalMinutes(linePathMap.get(lineIds.get(0)));
SteadyChecksquareQueryVO result = new SteadyChecksquareQueryVO();
result.setLineId(lineIds.get(0));
result.setLineIds(new ArrayList<String>(lineIds));
result.setLineName(buildLineNames(lineIds, linePathMap));
result.setTimeStart(param.getTimeStart());
@@ -506,9 +503,9 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
if (trimToNull(taskId) == null) {
task.setTaskNo(SteadyChecksquareIdUtil.taskNo());
}
task.setLineId(result.getLineId());
task.setLineName(result.getLineName());
List<String> lineIds = resolveResultLineIds(result);
task.setLineId(lineIds.isEmpty() ? null : lineIds.get(0));
task.setLineName(result.getLineName());
task.setLineIdsJson(writeJson(lineIds));
task.setLineIdsText(buildTextListSearchValue(lineIds));
task.setTimeStart(parseRequiredTime(result.getTimeStart(), "开始时间不能为空"));
@@ -1202,7 +1199,6 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
SteadyChecksquareTaskVO vo = new SteadyChecksquareTaskVO();
vo.setTaskId(task.getId());
vo.setTaskNo(task.getTaskNo());
vo.setLineId(task.getLineId());
vo.setLineIds(readTaskLineIds(task));
vo.setLineName(task.getLineName());
vo.setTimeStart(formatTime(task.getTimeStart()));
@@ -1431,11 +1427,7 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
}
private List<String> resolveLineIds(SteadyChecksquareQueryParam param) {
List<String> lineIds = normalizeTextList(param == null ? null : param.getLineIds());
if (lineIds.isEmpty() && param != null && trimToNull(param.getLineId()) != null) {
lineIds.add(trimToNull(param.getLineId()));
}
return lineIds;
return normalizeTextList(param == null ? null : param.getLineIds());
}
private List<String> resolveIndicatorCodes(SteadyChecksquareQueryParam param) {
@@ -1451,11 +1443,7 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
}
private List<String> resolveResultLineIds(SteadyChecksquareQueryVO result) {
List<String> lineIds = normalizeTextList(result == null ? null : result.getLineIds());
if (lineIds.isEmpty() && result != null && trimToNull(result.getLineId()) != null) {
lineIds.add(trimToNull(result.getLineId()));
}
return lineIds;
return normalizeTextList(result == null ? null : result.getLineIds());
}
private List<String> readTaskLineIds(SteadyChecksquareTaskPO task) {
@@ -1469,7 +1457,6 @@ public class SteadyChecksquareServiceImpl implements SteadyChecksquareService {
private SteadyChecksquareQueryParam copyCreateParam(SteadyChecksquareQueryParam param, List<String> indicatorCodes) {
SteadyChecksquareQueryParam result = new SteadyChecksquareQueryParam();
List<String> lineIds = resolveLineIds(param);
result.setLineId(lineIds.isEmpty() ? null : lineIds.get(0));
result.setLineIds(new ArrayList<String>(lineIds));
result.setIndicatorCodes(new ArrayList<String>(indicatorCodes));
result.setTimeStart(param.getTimeStart());

View File

@@ -56,5 +56,7 @@ class SteadyChecksquareControllerTest {
resultType.getActualTypeArguments()[0]);
Assertions.assertThrows(NoSuchFieldException.class,
() -> com.njcn.gather.steady.checksquare.pojo.vo.SteadyChecksquareTaskVO.class.getDeclaredField("items"));
Assertions.assertThrows(NoSuchFieldException.class,
() -> com.njcn.gather.steady.checksquare.pojo.vo.SteadyChecksquareTaskVO.class.getDeclaredField("lineId"));
}
}

View File

@@ -12,7 +12,8 @@ class SteadyChecksquareQueryParamTest {
@Test
void shouldOnlyExposeChecksquareQueryFields() {
Assertions.assertNotNull(field("lineId"));
Assertions.assertNull(field("lineId"));
Assertions.assertNotNull(field("lineIds"));
Assertions.assertNotNull(field("indicatorCodes"));
Assertions.assertNotNull(field("timeStart"));
Assertions.assertNotNull(field("timeEnd"));

View File

@@ -61,7 +61,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* 鏁版嵁鏍¢獙鏈嶅姟娴嬭瘯? */
* 鏁版嵁鏍¢獙鏈嶅姟娴嬭瘯<EFBFBD>? */
class SteadyChecksquareServiceImplTest {
@BeforeAll
@@ -102,7 +102,7 @@ class SteadyChecksquareServiceImplTest {
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-08 00:01:00");
@@ -147,7 +147,7 @@ class SteadyChecksquareServiceImplTest {
ArgumentCaptor<SteadyChecksquareTaskPO> taskCaptor = ArgumentCaptor.forClass(SteadyChecksquareTaskPO.class);
when(taskService.save(taskCaptor.capture())).thenReturn(true);
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Arrays.asList("V_RMS", "V_LINE_RMS", "FREQ", "I_RMS", "I_THD"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-03 23:59:00");
@@ -190,7 +190,7 @@ class SteadyChecksquareServiceImplTest {
mock(SteadyChecksquareItemService.class), mock(SteadyChecksquareStatSummaryService.class),
mock(SteadyChecksquareDetailService.class), new ObjectMapper());
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("I_RMS"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -238,7 +238,7 @@ class SteadyChecksquareServiceImplTest {
ArgumentCaptor<SteadyChecksquareTaskPO> taskCaptor = ArgumentCaptor.forClass(SteadyChecksquareTaskPO.class);
when(taskService.save(taskCaptor.capture())).thenReturn(true);
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -326,7 +326,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(emptyHarmonicParityRuleResult());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -339,7 +339,7 @@ class SteadyChecksquareServiceImplTest {
LocalDateTime.of(2026, 5, 1, 0, 0))));
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Arrays.asList("FLUC", "PST", "PLT"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 02:00:00");
@@ -379,7 +379,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(new HashSet<LocalDateTime>());
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.<String>emptyList());
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -414,7 +414,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(emptyHarmonicParityRuleResult());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -423,7 +423,7 @@ class SteadyChecksquareServiceImplTest {
LocalDateTime.of(2026, 5, 1, 0, 0))));
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_HARMONIC"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -453,7 +453,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(emptyHarmonicParityRuleResult());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -477,7 +477,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(normalRuleResult);
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_HARMONIC"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -507,7 +507,7 @@ class SteadyChecksquareServiceImplTest {
mock(SteadyChecksquareDetailService.class), new ObjectMapper());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -525,7 +525,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(ruleResult);
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -556,7 +556,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(emptyHarmonicParityRuleResult());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -565,7 +565,7 @@ class SteadyChecksquareServiceImplTest {
LocalDateTime.of(2026, 5, 1, 0, 0))));
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Arrays.asList("V_RMS", "V_LINE_RMS"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -603,7 +603,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(emptyRuleResult());
AddLedgerLinePathVO linePath = new AddLedgerLinePathVO();
linePath.setLineId("line-001");
linePath.setLineName("杩涚嚎涓");
linePath.setLineName("杩涚嚎涓<EFBFBD>?);
linePath.setLineInterval(1);
when(addLedgerService.listLinePathByLineIds(eq(Collections.singletonList("line-001"))))
.thenReturn(Collections.singletonMap("line-001", linePath));
@@ -623,7 +623,7 @@ class SteadyChecksquareServiceImplTest {
.thenReturn(ruleResult);
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setLineId("line-001");
param.setLineIds(Collections.singletonList("line-001"));
param.setIndicatorCodes(Collections.singletonList("V_HARMONIC"));
param.setTimeStart("2026-05-01 00:00:00");
param.setTimeEnd("2026-05-01 00:01:00");
@@ -665,7 +665,7 @@ class SteadyChecksquareServiceImplTest {
task.setId("task-001");
task.setState(1);
task.setLineId("line-001");
task.setLineName("杩涚嚎涓");
task.setLineName("杩涚嚎涓<EFBFBD>?);
task.setTimeStart(LocalDateTime.of(2026, 5, 1, 0, 0));
task.setTimeEnd(LocalDateTime.of(2026, 5, 1, 0, 1));
task.setIntervalMinutes(1);
@@ -850,8 +850,8 @@ class SteadyChecksquareServiceImplTest {
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
SteadyChecksquareQueryVO result = new SteadyChecksquareQueryVO();
result.setLineId("line-001");
result.setLineName("杩涚嚎涓");
result.setLineIds(Collections.singletonList("line-001"));
result.setLineName("杩涚嚎涓<EFBFBD>?);
result.setTimeStart("2026-05-01 00:00:00");
result.setTimeEnd("2026-05-01 00:01:00");
result.setIntervalMinutes(1);
@@ -860,7 +860,7 @@ class SteadyChecksquareServiceImplTest {
item.setLineId("line-001");
item.setLineName("line-001-name");
item.setIndicatorCode("V_RMS");
item.setIndicatorName("鐩哥數鍘嬫湁鏁堝?");
item.setIndicatorName("鐩哥數鍘嬫湁鏁堝<EFBFBD>?");
item.setIntervalMinutes(1);
item.setHasData(true);
item.setExpectedPointCount(2);
@@ -909,7 +909,7 @@ class SteadyChecksquareServiceImplTest {
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
SteadyChecksquareQueryVO result = new SteadyChecksquareQueryVO();
result.setLineId("line-001");
result.setLineIds(Collections.singletonList("line-001"));
result.setLineName("line-001");
result.setTimeStart("2026-05-01 00:00:00");
result.setTimeEnd("2026-05-01 00:01:00");
@@ -942,8 +942,8 @@ class SteadyChecksquareServiceImplTest {
SteadyChecksquareQueryParam param = new SteadyChecksquareQueryParam();
param.setIndicatorCodes(Collections.singletonList("V_RMS"));
SteadyChecksquareQueryVO result = new SteadyChecksquareQueryVO();
result.setLineId("line-001");
result.setLineName("杩涚嚎涓");
result.setLineIds(Collections.singletonList("line-001"));
result.setLineName("杩涚嚎涓<EFBFBD>?);
result.setTimeStart("2026-05-01 00:00:00");
result.setTimeEnd("2026-05-01 00:01:00");
result.setIntervalMinutes(1);