Browse Source

********************WX***********************
同步关系

zhangweixin 4 years ago
parent
commit
729a261e17

+ 14 - 5
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/RwdProject.kt

@@ -26,12 +26,14 @@
 
 package com.persagy.server.syn.services.jms
 
+import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DefClass
 import com.persagy.server.datacenter.models.entities.dictnew.DictProject
 import com.persagy.server.datacenter.models.entities.objects.Project
 import com.persagy.server.syn.Configure
+import com.persagy.server.syn.jms.MessageReceiver
 import com.persagy.server.syn.jms.bean.SyncRwdDatacenterMessage
 import com.persagy.server.syn.models.api.obj.BuildingApi
 import com.persagy.server.syn.models.tools.ProjectUtil
@@ -39,6 +41,7 @@ import com.persagy.server.syn.services.dict.DClassDefService
 import com.persagy.server.syn.task.SyncTaskDict
 import com.persagy.service.SBaseService
 import com.persagy.service.SObjectService
+import org.slf4j.LoggerFactory
 import org.springframework.stereotype.Service
 import java.util.concurrent.Executors
 
@@ -50,6 +53,10 @@ import java.util.concurrent.Executors
  */
 @Service
 class RwdProject {
+    companion object {
+        // 日志
+        private val logger = LoggerFactory.getLogger(MessageReceiver::class.java)
+    } // Companion object
     /** 项目服务 */
     private val projectService = SBaseService(SMybatisDao(Project::class.java))
     /** 缓存对象数据 - 数据中台到数据中心 */
@@ -66,6 +73,7 @@ class RwdProject {
      * 项目
      */
     fun projectType(message: SyncRwdDatacenterMessage) {
+        logger.debug("消息 = ${message.toJson()}")
         when(message.type){
             Configure.RWDCREATE -> {
                 /** 集团数据 */
@@ -85,7 +93,7 @@ class RwdProject {
                             dictProject!!.groupCode!!,
                             queryIdList[0]
                         )
-                        projectService.insert(buildingDataConversions)
+                        projectService.replace(buildingDataConversions)
                         message.state = 0
 
                     } else {
@@ -95,13 +103,15 @@ class RwdProject {
 
                 } else {
                     message.state = 2
-                    message.count+1
+                    message.count =message.count +1
                 }
                 /** 更改标记 */
                 syncRwdMessageService.update(message, arrayListOf("state","count"))
             }
             Configure.RWDUPDATE -> {
-                val entity = projectService.select(SFilter.eq("projectId", message.projectId!!)).entity()
+
+                val entity = projectService.select(SFilter.eq("id", message.projectId!!)).entity()
+                logger.debug("消息11 = ${entity?.toJson()}")
                 if (entity!=null){
                     /** 修改 */
                     val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
@@ -112,7 +122,7 @@ class RwdProject {
                                     dictProject!!.groupCode!!,
                                     queryIdList[0]
                             )
-                            projectService.update(buildingDataConversions)
+                            projectService.replace(buildingDataConversions)
                             message.state = 0
                         } else {
                             message.state = 2
@@ -140,7 +150,6 @@ class RwdProject {
 //                syncRwdMessageService.update(message, arrayListOf("state"))
             }
         }
-
     }
 
     /**