diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java index 1480909f3..72cb438b9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/AMapController.java @@ -83,9 +83,10 @@ public class AMapController extends BaseController { return result; } } catch (Exception e) { - + logger.error("高德拉取商家静态详细信息 error", e); + result = result.failedResponse(); } - return null; + return result; } 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 687f2a662..3f242b0c8 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 @@ -1,6 +1,7 @@ package com.jsowell.web.controller.pile; import com.alibaba.fastjson2.JSON; +import com.google.common.collect.Lists; import com.jsowell.common.annotation.Log; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.domain.AjaxResult; @@ -28,6 +29,7 @@ import com.jsowell.pile.service.ThirdPartyStationRelationService; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.service.PileService; +import com.jsowell.thirdparty.amap.service.AMapService; import com.jsowell.thirdparty.common.CommonService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -58,7 +60,8 @@ public class PileStationInfoController extends BaseController { @Autowired private CommonService commonService; - + @Autowired + private AMapService aMapService; @Autowired private ThirdPartyStationRelationService thirdPartyStationRelationService; @@ -184,6 +187,27 @@ public class PileStationInfoController extends BaseController { 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; + } + + /** * 删除充电站信息 */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/amap/EditAmapFlagDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/amap/EditAmapFlagDTO.java index 6670a5f97..75d782f8f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/amap/EditAmapFlagDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/amap/EditAmapFlagDTO.java @@ -11,6 +11,10 @@ import lombok.Data; @Data public class EditAmapFlagDTO { private String stationId; + + /** + * 是否对接高德地图(0-否;1-是) + */ private String amapFlag; } diff --git a/jsowell-ui/src/api/pile/station.js b/jsowell-ui/src/api/pile/station.js index 2a42943c5..c8aca1a02 100644 --- a/jsowell-ui/src/api/pile/station.js +++ b/jsowell-ui/src/api/pile/station.js @@ -73,6 +73,15 @@ export function updateAmapFlag(data) { }); } +// 高德地图商家推送静态信息状态 +export function pushAMapStationStatus(data) { + return request({ + url: "/pile/station/pushAMapStationStatus", + method: "post", + data: data, + }); +} + // 删除充电站信息 export function delStation(id) { diff --git a/jsowell-ui/src/views/pile/station/index.vue b/jsowell-ui/src/views/pile/station/index.vue index 987de625a..89606dd1f 100644 --- a/jsowell-ui/src/views/pile/station/index.vue +++ b/jsowell-ui/src/views/pile/station/index.vue @@ -293,7 +293,7 @@ import { delStation, addStation, updateStation, - fastCreateStation, updateAmapFlag, + fastCreateStation, updateAmapFlag, pushAMapStationStatus, } from "@/api/pile/station"; import {getMerchantList} from "@/api/pile/merchant"; import {regionData, CodeToText} from "element-china-area-data"; @@ -434,12 +434,19 @@ export default { // this.open = false; // this.getList(); // }); + // 修改数据库标识 updateAmapFlag(params).then((response) => { console.log("response", response) this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); + + // 向高德发送上线/下线消息 + pushAMapStationStatus(params).then((response) => { + console.log("response", response) + }); + }, getCodeToText(codeStr, codeArray) { if (null === codeStr && null === codeArray) {