mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
This commit is contained in:
@@ -128,4 +128,11 @@ public interface PileConnectorInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
PileConnectorInfoVO getConnectorInfoByParams(@Param("dto") QueryConnectorInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 通过站点idList查询枪口列表信息
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
List<ConnectorInfoVO> batchSelectConnectorList(@Param("stationIds") List<String> stationIds);
|
||||
}
|
||||
|
||||
@@ -37,4 +37,11 @@ public interface PileReservationInfoMapper {
|
||||
PileReservationInfo selectByPileConnectorCode(String pileConnectorCode);
|
||||
|
||||
PileReservationInfo selectByPileSn(String pileSn);
|
||||
|
||||
/**
|
||||
* 根据桩编号删除预约记录
|
||||
* @param pileSn
|
||||
* @return
|
||||
*/
|
||||
int deleteByPileSn(String pileSn);
|
||||
}
|
||||
@@ -114,6 +114,13 @@ public interface PileConnectorInfoService {
|
||||
|
||||
List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId);
|
||||
|
||||
/**
|
||||
* 根据站点idList批量查询枪口数据
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
List<ConnectorInfoVO> batchSelectConnectorList(List<String> stationIds);
|
||||
|
||||
List<ConnectorInfoVO> selectConnectorInfoList(String pileSn);
|
||||
|
||||
PageResponse selectStationConnectorList(QueryConnectorListDTO dto);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
import com.jsowell.pile.dto.CreateReservedDTO;
|
||||
import com.jsowell.pile.dto.PersonPileStopChargingDTO;
|
||||
import com.jsowell.pile.dto.PileReservationDTO;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
import com.jsowell.pile.vo.PileReservationInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PileReservationInfoService {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
@@ -77,5 +77,11 @@ public interface PileReservationInfoService {
|
||||
void initPersonalPileReservation(String pileConnectorCode);
|
||||
|
||||
void initPersonalPileReservation(String pileSn, String connectorCode);
|
||||
|
||||
/**
|
||||
* 根据pileSn删除预约记录
|
||||
* @param pileSn
|
||||
*/
|
||||
void deleteReservationByPileSn(String pileSn);
|
||||
}
|
||||
|
||||
|
||||
@@ -1112,10 +1112,12 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
|
||||
equipmentInfo.setEquipmentID(pileSn);
|
||||
equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN);
|
||||
equipmentInfo.setManufacturerName(Constants.MANUFACTURER_NAME);
|
||||
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime()));
|
||||
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType()));
|
||||
equipmentInfo.setEquipmentModel(modelInfo.getModelName());
|
||||
|
||||
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
|
||||
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn));
|
||||
|
||||
@@ -46,10 +46,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -484,10 +481,70 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId) {
|
||||
return getUniAppConnectorList(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询枪口列表
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ConnectorInfoVO> batchSelectConnectorList(List<String> stationIds){
|
||||
List<ConnectorInfoVO> resultList = new ArrayList<>();
|
||||
Map<String, List<ConnectorInfoVO>> map = new LinkedHashMap<>();
|
||||
String baseRedisKey = CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID;
|
||||
// 先查询缓存数据
|
||||
for (String stationId : stationIds) {
|
||||
String redisKey = baseRedisKey + stationId;
|
||||
List<ConnectorInfoVO> list = redisCache.getCacheList(redisKey);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
map.put(stationId, list);
|
||||
// 重新设置缓存
|
||||
redisCache.deleteObject(redisKey);
|
||||
redisCache.setCacheList(redisKey, list);
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h);
|
||||
}
|
||||
}
|
||||
// 先将已经有数据的stationId进行收集
|
||||
List<String> hasDataStationIds = new ArrayList<>(map.keySet());
|
||||
List<List<ConnectorInfoVO>> values = new ArrayList<>(map.values());
|
||||
// 筛选出没有数据的stationIds
|
||||
List<String> noDataStationIds = stationIds.stream()
|
||||
.filter(x -> !hasDataStationIds.contains(x))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(noDataStationIds)) {
|
||||
// 重新查询数据库
|
||||
// 通过stationIds批量查询数据库
|
||||
List<ConnectorInfoVO> newConnectorInfoList = pileConnectorInfoMapper.batchSelectConnectorList(noDataStationIds);
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
values = Lists.newArrayList();
|
||||
}
|
||||
values.add(newConnectorInfoList);
|
||||
|
||||
// 设置缓存
|
||||
// 先将list根据站点id分组
|
||||
Map<String, List<ConnectorInfoVO>> collect = newConnectorInfoList.stream()
|
||||
.collect(Collectors.groupingBy(ConnectorInfoVO::getStationId));
|
||||
// 循环map并设置缓存
|
||||
for (Map.Entry<String, List<ConnectorInfoVO>> entry : collect.entrySet()) {
|
||||
String stationId = entry.getKey();
|
||||
List<ConnectorInfoVO> voList = entry.getValue();
|
||||
|
||||
String redisKey = baseRedisKey + stationId;
|
||||
redisCache.setCacheList(redisKey, voList);
|
||||
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h);
|
||||
}
|
||||
}
|
||||
|
||||
// 最终将 values 中的所有 ConnectorInfoVO 元素收集到 resultList
|
||||
values.forEach(resultList::addAll);
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConnectorInfoVO> selectConnectorInfoList(String pileSn) {
|
||||
// log.info("查询充电枪口详情-selectConnectorInfoList, param:{}", pileSn);
|
||||
|
||||
@@ -615,5 +615,10 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
String pileConnectorCode = pileSn + connectorCode;
|
||||
this.initPersonalPileReservation(pileConnectorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReservationByPileSn(String pileSn) {
|
||||
pileReservationInfoMapper.deleteByPileSn(pileSn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,12 @@ public class EquipmentInfo {
|
||||
@JSONField(name = "ManufacturerID")
|
||||
private String manufacturerID;
|
||||
|
||||
/**
|
||||
* 设备生产商名称
|
||||
*/
|
||||
@JSONField(name = "ManufacturerName")
|
||||
private String manufacturerName;
|
||||
|
||||
/**
|
||||
* 设备型号 N
|
||||
* 由设备生厂商定义的设备型号
|
||||
|
||||
Reference in New Issue
Block a user