浏览代码

********************WX***********************
添加微服务和数据中台通讯方式

zhangweixin 4 年之前
父节点
当前提交
fa2933b069
共有 24 个文件被更改,包括 974 次插入598 次删除
  1. 2 3
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/graphtype/rel/RelEquipmentShaft.kt
  2. 2 4
      datacenter/src/main/kotlin/com/persagy/server/jms/TopicReceiver.kt
  3. 28 23
      datacenter/src/main/kotlin/com/persagy/server/services/rel/RTnInSpBaseService.kt
  4. 2 2
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationCalcService.kt
  5. 8 8
      datacenter/src/main/resources/application-prod.yml
  6. 168 164
      datacenter/src/main/resources/logback-spring.xml
  7. 19 0
      datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt
  8. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/CustomProperties.kt
  9. 3 0
      datasyn/src/main/kotlin/com/persagy/server/syn/ServiceNameConfig.kt
  10. 58 92
      datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/ObjectFromToControllers.kt
  11. 79 103
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/dict/DictTypeApi.kt
  12. 101 51
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/BuildingApi.kt
  13. 154 58
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt
  14. 82 35
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/FloorApi.kt
  15. 46 27
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ProjectApi.kt
  16. 15 4
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ShaftApi.kt
  17. 43 12
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SpaceApi.kt
  18. 16 6
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SystemApi.kt
  19. 74 0
      datasyn/src/main/kotlin/com/persagy/server/syn/services/BaseDataService.kt
  20. 40 0
      datasyn/src/main/kotlin/com/persagy/server/syn/utils/LogUtils.kt
  21. 16 1
      datasyn/src/main/resources/application-prod.yml
  22. 14 3
      datasyn/src/main/resources/application-test.yml
  23. 2 0
      equip-component/src/main/kotlin/com/persagy/server/service/EquipmentProSyService.kt
  24. 1 1
      equip-component/src/main/kotlin/com/persagy/server/service/RSyEqService.kt

+ 2 - 3
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/graphtype/rel/RelEquipmentShaft.kt

@@ -27,7 +27,6 @@
 package com.persagy.server.datacenter.models.entities.graphtype.rel
 
 import com.persagy.server.datacenter.models.entities.base.BaseInfo
-import com.persagy.server.datacenter.models.entities.objects.Shaft
 import com.persagy.service.models.annotations.SCascade
 import io.swagger.v3.oas.annotations.media.Schema
 import javax.persistence.Column
@@ -112,7 +111,7 @@ open class RelEquipmentShaft : BaseInfo() {
 
     /** 级联-设备服务的竖井 */
     @Schema(description = "级联-设备服务的竖井")
-    @SCascade(table="r_eq_in_sh", idColumn="equip_id", childIdColumn="shaft_id")
-    var objectInfo: ArrayList<Shaft>? = null
+    @SCascade(table="r_eq_for_sh", idColumn="equip_id", childIdColumn="shaft_id")
+    var objectInfo: ArrayList<RelShaft>? = null
 
 }

+ 2 - 4
datacenter/src/main/kotlin/com/persagy/server/jms/TopicReceiver.kt

@@ -32,8 +32,6 @@ import com.persagy.server.datacenter.models.jms.SynchronousMessage
 import com.persagy.server.datacenter.models.jms.SynchronousMessageRel
 import com.persagy.service.SObjectService
 import com.persagy.service.utils.SJsonUtil
-import org.springframework.amqp.rabbit.annotation.RabbitHandler
-import org.springframework.amqp.rabbit.annotation.RabbitListener
 import org.springframework.stereotype.Component
 import org.springframework.stereotype.Service
 import java.util.*
