|
@@ -7,8 +7,10 @@ import com.zsElectric.boot.business.mapper.BannerInfoMapper;
|
|
|
import com.zsElectric.boot.business.mapper.ThirdPartyStationInfoMapper;
|
|
import com.zsElectric.boot.business.mapper.ThirdPartyStationInfoMapper;
|
|
|
import com.zsElectric.boot.business.mapper.UserFirmMapper;
|
|
import com.zsElectric.boot.business.mapper.UserFirmMapper;
|
|
|
import com.zsElectric.boot.charging.entity.ThirdPartyConnectorInfo;
|
|
import com.zsElectric.boot.charging.entity.ThirdPartyConnectorInfo;
|
|
|
|
|
+import com.zsElectric.boot.charging.entity.ThirdPartyEquipmentInfo;
|
|
|
import com.zsElectric.boot.charging.mapper.ThirdPartyConnectorInfoMapper;
|
|
import com.zsElectric.boot.charging.mapper.ThirdPartyConnectorInfoMapper;
|
|
|
import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
|
|
import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
|
|
|
|
|
+import com.zsElectric.boot.business.mapper.ThirdPartyEquipmentInfoMapper;
|
|
|
import com.zsElectric.boot.business.model.entity.BannerInfo;
|
|
import com.zsElectric.boot.business.model.entity.BannerInfo;
|
|
|
import com.zsElectric.boot.business.model.entity.UserFirm;
|
|
import com.zsElectric.boot.business.model.entity.UserFirm;
|
|
|
import com.zsElectric.boot.business.model.query.StationInfoQuery;
|
|
import com.zsElectric.boot.business.model.query.StationInfoQuery;
|
|
@@ -41,6 +43,7 @@ public class AppletHomeServiceImpl implements AppletHomeService {
|
|
|
private final BannerInfoMapper bannerInfoMapper;
|
|
private final BannerInfoMapper bannerInfoMapper;
|
|
|
private final BannerInfoConverter bannerInfoConverter;
|
|
private final BannerInfoConverter bannerInfoConverter;
|
|
|
private final ThirdPartyConnectorInfoMapper thirdPartyConnectorInfoMapper;
|
|
private final ThirdPartyConnectorInfoMapper thirdPartyConnectorInfoMapper;
|
|
|
|
|
+ private final ThirdPartyEquipmentInfoMapper thirdPartyEquipmentInfoMapper;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 时间格式化器 HHmmss
|
|
* 时间格式化器 HHmmss
|
|
@@ -153,12 +156,32 @@ public class AppletHomeServiceImpl implements AppletHomeService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 查询充电终端列表
|
|
|
|
|
- List<ThirdPartyConnectorInfo> connectorList = thirdPartyConnectorInfoMapper.selectList(
|
|
|
|
|
- new LambdaQueryWrapper<ThirdPartyConnectorInfo>()
|
|
|
|
|
- .eq(ThirdPartyConnectorInfo::getStationId, stationInfo.getStationId())
|
|
|
|
|
|
|
+ // 根据站点stationId查询设备列表(third_party_equipment_info)
|
|
|
|
|
+ List<ThirdPartyEquipmentInfo> equipmentList = thirdPartyEquipmentInfoMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<ThirdPartyEquipmentInfo>()
|
|
|
|
|
+ .eq(ThirdPartyEquipmentInfo::getStationId, stationInfo.getStationId())
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+ // 构建设备ID到设备类型的映射
|
|
|
|
|
+ Map<String, Integer> equipmentTypeMap = equipmentList.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ ThirdPartyEquipmentInfo::getEquipmentId,
|
|
|
|
|
+ e -> e.getEquipmentType() != null ? e.getEquipmentType() : 0,
|
|
|
|
|
+ (v1, v2) -> v1
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ // 根据设备列表的equipmentId查询充电接口信息(third_party_connector_info)
|
|
|
|
|
+ List<ThirdPartyConnectorInfo> connectorList = new ArrayList<>();
|
|
|
|
|
+ if (!equipmentList.isEmpty()) {
|
|
|
|
|
+ List<String> equipmentIds = equipmentList.stream()
|
|
|
|
|
+ .map(ThirdPartyEquipmentInfo::getEquipmentId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ connectorList = thirdPartyConnectorInfoMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<ThirdPartyConnectorInfo>()
|
|
|
|
|
+ .in(ThirdPartyConnectorInfo::getEquipmentId, equipmentIds)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 统计终端状态
|
|
// 统计终端状态
|
|
|
int idleCount = 0;
|
|
int idleCount = 0;
|
|
|
int occupiedCount = 0;
|
|
int occupiedCount = 0;
|
|
@@ -171,20 +194,69 @@ public class AppletHomeServiceImpl implements AppletHomeService {
|
|
|
vo.setConnectorName(connector.getConnectorName());
|
|
vo.setConnectorName(connector.getConnectorName());
|
|
|
vo.setConnectorCode(connector.getConnectorId());
|
|
vo.setConnectorCode(connector.getConnectorId());
|
|
|
|
|
|
|
|
- // 设备分类:根据接口类型判断
|
|
|
|
|
- Integer connectorType = connector.getConnectorType();
|
|
|
|
|
- if (connectorType != null) {
|
|
|
|
|
- if (connectorType == 1 || connectorType == 2 || connectorType == 5) {
|
|
|
|
|
- vo.setEquipmentType("直流设备");
|
|
|
|
|
- } else {
|
|
|
|
|
- vo.setEquipmentType("交流设备");
|
|
|
|
|
|
|
+ // 设备分类:从设备表获取设备类型(1-直流设备,2-交流设备,3-交直流一体设备,4-无线设备,5-其他)
|
|
|
|
|
+ Integer equipmentType = equipmentTypeMap.get(connector.getEquipmentId());
|
|
|
|
|
+ if (equipmentType != null) {
|
|
|
|
|
+ switch (equipmentType) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ vo.setEquipmentType("直流设备");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ vo.setEquipmentType("交流设备");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ vo.setEquipmentType("交直流一体设备");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ vo.setEquipmentType("无线设备");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ vo.setEquipmentType("其他");
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ vo.setEquipmentType("未知");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // TODO: 实际状态需要从实时数据获取,这里暂时默认为空闲
|
|
|
|
|
- vo.setStatus(1);
|
|
|
|
|
- vo.setStatusName("空闲");
|
|
|
|
|
- idleCount++;
|
|
|
|
|
|
|
+ // 从充电接口表获取实际状态
|
|
|
|
|
+ // 0-离网,1-空闲,2-占用(未充电),3-占用(充电中),4-占用(预约锁定),255-故障
|
|
|
|
|
+ Integer connectorStatus = connector.getStatus();
|
|
|
|
|
+ if (connectorStatus == null) {
|
|
|
|
|
+ // 默认为离网
|
|
|
|
|
+ connectorStatus = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setStatus(connectorStatus);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置状态名称并统计
|
|
|
|
|
+ switch (connectorStatus) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ vo.setStatusName("离网");
|
|
|
|
|
+ offlineCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ vo.setStatusName("空闲");
|
|
|
|
|
+ idleCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ vo.setStatusName("占用(未充电)");
|
|
|
|
|
+ occupiedCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ vo.setStatusName("占用(充电中)");
|
|
|
|
|
+ occupiedCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ vo.setStatusName("占用(预约锁定)");
|
|
|
|
|
+ occupiedCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 255:
|
|
|
|
|
+ vo.setStatusName("故障");
|
|
|
|
|
+ offlineCount++;
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ vo.setStatusName("未知");
|
|
|
|
|
+ offlineCount++;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
connectorVOList.add(vo);
|
|
connectorVOList.add(vo);
|
|
|
}
|
|
}
|