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 b3c835ecc..2d3dd9d68 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 @@ -11,9 +11,11 @@ import com.jsowell.common.exception.BusinessException; 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.dto.FastCreateStationDTO; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.service.IPileStationInfoService; +import com.jsowell.pile.service.IThirdPartySettingInfoService; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.service.PileService; import org.springframework.beans.factory.annotation.Autowired; @@ -38,6 +40,9 @@ public class PileStationInfoController extends BaseController { @Autowired private PileService pileService; + @Autowired + private IThirdPartySettingInfoService thirdPartySettingInfoService; + /** * 查询充电站信息列表NEW @@ -166,4 +171,37 @@ public class PileStationInfoController extends BaseController { } return AjaxResult.success(pileService.updateStationQRCodePrefix(dto)); } + + /** + * 查询站点互联互通配置 + * @param id + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:query')") + @GetMapping("/getSettingByStationId/{stationId}") + public AjaxResult getSettingByStationId(@PathVariable("stationId") Long id) { + return AjaxResult.success(thirdPartySettingInfoService.getInfoByStationId(id)); + } + + /** + * 修改站点互联互通配置信息 + * @param info + * @return + */ + @PreAuthorize("@ss.hasPermi('pile:station:edit')") + @PostMapping("/updateSettingByStationId") + public AjaxResult updateSettingByStationId(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)); + // } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java index 29cab6909..904d5db1e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java @@ -66,4 +66,11 @@ public interface IThirdPartySettingInfoService { * @return */ public ThirdPartySettingInfo getInfoByStationId(Long stationId); + + /** + * 修改站点互联互通配置 + * @param info + * @return + */ + int updateStationSettingInfo(ThirdPartySettingInfo info); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java index 6696fd573..409502256 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java @@ -98,4 +98,22 @@ public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoS public ThirdPartySettingInfo getInfoByStationId(Long stationId) { return thirdPartySettingInfoMapper.getInfoByStationId(stationId); } + + /** + * 修改站点互联互通配置 + * @param info + * @return + */ + @Override + public int updateStationSettingInfo(ThirdPartySettingInfo info) { + Long stationId = info.getStationId(); + ThirdPartySettingInfo infoByStationId = getInfoByStationId(stationId); + if (infoByStationId == null) { + // 新增 + return insertThirdPartySettingInfo(info); + }else { + // 修改 + return updateThirdPartySettingInfo(info); + } + } } diff --git a/jsowell-ui/src/api/pile/station.js b/jsowell-ui/src/api/pile/station.js index 450f615a7..2366cc992 100644 --- a/jsowell-ui/src/api/pile/station.js +++ b/jsowell-ui/src/api/pile/station.js @@ -81,3 +81,32 @@ export function updateStationQRCodePrefix(data) { data: data, }); } + +/** + * 查询站点互联互通配置 + * @param id + * @returns {AxiosPromise} + */ +export function getSettingByStationId(id) { + return request({ + url: "/pile/station/getSettingByStationId/" + id, + method: "get", + }); +} + +// 修改站点互联互通配置 +export function updateSettingByStationId(data) { + return request({ + url: "/pile/station/updateSettingByStationId", + method: "post", + data: data, + }) +} + +// export function insertSettingInfo(data) { +// return request({ +// url: "/pile/station/insertSettingInfo", +// method: "post", +// data: data, +// }) +// }