Przeglądaj źródła

1021 实体修改

zhaoyk 3 lat temu
rodzic
commit
6abcdfb1b4

+ 2 - 0
src/main/java/com/persagy/bdtp/adm/entity/AdmRelsConfig.java

@@ -23,6 +23,8 @@ public class AdmRelsConfig extends BaseAdmEntity {
 
     private String classCodeTo;
 
+    private String direction;
+
     private String flag;
 
 }

+ 1 - 1
src/main/java/com/persagy/bdtp/adm/service/impl/AdmObjectServiceImpl.java

@@ -58,7 +58,7 @@ public class AdmObjectServiceImpl extends ServiceImpl<AdmObjectMapper, AdmObject
 	@Override
 	public List<AdmObject> queryM2dByObjType(String projectId, String objType) {
 		QueryWrapper<AdmObject> queryWrapper = new QueryWrapper<>();
-		queryWrapper.in("project_id", projectId).eq("obj_type", objType).isNull("client_id");
+		queryWrapper.eq("project_id", projectId).eq("obj_type", objType).isNull("client_id");
 		return admObjMapper.selectList(queryWrapper);
 	}
 

+ 4 - 1
src/main/resources/bootstrap.yml

@@ -43,4 +43,7 @@ persagy:
 #      service: http://82.157.159.41/dmp-rwd
     dic:
       service: http://develop.persagy.com/dmp-dic
-#      service: http://82.157.159.41/dmp-dic
+#      service: http://82.157.159.41/dmp-dic
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 32 - 7
src/test/java/com/persagy/bdtp/adm/test/AdmApplicationTests.java

@@ -1,6 +1,7 @@
 package com.persagy.bdtp.adm.test;
 
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -20,6 +21,7 @@ import org.springframework.core.io.Resource;
 import org.springframework.core.io.ResourceLoader;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.io.File;
 import java.util.*;
 
 @RunWith(SpringRunner.class)
@@ -51,7 +53,7 @@ public class AdmApplicationTests {
 
 	@Test
 	public void testMq(){
-		AdmObject obj = admObjectMapper.selectOne(new QueryWrapper<AdmObject>().eq("id", "Eq00022200023a8d5a59a7fb49a89dfa6ae746518bc2"));
+		AdmObject obj = admObjectMapper.selectOne(new QueryWrapper<AdmObject>().eq("id", "Eq000222001100a450f006274c85811a13ee0650bd94"));
 		obj.getInfos().put("comp_type", "FFFAAL-声光报警器");
 		D2mMessage msg = new D2mMessage();
 		msg.setAddItems(Arrays.asList(obj));
@@ -94,7 +96,7 @@ public class AdmApplicationTests {
 	private AdmRelsConfigMapper relsConfigMapper;
 	@Test
 	public void testRelsCfg(){
-		String type = "ac";
+		String type = "ff";
 		relsConfigMapper.delete(new QueryWrapper<AdmRelsConfig>().eq("flag", type));
 		List<AdmRelsConfig> list = new RelCfgs().read(type);
 		for(AdmRelsConfig item : list) {
@@ -107,7 +109,7 @@ public class AdmApplicationTests {
 	private AdmPipeConfigMapper pipeConfigMapper;
 	@Test
 	public void testPipeCfg(){
-		String type = "ac";
+		String type = "ff";
 		pipeConfigMapper.delete(new QueryWrapper<AdmPipeConfig>().eq("flag", type));
 		List<AdmPipeConfig> list = new PipeCfgs().read(type);
 		for(AdmPipeConfig item : list) {
@@ -205,10 +207,33 @@ public class AdmApplicationTests {
 	}
 
 	@Test
-	public void testAdmObject(){
-		try{
-			admObjectMapper.selectList(new QueryWrapper<AdmObject>());
-		}catch (Exception e) {
+	public void setRelCfgDirection(){
+		try {
+			List<Map> relDef = objectMapper.readValue(new File("D:\\work_area\\adm_1015\\rel_def.json"), List.class);
+			List<AdmRelsConfig> cfgs = relsConfigMapper.selectList(null);
+			for (AdmRelsConfig cfg : cfgs) {
+				for(Map def : relDef) {
+					if(cfg.getGraphCode().equals(def.get("graphCode")) && cfg.getRelCode().equals(def.get("code"))) {
+						int d = ((Number)def.get("directional")).intValue();
+						if(d == 0)
+							cfg.setDirection("none");
+						else if(d == 1) {
+							String target = (String) def.get("targetObjs");
+							if(StrUtil.isNotBlank(target) && target.indexOf('→') > 0)
+								cfg.setDirection("fixed");
+							else
+								cfg.setDirection("optional");
+						}
+						break;
+					}
+				}
+
+				if(cfg.getDirection() == null)
+					cfg.setDirection("optional");
+
+				relsConfigMapper.updateById(cfg);
+			}
+		} catch (Exception e) {
 
 		}
 	}