From c047ec59cb7c0e7df512c48ab3f9079c02819bba Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 7 Jan 2025 15:13:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/parking/ParkingCommonParam.java | 41 +++++++++++ .../com/jsowell/common/util/ParkingUtil.java | 70 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java create mode 100644 jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java b/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java new file mode 100644 index 000000000..b1f142d08 --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java @@ -0,0 +1,41 @@ +package com.jsowell.common.core.domain.parking; + +import lombok.Data; + +import java.util.Map; + +/** + * 停车场公告参数 + */ +@Data +public class ParkingCommonParam { + /** + * 服务名称 + */ + private String service; + + /** + * 版本 + */ + private String version; + + /** + * 消息ID(唯一) + */ + private String msgId; + + /** + * 机构ID(分配) + */ + private String orgId; + + /** + * 具体业务接口json对象 + */ + private Map data; + + /** + * 请求签名 + */ + private String sign; +} diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java new file mode 100644 index 000000000..bb43808b8 --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java @@ -0,0 +1,70 @@ +package com.jsowell.common.util; + +import com.jsowell.common.util.sign.MD5Util; + +import java.util.HashMap; +import java.util.Map; + +/** + * 停车平台工具类 + */ +public class ParkingUtil { + + /** + * 计算sign + */ + public static String generateSign(Map publicParams, Map businessParams, String secretKey) { + // Step 1: 过滤空值并按照ASCII码排序公共参数 + StringBuilder stringA = new StringBuilder(); + publicParams.entrySet().stream() + .filter(entry -> entry.getValue() != null && !entry.getValue().isEmpty()) + .sorted(Map.Entry.comparingByKey()) + .forEach(entry -> stringA.append(entry.getKey()).append("=").append(entry.getValue()).append("|")); + + // 去除最后的“|”符号 + // if (stringA.length() > 0) { + // stringA.deleteCharAt(stringA.length() - 1); + // } + + // Step 2: 过滤空值并按照ASCII码排序业务参数 + StringBuilder stringB = new StringBuilder(); + businessParams.entrySet().stream() + .filter(entry -> entry.getValue() != null && !entry.getValue().isEmpty()) + .sorted(Map.Entry.comparingByKey()) + .forEach(entry -> stringB.append(entry.getKey()).append("=").append(entry.getValue()).append("|")); + + // 去除最后的“|”符号 + // if (stringB.length() > 0) { + // stringB.deleteCharAt(stringB.length() - 1); + // } + + // Step 3: 拼接字符串A、B和机构密钥 + String stringC = stringA.toString() + stringB.toString() + secretKey; + + // Step 4: 对字符串C进行MD5加密并返回小写的签名 + return MD5Util.MD5Encode(stringC).toLowerCase(); + } + + public static void main(String[] args) { + // 模拟公共请求参数 + Map publicParams = new HashMap<>(); + publicParams.put("service", "getOwner"); + publicParams.put("version", "01"); + publicParams.put("msgId", "f719b06d-210b-4989-9c7f-02e85f22fe01"); + publicParams.put("orgId", "BTTEST01"); + + // 模拟业务请求参数 + Map businessParams = new HashMap<>(); + businessParams.put("parkId", "11609"); + businessParams.put("phone", "13148762240"); + businessParams.put("name", "pasika"); + businessParams.put("address", "测试"); + + // 机构密钥 + String secretKey = "K9OGNA7CIY8N5GXD8HF3WVDMEZNFKL3F"; + + // 计算签名 + String sign = generateSign(publicParams, businessParams, secretKey); + System.out.println("Generated Sign: " + sign); + } +} From 3433cf053d7312b8b2c81dc052a84c4e393b3bd3 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 7 Jan 2025 15:13:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jsowell/common/util/ParkingUtil.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java index bb43808b8..3cf7e4ebc 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java @@ -21,11 +21,6 @@ public class ParkingUtil { .sorted(Map.Entry.comparingByKey()) .forEach(entry -> stringA.append(entry.getKey()).append("=").append(entry.getValue()).append("|")); - // 去除最后的“|”符号 - // if (stringA.length() > 0) { - // stringA.deleteCharAt(stringA.length() - 1); - // } - // Step 2: 过滤空值并按照ASCII码排序业务参数 StringBuilder stringB = new StringBuilder(); businessParams.entrySet().stream() @@ -33,11 +28,6 @@ public class ParkingUtil { .sorted(Map.Entry.comparingByKey()) .forEach(entry -> stringB.append(entry.getKey()).append("=").append(entry.getValue()).append("|")); - // 去除最后的“|”符号 - // if (stringB.length() > 0) { - // stringB.deleteCharAt(stringB.length() - 1); - // } - // Step 3: 拼接字符串A、B和机构密钥 String stringC = stringA.toString() + stringB.toString() + secretKey; From 2234880632771ca23b7356287b1fc3cc5f4fe084 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 7 Jan 2025 15:40:38 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/parking/ParkingCommonParam.java | 10 ++++++++++ .../main/java/com/jsowell/common/util/ParkingUtil.java | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java b/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java index b1f142d08..27c730204 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/domain/parking/ParkingCommonParam.java @@ -2,6 +2,7 @@ package com.jsowell.common.core.domain.parking; import lombok.Data; +import java.util.HashMap; import java.util.Map; /** @@ -38,4 +39,13 @@ public class ParkingCommonParam { * 请求签名 */ private String sign; + + public Map getPublicParams() { + Map publicParams = new HashMap<>(); + publicParams.put("service", service); + publicParams.put("version", version); + publicParams.put("msgId", msgId); + publicParams.put("orgId", orgId); + return publicParams; + } } diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java index 3cf7e4ebc..284687093 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/ParkingUtil.java @@ -1,5 +1,6 @@ package com.jsowell.common.util; +import com.jsowell.common.core.domain.parking.ParkingCommonParam; import com.jsowell.common.util.sign.MD5Util; import java.util.HashMap; @@ -35,6 +36,14 @@ public class ParkingUtil { return MD5Util.MD5Encode(stringC).toLowerCase(); } + /** + * 设置sign + */ + public static void generateAndSetSign(ParkingCommonParam param, String secretKey) { + String sign = generateSign(param.getPublicParams(), param.getData(), secretKey); + param.setSign(sign); + } + public static void main(String[] args) { // 模拟公共请求参数 Map publicParams = new HashMap<>(); From fd3ceab0f60a2b9aa8c39b56e550e145e1fd423c Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 7 Jan 2025 16:59:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=B9=B3=E5=8F=B0,=20?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E4=BC=98=E6=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/PileStationInfoController.java | 603 +++++++++--------- jsowell-ui/src/api/pile/station.js | 8 - jsowell-ui/src/views/pile/station/detail.vue | 2 - 3 files changed, 304 insertions(+), 309 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index ca0e6f5cc..1dc501ae9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -14,7 +14,6 @@ import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.poi.ExcelUtil; import com.jsowell.pile.domain.PileStationInfo; -import com.jsowell.pile.domain.ThirdPartySettingInfo; import com.jsowell.pile.domain.ThirdpartyParkingConfig; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.PushStationInfoDTO; @@ -48,74 +47,74 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/pile/station") public class PileStationInfoController extends BaseController { - @Autowired - private PileStationInfoService pileStationInfoService; + @Autowired + private PileStationInfoService pileStationInfoService; - @Autowired - private PileService pileService; + @Autowired + private PileService pileService; - @Autowired - private ThirdPartySettingInfoService thirdPartySettingInfoService; + @Autowired + private ThirdPartySettingInfoService thirdPartySettingInfoService; - @Autowired - private CommonService commonService; + @Autowired + private CommonService commonService; - @Autowired - private AMapService aMapService; + @Autowired + private AMapService aMapService; - @Autowired - private ThirdPartyStationRelationService thirdPartyStationRelationService; + @Autowired + private ThirdPartyStationRelationService thirdPartyStationRelationService; - @Autowired - private ThirdPartyParkingConfigService parkingConfigService; + @Autowired + private ThirdPartyParkingConfigService parkingConfigService; - /** - * 查询充电站信息列表NEW - */ + /** + * 查询充电站信息列表NEW + */ @PreAuthorize("@ss.hasPermi('pile:station:list')") @GetMapping("/list") public TableDataInfo list(QueryStationDTO queryStationDTO) { - startPage(); - // List list = pileStationInfoService.selectPileStationInfoList(pileStationInfo); - List list = pileStationInfoService.queryStationInfos(queryStationDTO); - return getDataTable(list); - } + startPage(); + // List list = pileStationInfoService.selectPileStationInfoList(pileStationInfo); + List list = pileStationInfoService.queryStationInfos(queryStationDTO); + return getDataTable(list); + } - /** - * 查询充电站下拉列表 - */ - @PreAuthorize("@ss.hasPermi('pile:station:list')") - @GetMapping("/StationSelectList") - public TableDataInfo getStationSelectList(QueryStationDTO dto) { - logger.info("dto:{}", JSON.toJSONString(dto)); - startPage(); - List list = pileStationInfoService.getStationSelectList(dto); - return getDataTable(list); - } + /** + * 查询充电站下拉列表 + */ + @PreAuthorize("@ss.hasPermi('pile:station:list')") + @GetMapping("/StationSelectList") + public TableDataInfo getStationSelectList(QueryStationDTO dto) { + logger.info("dto:{}", JSON.toJSONString(dto)); + startPage(); + List list = pileStationInfoService.getStationSelectList(dto); + return getDataTable(list); + } - /** - * 快速建站接口 - */ + /** + * 快速建站接口 + */ // @PreAuthorize("@ss.hasPermi('pile:station:add')") @PostMapping("/fastCreateStation") public AjaxResult fastCreateStation(@RequestBody FastCreateStationDTO dto) { - logger.info("快速建站接口 param:{}", JSON.toJSONString(dto)); - int i = 0; - try { - i = pileStationInfoService.fastCreateStation(dto); - } catch (BusinessException e) { - logger.warn("快速建站接口 warn", e); - } catch (Exception e) { - logger.error("快速建站接口 error", e); - } - return toAjax(i); + logger.info("快速建站接口 param:{}", JSON.toJSONString(dto)); + int i = 0; + try { + i = pileStationInfoService.fastCreateStation(dto); + } catch (BusinessException e) { + logger.warn("快速建站接口 warn", e); + } catch (Exception e) { + logger.error("快速建站接口 error", e); + } + return toAjax(i); } - /** - * 查询充电站信息列表 - */ + /** + * 查询充电站信息列表 + */ /*@PreAuthorize("@ss.hasPermi('pile:station:list')") @GetMapping("/list") public TableDataInfo list(PileStationInfo pileStationInfo) { @@ -124,272 +123,278 @@ public class PileStationInfoController extends BaseController { return getDataTable(list); }*/ - /** - * 导出充电站信息列表 - */ - @PreAuthorize("@ss.hasPermi('pile:station:export')") - @Log(title = "充电站信息", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, PileStationInfo pileStationInfo) { - List list = pileStationInfoService.selectPileStationInfoList(pileStationInfo); - ExcelUtil util = new ExcelUtil(PileStationInfo.class); - util.exportExcel(response, list, "充电站信息数据"); - } + /** + * 导出充电站信息列表 + */ + @PreAuthorize("@ss.hasPermi('pile:station:export')") + @Log(title = "充电站信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PileStationInfo pileStationInfo) { + List list = pileStationInfoService.selectPileStationInfoList(pileStationInfo); + ExcelUtil util = new ExcelUtil(PileStationInfo.class); + util.exportExcel(response, list, "充电站信息数据"); + } - /** - * 获取充电站信息详细信息 - */ - @PreAuthorize("@ss.hasPermi('pile:station:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id)); - } + /** + * 获取充电站信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('pile:station:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id)); + } - /** - * 后管站点基本资料页面 - * @return - */ - @PreAuthorize("@ss.hasPermi('pile:station:query')") - @GetMapping(value = "/getStationInfo/{stationId}") - public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) { - return AjaxResult.success(pileStationInfoService.getStationInfo(stationId)); - } + /** + * 后管站点基本资料页面 + * + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:query')") + @GetMapping(value = "/getStationInfo/{stationId}") + public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) { + return AjaxResult.success(pileStationInfoService.getStationInfo(stationId)); + } - /** - * 新增充电站信息 - */ - @PreAuthorize("@ss.hasPermi('pile:station:add')") - @Log(title = "充电站信息", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) { - return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo)); - } + /** + * 新增充电站信息 + */ + @PreAuthorize("@ss.hasPermi('pile:station:add')") + @Log(title = "充电站信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) { + return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo)); + } - /** - * 修改充电站信息 - */ - @PreAuthorize("@ss.hasPermi('pile:station:edit')") - @Log(title = "充电站信息", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) { - logger.info("修改充电站信息 param:{}", pileStationInfo.toString()); - return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo)); - } + /** + * 修改充电站信息 + */ + @PreAuthorize("@ss.hasPermi('pile:station:edit')") + @Log(title = "充电站信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) { + logger.info("修改充电站信息 param:{}", pileStationInfo.toString()); + return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo)); + } - /** - * 修改对接高德标识 - */ - @PreAuthorize("@ss.hasPermi('pile:station:edit')") - @Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE) - @PostMapping("/editAmapFlag") - public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) { - logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto)); - return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag())); - } + /** + * 修改对接高德标识 + */ + @PreAuthorize("@ss.hasPermi('pile:station:edit')") + @Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE) + @PostMapping("/editAmapFlag") + public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) { + logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto)); + return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag())); + } - /** - * 高德地图商家推送静态信息状态 - * @param dto - * @return - */ - @PreAuthorize("@ss.hasPermi('pile:station:edit')") - @PostMapping("/pushAMapStationStatus") - public RestApiResponse pushAMapStationStatus(EditAmapFlagDTO dto) { - RestApiResponse response = null; - try { - String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag()); - response = new RestApiResponse<>(result); - } catch (Exception e) { - logger.error("高德地图商家推送静态信息状态 error", e); - response = new RestApiResponse<>(e); - } - logger.info("高德地图商家推送静态信息状态 result:{}", response); - return response; - } + /** + * 高德地图商家推送静态信息状态 + * + * @param dto + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:edit')") + @PostMapping("/pushAMapStationStatus") + public RestApiResponse pushAMapStationStatus(EditAmapFlagDTO dto) { + RestApiResponse response = null; + try { + String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag()); + response = new RestApiResponse<>(result); + } catch (Exception e) { + logger.error("高德地图商家推送静态信息状态 error", e); + response = new RestApiResponse<>(e); + } + logger.info("高德地图商家推送静态信息状态 result:{}", response); + return response; + } - /** - * 删除充电站信息 - */ - @PreAuthorize("@ss.hasPermi('pile:station:remove')") - @Log(title = "充电站信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids)); - } + /** + * 删除充电站信息 + */ + @PreAuthorize("@ss.hasPermi('pile:station:remove')") + @Log(title = "充电站信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids)); + } - /** - * 根据运营商id获取充电站列表 - */ - @PreAuthorize("@ss.hasPermi('pile:station:query')") - @PostMapping(value = "/selectStationListByMerchantId") - public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) { - return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId()))); - } + /** + * 根据运营商id获取充电站列表 + */ + @PreAuthorize("@ss.hasPermi('pile:station:query')") + @PostMapping(value = "/selectStationListByMerchantId") + public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) { + return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId()))); + } - /** - * 修改站点二维码前缀 - * @param dto - * @return - */ - @PreAuthorize("@ss.hasPermi('pile:station:edit')") - @PostMapping("/updateStationQRCodePrefix") - public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) { - // 校验入参 - if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) { - return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue()); - } - return AjaxResult.success(pileService.updateStationQRCodePrefix(dto)); - } + /** + * 修改站点二维码前缀 + * + * @param dto + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:edit')") + @PostMapping("/updateStationQRCodePrefix") + public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) { + // 校验入参 + if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) { + return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue()); + } + return AjaxResult.success(pileService.updateStationQRCodePrefix(dto)); + } - /** - * 查询站点互联互通配置 - * @param id - * @return - */ - @PreAuthorize("@ss.hasPermi('pile:station:query')") - @GetMapping("/getRelationByStationId/{stationId}") - public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) { - List list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id)); - for (ThirdPartyStationRelationVO vo : list) { - vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType())); - } - return getDataTable(list); - } + /** + * 查询站点互联互通配置 + * + * @param id + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:query')") + @GetMapping("/getRelationByStationId/{stationId}") + public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) { + List list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id)); + for (ThirdPartyStationRelationVO vo : list) { + vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType())); + } + return getDataTable(list); + } - /** - * 查询第三方平台配置信息 - * @param info - * @return - */ - @PreAuthorize("@ss.hasPermi('pile:station:query')") - @PostMapping("/getSettingInfo") - public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) { - List infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info); - return getDataTable(infos); - // return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info)); - } + /** + * 查询第三方平台配置信息 + * @param info + * @return + */ + // @PreAuthorize("@ss.hasPermi('pile:station:query')") + // @PostMapping("/getSettingInfo") + // public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) { + // List infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info); + // return getDataTable(infos); + // // return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info)); + // } - /** - * 修改站点互联互通配置信息 - * @param info - * @return - */ - // @PreAuthorize("@ss.hasPermi('pile:station:edit')") - // @PostMapping("/updateSettingByStationId") - // public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) { - // return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info)); - // } + /** + * 修改站点互联互通配置信息 + * @param info + * @return + */ + // @PreAuthorize("@ss.hasPermi('pile:station:edit')") + // @PostMapping("/updateSettingByStationId") + // public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) { + // return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info)); + // } - /** - * 新增站点互联互通配置信息 - * @param info - * @return - */ - // @PreAuthorize("@ss.hasPermi('pile:station:add')") - // @PostMapping("/insertSettingInfo") - // public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) { - // return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info)); - // } + /** + * 新增站点互联互通配置信息 + * @param info + * @return + */ + // @PreAuthorize("@ss.hasPermi('pile:station:add')") + // @PostMapping("/insertSettingInfo") + // public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) { + // return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info)); + // } + /** + * 推送充电站信息 notification_stationInfo + * http://localhost:8080/LianLian/pushStationInfo + * + * @param dto + * @return + */ + @PostMapping("/pushStationInfo") + public RestApiResponse pushStationInfo(@RequestBody PushStationInfoDTO dto) { + logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto)); + RestApiResponse response = null; + Long stationId = dto.getStationId(); + List types = dto.getThirdPartyTypes(); + // 先查到该站点推送过的类型 + List infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId)); + List typeList = infoList.stream() + .map(ThirdPartyStationRelationVO::getThirdPartyType) + .collect(Collectors.toList()); + // 对types去重,可获取到需要新推送的第三方平台类型 + types.removeAll(typeList); + dto.setThirdPartyTypes(types); + try { + if (StringUtils.isBlank(String.valueOf(stationId))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String result = commonService.commonPushStation(dto); + response = new RestApiResponse<>(result); + } catch (BusinessException e) { + logger.error("推送第三方平台充电站信息 error", e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + } catch (Exception e) { + logger.error("推送第三方平台充电站信息 error", e); + response = new RestApiResponse<>("推送失败,请联系管理员"); + // 有报错,所有的都必须删除 + thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types); + } + logger.info("推送第三方平台充电站信息 result:{}", response); + return response; + } - /** - * 推送充电站信息 notification_stationInfo - * http://localhost:8080/LianLian/pushStationInfo - * @param dto - * @return - */ - @PostMapping("/pushStationInfo") - public RestApiResponse pushStationInfo(@RequestBody PushStationInfoDTO dto) { - logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto)); - RestApiResponse response = null; - Long stationId = dto.getStationId(); - List types = dto.getThirdPartyTypes(); - // 先查到该站点推送过的类型 - List infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId)); - List typeList = infoList.stream() - .map(ThirdPartyStationRelationVO::getThirdPartyType) - .collect(Collectors.toList()); - // 对types去重,可获取到需要新推送的第三方平台类型 - types.removeAll(typeList); - dto.setThirdPartyTypes(types); - try { - if (StringUtils.isBlank(String.valueOf(stationId))) { - throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - } - String result = commonService.commonPushStation(dto); - response = new RestApiResponse<>(result); - }catch (BusinessException e) { - logger.error("推送第三方平台充电站信息 error",e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - }catch (Exception e) { - logger.error("推送第三方平台充电站信息 error", e); - response = new RestApiResponse<>("推送失败,请联系管理员"); - // 有报错,所有的都必须删除 - thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types); - } - logger.info("推送第三方平台充电站信息 result:{}", response); - return response; - } + /** + * 绑定停车平台(停车充电下发优惠券) + * + * @param dto + * @return + */ + @PostMapping("/bindParkingPlatform") + public RestApiResponse bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) { + logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto)); + RestApiResponse response = null; + try { + int i = pileStationInfoService.bindParkingPlatform(dto); + response = new RestApiResponse<>(i); + } catch (BusinessException e) { + logger.error("绑定停车平台 error,", e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + } catch (Exception e) { + logger.error("绑定停车平台 error", e); + response = new RestApiResponse<>(e); + } + logger.info("绑定停车平台 result:{}", response); + return response; + } - /** - * 绑定停车平台(停车充电下发优惠券) - * @param dto - * @return - */ - @PostMapping("/bindParkingPlatform") - public RestApiResponse bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) { - logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto)); - RestApiResponse response = null; - try { - int i = pileStationInfoService.bindParkingPlatform(dto); - response = new RestApiResponse<>(i); - }catch (BusinessException e) { - logger.error("绑定停车平台 error,", e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - } catch (Exception e) { - logger.error("绑定停车平台 error", e); - response = new RestApiResponse<>(e); - } - logger.info("绑定停车平台 result:{}", response); - return response; - } + /** + * 获取停车平台列表 + * + * @return + */ + @GetMapping("/getParkingInfoList") + public RestApiResponse getParkingInfoList() { + // logger.info("获取停车平台列表"); + RestApiResponse response = null; + try { + startPage(); + List list = parkingConfigService.selectInfoList(); + response = new RestApiResponse<>(list); + } catch (Exception e) { + logger.error("获取停车平台列表 error,", e); + response = new RestApiResponse<>(e); + } + logger.info("获取停车平台列表 result:{}", response); + return response; + } - /** - * 获取停车平台列表 - * @return - */ - @GetMapping("/getParkingInfoList") - public RestApiResponse getParkingInfoList() { - // logger.info("获取停车平台列表"); - RestApiResponse response = null; - try { - startPage(); - List list = parkingConfigService.selectInfoList(); - response = new RestApiResponse<>(list); - } catch (Exception e) { - logger.error("获取停车平台列表 error,", e); - response = new RestApiResponse<>(e); - } - logger.info("获取停车平台列表 result:{}", response); - return response; - } - - /** - * 更新站点与第三方平台关系 - */ - @PostMapping("/updateThirdPartyStationRelation") - public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) { - AjaxResult result; - try { - // startPage(); - thirdPartyStationRelationService.updateThirdPartyStationRelation(dto); - result = AjaxResult.success(); - } catch (Exception e) { - logger.error("更新站点与第三方平台关系error,", e); - result = AjaxResult.error(e.getMessage()); - } - return result; - } + /** + * 更新站点与第三方平台关系 + */ + @PostMapping("/updateThirdPartyStationRelation") + public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) { + AjaxResult result; + try { + // startPage(); + thirdPartyStationRelationService.updateThirdPartyStationRelation(dto); + result = AjaxResult.success(); + } catch (Exception e) { + logger.error("更新站点与第三方平台关系error,", e); + result = AjaxResult.error(e.getMessage()); + } + return result; + } } diff --git a/jsowell-ui/src/api/pile/station.js b/jsowell-ui/src/api/pile/station.js index c8aca1a02..cbff33a08 100644 --- a/jsowell-ui/src/api/pile/station.js +++ b/jsowell-ui/src/api/pile/station.js @@ -121,14 +121,6 @@ export function getRelationByStationId(id) { }); } -// 查询站点互联互通配置 -export function getSettingInfo(data) { - return request({ - url: "/pile/station/getSettingInfo", - method: "post", - data: data, - }); -} // 修改站点互联互通配置 export function updateSettingByStationId(data) { diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index e85c945a4..e1b36ecaf 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -255,10 +255,8 @@ import stationWhiteList from "@/views/pile/station/stationWhiteList"; import { getStationInfo, updateStationQRCodePrefix, - getSettingByStationId, updateSettingByStationId, pushStationInfo, - getSettingInfo, getParkingInfoList, bindParkingPlatform, getRelationByStationId,