|
@@ -7,6 +7,7 @@ import com.persagy.server.datacenter.models.entities.objects.Equipment
|
|
|
import com.persagy.server.datacenter.models.entities.objects.Floor
|
|
|
import com.persagy.server.datacenter.models.entities.objects.ZoneSpace
|
|
|
import com.persagy.server.datacenter.models.entities.rel.*
|
|
|
+import com.persagy.server.syn.Configure
|
|
|
import com.persagy.server.syn.models.api.obj.EquipApi
|
|
|
import com.persagy.service.SBaseService
|
|
|
import com.persagy.service.SObjectService
|
|
@@ -423,4 +424,43 @@ class RelFromToControllers {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备和设备关系
|
|
|
+ */
|
|
|
+ @Operation(summary= "设备和设备关系 同步到数据中心", description = "")
|
|
|
+ @PostMapping("/eq2eq")
|
|
|
+ fun eq2Eq(@RequestParam projectId: String,@RequestParam graphCode: String,@RequestParam relCode: String): SBaseResponse{
|
|
|
+ try {
|
|
|
+ val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
|
|
|
+ if (dictProject!=null) {
|
|
|
+ val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, graphCode, relCode)
|
|
|
+ if (!relList.isNullOrEmpty()){
|
|
|
+ val relType = Configure.relContrastEq(graphCode, relCode)
|
|
|
+ if (!relType.isNullOrEmpty()){
|
|
|
+ for ( rel in relList) {
|
|
|
+ try {
|
|
|
+ val fromId = rel["objFrom"].toString()
|
|
|
+ val toId = rel["objTo"].toString()
|
|
|
+ val rEq2Eq = REq2Eq()
|
|
|
+ rEq2Eq.id1 = fromId
|
|
|
+ rEq2Eq.id2 = toId
|
|
|
+ rEq2Eq.sign = 1
|
|
|
+ rEq2Eq.projectId = projectId
|
|
|
+ rEq2Eq.type = relType
|
|
|
+ rEq2EqService.replace(rEq2Eq)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return SBaseResponse(SResponseType.success)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ return SBaseResponse(SResponseType.failure)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|