新增 后管设置桩对应第三方平台编号页面

This commit is contained in:
Lemon
2024-03-11 16:07:20 +08:00
parent c73bc074cd
commit 0cec8f18ce
9 changed files with 244 additions and 4 deletions

View File

@@ -11,12 +11,16 @@ 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;
import com.jsowell.pile.domain.ThirdpartySnRelation;
import com.jsowell.pile.dto.BatchCreatePileDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ReplaceMerchantStationDTO;
import com.jsowell.pile.dto.ThirdPartySnRelationDTO;
import com.jsowell.pile.service.IThirdpartySnRelationService;
import com.jsowell.pile.service.PileBasicInfoService;
import com.jsowell.pile.service.PileMsgRecordService;
import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
import com.jsowell.service.PileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -49,6 +53,10 @@ public class PileBasicInfoController extends BaseController {
@Autowired
private PileMsgRecordService pileMsgRecordService;
@Autowired
private IThirdpartySnRelationService thirdpartySnRelationService;
/**
* 查询设备管理列表
*/
@@ -186,4 +194,35 @@ public class PileBasicInfoController extends BaseController {
return AjaxResult.success(pileMsgRecordService.getPileFeedList(dto));
}
/**
* 查询桩对应的第三方平台桩编号列表
* @param queryPileDTO
* @return
*/
@PostMapping("/getThirdPartySnRelation")
public TableDataInfo getThirdPartySnRelation(@RequestBody QueryPileDTO queryPileDTO) {
List<ThirdPartySnRelationVO> list = thirdpartySnRelationService.getRelationVOList(queryPileDTO);
return getDataTable(list);
}
/**
* 修改第三方平台对应编号
* @param dto
* @return
*/
@PreAuthorize("@ss.hasPermi('pile:basic:edit')")
@PostMapping("/updateThirdPartySnRelation")
public RestApiResponse<?> updateThirdPartySnRelation(@RequestBody ThirdPartySnRelationDTO dto) {
logger.info("修改第三方平台对应编号 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
int i = thirdpartySnRelationService.updateThirdPartySnRelation(dto);
response = new RestApiResponse<>(i);
} catch (Exception e) {
response = new RestApiResponse<>(e);
}
logger.info("修改第三方平台对应编号 result:{}", response);
return response;
}
}

View File

@@ -0,0 +1,21 @@
package com.jsowell.pile.dto;
import lombok.Data;
/**
* 第三方平台对应sn编号相关DTO
*
* @author Lemon
* @Date 2024/3/11 14:24:06
*/
@Data
public class ThirdPartySnRelationDTO {
// 桩编号
private String pileSn;
// 第三方平台类型
private String thirdPartyType;
// 第三方平台对应的sn
private String thirdPartySn;
}

View File

@@ -3,6 +3,10 @@ package com.jsowell.pile.mapper;
import java.util.List;
import com.jsowell.pile.domain.ThirdpartySnRelation;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ThirdPartySnRelationDTO;
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
/**
@@ -60,4 +64,18 @@ public interface ThirdpartySnRelationMapper {
* @return 结果
*/
public int deleteThirdpartySnRelationByIds(Long[] ids);
/**
* 查询第三方平台桩编号对应的列表
* @param queryPileDTO
* @return
*/
List<ThirdPartySnRelationVO> getRelationVOList(@Param("dto") QueryPileDTO queryPileDTO);
/**
* 修改第三方平台对应编号
* @param dto
* @return
*/
int updateThirdPartySnRelation(@Param("dto") ThirdPartySnRelationDTO dto);
}

View File

@@ -3,6 +3,9 @@ package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.ThirdpartySnRelation;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ThirdPartySnRelationDTO;
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
/**
* 万车充--第三方平台桩编号对应关系Service接口
@@ -58,4 +61,18 @@ public interface IThirdpartySnRelationService {
* @return 结果
*/
public int deleteThirdpartySnRelationById(Long id);
/**
* 查询第三方平台桩编号对应的列表
* @param queryPileDTO
* @return
*/
List<ThirdPartySnRelationVO> getRelationVOList(QueryPileDTO queryPileDTO);
/**
* 修改第三方平台对应编号
* @param dto
* @return
*/
int updateThirdPartySnRelation(ThirdPartySnRelationDTO dto);
}

View File

@@ -2,7 +2,11 @@ package com.jsowell.pile.service.impl;
import java.util.List;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ThirdPartySnRelationDTO;
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jsowell.pile.mapper.ThirdpartySnRelationMapper;
@@ -87,4 +91,31 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer
public int deleteThirdpartySnRelationById(Long id) {
return thirdpartySnRelationMapper.deleteThirdpartySnRelationById(id);
}
/**
* 查询第三方平台桩编号对应的列表
* @param queryPileDTO
* @return
*/
@Override
public List<ThirdPartySnRelationVO> getRelationVOList(QueryPileDTO queryPileDTO) {
List<ThirdPartySnRelationVO> list = thirdpartySnRelationMapper.getRelationVOList(queryPileDTO);
for (ThirdPartySnRelationVO thirdPartySnRelationVO : list) {
// 将第三方平台类型中文名称查询出来
String thirdPartyType = thirdPartySnRelationVO.getThirdPartyType();
String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType);
thirdPartySnRelationVO.setThirdPartyName(label);
}
return list;
}
/**
* 修改第三方平台对应编号
* @param dto
* @return
*/
@Override
public int updateThirdPartySnRelation(ThirdPartySnRelationDTO dto) {
return thirdpartySnRelationMapper.updateThirdPartySnRelation(dto);
}
}

View File

