From b5367cc258c95f0cc8a69f22b704646ff95f087a Mon Sep 17 00:00:00 2001 From: "BOOL\\25024" Date: Tue, 7 Jan 2025 15:31:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=BC=E5=87=BAExcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/package.json | 3 +- jsowell-ui/src/views/homeIndex/echarts.js | 77 +- jsowell-ui/src/views/homeIndex/homeIndex.vue | 718 ++++++++++--------- 3 files changed, 425 insertions(+), 373 deletions(-) diff --git a/jsowell-ui/package.json b/jsowell-ui/package.json index cd1d240d4..8480e66e4 100644 --- a/jsowell-ui/package.json +++ b/jsowell-ui/package.json @@ -57,7 +57,8 @@ "vue-qr": "^4.0.9", "vue-router": "3.4.9", "vuedraggable": "2.24.3", - "vuex": "3.6.0" + "vuex": "3.6.0", + "xlsx": "^0.18.5" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.6", diff --git a/jsowell-ui/src/views/homeIndex/echarts.js b/jsowell-ui/src/views/homeIndex/echarts.js index 47a724a96..41ff01a56 100644 --- a/jsowell-ui/src/views/homeIndex/echarts.js +++ b/jsowell-ui/src/views/homeIndex/echarts.js @@ -1,35 +1,70 @@ +import * as XLSX from 'xlsx'; +import { saveAs } from 'file-saver'; + export function barDataView(titleName, fileName) { var dataView = { show: true, readOnly: false, - lang: ['数据视图', '关闭', '刷新'], - optionToContent: function(opt) { - var axisData = opt.xAxis[0].data // 坐标数据 - var series = opt.series // 折线图数据 - var tdHeads = '' + lang: ['数据视图', '关闭', '导出Excel'], + optionToContent: function (opt) { + var axisData = opt.xAxis[0].data; // 坐标数据 + var series = opt.series; // 折线图数据 + var tdHeads = ''; for (let index = 0; index < titleName.length; index++) { - // 样式 - tdHeads += '' + titleName[index] + '' + tdHeads += '' + titleName[index] + ''; } - var tdBodys = '' // 表数据 - var table = '' + tdHeads + ' ' - // 组装表数据 + var tdBodys = ''; // 表数据 + var tableId = 'tableExcel_' + new Date().getTime(); // 动态表格ID + var table = `
${tdHeads}`; + for (var i = 0, l = axisData.length; i < l; i++) { + tdBodys = ''; // 添加坐标轴数据 for (var j = 0; j < series.length; j++) { - var temp = series[j].data[i] + var temp = series[j].data[i]; if (temp != null && temp !== undefined) { - tdBodys += '' + tdBodys += ''; } else { - tdBodys += '' + tdBodys += ''; } } - // 样式 - table += '' + tdBodys + '' - tdBodys = '' + table += '' + tdBodys + ''; } - table += '
' + axisData[i] + '' + temp + '' + temp + '
' + axisData[i] + '
' - return table - } - } - return dataView + table += ''; + return table; + }, + contentToOption: function (html, opt) { + console.log('HTMLDomElement:', html); // 调试信息 + if (!html || !html.tagName) { + console.error('Invalid HTML element passed to contentToOption'); + return opt; + } + + // 获取表格元素 + let tableElement = html.querySelector('table'); + + if (!tableElement) { + console.error('Table element not found within the provided HTML element'); + return opt; + } + + let et = XLSX.utils.table_to_book(tableElement); + let etout = XLSX.write(et, { + bookType: "xlsx", + bookSST: true, + type: "array", + }); + + try { + saveAs( + new Blob([etout], { type: "application/octet-stream" }), + `${fileName}-${new Date().toLocaleString().replace(/[:\/]/g, '-')}.xlsx` + ); + } catch (e) { + console.error("Export failed:", e); + } + + return opt; // 返回原始选项,因为这里没有修改图表的配置 + }, + }; + return dataView; } \ No newline at end of file diff --git a/jsowell-ui/src/views/homeIndex/homeIndex.vue b/jsowell-ui/src/views/homeIndex/homeIndex.vue index 12d7ca098..ec6ff6572 100644 --- a/jsowell-ui/src/views/homeIndex/homeIndex.vue +++ b/jsowell-ui/src/views/homeIndex/homeIndex.vue @@ -1,61 +1,65 @@ @@ -340,43 +356,43 @@ export default { // overflow: scroll; // } .box { - position: relative; - width: 15rem; - display: flex; - height: 6.25rem; - padding: 0.8rem; - /* font-size: 18px; */ - color: #ffffff; - border-radius: 8px; - box-shadow: 0 15px 0.8rem -11px black; - margin-right: 24px; - margin-bottom: 20px; - position: relative; + position: relative; + width: 15rem; + display: flex; + height: 6.25rem; + padding: 0.8rem; + /* font-size: 18px; */ + color: #ffffff; + border-radius: 8px; + box-shadow: 0 15px 0.8rem -11px black; + margin-right: 24px; + margin-bottom: 20px; + position: relative; - .box-image { - position: absolute; - left: 0; - width: 3.75rem; - height: 3.75rem; - // background-size: 100% 100%; - // position: absolute; - // right: 0; - // bottom: 0; - // filter: drop-shadow(40px 0px gray); - } + .box-image { + position: absolute; + left: 0; + width: 3.75rem; + height: 3.75rem; + // background-size: 100% 100%; + // position: absolute; + // right: 0; + // bottom: 0; + // filter: drop-shadow(40px 0px gray); + } - .flex1 { - flex: 1; - margin-left: 48px; - } + .flex1 { + flex: 1; + margin-left: 48px; + } } .box-h1 { - /* margin-top: -14px; */ - font-size: 2rem; + /* margin-top: -14px; */ + font-size: 2rem; } .box-text { - margin-top: 0px; + margin-top: 0px; } 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 2/3] =?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 3/3] =?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,