123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- package com.persagy.proxy.adm.service.impl;
- import cn.hutool.core.collection.CollUtil;
- import cn.hutool.core.util.StrUtil;
- import com.persagy.dmp.common.context.AppContext;
- import com.persagy.proxy.adm.constant.AdmObjectInfoConstant;
- import com.persagy.proxy.adm.model.AdmRelationAddRequest;
- import com.persagy.proxy.adm.request.AdmCreateResponse;
- import com.persagy.proxy.adm.service.AdmManualRelationCalcService;
- import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.stereotype.Service;
- import java.util.Map;
- /***
- * Description: 手动计算逻辑处理类
- * @author : lijie
- * @date :2021/8/31 11:51
- * Update By lijie 2021/8/31 11:51
- */
- @Service
- @Slf4j
- public class AbstractAdmManualRelationCalcServiceImpl implements AdmManualRelationCalcService {
- /***
- * Description: 添加关系
- * @param request : 请求参数
- * @return : com.persagy.proxy.adm.request.AdmCreateResponse
- * @author : lijie
- * @date :2021/8/31 12:14
- * Update By lijie 2021/8/31 12:14
- */
- @Override
- public AdmCreateResponse addRels(AdmRelationAddRequest request) {
- // 获取项目id
- String projectId = AppContext.getContext().getProjectId();
- if (StrUtil.isBlank(request.getRelType())){
- return AdmCreateResponse.failure("关系类型不能为空");
- }
- if (StrUtil.isBlank(request.getType())){
- return AdmCreateResponse.failure("识别不能为空");
- }
- if (StrUtil.isBlank(request.getMainContent())){
- return AdmCreateResponse.failure("主对象不能为空","1");
- }
- if (CollUtil.isEmpty(request.getFromContent())){
- return AdmCreateResponse.failure("从对象不能为空","2");
- }
- // 2.1 pe2sp,pe2sh,eq2sh_for,eq2fl_for,eq2bd_for,sy2sp_for,sy2sh_for,sy2fl_for,sy2bd_for
- // sp2sp_ConvectionNetwork_1,sp2sp_ConvectionNetwork_2,sp2sp_ConvectionNetwork_3,sp2sp_SpaceNeighborhood_5
- // sp2sp_SpaceNeighborhood_2,sp2sp_SpaceNeighborhood_4,sp2sp_TrafficNetwork_3,sp2sp_TrafficNetwork_2,
- // sp2sp_RadiationNetwork_1,sp2sp_RadiationNetwork_2,sp2sp_SpaceNeighborhood_1,sp2sp_TrafficNetwork_1,
- // sp2sp_SpaceNeighborhood_3,eq2sy_ControlRelation_2,eq2sy_ValveRelationship_vv2sy,
- // eq2sy_SensorRelationship_ss2sy,eq2sp_SensorRelationship_ss2sp,eq2sp_x,bd2bd_ArchForArch,bd2fl_ArchForArch,
- // bd2sh_ArchForArch,bd2sp_ArchForArch,fl2bd_ArchForArch,fl2fl_ArchForArch,fl2sh_ArchForArch,fl2sp_ArchForArch,
- // sh2bd_ArchForArch,sh2fl_ArchForArch,sh2sh_ArchForArch,sh2sp_ArchForArch,sp2bd_ArchForArch,sp2fl_ArchForArch,
- // sp2sh_ArchForArch,sp2sp_ArchForArch
- // 校验关系类型是否存在
- Map<String, AdmRelationTypeEnum> relationTypeMap = AdmRelationTypeEnum.getRelationTypeMap();
- if (relationTypeMap.containsKey(request.getRelType())){
- return AdmCreateResponse.failure("不存在的关系类型");
- }
- AdmRelationTypeEnum relationTypeEnum = relationTypeMap.get(request.getRelType());
- // type为cadId直接提示从对象不存在CADID编码并且errorType=2
- if (AdmObjectInfoConstant.CADID.equals(request.getType()) && relationTypeEnum.getHasCheckCadId()){
- return AdmCreateResponse.failure("从对象不存在CADID编码","2");
- }
- // 1.根据项目id和关系类型更新计算时间为当前时间
- // 2.根据不同关系类型进行处理
- // 2.2 特殊类型的判断
- // *******
- // sp2sp_RadiationNetwork_2,sp2sp_RadiationNetwork_1 && classCode!=LightingZone errorType=1,不是照明分区类型
- // sp2sp_ConvectionNetwork_2,sp2sp_ConvectionNetwork_3,sp2sp_ConvectionNetwork_1 && classCode!=AirConditioningZone errorType=1,不是空调分区类型
- // sp2sp_TrafficNetwork_3,sp2sp_TrafficNetwork_2,sp2sp_TrafficNetwork_1 && classCode!=GeneralZone errorType=1,不是物业分区类型
- // relType为上面几种的规定从对象不能重复,主对象和从对象不能重复
- // *******
- // eq2eq_EquipPower_1,eq2eq_EquipPower_2,eq2eq_EquipPower_3,eq2eq_EquipPower_4
- // 主对象的class_code必须等于SETDLS,SETDHS,其他的报不符合主对象条件限制错误
- // *******
- // 2.3 根据对象信息点和对象内容(主/副)查询对象,然后添加关系及计算标记
- // 1.obj_type,project_id,type(设备名称(name),设备ID(id),本地编码(localId),本地名称(localName))查询主对象
- // 2.obj_type,project_id,type(设备名称(name),设备ID(id),本地编码(localId),本地名称(localName)),是否排除主对象id,是否主对象的class_code查询从对象
- // 3.不存在/多实例,errorType为1,2(1-主实例,2-从实例),结束
- // 4.插入关系from_id,to_id,图类型编码,边类型编码,项目id,如果rel_value有值则加上,结束
- // 5.处理sign:计算标记 1 为手动 2为自动
- // pe2sp:from_id为资产id,to_id为空间id,主对象obj_type为property,从对象obj_type为space,图类型为PropertyInArch,边类型为Pe2Sp,rel_value为查询的空间对应的class_code
- // pe2sh:from_id为资产id,to_id为竖井id,主对象obj_type为property,从对象obj_type为shaft,图类型为PropertyInArch,边类型为Pe2Sh
- // eq2sh_for:from_id为设备id,to_id为竖井id,主对象obj_type为equipment,从对象obj_type为shaft,图类型为MechForArch,边类型为Eq2Sh
- // eq2fl_for:from_id为设备id,to_id为楼层id,主对象obj_type为equipment,从对象obj_type为floor,图类型为MechForArch,边类型为Eq2Fl
- // eq2bd_for:from_id为设备id,to_id为建筑id,主对象obj_type为equipment,从对象obj_type为building,图类型为MechForArch,边类型为Eq2Bd
- // sy2sp_for:from_id为系统id,to_id为空间id,主对象obj_type为system,从对象obj_type为space,图类型为MechForArch,边类型为Sy2Sp
- // sy2sh_for:from_id为系统id,to_id为竖井id,主对象obj_type为system,从对象obj_type为shaft,图类型为MechForArch,边类型为Sy2Sh
- // sy2fl_for:from_id为系统id,to_id为楼层id,主对象obj_type为system,从对象obj_type为floor,图类型为MechForArch,边类型为Sy2Fl
- // sy2bd_for:from_id为系统id,to_id为建筑id,主对象obj_type为system,从对象obj_type为building,图类型为MechForArch,边类型为Sy2Bd
- // sy2bd_for:from_id为系统id,to_id为建筑id,主对象obj_type为system,从对象obj_type为floor,图类型为MechForArch,边类型为Sy2Bd
- // *******
- // 从对象查询排除主对象id,主对象的class_code查询从对象
- // sp2sp_ConvectionNetwork_1,sp2sp_ConvectionNetwork_2,sp2sp_ConvectionNetwork_3,sp2sp_SpaceNeighborhood_5
- // sp2sp_SpaceNeighborhood_2,sp2sp_SpaceNeighborhood_4,sp2sp_TrafficNetwork_3,sp2sp_TrafficNetwork_2,
- // sp2sp_RadiationNetwork_1,sp2sp_RadiationNetwork_2,sp2sp_SpaceNeighborhood_1,sp2sp_TrafficNetwork_1,
- // sp2sp_SpaceNeighborhood_3
- // from_id为空间id,to_id为空间id,主对象obj_type为space,从对象obj_type为space,rel_value为查询的主对象空间对应的class_code
- // sp2sp_ConvectionNetwork_1:图类型为ConvectionNetwork,边类型为Natural
- // sp2sp_ConvectionNetwork_2:图类型为ConvectionNetwork,边类型为MixMech
- // sp2sp_ConvectionNetwork_3:图类型为ConvectionNetwork,边类型为OnewayMech
- // sp2sp_SpaceNeighborhood_1:图类型为SpaceNeighborhood,边类型为None
- // sp2sp_SpaceNeighborhood_2:图类型为SpaceNeighborhood,边类型为Door
- // sp2sp_SpaceNeighborhood_3:图类型为SpaceNeighborhood,边类型为Window
- // sp2sp_SpaceNeighborhood_4:图类型为SpaceNeighborhood,边类型为DoorWindow
- // sp2sp_SpaceNeighborhood_5:图类型为SpaceNeighborhood,边类型为Connect
- // sp2sp_TrafficNetwork_1:图类型为TrafficNetwork,边类型为Normal
- // sp2sp_TrafficNetwork_2:图类型为TrafficNetwork,边类型为FFOpen
- // sp2sp_TrafficNetwork_3:图类型为TrafficNetwork,边类型为FFClose
- // sp2sp_RadiationNetwork_1:图类型为RadiationNetwork,边类型为Connect
- // sp2sp_RadiationNetwork_2:图类型为RadiationNetwork,边类型为Transparent
- // *******
- // 从对象查询排除主对象id
- // eq2eq_LUDistribution_1,eq2eq_LUDistribution_2,eq2eq_HUDistribution_1,eq2eq_HUDistribution_2,
- // eq2eq_EquipPower_1,eq2eq_EquipPower_2,eq2eq_EquipPower_3,eq2eq_EquipPower_4
- // from_id为设备id,to_id为设备id,主对象obj_type为equipment,从对象obj_type为equipment,
- // eq2eq_LUDistribution_1:图类型为LUDistribution,边类型为Normal
- // eq2eq_LUDistribution_2:图类型为LUDistribution,边类型为Backup
- // eq2eq_HUDistribution_1:图类型为LUDistribution,边类型为Normal
- // eq2eq_HUDistribution_2:图类型为LUDistribution,边类型为Backup
- // eq2eq_EquipPower_1:图类型为EquipPower,边类型为EqNormal
- // eq2eq_EquipPower_2:图类型为EquipPower,边类型为EqBackup
- // eq2eq_EquipPower_3:图类型为EquipPower,边类型为SyNormal
- // eq2eq_EquipPower_4:图类型为EquipPower,边类型为SyBackup
- // ******
- // 从对象查询排除主对象id
- // eq2eq_ACAirNetwork_1,eq2eq_ACAirNetwork_2,eq2eq_ACAirNetwork_3
- // eq2eq_ChillWaterLoop_1,eq2eq_ChillWaterLoop_2,eq2eq_ChillWaterLoop_3,eq2eq_ChillWaterLoop_4
- // eq2eq_CoolingWaterLoop_1,eq2eq_CoolingWaterLoop_2,eq2eq_CoolingWaterLoop_3,eq2eq_CoolingWaterLoop_4
- // eq2eq_CondWaterNetwork_1
- // eq2eqFreshAirNetwork_1
- // eq2eq_HeatWaterLoop_1,eq2eq_HeatWaterLoop_2,eq2eq_HeatWaterLoop_3,eq2eq_HeatWaterLoop_4
- // eq2eq_VentNetwork_1,eq2eq_VentNetwork_2,eq2eq_VentNetwork_3
- // eq2eq_VRFNetwork_1
- // from_id为设备id,to_id为设备id,主对象obj_type为equipment,从对象obj_type为equipment,
- // eq2eq_ACAirNetwork_1:图类型为ACAirNetwork,边类型为Supply
- // eq2eq_ACAirNetwork_2:图类型为ACAirNetwork,边类型为Return
- // eq2eq_ACAirNetwork_3:图类型为ACAirNetwork,边类型为Discharge
- // eq2eq_ChillWaterLoop_1:图类型为ChillWaterLoop,边类型为Supply
- // eq2eq_ChillWaterLoop_2:图类型为ChillWaterLoop,边类型为Return
- // eq2eq_ChillWaterLoop_3:图类型为ChillWaterLoop,边类型为Bypass
- // eq2eq_ChillWaterLoop_4:图类型为ChillWaterLoop,边类型为Fill
- // eq2eq_CoolingWaterLoop_1:图类型为CoolingWaterLoop,边类型为Supply
- // eq2eq_CoolingWaterLoop_2:图类型为CoolingWaterLoop,边类型为Return
- // eq2eq_CoolingWaterLoop_3:图类型为CoolingWaterLoop,边类型为Bypass
- // eq2eq_CoolingWaterLoop_4:图类型为CoolingWaterLoop,边类型为Fill
- // eq2eq_CondWaterNetwork_1:图类型为CondWaterNetwork,边类型为Discharge
- // eq2eqFreshAirNetwork_1:图类型为FreshAirNetwork,边类型为Fresh
- // eq2eq_HeatWaterLoop_1:图类型为HeatWaterLoop,边类型为Supply
- // eq2eq_HeatWaterLoop_2:图类型为HeatWaterLoop,边类型为Return
- // eq2eq_HeatWaterLoop_3:图类型为HeatWaterLoop,边类型为Bypass
- // eq2eq_HeatWaterLoop_4:图类型为HeatWaterLoop,边类型为Fill
- // eq2eq_VentNetwork_1:图类型为VentNetwork,边类型为Supply
- // eq2eq_VentNetwork_2:图类型为VentNetwork,边类型为Discharge
- // eq2eq_VentNetwork_3:图类型为VentNetwork,边类型为Uncertain
- // eq2eq_VRFNetwork_1:图类型为VRFNetwork,边类型为SupplyReturn
- // ******
- // 从对象查询排除主对象id
- // eq2eq_SupplyWaterNetwork_1,eq2eq_SupplyWaterNetwork_2
- // eq2eq_DrainingWaterNetwork_1,eq2eq_DrainingWaterNetwork_2
- // eq2eq_DrinkingWaterNetwork_1,eq2eq_DrinkingWaterNetwork_2
- // eq2eq_DHWNetwork_1,eq2eq_DHWNetwork_2
- // eq2eq_GasNetwork_1,eq2eq_GasNetwork_2
- // eq2eq_FireWaterNetwork_1,eq2eq_FireWaterNetwork_2
- // eq2eq_FireVentNetwork_1
- // eq2eq_RecycleWaterNetwork_1,eq2eq_RecycleWaterNetwork_2
- // from_id为设备id,to_id为设备id,主对象obj_type为equipment,从对象obj_type为equipment,
- // eq2eq_SupplyWaterNetwork_1:图类型为SupplyWaterNetwork,边类型为Supply
- // eq2eq_SupplyWaterNetwork_2:图类型为SupplyWaterNetwork,边类型为Bypass
- // eq2eq_DrainingWaterNetwork_1:图类型为DrainingWaterNetwork,边类型为Discharge
- // eq2eq_DrainingWaterNetwork_2:图类型为DrainingWaterNetwork,边类型为Bypass
- // eq2eq_DrinkingWaterNetwork_1:图类型为DrinkingWaterNetwork,边类型为Supply
- // eq2eq_DrinkingWaterNetwork_2:图类型为DrinkingWaterNetwork,边类型为Bypass
- // eq2eq_DHWNetwork_1:图类型为DHWNetwork,边类型为Supply
- // eq2eq_DHWNetwork_2:图类型为DHWNetwork,边类型为Bypass
- // eq2eq_GasNetwork_1:图类型为GasNetwork,边类型为Supply
- // eq2eq_GasNetwork_2:图类型为GasNetwork,边类型为Bypass
- // eq2eq_FireWaterNetwork_1:图类型为FireWaterNetwork,边类型为Supply
- // eq2eq_FireWaterNetwork_2:图类型为FireWaterNetwork,边类型为Bypass
- // eq2eq_FireVentNetwork_1:图类型为FireVentNetwork,边类型为Discharge
- // eq2eq_RecycleWaterNetwork_1:图类型为RecycleWaterNetwork,边类型为Supply
- // eq2eq_RecycleWaterNetwork_2:图类型为RecycleWaterNetwork,边类型为Bypass
- // ******
- // eq2eq_SensorNetwork_1,eq2eq_ControlRelation_1,eq2eq_ValveRelationship_vv2eq,eq2eq_ControlEquipNetwork
- // 从对象查询排除主对象id
- // from_id为设备id,to_id为设备id,主对象obj_type为equipment,从对象obj_type为equipment,
- // eq2eq_SensorNetwork_1:图类型为SensorNetwork,边类型为Normal
- // eq2eq_ControlRelation_1:图类型为ControlRelation,边类型为MechCtrl
- // eq2eq_ValveRelationship_vv2eq:图类型为ValveRelationship,边类型为Vv2Eq
- // eq2eq_ControlEquipNetwork:图类型为ControlEquipNetwork,边类型为Normal
- // ******
- // eq2eq_SensorRelationship_ss2eq
- // 从对象查询排除主对象id
- // 传感器类型检查
- // eq2eq_SensorRelationship_ss2eq:图类型为SensorRelationship,边类型为Ss2Eq
- // *****
- // eq2sy_ControlRelation_2,eq2sy_ValveRelationship_vv2sy
- // eq2sy_ControlRelation_2:图类型为ControlRelation,边类型为SyCtrl
- // eq2sy_ValveRelationship_vv2sy:图类型为ValveRelationship,边类型为Vv2Sy
- // *****
- // eq2sy_SensorRelationship_ss2sy
- // 传感器类型检查
- // eq2sy_SensorRelationship_ss2sy:图类型为SensorRelationship,边类型为Ss2Sy
- // *****
- // eq2sp_SensorRelationship_ss2sp
- // 传感器类型检查
- // eq2sp_SensorRelationship_ss2sp:图类型为SensorRelationship,边类型为Ss2Sp
- // *****
- // eq2sp_x
- // bd2bd_ArchForArch,bd2fl_ArchForArch,bd2sh_ArchForArch,bd2sp_ArchForArch,fl2bd_ArchForArch,fl2fl_ArchForArch
- // fl2sh_ArchForArch,fl2sp_ArchForArch,sh2bd_ArchForArch,sh2fl_ArchForArch,sh2sh_ArchForArch,sh2sp_ArchForArch
- // sp2bd_ArchForArch,sp2fl_ArchForArch,sp2sh_ArchForArch,sp2sp_ArchForArch
- return null;
- }
- }
|