@@ -0,0 +1,28 @@
package com.jsowell.pile.vo.web;
import lombok.Data;
/**
* 第三方平台桩编号对应VO
*
* @author Lemon
* @Date 2024/3/11 10:33:51
*/
@Data
public class ThirdPartySnRelationVO {
/**
* 桩编号
*/
private String pileSn;
// 第三方平台类型
private String thirdPartyType;
// 第三方平台名称
private String thirdPartyName;
// 第三方平台对应的sn
private String thirdPartySn;
}

View File

@@ -87,4 +87,25 @@
#{id}
</foreach>
</delete>
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
SELECT
pile_sn AS pileSn,
thirdparty_type AS thirdpartyType,
thirdparty_pile_sn AS thirdPartySn
FROM
thirdparty_sn_relation
where del_flag = '0'
<if test="dto.pileSn != null and dto.pileSn != ''">
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
</if>
</select>
<update id="updateThirdPartySnRelation">
UPDATE thirdparty_sn_relation
SET thirdparty_pile_sn = #{dto.thirdPartySn,jdbcType=VARCHAR}
WHERE
pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
AND thirdparty_type = #{dto.thirdPartyType,jdbcType=VARCHAR}
</update>
</mapper>

View File

@@ -95,3 +95,21 @@ export function updatePileName(data) {
data: data
})
}
// 查询桩对应的第三方平台桩编号列表
export function getThirdPartySnRelation(data) {
return request({
url: '/pile/basic/getThirdPartySnRelation',
method: 'post',
data: data
})
}
// 修改第三方平台对应编号
export function updateThirdPartySnRelation(data) {
return request({
url: '/pile/basic/updateThirdPartySnRelation',
method: 'post',
data: data
})
}

View File

@@ -31,7 +31,7 @@
<template slot="label">
别名
<el-button type="text" icon="el-icon-edit" size="medium" circle
@click="openEdit" v-hasPermi="['pile:basic:edit']" />
@click="openEditName" v-hasPermi="['pile:basic:edit']" />
</template>
<el-input v-model="pileDetail.name" size="medium" clearable
:disabled="clearableFlag" type="number" :min="1"
@@ -43,6 +43,23 @@
</template>
</el-input>
</el-descriptions-item>
<el-descriptions-item v-for="(item,index) in snRelationList" :key="index">
<template slot="label">
{{item.thirdPartyName}} sn编号
<el-button type="text" icon="el-icon-edit" size="medium" circle
@click="openEditSnRelation" v-hasPermi="['pile:basic:edit']" />
</template>
<el-input v-model="item.thirdPartySn" size="medium" clearable
:disabled="clearableFlagSnRelation" type="text"
oninput="if(value<1)value=''">
<template slot="append">
<el-button type="text" size="medium" circle @click="updateThirdPartySn(item)">保存
</el-button>
</template>
</el-input>
</el-descriptions-item>
<el-descriptions-item label="运营商">{{ pileDetail.merchantName }}
</el-descriptions-item>
<el-descriptions-item label="站点">{{ pileDetail.stationName }}
@@ -187,10 +204,10 @@
import remoteUpgrade from "./components/remoteUpgrade.vue";
import {
getPileDetailById,
getPileFeedList,
getPileFeedList, getThirdPartySnRelation,
listBasic,
updateBasic,
updatePileName,
updatePileName, updateThirdPartySnRelation,
} from "@/api/pile/basic";
import { queryConnectorListByParams } from "@/api/pile/connector";
// 二维码组件
@@ -206,6 +223,7 @@ export default {
return {
visible: false,
clearableFlag: true,
clearableFlagSnRelation: true,
resCode: null,
msg: null,
pileDetailLoading: false,
@@ -217,6 +235,7 @@ export default {
// 充电桩详情 竖向 表格渲染的数据
pileDetail: { url: "" },
feedListLoading: false,
snRelationList: [],
qrWidth: 60,
flag: true,
// 充电桩通信日志
@@ -254,6 +273,8 @@ export default {
this.getPileDetail();
// 查询充电桩接口列表
this.queryPileConnectorList();
// 查询桩对应的第三方平台桩编号列表
this.getThirdPartySnRelationList();
},
mounted() {
setTimeout(() => {
@@ -309,9 +330,12 @@ export default {
console.log("测试");
},
// 开放编辑按钮
openEdit() {
openEditName() {
this.clearableFlag = this.clearableFlag === false;
},
openEditSnRelation() {
this.clearableFlagSnRelation = this.clearableFlagSnRelation === false;
},
// 修改充电桩别名
updateName() {
const params = {
@@ -335,6 +359,18 @@ export default {
this.getPileDetail();
});
},
// 修改第三方平台对应编号
updateThirdPartySn(item) {
const params = {
thirdPartyType: item.thirdPartyType,
pileSn: item.pileSn,
thirdPartySn: item.thirdPartySn,
}
console.log("修改第三方平台对应编号 params:", params)
updateThirdPartySnRelation(params).then((response) => {
console.log("修改第三方平台对应编号 response:", response)
});
},
// 查询充电桩详情接口
getPileDetail() {
this.pileDetailLoading = true;
@@ -349,6 +385,17 @@ export default {
console.log("getPileDetailById结果", this.pileDetail);
});
},
getThirdPartySnRelationList() {
const params = {
pileSn: this.pileDetail.pileSn
}
getThirdPartySnRelation(params).then((response) =>{
this.snRelationList = response.rows;
console.log("snRelationList:", this.snRelationList)
});
},
handleClick(tab) {
// console.log(tab.name, event);
if (tab.name === "second") {