瀏覽代碼

********************WX************************
数据同步:<wip>> <添加数据中心对象同步到中台,关系数据同步到中台>

zhangweixin 4 年之前
父節點
當前提交
ea5fb088b2

+ 3 - 3
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dict/EquipFamilyCategory.kt

@@ -38,18 +38,18 @@ import javax.persistence.Table
  * @author 张维新
  */
 @Schema(description = "设备族实体类")
-@Table(name = "equip_family")
+@Table(name = "dict.family")
 class EquipFamilyCategory : BaseInfo() {
 
     /** 族编码 */
     @Schema(description = "族编码")
     @Id
-    @Column(name = "family")
+    @Column(name = "code")
     var family: String? = null
 
     /** 族名称 */
     @Schema(description = "族名称")
-    @Column(name = "family_name")
+    @Column(name = "name")
     var familyName: String? = null
 
 }

+ 5 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dictnew/DefFuncId.kt

@@ -214,6 +214,11 @@ open class DefFuncId: Serializable {
     @Column(name = "un_disabled")
     var unDisabled: Boolean? = null
 
+    /** 关键信息点 */
+    @Schema(description = "关键信息点")
+    @Column(name = "key_word")
+    var keyWord: Boolean? = false
+
     /** 路径 */
     @Schema(description = "路径")
     var path: String? = null

+ 6 - 5
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/Property.kt

@@ -30,6 +30,7 @@ package com.persagy.server.datacenter.models.entities.objects
 import com.alibaba.fastjson.annotation.JSONField
 import com.persagy.server.datacenter.models.entities.assistant.BIMLocation
 import com.persagy.server.datacenter.models.entities.base.BaseInfo
+import com.persagy.server.datacenter.models.entities.dict.EquipFamilyCategory
 import com.persagy.server.datacenter.models.entities.dict.Family
 import com.persagy.server.datacenter.models.entities.task.SchemeUtils
 import com.persagy.service.models.annotations.SCascade
@@ -262,11 +263,11 @@ open class Property : BaseInfo(),Comparator<Property> {
     @SCascade(table="property", idColumn="id", childIdColumn="project_id")
     var project: Project? = null
 
-//    /** 级联-资产设备族 */
-//   @Schema(description = "级联-资产设备族")
-//    @SCascade(table="property", idColumn="id", childIdColumn="family")
-//    @JSONField(name = "EquipFamilyList")
-//    var equipFamilyList: ArrayList<EquipFamilyCategory>? = null
+    /** 级联-资产设备族 */
+    @Schema(description = "级联-资产设备族")
+    @SCascade(table="property", idColumn="id", childIdColumn="family")
+    @JSONField(name = "EquipFamilyList")
+    var equipFamilyList: ArrayList<EquipFamilyCategory>? = null
 
     /** 级联-资产设备族名称 */
     @Schema(description = "级联-资产设备族名称")

+ 10 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/REqForSh.kt

@@ -58,6 +58,16 @@ class REqForSh : RBaseInfo() {
     @Column(name = "project_id")
     var projectId: String? = null
 
+    /** 图类型编码 */
+    @Schema(description = "图类型编码")
+    @Column(name = "graph_code")
+    var graphCode: String? = null
+
+    /** 边类型 */
+    @Schema(description = "边类型")
+    @Column(name = "type")
+    var type: String? = null
+
     /** 计算标记 1 为手动 2为自动 */
     @Schema(description = "计算标记 1 为手动 2为自动 ")
     @Column(name = "sign")

+ 11 - 11
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/REqInSh.kt

@@ -26,8 +26,6 @@
 
 package com.persagy.server.datacenter.models.entities.rel
 
-import com.alibaba.fastjson.annotation.JSONField
-import com.google.gson.annotations.SerializedName
 import com.persagy.server.datacenter.models.entities.base.RBaseInfo
 import io.swagger.v3.oas.annotations.media.Schema
 import javax.persistence.Column
@@ -47,30 +45,32 @@ class REqInSh : RBaseInfo() {
     @Schema(description = "设备id")
     @Id
     @Column(name = "equip_id")
-    @JSONField(name = "EquipId")
-    @SerializedName("EquipId")
     var equipId: String? = null
 
     /** 竖井id */
     @Schema(description = "竖井id")
     @Id
     @Column(name = "shaft_id")
-    @JSONField(name = "ShaftId")
-    @SerializedName("ShaftId")
     var shaftId: String? = null
 
     /** 项目id */
     @Schema(description = "项目id")
     @Column(name = "project_id")
-    @JSONField(name = "ProjectId")
-    @SerializedName("ProjectId")
     var projectId: String? = null
 
+    /** 图类型编码 */
+    @Schema(description = "图类型编码")
+    @Column(name = "graph_code")
+    var graphCode: String? = null
+
+    /** 边类型 */
+    @Schema(description = "边类型")
+    @Column(name = "type")
+    var type: String? = null
+
     /** 计算标记 1 为手动 2为自动 */
     @Schema(description = "计算标记 1 为手动 2为自动 ")
     @Column(name = "sign")
-    @JSONField(name = "Sign")
-    @SerializedName("Sign")
     var sign: Int? = null
 
-} // Class REqInSh
+}

+ 11 - 10
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/RSyEq.kt

@@ -26,8 +26,6 @@
 
 package com.persagy.server.datacenter.models.entities.rel
 
-import com.alibaba.fastjson.annotation.JSONField
-import com.google.gson.annotations.SerializedName
 import com.persagy.server.datacenter.models.entities.base.RBaseInfo
 import io.swagger.v3.oas.annotations.media.Schema
 import javax.persistence.Column
@@ -47,29 +45,32 @@ class RSyEq : RBaseInfo(){
     @Schema(description = "设备id", required = true)
     @Id
     @Column(name = "equip_id")
-    @JSONField(name = "EquipID")
-    @SerializedName("EquipID")
     var equipId: String? = null
 
     /** 系统id */
     @Schema(description = "系统id", required = true)
     @Id
     @Column(name = "sys_id")
-    @JSONField(name = "SysID")
-    @SerializedName("SysID")
     var sysId: String? = null
 
     /** 项目id */
     @Schema(description = "项目id")
     @Column(name = "project_id")
-    @JSONField(name = "ProjectId")
-    @SerializedName("ProjectId")
     var projectId: String? = null
 
+    /** 图类型编码 */
+    @Schema(description = "图类型编码")
+    @Column(name = "graph_code")
+    var graphCode: String? = null
+
+    /** 边类型 */
+    @Schema(description = "边类型")
+    @Column(name = "type")
+    var type: String? = null
+
     /** 计算标记 1 为手动 2为自动 */
     @Schema(description = "计算标记 1 为手动 2为自动 ")
     @Column(name = "sign")
-    @JSONField(name = "Sign")
     var sign: Int? = null
 
-} // Class RSyEq
+}

+ 1 - 3
data-core/src/main/kotlin/com/persagy/server/datacenter/models/response/EquipAssetComponentsReqponse.kt

@@ -26,7 +26,6 @@
 
 package com.persagy.server.datacenter.models.response
 
-import com.alibaba.fastjson.annotation.JSONField
 import com.persagy.server.datacenter.models.entities.dictnew.DefClass
 import com.persagy.server.datacenter.models.entities.objects.Equipment
 import com.persagy.server.datacenter.models.entities.objects.GeneralSystem
@@ -71,11 +70,10 @@ class EquipAssetComponentsReqponse : Equipment() {
 
     /** 部件数量 */
     @Schema(description = "部件数量")
-    @JSONField(name ="Count")
     var count: Int = 0
 
     /** 级联-部件   table  对应关系表   idColumn 对应 本类的id    childIdColumn 级联对象的关系id */
     @Schema(description = "级联-是否有部件")
     @SCascade(table="equipment", idColumn="class_code", childIdColumn="parent_id")
     var componentCategory: ArrayList<DefClass>? = null
-} // Class EquipAssetComponentsReqponse
+}

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/services/objects/GeneralSystemService.kt

