|
|
@@ -11,6 +11,7 @@ import com.kym.entity.enplus.EnStationStatusInfo;
|
|
|
import com.kym.mapper.admin.StationMapper;
|
|
|
import com.kym.service.admin.StationService;
|
|
|
import com.kym.service.enplus.EnPlusService;
|
|
|
+import com.kym.service.utils.KymCache;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -32,6 +33,9 @@ import java.util.List;
|
|
|
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements StationService {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(StationServiceImpl.class);
|
|
|
+ @Autowired
|
|
|
+ private KymCache kymCache;
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
|
private EnPlusService enPlusService;
|
|
|
@@ -47,7 +51,9 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, Station> impl
|
|
|
""".formatted(pageNum, pageSize);
|
|
|
var response = enPlusService.enPlusPost(EnPlusApi.EN_PLUS_QUERY_STATION_INFO.getApi(), enPlusService.buildParams(param));
|
|
|
var enStations = JSONObject.parseObject(AESUtil.decrypt(response.getData()));
|
|
|
- return enStations.getJSONArray("StationInfos").toJavaList(Station.class);
|
|
|
+ var stationList = enStations.getJSONArray("StationInfos").toJavaList(Station.class);
|
|
|
+ stationList.forEach(station -> station.getEquipmentInfos().forEach(enEquipmentInfo -> enEquipmentInfo.getConnectorInfos().forEach(connector -> connector.setShortId(kymCache.getShortId(enEquipmentInfo.getEquipmentId())))));
|
|
|
+ return stationList;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -84,7 +90,7 @@ public class StationServiceImpl extends ServiceImpl<StationMapper, Station> impl
|
|
|
""".formatted(stationId, startTime, endTime);
|
|
|
var response = enPlusService.enPlusPost(EnPlusApi.EN_PLUS_QUERY_STATION_STATS.getApi(), enPlusService.buildParams(param));
|
|
|
// TODO: 2023-08-12 包装成自己的数据格式
|
|
|
- var enStationStats = JSONObject.parseObject(AESUtil.decrypt(response.getData()));
|
|
|
+ var enStationStats = JSONObject.parseObject(AESUtil.decrypt(response.getData()));
|
|
|
return enStationStats.getJSONObject("StationStats").toJavaObject(EnStationStatsInfo.class);
|
|
|
}
|
|
|
|