|
|
@@ -7,6 +7,7 @@ import com.kym.common.annotation.DynamicCache;
|
|
|
import com.kym.common.enums.EnPlusApi;
|
|
|
import com.kym.common.utils.AESUtil;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
|
+import com.kym.entity.admin.ConnectorInfo;
|
|
|
import com.kym.entity.admin.EquipmentInfo;
|
|
|
import com.kym.entity.admin.Station;
|
|
|
import com.kym.entity.admin.vo.StationVo;
|
|
|
@@ -14,6 +15,7 @@ import com.kym.entity.enplus.EnEquipmentInfo;
|
|
|
import com.kym.entity.enplus.EnStationStatsInfo;
|
|
|
import com.kym.entity.enplus.EnStationStatusInfo;
|
|
|
import com.kym.mapper.admin.StationMapper;
|
|
|
+import com.kym.service.admin.ConnectorInfoService;
|
|
|
import com.kym.service.admin.EquipmentInfoService;
|
|
|
import com.kym.service.admin.StationService;
|
|
|
import com.kym.service.cache.KymCache;
|
|
|
@@ -40,14 +42,16 @@ import java.util.List;
|
|
|
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements StationService {
|
|
|
|
|
|
private final KymCache kymCache;
|
|
|
- private final EquipmentInfoService equipmentInfoService;
|
|
|
private final EnPlusService enPlusService;
|
|
|
+ private final EquipmentInfoService equipmentInfoService;
|
|
|
+ private final ConnectorInfoService connectorInfoService;
|
|
|
|
|
|
|
|
|
- public StationServiceImpl(@Lazy KymCache kymCache, EnPlusService enPlusService, EquipmentInfoService equipmentInfoService) {
|
|
|
+ public StationServiceImpl(@Lazy KymCache kymCache, EnPlusService enPlusService, EquipmentInfoService equipmentInfoService, ConnectorInfoService connectorInfoService) {
|
|
|
this.kymCache = kymCache;
|
|
|
this.enPlusService = enPlusService;
|
|
|
this.equipmentInfoService = equipmentInfoService;
|
|
|
+ this.connectorInfoService = connectorInfoService;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -124,15 +128,26 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, Station> impl
|
|
|
var stationVoList = queryStationInfo(1, 1000);
|
|
|
var stationList = new ArrayList<Station>();
|
|
|
var equipmentList = new ArrayList<EquipmentInfo>();
|
|
|
+ var connectorList = new ArrayList<ConnectorInfo>();
|
|
|
stationVoList.forEach(vo -> {
|
|
|
if (!vo.getEquipmentInfos().isEmpty()) {
|
|
|
vo.getEquipmentInfos().forEach(item -> {
|
|
|
+ // 桩体
|
|
|
var equipment = new EquipmentInfo()
|
|
|
.setStationId(vo.getStationId())
|
|
|
.setShortId(item.getShortId())
|
|
|
.setPower(item.getConnectorInfos().get(0).getPower());
|
|
|
BeanUtils.copyProperties(item, equipment);
|
|
|
equipmentList.add(equipment);
|
|
|
+ // 枪
|
|
|
+ var connectorInfos = item.getConnectorInfos();
|
|
|
+ if (!CommUtil.isEmptyOrNull(connectorInfos)) {
|
|
|
+ connectorInfos.forEach(connector -> {
|
|
|
+ var connectorInfo = new ConnectorInfo();
|
|
|
+ BeanUtils.copyProperties(connector, connectorInfo);
|
|
|
+ connectorList.add(connectorInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
equipmentList.sort(Comparator.comparing(EquipmentInfo::getShortId));
|
|
|
}
|
|
|
@@ -143,8 +158,10 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, Station> impl
|
|
|
// 查询已存在的站点,只更新新增的站点和设备
|
|
|
var stations = list().stream().map(Station::getStationId).toList();
|
|
|
var equipments = equipmentInfoService.list().stream().map(EquipmentInfo::getEquipmentId).toList();
|
|
|
+ var connectors = connectorInfoService.list().stream().map(ConnectorInfo::getConnectorId).toList();
|
|
|
saveBatch(stationList.stream().filter(station -> !stations.contains(station.getStationId())).toList());
|
|
|
equipmentInfoService.saveBatch(equipmentList.stream().filter(equipmentInfo -> !equipments.contains(equipmentInfo.getEquipmentId())).toList());
|
|
|
+ connectorInfoService.saveBatch(connectorList.stream().filter(connector -> !connectors.contains(connector.getConnectorId())).toList());
|
|
|
}
|
|
|
|
|
|
@Override
|