瀏覽代碼

**********************************wx*************************
需采集信息点设置,缺少批量同步到项目

weixinVSjinlai 4 年之前
父節點
當前提交
66d0abef57

文件差異過大導致無法顯示
+ 9 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/dao/mappers/SchemeMapper.kt


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

@@ -0,0 +1,239 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.datacenter.models.entities.dictnew
+
+
+import io.swagger.v3.oas.annotations.media.Schema
+import java.io.Serializable
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 平台对象信息点
+ *
+ * @author wx <zhangweixin@sagacloud.cn>
+ * @date  2020/9/19 17:41
+ */
+@Schema(description = "平台对象信息点-需采集信息点操作")
+@Table(name = "dict.def_funcid_gather")
+open class DefFuncIdGather: Serializable {
+
+    /** 全局id */
+    @Schema(description = "全局id")
+    @Id
+    @Column(name = "id")
+    var id: String? = null
+
+    /** 类型编码 */
+    @Schema(description = "类型编码")
+    @Id
+    @Column(name = "class_code")
+    var classCode: String? = null
+
+    /** 动静分类:静态STATIC,脉冲PULSE,阶段GRADATION,时序SEQUENTIAL */
+    @Schema(description = "动静分类:静态STATIC,脉冲PULSE,阶段GRADATION,时序SEQUENTIAL")
+    @Column(name = "category")
+    var category: String? = null
+
+    /** 信息点编码 */
+    @Schema(description = "信息点编码")
+    @Id
+    @Column(name = "code")
+    var code: String? = null
+
+    /** 信息点名称 */
+    @Schema(description = "信息点名称")
+    @Column(name = "name")
+    var name: String? = null
+
+    /** 分类:commo平台级, group集团级, project项目级 */
+    @Schema(description = "分类:commo平台级, group集团级, project项目级")
+    @Id
+    @Column(name = "type")
+    var type: String? = null
+
+    /** 集团id, 默认为"0" */
+    @Schema(description = "集团id, 默认为'0'")
+    @Id
+    @Column(name = "group_code")
+    var groupCode: String? = null
+
+    /** 项目id, 默认为"0" */
+    @Schema(description = "项目id, 默认为'0'")
+    @Id
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 数据类型 */
+    @Schema(description = "数据类型")
+    @Column(name = "data_type")
+    var dataType: String? = null
+
+    /** 数据格式 */
+    @Schema(description = "数据格式")
+    @Column(name = "formater")
+    var formater: String? = null
+
+    /** 数据格式 */
+    @Schema(description = "数据格式")
+    @Column(name = "data_source")
+    var dataSource: ArrayList<Any?>? = null
+
+    /** 输入方式 */
+    @Schema(description = "输入方式")
+    @Column(name = "input_mode")
+    var inputMode: String? = null
+
+    /** 一级标签 */
+    @Schema(description = "一级标签")
+    @Column(name = "first_tag")
+    var firstTag: String? = null
+
+    /** 一级名称 */
+    @Schema(description = "一级名称")
+    @Column(name = "first_name")
+    var firstName: String? = null
+
+    /** 二级标签 */
+    @Schema(description = "二级标签")
+    @Column(name = "second_tag")
+    var secondTag: String? = null
+
+    /** 二级名称 */
+    @Schema(description = "二级名称")
+    @Column(name = "second_name")
+    var secondName: String? = null
+
+    /** 序列 */
+    @Schema(description = "序列")
+    @Column(name = "idx")
+    var idx: Int? = null
+
+    /** 优先级,重要程度 */
+    @Schema(description = "优先级,重要程度")
+    @Column(name = "priority")
+    var priority: String? = null
+
+    /** 单位 */
+    @Schema(description = "单位")
+    @Column(name = "unit")
+    var unit: String? = null
+
+    /** 备注 */
+    @Schema(description = "备注")
+    @Column(name = "note")
+    var note: String? = null
+
+    /** 输入类型 */
+    @Schema(description = "输入类型")
+    @Column(name = "orig_data_type")
+    var origDataType: String? = null
+
+    /** 旧信息点编码 */
+    @Schema(description = "旧信息点编码")
+    @Column(name = "orig_code")
+    var origCode: String? = null
+
+    /** 别编码 */
+    @Schema(description = "别编码")
+    @Column(name = "alias_code")
+    var aliasCode: String? = null
+
+    /** 别名称 */
+    @Schema(description = "别名称")
+    @Column(name = "alias_name")
+    var aliasName: String? = null
+
+    /** 是否分类标签 */
+    @Schema(description = "是否分类标签")
+    @Column(name = "can_sub")
+    var canSub: Boolean? = null
+
+    /** 是否复数 */
+    @Schema(description = "是否复数")
+    @Column(name = "is_multiple")
+    var isMultiple: Boolean? = null
+
+    /** 是否区间 */
+    @Schema(description = "是否区间")
+    @Column(name = "is_region")
+    var isRegion: Boolean? = null
+
+    /** 子分类标记 */
+    @Schema(description = "子分类标记")
+    @Column(name = "sub_flag")
+    var subFlag: Boolean? = null
+
+    /** 是否只读, 如果是则不允许对该信息点做变更 */
+    @Schema(description = "是否只读, 如果是则不允许对该信息点做变更")
+    @Column(name = "readonly")
+    var readonly: Boolean? = null
+
+    /** 排序 */
+    @Schema(description = "排序")
+    @Column(name = "sort")
+    var sort: Int? = null
+
+    /** 是否显示 */
+    @Schema(description = "是否显示")
+    @Column(name = "visible")
+    var visible: Boolean? = null
+
+    /** 是否编辑 */
+    @Schema(description = "是否编辑")
+    @Column(name = "editable")
+    var editable: Boolean? = null
+
+    /** 禁止操作 */
+    @Schema(description = "禁止操作")
+    @Column(name = "un_disabled")
+    var unDisabled: Boolean? = null
+
+    /** 关键信息点 */
+    @Schema(description = "关键信息点")
+    @Column(name = "key_word")
+    var keyWord: Boolean? = null
+
+    /** 路径 */
+    @Schema(description = "路径")
+    var path: String? = null
+        get() {
+            return if ( code == "roomLocalFuncTypeID"||code == "roomLocalFuncTypeName"){
+                "infos.$code"
+            } else if (firstName == "基本信息"|| firstName.isNullOrEmpty()||firstName == "基本参数"){
+                code
+            }  else {
+                "infos.$code"
+            }
+        }
+
+    /** 字典内容 */
+    @Schema(description = "字典内容")
+    var content: ArrayList<DefFuncIdGather>? = null
+
+}

