diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileBasicInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileBasicInfoController.java index bdf255138..15ea397ef 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileBasicInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileBasicInfoController.java @@ -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 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; + } + } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartySnRelationDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartySnRelationDTO.java new file mode 100644 index 000000000..9a7d341b8 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartySnRelationDTO.java @@ -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; +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdpartySnRelationMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdpartySnRelationMapper.java index 5fc15f69a..4caad03c7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdpartySnRelationMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdpartySnRelationMapper.java @@ -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 getRelationVOList(@Param("dto") QueryPileDTO queryPileDTO); + + /** + * 修改第三方平台对应编号 + * @param dto + * @return + */ + int updateThirdPartySnRelation(@Param("dto") ThirdPartySnRelationDTO dto); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdpartySnRelationService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdpartySnRelationService.java index c131324f5..a68b7936f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdpartySnRelationService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdpartySnRelationService.java @@ -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 getRelationVOList(QueryPileDTO queryPileDTO); + + /** + * 修改第三方平台对应编号 + * @param dto + * @return + */ + int updateThirdPartySnRelation(ThirdPartySnRelationDTO dto); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java index 6784a9888..f1ea7e5c5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java @@ -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 getRelationVOList(QueryPileDTO queryPileDTO) { + List 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); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ThirdPartySnRelationVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ThirdPartySnRelationVO.java new file mode 100644 index 000000000..1c503cfbf --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/ThirdPartySnRelationVO.java @@ -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; + + +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdpartySnRelationMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdpartySnRelationMapper.xml index 11a5cef15..3949b406b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdpartySnRelationMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdpartySnRelationMapper.xml @@ -87,4 +87,25 @@ #{id} + + + + + 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} + \ No newline at end of file diff --git a/jsowell-ui/src/api/pile/basic.js b/jsowell-ui/src/api/pile/basic.js index fbc4d2c3c..7d0af3d07 100644 --- a/jsowell-ui/src/api/pile/basic.js +++ b/jsowell-ui/src/api/pile/basic.js @@ -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 + }) +} diff --git a/jsowell-ui/src/views/pile/basic/detail.vue b/jsowell-ui/src/views/pile/basic/detail.vue index 01f2df0af..89079c8fc 100644 --- a/jsowell-ui/src/views/pile/basic/detail.vue +++ b/jsowell-ui/src/views/pile/basic/detail.vue @@ -31,7 +31,7 @@ + + + + + + + + {{ pileDetail.merchantName }} {{ 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") {