|
@@ -0,0 +1,132 @@
|
|
|
+package com.persagy.dmp.rwd.edit;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
+import com.persagy.common.criteria.JacksonCriteria;
|
|
|
+import com.persagy.common.json.JacksonMapper;
|
|
|
+import com.persagy.common.web.ListResponse;
|
|
|
+import com.persagy.common.web.MapResponse;
|
|
|
+import com.persagy.common.web.PagedResponse;
|
|
|
+import com.persagy.dmp.rwd.edit.entity.FuncidDefChangeRecord;
|
|
|
+import com.persagy.dmp.rwd.edit.enumeration.EnumOperationType;
|
|
|
+import com.persagy.dmp.rwd.edit.service.FuncidDefChangeRecordService;
|
|
|
+import com.persagy.dmp.rwd.edit.service.FuncidDefService;
|
|
|
+import com.persagy.dmp.rwd.enums.FuncidCategory;
|
|
|
+import com.persagy.dmp.rwd.enums.FuncidDataType;
|
|
|
+import com.persagy.dmp.rwd.model.FuncidDefModel;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@SpringBootTest
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+public class FuncidDefTest {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FuncidDefService funcidDefService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FuncidDefChangeRecordService funcidDefChangeRecordService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询信息点数据
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void queryFuncid() {
|
|
|
+ JacksonCriteria criteria = JacksonCriteria.newInstance();
|
|
|
+ criteria.add("classCode", "FFSC");
|
|
|
+ criteria.add("type", "common");
|
|
|
+ ListResponse<FuncidDefModel> response = funcidDefService.queryFuncid(criteria);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(response));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询信息点变更记录
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void query() {
|
|
|
+ JacksonCriteria criteria = JacksonCriteria.newInstance();
|
|
|
+ criteria.add("type", "common");
|
|
|
+ PagedResponse<FuncidDefChangeRecord> query = funcidDefChangeRecordService.query(criteria);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(query));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建信息点变更记录
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void create() {
|
|
|
+ FuncidDefChangeRecord param = new FuncidDefChangeRecord();
|
|
|
+ param.setCode("funcid01");
|
|
|
+ param.setGroupCode("0");
|
|
|
+ param.setProjectId("0");
|
|
|
+ param.setName("funcid01");
|
|
|
+ param.setAliasCode("funcid01");
|
|
|
+ param.setAliasName("funcid01");
|
|
|
+ param.setClassCode("ACCH");
|
|
|
+ param.setCategory(FuncidCategory.STATIC);
|
|
|
+ param.setType("common");
|
|
|
+ param.setFirstTag("1");
|
|
|
+ param.setSecondTag("2");
|
|
|
+ param.setPriority("S");
|
|
|
+ param.setInputMode("A2");
|
|
|
+ param.setUnit("m");
|
|
|
+ param.setDataType(FuncidDataType.INTEGER);
|
|
|
+ param.setIsMultiple(false);
|
|
|
+ param.setIsRegion(false);
|
|
|
+ ArrayNode dataSource = JacksonMapper.toObject("[{$gt:10, $lt:50}]", ArrayNode.class);
|
|
|
+ param.setDataSource(dataSource);
|
|
|
+ param.setNote("备注");
|
|
|
+ param.setSubFlag(false);
|
|
|
+ param.setWeakPoint(false);
|
|
|
+ param.setOperationType(EnumOperationType.create);
|
|
|
+ MapResponse response = funcidDefChangeRecordService.create(param);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(response));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改信息点变更记录
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void update() {
|
|
|
+ FuncidDefChangeRecord param = new FuncidDefChangeRecord();
|
|
|
+ param.setId(24);
|
|
|
+ param.setCode("funcid01");
|
|
|
+ param.setFirstTag("111");
|
|
|
+ param.setSecondTag("222");
|
|
|
+ param.setAliasCode("funcid01");
|
|
|
+ param.setAliasName("funcid01");
|
|
|
+ param.setNote("备注");
|
|
|
+ MapResponse response = funcidDefChangeRecordService.update(param);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(response));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 信息点变更记录添加版本
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void addVersion() {
|
|
|
+ String version = "1.0.1";
|
|
|
+ List<Integer> idList = new ArrayList<>();
|
|
|
+ idList.add(24);
|
|
|
+ MapResponse response = funcidDefChangeRecordService.addVersion(version, idList);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(response));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除信息点变更记录
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void delete() {
|
|
|
+ FuncidDefChangeRecord param = new FuncidDefChangeRecord();
|
|
|
+ param.setId(24);
|
|
|
+ MapResponse response = funcidDefChangeRecordService.delete(param);
|
|
|
+ System.err.println(JacksonMapper.toFormatJson(response));
|
|
|
+ }
|
|
|
+}
|