|
|
|
@ -39,11 +39,7 @@ import com.inspect.base.core.utils.xml.GenXmlByBean; |
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
|
@ -148,8 +144,12 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
} |
|
|
|
|
|
|
|
public String superSystemSynPatrolPointModel() { |
|
|
|
logger.info("[META] superSystemSynPatrolPointModel"); |
|
|
|
List<BasedataStation> stations = this.basedataStationMapper.selectBasedataStationList(new BasedataStation()); |
|
|
|
String stationNo = stations.get(0).getStationNo(); |
|
|
|
if ("lingzhouzhiliu".equals(stationNo)) { |
|
|
|
stationNo = "1cc010d8a78a598ccb52fb470301531cbff88e26c5"; |
|
|
|
} |
|
|
|
String modelXml = this.getModelXml(new BasedataPatrolPoint()); |
|
|
|
System.out.println("modelXml::" + modelXml); |
|
|
|
if (null != modelXml && !modelXml.isEmpty()) { |
|
|
|
@ -205,40 +205,50 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
List<BasedataStation> stations = this.basedataStationMapper.selectBasedataStationList(new BasedataStation()); |
|
|
|
if (null != stations && !stations.isEmpty()) { |
|
|
|
station_id = stations.get(0).getStationNo(); |
|
|
|
// 灵州站编码 |
|
|
|
if ("lingzhouzhiliu".equals(station_id)) { |
|
|
|
station_id = "1cc010d8a78a598ccb52fb470301531cbff88e26c5"; |
|
|
|
} |
|
|
|
station_name = stations.get(0).getStationName(); |
|
|
|
} |
|
|
|
|
|
|
|
for (BasedataPatrolPoint patrolPoint : list) { |
|
|
|
Set<String> hashSet = new HashSet<>(); |
|
|
|
DevicePointModelItem modelItem = new DevicePointModelItem(); |
|
|
|
String main_device_name = null; |
|
|
|
String main_device_id = null; |
|
|
|
String device_type = null; |
|
|
|
String component_id = null; |
|
|
|
String component_name = null; |
|
|
|
String device_id = patrolPoint.getPatrolPointCode(); |
|
|
|
// String device_id = patrolPoint.getPatrolPointCode(); |
|
|
|
String device_id = patrolPoint.getPatrolPointId() + ""; |
|
|
|
String device_name = patrolPoint.getPatrolPointName(); |
|
|
|
String phase = null; |
|
|
|
String device_info = patrolPoint.getPatrolContent(); |
|
|
|
String bay_id = null; |
|
|
|
String bay_name = null; |
|
|
|
String area_id = null; |
|
|
|
String area_name = null; |
|
|
|
new DevicePointModelItem(); |
|
|
|
Long mainDeviceId = patrolPoint.getMainDeviceId(); |
|
|
|
// 主设备 |
|
|
|
BasedataDevice mainDevice = this.basedataDeviceMapper.selectBasedataDeviceByDeviceId(mainDeviceId); |
|
|
|
Long deviceId; |
|
|
|
if (null != mainDevice) { |
|
|
|
main_device_name = mainDevice.getDeviceName(); |
|
|
|
main_device_id = mainDevice.getDeviceCode(); |
|
|
|
main_device_id = patrolPoint.getMainDeviceId() + ""; |
|
|
|
deviceId = mainDevice.getDeviceTypeId(); |
|
|
|
// 设备类型 |
|
|
|
BasedataDeviceType deviceType = this.basedataDevicetypeMapper.selectBasedataDeviceTypeByDeviceTypeId(deviceId); |
|
|
|
if (null != deviceType) { |
|
|
|
device_type = deviceType.getDeviceTypeCode(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 部件 |
|
|
|
deviceId = patrolPoint.getDeviceId(); |
|
|
|
BasedataDevice componentDevice = this.basedataDeviceMapper.selectBasedataDeviceByDeviceId(deviceId); |
|
|
|
if (null != componentDevice) { |
|
|
|
component_id = componentDevice.getDeviceCode(); |
|
|
|
component_id = patrolPoint.getDeviceId() + ""; |
|
|
|
component_name = componentDevice.getDeviceName(); |
|
|
|
String devicePhase = componentDevice.getPhase(); |
|
|
|
phase = this.handlePhase(devicePhase); |
|
|
|
@ -248,12 +258,44 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
if (null != areaId) { |
|
|
|
BaseDataArea baseDataArea = this.baseDataAreaMapper.selectAreaById(areaId); |
|
|
|
if (null != baseDataArea) { |
|
|
|
area_id = baseDataArea.getAreaCode(); |
|
|
|
area_name = baseDataArea.getAreaName(); |
|
|
|
if ("bayunit".equals(baseDataArea.getAreaType())) { |
|
|
|
bay_id = patrolPoint.getAreaId() + ""; |
|
|
|
// bay_id = baseDataArea.getUpSystemAreaId(); |
|
|
|
bay_name = baseDataArea.getAreaName(); |
|
|
|
// bay_name = baseDataArea.getUpSystemAreaName(); |
|
|
|
BaseDataArea areaPa = this.baseDataAreaMapper.selectAreaById(baseDataArea.getParentId()); |
|
|
|
if (null != areaPa) { |
|
|
|
area_id = areaPa.getAreaId() + ""; |
|
|
|
area_name = areaPa.getAreaName(); |
|
|
|
} else { |
|
|
|
// area_id = baseDataArea.getUpSystemAreaId(); |
|
|
|
// area_name = baseDataArea.getUpSystemAreaName(); |
|
|
|
area_id = patrolPoint.getAreaId() + ""; |
|
|
|
area_name = baseDataArea.getAreaName(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
area_id = patrolPoint.getAreaId() + ""; |
|
|
|
area_name = baseDataArea.getAreaName(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String algSubtypeIds = patrolPoint.getAlgSubtypeIds(); |
|
|
|
if (StringUtils.isNotEmpty(algSubtypeIds)) { |
|
|
|
String[] split = algSubtypeIds.split(","); |
|
|
|
for (String algSubtypeId : split) { |
|
|
|
BasedataAlgSubtype basedataAlgSubtype = basedataAlgSubtypeMapper.selectBasedataAlgSubtypeByAlgSubtypeId(Long.valueOf(algSubtypeId)); |
|
|
|
if (basedataAlgSubtype != null && StringUtils.isNotEmpty(basedataAlgSubtype.getAlgSubtypeName())) { |
|
|
|
if (basedataAlgSubtype.getAlgSubtypeName().contains("读数")) { |
|
|
|
hashSet.add("1"); |
|
|
|
} else if (basedataAlgSubtype.getAlgSubtypeName().contains("红外")) { |
|
|
|
hashSet.add("4"); |
|
|
|
} else { |
|
|
|
hashSet.add("3"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BasedataPatrolPointPreset basedataPatrolpointPreset = new BasedataPatrolPointPreset(); |
|
|
|
basedataPatrolpointPreset.setPatrolPointId(patrolPoint.getPatrolPointId()); |
|
|
|
JSONArray presetJsonArray = this.modelPatrolPointPresetHandle(basedataPatrolpointPreset); |
|
|
|
@ -271,10 +313,10 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
|
|
|
|
modelItem.setStation_name(nullToEmpty(station_name)); |
|
|
|
modelItem.setStation_code(nullToEmpty(station_id)); |
|
|
|
modelItem.setArea_id(nullToEmpty(areaId.toString())); |
|
|
|
modelItem.setArea_id(nullToEmpty(area_id)); |
|
|
|
modelItem.setArea_name(nullToEmpty(area_name)); |
|
|
|
modelItem.setBay_id(nullToEmpty(areaId.toString())); |
|
|
|
modelItem.setBay_name(nullToEmpty(area_name)); |
|
|
|
modelItem.setBay_id(nullToEmpty(bay_id)); |
|
|
|
modelItem.setBay_name(nullToEmpty(bay_name)); |
|
|
|
modelItem.setMain_device_id(nullToEmpty(main_device_id)); |
|
|
|
modelItem.setMain_device_name(nullToEmpty(main_device_name)); |
|
|
|
modelItem.setComponent_id(nullToEmpty(component_id)); |
|
|
|
@ -285,7 +327,7 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
modelItem.setMeter_type(""); |
|
|
|
modelItem.setAppearance_type(""); |
|
|
|
modelItem.setSave_type_list(""); |
|
|
|
modelItem.setRecognition_type_list(nullToEmpty(algSubtypeIds)); |
|
|
|
modelItem.setRecognition_type_list(hashSet.size() == 0 ? "" : StringUtils.join(hashSet, ",")); |
|
|
|
modelItem.setPhase(nullToEmpty(phase)); |
|
|
|
modelItem.setDevice_info(nullToEmpty(device_info)); |
|
|
|
modelItem.setData_type("1"); |
|
|
|
@ -305,7 +347,7 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi |
|
|
|
|
|
|
|
items.add(modelItem); |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("getModelXml items size: {}", items.size()); |
|
|
|
devicePointModel.setItem(items); |
|
|
|
GenXmlByBean<Object> pulseGet = new GenXmlByBean<>(); |
|
|
|
return pulseGet.getXml(devicePointModel); |
|
|
|
|