Browse Source

********************WX******************
空间多建筑楼层问题

zhangweixin 4 years ago
parent
commit
32c386ed94

+ 39 - 0
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt

@@ -54,6 +54,10 @@ import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlock
+import com.persagy.server.datacenter.models.entities.rel.RSpinBd
+import com.persagy.server.datacenter.models.entities.rel.RSpinFl
+import com.persagy.server.services.rel.RSpInBdService
+import com.persagy.server.services.rel.RSpInFlService
 
 /**
  * 自动关系计算
@@ -163,6 +167,24 @@ open class RelationCalcService {
                 upDate(projectId, "bd2sp")
 //                upDate(projectId,"fl2sp")
                 try {
+                    try {
+                        val zoneSpacelist = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId!!), SFilter.not(
+                            SFilter.isNull("buildingId"))).exec()
+                        if (zoneSpacelist.size>0) {
+                            for (zoneSpace in zoneSpacelist) {
+                                val rSpinBd = RSpinBd()
+                                rSpinBd.spaceId = zoneSpace.id
+                                rSpinBd.buildingId = zoneSpace.buildingId
+                                rSpinBd.objectType = zoneSpace.classCode
+                                rSpinBd.projectId = projectId
+                                RSpInBdService.replace(rSpinBd)
+                            }
+                        }
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+
+
                     /** 发送消息 */
                     rabbitMqService.sendRel(Opt.projectId!!, "Bd2Sp", "20", "123", "456")
                 } catch (e: Exception) {
@@ -571,6 +593,23 @@ open class RelationCalcService {
             val result = mapper.calcFl2Sp(tablesName, projectId)
             if (result != null && result == 0) {
                 try {
+                    try {
+                        val zoneSpacelist = ZoneSpaceBaseService.select(SFilter.eq("projectId", projectId!!), SFilter.not(
+                            SFilter.isNull("floorId"))).exec()
+                        if (zoneSpacelist.size>0) {
+                            for (zoneSpace in zoneSpacelist) {
+                                val rSpinFl = RSpinFl()
+                                rSpinFl.spaceId = zoneSpace.id
+                                rSpinFl.buildingId = zoneSpace.buildingId
+                                rSpinFl.objectType = zoneSpace.classCode
+                                rSpinFl.projectId = projectId
+                                rSpinFl.floorId = zoneSpace.floorId
+                                RSpInFlService.replace(rSpinFl)
+                            }
+                        }
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
                     /** 发送消息 */
                     rabbitMqService.sendRel(Opt.projectId!!, "Fl2Sp_in", "20", "全量同步", "456")
                 } catch (e: Exception) {