@@ -168,7 +168,7 @@ object GeneralSystemService : Service<GeneralSystem>(SMybatisDao(GeneralSystem::
      * 查询之前的操作
      */
     override fun onQueryBefore(queryBuilder: SQueryBuilder<GeneralSystem>) {
-        queryBuilder.tableName = "v_general_system"
+//        queryBuilder.tableName = "v_general_system"
         return
     } // Function onQueryBefore()
 

+ 153 - 12
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelToFromController.kt

@@ -28,11 +28,11 @@ package com.persagy.server.syn.controllers.obj
 
 import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
+import com.persagy.database.functions.SLength
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DictProject
 import com.persagy.server.datacenter.models.entities.objects.Equipment
-import com.persagy.server.datacenter.models.entities.rel.REqForBd
-import com.persagy.server.datacenter.models.entities.rel.REqForFl
+import com.persagy.server.datacenter.models.entities.rel.*
 import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.api.obj.EquipApi
 import com.persagy.service.SBaseService
@@ -66,13 +66,19 @@ class RelToFromController {
     private val rEqForFlService = SBaseService(SMybatisDao(REqForFl::class.java))
     /** 设备服务建筑 */
     private val rEqForBdService = SBaseService(SMybatisDao(REqForBd::class.java))
+    /** 系统下的设备 */
+    private val rSyEqService = SBaseService(SMybatisDao(RSyEq::class.java))
+    /** 设备服务于竖井 */
+    private val rEqForShService = SBaseService(SMybatisDao(REqForSh::class.java))
+    /** 设备所在竖井 */
+    private val rEqInShService = SBaseService(SMybatisDao(REqInSh::class.java))
+    /** 数据中心设备和空间关系 */
+    private val rEq2SpService = SObjectService(SMybatisDao(REq2Sp::class.java))
     /** 数据中心设备服务 */
     private val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
     /** 字典项目服务 */
     private val dictProjectService = SBaseService(SMybatisDao(DictProject::class.java))
 
-
-
     /**
      * 设备和楼层关系-同步到中台
      *
@@ -136,7 +142,7 @@ class RelToFromController {
      * @param isDel         是否删除以前的关系
      * @return 返回是否成功结果
      */
-    @Operation(summary= "设备和楼层关系-同步到中台", description = "设备所在的建筑(图类型 MechInArch 边类型 Eq2Bd ),设备服务的建筑(图类型 MechForArch 边类型 Eq2Bd), ")
+    @Operation(summary= "设备和建筑关系-同步到中台", description = "设备所在的建筑(图类型 MechInArch 边类型 Eq2Bd ),设备服务的建筑(图类型 MechForArch 边类型 Eq2Bd), ")
     @PostMapping("/eq2bd")
     fun eq2Bd(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
         try {
@@ -187,17 +193,82 @@ class RelToFromController {
      */
     @Operation(summary= "设备和系统关系-同步到中台", description = "系统下设备(图类型 MechSubset 边类型 Sy2Eq )")
     @PostMapping("/sy2eq")
-    fun sy2Eq(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
-        val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+    fun sy2Eq(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            val rSyEqList = rSyEqService.select(
+                SFilter.eq("projectId", projectId),
+                SFilter.eq("graphCode", graphCode),
+                SFilter.eq("type", type)
+            ).exec()
+            if (rSyEqList.size>0){
+                for (rSyEq in rSyEqList){
+                    if (isDel) {
+                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSyEq.sysId!!, null)
+                        EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
+                    }
+                    val toJsonObjArray =
+                        Configure.toJsonObjArray(graphCode, type, rSyEq.sysId!!, rSyEq.equipId!!)
+                    val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
+                    if (!createRel){
+                        logger.debug("系统下的设备关系失败:${toJsonObjArray.toJson()}")
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
+
     }
 
     /**
      * 设备和竖井关系
      */
-    @Operation(summary= "设备和竖井关系-同步到中台", description = "设备所在的竖井(图类型 MechInArch 边类型 Eq2Bd ),设备服务的竖井(图类型 MechForArch 边类型 Eq2Sh), ")
+    @Operation(summary= "设备和竖井关系-同步到中台", description = "设备所在的竖井(图类型 MechInArch 边类型 Eq2Sh ),设备服务的竖井(图类型 MechForArch 边类型 Eq2Sh), ")
     @PostMapping("/eq2sh")
-    fun eq2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
-        val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+    fun eq2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (graphCode == "MechInArch") {
+                val rEqInShList = rEqInShService.select(SFilter.eq("projectId", projectId)).exec()
+                if (rEqInShList.size>0) {
+                    for (rEqInSh in rEqInShList) {
+                        if (isDel) {
+                            val toJsonObj = Configure.toJsonObj(graphCode, type, rEqInSh.equipId!!, null)
+                            EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
+                        }
+                        val toJsonObjArray =
+                            Configure.toJsonObjArray(graphCode, type, rEqInSh.equipId!!, rEqInSh.shaftId!!)
+                        val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
+                        if (!createRel){
+                            logger.debug("设备所在竖井关系失败:${toJsonObjArray.toJson()}")
+                        }
+                    }
+                }
+            } else if (graphCode == "MechForArch") {
+                val rEqForShList = rEqForShService.select(SFilter.eq("projectId", projectId)).exec()
+                if (rEqForShList.size>0 ) {
+                    for (rEqForSh in rEqForShList) {
+                        if (isDel) {
+                            val toJsonObj = Configure.toJsonObj(graphCode, type, rEqForSh.equipId!!, null)
+                            EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
+                        }
+                        val toJsonObjArray =
+                            Configure.toJsonObjArray(graphCode, type, rEqForSh.equipId!!, rEqForSh.shaftId!!)
+                        val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
+                        if (!createRel){
+                            logger.debug("设备服务的竖井关系失败:${toJsonObjArray.toJson()}")
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
     }
 
     /**
@@ -205,8 +276,33 @@ class RelToFromController {
      */
     @Operation(summary= "设备和空间关系-同步到中台", description = "设备所在的空间(图类型 MechInArch 边类型 Eq2Sp ),设备服务的空间(图类型 MechForArch 边类型 Eq2Sp), ")
     @PostMapping("/eq2sp")
-    fun eq2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
-        val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+    fun eq2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            val rEq2SpList = rEq2SpService.select(
+                SFilter.eq("id", projectId),
+                SFilter.eq("graphCode", graphCode),
+                SFilter.eq("type", type)
+            ).exec()
+            if (rEq2SpList.size>0) {
+                for (rEq2Sp in rEq2SpList) {
+                    if (isDel) {
+                        val toJsonObj = Configure.toJsonObj(graphCode, type, rEq2Sp.id1!!, null)
+                        EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
+                    }
+                    val toJsonObjArray =
+                        Configure.toJsonObjArray(graphCode, type, rEq2Sp.id1!!, rEq2Sp.id2!!)
+                    val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
+                    if (!createRel){
+                        logger.debug("设备和空间关系失败:${toJsonObjArray.toJson()}")
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
     }
 
     /**
@@ -214,7 +310,52 @@ class RelToFromController {
      */
     fun eq2Ec(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
         val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+        val equipmentList =
+            equipmentService.select(SFilter.eq("projectId", projectId), SFilter.lte(SLength("classCode"), 8)).exec()
+        if (equipmentList.size>0) {
+
+        }
+
     }
 
+    /**
+     * 系统所在的竖井,系统服务的竖井
+     */
+    fun sy2Sh(projectId: String,graphCode: String,type: String,isDel: Boolean = false){
+
+    }
+
+    /**
+     * 竖井所在的空间
+     */
+    fun sh2Sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false) {
+
+    }
+    /**
+     * 建筑下的竖井
+     */
+    /**
+     * 竖井下的业务空间
+     */
+    /**
+     * 竖井贯通关系
+     */
+    /**
+     * 设备和部件关系
+     */
+    /**
+     * 系统所在的楼层,系统服务于楼层
+     */
+    /**
+     * 建筑下的楼层
+     */
+    /**
+     * 楼层下的业务空间
+     */
+    /**
+     * 楼层贯通关系
+     */
+
+
 
 }

+ 3 - 4
equip-componnet/src/main/kotlin/com/persagy/server/controllers/EquipController.kt

@@ -124,7 +124,7 @@ class EquipController {
     @GetMapping(value = ["/equip-compon"])
     fun getEquipCompon(id:String,category: String): RSQueryResponse<EquipCompon> {
         return  rEquipComponService.getEquipCompon(id,category)
-    } // Function getEquipCompon()
+    }
 
     /**
      * 根据设备批量创建资产
@@ -263,7 +263,7 @@ class EquipController {
     @GetMapping(value = ["/equip-compon-category"])
     fun  equipORComponCategory(): SQueryResponse<EquipORComponCategory>{
         return EquipORComponCategoryService.getEquipORComponCategory()
-    } // Function equipORComponCategory()
+    }
 
     /**
      *  批量处理设备关联资产、 查询接口
@@ -377,5 +377,4 @@ class EquipController {
     fun equipType(): SQueryResponse<DefClass>{
         return EquipmentService.equipTypeName()
     }
-
-} // Class EquipController
+}

+ 2 - 2
equip-componnet/src/main/kotlin/com/persagy/server/models/EquipORComponCategory.kt

@@ -44,8 +44,8 @@ class EquipORComponCategory : RBaseInfo()  {
     var classCode: String? = null
 
     /** 设备类型名称 */
-   @Schema(description = "设备类型名称")
+    @Schema(description = "设备类型名称")
     @Column(name = "name")
     var name: String? = null
 
-} // Class EquipORComponCategory
+}

+ 0 - 2
equip-componnet/src/main/kotlin/com/persagy/server/utils/DataVerification.kt

@@ -31,7 +31,6 @@ import com.persagy.database.SPageQueryInfo
 import com.persagy.database.functions.SLength
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.assistant.ViewEquipSystem
-import com.persagy.server.datacenter.models.entities.dict.ExplainAllCategories
 import com.persagy.server.datacenter.models.entities.objects.GeneralSystem
 import com.persagy.server.datacenter.models.response.EquipAssetComponentsReqponse
 import com.persagy.server.service.objects.EquipmentService
@@ -127,7 +126,6 @@ object DataVerification {
         /** 设备关联系统服务 */
         val viewEquipSystemservice = SBaseService(SMybatisDao(ViewEquipSystem::class.java))
         val generalSystemService = SBaseService(SMybatisDao(GeneralSystem::class.java))
-        val explainAllCategoriesService = SBaseService(SMybatisDao(ExplainAllCategories::class.java))
 
         val list = ArrayList<EquipAssetComponentsReqponse>()
         if (equipAssetComponentsList.size!! > 0) {