From bdafb64491d03e5f1355e09aa14b6972f97d8d0c Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Tue, 3 Aug 2021 19:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E7=AB=99=E3=80=81=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E3=80=81=E6=A1=A9=20POST=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E6=A1=A3=E5=B7=B2=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcChargingPileController.java | 32 +++++++++++++---- .../XhpcChargingStationController.java | 15 ++++---- .../controller/XhpcTerminalController.java | 19 ++++++----- .../mapper/XhpcChargingPileMapper.java | 10 +++++- .../service/IXhpcChargingPileService.java | 14 ++++++++ .../service/XhpcChargingPileServiceImpl.java | 34 +++++++++++++++---- .../mapper/XhpcChargingPileMapper.xml | 23 ++++++++----- .../mapper/XhpcChargingStationMapper.xml | 7 ++-- .../resources/mapper/XhpcTerminalMapper.xml | 11 +++--- .../xhpc/common/domain/XhpcChargingPile.java | 20 +++++------ .../general/service/XhpcSmsServiceImpl.java | 1 - 11 files changed, 128 insertions(+), 58 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 2a766a86..9e4a99a8 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 @@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.charging.station.service.IXhpcChargingPileService; import com.xhpc.common.domain.XhpcChargingPile; +import com.xhpc.common.domain.XhpcTerminal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -31,7 +32,7 @@ public class XhpcChargingPileController extends BaseController { */ //@PreAuthorize(hasPermi = "system:station:list") @GetMapping("/list") - public TableDataInfo list(String name, Integer type, Integer status, String serialNumber,Long chargingStationId) + public TableDataInfo list(String name, Integer type,String serialNumber,Long chargingStationId) { startPage(); List> list = xhpcChargingPileService.selectXhpcChargingPileList(name,type,serialNumber,chargingStationId); @@ -45,7 +46,7 @@ public class XhpcChargingPileController extends BaseController { @PostMapping(value = "/addXhpcChargingPile") public AjaxResult addXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) { - return AjaxResult.success(xhpcChargingPileService.addXhpcChargingPile(xhpcChargingPile)); + return xhpcChargingPileService.addXhpcChargingPile(xhpcChargingPile); } /** @@ -55,7 +56,7 @@ public class XhpcChargingPileController extends BaseController { @PostMapping(value = "/updateXhpcChargingPile") public AjaxResult updateXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) { - return AjaxResult.success(xhpcChargingPileService.updateXhpcChargingPile(xhpcChargingPile)); + return xhpcChargingPileService.updateXhpcChargingPile(xhpcChargingPile); } @@ -63,9 +64,28 @@ public class XhpcChargingPileController extends BaseController { * 桩详情 * @return */ - @PostMapping(value = "/selectXhpcChargingPile") - public AjaxResult selectXhpcChargingPile(@RequestParam(value = "chargingPileId",required = true) Long chargingPileId) + @GetMapping(value = "/selectXhpcChargingPile") + public AjaxResult selectXhpcChargingPile(@RequestParam(value = "chargingPileId") Long chargingPileId) { - return AjaxResult.success(xhpcChargingPileService.selectXhpcChargingPile(chargingPileId)); + return xhpcChargingPileService.selectXhpcChargingPile(chargingPileId); + } + + /** + * 停用 + * @return + */ + @PostMapping(value = "/updateStatus") + public AjaxResult updateStatus(@RequestBody XhpcChargingPile xhpcChargingPile) + { + return xhpcChargingPileService.updateStatus(xhpcChargingPile.getChargingPileId(),xhpcChargingPile.getStatus()); + } + + /** + * 删除电站 + */ + @DeleteMapping("/{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 2ab931a3..ed7eb38a 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 @@ -104,24 +104,21 @@ public class XhpcChargingStationController extends BaseController { //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @PostMapping("/status") - public AjaxResult status(@RequestParam(value = "status",required = true)Integer status,@RequestParam(value = "chargingStationId",required = true)Long chargingStationId) + public AjaxResult status(@RequestBody XhpcChargingStation xhpcChargingStation) { - return toAjax(xhpcChargingStationService.status(status,chargingStationId)); + return toAjax(xhpcChargingStationService.status(xhpcChargingStation.getStatus(),xhpcChargingStation.getChargingStationId())); } /** * APP端、小程序是否可见 - * @param type 0可见 1不可见 - * @param clientVisible 值 - * @param chargingStationId 场站id * @return 结果 */ //@PreAuthorize(hasPermi = "system:station:remove") //@Log(title = "电站", businessType = BusinessType.DELETE) @PostMapping("/clientVisible") - public AjaxResult status(@RequestParam(value = "type",required = true)Integer type,@RequestParam(value = "clientVisible",required = true)String clientVisible,@RequestParam(value = "chargingStationId",required = true)Long chargingStationId) + public AjaxResult clientVisible(@RequestBody XhpcChargingStation xhpcChargingStation) { - return toAjax(xhpcChargingStationService.clientVisible(type,clientVisible,chargingStationId)); + return toAjax(xhpcChargingStationService.clientVisible(xhpcChargingStation.getType(),xhpcChargingStation.getClientVisible(),xhpcChargingStation.getChargingStationId())); } @@ -222,7 +219,7 @@ public class XhpcChargingStationController extends BaseController { @PostMapping(value = "/updateXhpcTerminal") public AjaxResult updateXhpcTerminal(@RequestBody XhpcChargingStation xhpcChargingStation) { - return AjaxResult.success(xhpcChargingStationService.updateXhpcTerminal(xhpcChargingStation)); + return xhpcChargingStationService.updateXhpcTerminal(xhpcChargingStation); } /** @@ -232,6 +229,6 @@ public class XhpcChargingStationController extends BaseController { @PostMapping(value = "/updateXhpcRateTime") public AjaxResult updateXhpcRateTime(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) { - return AjaxResult.success(xhpcChargingStationService.updateXhpcRateTime(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 d54e6229..1efcf9d7 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 @@ -4,6 +4,7 @@ import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.charging.station.service.IXhpcTerminalService; +import com.xhpc.common.domain.XhpcTerminal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -46,18 +47,18 @@ public class XhpcTerminalController extends BaseController { * @return */ @PostMapping(value = "/updateStatus") - public AjaxResult updateStatus(Long terminalId,Integer Status) + public AjaxResult updateStatus(@RequestBody XhpcTerminal xhpcTerminal) { - return AjaxResult.success(xhpcTerminalService.updateStatus(terminalId,Status)); + return xhpcTerminalService.updateStatus(xhpcTerminal.getTerminalId(),xhpcTerminal.getStatus()); } /** * 查询 */ - @PostMapping(value = "/selectXhpcTerminalMessage") + @GetMapping(value = "/selectXhpcTerminalMessage") public AjaxResult selectXhpcTerminalMessage(Long terminalId) { - return AjaxResult.success(xhpcTerminalService.selectXhpcTerminalMessage(terminalId)); + return xhpcTerminalService.selectXhpcTerminalMessage(terminalId); } /** @@ -65,18 +66,18 @@ public class XhpcTerminalController extends BaseController { * @return */ @PostMapping(value = "/updateXhpcTerminalName") - public AjaxResult updateXhpcTerminalName(Long terminalId,String name,String serialNumber) + public AjaxResult updateXhpcTerminalName(@RequestBody XhpcTerminal xhpcTerminal) { - return AjaxResult.success(xhpcTerminalService.updateXhpcTerminalName(terminalId,name,serialNumber)); + return xhpcTerminalService.updateXhpcTerminalName(xhpcTerminal.getTerminalId(),xhpcTerminal.getName(),xhpcTerminal.getSerialNumber()); } /** * 终端详情 */ - @PostMapping(value = "/selectXhpcTerminalPileMessage") + @GetMapping(value = "/selectXhpcTerminalPileMessage") public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) { - return AjaxResult.success(xhpcTerminalService.selectXhpcTerminalPileMessage(terminalId)); + return xhpcTerminalService.selectXhpcTerminalPileMessage(terminalId); } @@ -86,7 +87,7 @@ public class XhpcTerminalController extends BaseController { @GetMapping(value = "/getWXpNumMessage") public AjaxResult getWXpNumMessage(@RequestParam(value = "pNum") String pNum) { - return AjaxResult.success(xhpcTerminalService.getWXpNumMessage(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 b7d66b72..8cc5c2e7 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 @@ -40,7 +40,7 @@ public interface XhpcChargingPileMapper { Map selectXhpcChargingStationById(Long chargingStationId); /** - * 查询终端 + * 查询桩 * * @param chargingPileId 终端ID * @return 电站 @@ -61,4 +61,12 @@ public interface XhpcChargingPileMapper { * @return */ List> selectXhpcTerminalList(@Param("chargingPileId") Long chargingPileId); + + /** + * 删除桩信息 + * + * @param chargingPileId 桩ID + * @return 结果 + */ + int updateXhpcChargingPileById(@Param("chargingPileId")Long chargingPileId); } 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 424be665..12f63d29 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 @@ -43,4 +43,18 @@ public interface IXhpcChargingPileService { */ AjaxResult selectXhpcChargingPile(Long chargingPileId); + /** + * 停用 + * @return + */ + AjaxResult updateStatus(Long chargingPileId,Integer status); + + + /** + * 删除桩信息 + * + * @param chargingPileId 桩ID + * @return 结果 + */ + int updateXhpcChargingPileById(Long chargingPileId); } 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 fc1b26d8..e668066b 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 @@ -9,11 +9,9 @@ import com.xhpc.charging.station.mapper.XhpcTerminalMapper; import com.xhpc.common.api.PowerPileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author yuyang @@ -43,6 +41,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ } @Override + @Transactional public AjaxResult addXhpcChargingPile(XhpcChargingPile xhpcChargingPile) { Long chargingStationId = xhpcChargingPile.getChargingStationId(); @@ -83,10 +82,10 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); if(xhpcChargingPile.getSerialNumber() ==null){ - AjaxResult.error("桩编号不能为空"); + return AjaxResult.error("桩编号不能为空"); } if(xhpc.getSerialNumber() != xhpc.getSerialNumber()){ - AjaxResult.error("桩编号不能编辑"); + return AjaxResult.error("桩编号不能编辑"); } xhpcChargingPileMapper.updaeXhpcChargingPile(xhpcChargingPile); @@ -104,4 +103,27 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ return AjaxResult.success(map); } + + @Override + public AjaxResult updateStatus(Long chargingPileId, Integer status) { + XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); + xhpc.setStatus(status); + xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc); + return AjaxResult.success(); + } + + @Override + public int updateXhpcChargingPileById(Long chargingPileId) { + XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId); + int i = xhpcChargingPileMapper.updateXhpcChargingPileById(chargingPileId); + if (i>0) { + //删除桩 + 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/resources/mapper/XhpcChargingPileMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml index 7ffd4532..12b13a8e 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 @@ -25,7 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -33,9 +32,10 @@ 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,charging_pile_number,status, del_flag, create_time, create_by, update_time, update_by, remark, rate_model_id 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 + + + update xhpc_charging_pile set del_flag =1 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 674810df..0ebb4bd9 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 @@ -180,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ct.charging_station_id as chargingStationId, ct.name as name, ct.operator_id as operatorId, + ct.station_type as stationType, op.name as operatorName, ct.type as type, ct.station_type as stationType, @@ -190,14 +191,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ct.address as address, ct.detailed_address as detailedAddress, ct.periphery_facilities as peripheryFacilities, - ct.service_facilities as erviceFacilities, + ct.service_facilities as serviceFacilities, ct.parking_instructions as parkingInstructions, ct.business_instructions as businessInstructions, ct.reminder_instructions as reminderInstructions, ct.img_id as imgId from xhpc_charging_station as ct left join xhpc_operator as op on op.operator_id = ct.operator_id - where ct.charging_station_id = 4 and ct.del_flag =0 + where ct.charging_station_id =#{chargingStationId} and ct.del_flag =0 select ter.terminal_id as terminalId, - ter.charging_station_id as ter.chargingStationId, + ter.charging_station_id as chargingStationId, ter.name as name, ter.serial_number as serialNumber, ter.gun_status as gunStatus, @@ -222,6 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" rt.start_time as startTime, replace(rt.end_time,'00:00:00','24:00:00') AS endTime, rt.rate_id as rateId, + rate_value as rateValue, ra.name as rateName from xhpc_rate_time as rt left join xhpc_rate as ra on ra.rate_id =rt.rate_id @@ -242,7 +243,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"