@@ -63,8 +61,8 @@ class TopicReceiver {
      *
      * @param
      */
-    @RabbitListener(queues = ["queue-center-adm"])
-    @RabbitHandler
+//    @RabbitListener(queues = ["queue-center-adm"])
+//    @RabbitHandler
     fun receiveMessage(message: String) {
         try {
             println("接收数据中心消息 , $message")

+ 28 - 23
datacenter/src/main/kotlin/com/persagy/server/services/rel/RTnInSpBaseService.kt

@@ -138,33 +138,38 @@ object RTnInSpBaseService: RService<RTnInSpBase>(SMybatisDao(RTnInSpBase::class.
             val failureList = ArrayList<Any>()
             rTn2SpService.delete("id1 = '${rTnInSpBaseList.tenantId}'")
             val projectId = SPageContext.getHeader("projectId")
-            for (spaceId in rTnInSpBaseList.spaceIdList!!){
-                val rTn2Sp = RTn2Sp()
-                rTn2Sp.id1 = rTnInSpBaseList.tenantId
-                rTn2Sp.id2 = spaceId
-                rTn2Sp.projectId = projectId
-                rTn2Sp.sign = 1
-                rTn2Sp.zoneType = type
-                rTn2Sp.type = "tn2sp"
-                val replace = rTn2SpService.replace(rTn2Sp)
-                if (replace){
-                    successList.add(spaceId)
-                }else{
-                    failureList.add(rTn2Sp)
+            if (!rTnInSpBaseList.spaceIdList.isNullOrEmpty()) {
+                for (spaceId in rTnInSpBaseList.spaceIdList!!){
+                    val rTn2Sp = RTn2Sp()
+                    rTn2Sp.id1 = rTnInSpBaseList.tenantId
+                    rTn2Sp.id2 = spaceId
+                    rTn2Sp.projectId = projectId
+                    rTn2Sp.sign = 1
+                    rTn2Sp.zoneType = type
+                    rTn2Sp.type = "tn2sp"
+                    val replace = rTn2SpService.replace(rTn2Sp)
+                    if (replace){
+                        successList.add(spaceId)
+                    }else{
+                        failureList.add(rTn2Sp)
+                    }
                 }
-            }
-            if (successList.size>0){
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "tn2sp","13", rTnInSpBaseList.tenantId!!,successList.toJson())
-                val sCreateResponse = SCreateResponse<RTnInSpBase>(SResponseType.success)
-                if (failureList.size>0){
-                    sCreateResponse.message ="失败对象:"+failureList.toJson()
+                if (successList.size>0){
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "tn2sp","13", rTnInSpBaseList.tenantId!!,successList.toJson())
+                    val sCreateResponse = SCreateResponse<RTnInSpBase>(SResponseType.success)
+                    if (failureList.size>0){
+                        sCreateResponse.message ="失败对象:"+failureList.toJson()
+                    }
+                    sCreateResponse
+                }else{
+                    SCreateResponse(SResponseType.failure)
                 }
-                sCreateResponse
-            }else{
-                SCreateResponse(SResponseType.failure)
+            }else {
+                SCreateResponse(SResponseType.success)
             }
 
+
         } catch (e: Exception) {
             e.printStackTrace()
             SCreateResponse(SResponseType.failure,e.message.toString())

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationCalcService.kt

@@ -490,12 +490,12 @@ open class ManualRelationCalcService {
             val relProperty = relPropertyList[0]
 
             for (relZoneSpace in relZoneSpaceList){
-                val rEq2Sh = REqInSh()
+                val rEq2Sh = REqForSh()
                 rEq2Sh.shaftId = relZoneSpace.id
                 rEq2Sh.projectId = projectId
                 rEq2Sh.equipId = relProperty.id
                 rEq2Sh.sign = 1
-                val replace = REqInShService.replace(rEq2Sh)
+                val replace = REqForShService.replace(rEq2Sh)
                 if (replace){
                     /** 发送消息 */
                     rabbitMqService.sendRel(Opt.projectId!!, "Eq2Sh","11",rEq2Sh.equipId!!,rEq2Sh.shaftId!!)

+ 8 - 8
datacenter/src/main/resources/application-prod.yml

@@ -51,14 +51,14 @@ spring:
       max-request-size:                500MB        # 限制上传的多个文件的总大小
       max-file-size:                   500MB        # 限制单个文件的最大值
 
-logging:
-  config: classpath:logback-spring.xml
-  level:
-    root: INFO
-    org.hibernate: INFO
-    org.hibernate.type.descriptor.sql.BasicExtractor: INFO
-    com.ys.adage.mapper: INFO
-    org.springframework: INFO
+#logging:
+#  config: classpath:logback-spring.xml
+#  level:
+#    root: INFO
+#    org.hibernate: INFO
+#    org.hibernate.type.descriptor.sql.BasicExtractor: INFO
+#    com.ys.adage.mapper: INFO
+#    org.springframework: INFO
 
 mqtopid: # 消息
   exchange:                           exchange-dmp

+ 168 - 164
datacenter/src/main/resources/logback-spring.xml

@@ -38,184 +38,188 @@
     </appender>
 
     <!-- 定义cn.sagacloud包的日志级别 -->
-    <logger name="com.persagy" level="DEBUG" additivity="false">
+    <logger name="com.persagy" level="ERROR" additivity="false">
         <appender-ref ref="STDOUT"/>
     </logger>
 
     <!-- 定义com.persagy包的日志级别 -->
-    <logger name="com.persagy" level="DEBUG" additivity="false">
+    <logger name="com.persagy" level="ERROR" additivity="false">
         <appender-ref ref="STDOUT"/>
     </logger>
 
 
     <!-- ERROR级别日志 -->
     <!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 RollingFileAppender -->
-    <appender name="ERROR"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 过滤器,只记录WARN级别的日志 -->
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>ERROR</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-        <!-- 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责出发滚动 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-
-            <!--日志输出位置 可相对、和绝对路径 -->
-            <fileNamePattern>
-                ${log_dir}/dataCenter_app_error.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <!-- 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件假设设置每个月滚动,且<maxHistory>是6, 则只保存最近6个月的文件,删除之前的旧文件。注意,删除旧文件是,那些为了归档而创建的目录也会被删除 -->
-            <maxHistory>${maxHistory}</maxHistory>
-            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>${maxFileSize}</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-
-        </rollingPolicy>
-
-
-        <!-- 按照固定窗口模式生成日志文件,当文件大于20MB时,生成新的日志文件。窗口大小是1到3,当保存了3个归档文件后,将覆盖最早的日志。
-            <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
-            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/.log.zip</fileNamePattern> <minIndex>1</minIndex>
-            <maxIndex>3</maxIndex> </rollingPolicy> -->
-        <!-- 查看当前活动文件的大小,如果超过指定大小会告知RollingFileAppender 触发当前活动文件滚动 <triggeringPolicy
-            class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>5MB</maxFileSize>
-            </triggeringPolicy> -->
-
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-
-
-    <!-- WARN级别日志 appender -->
-    <appender name="WARN"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 过滤器,只记录WARN级别的日志 -->
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>WARN</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 按天回滚 daily -->
-            <fileNamePattern>
-                ${log_dir}/dataCenter_app_warn.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>${maxHistory}</maxHistory>
-            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>${maxFileSize}</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-
-
-
-    <!-- INFO级别日志 appender -->
-    <appender name="INFO"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 过滤器,只记录INFO级别的日志 -->
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>INFO</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 按天回滚 daily -->
-            <fileNamePattern>
-                ${log_dir}/dataCenter_app_info.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>${maxHistory}</maxHistory>
-            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>${maxFileSize}</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-
-
-
-    <!-- DEBUG级别日志 appender -->
-    <appender name="DEBUG"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 过滤器,只记录DEBUG级别的日志 -->
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>DEBUG</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 按天回滚 daily -->
-            <fileNamePattern>
-                ${log_dir}/dataCenter_app_debug.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>${maxHistory}</maxHistory>
-            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>${maxFileSize}</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <!-- TRACE级别日志 appender -->
-    <appender name="TRACE"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 过滤器,只记录ERROR级别的日志 -->
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>TRACE</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 按天回滚 daily -->
-            <fileNamePattern>
-                ${log_dir}/dataCenter_app_trace.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>${maxHistory}</maxHistory>
-
-            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>${maxFileSize}</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <logger name="java.sql.PreparedStatement" value="DEBUG" />
-    <logger name="java.sql.Connection" value="DEBUG" />
-    <logger name="java.sql.Statement" value="DEBUG" />
-    <logger name="com.ibatis" value="DEBUG" />
-    <logger name="com.ibatis.common.jdbc.SimpleDataSource" value="DEBUG" />
-    <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" />
-    <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate"
-            value="DEBUG" />
-    <logger name="com.apache.ibatis" level="TRACE" />
+<!--    <appender name="ERROR"-->
+<!--              class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 过滤器,只记录WARN级别的日志 &ndash;&gt;-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>ERROR</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--        &lt;!&ndash; 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责出发滚动 &ndash;&gt;-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+
+<!--            &lt;!&ndash;日志输出位置 可相对、和绝对路径 &ndash;&gt;-->
+<!--            <fileNamePattern>-->
+<!--                ${log_dir}/dataCenter_app_error.%d{yyyy-MM-dd}.%i.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件假设设置每个月滚动,且<maxHistory>是6, 则只保存最近6个月的文件,删除之前的旧文件。注意,删除旧文件是,那些为了归档而创建的目录也会被删除 &ndash;&gt;-->
+<!--            <maxHistory>${maxHistory}</maxHistory>-->
+<!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
+<!--                <maxFileSize>${maxFileSize}</maxFileSize>-->
+<!--            </timeBasedFileNamingAndTriggeringPolicy>-->
+
+<!--        </rollingPolicy>-->
+
+
+<!--        &lt;!&ndash; 按照固定窗口模式生成日志文件,当文件大于20MB时,生成新的日志文件。窗口大小是1到3,当保存了3个归档文件后,将覆盖最早的日志。-->
+<!--            <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">-->
+<!--            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/.log.zip</fileNamePattern> <minIndex>1</minIndex>-->
+<!--            <maxIndex>3</maxIndex> </rollingPolicy> &ndash;&gt;-->
+<!--        &lt;!&ndash; 查看当前活动文件的大小,如果超过指定大小会告知RollingFileAppender 触发当前活动文件滚动 <triggeringPolicy-->
+<!--            class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>5MB</maxFileSize>-->
+<!--            </triggeringPolicy> &ndash;&gt;-->
+
+<!--        <encoder>-->
+<!--            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+
+
+
+<!--    &lt;!&ndash; WARN级别日志 appender &ndash;&gt;-->
+<!--    <appender name="WARN"-->
+<!--              class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 过滤器,只记录WARN级别的日志 &ndash;&gt;-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>WARN</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 按天回滚 daily &ndash;&gt;-->
+<!--            <fileNamePattern>-->
+<!--                ${log_dir}/dataCenter_app_warn.%d{yyyy-MM-dd}.%i.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 日志最大的历史 60天 &ndash;&gt;-->
+<!--            <maxHistory>${maxHistory}</maxHistory>-->
+<!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
+<!--                <maxFileSize>${maxFileSize}</maxFileSize>-->
+<!--            </timeBasedFileNamingAndTriggeringPolicy>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+
+
+
+
+<!--    &lt;!&ndash; INFO级别日志 appender &ndash;&gt;-->
+<!--    <appender name="INFO"-->
+<!--              class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 过滤器,只记录INFO级别的日志 &ndash;&gt;-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>INFO</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 按天回滚 daily &ndash;&gt;-->
+<!--            <fileNamePattern>-->
+<!--                ${log_dir}/dataCenter_app_info.%d{yyyy-MM-dd}.%i.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 日志最大的历史 60天 &ndash;&gt;-->
+<!--            <maxHistory>${maxHistory}</maxHistory>-->
+<!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
+<!--                <maxFileSize>${maxFileSize}</maxFileSize>-->
+<!--            </timeBasedFileNamingAndTriggeringPolicy>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+
+
+
+
+<!--    &lt;!&ndash; DEBUG级别日志 appender &ndash;&gt;-->
+<!--    <appender name="DEBUG"-->
+<!--              class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 过滤器,只记录DEBUG级别的日志 &ndash;&gt;-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>DEBUG</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 按天回滚 daily &ndash;&gt;-->
+<!--            <fileNamePattern>-->
+<!--                ${log_dir}/dataCenter_app_debug.%d{yyyy-MM-dd}.%i.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 日志最大的历史 60天 &ndash;&gt;-->
+<!--            <maxHistory>${maxHistory}</maxHistory>-->
+<!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
+<!--                <maxFileSize>${maxFileSize}</maxFileSize>-->
+<!--            </timeBasedFileNamingAndTriggeringPolicy>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+
+<!--    &lt;!&ndash; TRACE级别日志 appender &ndash;&gt;-->
+<!--    <appender name="TRACE"-->
+<!--              class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 过滤器,只记录ERROR级别的日志 &ndash;&gt;-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>TRACE</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 按天回滚 daily &ndash;&gt;-->
+<!--            <fileNamePattern>-->
+<!--                ${log_dir}/dataCenter_app_trace.%d{yyyy-MM-dd}.%i.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 日志最大的历史 60天 &ndash;&gt;-->
+<!--            <maxHistory>${maxHistory}</maxHistory>-->
+
+<!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
+<!--                <maxFileSize>${maxFileSize}</maxFileSize>-->
+<!--            </timeBasedFileNamingAndTriggeringPolicy>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+
+<!--    <logger name="java.sql.PreparedStatement" value="DEBUG" />-->
+<!--    <logger name="java.sql.Connection" value="DEBUG" />-->
+<!--    <logger name="java.sql.Statement" value="DEBUG" />-->
+<!--    <logger name="com.ibatis" value="DEBUG" />-->
+<!--    <logger name="com.ibatis.common.jdbc.SimpleDataSource" value="DEBUG" />-->
+<!--    <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" />-->
+<!--    <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate"-->
+<!--            value="DEBUG" />-->
+<!--    <logger name="com.apache.ibatis" level="TRACE" />-->
 
 
 
     <!-- 定义日志级别 -->
     <!-- root级别 DEBUG -->
-    <root level="debug">
-        <!-- 文件输出 -->
-        <appender-ref ref="ERROR" />
-        <appender-ref ref="INFO" />
-        <appender-ref ref="WARN" />
-        <appender-ref ref="DEBUG" />
-        <appender-ref ref="TRACE" />
+<!--    <root level="debug">-->
+<!--        &lt;!&ndash; 文件输出 &ndash;&gt;-->
+<!--        <appender-ref ref="ERROR" />-->
+<!--        <appender-ref ref="INFO" />-->
+<!--        <appender-ref ref="WARN" />-->
+<!--        <appender-ref ref="DEBUG" />-->
+<!--        <appender-ref ref="TRACE" />-->
+<!--    </root>-->
+    <!-- 定义日志级别 -->
+    <root level="ERROR">
+        <appender-ref ref="STDOUT" />
     </root>
 </configuration>

+ 19 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt

@@ -28,7 +28,9 @@ package com.persagy.server.syn
 
 import com.alibaba.fastjson.JSONArray
 import com.alibaba.fastjson.JSONObject
+import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
+import org.springframework.web.client.RestTemplate
 
 /**
  * 配置文件
@@ -40,6 +42,23 @@ object Configure {
     /** 日志 */
     private val logger = LoggerFactory.getLogger(Configure::class.java)
 
+    /** 配置实例 */
+     val opts: Opts by lazy {
+        SSpringContextUtil.getBean(Opts::class.java) as Opts
+    }
+    /** 获取配置文件的服务名 */
+     val serviceNameConfig by lazy {
+        SSpringContextUtil.getBean(ServiceNameConfig::class.java) as ServiceNameConfig
+    }
+    /** 获取配置自定义属性 */
+     val customProperties by lazy {
+        SSpringContextUtil.getBean(CustomProperties::class.java) as CustomProperties
+    }
+    /** Rest服务 */
+     val restTemplate by lazy {
+        SSpringContextUtil.getBean(RestTemplate::class.java) as RestTemplate
+    }
+
     /** 标记 */
     var flag: Boolean = true
     var messageTypeDataCerten = 1

+ 1 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/CustomProperties.kt

@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component
  * @date  2021/1/12 16:09
  */
 @Component
-@ConfigurationProperties(prefix = "sagas")
+@ConfigurationProperties(prefix = "custom")
 class CustomProperties {
 
 

+ 3 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/ServiceNameConfig.kt

@@ -43,5 +43,8 @@ class ServiceNameConfig {
     lateinit var DMPORG: String
     /** 中台 */
     lateinit var DMPRWD: String
+    /** 字典 */
+    lateinit var DMPDIC: String
+
 
 }

+ 58 - 92
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/ObjectFromToControllers.kt

@@ -30,18 +30,14 @@ import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
 import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
-import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.assistant.PointPosition
-import com.persagy.server.datacenter.models.entities.dictnew.DictProject
-import com.persagy.server.datacenter.models.entities.dictnew.Group
-import com.persagy.server.datacenter.models.entities.objects.*
+import com.persagy.server.datacenter.models.entities.objects.SpaceOutline
 import com.persagy.server.datacenter.models.entities.rel.RSpinBd
 import com.persagy.server.datacenter.models.entities.rel.RSpinFl
 import com.persagy.server.syn.models.api.obj.*
 import com.persagy.server.syn.models.tools.*
+import com.persagy.server.syn.services.BaseDataService
 import com.persagy.server.syn.services.dict.DClassDefService
-import com.persagy.service.SBaseService
-import com.persagy.service.SObjectService
 import com.persagy.service.models.enums.SResponseType
 import com.persagy.service.models.responses.SBaseResponse
 import io.swagger.v3.oas.annotations.Operation
@@ -67,32 +63,6 @@ class ObjectFromToControllers {
         private val logger = LoggerFactory.getLogger(ObjectFromToControllers::class.java)
     } // Companion object
 
-    /** 集团服务 */
-    private val groupService = SBaseService(SMybatisDao(Group::class.java))
-    /** 字典项目服务 */
-    private val dictProjectService = SBaseService(SMybatisDao(DictProject::class.java))
-    /** 数据中心项目服务 */
-    private val projectService = SObjectService(SMybatisDao(Project::class.java))
-    /** 数据中心建筑服务 */
-    private val buildingService = SObjectService(SMybatisDao(Building::class.java))
-    /** 数据中心楼层服务 */
-    private val floorService = SObjectService(SMybatisDao(Floor::class.java))
-    /** 数据中心设备服务 */
-    private val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
-    /** 建筑下的空间 */
-    private val rSpinBdService = SObjectService(SMybatisDao(RSpinBd::class.java))
-    /** 楼层下的空间 */
-    private val rSpinFlService = SObjectService(SMybatisDao(RSpinFl::class.java))
-    /** 业务空间 */
-    private val zoneSpaceService = SObjectService(SMybatisDao(ZoneSpace::class.java))
-    /** 系统服务 */
-    private val generalSystemService = SObjectService(SMybatisDao(GeneralSystem::class.java))
-    /** 竖井 */
-    private val shaftService = SObjectService(SMybatisDao(Shaft::class.java))
-    /** 楼层轮廓线 */
-    private val floorOutlineService = SObjectService(SMybatisDao(FloorOutline::class.java))
-    /** 空间轮廓线 */
-    private val spaceOutlineService = SObjectService(SMybatisDao(SpaceOutline::class.java))
 
     /**
      * 项目信息 - 数据中台存储到数据中心,根据集团获取集团写所有项目
@@ -105,21 +75,17 @@ class ObjectFromToControllers {
             DClassDefService.groupQuerys()
             /** 项目数据 */
             DClassDefService.dictProject()
-
-            val groupList = dictProjectService.selectAll().exec()
+            val groupList = BaseDataService.dictProjectService.selectAll().exec()
             for (group in groupList) {
                 val projectQueryList = ProjectApi.projectQuery(group.groupCode!!,group.id!!)
-
                 if (projectQueryList.size > 0) {
                     for (projectQuery in projectQueryList) {
                         val projectDataConversion = ProjectUtil.projectDataConversions(group.groupCode!!, projectQuery)
                         logger.debug("项目:  ${projectDataConversion.toJson()} ")
-
-                        projectService.replace(projectDataConversion)
+                        BaseDataService.projectService.replace(projectDataConversion)
                     }
                 }
             }
-
             SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
@@ -140,18 +106,18 @@ class ObjectFromToControllers {
             /** 项目数据 */
             DClassDefService.dictProject()
             if (!sign){
-                val dictProject = dictProjectService.select(SFilter.eq("id",projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id",projectId)).entity()
                 val projectQueryList = ProjectApi.projectQuery(dictProject!!.groupCode!!,projectId!!)
                 if (projectQueryList.size > 0) {
                     for (projectQuery in projectQueryList) {
                         logger.debug("项目1:  ${projectQuery.toJson()} ")
                         val projectDataConversion = ProjectUtil.projectDataConversions(dictProject!!.groupCode!!, projectQuery)
                         logger.debug("项目:  ${projectDataConversion.toJson()} ")
-                        projectService.replace(projectDataConversion)
+                        BaseDataService.projectService.replace(projectDataConversion)
                     }
                 }
             } else {
-                val dictProjectList = dictProjectService.selectAll().exec()
+                val dictProjectList = BaseDataService.dictProjectService.selectAll().exec()
                 for (dictProject in dictProjectList) {
                     val projectQueryList = ProjectApi.projectQuery(dictProject!!.groupCode!!,projectId!!)
                     if (projectQueryList.size > 0) {
@@ -159,7 +125,7 @@ class ObjectFromToControllers {
                             logger.debug("项目1:  ${projectQuery.toJson()} ")
                             val projectDataConversion = ProjectUtil.projectDataConversions(dictProject!!.groupCode!!, projectQuery)
                             logger.debug("项目:  ${projectDataConversion.toJson()} ")
-                            projectService.replace(projectDataConversion)
+                            BaseDataService.projectService.replace(projectDataConversion)
                         }
                     }
                 }
@@ -181,30 +147,30 @@ class ObjectFromToControllers {
     fun buildingSyn( @RequestParam projectId: String, @RequestParam switch: Boolean = true): SBaseResponse {
         return try {
             if (switch) {
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val buildingSynList = BuildingApi.buildingSyn(dictProject!!.groupCode!!,projectId,"building")
                 if (buildingSynList.size > 0) {
                     for (buildingSyn in buildingSynList) {
                         val buildingDataConversion =
                             BuildingUtil.buildingDataConversions(projectId, dictProject!!.groupCode!!, buildingSyn)
                         logger.debug("建筑:  ${buildingDataConversion.toJson()} ")
-                        buildingService.replace(buildingDataConversion)
+                        BaseDataService.buildingService.replace(buildingDataConversion)
 
                     }
                 }
 
             } else {
                 /** 查询所有的项目 */
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val buildingSynList = BuildingApi.buildingSyn(dictProject!!.groupCode!!,projectId,"building")
                     if (buildingSynList.size > 0) {
                         for (buildingSyn in buildingSynList) {
                             val buildingDataConversion =
                                 BuildingUtil.buildingDataConversions(project.id!!, dictProject!!.groupCode!!, buildingSyn)
                             logger.debug("建筑:  ${buildingDataConversion.toJson()} ")
-                            buildingService.replace(buildingDataConversion)
+                            BaseDataService.buildingService.replace(buildingDataConversion)
                         }
                     }
                 }
@@ -225,7 +191,7 @@ class ObjectFromToControllers {
     fun floorSyn(@RequestParam projectId: String, @RequestParam switch: Boolean = true): SBaseResponse {
         return try {
             if (switch){
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val floorSynList = BuildingApi.buildingSyn(dictProject!!.groupCode!!,projectId, "floor")
                 if (floorSynList.size>0) {
                     for (floorSyn in floorSynList){
@@ -240,7 +206,7 @@ class ObjectFromToControllers {
                                 }
                             }
                         }
-                        floorService.replace(floor)
+                        BaseDataService.floorService.replace(floor)
                         val containsKeyOutline = floorSyn.containsKey("outline")
                         if (containsKeyOutline){
                             val id = floorSyn["id"].toString()
@@ -253,14 +219,14 @@ class ObjectFromToControllers {
 //                            floorOutlineService.replace(FloorOutline(id,outline))
                             floor.outline = outline
                         }
-                        floorService.replace(floor)
+                        BaseDataService.floorService.replace(floor)
                     }
                 }
             } else {
                 /** 查询所有的项目 */
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val floorSynList = BuildingApi.buildingSyn(dictProject!!.groupCode!!,projectId, "floor")
                     if (floorSynList.size>0) {
                         for (floorSyn in floorSynList){
@@ -275,7 +241,7 @@ class ObjectFromToControllers {
                                     }
                                 }
                             }
-                            floorService.replace(floor)
+                            BaseDataService.floorService.replace(floor)
                         }
                     }
                 }
@@ -303,7 +269,7 @@ class ObjectFromToControllers {
         return try {
             var num = page
             if (switch) {
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val equipSynApi = EquipApi.equipSynApi(dictProject!!.groupCode!!,projectId, page)
                 val equipDataList = equipSynApi.data
                 for (equipData in equipDataList!!){
@@ -328,23 +294,23 @@ class ObjectFromToControllers {
                         }
                         if (equipSyn.buildingId.isNullOrEmpty()){
                             if (!equipSyn.floorId.isNullOrEmpty()){
-                                val floor = floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
                                 if (floor!=null){
                                     equipSyn.buildingId = floor.buildingId
                                 }
                             }
                         }
                     }
-                    equipmentService.replace(equipSyn)
+                    BaseDataService.equipmentService.replace(equipSyn)
                 }
                 if (equipSynApi.data!!.size>= 1000){
                     num ++
                     equipSyn(projectId,switch,isBuildingFloor,num)
                 }
             } else {
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val equipSynApi = EquipApi.equipSynApi(dictProject!!.groupCode!!,project.id!!, page)
                     val equipDataList = equipSynApi.data
                     for (equipData in equipDataList!!){
@@ -368,14 +334,14 @@ class ObjectFromToControllers {
                             }
                             if (equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
                                 if (!equipSyn.floorId.isNullOrEmpty()){
-                                    val floor = floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                    val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
                                     if (floor!=null){
                                         equipSyn.buildingId = floor.buildingId
                                     }
                                 }
                             }
                         }
-                        equipmentService.replace(equipSyn)
+                        BaseDataService.equipmentService.replace(equipSyn)
                     }
                     if (equipSynApi.data!!.size>= 1000){
                         num ++
@@ -398,7 +364,7 @@ class ObjectFromToControllers {
     fun equipSynAll(@RequestParam projectId: String,@RequestParam switch: Boolean = true,@RequestParam isBuildingFloor: Boolean = true): SBaseResponse {
         return try {
             if (switch) {
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val equipSynApi = EquipApi.equipSynApiAll(dictProject!!.groupCode!!,projectId)
                 logger.debug("数量 = ${equipSynApi.data?.size}")
 //                return  SBaseResponse(SResponseType.success)
@@ -425,19 +391,19 @@ class ObjectFromToControllers {
                         }
                         if (equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
                             if (!equipSyn.floorId.isNullOrEmpty()){
-                                val floor = floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
                                 if (floor!=null){
                                     equipSyn.buildingId = floor.buildingId
                                 }
                             }
                         }
                     }
-                    equipmentService.replace(equipSyn)
+                    BaseDataService.equipmentService.replace(equipSyn)
                 }
             } else {
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val equipSynApi = EquipApi.equipSynApiAll(dictProject!!.groupCode!!,project.id!!)
                     val equipDataList = equipSynApi.data
                     for (equipData in equipDataList!!){
@@ -461,14 +427,14 @@ class ObjectFromToControllers {
                             }
                             if (equipSyn.buildingId.isNullOrEmpty()){
                                 if (!equipSyn.floorId.isNullOrEmpty()){
-                                    val floor = floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                    val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
                                     if (floor!=null){
                                         equipSyn.buildingId = floor.buildingId
                                     }
                                 }
                             }
                         }
-                        equipmentService.replace(equipSyn)
+                        BaseDataService.equipmentService.replace(equipSyn)
                     }
                 }
             }
@@ -496,14 +462,14 @@ class ObjectFromToControllers {
     fun spaceSyn(@RequestParam projectId: String,@RequestParam switch: Boolean = true,@RequestParam isBuildingFloor:Boolean = true): SBaseResponse {
         return try {
             if (switch){
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val spaceSynApiList = SpaceApi.spaceSynApi(dictProject!!.groupCode!!,projectId)
                 if (spaceSynApiList.size>0){
                     for (spaceSyn in spaceSynApiList){
                         val spaceDataConversion =
                             SpaceUtil.spaceDataConversions(projectId, dictProject!!.groupCode!!, spaceSyn)
                         logger.debug("打印空间02 = ${spaceDataConversion.toJson()}")
-                        zoneSpaceService.replace(spaceDataConversion)
+                        BaseDataService.zoneSpaceService.replace(spaceDataConversion)
                         if (isBuildingFloor){
                             val spaceInBuildingList = SpaceApi.spaceInBuilding(dictProject!!.groupCode!!,projectId, spaceDataConversion.id!!)
                             if (spaceInBuildingList.size>0){
@@ -515,7 +481,7 @@ class ObjectFromToControllers {
                                     rSpinBd.sign = 1
                                     rSpinBd.spaceId = spaceDataConversion.id
                                     rSpinBd.objectType = spaceDataConversion.classCode
-                                    rSpinBdService.replace(rSpinBd)
+                                    BaseDataService.rSpinBdService.replace(rSpinBd)
                                 }
                             }
                             val spaceInFloorList = SpaceApi.spaceInFloor(dictProject!!.groupCode!!,projectId, spaceDataConversion.id!!)
@@ -523,7 +489,7 @@ class ObjectFromToControllers {
                                 for (spaceInFloor in spaceInFloorList){
                                     val any = spaceInFloor["objFrom"].toString()
                                     val floor =
-                                        floorService.select(SFilter.eq("id", spaceInFloor["objFrom"].toString())).entity()
+                                        BaseDataService.floorService.select(SFilter.eq("id", spaceInFloor["objFrom"].toString())).entity()
                                     val rSpinFl = RSpinFl()
                                     spaceDataConversion.floorId = spaceInFloor["objFrom"].toString()
 
@@ -534,7 +500,7 @@ class ObjectFromToControllers {
                                     rSpinFl.sign = 1
                                     rSpinFl.spaceId = spaceDataConversion.id
                                     logger.debug("空間和楼层关系 = ${rSpinFl.toJson()} *************************************************************************************************************")
-                                    rSpinFlService.replace(rSpinFl)
+                                    BaseDataService.rSpinFlService.replace(rSpinFl)
                                     if (spaceDataConversion.buildingId.isNullOrEmpty()) {
                                         spaceDataConversion.buildingId = floor?.buildingId
                                         val rSpinBd = RSpinBd()
@@ -543,7 +509,7 @@ class ObjectFromToControllers {
                                         rSpinBd.sign = 1
                                         rSpinBd.spaceId = spaceDataConversion.id
                                         rSpinBd.objectType = spaceDataConversion.classCode
-                                        rSpinBdService.replace(rSpinBd)
+                                        BaseDataService. rSpinBdService.replace(rSpinBd)
                                     }
                                 }
                             }
@@ -560,24 +526,24 @@ class ObjectFromToControllers {
 //                                spaceOutlineService.replace(SpaceOutline(id,outline))
                                 spaceDataConversion.outline = outline
                             }
-                            zoneSpaceService.update(spaceDataConversion)
+                            BaseDataService.zoneSpaceService.update(spaceDataConversion)
                         }
 
                     }
                 }
             } else {
                 /** 查询所有的项目 */
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
                     val projectId = project.id!!
-                    val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                     val spaceSynApiList = SpaceApi.spaceSynApi(dictProject!!.groupCode!!,projectId)
                     if (spaceSynApiList.size>0){
                         for (spaceSyn in spaceSynApiList){
                             val spaceDataConversion =
                                 SpaceUtil.spaceDataConversions(projectId, dictProject!!.groupCode!!, spaceSyn)
 
-                            zoneSpaceService.replace(spaceDataConversion)
+                            BaseDataService.zoneSpaceService.replace(spaceDataConversion)
                             if (isBuildingFloor){
                                 val spaceInBuildingList = SpaceApi.spaceInBuilding(dictProject!!.groupCode!!,projectId, spaceDataConversion.id!!)
                                 if (spaceInBuildingList.size>0){
@@ -589,7 +555,7 @@ class ObjectFromToControllers {
                                         rSpinBd.sign = 1
                                         rSpinBd.spaceId = spaceDataConversion.id
                                         rSpinBd.objectType = spaceDataConversion.classCode
-                                        rSpinBdService.replace(rSpinBd)
+                                        BaseDataService.rSpinBdService.replace(rSpinBd)
                                     }
                                 }
                                 val spaceInFloorList = SpaceApi.spaceInFloor(dictProject!!.groupCode!!,projectId, spaceDataConversion.id!!)
@@ -597,7 +563,7 @@ class ObjectFromToControllers {
                                     for (spaceInFloor in spaceInFloorList){
                                         val any = spaceInFloor["objFrom"].toString()
                                         val floor =
-                                            floorService.select(SFilter.eq("id", spaceInFloor["objFrom"].toString())).entity()
+                                            BaseDataService.floorService.select(SFilter.eq("id", spaceInFloor["objFrom"].toString())).entity()
                                         spaceDataConversion.floorId = spaceInFloor["objFrom"].toString()
                                         val rSpinFl = RSpinFl()
                                         rSpinFl.buildingId = floor?.buildingId
@@ -606,10 +572,10 @@ class ObjectFromToControllers {
                                         rSpinFl.projectId = projectId
                                         rSpinFl.sign = 1
                                         rSpinFl.spaceId = spaceDataConversion.id
-                                        rSpinFlService.replace(rSpinFl)
+                                        BaseDataService.rSpinFlService.replace(rSpinFl)
                                     }
                                 }
-                                zoneSpaceService.update(spaceDataConversion)
+                                BaseDataService.zoneSpaceService.update(spaceDataConversion)
                                 val containsKey = spaceSyn.containsKey("outline")
                                 if (containsKey){
                                     val id = spaceSyn["id"].toString()
@@ -619,7 +585,7 @@ class ObjectFromToControllers {
                                     val type = object : TypeToken<ArrayList<ArrayList<ArrayList<PointPosition>>>>() {
                                     }.type
                                     var outline=  Gson().fromJson<ArrayList<ArrayList<ArrayList<PointPosition>>>>(replace3,type)
-                                    spaceOutlineService.replace(SpaceOutline(id,outline))
+                                    BaseDataService.spaceOutlineService.replace(SpaceOutline(id,outline))
                                 }
                             }
                         }
@@ -646,26 +612,26 @@ class ObjectFromToControllers {
     fun systemSyn(@RequestParam projectId: String,@RequestParam switch: Boolean = true,@RequestParam isBuildingFloor:Boolean = true): SBaseResponse {
         return try {
             if (switch) {
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val systemQueryList = SystemApi.systemQuery(dictProject!!.groupCode!!,projectId)
                 if (systemQueryList.size>0){
                     for (systemQuery in systemQueryList){
                         val spaceDataConversion =
                             SystemUtil.systemDataConversions(projectId, dictProject!!.groupCode!!, systemQuery)
-                        generalSystemService.replace(spaceDataConversion)
+                        BaseDataService.generalSystemService.replace(spaceDataConversion)
                     }
                 }
             } else {
                 /** 查询所有的项目 */
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val systemQueryList = SystemApi.systemQuery(dictProject!!.groupCode!!,project.id!!)
                     if (systemQueryList.size>0){
                         for (systemQuery in systemQueryList){
                             val spaceDataConversion =
                                 SystemUtil.systemDataConversions(project.id!!, dictProject!!.groupCode!!, systemQuery)
-                            generalSystemService.replace(spaceDataConversion)
+                            BaseDataService.generalSystemService.replace(spaceDataConversion)
                         }
                     }
                 }
@@ -690,26 +656,26 @@ class ObjectFromToControllers {
     fun shaftSyn(@RequestParam projectId: String,@RequestParam switch: Boolean = true,@RequestParam isBuildingFloor:Boolean = true): SBaseResponse {
         return try {
             if (switch){
-                val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+                val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", projectId)).entity()
                 val shaftQueryList = ShaftApi.shaftQuery(dictProject!!.groupCode!!,projectId)
                 if (!shaftQueryList.isNullOrEmpty()) {
                     for (shaftQuery in shaftQueryList) {
                         val shaftDataConversion =
                             ShaftUtil.shaftDataConversions(projectId, dictProject?.groupCode!!, shaftQuery)
-                        shaftService.replace(shaftDataConversion)
+                        BaseDataService.shaftService.replace(shaftDataConversion)
                     }
                 }
             } else {
                 /** 查询所有的项目 */
-                val projectList = projectService.selectAll().exec()
+                val projectList = BaseDataService.projectService.selectAll().exec()
                 for (project in projectList){
-                    val dictProject = dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
+                    val dictProject = BaseDataService.dictProjectService.select(SFilter.eq("id", project.id!!)).entity()
                     val shaftQueryList = ShaftApi.shaftQuery(dictProject!!.groupCode!!,project.id!!)
                     if (!shaftQueryList.isNullOrEmpty()) {
                         for (shaftQuery in shaftQueryList) {
                             val shaftDataConversion =
                                 ShaftUtil.shaftDataConversions(project.id!!, dictProject?.groupCode!!, shaftQuery)
-                            shaftService.replace(shaftDataConversion)
+                            BaseDataService.shaftService.replace(shaftDataConversion)
                         }
                     }
                 }

+ 79 - 103
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/dict/DictTypeApi.kt

@@ -30,18 +30,14 @@ import com.alibaba.fastjson.JSONArray
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.extensions.toJson
 import com.persagy.base.utils.SHttpUtil
-import com.persagy.server.syn.CustomProperties
-import com.persagy.server.syn.Opts
-import com.persagy.server.syn.ServiceNameConfig
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.DictPlatformInfo
 import com.persagy.server.syn.models.DictPlatformType
 import com.persagy.server.syn.models.DictProject
 import com.persagy.server.syn.models.Group
 import com.persagy.server.syn.models.response.*
 import com.persagy.server.syn.services.dict.DClassDefService
-import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
-import org.springframework.web.client.RestTemplate
 
 /**
  * 字典API
@@ -52,35 +48,14 @@ import org.springframework.web.client.RestTemplate
 object DictTypeApi {
     // 日志
     private val logger = LoggerFactory.getLogger(DictTypeApi::class.java)
-    /** 配置实例 */
-    private val opts: Opts by lazy {
-        SSpringContextUtil.getBean(Opts::class.java) as Opts
-    } // opts
-
-    /** 获取配置文件的服务名 */
-    val serviceNameConfig by lazy {
-        SSpringContextUtil.getBean(ServiceNameConfig::class.java) as ServiceNameConfig
-    }
-
-    /** 获取配置自定义属性 */
-    val customProperties by lazy {
-        SSpringContextUtil.getBean(CustomProperties::class.java) as CustomProperties
-    }
-
-    /** Rest服务 */
-    val restTemplate by lazy {
-        SSpringContextUtil.getBean(RestTemplate::class.java) as RestTemplate
-    }
 
     /**
      * 字典类型
      */
     fun dictTypeHttp(){
 
-       val url = "${opts.dataPlatform}dict/class?&groupId=wd&schemeId=7&projectId=Pj1101050029&appId=datautils&subFlag=false"
-
+       val url = "${Configure.opts.dataPlatform}dict/class?&groupId=wd&schemeId=7&projectId=Pj1101050029&appId=datautils&subFlag=false"
         val request = SHttpUtil.getRequest(url)
-
     } // Fun dictTypeHttp()
 
 
@@ -94,8 +69,9 @@ object DictTypeApi {
             val jsonObject2 = JSONObject()
             jsonObject["criteria"] = jsonObject2
             /** 直接 http 请求还是通过注册中心 */
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/org/group/query"
+            logger.debug("标记=${Configure.customProperties.eurekaorhttp}")
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/org/group/query"
                 val postObject = SHttpUtil.postObject<GroupResponse>(url, jsonObject)
                 DClassDefService.logger.debug("集团结果:${postObject.toJson()}")
                 if (postObject.result == "success"){
@@ -105,8 +81,8 @@ object DictTypeApi {
                 }
             } else {
                 /** 注册中心 */
-                val url = "${serviceNameConfig.DMPORG}/org/group/query"
-                val postForObject = restTemplate.postForObject(url, jsonObject, GroupResponse::class.java)
+                val url = "http://${Configure.serviceNameConfig.DMPORG}/org/group/query"
+                val postForObject = Configure.restTemplate.postForObject(url, jsonObject, GroupResponse::class.java)
                 DClassDefService.logger.debug("集团结果:${postForObject.toJson()}")
                 if (postForObject.result == "success"){
                     if (!postForObject.data.isNullOrEmpty()){
@@ -134,24 +110,24 @@ object DictTypeApi {
             jsonObject2["groupCode"] = code
             jsonObject["criteria"] = jsonObject2
             /** 直接 http 请求还是通过注册中心 */
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/org/project/query?userId=123456&groupCode=$code"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/org/project/query?userId=123456&groupCode=$code"
 
                 DClassDefService.logger.debug("url:${url}")
                 DClassDefService.logger.debug("项目请求体:${jsonObject.toJson()}")
                 val postObject = SHttpUtil.postObject<DictProjectResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE){
+                if (postObject.result == Configure.opts.SUCCESS_CODE){
                     if (!postObject.data.isNullOrEmpty()){
                         return  postObject.data!!
                     }
                 }
             }else {
-                val url = "${serviceNameConfig.DMPORG}/org/project/query?userId=123456&groupCode=$code"
+                val url = "http://${Configure.serviceNameConfig.DMPORG}/org/project/query?userId=123456&groupCode=$code"
                 DClassDefService.logger.debug("url:${url}")
                 DClassDefService.logger.debug("项目请求体:${jsonObject.toJson()}")
     //            val postObject = SHttpUtil.postObject<DictProjectResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictProjectResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE){
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictProjectResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE){
                     if (!postObject.data.isNullOrEmpty()){
                         return  postObject.data!!
                     }
@@ -175,19 +151,19 @@ object DictTypeApi {
             jsonObject2["type"] = "common"
             jsonObject["criteria"] = jsonObject2
             /** 直接 http 请求还是通过注册中心 */
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/rwd/def/class/"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/def/class/"
                 val postObject = SHttpUtil.postObject<DictPlatformTypeResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/rwd/def/class/"
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/class/"
     //            val postObject = SHttpUtil.postObject<DictPlatformTypeResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -214,19 +190,19 @@ object DictTypeApi {
             jsonObject2["classCode"] = category
             jsonObject["criteria"] = jsonObject2
             /** 直接 http 请求还是通过注册中心 */
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/rwd/def/funcid"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/def/funcid"
                 val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid"
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/funcid"
     //            val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -251,19 +227,19 @@ object DictTypeApi {
                 val jsonObject2 = JSONObject()
                 jsonObject2["type"] = type
                 jsonObject["criteria"] = jsonObject2
-                if (!customProperties.eurekaorhttp) {
-                    val url = "${opts.dataPlatform}/dic/dt/data/query?groupCode=WD&userId=123456"
+                if (!Configure.customProperties.eurekaorhttp) {
+                    val url = "${Configure.opts.dataPlatform}/dic/dt/data/query?groupCode=WD&userId=123456"
                     val postObject = SHttpUtil.postObject<DictMajorResponse>(url, jsonObject)
-                    if (postObject.result == opts.SUCCESS_CODE) {
+                    if (postObject.result == Configure.opts.SUCCESS_CODE) {
                         if (!postObject.data.isNullOrEmpty()){
                             return postObject.data!!
                         }
                     }
                 }else {
-                    val url = "${serviceNameConfig.DMPRWD}/dic/dt/data/query?groupCode=WD&userId=123456"
+                    val url = "http://${Configure.serviceNameConfig.DMPDIC}/dic/dt/data/query?groupCode=WD&userId=123456"
         //            val postObject = SHttpUtil.postObject<DictMajorResponse>(url, jsonObject)
-                    val postObject = restTemplate.postForObject(url, jsonObject, DictMajorResponse::class.java)
-                    if (postObject.result == opts.SUCCESS_CODE) {
+                    val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictMajorResponse::class.java)
+                    if (postObject.result == Configure.opts.SUCCESS_CODE) {
                         if (!postObject.data.isNullOrEmpty()){
                             return postObject.data!!
                         }
@@ -290,19 +266,19 @@ object DictTypeApi {
             val jsonObject2 = JSONObject()
             jsonObject2["groupId"] = groupId
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/dict/scheme/query"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/dict/scheme/query"
                 val postObject = SHttpUtil.postObject<DictGroupSchemeResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/dict/scheme/query"
+                val url = "http://${Configure.serviceNameConfig.DMPDIC}/dict/scheme/query"
     //            val postObject = SHttpUtil.postObject<DictGroupSchemeResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictGroupSchemeResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictGroupSchemeResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -326,19 +302,19 @@ object DictTypeApi {
             val jsonObject2 = JSONObject()
             jsonObject2["groupId"] = schemeId.toString()
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/dict/scheme/class/query"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/dict/scheme/class/query"
                 val postObject = SHttpUtil.postObject<DictSchemeCategoryResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/dict/scheme/class/query"
+                val url = "http://${Configure.serviceNameConfig.DMPDIC}/dict/scheme/class/query"
     //            val postObject = SHttpUtil.postObject<DictSchemeCategoryResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -362,19 +338,19 @@ object DictTypeApi {
             jsonObject2["schemeId"] = schemeId.toString()
             jsonObject2["classCode"] = code
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/dict/scheme/funcid/query"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/dict/scheme/funcid/query"
                 val postObject = SHttpUtil.postObject<DictSchemeCategoryResponseInfo>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/dict/scheme/funcid/query"
+                val url = "http://${Configure.serviceNameConfig.DMPDIC}/dict/scheme/funcid/query"
     //            val postObject = SHttpUtil.postObject<DictSchemeCategoryResponseInfo>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponseInfo::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictSchemeCategoryResponseInfo::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -399,19 +375,19 @@ object DictTypeApi {
             jsonArray.fluentAdd(projectId)
             jsonObject2["projectId"] = jsonArray
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/dict/scheme/project/query"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/dict/scheme/project/query"
                 val postObject = SHttpUtil.postObject<DictSchemeAndProjectResponse>(url, jsonObject)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/dict/scheme/project/query"
+                val url = "http://${Configure.serviceNameConfig.DMPDIC}/dict/scheme/project/query"
     //            val postObject = SHttpUtil.postObject<DictSchemeAndProjectResponse>(url, jsonObject)
-                val postObject = restTemplate.postForObject(url, jsonObject, DictSchemeAndProjectResponse::class.java)
-                if (postObject.result == opts.SUCCESS_CODE) {
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, DictSchemeAndProjectResponse::class.java)
+                if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){
                         return postObject.data!!
                     }
@@ -435,19 +411,19 @@ object DictTypeApi {
             val jsonObject = JSONObject()
             val jsonObject2 = JSONObject()
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupId"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/def/class?groupCode=$groupId"
                 val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
-                if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
+                if (dictGroupCategoryResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
                         return dictGroupCategoryResponse.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupId"
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupId"
     //            val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
-                val dictGroupCategoryResponse = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
-                if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
+                val dictGroupCategoryResponse = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
+                if (dictGroupCategoryResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
                         return dictGroupCategoryResponse.data!!
                     }
@@ -469,19 +445,19 @@ object DictTypeApi {
             val jsonObject2 = JSONObject()
             jsonObject2["classCode"] = code
             jsonObject["criteria"] = jsonObject2
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId"
                 val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
-                if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
+                if (dictPlatformInfoResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
                         return dictPlatformInfoResponse.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId"
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId"
     //            val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
-                val dictPlatformInfoResponse = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
-                if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
+                val dictPlatformInfoResponse = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
+                if (dictPlatformInfoResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
                         return dictPlatformInfoResponse.data!!
                     }
@@ -506,23 +482,23 @@ object DictTypeApi {
             val jsonObject2 = JSONObject()
             jsonObject["criteria"] = jsonObject2
 
-            if (!customProperties.eurekaorhttp) {
-                val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
                 logger.debug("url = $url")
                 logger.debug("boby = ${jsonObject.toJson()}")
                 val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
-                if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
+                if (dictGroupCategoryResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
                         return dictGroupCategoryResponse.data!!
                     }
                 }
             } else {
-                val url = "${serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
                 logger.debug("url = $url")
                 logger.debug("boby = ${jsonObject.toJson()}")
 //                val dictGroupCategoryResponse = SHttpUtil.postObject<DictPlatformTypeResponse>(url,jsonObject)
-                val dictGroupCategoryResponse = restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
-                if (dictGroupCategoryResponse.result == opts.SUCCESS_CODE) {
+                val dictGroupCategoryResponse = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformTypeResponse::class.java)
+                if (dictGroupCategoryResponse.result == Configure.opts.SUCCESS_CODE) {
                     if (!dictGroupCategoryResponse.data.isNullOrEmpty()){
                         return dictGroupCategoryResponse.data!!
                     }
@@ -543,19 +519,19 @@ object DictTypeApi {
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = code
         jsonObject["criteria"] = jsonObject2
-        if (!customProperties.eurekaorhttp) {
-            val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${Configure.opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
             val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
-            if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
+            if (dictPlatformInfoResponse.result == Configure.opts.SUCCESS_CODE) {
                 if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
                     return dictPlatformInfoResponse.data!!
                 }
             }
         }else {
-            val url = "${serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
 //            val dictPlatformInfoResponse = SHttpUtil.postObject<DictPlatformInfoResponse>(url,jsonObject)
-            val dictPlatformInfoResponse = restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
-            if (dictPlatformInfoResponse.result == opts.SUCCESS_CODE) {
+            val dictPlatformInfoResponse = Configure.restTemplate.postForObject(url, jsonObject, DictPlatformInfoResponse::class.java)
+            if (dictPlatformInfoResponse.result == Configure.opts.SUCCESS_CODE) {
                 if (!dictPlatformInfoResponse.data.isNullOrEmpty()){
                     return dictPlatformInfoResponse.data!!
                 }

+ 101 - 51
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/BuildingApi.kt

@@ -27,13 +27,11 @@
 package com.persagy.server.syn.models.api.obj
 
 import com.alibaba.fastjson.JSONObject
-import com.persagy.base.extensions.toJson
 import com.persagy.base.utils.SHttpUtil
 import com.persagy.server.datacenter.models.entities.objects.Building
-import com.persagy.server.syn.Opts
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.server.syn.models.tools.BuildingUtil
-import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
 
 /**
@@ -44,14 +42,8 @@ import org.slf4j.LoggerFactory
  */
 object BuildingApi {
 
-        /** 日志 */
-        private val logger = LoggerFactory.getLogger(BuildingApi::class.java)
-
-
-    /** 配置实例 */
-    private val opts: Opts by lazy {
-        SSpringContextUtil.getBean(Opts::class.java) as Opts
-    } // opts
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(BuildingApi::class.java)
 
     /**
      * 获取建筑
@@ -61,15 +53,28 @@ object BuildingApi {
      * @return              返回结果
      */
     fun buildingSyn(groupCode: String,projectId: String,type: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
-        val jsonObject = JSONObject()
-        val jsonObject2 = JSONObject()
-        jsonObject2["classCode"] = type
-        jsonObject2["valid"] = 1
-        jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        try {
+            val jsonObject = JSONObject()
+            val jsonObject2 = JSONObject()
+            jsonObject2["classCode"] = type
+            jsonObject2["valid"] = 1
+            jsonObject["criteria"] = jsonObject2
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return ArrayList<HashMap<String, Any?>>()
     }
@@ -82,14 +87,24 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  createObj(groupCode: String,projectId: String, building:Building): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        logger.debug("url= ${url} ************************************")
-        val buildingTools = BuildingUtil.buildingTools(projectId, building)
-        logger.debug("boby= ${buildingTools.toJson()} ************************************")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
-        logger.debug("建筑创建结果= ${postObject.toJson()} ************************************")
-        if (postObject.result == "success") {
-            return true
+        try {
+            val buildingTools = BuildingUtil.buildingTools(projectId, building)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, buildingTools, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return false
     }
@@ -102,13 +117,24 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  updateObj(groupCode: String,projectId: String, building:Building): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        val buildingTools = BuildingUtil.buildingTools(projectId, building)
-        logger.debug("url = ${url}")
-        logger.debug("boby = ${ buildingTools.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
-        if (postObject.result == "success") {
-            return true
+        try {
+            val buildingTools = BuildingUtil.buildingTools(projectId, building)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, buildingTools, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return false
     }
@@ -121,14 +147,25 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  deleteObj(groupCode: String,projectId: String, buildingId: String): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        val listId = ArrayList<String>()
-        listId.add(buildingId)
-        logger.debug("删除建筑url= ${url}")
-        logger.debug("boby= ${listId.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
-        if (postObject.result == "success") {
-            return true
+        try {
+            val listId = ArrayList<String>()
+            listId.add(buildingId)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, listId, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return false
     }
@@ -141,14 +178,27 @@ object BuildingApi {
      * @return 返回结果
      */
     fun queryId(groupCode: String, projectId: String,id: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
-        val jsonObject = JSONObject()
-        val jsonObject2 = JSONObject()
-        jsonObject2["id"] = id
-        jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        try {
+            val jsonObject = JSONObject()
+            val jsonObject2 = JSONObject()
+            jsonObject2["id"] = id
+            jsonObject["criteria"] = jsonObject2
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return ArrayList<HashMap<String, Any?>>()
     }

+ 154 - 58
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt

@@ -30,6 +30,7 @@ import com.alibaba.fastjson.JSONArray
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.extensions.toJson
 import com.persagy.base.utils.SHttpUtil
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.Opts
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.service.utils.SSpringContextUtil
@@ -60,7 +61,6 @@ object EquipApi {
      * @return 返回值
      */
     fun equipSynApi(groupCode: String,projectId: String,page: Int): MiddleGroundDataRespose{
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "equipment"
@@ -68,11 +68,22 @@ object EquipApi {
         jsonObject["criteria"] = jsonObject2
         jsonObject["page"] = page
         jsonObject["size"] = 1000
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject
+            }
+            return postObject
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject
+            }
             return postObject
         }
-        return postObject
     }
     /**
      * 获取中台设备数据
@@ -82,17 +93,28 @@ object EquipApi {
      * @return 返回值
      */
     fun equipSynApiAll(groupCode: String,projectId: String): MiddleGroundDataRespose{
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "equipment"
         jsonObject2["valid"] = 1
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject
+            }
+            return postObject
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject
+            }
             return postObject
         }
-        return postObject
+
     }
 
     /**
@@ -103,17 +125,27 @@ object EquipApi {
      * @return 返回结果
      */
     fun equipInFloor(groupCode: String,projectId: String,equipId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "MechInArch"
         jsonObject2["relCode"] = "Eq2Fl"
         jsonObject2["objFrom"] = equipId
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 
@@ -125,18 +157,28 @@ object EquipApi {
      * @return 返回结果
      */
     fun equipInBuilding(groupCode: String,projectId: String,equipId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "MechInArch"
         jsonObject2["relCode"] = "Eq2Bd"
         jsonObject2["objFrom"] = equipId
         jsonObject["criteria"] = jsonObject2
-        logger.debug("设备建筑url = ${url}")
-        logger.debug("设备建筑boby= ${jsonObject.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            logger.debug("设备建筑url = ${url}")
+            logger.debug("设备建筑boby= ${jsonObject.toJson()}")
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
         return ArrayList<HashMap<String, Any?>>()
     }
@@ -151,12 +193,19 @@ object EquipApi {
      * @return 返回结果
      */
     fun queryRelation(groupCode: String,projectId: String,jsonObject: JSONObject): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
-//        val jsonObject = JSONObject()
-//        jsonObject["criteria"] = jsonObject
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
         return ArrayList<HashMap<String, Any?>>()
     }
@@ -170,14 +219,21 @@ object EquipApi {
      * @return 是否成功
      */
     fun  createObj(groupCode: String,projectId: String, listObj: ArrayList<HashMap<String,Any?>>): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-//        val buildingTools = FloorUtil.floorTools(projectId, floor)
-        logger.debug("设备创建url = ${url}")
-        logger.debug("设备创建boby = ${listObj.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
-        if (postObject.result == "success") {
-            return true
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
+            if (postObject.result == "success") {
+                return true
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = Configure.restTemplate.postForObject(url, listObj, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success") {
+                return true
+            }
         }
+
         return false
     }
 
@@ -189,13 +245,19 @@ object EquipApi {
      * @return 是否成功
      */
     fun  updateObj(groupCode: String,projectId: String, listObj: ArrayList<HashMap<String,Any?>>): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-//        val buildingTools = FloorUtil.floorTools(projectId, floor)
-        logger.debug("设备创建url = ${url}")
-        logger.debug("设备创建boby = ${listObj.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
-        if (postObject.result == "success") {
-            return true
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
+            if (postObject.result == "success") {
+                return true
+            }
+        }else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = Configure.restTemplate.postForObject(url, listObj, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success") {
+                return true
+            }
         }
         return false
     }
@@ -208,13 +270,23 @@ object EquipApi {
      * @return 是否成功
      */
     fun  deleteObj(groupCode: String,projectId: String, id: String): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
         val listId = ArrayList<String>()
         listId.add(id)
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
-        if (postObject.result == "success") {
-            return true
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
+            if (postObject.result == "success") {
+                return true
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = Configure.restTemplate.postForObject(url, listId, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success") {
+                return true
+            }
         }
+
         return false
     }
 
@@ -223,23 +295,38 @@ object EquipApi {
      * 创建关系
      */
     fun createRel(groupCode: String, projectId: String, jsonArray:JSONArray): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        logger.debug("url = ${url}")
-        logger.debug("boby= ${jsonArray.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonArray)
-        if (postObject.result == "success") {
-            return true
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonArray)
+            if (postObject.result == "success") {
+                return true
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = Configure.restTemplate.postForObject(url, jsonArray, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success") {
+                return true
+            }
         }
+
         return false
     }
 
     fun delRel(groupCode: String, projectId: String, jsonObject: JSONObject): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        logger.debug("url = ${url}")
-        logger.debug("boby= ${jsonObject.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success") {
-            return true
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success") {
+                return true
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success") {
+                return true
+            }
         }
         return false
     }
@@ -253,15 +340,24 @@ object EquipApi {
      * @return 返回结果
      */
     fun getRel(groupCode: String,projectId: String,graphCode: String,relCode: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = graphCode
         jsonObject2["relCode"] = relCode
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
         return ArrayList<HashMap<String, Any?>>()
     }

+ 82 - 35
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/FloorApi.kt

@@ -27,13 +27,11 @@
 package com.persagy.server.syn.models.api.obj
 
 import com.alibaba.fastjson.JSONObject
-import com.persagy.base.extensions.toJson
 import com.persagy.base.utils.SHttpUtil
 import com.persagy.server.datacenter.models.entities.objects.Floor
-import com.persagy.server.syn.Opts
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.server.syn.models.tools.FloorUtil
-import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
 
 /**
@@ -46,10 +44,6 @@ object FloorApi {
 
     /** 日志 */
     private val logger = LoggerFactory.getLogger(FloorApi::class.java)
-    /** 配置实例 */
-    private val opts: Opts by lazy {
-        SSpringContextUtil.getBean(Opts::class.java) as Opts
-    } // opts
 
     /**
      * 获取楼层和建筑的关系
@@ -59,17 +53,31 @@ object FloorApi {
      * @return 返回结果
      */
     fun floorInBuilding(groupCode: String,projectId: String,floorId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
-        val jsonObject = JSONObject()
-        val jsonObject2 =  JSONObject()
-        jsonObject2["graphCode"] = "ArchSubset"
-        jsonObject2["relCode"] = "Bd2Fl"
-        jsonObject2["objTo"] = floorId
-        jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        try {
+            val jsonObject = JSONObject()
+            val jsonObject2 =  JSONObject()
+            jsonObject2["graphCode"] = "ArchSubset"
+            jsonObject2["relCode"] = "Bd2Fl"
+            jsonObject2["objTo"] = floorId
+            jsonObject["criteria"] = jsonObject2
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 
@@ -81,14 +89,26 @@ object FloorApi {
      * @return 是否成功
      */
     fun  createObj(groupCode: String,projectId: String, floor: Floor): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        logger.debug("url = ${url}")
-        val buildingTools = FloorUtil.floorTools(projectId, floor)
-        logger.debug("boby = ${buildingTools.toJson()}")
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
-        if (postObject.result == "success") {
-            return true
+        try {
+            val buildingTools = FloorUtil.floorTools(projectId, floor)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, buildingTools, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
+
         return false
     }
 
@@ -100,12 +120,26 @@ object FloorApi {
      * @return 是否成功
      */
     fun  updateObj(groupCode: String,projectId: String, floor: Floor): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        val buildingTools = FloorUtil.floorTools(projectId, floor)
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
-        if (postObject.result == "success") {
-            return true
+        try {
+            val buildingTools = FloorUtil.floorTools(projectId, floor)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/update?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, buildingTools, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
+
         return false
     }
 
@@ -117,12 +151,25 @@ object FloorApi {
      * @return 是否成功
      */
     fun  deleteObj(groupCode: String,projectId: String, id: String): Boolean {
-        val url = "${opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-        val listId = ArrayList<String>()
-        listId.add(id)
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
-        if (postObject.result == "success") {
-            return true
+        try {
+            val listId = ArrayList<String>()
+            listId.add(id)
+            /** 直接 http 请求还是通过注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
+                if (postObject.result == "success") {
+                    return true
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/delete?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                val postObject = Configure.restTemplate.postForObject(url, listId, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success") {
+                    return true
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return false
     }

+ 46 - 27
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ProjectApi.kt

@@ -28,9 +28,8 @@ package com.persagy.server.syn.models.api.obj
 
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.utils.SHttpUtil
-import com.persagy.server.syn.Opts
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
-import com.persagy.service.utils.SSpringContextUtil
 
 /**
  * 数据中台至数据中心
@@ -40,11 +39,6 @@ import com.persagy.service.utils.SSpringContextUtil
  */
 object ProjectApi {
 
-    /** 配置实例 */
-    private val opts: Opts by lazy {
-        SSpringContextUtil.getBean(Opts::class.java) as Opts
-    }
-
     /**
      * 根据集团查询集团下所有的项目
      *
@@ -52,17 +46,30 @@ object ProjectApi {
      * @return
      */
     fun projectQueryGroup(id: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=${id}"
-        val jsonObject = JSONObject()
-        val jsonObject2 = JSONObject()
-        jsonObject2["classCode"] = "project"
-        jsonObject2["valid"] = 1
-        jsonObject["criteria"] = jsonObject2
-
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        try {
+            val jsonObject = JSONObject()
+            val jsonObject2 = JSONObject()
+            jsonObject2["classCode"] = "project"
+            jsonObject2["valid"] = 1
+            jsonObject["criteria"] = jsonObject2
+            /** 判断是否使用注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/query?groupCode=${id}"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=${id}"
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 
@@ -73,16 +80,28 @@ object ProjectApi {
      * @return
      */
     fun projectQuery(groupCode: String,projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
-        val jsonObject = JSONObject()
-        val jsonObject2 = JSONObject()
-        jsonObject2["classCode"] = "project"
-        jsonObject2["valid"] = 1
-        jsonObject["criteria"] = jsonObject2
-
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        try {
+            val jsonObject = JSONObject()
+            val jsonObject2 = JSONObject()
+            jsonObject2["classCode"] = "project"
+            jsonObject2["valid"] = 1
+            jsonObject["criteria"] = jsonObject2
+            /** 判断是否使用注册中心 */
+            if (!Configure.customProperties.eurekaorhttp) {
+                val url = "${Configure.opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            } else {
+                val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+                val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+                if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                    return postObject.data!!
+                }
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
         return ArrayList<HashMap<String, Any?>>()
     }

+ 15 - 4
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ShaftApi.kt

@@ -28,6 +28,7 @@ package com.persagy.server.syn.models.api.obj
 
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.utils.SHttpUtil
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.Opts
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.service.utils.SSpringContextUtil
@@ -45,16 +46,26 @@ object ShaftApi {
     }
 
     fun shaftQuery(groupCode: String,projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = "shaft"
         jsonObject2["valid"] = 1
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 

+ 43 - 12
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SpaceApi.kt

@@ -28,6 +28,7 @@ package com.persagy.server.syn.models.api.obj
 
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.utils.SHttpUtil
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.Opts
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.service.utils.SSpringContextUtil
@@ -52,16 +53,26 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceSynApi(groupCode: String,projectId: String): ArrayList<HashMap<String, Any?>>{
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "space"
         jsonObject2["valid"] = 1
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 
@@ -73,17 +84,27 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceInBuilding(groupCode: String,projectId: String,spaceId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "ArchSubset"
         jsonObject2["relCode"] = "Bd2Sp"
         jsonObject2["objTo"] = spaceId
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
+
         return ArrayList<HashMap<String, Any?>>()
     }
 
@@ -95,16 +116,26 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceInFloor(groupCode: String,projectId: String,spaceId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "ArchSubset"
         jsonObject2["relCode"] = "Fl2Sp"
         jsonObject2["objTo"] = spaceId
         jsonObject["criteria"] = jsonObject2
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        } else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/relation/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
         return ArrayList<HashMap<String, Any?>>()
     }

+ 16 - 6
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SystemApi.kt

@@ -29,6 +29,7 @@ package com.persagy.server.syn.models.api.obj
 import com.alibaba.fastjson.JSONObject
 import com.persagy.base.extensions.toJson
 import com.persagy.base.utils.SHttpUtil
+import com.persagy.server.syn.Configure
 import com.persagy.server.syn.Opts
 import com.persagy.server.syn.models.obj.MiddleGroundDataRespose
 import com.persagy.service.utils.SSpringContextUtil
@@ -56,17 +57,26 @@ object SystemApi {
      * @return 返回结果
      */
     fun systemQuery(groupCode: String,projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "system"
         jsonObject2["valid"] = 1
         jsonObject["criteria"] = jsonObject2
-
-        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
-        logger.debug("结果= ${postObject.toJson()}")
-        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
-            return postObject.data!!
+        /** 直接 http 请求还是通过注册中心 */
+        if (!Configure.customProperties.eurekaorhttp) {
+            val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+            logger.debug("结果= ${postObject.toJson()}")
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
+        }else {
+            val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
+            logger.debug("结果= ${postObject.toJson()}")
+            if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+                return postObject.data!!
+            }
         }
         return ArrayList<HashMap<String, Any?>>()
     }

+ 74 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/services/BaseDataService.kt

@@ -0,0 +1,74 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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-2021.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.syn.services
+
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.dictnew.DictProject
+import com.persagy.server.datacenter.models.entities.dictnew.Group
+import com.persagy.server.datacenter.models.entities.objects.*
+import com.persagy.server.datacenter.models.entities.rel.RSpinBd
+import com.persagy.server.datacenter.models.entities.rel.RSpinFl
+import com.persagy.service.SBaseService
+import com.persagy.service.SObjectService
+
+/**
+ * 基类服务
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2021/1/15 15:15
+ */
+object BaseDataService {
+
+    /** 集团服务 */
+    val groupService = SBaseService(SMybatisDao(Group::class.java))
+    /** 字典项目服务 */
+    val dictProjectService = SBaseService(SMybatisDao(DictProject::class.java))
+    /** 数据中心项目服务 */
+    val projectService = SObjectService(SMybatisDao(Project::class.java))
+    /** 数据中心建筑服务 */
+    val buildingService = SObjectService(SMybatisDao(Building::class.java))
+    /** 数据中心楼层服务 */
+    val floorService = SObjectService(SMybatisDao(Floor::class.java))
+    /** 数据中心设备服务 */
+     val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
+    /** 建筑下的空间 */
+     val rSpinBdService = SObjectService(SMybatisDao(RSpinBd::class.java))
+    /** 楼层下的空间 */
+     val rSpinFlService = SObjectService(SMybatisDao(RSpinFl::class.java))
+    /** 业务空间 */
+     val zoneSpaceService = SObjectService(SMybatisDao(ZoneSpace::class.java))
+    /** 系统服务 */
+     val generalSystemService = SObjectService(SMybatisDao(GeneralSystem::class.java))
+    /** 竖井 */
+     val shaftService = SObjectService(SMybatisDao(Shaft::class.java))
+    /** 楼层轮廓线 */
+     val floorOutlineService = SObjectService(SMybatisDao(FloorOutline::class.java))
+    /** 空间轮廓线 */
+     val spaceOutlineService = SObjectService(SMybatisDao(SpaceOutline::class.java))
+
+
+}

+ 40 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/utils/LogUtils.kt

@@ -0,0 +1,40 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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-2021.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.syn.utils
+
+/**
+ * 日志工具
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2021/1/15 14:46
+ */
+class LogUtils {
+
+
+
+
+}

+ 16 - 1
datasyn/src/main/resources/application-prod.yml

@@ -25,4 +25,19 @@ saga:
 
 mqtopid:
   exchange:                           exchange-dmp
-  routingKey:
+  routingKey:
+
+
+custom: # 自定义类型
+  #true 代表eureka  false  代表 http
+  eurekaorhttp:                       false
+
+# 服务名
+servicename: #注册中心使用,服务名
+
+  DMPORG:                             DMP-ORG   #物理3世界
+  DMPRWD:                             DMP-RWD   #中台
+  DMPDIC:                             DMP-DIC   #字典
+
+
+

+ 14 - 3
datasyn/src/main/resources/application-test.yml

@@ -30,8 +30,19 @@ spring:
     virtual-host: /test
 
 saga:
-#  dataPlatform:                        http://192.168.64.17:8832
-  dataPlatform:                        http://39.102.40.239:9970
+  dataPlatform:                        http://192.168.64.17:8832
+#  dataPlatform:                        http://39.102.40.239:9970
 mqtopid:
   exchange:                           exchange-dmp
-  routingKey:
+  routingKey:
+
+custom:
+  #true 代表eureka  false  代表 http
+  eurekaorhttp:                       true
+
+# 服务名
+servicename:
+
+  DMPORG:                             DMP-ORG   #物理3世界
+  DMPRWD:                             DMP-RWD   #中台
+  DMPDIC:                             DMP-DIC   #字典

+ 2 - 0
equip-component/src/main/kotlin/com/persagy/server/service/EquipmentProSyService.kt

@@ -126,6 +126,8 @@ object EquipmentProSyService : Service<EquipmentProSy>(SMybatisDao(EquipmentProS
                         val rSyEq = RSyEq()
                         rSyEq.equipId = entity.id
                         rSyEq.sysId = syId
+                        rSyEq.projectId = entity.projectId
+                        rSyEq.sign = 1
                         RSyEqService.create(rSyEq)
                     }
                 }

+ 1 - 1
equip-component/src/main/kotlin/com/persagy/server/service/RSyEqService.kt

@@ -52,7 +52,7 @@ object RSyEqService : RService<RSyEq>(SMybatisDao(RSyEq::class.java)) {
     fun create(rSyEq: RSyEq): SCreateResponse<RSyEq> {
         return try {
 //            rSyEq.id = IdUtils.uuidCreate()
-            val isInsert = insert(rSyEq)
+            val isInsert = replace(rSyEq)
             if (isInsert){
                 SCreateResponse(SResponseType.success)
             }else{