|
@@ -30,6 +30,9 @@ import com.persagy.database.SFilter
|
|
|
import com.persagy.mybatis.SMybatisDao
|
|
|
import com.persagy.server.datacenter.models.entities.dictnew.DictProject
|
|
|
import com.persagy.server.datacenter.models.entities.rel.*
|
|
|
+import com.persagy.server.datacenter.models.entities.rel.archforarch.RSp2Bd
|
|
|
+import com.persagy.server.datacenter.models.entities.rel.archforarch.RSp2Fl
|
|
|
+import com.persagy.server.datacenter.models.entities.rel.archforarch.RSp2Sh
|
|
|
import com.persagy.server.datacenter.models.jms.SynchronousMessageRel
|
|
|
import com.persagy.server.syn.Configure
|
|
|
import com.persagy.server.syn.models.api.obj.EquipApi
|
|
@@ -69,6 +72,16 @@ class AutomaticCalculationSync {
|
|
|
val rSp2SpService = SObjectService(SMybatisDao(RSp2Sp::class.java))
|
|
|
/** 设备和设备关系 */
|
|
|
val rEq2EqService = SObjectService(SMybatisDao(REq2Eq::class.java))
|
|
|
+ /** 设备服务于竖井 */
|
|
|
+ val rEqForShService = SObjectService(SMybatisDao(REqForSh::class.java))
|
|
|
+ /** 空间和竖井 */
|
|
|
+ private val rSp2ShService = SObjectService(SMybatisDao(RSp2Sh::class.java))
|
|
|
+ /** 空间和楼层 */
|
|
|
+ private val rSp2FlService = SObjectService(SMybatisDao(RSp2Fl::class.java))
|
|
|
+ /** 区域服务-空间和建筑 */
|
|
|
+ private val rSp2BdService = SObjectService(SMybatisDao(RSp2Bd::class.java))
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/** 缓存对象数据服务 - 数据中心到数据中台 */
|
|
|
var synchronousMessageRelService = SObjectService(SMybatisDao(SynchronousMessageRel::class.java))
|
|
@@ -685,12 +698,184 @@ class AutomaticCalculationSync {
|
|
|
val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
if (!createRel){
|
|
|
message.sign = 2
|
|
|
- message.count +1
|
|
|
+ message.count = message.count +1
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
message.sign = 2
|
|
|
- message.count +1
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 更改标记 */
|
|
|
+ synchronousMessageRelService.update(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备服务于竖井
|
|
|
+ */
|
|
|
+ fun eq2ShFor(message: SynchronousMessageRel) {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val rEq2SpList = rEqForShService.select(SFilter.eq("projectId", message.projectId!!)).exec()
|
|
|
+ message.sign = 0
|
|
|
+ if (rEq2SpList.size>0) {
|
|
|
+ for (rEq2Sp in rEq2SpList) {
|
|
|
+ try {
|
|
|
+ /** 先执行删除 */
|
|
|
+ val toJsonObj = Configure.toJsonObj("MechForArch", "Eq2Sh", rEq2Sp.equipId!!, rEq2Sp.shaftId!!)
|
|
|
+ val delRel = EquipApi.delRel(dictProject.groupCode!!, message.projectId!!, toJsonObj)
|
|
|
+ /** 关系列表 */
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray("MechForArch", "Eq2Sh", rEq2Sp.equipId!!, rEq2Sp.shaftId!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 更改标记 */
|
|
|
+ synchronousMessageRelService.update(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 空间服务于空间
|
|
|
+ */
|
|
|
+ fun sp2SpFor(message: SynchronousMessageRel) {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val rEq2SpList = rSp2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sp_ArchForArch")).exec()
|
|
|
+ message.sign = 0
|
|
|
+ if (rEq2SpList.size>0) {
|
|
|
+ for (rEq2Sp in rEq2SpList) {
|
|
|
+ try {
|
|
|
+ /** 先执行删除 */
|
|
|
+ val toJsonObj = Configure.toJsonObj("ArchForArch", "Sp2Sp", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val delRel = EquipApi.delRel(dictProject.groupCode!!, message.projectId!!, toJsonObj)
|
|
|
+ /** 关系列表 */
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray("ArchForArch", "Sp2Sp", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 更改标记 */
|
|
|
+ synchronousMessageRelService.update(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 空间服务于竖井
|
|
|
+ */
|
|
|
+ fun sp2ShFor(message: SynchronousMessageRel) {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val rEq2SpList = rSp2ShService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sh_ArchForArch")).exec()
|
|
|
+ message.sign = 0
|
|
|
+ if (rEq2SpList.size>0) {
|
|
|
+ for (rEq2Sp in rEq2SpList) {
|
|
|
+ try {
|
|
|
+ /** 先执行删除 */
|
|
|
+ val toJsonObj = Configure.toJsonObj("ArchForArch", "Sp2Sh", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val delRel = EquipApi.delRel(dictProject.groupCode!!, message.projectId!!, toJsonObj)
|
|
|
+ /** 关系列表 */
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray("ArchForArch", "Sp2Sh", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 更改标记 */
|
|
|
+ synchronousMessageRelService.update(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 空间服务于楼层
|
|
|
+ */
|
|
|
+ fun sp2FlFor(message: SynchronousMessageRel) {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val rEq2SpList = rSp2FlService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2fl_ArchForArch")).exec()
|
|
|
+ message.sign = 0
|
|
|
+ if (rEq2SpList.size>0) {
|
|
|
+ for (rEq2Sp in rEq2SpList) {
|
|
|
+ try {
|
|
|
+ /** 先执行删除 */
|
|
|
+ val toJsonObj = Configure.toJsonObj("ArchForArch", "Sp2Fl", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val delRel = EquipApi.delRel(dictProject.groupCode!!, message.projectId!!, toJsonObj)
|
|
|
+ /** 关系列表 */
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray("ArchForArch", "Sp2Fl", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }else {
|
|
|
+ message.sign = 0
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 更改标记 */
|
|
|
+ synchronousMessageRelService.update(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 空间服务于建筑
|
|
|
+ */
|
|
|
+ fun sp2BdFor(message: SynchronousMessageRel) {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val rEq2SpList = rSp2BdService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2bd_ArchForArch")).exec()
|
|
|
+ message.sign = 0
|
|
|
+ if (rEq2SpList.size>0) {
|
|
|
+ for (rEq2Sp in rEq2SpList) {
|
|
|
+ try {
|
|
|
+ /** 先执行删除 */
|
|
|
+ val toJsonObj = Configure.toJsonObj("ArchForArch", "Sp2Bd", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val delRel = EquipApi.delRel(dictProject.groupCode!!, message.projectId!!, toJsonObj)
|
|
|
+ /** 关系列表 */
|
|
|
+ val toJsonObjArray =
|
|
|
+ Configure.toJsonObjArray("ArchForArch", "Sp2Bd", rEq2Sp.id1!!, rEq2Sp.id1!!)
|
|
|
+ val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
|
|
|
+ if (!createRel){
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ message.sign = 2
|
|
|
+ message.count = message.count +1
|
|
|
}
|
|
|
}
|
|
|
}
|