update 修改充电桩别名

This commit is contained in:
Lemon
2023-08-08 15:54:53 +08:00
parent ae05198fdb
commit 6d67dd212c
9 changed files with 83 additions and 3 deletions

View File

@@ -12,6 +12,8 @@ import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.PileConnectorInfo;
@@ -150,10 +152,23 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
@Override
public int updatePileBasicInfo(PileBasicInfo pileBasicInfo) {
// pileBasicInfo.setUpdateBy(SecurityUtils.getUsername());
Long stationId = pileBasicInfo.getStationId();
// 清缓存
cleanRedisCache(pileBasicInfo.getSn());
pileBasicInfo.setUpdateTime(DateUtils.getNowDate());
redisCache.deleteObject(CacheConstants.GET_PILE_LIST_BY_STATION_ID + pileBasicInfo.getStationId());
// 判断是否修改别名
if (StringUtils.isNotBlank(pileBasicInfo.getName())) {
// 先查询该别名在该站点下是否有用过
PileBasicInfo info = new PileBasicInfo();
info.setName(pileBasicInfo.getName());
info.setStationId(stationId);
List<PileBasicInfo> pileBasicInfos = selectPileBasicInfoList(info);
if (CollectionUtils.isNotEmpty(pileBasicInfos)) {
// 已有重复别名
throw new BusinessException(ReturnCodeEnum.CODE_THIS_NAME_HAS_BEEN_USED);
}
}
redisCache.deleteObject(CacheConstants.GET_PILE_LIST_BY_STATION_ID + stationId);
return pileBasicInfoMapper.updatePileBasicInfo(pileBasicInfo);
}
@@ -709,11 +724,14 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
List<PileConnectorInfoVO> connectorInfoVOList = pileConnectorInfoService.selectConnectorListByStationId(Long.parseLong(stationId));
// 根据pileSn分组
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream().collect(Collectors.groupingBy(PileConnectorInfoVO::getPileSn));
// 根据桩别名分组
// Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream().collect(Collectors.groupingBy(PileConnectorInfoVO::getName));
for (Map.Entry<String, List<PileConnectorInfoVO>> entry : collect.entrySet()) {
vo = new GroundLockInfoVO();
lockInfoList = new ArrayList<>();
String pileSn = entry.getKey();
// String pileName = entry.getKey();
List<PileConnectorInfoVO> list = entry.getValue();
for (PileConnectorInfoVO pileConnectorInfoVO : list) {
// 查地锁缓存状态,有缓存说明有地锁信息
@@ -737,6 +755,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
.build());
}
vo.setPileSn(pileSn);
// vo.setName(pileName);
vo.setLockInfos(lockInfoList);
resultList.add(vo);

View File

@@ -23,6 +23,11 @@ public class GroundLockInfoVO {
*/
private String pileSn;
/**
* 桩别名
*/
private String name;
/**
* 地锁List
*/

View File

@@ -70,6 +70,11 @@ public class PileConnectorInfoVO {
*/
private String pileSn;
/**
* 充电桩别名
*/
private String name;
/**
* 类型
* 1-直流接口 汽车桩+快充

View File

@@ -23,6 +23,11 @@ public class PileDetailVO {
*/
private String pileSn;
/**
* 桩类型1-运营桩2-个人桩)
*/
private String businessType;
/**
* 别名
*/