feat(mms-mapping): 添加ICD校验结果保存功能支持文件上传
- 在CsIcdPathController中添加POST接口支持multipart表单上传ICD文件 - 实现saveIcdCheckResultWithFile方法处理文件上传和校验结果保存 - 添加fillIcdFile方法处理ICD文件内容填充到参数对象 - 在CsIcdPathPO中将Icd_Content字段重命名为Icd并使用JsonNodeTypeHandler处理JSON转换 - 更新resultMap配置使用新的字段映射关系 - 修改ICD一致性校验服务的日志记录和校验逻辑 - 移除自动修正映射差异的功能,只保留一致性检查 - 优化测试用例验证ICD校验结果保存和文件上传功能
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.njcn.gather.steady.checksquare.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.gather.steady.checksquare.component.SteadyChecksquareCalculator;
|
||||
@@ -32,8 +34,11 @@ import com.njcn.gather.tool.adddata.component.AddDataTimeSlotCalculator;
|
||||
import com.njcn.gather.tool.addledger.pojo.vo.AddLedgerLinePathVO;
|
||||
import com.njcn.gather.tool.addledger.service.AddLedgerService;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.apache.ibatis.builder.MapperBuilderAssistant;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -58,6 +63,14 @@ import static org.mockito.Mockito.when;
|
||||
* 鏁版嵁鏍¢獙鏈嶅姟娴嬭瘯銆? */
|
||||
class SteadyChecksquareServiceImplTest {
|
||||
|
||||
@BeforeAll
|
||||
static void initMybatisPlusTableInfo() {
|
||||
MapperBuilderAssistant assistant = new MapperBuilderAssistant(new Configuration(), "");
|
||||
TableInfoHelper.initTableInfo(assistant, SteadyChecksquareTaskPO.class);
|
||||
TableInfoHelper.initTableInfo(assistant, SteadyChecksquareItemPO.class);
|
||||
TableInfoHelper.initTableInfo(assistant, SteadyChecksquareDetailPO.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotOpenTransactionAroundCreateCalculation() throws Exception {
|
||||
Method createMethod = SteadyChecksquareServiceImpl.class.getMethod("create", SteadyChecksquareQueryParam.class);
|
||||
@@ -72,7 +85,7 @@ class SteadyChecksquareServiceImplTest {
|
||||
LambdaQueryChainWrapper<SteadyChecksquareTaskPO> taskQuery = mock(LambdaQueryChainWrapper.class);
|
||||
when(taskService.lambdaQuery()).thenReturn(taskQuery);
|
||||
when(taskQuery.eq(any(), any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any(SFunction.class))).thenReturn(taskQuery);
|
||||
when(taskQuery.list()).thenReturn(Collections.emptyList());
|
||||
SteadyChecksquareServiceImpl service = new SteadyChecksquareServiceImpl(new SteadyTrendIndicatorCatalog(),
|
||||
mock(SteadyChecksquareInfluxQueryComponent.class), new SteadyChecksquareCalculator(),
|
||||
@@ -110,7 +123,7 @@ class SteadyChecksquareServiceImplTest {
|
||||
LambdaQueryChainWrapper<SteadyChecksquareTaskPO> taskQuery = mock(LambdaQueryChainWrapper.class);
|
||||
when(taskService.lambdaQuery()).thenReturn(taskQuery);
|
||||
when(taskQuery.eq(any(), any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any(SFunction.class))).thenReturn(taskQuery);
|
||||
when(taskQuery.list()).thenReturn(Collections.emptyList());
|
||||
SteadyChecksquareServiceImpl service = new SteadyChecksquareServiceImpl(new SteadyTrendIndicatorCatalog(),
|
||||
influxQueryComponent, new SteadyChecksquareCalculator(),
|
||||
@@ -165,7 +178,7 @@ class SteadyChecksquareServiceImplTest {
|
||||
task.setState(1);
|
||||
when(taskService.lambdaQuery()).thenReturn(taskQuery);
|
||||
when(taskQuery.eq(any(), any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any(SFunction.class))).thenReturn(taskQuery);
|
||||
when(taskQuery.list()).thenReturn(Collections.singletonList(task));
|
||||
SteadyChecksquareServiceImpl service = new SteadyChecksquareServiceImpl(new SteadyTrendIndicatorCatalog(),
|
||||
mock(SteadyChecksquareInfluxQueryComponent.class), new SteadyChecksquareCalculator(),
|
||||
@@ -200,7 +213,7 @@ class SteadyChecksquareServiceImplTest {
|
||||
LambdaQueryChainWrapper<SteadyChecksquareTaskPO> taskQuery = mock(LambdaQueryChainWrapper.class);
|
||||
when(taskService.lambdaQuery()).thenReturn(taskQuery);
|
||||
when(taskQuery.eq(any(), any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any())).thenReturn(taskQuery);
|
||||
when(taskQuery.orderByDesc(any(SFunction.class))).thenReturn(taskQuery);
|
||||
when(taskQuery.list()).thenReturn(Collections.emptyList());
|
||||
SteadyChecksquareServiceImpl service = new SteadyChecksquareServiceImpl(new SteadyTrendIndicatorCatalog(),
|
||||
influxQueryComponent, new SteadyChecksquareCalculator(),
|
||||
@@ -660,7 +673,7 @@ class SteadyChecksquareServiceImplTest {
|
||||
SteadyChecksquareItemVO item = new SteadyChecksquareItemVO();
|
||||
item.setItemKey("line-001|V_RMS");
|
||||
item.setIndicatorCode("V_RMS");
|
||||
item.setIndicatorName("鐩哥數鍘嬫湁鏁堝€?);
|
||||
item.setIndicatorName("鐩哥數鍘嬫湁鏁堝€?");
|
||||
item.setIntervalMinutes(1);
|
||||
item.setHasData(true);
|
||||
item.setExpectedPointCount(2);
|
||||
|
||||
Reference in New Issue
Block a user