From 1bccc678461e31a9de3bae5061a653c0c6627055 Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Thu, 5 Aug 2021 17:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=88=E7=AB=AF=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=8E=A5=E5=8F=A3,=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcChargingPileController.java | 40 +- .../XhpcChargingStationController.java | 111 ++-- .../controller/XhpcTerminalController.java | 41 +- .../mapper/XhpcChargingPileMapper.java | 24 +- .../mapper/XhpcChargingStationMapper.java | 73 +-- .../station/mapper/XhpcRateTimeMapper.java | 18 +- .../station/mapper/XhpcTerminalMapper.java | 30 +- .../service/IXhpcChargingPileService.java | 16 +- .../service/IXhpcChargingStationService.java | 58 +- .../station/service/IXhpcRateTimeService.java | 3 +- .../service/XhpcChargingPileServiceImpl.java | 53 +- .../XhpcChargingStationServiceImpl.java | 532 +++++++++--------- .../service/XhpcRateTimeServiceImpl.java | 16 +- .../service/XhpcTerminalServiceImpl.java | 37 +- .../mapper/XhpcChargingPileMapper.xml | 119 ++-- .../mapper/XhpcChargingStationMapper.xml | 306 +++++----- .../resources/mapper/XhpcRateTimeMapper.xml | 55 +- .../resources/mapper/XhpcTerminalMapper.xml | 183 +++--- 18 files changed, 965 insertions(+), 750 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java index 9e4a99a8..906c7f2e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java @@ -25,67 +25,73 @@ public class XhpcChargingPileController extends BaseController { /** * 桩列表 - * @param serialNumber 桩编号 - * @param type 桩类型 - * @param name 桩名称 + * + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 * @return */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/list") - public TableDataInfo list(String name, Integer type,String serialNumber,Long chargingStationId) - { + public TableDataInfo list(String name, Integer type, String serialNumber, Long chargingStationId) { + startPage(); - List> list = xhpcChargingPileService.selectXhpcChargingPileList(name,type,serialNumber,chargingStationId); + List> list = xhpcChargingPileService.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId); return getDataTable(list); } /** * 新增桩 + * * @return */ @PostMapping(value = "/addXhpcChargingPile") - public AjaxResult addXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) - { + public AjaxResult addXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) { + return xhpcChargingPileService.addXhpcChargingPile(xhpcChargingPile); } /** * 编辑桩 + * * @return */ @PostMapping(value = "/updateXhpcChargingPile") - public AjaxResult updateXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) - { + public AjaxResult updateXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) { + return xhpcChargingPileService.updateXhpcChargingPile(xhpcChargingPile); } /** * 桩详情 + * * @return */ @GetMapping(value = "/selectXhpcChargingPile") - public AjaxResult selectXhpcChargingPile(@RequestParam(value = "chargingPileId") Long chargingPileId) - { + public AjaxResult selectXhpcChargingPile(@RequestParam(value = "chargingPileId") Long chargingPileId) { + return xhpcChargingPileService.selectXhpcChargingPile(chargingPileId); } /** * 停用 + * * @return */ @PostMapping(value = "/updateStatus") - public AjaxResult updateStatus(@RequestBody XhpcChargingPile xhpcChargingPile) - { - return xhpcChargingPileService.updateStatus(xhpcChargingPile.getChargingPileId(),xhpcChargingPile.getStatus()); + public AjaxResult updateStatus(@RequestBody XhpcChargingPile xhpcChargingPile) { + + return xhpcChargingPileService.updateStatus(xhpcChargingPile.getChargingPileId(), xhpcChargingPile.getStatus()); } /** * 删除电站 */ @DeleteMapping("/{chargingPileId}") - public AjaxResult remove(@PathVariable Long chargingPileId) - { + public AjaxResult remove(@PathVariable Long chargingPileId) { + return toAjax(xhpcChargingPileService.updateXhpcChargingPileById(chargingPileId)); } + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java index ed7eb38a..e4fb7a3c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java @@ -35,10 +35,10 @@ public class XhpcChargingStationController extends BaseController { */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/list") - public TableDataInfo list(String name,String operatorName) - { + public TableDataInfo list(String name, String operatorName) { + startPage(); - List> list = xhpcChargingStationService.selectXhpcChargingStationList(name,operatorName); + List> list = xhpcChargingStationService.selectXhpcChargingStationList(name, operatorName); return getDataTable(list); } @@ -48,8 +48,7 @@ public class XhpcChargingStationController extends BaseController { @PreAuthorize(hasPermi = "system:station:export") @Log(title = "电站", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, XhpcChargingStation xhpcChargingStation) throws IOException - { + public void export(HttpServletResponse response, XhpcChargingStation xhpcChargingStation) throws IOException { //List list = xhpcChargingStationService.selectXhpcChargingStationList(xhpcChargingStation); //ExcelUtil util = new ExcelUtil(XhpcChargingStation.class); //util.exportExcel(response, list, "电站数据"); @@ -60,8 +59,8 @@ public class XhpcChargingStationController extends BaseController { */ @PreAuthorize(hasPermi = "system:station:query") @GetMapping(value = "/{chargingStationId}") - public AjaxResult getInfo(@PathVariable("chargingStationId") Long chargingStationId) - { + public AjaxResult getInfo(@PathVariable("chargingStationId") Long chargingStationId) { + return AjaxResult.success(xhpcChargingStationService.selectXhpcChargingStationById(chargingStationId)); } @@ -71,8 +70,8 @@ public class XhpcChargingStationController extends BaseController { @PreAuthorize(hasPermi = "system:station:add") @Log(title = "电站", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody XhpcChargingStation xhpcChargingStation) - { + public AjaxResult add(@RequestBody XhpcChargingStation xhpcChargingStation) { + return toAjax(xhpcChargingStationService.insertXhpcChargingStation(xhpcChargingStation)); } @@ -82,8 +81,8 @@ public class XhpcChargingStationController extends BaseController { @PreAuthorize(hasPermi = "system:station:edit") @Log(title = "电站", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody XhpcChargingStation xhpcChargingStation) - { + public AjaxResult edit(@RequestBody XhpcChargingStation xhpcChargingStation) { + return toAjax(xhpcChargingStationService.updateXhpcChargingStation(xhpcChargingStation)); } @@ -93,8 +92,8 @@ public class XhpcChargingStationController extends BaseController { //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @DeleteMapping("/{chargingStationIds}") - public AjaxResult remove(@PathVariable Long chargingStationIds) - { + public AjaxResult remove(@PathVariable Long chargingStationIds) { + return toAjax(xhpcChargingStationService.updateXhpcChargingStationById(chargingStationIds)); } @@ -104,21 +103,22 @@ public class XhpcChargingStationController extends BaseController { //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @PostMapping("/status") - public AjaxResult status(@RequestBody XhpcChargingStation xhpcChargingStation) - { - return toAjax(xhpcChargingStationService.status(xhpcChargingStation.getStatus(),xhpcChargingStation.getChargingStationId())); + public AjaxResult status(@RequestBody XhpcChargingStation xhpcChargingStation) { + + return toAjax(xhpcChargingStationService.status(xhpcChargingStation.getStatus(), xhpcChargingStation.getChargingStationId())); } /** * APP端、小程序是否可见 + * * @return 结果 */ //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @PostMapping("/clientVisible") - public AjaxResult clientVisible(@RequestBody XhpcChargingStation xhpcChargingStation) - { - return toAjax(xhpcChargingStationService.clientVisible(xhpcChargingStation.getType(),xhpcChargingStation.getClientVisible(),xhpcChargingStation.getChargingStationId())); + public AjaxResult clientVisible(@RequestBody XhpcChargingStation xhpcChargingStation) { + + return toAjax(xhpcChargingStationService.clientVisible(xhpcChargingStation.getType(), xhpcChargingStation.getClientVisible(), xhpcChargingStation.getChargingStationId())); } @@ -128,107 +128,116 @@ public class XhpcChargingStationController extends BaseController { //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @GetMapping(value = "/stationInternetBlackList") - public AjaxResult stationInternetBlackList(@RequestParam(value = "chargingStationId",required = true) Long chargingStationId) - { + public AjaxResult stationInternetBlackList(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId) { + return AjaxResult.success(xhpcChargingStationService.stationInternetBlackList(chargingStationId)); } /** * 添加场点 + * * @param xhpcChargingStationDto * @return */ @PostMapping(value = "/addXhpcChargingStation") - public AjaxResult addXhpcChargingStation(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) - { + public AjaxResult addXhpcChargingStation(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) { + return xhpcChargingStationService.addXhpcChargingStation(xhpcChargingStationDto); } /** * 场站详情接口 + * * @param chargingStationId - * @param type 1编辑使用 2详情使用 + * @param type 1编辑使用 2详情使用 * @return */ @GetMapping(value = "/getXhpcChargingStationMessage") - public AjaxResult getXhpcChargingStationMessage(Long chargingStationId,Integer type) - { - return AjaxResult.success(xhpcChargingStationService.getXhpcChargingStationMessage(chargingStationId,type)); + public AjaxResult getXhpcChargingStationMessage(Long chargingStationId, Integer type) { + + return AjaxResult.success(xhpcChargingStationService.getXhpcChargingStationMessage(chargingStationId, type)); } /** * 微信小程序电站列表 - * @param name 电站名称 - * @param serviceFacilities 标签(服务设施) - * @param code 城市id - * @param longitude 经度 - * @param latitude 维度 + * + * @param name 电站名称 + * @param serviceFacilities 标签(服务设施) + * @param code 城市id + * @param longitude 经度 + * @param latitude 维度 * @return */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/getWXList") - public TableDataInfo getWXList(String name,String serviceFacilities,Integer code,String longitude,String latitude) - { + public TableDataInfo getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude) { + startPage(); - List> list = xhpcChargingStationService.getWXList(name,serviceFacilities,code,longitude,latitude); + List> list = xhpcChargingStationService.getWXList(name, serviceFacilities, code, longitude, latitude); return getDataTable(list); } /** * 电站详情+站点详情 - * @param chargingStationId 站点id - * @param longitude 经度 - * @param latitude 维度 + * + * @param chargingStationId 站点id + * @param longitude 经度 + * @param latitude 维度 * @return */ @GetMapping(value = "/getWXXhpcChargingStationMessage") - public AjaxResult getWXXhpcChargingStationMessage(@RequestParam(value = "chargingStationId",required = true)Long chargingStationId,@RequestParam(value = "longitude",required = true)String longitude,@RequestParam(value = "latitude",required = true)String latitude) - { - return AjaxResult.success(xhpcChargingStationService.getWXXhpcChargingStationMessage(chargingStationId,longitude,latitude)); + public AjaxResult getWXXhpcChargingStationMessage(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId, @RequestParam(value = "longitude", required = true) String longitude, @RequestParam(value = "latitude", required = true) String latitude) { + + return AjaxResult.success(xhpcChargingStationService.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude)); } /** * 电站详情---价格详情 - * @param chargingStationId 站点id + * + * @param chargingStationId 站点id * @return */ @GetMapping(value = "/getWXXhpcRateTimeMassage") - public AjaxResult getXhpcRateTimeMassage(@RequestParam(value = "chargingStationId",required = true) Long chargingStationId) - { + public AjaxResult getXhpcRateTimeMassage(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId) { + return AjaxResult.success(xhpcChargingStationService.getWXXhpcRateTimeMassage(chargingStationId)); } /** * 电站详情---终端列表 - * @param chargingStationId 站点id + * + * @param chargingStationId 站点id * @return */ @GetMapping(value = "/getWXXhpcTerminalMassage") - public AjaxResult getWXXhpcTerminalMassage(@RequestParam(value = "chargingStationId",required = true) Long chargingStationId) - { + public AjaxResult getWXXhpcTerminalMassage(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId) { + return AjaxResult.success(xhpcChargingStationService.getWXXhpcTerminalMassage(chargingStationId)); } /** * 编辑电站(基本信息) + * * @return */ @PostMapping(value = "/updateXhpcTerminal") - public AjaxResult updateXhpcTerminal(@RequestBody XhpcChargingStation xhpcChargingStation) - { + public AjaxResult updateXhpcTerminal(@RequestBody XhpcChargingStation xhpcChargingStation) { + return xhpcChargingStationService.updateXhpcTerminal(xhpcChargingStation); } /** * 编辑费率 + * * @return */ @PostMapping(value = "/updateXhpcRateTime") - public AjaxResult updateXhpcRateTime(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) - { + public AjaxResult updateXhpcRateTime(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) { + return xhpcChargingStationService.updateXhpcRateTime(xhpcChargingStationDto); } + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTerminalController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTerminalController.java index 1efcf9d7..f5274d99 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTerminalController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTerminalController.java @@ -25,58 +25,61 @@ public class XhpcTerminalController extends BaseController { /** * 终端列表 - * @param serialNumber 终端编号 - * @param type 桩类型 - * @param status 0启用 1停用 - * @param workStatus 0离线 1故障 2空闲 3充电 + * + * @param serialNumber 终端编号 + * @param type 桩类型 + * @param status 0启用 1停用 + * @param workStatus 0离线 1故障 2空闲 3充电 * @param chargingStationId * @return */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/list") - public TableDataInfo list(String serialNumber, Integer type,Integer status,String workStatus, Long chargingStationId) - { + public TableDataInfo list(String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) { + startPage(); - List> list = xhpcTerminalService.getXhpcTerminalList(serialNumber,type,status,workStatus,chargingStationId); + List> list = xhpcTerminalService.getXhpcTerminalList(serialNumber, type, status, workStatus, chargingStationId); return getDataTable(list); } /** * 停用 + * * @return */ @PostMapping(value = "/updateStatus") - public AjaxResult updateStatus(@RequestBody XhpcTerminal xhpcTerminal) - { - return xhpcTerminalService.updateStatus(xhpcTerminal.getTerminalId(),xhpcTerminal.getStatus()); + public AjaxResult updateStatus(@RequestBody XhpcTerminal xhpcTerminal) { + + return xhpcTerminalService.updateStatus(xhpcTerminal.getTerminalId(), xhpcTerminal.getStatus()); } /** * 查询 */ @GetMapping(value = "/selectXhpcTerminalMessage") - public AjaxResult selectXhpcTerminalMessage(Long terminalId) - { + public AjaxResult selectXhpcTerminalMessage(Long terminalId) { + return xhpcTerminalService.selectXhpcTerminalMessage(terminalId); } /** * 修改 + * * @return */ @PostMapping(value = "/updateXhpcTerminalName") - public AjaxResult updateXhpcTerminalName(@RequestBody XhpcTerminal xhpcTerminal) - { - return xhpcTerminalService.updateXhpcTerminalName(xhpcTerminal.getTerminalId(),xhpcTerminal.getName(),xhpcTerminal.getSerialNumber()); + public AjaxResult updateXhpcTerminalName(@RequestBody XhpcTerminal xhpcTerminal) { + + return xhpcTerminalService.updateXhpcTerminalName(xhpcTerminal.getTerminalId(), xhpcTerminal.getName(), xhpcTerminal.getSerialNumber()); } /** * 终端详情 */ @GetMapping(value = "/selectXhpcTerminalPileMessage") - public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) - { + public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) { + return xhpcTerminalService.selectXhpcTerminalPileMessage(terminalId); } @@ -85,8 +88,8 @@ public class XhpcTerminalController extends BaseController { * 通过终端编号进入小程序开始充电页面 */ @GetMapping(value = "/getWXpNumMessage") - public AjaxResult getWXpNumMessage(@RequestParam(value = "pNum") String pNum) - { + public AjaxResult getWXpNumMessage(@RequestParam(value = "pNum") String pNum) { + return xhpcTerminalService.getWXpNumMessage(pNum); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java index d649ae9d..69173998 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java @@ -15,12 +15,13 @@ public interface XhpcChargingPileMapper { /** * 桩列表 - * @param serialNumber 桩编号 - * @param type 桩类型 - * @param name 桩名称 + * + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 * @return */ - List> selectXhpcChargingPileList(@Param("name") String name, @Param("type")Integer type,@Param("serialNumber") String serialNumber,@Param("chargingStationId")Long chargingStationId); + List> selectXhpcChargingPileList(@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId); /** * 终端 @@ -37,7 +38,7 @@ public interface XhpcChargingPileMapper { * @param chargingStationId 电站ID * @return 电站 */ - Map selectXhpcChargingStationById(Long chargingStationId); + Map selectXhpcChargingStationById(Long chargingStationId); /** * 查询桩 @@ -57,10 +58,11 @@ public interface XhpcChargingPileMapper { /** * 终端列表 - * @param chargingPileId 桩id + * + * @param chargingPileId 桩id * @return */ - List> selectXhpcTerminalList(@Param("chargingPileId") Long chargingPileId); + List> selectXhpcTerminalList(@Param("chargingPileId") Long chargingPileId); /** * 删除桩信息 @@ -68,20 +70,22 @@ public interface XhpcChargingPileMapper { * @param chargingPileId 桩ID * @return 结果 */ - int updateXhpcChargingPileById(@Param("chargingPileId")Long chargingPileId); + int updateXhpcChargingPileById(@Param("chargingPileId") Long chargingPileId); /** * 判断 + * * @param serialNumber * @return */ - int getXhpcChargingPileSerialNumberCount(@Param("serialNumber")String serialNumber); + int getXhpcChargingPileSerialNumberCount(@Param("serialNumber") String serialNumber); /** * 删除终端 + * * @param chargingPileId * @return */ - int updateXhpcTerminal(@Param("chargingPileId")Long chargingPileId); + int updateXhpcTerminal(@Param("chargingPileId") Long chargingPileId); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java index 7d7451b3..686fb72e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingStationMapper.java @@ -25,15 +25,16 @@ public interface XhpcChargingStationMapper { * @param chargingStationId 电站ID * @return 电站 */ - XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId); + XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId); /** * 查询电站列表 - * @param name 电站名称 + * + * @param name 电站名称 * @param operatorName 运营商名称 * @return 电站集合 */ - List> selectXhpcChargingStationList(@Param("name")String name, @Param("operatorName")String operatorName); + List> selectXhpcChargingStationList(@Param("name") String name, @Param("operatorName") String operatorName); /** * 新增电站 @@ -41,7 +42,7 @@ public interface XhpcChargingStationMapper { * @param xhpcChargingStation 电站 * @return 结果 */ - int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation); + int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation); /** * 修改电站 @@ -49,7 +50,7 @@ public interface XhpcChargingStationMapper { * @param xhpcChargingStation 电站 * @return 结果 */ - int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation); + int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation); /** * 删除电站 @@ -57,7 +58,7 @@ public interface XhpcChargingStationMapper { * @param chargingStationId 电站ID * @return 结果 */ - int updateXhpcChargingStationById(Long chargingStationId); + int updateXhpcChargingStationById(Long chargingStationId); /** * 批量删除电站 @@ -65,7 +66,7 @@ public interface XhpcChargingStationMapper { * @param chargingStationIds 需要删除的数据ID * @return 结果 */ - int updateXhpcChargingStationByIds(Long[] chargingStationIds); + int updateXhpcChargingStationByIds(Long[] chargingStationIds); /** * 状态(0启用 1停用) @@ -73,17 +74,17 @@ public interface XhpcChargingStationMapper { * @param status 0启用 1停用 * @return 结果 */ - void status(@Param("status") Integer status,@Param("chargingStationId")Long chargingStationId); + void status(@Param("status") Integer status, @Param("chargingStationId") Long chargingStationId); /** * APP端、小程序是否可见 * - * @param clientVisible app可见值 + * @param clientVisible app可见值 * @param chargingStationId 场站id * @return 结果 */ - void clientVisible(@Param("clientVisible") String clientVisible,@Param("chargingStationId")Long chargingStationId); + void clientVisible(@Param("clientVisible") String clientVisible, @Param("chargingStationId") Long chargingStationId); /** * 合作的电站 @@ -91,7 +92,7 @@ public interface XhpcChargingStationMapper { * @param chargingStationId 电站ID * @return 电站 */ - List> stationInternetBlackList(Long chargingStationId); + List> stationInternetBlackList(Long chargingStationId); /** @@ -100,30 +101,31 @@ public interface XhpcChargingStationMapper { * @param chargingStationId 电站ID * @return 电站 */ - Map getXhpcChargingStationMessage(@Param("chargingStationId")Long chargingStationId); + Map getXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId); /** * 微信小程序电站列表 - * @param name 电站名称 - * @param serviceFacilities 标签集合(服务设施) - * @param code 城市id - * @param longitude 经度 - * @param latitude 维度 - * @param clientVisible 微信小程序是否可见 2可见 + * + * @param name 电站名称 + * @param serviceFacilities 标签集合(服务设施) + * @param code 城市id + * @param longitude 经度 + * @param latitude 维度 + * @param clientVisible 微信小程序是否可见 2可见 * @return */ - List> getWXList(@Param("name") String name,@Param("serviceFacilities")List serviceFacilities,@Param("code")Integer code,@Param("longitude")String longitude,@Param("latitude")String latitude,@Param("clientVisible")Integer clientVisible); + List> getWXList(@Param("name") String name, @Param("serviceFacilities") List serviceFacilities, @Param("code") Integer code, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("clientVisible") Integer clientVisible); /** * 根据code获取数据 * - * @param code 字典code + * @param code 字典code * @param serviceFacilities 筛选条件 * @return 电站 */ - List> getCode(@Param("code")String code,@Param("serviceFacilities")List serviceFacilities); + List> getCode(@Param("code") String code, @Param("serviceFacilities") List serviceFacilities); /** * 电站详情(站点详情) @@ -131,31 +133,34 @@ public interface XhpcChargingStationMapper { * @param chargingStationId 电站ID * @return 电站 */ - Map getWXXhpcChargingStationMessage(@Param("chargingStationId")Long chargingStationId,@Param("longitude")String longitude,@Param("latitude")String latitude); + Map getWXXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId, @Param("longitude") String longitude, @Param("latitude") String latitude); /** * 获取图片信息 + * * @param imgIds * @return */ - List> getImageList(@Param("imgIds")List imgIds); + List> getImageList(@Param("imgIds") List imgIds); /** * 电站详情---价格详情 + * * @param chargingStationId 电站ID * @return 电站 */ - List> getWXXhpcRateTimeMassage(@Param("chargingStationId")Long chargingStationId); + List> getWXXhpcRateTimeMassage(@Param("chargingStationId") Long chargingStationId); /** * 电站详情---终端列表 + * * @param chargingStationId 电站ID * @return 电站 */ - List> getWXXhpcTerminalMassage(@Param("chargingStationId")Long chargingStationId); + List> getWXXhpcTerminalMassage(@Param("chargingStationId") Long chargingStationId); /** @@ -183,46 +188,50 @@ public interface XhpcChargingStationMapper { /** * 返回费率 */ - List> getXhpcRateList(@Param("chargingStationId")Long chargingStationId); + List> getXhpcRateList(@Param("chargingStationId") Long chargingStationId); /** * 返回费率时段(设置时段) */ - List> getXhpcRateTimeTypeList(@Param("chargingStationId")Long chargingStationId,@Param("type")Integer type); + List> getXhpcRateTimeTypeList(@Param("chargingStationId") Long chargingStationId, @Param("type") Integer type); /** * 今日充电量、今日充电用户、今日充电次数 */ - Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId")Long chargingStationId); + Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId") Long chargingStationId); /** * 删除之前的费率 + * * @param chargingStationId * @return */ - int updateXhpcRate(@Param("chargingStationId")Long chargingStationId); + int updateXhpcRate(@Param("chargingStationId") Long chargingStationId); /** * 删除之前的费率时段 + * * @param chargingStationId * @return */ - int updateXhpcRateTime(@Param("chargingStationId")Long chargingStationId); + int updateXhpcRateTime(@Param("chargingStationId") Long chargingStationId); /** * 根据场站id获取桩编号 + * * @param chargingStationId * @return */ - Set getXchargingPileList(@Param("chargingStationId")Long chargingStationId); + Set getXchargingPileList(@Param("chargingStationId") Long chargingStationId); /** * 按照没30分钟为一段进行分组 + * * @param chargingStationId * @return */ - List> getXhpcRateTimeNumber(@Param("chargingStationId")Long chargingStationId); + List> getXhpcRateTimeNumber(@Param("chargingStationId") Long chargingStationId); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateTimeMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateTimeMapper.java index fbc21ee8..77a30d78 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateTimeMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateTimeMapper.java @@ -9,27 +9,29 @@ public interface XhpcRateTimeMapper { /** * 判断本时间段的电费 - * @param date 本地时间(时分秒) - * @param datchargingStationId 电站id + * + * @param date 本地时间(时分秒) + * @param datchargingStationId 电站id * @return */ - Map getXhpcRateTime(@Param("date")String date,@Param("datchargingStationId")Long datchargingStationId); + Map getXhpcRateTime(@Param("date") String date, @Param("datchargingStationId") Long datchargingStationId); /** * 获取在这个时间段的费率 - * @param datchargingStationId 电站id + * + * @param datchargingStationId 电站id * @return */ - Map getXhpcTimeType(@Param("datchargingStationId")Long datchargingStationId,@Param("rateId")Long rateId); + Map getXhpcTimeType(@Param("datchargingStationId") Long datchargingStationId, @Param("rateId") Long rateId); /** * 获取剩余时间费率 - * @param datchargingStationId 电站id + * + * @param datchargingStationId 电站id * @return */ - Map getXhpcRateTimeType(@Param("datchargingStationId")Long datchargingStationId); - + Map getXhpcRateTimeType(@Param("datchargingStationId") Long datchargingStationId); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTerminalMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTerminalMapper.java index f71e1b07..30ea9253 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTerminalMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcTerminalMapper.java @@ -19,21 +19,23 @@ public interface XhpcTerminalMapper { /** * PC端页面统计 + * * @param chargingStationId 电站id * @return */ - Map countXhpcTerminalWorkStatus(Long chargingStationId); + Map countXhpcTerminalWorkStatus(Long chargingStationId); /** * 终端列表 - * @param serialNumber 终端编号 - * @param type 桩类型 - * @param status 0启用 1停用 - * @param workStatus 0离线 1故障 2空闲 3充电 + * + * @param serialNumber 终端编号 + * @param type 桩类型 + * @param status 0启用 1停用 + * @param workStatus 0离线 1故障 2空闲 3充电 * @param chargingStationId * @return */ - List> getXhpcTerminalList(@Param("serialNumber") String serialNumber,@Param("type") Integer type,@Param("status") Integer status, @Param("workStatus")String workStatus,@Param("chargingStationId") Long chargingStationId); + List> getXhpcTerminalList(@Param("serialNumber") String serialNumber, @Param("type") Integer type, @Param("status") Integer status, @Param("workStatus") String workStatus, @Param("chargingStationId") Long chargingStationId); /** @@ -60,33 +62,37 @@ public interface XhpcTerminalMapper { * @return 结果 */ int addXhpcTerminal(XhpcTerminal xhpcTerminal); + /** * 终端详情 */ - Map selectXhpcTerminalPileMessage(Long terminalId); + Map selectXhpcTerminalPileMessage(Long terminalId); /** * 返回费率时段(设置时段) */ - List> getXhpcRateTimeTypeList(@Param("chargingStationId")Long chargingStationId,@Param("type")Integer type); + List> getXhpcRateTimeTypeList(@Param("chargingStationId") Long chargingStationId, @Param("type") Integer type); /** * 今日充电量、今日充电用户、今日充电次数 */ - Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId")Long chargingStationId,@Param("gunNumber")String gunNumber); + Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId") Long chargingStationId, @Param("gunNumber") String gunNumber); /** * 通过终端编号进入小程序开始充电页面 - * @param pNum 终端编号 + * + * @param pNum 终端编号 * @return */ - Map getWXpNumMessage(@Param("pNum")String pNum); + Map getWXpNumMessage(@Param("pNum") String pNum); /** * 获取图片信息 + * * @param imgIds * @return */ - List> getImageList(@Param("imgIds")List imgIds); + List> getImageList(@Param("imgIds") List imgIds); + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java index 12f63d29..f6aeca41 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java @@ -14,16 +14,18 @@ public interface IXhpcChargingPileService { /** * 桩列表 - * @param serialNumber 桩编号 - * @param type 桩类型 - * @param name 桩名称 + * + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 * @return */ - List> selectXhpcChargingPileList(String name, Integer type, String serialNumber,Long chargingStationId); + List> selectXhpcChargingPileList(String name, Integer type, String serialNumber, Long chargingStationId); /** * 添加桩 + * * @param * @return */ @@ -31,6 +33,7 @@ public interface IXhpcChargingPileService { /** * 编辑桩 + * * @param * @return */ @@ -38,6 +41,7 @@ public interface IXhpcChargingPileService { /** * 桩详情 + * * @param * @return */ @@ -45,9 +49,10 @@ public interface IXhpcChargingPileService { /** * 停用 + * * @return */ - AjaxResult updateStatus(Long chargingPileId,Integer status); + AjaxResult updateStatus(Long chargingPileId, Integer status); /** @@ -57,4 +62,5 @@ public interface IXhpcChargingPileService { * @return 结果 */ int updateXhpcChargingPileById(Long chargingPileId); + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java index d968a057..6bce0bbb 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingStationService.java @@ -21,16 +21,16 @@ public interface IXhpcChargingStationService { * @param chargingStationId 电站ID * @return 电站 */ - XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId); + XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId); /** * 查询电站列表 * - * @param name 电站名称 + * @param name 电站名称 * @param operatorName 运营商名称 * @return 电站集合 */ - List> selectXhpcChargingStationList(String name,String operatorName); + List> selectXhpcChargingStationList(String name, String operatorName); /** * 新增电站 @@ -38,7 +38,7 @@ public interface IXhpcChargingStationService { * @param xhpcChargingStation 电站 * @return 结果 */ - int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation); + int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation); /** * 修改电站 @@ -46,7 +46,7 @@ public interface IXhpcChargingStationService { * @param xhpcChargingStation 电站 * @return 结果 */ - int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation); + int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation); /** * 批量删除电站 @@ -54,7 +54,7 @@ public interface IXhpcChargingStationService { * @param chargingStationIds 需要删除的电站ID * @return 结果 */ - int updateXhpcChargingStationByIds(Long[] chargingStationIds); + int updateXhpcChargingStationByIds(Long[] chargingStationIds); /** * 删除电站信息 @@ -62,26 +62,26 @@ public interface IXhpcChargingStationService { * @param chargingStationId 电站ID * @return 结果 */ - int updateXhpcChargingStationById(Long chargingStationId); + int updateXhpcChargingStationById(Long chargingStationId); /** * 状态(0启用 1停用) * - * @param status 0启用 1停用 + * @param status 0启用 1停用 * @param chargingStationId 场站id * @return 结果 */ - int status(Integer status,Long chargingStationId); + int status(Integer status, Long chargingStationId); /** * APP端、小程序是否可见 * - * @param type 0可见 1不可见 - * @param clientVisible 值 + * @param type 0可见 1不可见 + * @param clientVisible 值 * @param chargingStationId 场站id * @return 结果 */ - int clientVisible(Integer type,String clientVisible,Long chargingStationId); + int clientVisible(Integer type, String clientVisible, Long chargingStationId); /** * 合作的电站 @@ -89,10 +89,11 @@ public interface IXhpcChargingStationService { * @param chargingStationId 电站ID * @return 电站 */ - public List> stationInternetBlackList(Long chargingStationId); + public List> stationInternetBlackList(Long chargingStationId); /** * 添加场点 + * * @param xhpcChargingStationDto * @return */ @@ -105,18 +106,19 @@ public interface IXhpcChargingStationService { * @param chargingStationId 电站ID * @return 电站 */ - Map getXhpcChargingStationMessage(Long chargingStationId,Integer type); + Map getXhpcChargingStationMessage(Long chargingStationId, Integer type); /** * 微信小程序电站列表 - * @param name 电站名称 - * @param serviceFacilities 标签(服务设施) - * @param code 城市id - * @param longitude 经度 - * @param latitude 维度 + * + * @param name 电站名称 + * @param serviceFacilities 标签(服务设施) + * @param code 城市id + * @param longitude 经度 + * @param latitude 维度 * @return */ - List> getWXList(String name,String serviceFacilities,Integer code,String longitude,String latitude); + List> getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude); /** @@ -125,26 +127,29 @@ public interface IXhpcChargingStationService { * @param chargingStationId 电站ID * @return 电站 */ - Map getWXXhpcChargingStationMessage(Long chargingStationId,String longitude,String latitude); + Map getWXXhpcChargingStationMessage(Long chargingStationId, String longitude, String latitude); /** * 电站详情---价格详情 + * * @param chargingStationId 电站ID * @return 电站 */ - List> getWXXhpcRateTimeMassage(Long chargingStationId); + List> getWXXhpcRateTimeMassage(Long chargingStationId); /** * 电站详情---终端列表 + * * @param chargingStationId 电站ID * @return 电站 */ - List> getWXXhpcTerminalMassage(Long chargingStationId); + List> getWXXhpcTerminalMassage(Long chargingStationId); /** * 编辑电站(基本信息) + * * @param * @return */ @@ -152,6 +157,7 @@ public interface IXhpcChargingStationService { /** * 编辑电站(编辑费率) + * * @param * @return */ @@ -159,8 +165,10 @@ public interface IXhpcChargingStationService { /** * 上传桩编号和删除编号 - * @param status 0启用 1停用 - * @param chargingStationId 场站id + * + * @param status 0启用 1停用 + * @param chargingStationId 场站id */ void extracted(Integer status, Long chargingStationId); + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateTimeService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateTimeService.java index 24ecfab8..84dc664a 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateTimeService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateTimeService.java @@ -15,9 +15,10 @@ public interface IXhpcRateTimeService { /** * 获取本时间段的电费 + * * @param date * @return */ - public Map getXhpcRateTime(String date,Long datchargingStationIde); + public Map getXhpcRateTime(String date, Long datchargingStationIde); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java index 640021fb..c01f5d9c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -17,7 +17,7 @@ import java.util.*; * @date 2021/7/27 14:36 */ @Service -public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ +public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService { @Autowired private XhpcChargingPileMapper xhpcChargingPileMapper; @@ -29,14 +29,16 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ /** * 桩列表 - * @param serialNumber 桩编号 - * @param type 桩类型 - * @param name 桩名称 + * + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 * @return */ @Override - public List> selectXhpcChargingPileList(String name, Integer type, String serialNumber, Long chargingStationId) { - return xhpcChargingPileMapper.selectXhpcChargingPileList(name,type,serialNumber,chargingStationId); + public List> selectXhpcChargingPileList(String name, Integer type, String serialNumber, Long chargingStationId) { + + return xhpcChargingPileMapper.selectXhpcChargingPileList(name, type, serialNumber, chargingStationId); } @Override @@ -51,7 +53,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ String serialNumber = xhpcChargingPile.getSerialNumber(); //判断桩编号是否重复 int count = xhpcChargingPileMapper.getXhpcChargingPileSerialNumberCount(serialNumber); - if(count>0){ + if (count > 0) { return AjaxResult.error("桩编号重复"); } @@ -59,15 +61,15 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ //桩 xhpcChargingPileMapper.addXhpcChargingPile(xhpcChargingPile); //终端 - Long chargingPileId=xhpcChargingPile.getChargingPileId(); + Long chargingPileId = xhpcChargingPile.getChargingPileId(); - if(xhpcChargingPile.getGunNumber()>0){ + if (xhpcChargingPile.getGunNumber() > 0) { for (int i = 0; i < xhpcChargingPile.getGunNumber(); i++) { - XhpcTerminal xhpcTerminal =new XhpcTerminal(); + XhpcTerminal xhpcTerminal = new XhpcTerminal(); xhpcTerminal.setChargingStationId(chargingStationId); xhpcTerminal.setChargingPileId(chargingPileId); xhpcTerminal.setName(serialNumber + "-" + (i)); - xhpcTerminal.setSerialNumber(serialNumber+ "0" + i); + xhpcTerminal.setSerialNumber(serialNumber + "0" + i); xhpcTerminal.setPileSerialNumber(serialNumber); xhpcTerminal.setWorkStatus(2); xhpcTerminal.setStatus(0); @@ -89,26 +91,26 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ Long chargingPileId = xhpcChargingPile.getChargingPileId(); XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); - if(xhpcChargingPile.getSerialNumber() ==null){ + if (xhpcChargingPile.getSerialNumber() == null) { return AjaxResult.error("桩编号不能为空"); } - if(xhpc.getSerialNumber() != xhpc.getSerialNumber()){ + if (xhpc.getSerialNumber() != xhpc.getSerialNumber()) { return AjaxResult.error("桩编号不能编辑"); } - if(!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())){ + if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())) { //删除之前的终端 xhpcChargingPileMapper.updateXhpcTerminal(chargingPileId); String serialNumber = xhpcChargingPile.getSerialNumber(); Long chargingStationId = xhpcChargingPile.getChargingStationId(); - if(xhpcChargingPile.getGunNumber()>0){ + if (xhpcChargingPile.getGunNumber() > 0) { for (int i = 0; i < xhpcChargingPile.getGunNumber(); i++) { - XhpcTerminal xhpcTerminal =new XhpcTerminal(); + XhpcTerminal xhpcTerminal = new XhpcTerminal(); xhpcTerminal.setChargingStationId(chargingStationId); xhpcTerminal.setChargingPileId(chargingPileId); xhpcTerminal.setName(serialNumber + "-" + (i)); - xhpcTerminal.setSerialNumber(serialNumber+ "0" + i); + xhpcTerminal.setSerialNumber(serialNumber + "0" + i); xhpcTerminal.setPileSerialNumber(serialNumber); xhpcTerminal.setWorkStatus(2); xhpcTerminal.setStatus(0); @@ -126,18 +128,20 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ @Override public AjaxResult selectXhpcChargingPile(Long chargingPileId) { + XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); //终端信息 - Map map = new HashMap<>(); + Map map = new HashMap<>(); List> list = xhpcChargingPileMapper.selectXhpcTerminalList(chargingPileId); - map.put("chargingPile",xhpc); - map.put("terminal",list); + map.put("chargingPile", xhpc); + map.put("terminal", list); return AjaxResult.success(map); } @Override public AjaxResult updateStatus(Long chargingPileId, Integer status) { + XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); xhpc.setStatus(status); xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc); @@ -146,13 +150,14 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ @Override public int updateXhpcChargingPileById(Long chargingPileId) { + XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); int i = xhpcChargingPileMapper.updateXhpcChargingPileById(chargingPileId); - if (i>0) { + if (i > 0) { //删除桩 - Set set =new HashSet<>(); - set.add(chargingPileId+""); - powerPileService.deletePileWhitelist(xhpc.getChargingStationId(),set); + Set set = new HashSet<>(); + set.add(chargingPileId + ""); + powerPileService.deletePileWhitelist(xhpc.getChargingStationId(), set); return 1; } return 0; diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 8fa12bee..932369d7 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -33,7 +33,7 @@ import java.util.regex.Pattern; * @date 2021-07-19 */ @Service -public class XhpcChargingStationServiceImpl implements IXhpcChargingStationService{ +public class XhpcChargingStationServiceImpl implements IXhpcChargingStationService { @Autowired private XhpcChargingStationMapper xhpcChargingStationMapper; @@ -51,36 +51,35 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi * @return 电站 */ @Override - public XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId) - { + public XhpcChargingStation selectXhpcChargingStationById(Long chargingStationId) { + return xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); } /** * 查询电站列表 * - * @param name 电站名称 + * @param name 电站名称 * @param operatorName 运营商名称 * @return 电站 */ @Override - public List> selectXhpcChargingStationList(String name,String operatorName) - { + public List> selectXhpcChargingStationList(String name, String operatorName) { //桩的统计、该时段金额 - List> list = xhpcChargingStationMapper.selectXhpcChargingStationList(name,operatorName); + List> list = xhpcChargingStationMapper.selectXhpcChargingStationList(name, operatorName); for (int i = 0; i < list.size(); i++) { - Map map = list.get(i); + Map map = list.get(i); Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString()); //获取该时段电费 //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId); - if(xhpcRateTime!=null){ + if (xhpcRateTime != null) { map.putAll(xhpcRateTime); } //获取桩的统计 Map chargingId = xhpcTerminalService.countXhpcTerminalWorkStatus(chargingStationId); - if(chargingId!=null){ + if (chargingId != null) { map.putAll(chargingId); } } @@ -94,8 +93,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi * @return 结果 */ @Override - public int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation) - { + public int insertXhpcChargingStation(XhpcChargingStation xhpcChargingStation) { + xhpcChargingStation.setCreateTime(DateUtils.getNowDate()); return xhpcChargingStationMapper.insertXhpcChargingStation(xhpcChargingStation); } @@ -107,8 +106,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi * @return 结果 */ @Override - public int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation) - { + public int updateXhpcChargingStation(XhpcChargingStation xhpcChargingStation) { + xhpcChargingStation.setUpdateTime(DateUtils.getNowDate()); return xhpcChargingStationMapper.updateXhpcChargingStation(xhpcChargingStation); } @@ -120,8 +119,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi * @return 结果 */ @Override - public int updateXhpcChargingStationByIds(Long[] chargingStationIds) - { + public int updateXhpcChargingStationByIds(Long[] chargingStationIds) { + return xhpcChargingStationMapper.updateXhpcChargingStationByIds(chargingStationIds); } @@ -132,11 +131,11 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi * @return 结果 */ @Override - public int updateXhpcChargingStationById(Long chargingStationId) - { + public int updateXhpcChargingStationById(Long chargingStationId) { + int i = xhpcChargingStationMapper.updateXhpcChargingStationById(chargingStationId); - if (i>0) { - extracted(1,chargingStationId); + if (i > 0) { + extracted(1, chargingStationId); } return i; } @@ -144,14 +143,15 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi /** * 状态(0正常 1停用) * - * @param status 0正常 1停用 + * @param status 0正常 1停用 * @param chargingStationId 场站id * @return 结果 */ @Override - public int status(Integer status,Long chargingStationId) { - if(status !=null && (status ==0 || status==1)){ - xhpcChargingStationMapper.status(status,chargingStationId); + public int status(Integer status, Long chargingStationId) { + + if (status != null && (status == 0 || status == 1)) { + xhpcChargingStationMapper.status(status, chargingStationId); extracted(status, chargingStationId); return 1; } @@ -159,12 +159,11 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi } - /** * APP端、小程序是否可见 * - * @param type 0可见 1不可见 - * @param clientVisible 值 + * @param type 0可见 1不可见 + * @param clientVisible 值 * @param chargingStationId 场站id * @return 结果 */ @@ -172,25 +171,25 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi public int clientVisible(Integer type, String clientVisible, Long chargingStationId) { //判断状态 - if(type !=null && (type ==0 || type==1)){ + if (type != null && (type == 0 || type == 1)) { //获取场站数据 XhpcChargingStation xhpcChargingStation = xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); String clientVisibleValue = xhpcChargingStation.getClientVisible(); - if(clientVisibleValue ==null || clientVisibleValue ==""){ - if(type ==0){ - xhpcChargingStationMapper.clientVisible(clientVisible,chargingStationId); + if (clientVisibleValue == null || clientVisibleValue == "") { + if (type == 0) { + xhpcChargingStationMapper.clientVisible(clientVisible, chargingStationId); } - }else{ + } else { //去掉重复的值 String[] split = clientVisibleValue.split(","); - Set set= new HashSet<>(Arrays.asList(split)); - if(type ==0){ + Set set = new HashSet<>(Arrays.asList(split)); + if (type == 0) { set.add(clientVisible); - }else{ + } else { set.remove(clientVisible); } String str = String.join(",", set); - xhpcChargingStationMapper.clientVisible(str,chargingStationId); + xhpcChargingStationMapper.clientVisible(str, chargingStationId); } return 1; } @@ -198,7 +197,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi } @Override - public List> stationInternetBlackList(Long chargingStationId) { + public List> stationInternetBlackList(Long chargingStationId) { + return xhpcChargingStationMapper.stationInternetBlackList(chargingStationId); } @@ -206,51 +206,52 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi @Transactional public AjaxResult addXhpcChargingStation(XhpcChargingStationDto xhpcChargingStationDto) { - if(xhpcChargingStationDto.getName()==null || "".equals(xhpcChargingStationDto.getName())){ - return AjaxResult.error(1001,"电站名称不能为空"); + if (xhpcChargingStationDto.getName() == null || "".equals(xhpcChargingStationDto.getName())) { + return AjaxResult.error(1001, "电站名称不能为空"); } - if(xhpcChargingStationDto.getOperatorId()==null){ - return AjaxResult.error(1001,"运营商不能为空"); + if (xhpcChargingStationDto.getOperatorId() == null) { + return AjaxResult.error(1001, "运营商不能为空"); } - if(xhpcChargingStationDto.getAreaCode()==null){ - return AjaxResult.error(1001,"电站地址不能为空"); + if (xhpcChargingStationDto.getAreaCode() == null) { + return AjaxResult.error(1001, "电站地址不能为空"); } - if(xhpcChargingStationDto.getAddress()==null){ - return AjaxResult.error(1001,"详细地址不能为空"); + if (xhpcChargingStationDto.getAddress() == null) { + return AjaxResult.error(1001, "详细地址不能为空"); } - if(xhpcChargingStationDto.getServiceFacilities()==null){ - return AjaxResult.error(1001,"服务设施不能为空"); + if (xhpcChargingStationDto.getServiceFacilities() == null) { + return AjaxResult.error(1001, "服务设施不能为空"); } - if(xhpcChargingStationDto.getSerialNumber()==null){ - return AjaxResult.error(1001,"站编号不能为空"); + if (xhpcChargingStationDto.getSerialNumber() == null) { + return AjaxResult.error(1001, "站编号不能为空"); } - if(xhpcChargingStationDto.getParkingInstructions()==null){ - return AjaxResult.error(1001,"停车说明不能为空"); + if (xhpcChargingStationDto.getParkingInstructions() == null) { + return AjaxResult.error(1001, "停车说明不能为空"); } - if(xhpcChargingStationDto.getBusinessInstructions()==null){ - return AjaxResult.error(1001,"营业时间说明不能为空"); + if (xhpcChargingStationDto.getBusinessInstructions() == null) { + return AjaxResult.error(1001, "营业时间说明不能为空"); } - if(xhpcChargingStationDto.getReminderInstructions()==null){ - return AjaxResult.error(1001,"温馨提示说明不能为空"); + if (xhpcChargingStationDto.getReminderInstructions() == null) { + return AjaxResult.error(1001, "温馨提示说明不能为空"); } - if(xhpcChargingStationDto.getRemark()==null){ - return AjaxResult.error(1001,"备注不能为空"); + if (xhpcChargingStationDto.getRemark() == null) { + return AjaxResult.error(1001, "备注不能为空"); } - if(xhpcChargingStationDto.getImgId()==null){ - return AjaxResult.error(1001,"图片不能为空"); + if (xhpcChargingStationDto.getImgId() == null) { + return AjaxResult.error(1001, "图片不能为空"); } //判断费率和费率时间段 是否有值 - if(xhpcChargingStationDto.getXhpcRateList() ==null && xhpcChargingStationDto.getXhpcRateList().size()==0){ - return AjaxResult.error(1001,"费率不能为空"); + if (xhpcChargingStationDto.getXhpcRateList() == null && xhpcChargingStationDto.getXhpcRateList().size() == 0) { + return AjaxResult.error(1001, "费率不能为空"); } - if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){ - return AjaxResult.error(1001,"费率时段不能为空"); - }else{ + if (xhpcChargingStationDto.getXhpcRateTimeList() == null && xhpcChargingStationDto.getXhpcRateTimeList().size() == 0) { + return AjaxResult.error(1001, "费率时段不能为空"); + } else { for (int i = 0; i < xhpcChargingStationDto.getXhpcRateTimeList().size(); i++) { String id = xhpcChargingStationDto.getXhpcRateTimeList().get(i).getId(); - if("00".equals(id)||"01".equals(id)||"02".equals(id)||"03".equals(id)){}else{ - return AjaxResult.error("1003","费率id格式不对"); + if ("00".equals(id) || "01".equals(id) || "02".equals(id) || "03".equals(id)) { + } else { + return AjaxResult.error("1003", "费率id格式不对"); } } } @@ -262,27 +263,28 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi String end = xhpcRateTime.getEndTime(); String id = xhpcRateTime.getId(); //检查格式,正则验证 【[0-2][0-9]:[0-6][0]:[0]{2}】 - String pattern ="^([0-2][0-9]:([0]|[3])[0]:[0][0])"; + String pattern = "^([0-2][0-9]:([0]|[3])[0]:[0][0])"; Pattern compile = Pattern.compile(pattern); - Matcher m =compile.matcher(start); + Matcher m = compile.matcher(start); - if("00".equals(id)||"01".equals(id)||"02".equals(id)||"03".equals(id)){}else{ - return AjaxResult.error("1003","费率id格式不对"); + if ("00".equals(id) || "01".equals(id) || "02".equals(id) || "03".equals(id)) { + } else { + return AjaxResult.error("1003", "费率id格式不对"); } boolean isMatch = m.matches(); - if(!isMatch){ - return AjaxResult.error("1003","时间格式不对"); + if (!isMatch) { + return AjaxResult.error("1003", "时间格式不对"); } - Matcher m1 =compile.matcher(end); + Matcher m1 = compile.matcher(end); boolean isMatch1 = m1.matches(); - if(!isMatch1){ - return AjaxResult.error("1003","时间格式不对"); + if (!isMatch1) { + return AjaxResult.error("1003", "时间格式不对"); } //判断结束时间是否小于开始时间 Date startTime = DateUtil.parse(start); Date endTime = DateUtil.parse(end); - if(startTime.getTime()>endTime.getTime()){ - return AjaxResult.error("1002","开始时间不能大于结束时间"); + if (startTime.getTime() > endTime.getTime()) { + return AjaxResult.error("1002", "开始时间不能大于结束时间"); } } //判断是否有重叠 @@ -290,50 +292,50 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi XhpcRateTimeDto xhpcRateTimeOne = xhpcRateTimeList.get(i); Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime()); Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime()); - for (int j = i+1; j < xhpcRateTimeList.size(); j++) { + for (int j = i + 1; j < xhpcRateTimeList.size(); j++) { XhpcRateTimeDto xhpcRateTimeTwo = xhpcRateTimeList.get(j); Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime()); Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime()); - if (DateUtil.compare(startOne, endTwo)<0&&DateUtil.compare(startTwo, endOne)<0){ - return AjaxResult.error("1004","时间段有重叠"); + if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) { + return AjaxResult.error("1004", "时间段有重叠"); } } } //添加费率计费模型 XhpcRateModel xhpcRateModel = new XhpcRateModel(); - BeanUtils.copyProperties(xhpcChargingStationDto,xhpcRateModel); + BeanUtils.copyProperties(xhpcChargingStationDto, xhpcRateModel); int i = xhpcChargingStationMapper.addXhpcRateModel(xhpcRateModel); - if(i==0){ - return AjaxResult.error("1005","费率计费模型添加失败"); + if (i == 0) { + return AjaxResult.error("1005", "费率计费模型添加失败"); } //费率模型id Long rateModelId = xhpcRateModel.getRateModelId(); //添加电站基本信息 - XhpcChargingStation xhpcChargingStation =new XhpcChargingStation(); - BeanUtils.copyProperties(xhpcChargingStationDto,xhpcChargingStation); + XhpcChargingStation xhpcChargingStation = new XhpcChargingStation(); + BeanUtils.copyProperties(xhpcChargingStationDto, xhpcChargingStation); xhpcChargingStation.setRateModelId(rateModelId); int j = xhpcChargingStationMapper.addXhpcChargingStation(xhpcChargingStation); - if(j==0){ - return AjaxResult.error("1006","电站基本信息添加失败"); + if (j == 0) { + return AjaxResult.error("1006", "电站基本信息添加失败"); } Long chargingStationId = xhpcChargingStation.getChargingStationId(); //添加费率 - Map map =new HashMap<>(); + Map map = new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id XhpcRateDto xhpcRateDto = xhpcRateList.get(k); - XhpcRate xhpcRate =new XhpcRate(); + XhpcRate xhpcRate = new XhpcRate(); xhpcRate.setChargingStationId(chargingStationId); - if("00".equals(xhpcRateDto.getId())){ + if ("00".equals(xhpcRateDto.getId())) { xhpcRate.setName("尖费率"); - }else if ("01".equals(xhpcRateDto.getId())){ + } else if ("01".equals(xhpcRateDto.getId())) { xhpcRate.setName("峰费率"); - }else if ("02".equals(xhpcRateDto.getId())){ + } else if ("02".equals(xhpcRateDto.getId())) { xhpcRate.setName("平费率"); - }else{ + } else { xhpcRate.setName("谷费率"); } xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); @@ -341,7 +343,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setRateModelId(rateModelId); xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); - map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); + map.put(xhpcRateDto.getId(), xhpcRate.getRateId()); } //添加费率时段 @@ -349,22 +351,22 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi //存费率时段,从Map中获取费率id //每个时间段都要存 //返回计费模型 24:00 转成 00:00 - XhpcRateTimeDto [] xhpcRateTimeDtosArr =new XhpcRateTimeDto[xhpcRateTimeList.size()]; + XhpcRateTimeDto[] xhpcRateTimeDtosArr = new XhpcRateTimeDto[xhpcRateTimeList.size()]; xhpcRateTimeList.toArray(xhpcRateTimeDtosArr); - XhpcRateTimeDto [] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr); + XhpcRateTimeDto[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr); //排序好的费率时段 List list = Arrays.asList(xhpcRateTimeDtos); //默认时段费率Id - Long defaultPeriodId=null; - if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ - defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); + Long defaultPeriodId = null; + if (xhpcChargingStationDto.getDefaultPeriodId() != null) { + defaultPeriodId = map.get(xhpcChargingStationDto.getDefaultPeriodId()); } //默认费率类型值 - String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); + String rateValue = xhpcChargingStationDto.getDefaultPeriodId(); String[] tfPricesSeq = new String[48]; - int number =0; - int sort =1; + int number = 0; + int sort = 1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); @@ -372,81 +374,81 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi String rateValues = xhpcRateTimeDto.getId(); Long defaultPeriodIdMap = map.get(rateValues); - if(k==0){ - if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ + if (k == 0) { + if (!"00:00:00".equals(xhpcRateTimeDto.getStartTime())) { //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); + sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, "00:00:00", startTime, sort, 2, rateValue); //时间差 long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse(startTime), DateUnit.SECOND); int day1 = Math.toIntExact(betweenDay / 1800); for (int l = 0; l < day1; l++) { - tfPricesSeq[number] =rateValue; - number=number+1; + tfPricesSeq[number] = rateValue; + number = number + 1; } } - //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); + //并把本条数据也添加上 + sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); //时间差 long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND); int day2 = Math.toIntExact(betweenDay / 1800); for (int l = 0; l < day2; l++) { - tfPricesSeq[number] =rateValues; - number=number+1; + tfPricesSeq[number] = rateValues; + number = number + 1; } - }else if(k getXhpcChargingStationMessage(Long chargingStationId,Integer type) { + public Map getXhpcChargingStationMessage(Long chargingStationId, Integer type) { Map map = xhpcChargingStationMapper.getXhpcChargingStationMessage(chargingStationId); //图片信息 - List imgList =new ArrayList<>(); - if(map.get("imgId") !=null && map.get("imgId").toString() !=""){ + List imgList = new ArrayList<>(); + if (map.get("imgId") != null && map.get("imgId").toString() != "") { String[] split = map.get("imgId").toString().split(","); - imgList=Arrays.asList(split); + imgList = Arrays.asList(split); List> imgLists = xhpcChargingStationMapper.getImageList(imgList); - map.put("imgIdList",imgLists); - }else{ - map.put("imgIdList",new ArrayList<>()); + map.put("imgIdList", imgLists); + } else { + map.put("imgIdList", new ArrayList<>()); } //费率 List> xhpcRateList = xhpcChargingStationMapper.getXhpcRateList(chargingStationId); @@ -536,7 +539,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi List> xhpcRateTimeTypeList = xhpcChargingStationMapper.getXhpcRateTimeTypeList(chargingStationId, 1); xhpcRateTimeTypeList.addAll(xhpcChargingStationMapper.getXhpcRateTimeTypeList(chargingStationId, 2)); map.put("xhpcRateTimeList", xhpcRateTimeTypeList); - if(type ==2){ + if (type == 2) { //统计终端(充redis获取终端信息) map.putAll(xhpcChargingStationMapper.getXhpcRateTimeOrderStatistics(chargingStationId)); @@ -544,8 +547,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi return map; } - private int addXhpcRateTime(Long chargingStationId,Long rateModelId, Long defaultPeriodId,String startTime,String endTime, int sort,int type,String rateValue) { - XhpcRateTime xhpcRateTime =new XhpcRateTime(); + private int addXhpcRateTime(Long chargingStationId, Long rateModelId, Long defaultPeriodId, String startTime, String endTime, int sort, int type, String rateValue) { + + XhpcRateTime xhpcRateTime = new XhpcRateTime(); xhpcRateTime.setChargingStationId(chargingStationId); xhpcRateTime.setRateId(defaultPeriodId); Date start = DateUtil.parse(startTime); @@ -557,65 +561,65 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRateTime.setType(type); xhpcRateTime.setRateValue(rateValue); xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime); - sort=sort+1; + sort = sort + 1; return sort; } @Override public List> getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude) { - List stringList =new ArrayList<>(); - if(serviceFacilities !=null && serviceFacilities !=""){ + List stringList = new ArrayList<>(); + if (serviceFacilities != null && serviceFacilities != "") { String[] split = serviceFacilities.split(","); - stringList=Arrays.asList(split); + stringList = Arrays.asList(split); } - List> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude,2); - if(list !=null && list.size()>0){ + List> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2); + if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { - Map map = list.get(i); + Map map = list.get(i); Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString()); //获取该时段电费 //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId); - if(xhpcRateTime!=null){ + if (xhpcRateTime != null) { map.putAll(xhpcRateTime); } - List serviceFacilitiesList =new ArrayList<>(); - if(map.get("serviceFacilities") !=null && map.get("serviceFacilities").toString() !=""){ + List serviceFacilitiesList = new ArrayList<>(); + if (map.get("serviceFacilities") != null && map.get("serviceFacilities").toString() != "") { String[] split = map.get("serviceFacilities").toString().split(","); - serviceFacilitiesList=Arrays.asList(split); + serviceFacilitiesList = Arrays.asList(split); } //获取标签 - List> label_type = xhpcChargingStationMapper.getCode("service_facilities",serviceFacilitiesList); - map.put("serviceFacilities",label_type); + List> label_type = xhpcChargingStationMapper.getCode("service_facilities", serviceFacilitiesList); + map.put("serviceFacilities", label_type); //桩(空闲和使用从redis获取) - map.put("free",10); + map.put("free", 10); - map.put("common",12); + map.put("common", 12); } } return list; } @Override - public Map getWXXhpcChargingStationMessage(Long chargingStationId,String longitude,String latitude) { + public Map getWXXhpcChargingStationMessage(Long chargingStationId, String longitude, String latitude) { //获取基本信息 - Map map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId,longitude,latitude); + Map map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude); //桩(空闲和使用从redis获取) - map.put("free",10); + map.put("free", 10); - map.put("common",12); + map.put("common", 12); //服务设施 - List serviceFacilitiesList =new ArrayList<>(); - if(map.get("serviceFacilities") !=null && map.get("serviceFacilities").toString() !=""){ + List serviceFacilitiesList = new ArrayList<>(); + if (map.get("serviceFacilities") != null && map.get("serviceFacilities").toString() != "") { String[] split = map.get("serviceFacilities").toString().split(","); - serviceFacilitiesList=Arrays.asList(split); + serviceFacilitiesList = Arrays.asList(split); } - List> service_facilities = xhpcChargingStationMapper.getCode("service_facilities",serviceFacilitiesList); - map.put("serviceFacilitiesList",service_facilities); + List> service_facilities = xhpcChargingStationMapper.getCode("service_facilities", serviceFacilitiesList); + map.put("serviceFacilitiesList", service_facilities); //周边设施 // List peripheryFacilities =new ArrayList<>(); @@ -627,28 +631,29 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi // map.put("peripheryFacilities",charging_periphery_facilities); //图片信息 - List imgList =new ArrayList<>(); - if(map.get("imgId") !=null && map.get("imgId").toString() !=""){ + List imgList = new ArrayList<>(); + if (map.get("imgId") != null && map.get("imgId").toString() != "") { String[] split = map.get("imgId").toString().split(","); - imgList=Arrays.asList(split); + imgList = Arrays.asList(split); List> imgLists = xhpcChargingStationMapper.getImageList(imgList); - map.put("imgIdList",imgLists); - }else{ - map.put("imgIdList",new ArrayList<>()); + map.put("imgIdList", imgLists); + } else { + map.put("imgIdList", new ArrayList<>()); } //获取该时段电费 //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId); - if(xhpcRateTime!=null){ + if (xhpcRateTime != null) { map.putAll(xhpcRateTime); } return map; } @Override - public List> getWXXhpcRateTimeMassage(Long chargingStationId) { + public List> getWXXhpcRateTimeMassage(Long chargingStationId) { + return xhpcChargingStationMapper.getWXXhpcRateTimeMassage(chargingStationId); } @@ -657,16 +662,16 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi List> list = xhpcChargingStationMapper.getWXXhpcTerminalMassage(chargingStationId); - if(list !=null && list.size()>0){ + if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Map map = list.get(i); //终端状态用 redis数据 //终端状态 - map.put("status","1"); + map.put("status", "1"); //soc - map.put("soc","18%"); + map.put("soc", "18%"); //剩余时间 - map.put("remainingTime","16分钟"); + map.put("remainingTime", "16分钟"); } } return list; @@ -676,11 +681,11 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi @Transactional public AjaxResult updateXhpcTerminal(XhpcChargingStation xhpcChargingStation) { //电站id不能为空 - if(xhpcChargingStation.getChargingStationId() ==null){ - return AjaxResult.error("1001","电站id为空"); + if (xhpcChargingStation.getChargingStationId() == null) { + return AjaxResult.error("1001", "电站id为空"); } //获取之前的模板id - XhpcChargingStation xhpc= xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcChargingStation.getChargingStationId()); + XhpcChargingStation xhpc = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcChargingStation.getChargingStationId()); xhpcChargingStation.setRateModelId(xhpc.getRateModelId()); xhpcChargingStationMapper.updateXhpcChargingStation(xhpcChargingStation); return AjaxResult.success(); @@ -689,20 +694,20 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi @Override public AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto) { //电站id不能为空 - if(xhpcChargingStationDto.getChargingStationId() ==null){ - return AjaxResult.error("1001","电站id为空"); + if (xhpcChargingStationDto.getChargingStationId() == null) { + return AjaxResult.error("1001", "电站id为空"); } //电站id不能为空 - if(xhpcChargingStationDto.getDefaultPeriodId() ==null){ - return AjaxResult.error("1001","默认时段费率id为空"); + if (xhpcChargingStationDto.getDefaultPeriodId() == null) { + return AjaxResult.error("1001", "默认时段费率id为空"); } //判断费率和费率时间段 是否有值 - if(xhpcChargingStationDto.getXhpcRateList() ==null && xhpcChargingStationDto.getXhpcRateList().size()==0){ - return AjaxResult.error(1001,"费率不能为空"); + if (xhpcChargingStationDto.getXhpcRateList() == null && xhpcChargingStationDto.getXhpcRateList().size() == 0) { + return AjaxResult.error(1001, "费率不能为空"); } - if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){ - return AjaxResult.error(1001,"费率时段不能为空"); + if (xhpcChargingStationDto.getXhpcRateTimeList() == null && xhpcChargingStationDto.getXhpcRateTimeList().size() == 0) { + return AjaxResult.error(1001, "费率时段不能为空"); } List xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList(); @@ -711,23 +716,23 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi String start = xhpcRateTime.getStartTime(); String end = xhpcRateTime.getEndTime(); //检查格式,正则验证 【[0-2][0-9]:[0-6][0]:[0]{2}】 - String pattern ="^([0-2][0-9]:([0]|[3])[0]:[0][0])"; + String pattern = "^([0-2][0-9]:([0]|[3])[0]:[0][0])"; Pattern compile = Pattern.compile(pattern); - Matcher m =compile.matcher(start); + Matcher m = compile.matcher(start); boolean isMatch = m.matches(); - if(!isMatch){ - return AjaxResult.error("1003","时间格式不对"); + if (!isMatch) { + return AjaxResult.error("1003", "时间格式不对"); } - Matcher m1 =compile.matcher(end); + Matcher m1 = compile.matcher(end); boolean isMatch1 = m1.matches(); - if(!isMatch1){ - return AjaxResult.error("1003","时间格式不对"); + if (!isMatch1) { + return AjaxResult.error("1003", "时间格式不对"); } //判断结束时间是否小于开始时间 Date startTime = DateUtil.parse(start); Date endTime = DateUtil.parse(end); - if(startTime.getTime()>endTime.getTime()){ - return AjaxResult.error("1002","开始时间不能大于结束时间"); + if (startTime.getTime() > endTime.getTime()) { + return AjaxResult.error("1002", "开始时间不能大于结束时间"); } } //判断是否有重叠 @@ -735,29 +740,29 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi XhpcRateTimeDto xhpcRateTimeOne = xhpcRateTimeList.get(i); Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime()); Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime()); - for (int j = i+1; j < xhpcRateTimeList.size(); j++) { + for (int j = i + 1; j < xhpcRateTimeList.size(); j++) { XhpcRateTimeDto xhpcRateTimeTwo = xhpcRateTimeList.get(j); Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime()); Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime()); - if (DateUtil.compare(startOne, endTwo)<0&&DateUtil.compare(startTwo, endOne)<0){ - return AjaxResult.error("1004","时间段有重叠"); + if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) { + return AjaxResult.error("1004", "时间段有重叠"); } } } //添加费率计费模型 XhpcRateModel xhpcRateModel = new XhpcRateModel(); - BeanUtils.copyProperties(xhpcChargingStationDto,xhpcRateModel); + BeanUtils.copyProperties(xhpcChargingStationDto, xhpcRateModel); xhpcRateModel.setRemark("修改"); int i = xhpcChargingStationMapper.addXhpcRateModel(xhpcRateModel); - if(i==0){ - return AjaxResult.error("1005","费率计费模型添加失败"); + if (i == 0) { + return AjaxResult.error("1005", "费率计费模型添加失败"); } //费率模型id Long rateModelId = xhpcRateModel.getRateModelId(); Long chargingStationId = xhpcChargingStationDto.getChargingStationId(); //获取之前的模板id - XhpcChargingStation xhpc= xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); + XhpcChargingStation xhpc = xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); xhpc.setRateModelId(rateModelId); xhpcChargingStationMapper.updateXhpcChargingStation(xhpc); @@ -766,12 +771,12 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcChargingStationMapper.updateXhpcRate(chargingStationId); //添加费率 - Map map =new HashMap<>(); + Map map = new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id XhpcRateDto xhpcRateDto = xhpcRateList.get(k); - XhpcRate xhpcRate =new XhpcRate(); + XhpcRate xhpcRate = new XhpcRate(); xhpcRate.setChargingStationId(chargingStationId); xhpcRate.setName(xhpcRateDto.getName()); xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); @@ -779,7 +784,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setRateModelId(rateModelId); xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); - map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); + map.put(xhpcRateDto.getId(), xhpcRate.getRateId()); } //添加费率时段 @@ -787,68 +792,68 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi //存费率时段,从Map中获取费率id //每个时间段都要存 //返回计费模型 24:00 转成 00:00 - XhpcRateTimeDto [] xhpcRateTimeDtosArr =new XhpcRateTimeDto[xhpcRateTimeList.size()]; + XhpcRateTimeDto[] xhpcRateTimeDtosArr = new XhpcRateTimeDto[xhpcRateTimeList.size()]; xhpcRateTimeList.toArray(xhpcRateTimeDtosArr); - XhpcRateTimeDto [] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr); + XhpcRateTimeDto[] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr); //排序好的费率时段 List list = Arrays.asList(xhpcRateTimeDtos); //默认时段费率Id - Long defaultPeriodId=null; - if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ - defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); + Long defaultPeriodId = null; + if (xhpcChargingStationDto.getDefaultPeriodId() != null) { + defaultPeriodId = map.get(xhpcChargingStationDto.getDefaultPeriodId()); } //默认费率类型值 - String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); - int sort =1; + String rateValue = xhpcChargingStationDto.getDefaultPeriodId(); + int sort = 1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); String endTime = xhpcRateTimeDto.getEndTime(); Long defaultPeriodIdMap = map.get(xhpcRateTimeDto.getId()); String rateValues = xhpcRateTimeDto.getId(); - if(k==0){ - if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ + if (k == 0) { + if (!"00:00:00".equals(xhpcRateTimeDto.getStartTime())) { //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); + sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, "00:00:00", startTime, sort, 2, rateValue); } //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); - }else if(kDateUtil.parse(end).getTime()){ - XhpcRateTimeDto temp=args[i]; - args[i]=args[j]; - args[j]=temp; + if (DateUtil.parse(start).getTime() > DateUtil.parse(end).getTime()) { + XhpcRateTimeDto temp = args[i]; + args[i] = args[j]; + args[j] = temp; } } } @@ -857,6 +862,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi /** * 0 添加 1删除 + * * @param status * @param chargingStationId */ @@ -864,13 +870,13 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi public void extracted(Integer status, Long chargingStationId) { Set set = xhpcChargingStationMapper.getXchargingPileList(chargingStationId); - if(set !=null && set.size()>0){ - if (status ==0) { + if (set != null && set.size() > 0) { + if (status == 0) { //添加场站下面的所有桩 - powerPileService.addPileWhitelist(chargingStationId,set); - }else{ + powerPileService.addPileWhitelist(chargingStationId, set); + } else { //删除场站下面的所有桩 - powerPileService.deletePileWhitelist(chargingStationId,set); + powerPileService.deletePileWhitelist(chargingStationId, set); } } } @@ -880,7 +886,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi //时间差 long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse("10:00:00"), DateUnit.SECOND); - System.out.println("betweenDay:"+betweenDay); + System.out.println("betweenDay:" + betweenDay); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateTimeServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateTimeServiceImpl.java index 84ed7e9c..b59cd1bd 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateTimeServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateTimeServiceImpl.java @@ -15,30 +15,32 @@ import java.util.Map; * @date 2021-07-20 */ @Service -public class XhpcRateTimeServiceImpl implements IXhpcRateTimeService{ +public class XhpcRateTimeServiceImpl implements IXhpcRateTimeService { @Autowired private XhpcRateTimeMapper xhpcRateTimeMapper; + /** * 获取本时间段的电费 + * * @param date * @return */ @Override - public Map getXhpcRateTime(String date,Long datchargingStationIde) { + public Map getXhpcRateTime(String date, Long datchargingStationIde) { //判断本时间段的电费 - Map hpcRateTimeMap = xhpcRateTimeMapper.getXhpcRateTime(date, datchargingStationIde); + Map hpcRateTimeMap = xhpcRateTimeMapper.getXhpcRateTime(date, datchargingStationIde); //该判断防止某个时间段费率没有录入 - if(hpcRateTimeMap ==null){ + if (hpcRateTimeMap == null) { //获取剩余时间费率 return new HashMap<>(); } - Map map =new HashMap<>(); + Map map = new HashMap<>(); Long rateId = Long.valueOf(hpcRateTimeMap.get("rateId").toString()); Map xhpcTimeType = xhpcRateTimeMapper.getXhpcTimeType(datchargingStationIde, rateId); - map.put("startTime",hpcRateTimeMap.get("startTime")); - map.put("endTime",hpcRateTimeMap.get("endTime")); + map.put("startTime", hpcRateTimeMap.get("startTime")); + map.put("endTime", hpcRateTimeMap.get("endTime")); map.putAll(xhpcTimeType); return map; } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java index ac4e8814..48bfc15b 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTerminalServiceImpl.java @@ -16,7 +16,7 @@ import java.util.*; * @date 2021-07-20 */ @Service -public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ +public class XhpcTerminalServiceImpl implements IXhpcTerminalService { @Autowired private XhpcTerminalMapper xhpcTerminalMapper; @@ -25,22 +25,25 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ /** * PC端页面统计 + * * @param chargingStationId 电站id * @return */ @Override public Map countXhpcTerminalWorkStatus(Long chargingStationId) { + return xhpcTerminalMapper.countXhpcTerminalWorkStatus(chargingStationId); } @Override public List> getXhpcTerminalList(String serialNumber, Integer type, Integer status, String workStatus, Long chargingStationId) { - return xhpcTerminalMapper.getXhpcTerminalList(serialNumber,type,status,workStatus,chargingStationId); + return xhpcTerminalMapper.getXhpcTerminalList(serialNumber, type, status, workStatus, chargingStationId); } @Override public AjaxResult updateStatus(Long terminalId, Integer Status) { + XhpcTerminal xhpcTerminal = xhpcTerminalMapper.selectXhpcTerminalById(terminalId); xhpcTerminal.setStatus(Status); xhpcTerminalMapper.updateXhpcTerminal(xhpcTerminal); @@ -49,12 +52,14 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ @Override public AjaxResult selectXhpcTerminalMessage(Long terminalId) { + XhpcTerminal xhpcTerminal = xhpcTerminalMapper.selectXhpcTerminalById(terminalId); return AjaxResult.success(xhpcTerminal); } @Override - public AjaxResult updateXhpcTerminalName(Long terminalId,String name, String serialNumber) { + public AjaxResult updateXhpcTerminalName(Long terminalId, String name, String serialNumber) { + XhpcTerminal xhpcTerminal = xhpcTerminalMapper.selectXhpcTerminalById(terminalId); xhpcTerminal.setName(name); xhpcTerminal.setSerialNumber(serialNumber); @@ -66,16 +71,16 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) { Map map = xhpcTerminalMapper.selectXhpcTerminalPileMessage(terminalId); - if(map !=null && map.get("chargingStationId") !=null && map.get("serialNumber") !=null){ - Long chargingStationId =Long.parseLong(map.get("chargingStationId").toString()); + if (map != null && map.get("chargingStationId") != null && map.get("serialNumber") != null) { + Long chargingStationId = Long.parseLong(map.get("chargingStationId").toString()); String gunNumber = map.get("serialNumber").toString(); //费率时段,先反设置时段,在反默认时段 List> xhpcRateTimeTypeList = xhpcTerminalMapper.getXhpcRateTimeTypeList(chargingStationId, 1); xhpcRateTimeTypeList.addAll(xhpcTerminalMapper.getXhpcRateTimeTypeList(chargingStationId, 2)); - map.put("rateTimeList",xhpcRateTimeTypeList); + map.put("rateTimeList", xhpcRateTimeTypeList); //统计终端(充redis获取终端信息) - map.putAll(xhpcTerminalMapper.getXhpcRateTimeOrderStatistics(chargingStationId,gunNumber)); + map.putAll(xhpcTerminalMapper.getXhpcRateTimeOrderStatistics(chargingStationId, gunNumber)); return AjaxResult.success(map); } return AjaxResult.error("无效终端"); @@ -85,8 +90,8 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ public AjaxResult getWXpNumMessage(String pNum) { Map map = xhpcTerminalMapper.getWXpNumMessage(pNum); - if(map ==null || map.get("chargingStationId")==null){ - return AjaxResult.error(1007,"无效的终端编码"); + if (map == null || map.get("chargingStationId") == null) { + return AjaxResult.error(1007, "无效的终端编码"); } //获取桩的状态 @@ -95,18 +100,18 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService{ //HH:mm:ss String tiem = DateUtil.formatTime(new Date()); Map xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId); - if(xhpcRateTime!=null){ + if (xhpcRateTime != null) { map.putAll(xhpcRateTime); } //图片信息 - List imgList =new ArrayList<>(); - if(map.get("imgId") !=null && map.get("imgId").toString() !=""){ + List imgList = new ArrayList<>(); + if (map.get("imgId") != null && map.get("imgId").toString() != "") { String[] split = map.get("imgId").toString().split(","); - imgList= Arrays.asList(split); + imgList = Arrays.asList(split); List> imgLists = xhpcTerminalMapper.getImageList(imgList); - map.put("imgIdList",imgLists); - }else{ - map.put("imgIdList",new ArrayList<>()); + map.put("imgIdList", imgLists); + } else { + map.put("imgIdList", new ArrayList<>()); } return AjaxResult.success(map); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml index 6ae20f93..39424620 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -15,41 +15,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - select charging_pile_id, charging_station_id, name, national_standard, power, auxiliary_power_supply, input_voltage, max_voltage, min_voltage, max_electric_current, min_electric_current, serial_number, type, program_version, network_link_type, gun_number,communication_protocol_version,communication_operator,sim_card,rate_model_id,status, del_flag, create_time, create_by, update_time, update_by, remark, rate_model_id ,brand_model from xhpc_charging_pile + select charging_pile_id, + charging_station_id, + name, + national_standard, + power, + auxiliary_power_supply, + input_voltage, + max_voltage, + min_voltage, + max_electric_current, + min_electric_current, + serial_number, + type, + program_version, + network_link_type, + gun_number, + communication_protocol_version, + communication_operator, + sim_card, + rate_model_id, + status, + del_flag, + create_time, + create_by, + update_time, + update_by, + remark, + rate_model_id, + brand_model + from xhpc_charging_pile - select - charging_station_id as chargingStationId, - rate_model_id as rateModelId - from xhpc_charging_station where charging_station_id=#{chargingStationId} + select charging_station_id as chargingStationId, + rate_model_id as rateModelId + from xhpc_charging_station + where charging_station_id = #{chargingStationId} - update xhpc_charging_pile set del_flag =1 where charging_pile_id = #{chargingPileId} + update xhpc_charging_pile + set del_flag =1 + where charging_pile_id = #{chargingPileId} - update xhpc_terminal set del_flag = 2 where charging_pile_id = #{chargingPileId} + update xhpc_terminal + set del_flag = 2 + where charging_pile_id = #{chargingPileId} diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index db5817e4..53cdc63e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -15,39 +15,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - select charging_station_id, name, operator_id, type, construction_site, service_facilities, periphery_facilities, area_code, address, detailed_address, longitude, latitude, parking_instructions, serial_number, client_visible, status, del_flag, create_time, create_by, update_time, update_by, remark, rate_model_id from xhpc_charging_station + select charging_station_id, + name, + operator_id, + type, + construction_site, + service_facilities, + periphery_facilities, + area_code, + address, + detailed_address, + longitude, + latitude, + parking_instructions, + serial_number, + client_visible, + status, + del_flag, + create_time, + create_by, + update_time, + update_by, + remark, + rate_model_id + from xhpc_charging_station - select name from xhpc_internet_user where del_flag=0 and internet_user_id not in (select internet_user_id from xhpc_station_internet_blacklist where charging_station_id=#{chargingStationId}) + select name + from xhpc_internet_user + where del_flag = 0 + and internet_user_id not in (select internet_user_id + from xhpc_station_internet_blacklist + where charging_station_id = #{chargingStationId}) - #{name}, + #{name}, #{operatorId}, @@ -697,13 +743,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -736,37 +782,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update xhpc_rate set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0 + update xhpc_rate + set del_flag =1 + where charging_station_id = #{chargingStationId} + and del_flag = 0 - update xhpc_rate_time set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0 + update xhpc_rate_time + set del_flag =1 + where charging_station_id = #{chargingStationId} + and del_flag = 0 diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml index a7674e55..62ac099d 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -15,38 +15,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - + + + + + + diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTerminalMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTerminalMapper.xml index a6328e7d..4d42060c 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTerminalMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTerminalMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -15,54 +15,88 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - + + + + + - select terminal_id, charging_pile_id, charging_station_id, name, serial_number, pile_serial_number, gun_status, work_status, status, del_flag, create_time, create_by, update_time, update_by, remark from xhpc_terminal + select terminal_id, + charging_pile_id, + charging_station_id, + name, + serial_number, + pile_serial_number, + gun_status, + work_status, + status, + del_flag, + create_time, + create_by, + update_time, + update_by, + remark + from xhpc_terminal - select - te.terminal_id as terminalId, - te.name as terminalName, - ct.name as chargingStationName, - te.pile_serial_number as pileSerialNumber, - cp.power as power, - cp.serial_number as serialNumber, - te.status as status, - te.work_status as workStatus + te.terminal_id as terminalId, + te.name as terminalName, + ct.name as chargingStationName, + te.pile_serial_number as pileSerialNumber, + cp.power as power, + cp.serial_number as serialNumber, + te.status as status, + te.work_status as workStatus from xhpc_terminal as te left join xhpc_charging_station as ct on ct.charging_station_id = te.charging_station_id left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id where te.del_flag=0 - and te.charging_station_id=#{chargingStationId} + and te.charging_station_id=#{chargingStationId} - and te.serial_number like CONCAT('%',#{serialNumber},'%') + and te.serial_number like CONCAT('%',#{serialNumber},'%') - and cp.type=#{type} + and cp.type=#{type} - and cp.status=#{status} + and cp.status=#{status} - and te.work_status=#{chargingStationId} + and te.work_status=#{chargingStationId} @@ -188,32 +222,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"