Browse Source

********************WX******************
算法

zhangweixin 4 năm trước cách đây
mục cha
commit
5b1a10298e

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

@@ -63,8 +63,8 @@ class TopicReceiver {
      *
      * @param
      */
-//    @RabbitListener(queues = ["queue-center-adm"])
-//    @RabbitHandler
+    @RabbitListener(queues = ["queue-center-adm"])
+    @RabbitHandler
     fun receiveMessage(message: String) {
         try {
             println("接收数据中心消息 , $message")

+ 175 - 110
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt

@@ -152,13 +152,19 @@ open class RelationCalcService {
             if (result != null && result == 0) {
                 upDate(projectId, "bd2sp")
 //                upDate(projectId,"fl2sp")
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "Bd2Sp", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "Bd2Sp", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "bd2sp", 5)
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "bd2sp", 5)
+//            }
+            upDate(projectId, "bd2sp")
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -173,11 +179,15 @@ open class RelationCalcService {
         try {
             val result = mapper.calcEq2Bd(projectId)
             if (result != null && result == 0) {
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "Eq2Bd_in", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "Eq2Bd_in", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 return SBaseResponse(SResponseType.success)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -194,13 +204,19 @@ open class RelationCalcService {
             val result = mapper.calcEq2Fl(projectId)
             if (result != null && result == 0) {
                 upDate(projectId, "eq2fl")
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "Eq2Bd_in", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "Eq2Bd_in", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "eq2fl", 5)
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "eq2fl", 5)
+//            }
+            upDateBiaoji(projectId, "eq2fl", 1)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -219,6 +235,7 @@ open class RelationCalcService {
             val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in")).entity()
             if (entity != null) {
                 entity.computationalState = 3
+                entity.computingTime = IdUtils.time()
                 relationTypeProjectservice.update(entity)
             }
             val result = mapper.calcEq2Sh(projectId)
@@ -230,17 +247,28 @@ open class RelationCalcService {
                 upDate(projectId, "fl2sp")
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "eq2sh", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
-                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in")).entity()
-                if (entity != null) {
-                    entity.computationalState = 5
-                    relationTypeProjectservice.update(entity)
-                }
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "eq2sh", 5)
+//                upDateBiaoji(projectId, "eq2fl", 5)
+//                upDateBiaoji(projectId, "fl2sp", 5)
+//                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in")).entity()
+//                if (entity != null) {
+//                    entity.computationalState = 5
+//                    relationTypeProjectservice.update(entity)
+//                }
+//            }
+            val entity2 = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in")).entity()
+            if (entity2 != null) {
+                entity2.computationalState = 1
+                entity2.computingTime = IdUtils.time()
+                relationTypeProjectservice.update(entity2)
+            }
+            upDate(projectId, "eq2sh")
+            upDate(projectId, "eq2sp_in")
+            upDate(projectId, "fl2sp")
+            upDate(projectId, "eq2fl")
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -368,8 +396,12 @@ open class RelationCalcService {
             val result = mapper.calcEq2Sp(projectId)
             if (result != null && result == 0) {
                 try {
-                    /** 发送消息 */
-                    rabbitMqService.sendRel(Opt.projectId!!, "Eq2Sp_in", "20", tables!!, "456")
+                    try {
+                        /** 发送消息 */
+                        rabbitMqService.sendRel(Opt.projectId!!, "Eq2Sp_in", "20", tables!!, "456")
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
                     upDate(projectId, "fl2sp")
                     upDate(projectId, "eq2fl")
                     val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType", tables!!)).entity()
@@ -382,17 +414,26 @@ open class RelationCalcService {
                     e.printStackTrace()
                 }
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
-                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType", tables!!)).entity()
-                if (entity != null) {
-                    entity.computationalState = 5
-                    entity.computingTime = IdUtils.time()
-                    relationTypeProjectservice.update(entity)
-                }
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "eq2fl", 5)
+//                upDateBiaoji(projectId, "fl2sp", 5)
+//                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType", tables!!)).entity()
+//                if (entity != null) {
+//                    entity.computationalState = 5
+//                    entity.computingTime = IdUtils.time()
+//                    relationTypeProjectservice.update(entity)
+//                }
+//            }
+            upDate(projectId, "fl2sp")
+            upDate(projectId, "eq2fl")
+            val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType", tables!!)).entity()
+            if (entity != null) {
+                entity.computationalState = 1
+                entity.computingTime = IdUtils.time()
+                relationTypeProjectservice.update(entity)
+            }
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -412,25 +453,33 @@ open class RelationCalcService {
             val result = mapper.calcFl2Fl(projectId, 2, 2)
             if (result != null && result == 0) {
                 try {
-                    /** 发送消息 */
-                    rabbitMqService.sendRel(Opt.projectId!!, "Fl2Fl_Through", "20", "123", "456")
+                    try {
+                        /** 发送消息 */
+                        rabbitMqService.sendRel(Opt.projectId!!, "Fl2Fl_Through", "20", "123", "456")
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
                     val entity = RUpDateEquipAndSapceService.relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "Fl2Fl")).entity()
                     if (entity != null) {
                         entity.computationalState = 1
                         entity.computingTime = IdUtils.time()
                         RUpDateEquipAndSapceService.relationTypeProjectservice.update(entity)
-                    }else{
-                        upDateBiaoji(projectId, "fl2fl", 5)
                     }
+//                    else
+//                    {
+//                        upDateBiaoji(projectId, "fl2fl", 5)
+//                    }
                 } catch (e: Exception) {
                     e.printStackTrace()
                 }
 
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "fl2fl", 5)
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "fl2fl", 5)
+//            }
+            upDateBiaoji(projectId, "fl2fl", 1)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -511,14 +560,20 @@ open class RelationCalcService {
             upDateBiaoji(projectId, "fl2sp", 3)
             val result = mapper.calcFl2Sp(tablesName, projectId)
             if (result != null && result == 0) {
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "Fl2Sp_in", "20", "全量同步", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "Fl2Sp_in", "20", "全量同步", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 upDate(projectId, "fl2sp")
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "fl2sp", 5)
             }
-            return SBaseResponse(SResponseType.failure)
+//            else {
+//                upDateBiaoji(projectId, "fl2sp", 5)
+//            }
+            upDateBiaoji(projectId, "fl2sp", 1)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -540,10 +595,10 @@ open class RelationCalcService {
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "pe2bd", 5)
-                upDateBiaoji(projectId, "eq2fl", 2)
+                upDateBiaoji(projectId, "pe2bd", 1)
+                upDateBiaoji(projectId, "eq2fl", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -565,10 +620,10 @@ open class RelationCalcService {
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "pe2fl", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
+                upDateBiaoji(projectId, "pe2fl", 1)
+                upDateBiaoji(projectId, "eq2fl", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -598,14 +653,14 @@ open class RelationCalcService {
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "pe2sh", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
-                upDateBiaoji(projectId, "eq2sp_in", 5)
-                upDateBiaoji(projectId, "pe2sp", 5)
-                upDateBiaoji(projectId, "eq2sh", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
+                upDateBiaoji(projectId, "pe2sh", 1)
+                upDateBiaoji(projectId, "fl2sp", 1)
+                upDateBiaoji(projectId, "eq2sp_in", 1)
+                upDateBiaoji(projectId, "pe2sp", 1)
+                upDateBiaoji(projectId, "eq2sh", 1)
+                upDateBiaoji(projectId, "eq2fl", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -631,12 +686,12 @@ open class RelationCalcService {
                 upDate(projectId, "eq2sp_in")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "pe2sp", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
-                upDateBiaoji(projectId, "eq2sp_in", 5)
+                upDateBiaoji(projectId, "pe2sp", 1)
+                upDateBiaoji(projectId, "eq2fl", 1)
+                upDateBiaoji(projectId, "fl2sp", 1)
+                upDateBiaoji(projectId, "eq2sp_in", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -658,9 +713,9 @@ open class RelationCalcService {
                 upDate(projectId, "sh2bd")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sh2bd", 5)
+                upDateBiaoji(projectId, "sh2bd", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -682,9 +737,9 @@ open class RelationCalcService {
                 upDate(projectId, "sh2sh")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sh2sh", 5)
+                upDateBiaoji(projectId, "sh2sh", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -706,16 +761,20 @@ open class RelationCalcService {
             logger.debug("设备= ${resultEq}")
             logger.debug("系统= ${resultSy}")
             if (resultEq != null && resultSy != null && resultEq == 0 && resultSy == 0) {
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "syeq2bd", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "syeq2bd", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 upDate(projectId, "syeq2bd")
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
             } else {
                 upDateBiaoji(projectId, "syeq2bd", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
+                upDateBiaoji(projectId, "eq2fl", 2)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -732,11 +791,15 @@ open class RelationCalcService {
             val result = mapper.calcSy2Bd(projectId)
             if (result != null && result == 0) {
 //                upDate(projectId,"sh2sh")
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "syeq2bd", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "syeq2bd", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 return SBaseResponse(SResponseType.success)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -753,16 +816,20 @@ open class RelationCalcService {
             upDateBiaoji(projectId, "sy2fl", 3)
             upDateBiaoji(projectId, "eq2fl", 3)
             val result = mapper.calcSy2Fl(projectId)
+            logger.debug("计算= ${result}")
             if (result != null && result == 0) {
                 /** 发送消息 */
                 rabbitMqService.sendRel(Opt.projectId!!, "Sy2Fl_in", "20", "123", "456")
                 upDate(projectId, "sy2fl")
                 upDate(projectId, "eq2fl")
                 return SBaseResponse(SResponseType.success)
-            } else {
-                upDateBiaoji(projectId, "sy2fl", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
             }
+//            else {
+//                upDateBiaoji(projectId, "sy2fl", 5)
+//                upDateBiaoji(projectId, "eq2fl", 5)
+//            }
+            upDate(projectId, "sy2fl")
+            upDate(projectId, "eq2fl")
             return SBaseResponse(SResponseType.failure)
         } catch (e: Exception) {
             e.printStackTrace()
@@ -829,12 +896,12 @@ open class RelationCalcService {
                 upDate(projectId, "eq2sp_in")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sy2sp", 5)
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
-                upDateBiaoji(projectId, "eq2sp_in", 5)
+                upDateBiaoji(projectId, "sy2sp", 1)
+                upDateBiaoji(projectId, "eq2fl", 1)
+                upDateBiaoji(projectId, "fl2sp", 1)
+                upDateBiaoji(projectId, "eq2sp_in", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -850,14 +917,18 @@ open class RelationCalcService {
             upDateBiaoji(projectId, "sp2sp_TrafficNetwork_1", 3)
             val result = mapper.calcsp2spTransport(projectId)
             if (result != null && result == 0) {
-                /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "sp2sp_TrafficNetwork_1", "20", "123", "456")
+                try {
+                    /** 发送消息 */
+                    rabbitMqService.sendRel(Opt.projectId!!, "sp2sp_TrafficNetwork_1", "20", "123", "456")
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
                 upDate(projectId, "sp2sp_TrafficNetwork_1")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sp2sp_TrafficNetwork_1", 5)
+                upDateBiaoji(projectId, "sp2sp_TrafficNetwork_1", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -877,9 +948,9 @@ open class RelationCalcService {
                 upDate(projectId, "sp2sp_RadiationNetwork_1")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sp2sp_RadiationNetwork_1", 5)
+                upDateBiaoji(projectId, "sp2sp_RadiationNetwork_1", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -899,9 +970,9 @@ open class RelationCalcService {
                 upDate(projectId, "sp2sp_ConvectionNetwork_1")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sp2sp_ConvectionNetwork_1", 5)
+                upDateBiaoji(projectId, "sp2sp_ConvectionNetwork_1", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -921,9 +992,9 @@ open class RelationCalcService {
                 upDate(projectId, "sp2sp_SpaceNeighborhood_5")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "sp2sp_SpaceNeighborhood_5", 5)
+                upDateBiaoji(projectId, "sp2sp_SpaceNeighborhood_5", 1)
             }
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -1075,16 +1146,16 @@ open class RelationCalcService {
 
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
+                upDateBiaoji(projectId, "eq2fl", 1)
+                upDateBiaoji(projectId, "fl2sp", 1)
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_SensorRelationship_ss2sp")).entity()
                 if (entity != null) {
-                    entity.computationalState = 5
+                    entity.computationalState = 1
                     relationTypeProjectservice.update(entity)
                 }
             }
 
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -1110,6 +1181,7 @@ open class RelationCalcService {
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_for"), SFilter.eq("zoneType", tables!!)).entity()
                 if (entity != null) {
                     entity.computationalState = 3
+                    entity.computingTime = IdUtils.time()
                     relationTypeProjectservice.update(entity)
                 }
             } catch (e: Exception) {
@@ -1164,17 +1236,17 @@ open class RelationCalcService {
                 rabbitMqService.sendRel(Opt.projectId!!, "fengkou_for", "20", "123", "456")
                 return SBaseResponse(SResponseType.success)
             } else {
-                upDateBiaoji(projectId, "eq2fl", 5)
-                upDateBiaoji(projectId, "fl2sp", 5)
+                upDateBiaoji(projectId, "eq2fl", 1)
+                upDateBiaoji(projectId, "fl2sp", 1)
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_for"), SFilter.eq("zoneType", tables!!)).entity()
                 if (entity != null) {
-                    entity.computationalState = 5
+                    entity.computationalState = 1
                     entity.computingTime = IdUtils.time()
                     relationTypeProjectservice.update(entity)
                 }
             }
 
-            return SBaseResponse(SResponseType.failure)
+            return SBaseResponse(SResponseType.success)
         } catch (e: Exception) {
             e.printStackTrace()
             return SBaseResponse(SResponseType.failure, e.message!!)
@@ -1315,11 +1387,4 @@ open class RelationCalcService {
         return TwicePoint(base_x + vector_x1,base_y + vector_y1,base_x + vector_x2,base_y + vector_y2)
     }
 
-
-
-
-
-
-
-
-} // Class RelationCalcService
+}

+ 7 - 7
datacenter/src/main/resources/application-test.yml

@@ -33,13 +33,13 @@ spring:
     username:                           postgres
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-#  rabbitmq:
-#    host: 192.168.64.15
-#    port: 9936
-#    username: admin
-#    password: brzj123456
-#    #虚拟host 可以不设置,使用server默认host
-#    virtual-host: /test
+  rabbitmq:
+    host: 192.168.64.15
+    port: 9936
+    username: admin
+    password: brzj123456
+    #虚拟host 可以不设置,使用server默认host
+    virtual-host: /test
 
   servlet:
     multipart:

+ 54 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/ObjectToFromController.kt

@@ -257,7 +257,9 @@ class ObjectToFromController {
         try {
             val spaceList = spaceService.select(SFilter.eq("projectId", projectId)).exec()
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            logger.debug("1111111111111111111111111111*")
             if (spaceList.size>0){
+                logger.debug("******************************************************************")
                 for (space in spaceList){
 //                    val spaceOutline = spaceOutlineService.select(SFilter.eq("id", space.id!!)).entity()
 //                    if (spaceOutline!=null){
@@ -265,11 +267,18 @@ class ObjectToFromController {
 //                    }
                     val createObj =
                         EquipApi.createObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
-                    if (createObj!!.result == "success") {
+                    if (createObj!!.result != "success") {
+                        val updateObj =
+                            EquipApi.updateObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
+                        if (updateObj!=null&&updateObj.result == "success") {
+                            logger.debug("空间更成功:${space.id}")
+                        }
+                    }else {
+                        logger.debug("空间创建成功:${space.toJson()}")
                         val updateObj =
                             EquipApi.updateObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
                         if (updateObj!=null&&updateObj.result == "success") {
-                            logger.debug("空间更新失败:${space.toJson()}")
+                            logger.debug("空间更成功:${space.id}")
                         }
                     }
                 }
@@ -282,6 +291,49 @@ class ObjectToFromController {
     }
 
     /**
+     * 空间
+     */
+    @Operation(summary= "空间-数据中心同步到数据中台", description = "")
+    @PostMapping("/spaceid")
+    fun spaceSyncId(@RequestParam projectId: String,@RequestParam id: String): SBaseResponse {
+        try {
+            val spaceList = spaceService.select(SFilter.eq("projectId", projectId),SFilter.eq("id", id)).exec()
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            logger.debug("1111111111111111111111111111*")
+            if (spaceList.size>0){
+                logger.debug("******************************************************************")
+                for (space in spaceList){
+                    val spaceOutline = spaceOutlineService.select(SFilter.eq("id", space.id!!)).entity()
+                    if (spaceOutline!=null){
+                        space.outline = spaceOutline.outline
+                    }
+                    val createObj =
+                        EquipApi.createObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
+                    if (createObj!!.result != "success") {
+                        val updateObj =
+                            EquipApi.updateObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
+                        if (updateObj!=null&&updateObj.result == "success") {
+                            logger.debug("空间更成功:${space.toJson()}")
+                        }
+                    }else {
+                        logger.debug("空间创建成功:${space.toJson()}")
+                        val updateObj =
+                            EquipApi.updateObj(dictProject!!.groupCode!!, projectId,SpaceUtil.spaceTools(projectId, space))
+                        if (updateObj!=null&&updateObj.result == "success") {
+                            logger.debug("空间更成功:${space.toJson()}")
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
+    }
+
+
+    /**
      * 创建关系列表
      *
      * @param graphCode     图类型编码

+ 5 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/jms/MessageProcessing.kt

@@ -81,7 +81,11 @@ class MessageProcessing {
                     if (syncRwdMessageList.size >0){
                         rwdSync.dataSync(syncRwdMessageList)
                         messageTypeRwd = 1
-                        syncRwdData()
+                        try {
+                            syncRwdData()
+                        } catch (e: Exception) {
+
+                        }
                     } else {
                         logger.debug("释放状态-中台")
                         messageTypeRwd = 1

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

@@ -235,6 +235,9 @@ object EquipApi {
         try {
             if (!Configure.customProperties.eurekaorhttp) {
                 val url = "${opts.data_rwd}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+                logger.debug("url= ${url}")
+                logger.debug("url= ${listObj.toJson()}")
+                logger.debug("结果=${listObj.toJson()}")
                 val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
                 return postObject
             } else {
@@ -274,9 +277,10 @@ object EquipApi {
             }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)
-
+                logger.debug("url= ${url}")
+                logger.debug("boby= ${listObj.toJson()}")
+                logger.debug("结果= ${postObject.toJson()}")
                 return postObject
-
             }
         } catch (e: Exception) {
             e.printStackTrace()
@@ -315,14 +319,16 @@ object EquipApi {
         /** 直接 http 请求还是通过注册中心 */
         if (!Configure.customProperties.eurekaorhttp) {
             val url = "${opts.data_rwd}/rwd/instance/relation/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
-//            logger.debug("url=${url}")
-//            logger.debug("boby=${jsonArray.toJson()}")
+            logger.debug("url=${url}")
+            logger.debug("boby=${jsonArray.toJson()}")
             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"
+            logger.debug("url=${url}")
+            logger.debug("boby=${jsonArray.toJson()}")
             val postObject = Configure.restTemplate.postForObject(url, jsonArray, MiddleGroundDataRespose::class.java)
             if (postObject.result == "success") {
                 return true

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

@@ -53,7 +53,7 @@ class SchedulerTask {
     //cron表达式:每隔5秒执行一次
 //    @Scheduled(cron = "0 */5 * * * ?")
 //    @Scheduled(cron="0/30 * *  * * ? ")   //每5秒执行一次
-    @Scheduled(cron = "0 */1 * * * ?")
+//    @Scheduled(cron = "0 */1 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始至中台")
         messageProcessing.syncDataCenter()

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

@@ -53,7 +53,7 @@ class SchedulerTaskRel {
     //cron表达式:每隔5秒执行一次
 //    @Scheduled(cron = "0 */5 * * * ?")
 //    @Scheduled(cron="0/5 * *  * * ? ")   //每5秒执行一次
-    @Scheduled(cron = "0 */3 * * * ?")
+//    @Scheduled(cron = "0 */3 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始至数据中台-关系数据")
         messageProcessing.syncDataCenterRel()

+ 2 - 2
datasyn/src/main/resources/application-dev.yml

@@ -6,8 +6,8 @@ spring:
     #    username:                           postgres
     #    password:                           123qwe!@#
 #    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
-    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
-#    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
+#    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
+    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
     #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj