Browse Source

********************WX******************
添加关系校验

zhangweixin 3 years ago
parent
commit
ef184776cb

+ 97 - 29
datacenter/src/main/kotlin/com/persagy/server/services/graphtype/RelationTypeProjectService.kt

@@ -41,6 +41,7 @@ import com.persagy.server.mappers.IRelationExcelExportMapper
 import com.persagy.server.mappers.IRelationExcelImportMapper
 import com.persagy.server.services.base.RService
 import com.persagy.server.services.objects.EquipmentService
+import com.persagy.server.services.objects.ZoneSpaceBaseService
 import com.persagy.server.utils.IdUtils
 import com.persagy.service.SObjectService
 import com.persagy.service.SPageContext
@@ -441,36 +442,71 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
                             }
                         /***************************************************************************** 限定条件 *********************************************************************************/
 
-//                        if (relType == "sp2sp_RadiationNetwork_2"||relType =="sp2sp_RadiationNetwork_1") {
-//                            if (relZoneToSpaceList[0].classCode != "LightingZone") {
-//                                /** 主对象编码识别到多个实例 */
-//                                sCreateResponse.result = SResponseType.failure
-//                                sCreateResponse.message = relationAddRequest.mainContent+":不是照明分区类型"
-//                                sCreateResponse.errorType = "2"
-//                                return sCreateResponse
-//                            }
-//                        }
-//                        if (relType == "sp2sp_ConvectionNetwork_2"||relType =="sp2sp_ConvectionNetwork_3"||relType =="sp2sp_ConvectionNetwork_1") {
-//                            if (relZoneToSpaceList[0].classCode != "AirConditioningZone") {
-//                                /** 主对象编码识别到多个实例 */
-//                                sCreateResponse.result = SResponseType.failure
-//                                sCreateResponse.message = relationAddRequest.mainContent+":不是空调分区类型"
-//                                sCreateResponse.errorType = "2"
-//                                return sCreateResponse
-//                            }
-//                        }
-//                        if (relType =="sp2sp_TrafficNetwork_3"||relType =="sp2sp_TrafficNetwork_2"||relType =="sp2sp_TrafficNetwork_1") {
-//                            if (relZoneToSpaceList[0].classCode != "GeneralZone") {
-//                                /** 主对象编码识别到多个实例 */
-//                                sCreateResponse.result = SResponseType.failure
-//                                sCreateResponse.message = relationAddRequest.mainContent+":不是物业分区类型"
-//                                sCreateResponse.errorType = "2"
-//                                return sCreateResponse
-//                            }
-//                        }
-
-
+                        if (relType == "sp2sp_RadiationNetwork_2"||relType =="sp2sp_RadiationNetwork_1") {
+                            val entity1 = ZoneSpaceBaseService.select(SFilter.eq("id", id1List[0])).entity()
+                            if (entity1?.classCode != "LightingZone" ) {
+                                row.createCell(stateCol).setCellValue("主对象不属于照明分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                            val entity2 = ZoneSpaceBaseService.select(SFilter.eq("id", id2List[0])).entity()
+                            if (entity2?.classCode != "LightingZone" ) {
+                                row.createCell(stateCol).setCellValue("从对象不属于照明分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                        }
+                        if (relType == "sp2sp_ConvectionNetwork_2"||relType =="sp2sp_ConvectionNetwork_3"||relType =="sp2sp_ConvectionNetwork_1") {
 
+                            val entity1 = ZoneSpaceBaseService.select(SFilter.eq("id", id1List[0])).entity()
+                            if (entity1?.classCode != "LightingZone" ) {
+                                row.createCell(stateCol).setCellValue("主对象不属于空调分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                            val entity2 = ZoneSpaceBaseService.select(SFilter.eq("id", id2List[0])).entity()
+                            if (entity2?.classCode != "LightingZone" ) {
+                                row.createCell(stateCol).setCellValue("从对象不属于空调分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                        }
+                        if (relType =="sp2sp_TrafficNetwork_3"||relType =="sp2sp_TrafficNetwork_2"||relType =="sp2sp_TrafficNetwork_1") {
+                            val entity1 = ZoneSpaceBaseService.select(SFilter.eq("id", id1List[0])).entity()
+                            if (entity1?.classCode != "GeneralZone" ) {
+                                row.createCell(stateCol).setCellValue("主对象不属于物业分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                            val entity2 = ZoneSpaceBaseService.select(SFilter.eq("id", id2List[0])).entity()
+                            if (entity2?.classCode != "GeneralZone" ) {
+                                row.createCell(stateCol).setCellValue("从对象不属于物业分区类型,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                        }
+                        if (relType =="eq2eq_EquipPower_1"||relType =="eq2eq_EquipPower_2"||
+                            relType =="eq2eq_EquipPower_3"||relType =="eq2eq_EquipPower_4"){
+                            val entity = EquipmentService.select(SFilter.eq("id", id1List[0])).entity()
+                            if (entity?.classCode!! == "SETDLS"||entity?.classCode!! == "SETDHS") {
+                                /** 符合条件不做操作 */
+                            } else {
+                                row.createCell(stateCol).setCellValue("主对象不属于低/高压开关柜,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                        }
+                        if (relType == "eq2eq_SensorRelationship_ss2eq"||relType == "eq2sy_SensorRelationship_ss2sy"||
+                            relType == "eq2sp_SensorRelationship_ss2sp") {
+                            val entity = EquipmentService.select(SFilter.eq("id", id1List[0])).entity()
+                            val ss2EqCheck = ss2EqCheck()
+                            val containsKey = ss2EqCheck.containsKey(entity?.classCode)
+                            if (!containsKey){
+                                row.createCell(stateCol).setCellValue("主对象不是传感器,请参考规则")
+                                failCount += 1
+                                continue
+                            }
+                        }
 
                         /******************************************************************************************************************************************************/
 
@@ -1125,5 +1161,37 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
         workbook.write(response.outputStream)
     }
 
+    /**
+     * 传感器类型
+     */
+    fun ss2EqCheck(): HashMap<String,String> {
+        val map = HashMap<String,String>()
+        map["SPVSCM"] = "1"
+        map["FFEALS"] = "1"
+        map["FFFPSE"] = "1"
+        map["FFFASE"] = "1"
+        map["SPIASE"] = "1"
+        map["WEGMCM"] = "1"
+        map["WEOFCM"] = "1"
+        map["WEGMPD"] = "1"
+        map["FFGASE"] = "1"
+        map["OTSESP"] = "1"
+        map["OTSESD"] = "1"
+        map["OTSETP"] = "1"
+        map["OTSEVD"] = "1"
+        map["OTSEPS"] = "1"
+        map["OTSEPF"] = "1"
+        map["OTSERH"] = "1"
+        map["OTSEIP"] = "1"
+        map["OTSEIL"] = "1"
+        map["OTSEHT"] = "1"
+        map["OTSECB"] = "1"
+        map["OTSECT"] = "1"
+        map["OTSEEE"] = "1"
+        map["OTSEDP"] = "1"
+        map["OTSEFL"] = "1"
+        return map
+    }
+
 }
 

+ 6 - 1
pendingIssues.md

@@ -58,7 +58,12 @@ v_equip_component_count
  密码: persagy@2021
 ```
 
-
+```
+服务器:8.140.129.63
+gogs:http://8.140.129.63:3000/        presagy      Presagy@2021
+nexus: http://8.140.129.63:8081/        admin       Presagy@2021
+nacos: http://8.140.129.63:8848/        nacos       Presagy@2021
+```
 
 缓存数据服务器
 ```