+ 28 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/dict/DictGatherControllers.kt

@@ -0,0 +1,28 @@
+package com.persagy.server.syn.controllers.dict
+
+import com.persagy.server.syn.services.dict.DClassDefService
+import com.persagy.service.models.responses.SBaseResponse
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.tags.Tag
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ *
+ */
+@Tag(name = "0004、字典-手动更新需采集信息")
+@RestController
+@RequestMapping("/dict/gather")
+class DictGatherControllers {
+
+    /**
+     * 平台字典 详细信息点
+     */
+    @Operation(summary = "001、平台字典对象信息点-存入数据中心", description = "")
+    @GetMapping(value = ["/dict-platform-info"])
+    fun dictPlatformInfo(): SBaseResponse {
+        return DClassDefService.dictPlatformInfoGather()
+    }
+
+}

+ 173 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/services/dict/DClassDefService.kt

@@ -62,6 +62,8 @@ object DClassDefService : SObjectService<DefClass>(SMybatisDao(DefClass::class.j
     private val defClassService = SBaseService(SMybatisDao(DefClass::class.java))
     /** 详细信息点 */
     private val defFuncIdService = SBaseService(SMybatisDao(DefFuncId::class.java))
+    /** 详细信息点 需采集信息点配置 */
+    private val defFuncIdGather = SBaseService(SMybatisDao(DefFuncIdGather::class.java))
     /** 专业 */
     private val dictMajorService = SBaseService(SMybatisDao(DictMajor::class.java))
     /** 方案 */
@@ -1230,4 +1232,175 @@ object DClassDefService : SObjectService<DefClass>(SMybatisDao(DefClass::class.j
     }
 
 
+    /**
+     * 字典对象的详细信息点 - 平台级信息点更新需采集信息点
+     */
+    fun dictPlatformInfoGather(): SBaseResponse{
+        val sBaseResponse = SBaseResponse()
+        val defClassList = defClassService.select(SFilter.eq("type", "common")).exec()
+        if (defClassList.size>0){
+            for (defClass in defClassList){
+                val dictPlatformInfoList = DictTypeApi.dictPlatformInfo(defClass.code!!, defClass.type!!)
+//                defFuncIdService.delete(SFilter.eq("classCode", defClass.code!!),SFilter.eq("groupCode", "0"))
+                if (!dictPlatformInfoList.isNullOrEmpty()){
+                    for (dictPlatformInfo in dictPlatformInfoList){
+                        /** 开头字母大写转小写 */
+                        val defFuncId = DefFuncIdGather()
+                        defFuncId.canSub = dictPlatformInfo.canSub
+                        defFuncId.category = dictPlatformInfo.category
+                        defFuncId.classCode = defClass.code
+                        if (dictPlatformInfo.code == "equipLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "equipLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "sysLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "sysLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "tenantLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code =="tenantLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "roomLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "roomLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "shaftLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "shaftLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "shaftID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "shaftName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "equipID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "equipName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "sysID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "sysName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "tenantID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "tenantName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "roomID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "roomName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "projID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "projName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "projLocalName"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "projLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "flootID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "flootName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "floorLocalName"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "floorLocalName"){
+                            defFuncId.code = "localName"
+                        }else if (dictPlatformInfo.code == "buildID"){
+                            defFuncId.code = "id"
+                        }else if (dictPlatformInfo.code == "buildName"){
+                            defFuncId.code = "name"
+                        }else if (dictPlatformInfo.code == "buildLocalID"){
+                            defFuncId.code = "localId"
+                        }else if (dictPlatformInfo.code == "buildLocalName"){
+                            defFuncId.code = "localName"
+                        }else{
+                            defFuncId.code = dictPlatformInfo.code
+                        }
+
+                        defFuncId.id = dictPlatformInfo.id
+//                        defFuncId.code = dictPlatformInfo.code
+                        defFuncId.dataSource = dictPlatformInfo.dataSource
+                        logger.debug("数据= ${dictPlatformInfo.dataSource?.toJson()}")
+                        defFuncId.dataType = dictPlatformInfo.dataType
+                        defFuncId.firstName = dictPlatformInfo.firstTag
+                        if (!dictPlatformInfo.firstTag.isNullOrEmpty()){
+                            defFuncId.firstTag = ParamTools.TwoLevelCode(dictPlatformInfo.firstTag!!)
+                        }
+                        defFuncId.formater = dictPlatformInfo.formater
+                        defFuncId.groupCode = if (dictPlatformInfo.groupCode.isNullOrEmpty()) "0" else dictPlatformInfo.groupCode
+                        defFuncId.idx = dictPlatformInfo.idx
+                        defFuncId.inputMode = dictPlatformInfo.inputMode
+                        defFuncId.isMultiple = dictPlatformInfo.isMultiple
+                        defFuncId.isRegion = dictPlatformInfo.isRegion
+                        defFuncId.name = dictPlatformInfo.name
+                        defFuncId.note = dictPlatformInfo.note
+                        defFuncId.priority = dictPlatformInfo.priority
+                        defFuncId.projectId = if (dictPlatformInfo.projectId.isNullOrEmpty()) "0" else dictPlatformInfo.projectId
+                        defFuncId.readonly = dictPlatformInfo.readonly
+                        defFuncId.secondName = dictPlatformInfo.secondTag
+                        if (!dictPlatformInfo.secondTag.isNullOrEmpty()){
+                            defFuncId.secondTag = ParamTools.TwoLevelCode(dictPlatformInfo.secondTag!!)
+                        }
+                        defFuncId.subFlag = dictPlatformInfo.subFlag
+                        defFuncId.type = dictPlatformInfo.type
+                        defFuncId.unit = dictPlatformInfo.unit
+                        defFuncId.origCode = dictPlatformInfo.origCode
+                        defFuncId.origDataType = dictPlatformInfo.origDataType
+                        defFuncId.aliasCode = dictPlatformInfo.aliasCode
+                        defFuncId.aliasName = dictPlatformInfo.aliasName
+                        if (!defFuncId.name.isNullOrEmpty()){
+                            /** 排序 */
+                            if (defFuncId.name!! == "设备本地编码"||defFuncId.name!! == "楼层本地编码"){
+                                defFuncId.sort = 1
+                            }else if (defFuncId.name!! == "设备本地名称"|| defFuncId.name!! == "楼层本地名称"){
+                                defFuncId.sort = 2
+                            }else if (defFuncId.name!! == "设备二维码图片"){
+                                defFuncId.sort = 3
+                            }else if (defFuncId.name!! == "设计图纸中编码"){
+                                defFuncId.sort = 4
+                            }else if (defFuncId.name!! == "设备ID"){
+                                defFuncId.sort = 101
+                            }else if (defFuncId.name!! == "设备名称"){
+                                defFuncId.sort = 102
+                            }else if (defFuncId.name!! == "BIM模型中编码"){
+                                defFuncId.sort = 103
+                            }else if (defFuncId.name!! == "BIM模型中坐标"){
+                                defFuncId.sort = 104
+                            }else if (defFuncId.firstName != null&& defFuncId.firstName == "台账参数"){
+                                defFuncId.sort = 10
+                            }else if(defFuncId.firstName != null&& defFuncId.firstName == "通讯参数"){
+                                defFuncId.sort = 20
+                            }else {
+                                defFuncId.sort = 60
+                            }
+                        }
+
+                        val dicConfigureEditable = ParamTools.dicConfigureEditable()
+                        val containsKey = dicConfigureEditable.containsKey(defFuncId.code!!)
+                        if (containsKey){
+                            defFuncId.editable = false
+                            defFuncId.unDisabled = false
+                            defFuncId.visible = false
+                        }
+                        val dicConfigure = ParamTools.dicConfigure()
+                        if (defFuncId.code!=null){
+                            val containsKey = dicConfigure.containsKey(defFuncId.code!!)
+                            if (containsKey){
+                                defFuncId.editable = true
+                                defFuncId.unDisabled = false
+                                defFuncId.visible = true
+                            }
+                        }
+                        defFuncIdGather.replace(defFuncId)
+                    }
+                }
+            }
+            sBaseResponse.result = SResponseType.success
+        } else {
+            sBaseResponse.result = SResponseType.failure
+        }
+        return sBaseResponse
+    } // Fun dictPlatformInfo()
+
+
 } // Object DClassDefService

+ 44 - 54
equip-component/src/main/kotlin/com/persagy/server/controllers/dict/DictCustomController.kt

@@ -30,12 +30,19 @@ package com.persagy.server.controllers.dict
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.datacenter.models.entities.dict.DictSQueryRequest
+import com.persagy.server.datacenter.models.entities.dictnew.DefClass
 import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
+import com.persagy.server.datacenter.models.entities.dictnew.DefFuncIdGather
+import com.persagy.server.datacenter.models.entities.dictnew.DefFuncIdProject
 import com.persagy.server.datacenter.models.jms.SynchronousMessage
+import com.persagy.server.datacenter.models.requests.CategoryRequest
 import com.persagy.server.service.dict.DictDefClassService
 import com.persagy.service.SObjectService
 import com.persagy.service.models.requests.SCountRequest
+import com.persagy.service.models.requests.SCreateRequest
 import com.persagy.service.models.responses.SCountResponse
+import com.persagy.service.models.responses.SCreateResponse
 import com.persagy.service.models.responses.SQueryResponse
 import io.swagger.v3.oas.annotations.Operation
 import io.swagger.v3.oas.annotations.tags.Tag
@@ -56,59 +63,6 @@ class DictCustomController {
 
     /** 缓存对象数据服务 - 数据中心到数据中台  */
     var synchronousMessageObjService = SObjectService(SMybatisDao(SynchronousMessage::class.java))
-    /**
-     * 项目化字典类型
-     */
-//   @Operation(summary = "项目化字典 - 统计数量", description = "")
-//    @PostMapping(value = ["/project-dict-count"])
-//    fun  projectDictCount(@RequestBody request: SCountRequest): SCountResponse {
-//        return DictDatacenterProjectcustomService.counts(request)
-//    } // Function  projectDictCount
-
-    /**
-     * 需补充转换规则数量
-     */
-//   @Operation(summary = "项目化字典 - 需补充转换规则数量", description = "")
-//    @PostMapping(value = ["/project-dict-switch-count"])
-//    fun  projectDictSwitchRuleCount(): SCountResponse{
-//        return DictDatacenterProjectcustomService.projectDictSwitchRuleCounts()
-//    } // Function  projectDictSwitchRuleCount
-
-
-    /**
-     * 项目化字典类型
-     */
-//   @Operation(summary = "项目化字典 - 内容", description = "")
-//    @PostMapping(value = ["/project-dict-info"])
-//    fun  projectDictInfo(@RequestBody request: SQueryRequest): SQueryResponse<DictDatacenterProjectcustom> {
-//        return DictDatacenterProjectcustomService.queryDict(request)
-//    } // Function  projectDictCount()
-
-    /**
-     * 数据中心-物理世界数据转换
-     */
-//   @Operation(summary = "数据中心-物理世界数据转换 ", description = "")
-//    @PostMapping(value = ["/project-dict-datacenter"])
-//    fun dataCenterDataPlatform(): SQueryResponse<EquipDictStatistics>{
-//       return DictDatacenterProjectcustomService.equipStatisticsDataCenter()
-//    } // Function dataCenterDataPlatform ()
-
-    /**
-     * 物理世界 - 数据中心数据转换
-     */
-//   @Operation(summary = "物理世界-数据中心数据转换 ", description = "")
-//    @PostMapping(value = ["/project-dict-dataplatfrom"])
-//    fun dataPlatformdataCenter(): SQueryResponse<EquipDictStatistics>{
-//        return DictDatacenterProjectcustomService.equipStatisticsDataPlatfrom()
-//    } // Function dataCenterDataPlatform ()
-
-
-//   @Operation(summary = "更新自定义自定脚本", description = "")
-//    @PostMapping(value = ["/update"])
-//    fun update(@RequestBody request: ArrayList<DictDatacenterProjectcustom>): SBaseResponse {
-//
-//        return DictDatacenterProjectcustomService.updateDictSwitchRule(request)
-//    } // Function upDate
 
     /**
      * 查询 M 和 L 类型的信息点
@@ -130,5 +84,41 @@ class DictCustomController {
         return SCountResponse(messageList.size.toLong())
     }  // Function objectCounts()
 
+    /**
+     * 字典查询所有设备类型、部件所有类型、系统类型、专业类型
+     *
+     * @param  categoryRequest        查询信息条件
+     * @return 查询结果
+     */
+    @Operation(summary = "类型-字典查询所有设备类型、部件所有类型、系统类型、专业类型", description = "输入设备类型:equipment,输入部件类型:component,输入系统类型:system,输入专业类型:major," +
+            "专业和系统:majorSystem,业务空间类型 space ,专业下的设备类型 majorEquipment ,设备和部件equipmentAndComponent,设备类型要以及对应的部件equipmentComponent,专业下的系统,系统下的设备majorSystemEquip ,资产 property ")
+    @PostMapping(value = ["/category"])
+    fun categoryQuery(@RequestBody categoryRequest: CategoryRequest): SQueryResponse<DefClass> {
+        return DictDefClassService.equipQuery(categoryRequest)
+    }
+
+    /**
+     * 项目字典
+     *
+     * @param request   查询条件
+     * @return 查询结构
+     */
+    @Operation(summary ="查询项目下类型的信息点",description = " 租户(VOTn)")
+    @PostMapping(value = ["/query"])
+    fun categoryInfoQuery(@RequestBody request: DictSQueryRequest): SQueryResponse<DefFuncIdGather>{
+        return DictDefClassService.categoryInfoQuery(request)
+    }
+
+    /**
+     * 项目定制化设置
+     *
+     * @param request   信息点对象列表
+     * @return 返回结果
+     */
+    @Operation(summary = "设置-项目定制化字典", description = "")
+    @PostMapping(value = ["/setting-dic-project"])
+    fun settingDict(@RequestBody request: SCreateRequest<DefFuncIdGather>): SCreateResponse<DefFuncIdGather> {
+        return DictDefClassService.settingDict(request)
+    }
 
-} //
+}

+ 8 - 0
equip-component/src/main/kotlin/com/persagy/server/service/CustomSqlService.kt

@@ -27,6 +27,7 @@
 package com.persagy.server.service
 
 import com.persagy.server.dao.mappers.CustomSql
+import com.persagy.server.datacenter.dao.mappers.SchemeMapper
 import com.persagy.server.datacenter.models.entities.dictnew.DefClass
 import com.persagy.server.models.EquipDictStatistics
 import com.persagy.server.models.GatherInfoPoint
@@ -49,6 +50,10 @@ class CustomSqlService {
     @Autowired
     lateinit var mapper: CustomSql
 
+    /** 实例化 mapper 对象 */
+    @Autowired
+    lateinit var schemeMapper: SchemeMapper
+
     companion object {
         // 日志
         private val logger = LoggerFactory.getLogger(CustomSqlService::class.java)
@@ -458,5 +463,8 @@ class CustomSqlService {
     }
 
 
+    fun dictInfoProperty(projectId: String, groupId: String,  code:String,propertyCode: String){
+        schemeMapper.dictInfoPropertyGather(projectId,groupId,code,propertyCode)
+    }
 
 } // class CustomSqlService

+ 337 - 2
equip-component/src/main/kotlin/com/persagy/server/service/dict/DictDefClassService.kt

@@ -27,13 +27,24 @@
 package com.persagy.server.service.dict
 
 import com.persagy.database.SFilter
+import com.persagy.database.SPageQueryInfo
+import com.persagy.database.SQueryBuilder
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
-import com.persagy.server.datacenter.models.entities.dictnew.DefClass
-import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
+import com.persagy.server.datacenter.models.entities.dict.DictSQueryRequest
+import com.persagy.server.datacenter.models.entities.dict.EquipFamily
+import com.persagy.server.datacenter.models.entities.dict.Family
+import com.persagy.server.datacenter.models.entities.dictnew.*
+import com.persagy.server.datacenter.models.requests.CategoryRequest
+import com.persagy.server.service.CustomSqlService
+import com.persagy.service.SBaseService
 import com.persagy.service.SObjectService
+import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SCreateRequest
+import com.persagy.service.models.responses.SCreateResponse
 import com.persagy.service.models.responses.SQueryResponse
+import com.persagy.service.utils.SSpringContextUtil
 
 /**
  * 字典服务
@@ -101,6 +112,20 @@ object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::cla
         return sQueryResponse
     }
 
+    /** 自定义SQL 对象 */
+    private val schemeService by lazy {
+        SSpringContextUtil.getBean(CustomSqlService::class.java) as CustomSqlService
+    }
+
+    /** 设备族 */
+    private val familyService = SObjectService(SMybatisDao(Family::class.java))
+    /** 专业 */
+    private val dictMajorService = SObjectService(SMybatisDao(DictMajor::class.java))
+    /** 详细信息点 需采集信息点配置 */
+    private val defFuncIdGatherService = SObjectService(SMybatisDao(DefFuncIdGather::class.java))
+    /** 设备族和设备类型对应表服务 */
+    private val equipFamilyService = SObjectService(SMybatisDao(EquipFamily::class.java))
+
     /**
      * 项目、建筑、楼层 M 或 L 信息点统计
      *
@@ -173,5 +198,315 @@ object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::cla
     }
 
 
+    /**
+     * 查询设备、部件、系统、专业类型
+     *
+     * @param categoryRequest   类型查询对象
+     * @return 返回结果
+     */
+    fun equipQuery(categoryRequest: CategoryRequest): SQueryResponse<DefClass> {
+        val sQueryResponse = SQueryResponse<DefClass>()
+        if (!categoryRequest.type.isNullOrEmpty()){
+            var dictSchemeCategoryList = ArrayList<DefClass>()
+                var queryBuilder : SQueryBuilder<DefClass>? = null
+                var pageInfo : SPageQueryInfo<DefClass>? = null
+                when (categoryRequest.type) {
+                    "equipment" -> {
+//                    queryBuilder = select(SFilter.eq(SLength("id"), 4), SFilter.not(SFilter.isNull("parentId")))
+//                    pageInfo = queryBuilder.pageQuery(1, 1000)
+
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.eq("parentCode","equipment"),
+                                SFilter.eq("type","common")
+                        ).order("code").exec()
+
+                    }
+                    "component" -> {
+//                    queryBuilder = select(SFilter.eq(SLength("id"), 6), SFilter.not(SFilter.isNull("parentId")),
+//                        SFilter.not(SFilter.eq("parentId","Space")),SFilter.not(SFilter.eq("name","租户"))
+//                    )
+//                    pageInfo = queryBuilder.pageQuery(1, 1000)
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.eq("parentCode","component"),
+                                SFilter.eq("type","common")
+                        ).order("code").exec()
+                    }
+                    "system" -> {
+//                    queryBuilder = select(SFilter.eq(SLength("id"), 2), SFilter.not(SFilter.eq("parentId","AllProfessionalSystemEquipment")))
+//                    pageInfo = queryBuilder.pageQuery(1, 1000)
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.eq("parentCode","system"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                    }
+                    "major" -> {
+//                    queryBuilder = select(SFilter.eq(SLength("id"), 2), SFilter.eq("parentId","AllProfessionalSystemEquipment"))
+////                    pageInfo = queryBuilder.pageQuery(1, 1000)
+                        val dictMajorList = dictMajorService.selectAll().exec()
+                        if (dictMajorList.size>0){
+                            for (dictMajor in dictMajorList){
+                                val defClass = DefClass()
+                                defClass.code = dictMajor.code
+                                defClass.name = dictMajor.name
+                                defClass.aliasName = dictMajor.aliasName
+                                defClass.aliasCode = dictMajor.aliasCode
+                                dictSchemeCategoryList.add(defClass)
+                            }
+                        }
+                    }
+                    "majorSystem" -> {
+//                    val listClassDef = DClassDefService.select(SFilter.eq("parentId", "AllProfessionalSystemEquipment")).exec()
+//                    for (classDef in listClassDef){
+//                        val exec = DClassDefService.select(SFilter.eq("parentId", classDef.id!!)).exec()
+//                        classDef.listClassDef = exec
+//                    }
+//                    pageInfo = SPageQueryInfo(1, 1000)
+//                    pageInfo.content  = listClassDef
+                        val dictMajorList = dictMajorService.selectAll().exec()
+                        if (dictMajorList.size>0){
+                            for (dictMajor in dictMajorList){
+                                val defClass = DefClass()
+                                defClass.code = dictMajor.code
+                                defClass.name = dictMajor.name
+                                defClass.aliasName = dictMajor.aliasName
+                                defClass.aliasCode = dictMajor.aliasCode
+                                val defClassList = defClassService.select(
+                                        SFilter.eq("parentCode", "system"),
+                                        SFilter.eq("type","common"),
+                                        SFilter.eq("majorCode", defClass.code!!)
+                                ).exec()
+                                defClass.children = defClassList
+                                dictSchemeCategoryList.add(defClass)
+                            }
+                        }
+                    }
+                    "space" -> {
+                        /** 业务空间类型 */
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.eq("parentCode","space"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                    }
+                    "majorEquipment" -> {
+                        /** 专业下的设备 */
+                        val dictMajorList = dictMajorService.selectAll().exec()
+                        if (dictMajorList.size>0){
+                            for (dictMajor in dictMajorList){
+                                val defClass = DefClass()
+                                defClass.code = dictMajor.code
+                                defClass.name = dictMajor.name
+                                defClass.aliasName = dictMajor.aliasName
+                                defClass.aliasCode = dictMajor.aliasCode
+                                val defClassList = defClassService.select(
+                                        SFilter.eq("parentCode", "equipment"),
+                                        SFilter.eq("type","common"),
+                                        SFilter.eq("majorCode", defClass.code!!)
+                                ).exec()
+                                defClass.children = defClassList
+                                dictSchemeCategoryList.add(defClass)
+                            }
+                        }
+                    }
+                    "equipmentAndComponent" -> {
+                        /** 设备和部件 */
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.or(SFilter.eq("parentCode","component"),
+                                        SFilter.eq("parentCode","equipment")),
+                                SFilter.eq("type","common")
+
+                        ).exec()
+                    }
+                    "equipmentComponent" ->{
+                        /** 设备下的部件 */
+                        dictSchemeCategoryList = defClassService.select(
+                                SFilter.eq("parentCode","equipment"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                        val defClassList = defClassService.select(
+                                SFilter.eq("parentCode", "component"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                        if (dictSchemeCategoryList.size > 0){
+                            for (dictSchemeCategory in dictSchemeCategoryList){
+                                var list = ArrayList<DefClass>()
+                                for (defClass in defClassList){
+                                    if (defClass.equipmentCode == dictSchemeCategory.code){
+                                        list.add(defClass)
+                                    }
+                                }
+                                if (list.size>0){
+                                    dictSchemeCategory.children = list
+                                }
+                            }
+                        }
+                    }
+                    "majorSystemEquip" -> {
+                        /** 专业下的系统,系统下的设备 */
+                        val dictMajorList = dictMajorService.selectAll().exec()
+                        if (dictMajorList.size>0){
+                            for (dictMajor in dictMajorList){
+                                val defClass = DefClass()
+                                defClass.code = dictMajor.code
+                                defClass.name = dictMajor.name
+                                defClass.aliasName = dictMajor.aliasName
+                                defClass.aliasCode = dictMajor.aliasCode
+                                dictSchemeCategoryList.add(defClass)
+                            }
+                        }
+                        /** 系统 */
+                        val systemList = defClassService.select(
+                                SFilter.eq("parentCode", "system"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                        /** 设备 */
+                        val equipmentList = defClassService.select(
+                                SFilter.eq("parentCode","equipment"),
+                                SFilter.eq("type","common")
+                        ).exec()
+                        /** 系统下的设备 */
+                        for (system in systemList){
+                            for (equipment in equipmentList){
+                                if (system.code == equipment.systemCode){
+                                    if (system.children.isNullOrEmpty()){
+                                        system.children = ArrayList<DefClass>()
+                                    }
+                                    system.children!!.add(equipment)
+                                }
+                            }
+                        }
+                        /** 专业下的系统 */
+                        for (system in systemList){
+                            for (dictMajor in dictSchemeCategoryList){
+                                if (dictMajor.code == system.majorCode ){
+                                    if (dictMajor.children.isNullOrEmpty()){
+                                        dictMajor.children = ArrayList<DefClass>()
+                                    }
+                                    dictMajor.children!!.add(system)
+                                }
+                            }
+                        }
+                    }
+                    "property" -> {
+                        /** 资产 */
+                        val familyList = familyService.selectAll().exec()
+                        for (family in familyList){
+                            val defClass = DefClass()
+                            defClass.code = family.code
+                            defClass.name = family.name
+                            defClass.aliasName = family.code
+                            defClass.aliasCode = family.name
+                            dictSchemeCategoryList.add(defClass)
+                        }
+                    }
+                }
+                sQueryResponse.result = SResponseType.success
+                sQueryResponse.content = dictSchemeCategoryList
+                sQueryResponse.total = dictSchemeCategoryList.size.toLong()
+        }else{
+            sQueryResponse.result = SResponseType.failure
+            sQueryResponse.message = "请输入查询类型"
+        }
+        return sQueryResponse
+    }
+
+    /**
+     * 查询项目下对象类型对应的信息点
+     *
+     * @param request   查询条件
+     * @return 返回结果
+     */
+    fun categoryInfoQuery(request: DictSQueryRequest): SQueryResponse<DefFuncIdGather> {
+        /** 项目id */
+        val projectId = SPageContext.getHeader("projectId")
+        /** 返回对象 */
+        val sQueryResponse = SQueryResponse<DefFuncIdGather>()
+        sQueryResponse.result = SResponseType.failure
+        /** 类型不能为空 */
+        if (!request.type.isNullOrEmpty()) {
+
+                /** 项目定制已存在直接返回 */
+                if(request.type!!.length == 3){
+                    val defFuncIdGatherList = defFuncIdGatherService.select(SFilter.eq("classCode", request.type!!)).exec()
+                    if (defFuncIdGatherList.size>0) {
+                        val dictDefFuncBuilder = defFuncIdGatherService.select(
+                                SFilter.eq("classCode", request.type!!)
+                        )
+                        val dictDefFuncList = dictDefFuncBuilder.table("dict.def_funcid_project").order("sort").exec()
+                        sQueryResponse.content = dictDefFuncList
+                        sQueryResponse.total = dictDefFuncList.size.toLong()
+                    }else {
+                        val familyList = equipFamilyService.select(SFilter.eq("family", request.type!!)).exec()
+                        if (familyList.size>0){
+                            val equipFamily = familyList[0]
+//                            schemeService.dictInfoProperty(projectId!!, dictProject.groupCode!!, equipFamily.equipCode!!,request.type!!)
+                        }
+                    }
+
+                }else {
+                    val dictDefFuncBuilder = defFuncIdGatherService.select(request.filters).filter(
+                            SFilter.eq("type","common"),
+                            SFilter.eq("classCode", request.type!!))
+                    /** 过滤 */
+                    if (null != request.projection) {
+                        dictDefFuncBuilder.projection(request.projection!!)
+                    }
+                    /** 排序 */
+                    if (null != request.orders) {
+                        dictDefFuncBuilder.order(request.orders!!)
+                    }
+
+                    /** 去重 */
+                    if (null != request.distinct && request.distinct!!) {
+                        dictDefFuncBuilder.distinct()
+                    }
+                    val dictDefFuncList = dictDefFuncBuilder.table("dict.def_funcid_gather").order("sort").exec()
+                    sQueryResponse.content = dictDefFuncList
+                    sQueryResponse.total = dictDefFuncList.size.toLong()
+                    sQueryResponse.result = SResponseType.success
+                }
 
+        }else {
+            return  defFuncIdGatherService.pageQuery(request, arrayListOf(SFilter.eq("projectId", projectId!!)))
+        }
+        return sQueryResponse
+    }
+
+    /**
+     * 项目定制化设置
+     *
+     * @param request   字典信息列表
+     * @return 返回结果
+     */
+    fun settingDict(request: SCreateRequest<DefFuncIdGather>): SCreateResponse<DefFuncIdGather> {
+        /** 返回对象实例 */
+        val sCreateResponse = SCreateResponse<DefFuncIdGather>()
+        sCreateResponse.result = SResponseType.failure
+        return try {
+            /** 数组不为空 */
+            if (!request.content.isNullOrEmpty()) {
+                /** 遍历字典信息列表 */
+                for (dictProject in request.content) {
+                    /** 项目id为空重新赋值 */
+                    if (dictProject.projectId.isNullOrEmpty()) {
+                        dictProject.projectId = "0"
+                    }
+                    try {
+                        /** 插入字典信息数据 */
+                        defFuncIdGatherService.update(dictProject)
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+                }
+                sCreateResponse.result = SResponseType.success
+                sCreateResponse.entityList = request.content
+                sCreateResponse
+            } else {
+                sCreateResponse
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            sCreateResponse.message = e.message!!
+            sCreateResponse
+        }
+    }
 }