|
@@ -30,12 +30,15 @@ import com.persagy.database.SFilter
|
|
|
import com.persagy.mybatis.SMybatisDao
|
|
|
import com.persagy.server.Opt
|
|
|
import com.persagy.server.datacenter.models.entities.objects.Building
|
|
|
+import com.persagy.server.datacenter.models.entities.objects.Floor
|
|
|
import com.persagy.server.services.assistant.ObjInfoService
|
|
|
import com.persagy.server.services.base.Service
|
|
|
import com.persagy.server.services.log.DataCenterLogsService
|
|
|
import com.persagy.server.utils.IdUtils
|
|
|
import com.persagy.server.utils.ShaftNameUtil
|
|
|
import com.persagy.service.SPageContext
|
|
|
+import com.persagy.service.models.enums.SResponseType
|
|
|
+import com.persagy.service.models.responses.SBaseResponse
|
|
|
import java.util.*
|
|
|
|
|
|
/**
|
|
@@ -176,7 +179,7 @@ object BuildingService : Service<Building>(SMybatisDao(Building::class.java)) {
|
|
|
try {
|
|
|
val projectId = SPageContext.getHeader("projectId")
|
|
|
for (building in entityList) {
|
|
|
- ObjInfoService.delete(SFilter.eq("projectId",projectId!!), SFilter.eq("objId",building.id!!), SFilter.eq("objType","Bd"))
|
|
|
+// ObjInfoService.delete(SFilter.eq("projectId",projectId!!), SFilter.eq("objId",building.id!!), SFilter.eq("objType","Bd"))
|
|
|
rabbitMqService.sendObjects(building.projectId!!, Opt.DELETE,building.id!!)
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
@@ -184,5 +187,47 @@ object BuildingService : Service<Building>(SMybatisDao(Building::class.java)) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除楼层数据
|
|
|
+ */
|
|
|
+ fun deleteList(buildingList: ArrayList<Building>): SBaseResponse {
|
|
|
+ val sBaseResponse = SBaseResponse(SResponseType.success)
|
|
|
+ if (!buildingList.isNullOrEmpty()) {
|
|
|
+ for (building in buildingList) {
|
|
|
+
|
|
|
+ val floorList = FloorService.select(SFilter.eq("projectId", Opt.projectId!!),
|
|
|
+ SFilter.eq("buildingId", building.id!!)).exec()
|
|
|
+ val equipList =
|
|
|
+ EquipmentService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("buildingId", building.id!!))
|
|
|
+ .exec()
|
|
|
+ val spaceList = ZoneSpaceBaseService.select(SFilter.eq("projectId", Opt.projectId!!),
|
|
|
+ SFilter.eq("buildingId", building.id!!)).exec()
|
|
|
+ val ispaceList =
|
|
|
+ SpaceService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("buildingId", building.id!!))
|
|
|
+ .exec()
|
|
|
+ if (floorList.size>0||equipList.size>0||spaceList.size>0||ispaceList.size>0 ) {
|
|
|
+ sBaseResponse.message = "建筑下包含其他对象实例,请解除关系后删除"
|
|
|
+ sBaseResponse.result = SResponseType.failure
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ val delete =
|
|
|
+ BuildingService.delete(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("id", building.id!!))
|
|
|
+ if (delete) {
|
|
|
+ try {
|
|
|
+ rabbitMqService.sendObjects(building.projectId!!, Opt.DELETE,building.id!!)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ sBaseResponse.result = SResponseType.failure
|
|
|
+ sBaseResponse.message = "列表不可以为空"
|
|
|
+ }
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
} // Object BuildingService
|