mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-06 19:10:20 +08:00
update 修改充电桩别名
This commit is contained in:
@@ -6,6 +6,8 @@ import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.core.page.TableDataInfo;
|
||||
import com.jsowell.common.enums.BusinessType;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
@@ -112,6 +114,28 @@ public class PileBasicInfoController extends BaseController {
|
||||
return toAjax(pileBasicInfoService.updatePileBasicInfo(pileBasicInfo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改桩别名
|
||||
* @param pileBasicInfo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updatePileName")
|
||||
public RestApiResponse<?> updatePileName(@RequestBody PileBasicInfo pileBasicInfo) {
|
||||
logger.info("修改桩别名 params:{}", JSONObject.toJSONString(pileBasicInfo));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileBasicInfoService.updatePileBasicInfo(pileBasicInfo);
|
||||
response = new RestApiResponse<>(i);
|
||||
} catch (BusinessException e) {
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("修改桩别名 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备管理
|
||||
*/
|
||||
|
||||
@@ -108,6 +108,8 @@ public enum ReturnCodeEnum {
|
||||
|
||||
CODE_OPEN_ID_IS_NULL_ERROR("00100050", "获取openId失败"),
|
||||
|
||||
CODE_THIS_NAME_HAS_BEEN_USED("00100051", "此站点已有该别名,请重新设置"),
|
||||
|
||||
/* 个人桩 start */
|
||||
|
||||
CODE_PILE_HAS_BEEN_BINDING_ERROR("00400001", "此桩已被绑定,请联系管理员!"),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -23,6 +23,11 @@ public class GroundLockInfoVO {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 桩别名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 地锁List
|
||||
*/
|
||||
|
||||
@@ -70,6 +70,11 @@ public class PileConnectorInfoVO {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩别名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
* 1-直流接口 汽车桩+快充
|
||||
|
||||
@@ -23,6 +23,11 @@ public class PileDetailVO {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 桩类型(1-运营桩;2-个人桩)
|
||||
*/
|
||||
private String businessType;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
|
||||
@@ -150,6 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT
|
||||
t1.id as pileId,
|
||||
t1.sn as pileSn,
|
||||
t1.business_type as businessType,
|
||||
t1.station_id AS stationId,
|
||||
t3.station_name as stationName,
|
||||
t1.sim_id,
|
||||
|
||||
@@ -86,3 +86,12 @@ export function getPileFeedList(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改桩别名
|
||||
export function updatePileName(data) {
|
||||
return request({
|
||||
url: '/pile/basic/updatePileName',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ import remoteUpgrade from './components/remoteUpgrade.vue';
|
||||
import {
|
||||
getPileDetailById,
|
||||
getPileFeedList,
|
||||
listBasic, updateBasic,
|
||||
listBasic, updateBasic, updatePileName,
|
||||
} from "@/api/pile/basic";
|
||||
import {queryConnectorListByParams} from "@/api/pile/connector";
|
||||
// 二维码组件
|
||||
@@ -276,6 +276,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
clearableFlag: true,
|
||||
resCode: null,
|
||||
msg: null,
|
||||
pileDetailLoading: false,
|
||||
pileListLoading: false,
|
||||
pileId: this.$route.params.pileId,
|
||||
@@ -389,8 +391,16 @@ export default {
|
||||
stationId: this.pileDetail.stationId
|
||||
}
|
||||
console.log("params", params)
|
||||
updateBasic(params).then((response) => {
|
||||
updatePileName(params).then((response) => {
|
||||
console.log("response", response)
|
||||
this.resCode = response.resCode;
|
||||
this.msg = response.msg
|
||||
if (this.resCode !== '00100000') {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: this.msg,
|
||||
});
|
||||
}
|
||||
this.clearableFlag = true;
|
||||
this.getPileDetail();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user