소스 검색

增加顔色区分

DESKTOP-2K9OVK9\siwei 5 달 전
부모
커밋
8a96c95789

+ 6 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/dimentity/DimEntityController.java

@@ -34,6 +34,12 @@ public class DimEntityController {
         return RequestResult.success(dimEntityService.queryEntityRelationshipToNeo4j(entityid));
     }
 
+    @GetMapping("/entity/color")
+    public RequestResult queryEntityColor() {
+        return RequestResult.success(dimEntityService.queryEntityColor());
+    }
+
+
     @GetMapping("/entity/add/relationship")
     public RequestResult addEntityRelationship(EntityRelationshipToNeo4jVo entityRelationshipToNeo4jVo) {
         if (entityRelationshipToNeo4jVo == null) {

+ 118 - 83
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/dimentity/TEntityCodeTable.java

@@ -7,199 +7,234 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 实体编码表对象 t_entity_code_table
- * 
+ *
  * @author zhx
  * @date 2024-12-27
  */
-public class TEntityCodeTable extends BaseEntity
-{
+public class TEntityCodeTable extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /**
+     * id
+     */
     private String id;
 
-    /** 实体门类 */
+    /**
+     * 实体门类
+     */
     @Excel(name = "实体门类")
     private String category;
 
-    /** 一级分类码 */
+    /**
+     * 一级分类码
+     */
     @Excel(name = "一级分类码")
     private String firstcode;
 
-    /** 一级分类名 */
+    /**
+     * 一级分类名
+     */
     @Excel(name = "一级分类名")
     private String firstcodename;
 
-    /** 二级分类码 */
+    /**
+     * 二级分类码
+     */
     @Excel(name = "二级分类码")
     private String twocode;
 
-    /** 二级分类名 */
+    /**
+     * 二级分类名
+     */
     @Excel(name = "二级分类名")
     private String twocodename;
 
-    /** 三级分类码 */
+    /**
+     * 三级分类码
+     */
     @Excel(name = "三级分类码")
     private String threecode;
 
-    /** 三级分类名 */
+    /**
+     * 三级分类名
+     */
     @Excel(name = "三级分类名")
     private String threecodename;
 
-    /** 四级分类码 */
+    /**
+     * 四级分类码
+     */
     @Excel(name = "四级分类码")
     private String fourcode;
 
-    /** 四级分类名 */
+    /**
+     * 四级分类名
+     */
     @Excel(name = "四级分类名")
     private String fourcodename;
 
-    /** 图形特征码 */
+    /**
+     * 图形特征码
+     */
     @Excel(name = "图形特征码")
     private String featurecode;
 
-    /** 实体图层 */
+    /**
+     * 实体图层
+     */
     @Excel(name = "实体图层")
     private String entilayer;
 
-    /** 实体类型 */
+    /**
+     * 实体类型
+     */
     @Excel(name = "实体类型")
     private String entilaytype;
 
-    public void setId(String id) 
-    {
+    /**
+     * 实体类型
+     */
+    @Excel(name = "实体颜色")
+    private String color;
+    private int colorIndex;
+
+    public void setId(String id) {
         this.id = id;
     }
 
-    public String getId() 
-    {
+    public String getId() {
         return id;
     }
-    public void setCategory(String category) 
-    {
+
+    public void setCategory(String category) {
         this.category = category;
     }
 
-    public String getCategory() 
-    {
+    public String getCategory() {
         return category;
     }
-    public void setFirstcode(String firstcode) 
-    {
+
+    public void setFirstcode(String firstcode) {
         this.firstcode = firstcode;
     }
 
-    public String getFirstcode() 
-    {
+    public String getFirstcode() {
         return firstcode;
     }
-    public void setFirstcodename(String firstcodename) 
-    {
+
+    public void setFirstcodename(String firstcodename) {
         this.firstcodename = firstcodename;
     }
 
-    public String getFirstcodename() 
-    {
+    public String getFirstcodename() {
         return firstcodename;
     }
-    public void setTwocode(String twocode) 
-    {
+
+    public void setTwocode(String twocode) {
         this.twocode = twocode;
     }
 
-    public String getTwocode() 
-    {
+    public String getTwocode() {
         return twocode;
     }
-    public void setTwocodename(String twocodename) 
-    {
+
+    public void setTwocodename(String twocodename) {
         this.twocodename = twocodename;
     }
 
-    public String getTwocodename() 
-    {
+    public String getTwocodename() {
         return twocodename;
     }
-    public void setThreecode(String threecode) 
-    {
+
+    public void setThreecode(String threecode) {
         this.threecode = threecode;
     }
 
-    public String getThreecode() 
-    {
+    public String getThreecode() {
         return threecode;
     }
-    public void setThreecodename(String threecodename) 
-    {
+
+    public void setThreecodename(String threecodename) {
         this.threecodename = threecodename;
     }
 
-    public String getThreecodename() 
-    {
+    public String getThreecodename() {
         return threecodename;
     }
-    public void setFourcode(String fourcode) 
-    {
+
+    public void setFourcode(String fourcode) {
         this.fourcode = fourcode;
     }
 
-    public String getFourcode() 
-    {
+    public String getFourcode() {
         return fourcode;
     }
-    public void setFourcodename(String fourcodename) 
-    {
+
+    public void setFourcodename(String fourcodename) {
         this.fourcodename = fourcodename;
     }
 
-    public String getFourcodename() 
-    {
+    public String getFourcodename() {
         return fourcodename;
     }
-    public void setFeaturecode(String featurecode) 
-    {
+
+    public void setFeaturecode(String featurecode) {
         this.featurecode = featurecode;
     }
 
-    public String getFeaturecode() 
-    {
+    public String getFeaturecode() {
         return featurecode;
     }
-    public void setEntilayer(String entilayer) 
-    {
+
+    public void setEntilayer(String entilayer) {
         this.entilayer = entilayer;
     }
 
-    public String getEntilayer() 
-    {
+    public String getEntilayer() {
         return entilayer;
     }
-    public void setEntilaytype(String entilaytype) 
-    {
+
+    public void setEntilaytype(String entilaytype) {
         this.entilaytype = entilaytype;
     }
 
-    public String getEntilaytype() 
-    {
+    public String getEntilaytype() {
         return entilaytype;
     }
 
+    public String getColor() {
+        return color;
+    }
+
+    public void setColor(String color) {
+        this.color = color;
+    }
+
+    public int getColorIndex() {
+        return colorIndex;
+    }
+
+    public void setColorIndex(int colorIndex) {
+        this.colorIndex = colorIndex;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("category", getCategory())
-            .append("firstcode", getFirstcode())
-            .append("firstcodename", getFirstcodename())
-            .append("twocode", getTwocode())
-            .append("twocodename", getTwocodename())
-            .append("threecode", getThreecode())
-            .append("threecodename", getThreecodename())
-            .append("fourcode", getFourcode())
-            .append("fourcodename", getFourcodename())
-            .append("featurecode", getFeaturecode())
-            .append("entilayer", getEntilayer())
-            .append("entilaytype", getEntilaytype())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("category", getCategory())
+                .append("firstcode", getFirstcode())
+                .append("firstcodename", getFirstcodename())
+                .append("twocode", getTwocode())
+                .append("twocodename", getTwocodename())
+                .append("threecode", getThreecode())
+                .append("threecodename", getThreecodename())
+                .append("fourcode", getFourcode())
+                .append("fourcodename", getFourcodename())
+                .append("featurecode", getFeaturecode())
+                .append("entilayer", getEntilayer())
+                .append("entilaytype", getEntilaytype())
+                .append("color", getColor())
+                .toString();
     }
 }

+ 1 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/DimEntityService.java

@@ -24,4 +24,5 @@ public interface DimEntityService {
 
     Map<String, Object> queryEntityRelationshipToNeo4j(String entityid);
 
+    List<Map> queryEntityColor();
 }

+ 23 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/impl/DimEntityServiceImpl.java

@@ -1,5 +1,6 @@
 package com.onemap.apply.service.dimentity.impl;
 
+import com.alibaba.fastjson2.JSON;
 import com.onemap.apply.domain.dimentity.*;
 import com.onemap.apply.mapper.dimentity.DimEntityMapper;
 import com.onemap.apply.mapper.dimentity.DimEntityReponsitory;
@@ -66,11 +67,13 @@ public class DimEntityServiceImpl implements DimEntityService {
         EntityRelationshipVo d0_relationshipVo = relationshipVos.get(0);
         String d0_entilayer = d0_relationshipVo.getEntilayer();
         List<TEntityCodeAttribute> d7_attributes = new ArrayList<>();
+        int colorIndex = 0;
         for (String d6TableName : d5) {
             if (StringUtils.toRootLowerCase(d0_entilayer).lastIndexOf(d6TableName) != -1) {
                 d7_attributes = d_0_entityCodeAttributeUtil.getTableCacheData(d6TableName);
-                continue;
+                break;
             }
+            colorIndex++;
         }
         if (d7_attributes == null || d7_attributes.size() == 0) {
             return result;
@@ -84,6 +87,7 @@ public class DimEntityServiceImpl implements DimEntityService {
             return result;
         }
         result = d0_EntityData;
+        result.put("siwei_category", colorIndex);
         //查询空间详细数据
         List<Map<String, Object>> geomList = new ArrayList<Map<String, Object>>();
         if (d0_EntityData != null) {
@@ -196,4 +200,22 @@ public class DimEntityServiceImpl implements DimEntityService {
         return retMap;
     }
 
+    @Override
+    public List<Map> queryEntityColor() {
+        List<Map> retList = new ArrayList<>();
+        EntityCodeTableUtil d_0_entityCodeTableUtil = EntityCodeTableUtil.getInstance();
+        List<String> d5 = d_0_entityCodeTableUtil.getTableNameAllCacheData();
+        for (String d6TableName : d5) {
+            TEntityCodeTable d0 = d_0_entityCodeTableUtil.getTableCacheData(d6TableName);
+            String color = d0.getColor();
+            if (StringUtils.isBlank(color)) {
+                color = "#FCBB5B";
+            }
+            String jsonStr = "{\"name\":\"" + d0.getTwocodename() + "\",\"itemStyle\":{\"normal\":{\"color\":\"" + color + "\"} }}";
+            retList.add(JSON.parseObject(jsonStr, Map.class));
+        }
+
+        return retList;
+    }
+
 }

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/impl/EntityCodeAttributeUtil.java

@@ -14,7 +14,7 @@ public class EntityCodeAttributeUtil {
     private EntityCodeAttributeUtil() {
         cacheSingletonCodeMap = new HashMap<String, List<TEntityCodeAttribute>>();
         cacheSingletonTableMap = new HashMap<String, List<TEntityCodeAttribute>>();
-        cacheSingletonTableNameList = new HashSet<String>();
+        cacheSingletonTableNameList = new LinkedHashSet<String>();
     }
 
     /*

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/dimentity/impl/EntityCodeTableUtil.java

@@ -14,7 +14,7 @@ public class EntityCodeTableUtil {
     private EntityCodeTableUtil() {
         cacheSingletonCodeMap = new HashMap<String, TEntityCodeTable>();
         cacheSingletonTableMap = new HashMap<String, TEntityCodeTable>();
-        cacheSingletonTableNameList = new HashSet<String>();
+        cacheSingletonTableNameList = new LinkedHashSet<String>();
     }
 
     /*

+ 4 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/task/EntityCodeTableDBSchedule.java

@@ -41,11 +41,13 @@ public class EntityCodeTableDBSchedule {
 
         TEntityCodeAttribute queryTEntityCodeAttribute;
         List<TEntityCodeAttribute> tEntityCodeAttributes;
+        
         for (TEntityCodeTable d_0 : tEntityCodeTables) {
-            queryTEntityCodeAttribute = new TEntityCodeAttribute();
-            d_0_entityCodeTableUtil.addTableCacheData(StringUtils.toRootLowerCase(d_0.getEntilayer()), d_0);
+            String p0_table = StringUtils.toRootLowerCase(d_0.getEntilayer());
+            d_0_entityCodeTableUtil.addTableCacheData(p0_table, d_0);
             d_0_entityCodeTableUtil.addCodeCacheData(d_0.getFourcode(), d_0);
 
+            queryTEntityCodeAttribute = new TEntityCodeAttribute();
             queryTEntityCodeAttribute.setTwocode(d_0.getTwocode());
             tEntityCodeAttributes = itEntityCodeAttributeService.selectTEntityCodeAttributeList(queryTEntityCodeAttribute);
             d_0_entityCodeAttributeUtil.addTableCacheData(StringUtils.toRootLowerCase(d_0.getEntilayer()), tEntityCodeAttributes);

+ 2 - 1
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/dimentity/TEntityCodeTableMapper.xml

@@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="featurecode"    column="featurecode"    />
         <result property="entilayer"    column="entilayer"    />
         <result property="entilaytype"    column="entilaytype"    />
+        <result property="color"    column="color"    />
     </resultMap>
 
     <sql id="selectTEntityCodeTableVo">
-        select id, category, firstcode, firstcodename, twocode, twocodename, threecode, threecodename, fourcode, fourcodename, featurecode, entilayer, entilaytype from t_entity_code_table
+        select id, category, firstcode, firstcodename, twocode, twocodename, threecode, threecodename, fourcode, fourcodename, featurecode, entilayer, entilaytype,color from t_entity_code_table
     </sql>
 
     <select id="selectTEntityCodeTableList" parameterType="TEntityCodeTable" resultMap="TEntityCodeTableResult">