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 new file mode 100644 index 00000000..1df12a6b --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java @@ -0,0 +1,62 @@ +package com.xhpc.charging.station.controller; + +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.xhpc.charging.station.domain.XhpcChargingPile; +import com.xhpc.charging.station.dto.XhpcChargingStationDto; +import com.xhpc.charging.station.service.IXhpcChargingPileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/7/27 14:44 + */ +@RestController +@RequestMapping("/chargingPile") +public class XhpcChargingPileController extends BaseController { + + @Autowired + private IXhpcChargingPileService xhpcChargingPileService; + + /** + * 桩列表 + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 + * @return + */ + //@PreAuthorize(hasPermi = "system:station:list") + @GetMapping("/list") + public TableDataInfo list(String name, Integer type, Integer status, String serialNumber,Long chargingStationId) + { + startPage(); + List> list = xhpcChargingPileService.selectXhpcChargingStationList(name,type,serialNumber,chargingStationId); + return getDataTable(list); + } + + /** + * 新增桩 + * @return + */ + @PostMapping(value = "/addXhpcChargingPile") + public AjaxResult addXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) + { + return AjaxResult.success(xhpcChargingPileService.addXhpcChargingPile(xhpcChargingPile)); + } + + /** + * 编辑桩 + * @return + */ + @PostMapping(value = "/updateXhpcChargingPile") + public AjaxResult updateXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) + { + return AjaxResult.success(xhpcChargingPileService.updateXhpcChargingPile(xhpcChargingPile)); + } + +} 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 9d2bf677..34be851c 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 @@ -195,7 +195,7 @@ public class XhpcChargingStationController extends BaseController { * @return */ @GetMapping(value = "/getWXXhpcChargingStationMessage") - public AjaxResult getWXXhpcChargingStationMessage(@Param("chargingStationId") Long chargingStationId,@Param("longitude")String longitude,@Param("latitude")String latitude) + public AjaxResult getWXXhpcChargingStationMessage(@RequestParam("chargingStationId") Long chargingStationId,@RequestParam("longitude")String longitude,@RequestParam("latitude")String latitude) { return AjaxResult.success(xhpcChargingStationService.getWXXhpcChargingStationMessage(chargingStationId,longitude,latitude)); } @@ -222,4 +222,24 @@ public class XhpcChargingStationController extends BaseController { return AjaxResult.success(xhpcChargingStationService.getWXXhpcTerminalMassage(chargingStationId)); } + + /** + * 编辑电站(基本信息) + * @return + */ + @PostMapping(value = "/updateXhpcTerminal") + public AjaxResult updateXhpcTerminal(@RequestBody XhpcChargingStation xhpcChargingStation) + { + return AjaxResult.success(xhpcChargingStationService.updateXhpcTerminal(xhpcChargingStation)); + } + + /** + * 编辑费率 + * @return + */ + @PostMapping(value = "/updateXhpcRateTime") + public AjaxResult updateXhpcRateTime(@RequestBody XhpcChargingStationDto xhpcChargingStationDto) + { + return AjaxResult.success(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 new file mode 100644 index 00000000..b7feb063 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcTerminalController.java @@ -0,0 +1,85 @@ +package com.xhpc.charging.station.controller; + +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.xhpc.charging.station.service.IXhpcTerminalService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/7/27 9:29 + */ +@RestController +@RequestMapping("/terminal") +public class XhpcTerminalController extends BaseController { + + @Autowired + private IXhpcTerminalService xhpcTerminalService; + + + /** + * 终端列表 + * @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) + { + startPage(); + List> list = xhpcTerminalService.getXhpcTerminalList(serialNumber,type,status,workStatus,chargingStationId); + return getDataTable(list); + } + + + /** + * 停用 + * @return + */ + @PostMapping(value = "/updateStatus") + public AjaxResult updateStatus(Long terminalId,Integer Status) + { + return AjaxResult.success(xhpcTerminalService.updateStatus(terminalId,Status)); + } + + /** + * 查询 + */ + @PostMapping(value = "/selectXhpcTerminalMessage") + public AjaxResult selectXhpcTerminalMessage(Long terminalId) + { + return AjaxResult.success(xhpcTerminalService.selectXhpcTerminalMessage(terminalId)); + } + + /** + * 修改 + * @return + */ + @PostMapping(value = "/updateXhpcTerminalName") + public AjaxResult updateXhpcTerminalName(Long terminalId,String name,String serialNumber) + { + return AjaxResult.success(xhpcTerminalService.updateXhpcTerminalName(terminalId,name,serialNumber)); + } + + /** + * 终端详情 + */ + @PostMapping(value = "/selectXhpcTerminalPileMessage") + public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) + { + return AjaxResult.success(xhpcTerminalService.selectXhpcTerminalPileMessage(terminalId)); + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingPile.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingPile.java new file mode 100644 index 00000000..e998ee06 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingPile.java @@ -0,0 +1,291 @@ +package com.xhpc.charging.station.domain; + +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 桩 xhpc_charging_pile + * @author yuyang + * @date 2021/7/27 14:11 + */ +public class XhpcChargingPile extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 电桩id */ + private Long chargingPileId; + /** 电站id */ + private Long chargingStationId; + /** 名称 */ + private String name; + /** 国标 */ + private String nationalStandard; + /** 功率 */ + private Double power; + /** 辅助电源支持 */ + private Double auxiliaryPowerSupply; + /** 输入电压 */ + private Double inputVoltage; + /** 最大电压 */ + private Double maxVoltage; + /** 最小电压 */ + private Double minVoltage; + /** 最大电流 */ + private Double maxElectricCurrent; + /** 最小电流 */ + private Double minElectriCurrent; + /** 桩编号 */ + private String serialNumber; + /** 桩类型 */ + private Integer type; + /** 程序版本 */ + private String programVersion; + /** 网络链接类型 */ + private String networkLinkType; + /** 终端数量 */ + private Integer gunNumber; + /** 通讯协议版本 */ + private String communicationProtocolVersion; + /** 通讯运营商 */ + private String communicationOperator; + /** Sim卡 */ + private String simCard; + /** 状态(0正常 1停用) */ + private String status; + /** 删除标志(0代表存在 2代表删除) */ + private Integer delFlag; + /** 计费模型id */ + private Long rateModelId; + /** 桩编码 */ + private String chargingPileNumber; + + public Long getChargingPileId() { + + return chargingPileId; + } + + public void setChargingPileId(Long chargingPileId) { + + this.chargingPileId = chargingPileId; + } + + public Long getChargingStationId() { + + return chargingStationId; + } + + public void setChargingStationId(Long chargingStationId) { + + this.chargingStationId = chargingStationId; + } + + public String getName() { + + return name; + } + + public void setName(String name) { + + this.name = name; + } + + public String getNationalStandard() { + + return nationalStandard; + } + + public void setNationalStandard(String nationalStandard) { + + this.nationalStandard = nationalStandard; + } + + public Double getPower() { + + return power; + } + + public void setPower(Double power) { + + this.power = power; + } + + public Double getAuxiliaryPowerSupply() { + + return auxiliaryPowerSupply; + } + + public void setAuxiliaryPowerSupply(Double auxiliaryPowerSupply) { + + this.auxiliaryPowerSupply = auxiliaryPowerSupply; + } + + public Double getInputVoltage() { + + return inputVoltage; + } + + public void setInputVoltage(Double inputVoltage) { + + this.inputVoltage = inputVoltage; + } + + public Double getMaxVoltage() { + + return maxVoltage; + } + + public void setMaxVoltage(Double maxVoltage) { + + this.maxVoltage = maxVoltage; + } + + public Double getMinVoltage() { + + return minVoltage; + } + + public void setMinVoltage(Double minVoltage) { + + this.minVoltage = minVoltage; + } + + public Double getMaxElectricCurrent() { + + return maxElectricCurrent; + } + + public void setMaxElectricCurrent(Double maxElectricCurrent) { + + this.maxElectricCurrent = maxElectricCurrent; + } + + public Double getMinElectriCurrent() { + + return minElectriCurrent; + } + + public void setMinElectriCurrent(Double minElectriCurrent) { + + this.minElectriCurrent = minElectriCurrent; + } + + public String getSerialNumber() { + + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + + this.serialNumber = serialNumber; + } + + public Integer getType() { + + return type; + } + + public void setType(Integer type) { + + this.type = type; + } + + public String getProgramVersion() { + + return programVersion; + } + + public void setProgramVersion(String programVersion) { + + this.programVersion = programVersion; + } + + public String getNetworkLinkType() { + + return networkLinkType; + } + + public void setNetworkLinkType(String networkLinkType) { + + this.networkLinkType = networkLinkType; + } + + public Integer getGunNumber() { + + return gunNumber; + } + + public void setGunNumber(Integer gunNumber) { + + this.gunNumber = gunNumber; + } + + public String getCommunicationProtocolVersion() { + + return communicationProtocolVersion; + } + + public void setCommunicationProtocolVersion(String communicationProtocolVersion) { + + this.communicationProtocolVersion = communicationProtocolVersion; + } + + public String getCommunicationOperator() { + + return communicationOperator; + } + + public void setCommunicationOperator(String communicationOperator) { + + this.communicationOperator = communicationOperator; + } + + public String getSimCard() { + + return simCard; + } + + public void setSimCard(String simCard) { + + this.simCard = simCard; + } + + public String getStatus() { + + return status; + } + + public void setStatus(String status) { + + this.status = status; + } + + public Integer getDelFlag() { + + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + + this.delFlag = delFlag; + } + + public Long getRateModelId() { + + return rateModelId; + } + + public void setRateModelId(Long rateModelId) { + + this.rateModelId = rateModelId; + } + + public String getChargingPileNumber() { + + return chargingPileNumber; + } + + public void setChargingPileNumber(String chargingPileNumber) { + + this.chargingPileNumber = chargingPileNumber; + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingStation.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingStation.java index 23de65fc..bfd134af 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingStation.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcChargingStation.java @@ -25,8 +25,8 @@ public class XhpcChargingStation extends BaseEntity { @Excel(name = "运营商id") private Long operatorId; - /** 电站地址 */ - @Excel(name = "电站地址") + /** 电站位置 */ + @Excel(name = "电站位置") private Integer type; /** 建设场所 */ @@ -94,7 +94,7 @@ public class XhpcChargingStation extends BaseEntity { /** 营业说明 */ @Excel(name = "营业说明") - private String pbusinessInstructions; + private String businessInstructions; /** 温馨提示说明 */ @Excel(name = "温馨提示说明") @@ -273,14 +273,14 @@ public class XhpcChargingStation extends BaseEntity { this.imgId = imgId; } - public String getPbusinessInstructions() { + public String getBusinessInstructions() { - return pbusinessInstructions; + return businessInstructions; } - public void setPbusinessInstructions(String pbusinessInstructions) { + public void setBusinessInstructions(String businessInstructions) { - this.pbusinessInstructions = pbusinessInstructions; + this.businessInstructions = businessInstructions; } public String getReminderInstructions() { 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 new file mode 100644 index 00000000..952e8742 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java @@ -0,0 +1,50 @@ +package com.xhpc.charging.station.mapper; + +import com.xhpc.charging.station.domain.XhpcChargingPile; +import com.xhpc.charging.station.domain.XhpcChargingStation; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/7/27 14:37 + */ +public interface XhpcChargingPileMapper { + + + /** + * 桩列表 + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 + * @return + */ + List> selectXhpcChargingStationList(@Param("name") String name, @Param("type")Integer type,@Param("serialNumber") String serialNumber,@Param("chargingStationId")Long chargingStationId); + + /** + * 终端 + * + * @param xhpcChargingPile 终端 + * @return 结果 + */ + int addXhpcChargingPile(XhpcChargingPile xhpcChargingPile); + + + /** + * 查询电站 + * + * @param chargingStationId 电站ID + * @return 电站 + */ + Map selectXhpcChargingStationById(Long chargingStationId); + + /** + * 查询终端 + * + * @param chargingPileId 终端ID + * @return 电站 + */ + XhpcChargingPile selectXhpcChargingPileById(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 d1b65d4b..0053f78b 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 @@ -196,9 +196,17 @@ public interface XhpcChargingStationMapper { Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId")Long chargingStationId); /** - * 获取终端列表 + * 删除之前的费率 * @param chargingStationId * @return */ - List> getXhpcTerminalList(@Param("chargingStationId")Long chargingStationId); + int updateXhpcRate(@Param("chargingStationId")Long chargingStationId); + + /** + * 删除之前的费率时段 + * @param chargingStationId + * @return + */ + int updateXhpcRateTime(@Param("chargingStationId")Long chargingStationId); + } 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 a4c0b6b0..c24001db 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 @@ -1,5 +1,9 @@ package com.xhpc.charging.station.mapper; +import com.xhpc.charging.station.domain.XhpcChargingStation; +import com.xhpc.charging.station.domain.XhpcTerminal; +import org.apache.ibatis.annotations.Param; + import java.util.List; import java.util.Map; @@ -18,4 +22,55 @@ public interface XhpcTerminalMapper { * @return */ Map countXhpcTerminalWorkStatus(Long chargingStationId); + + /** + * 终端列表 + * @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); + + + /** + * 查询电站 + * + * @param terminalId 终端id + * @return 电站 + */ + XhpcTerminal selectXhpcTerminalById(Long terminalId); + + + /** + * 修改终端 + * + * @param xhpcTerminal 终端 + * @return 结果 + */ + int updateXhpcTerminal(XhpcTerminal xhpcTerminal); + + /** + * 添加终端 + * + * @param xhpcTerminal 终端 + * @return 结果 + */ + int addXhpcTerminal(XhpcTerminal xhpcTerminal); + /** + * 终端详情 + */ + Map selectXhpcTerminalPileMessage(Long terminalId); + + /** + * 返回费率时段(设置时段) + */ + List> getXhpcRateTimeTypeList(@Param("chargingStationId")Long chargingStationId,@Param("type")Integer type); + + /** + * 今日充电量、今日充电用户、今日充电次数 + */ + Map getXhpcRateTimeOrderStatistics(@Param("chargingStationId")Long chargingStationId,@Param("gunNumber")String gunNumber); } 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 new file mode 100644 index 00000000..823f117a --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcChargingPileService.java @@ -0,0 +1,39 @@ +package com.xhpc.charging.station.service; + +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.xhpc.charging.station.domain.XhpcChargingPile; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/7/27 14:36 + */ +public interface IXhpcChargingPileService { + + /** + * 桩列表 + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 + * @return + */ + List> selectXhpcChargingStationList(String name, Integer type, String serialNumber,Long chargingStationId); + + + /** + * 添加电站(编辑费率) + * @param + * @return + */ + AjaxResult addXhpcChargingPile(XhpcChargingPile xhpcChargingPile); + + /** + * 编辑电站(编辑费率) + * @param + * @return + */ + AjaxResult updateXhpcChargingPile(XhpcChargingPile xhpcChargingPile); + +} 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 a33023b7..e2cade2a 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 @@ -3,6 +3,7 @@ package com.xhpc.charging.station.service; import com.ruoyi.common.core.web.domain.AjaxResult; import com.xhpc.charging.station.domain.XhpcChargingStation; import com.xhpc.charging.station.dto.XhpcChargingStationDto; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -143,4 +144,17 @@ public interface IXhpcChargingStationService { */ List> getWXXhpcTerminalMassage(Long chargingStationId); + /** + * 编辑电站(基本信息) + * @param + * @return + */ + AjaxResult updateXhpcTerminal(XhpcChargingStation xhpcChargingStation); + + /** + * 编辑电站(编辑费率) + * @param + * @return + */ + AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTerminalService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTerminalService.java index 1e06de5d..0dd68736 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTerminalService.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcTerminalService.java @@ -1,5 +1,7 @@ package com.xhpc.charging.station.service; +import com.ruoyi.common.core.web.domain.AjaxResult; + import java.util.List; import java.util.Map; @@ -19,5 +21,30 @@ public interface IXhpcTerminalService { */ public Map countXhpcTerminalWorkStatus(Long chargingStationId); + /** + * 列表接口 + */ + List> getXhpcTerminalList(String serialNumber, Integer type,Integer status,String workStatus, Long chargingStationId); + /** + * 停用 + * @return + */ + AjaxResult updateStatus(Long terminalId,Integer Status); + + /** + * 查询 + */ + AjaxResult selectXhpcTerminalMessage(Long terminalId); + + /** + * 修改 + * @return + */ + AjaxResult updateXhpcTerminalName(Long terminalId,String name,String serialNumber); + + /** + * 终端详情 + */ + AjaxResult selectXhpcTerminalPileMessage(Long terminalId); } 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 new file mode 100644 index 00000000..641fda48 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -0,0 +1,74 @@ +package com.xhpc.charging.station.service; + +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.xhpc.charging.station.domain.XhpcChargingPile; +import com.xhpc.charging.station.domain.XhpcTerminal; +import com.xhpc.charging.station.mapper.XhpcChargingPileMapper; +import com.xhpc.charging.station.mapper.XhpcTerminalMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @date 2021/7/27 14:36 + */ +@Service +public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ + + @Autowired + private XhpcChargingPileMapper xhpcChargingPileMapper; + @Autowired + private XhpcTerminalMapper xhpcTerminalMapper; + + /** + * 桩列表 + * @param serialNumber 桩编号 + * @param type 桩类型 + * @param name 桩名称 + * @return + */ + @Override + public List> selectXhpcChargingStationList(String name, Integer type, String serialNumber, Long chargingStationId) { + return xhpcChargingPileMapper.selectXhpcChargingStationList(name,type,serialNumber,chargingStationId); + } + + @Override + public AjaxResult addXhpcChargingPile(XhpcChargingPile xhpcChargingPile) { + + Long chargingStationId = xhpcChargingPile.getChargingStationId(); + //获取计费模型id + Map stringObjectMap = xhpcChargingPileMapper.selectXhpcChargingStationById(chargingStationId); + Long rateModelId = Long.parseLong(stringObjectMap.get("rateModelId").toString()); + xhpcChargingPile.setRateModelId(rateModelId); + //桩 + xhpcChargingPileMapper.addXhpcChargingPile(xhpcChargingPile); + //终端 + Long chargingPileId=xhpcChargingPile.getChargingPileId(); + String serialNumber = xhpcChargingPile.getSerialNumber(); + if(xhpcChargingPile.getGunNumber()>0){ + for (int i = 0; i < xhpcChargingPile.getGunNumber(); i++) { + XhpcTerminal xhpcTerminal =new XhpcTerminal(); + xhpcTerminal.setChargingStationId(chargingStationId); + xhpcTerminal.setChargingPileId(chargingPileId); + xhpcTerminal.setName(serialNumber+"-"+(i+1)); + xhpcTerminal.setPileSerialNumber(serialNumber); + xhpcTerminal.setWorkStatus(2); + xhpcTerminal.setStatus(0); + xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal); + } + } + return AjaxResult.success(); + } + + @Override + public AjaxResult updateXhpcChargingPile(XhpcChargingPile xhpcChargingPile) { + + + + return null; + } + +} 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 f723c9e8..ed0d08c5 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 @@ -212,7 +212,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if(xhpcChargingStationDto.getParkingInstructions()==null){ return AjaxResult.error(1001,"停车说明不能为空"); } - if(xhpcChargingStationDto.getPbusinessInstructions()==null){ + if(xhpcChargingStationDto.getBusinessInstructions()==null){ return AjaxResult.error(1001,"营业时间说明不能为空"); } if(xhpcChargingStationDto.getReminderInstructions()==null){ @@ -293,7 +293,6 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi Long chargingStationId = xhpcChargingStation.getChargingStationId(); //添加费率 - Map map =new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { @@ -393,10 +392,8 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi map.put("rateTimeList",xhpcRateTimeTypeList); if(type ==2){ //统计终端(充redis获取终端信息) + map.putAll(xhpcChargingStationMapper.getXhpcRateTimeOrderStatistics(chargingStationId)); - //桩列表 - List> xhpcTerminalList = xhpcChargingStationMapper.getXhpcTerminalList(chargingStationId); - map.put("terminalList",xhpcTerminalList); } return map; } @@ -446,7 +443,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi List> label_type = xhpcChargingStationMapper.getCode("service_facilities",serviceFacilitiesList); map.put("serviceFacilities",label_type); //桩(空闲和使用从redis获取) + map.put("free",10); + map.put("common",12); } } return list; @@ -459,7 +458,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi Map map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId,longitude,latitude); //桩空闲数量,从redis获取 - //标签 + //服务设施 List serviceFacilitiesList =new ArrayList<>(); if(map.get("serviceFacilities") !=null && map.get("serviceFacilities").toString() !=""){ String[] split = map.get("serviceFacilities").toString().split(","); @@ -468,6 +467,15 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi List> service_facilities = xhpcChargingStationMapper.getCode("service_facilities",serviceFacilitiesList); map.put("serviceFacilitiesList",service_facilities); + //周边设施 + List peripheryFacilities =new ArrayList<>(); + if(map.get("peripheryFacilities") !=null && map.get("peripheryFacilities").toString() !=""){ + String[] split = map.get("peripheryFacilities").toString().split(","); + peripheryFacilities=Arrays.asList(split); + } + List> charging_periphery_facilities = xhpcChargingStationMapper.getCode("charging_periphery_facilities",peripheryFacilities); + map.put("peripheryFacilities",charging_periphery_facilities); + //图片信息 List imgList =new ArrayList<>(); if(map.get("imgId") !=null && map.get("imgId").toString() !=""){ @@ -514,6 +522,169 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi return list; } + @Override + @Transactional + public AjaxResult updateXhpcTerminal(XhpcChargingStation xhpcChargingStation) { + //电站id不能为空 + if(xhpcChargingStation.getChargingStationId() ==null){ + return AjaxResult.error("1001","电站id为空"); + } + //获取之前的模板id + XhpcChargingStation xhpc= xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcChargingStation.getChargingStationId()); + xhpcChargingStation.setRateModelId(xhpc.getRateModelId()); + xhpcChargingStationMapper.updateXhpcChargingStation(xhpcChargingStation); + return AjaxResult.success(); + } + + @Override + public AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto) { + //电站id不能为空 + if(xhpcChargingStationDto.getChargingStationId() ==null){ + return AjaxResult.error("1001","电站id为空"); + } + //电站id不能为空 + if(xhpcChargingStationDto.getDefaultPeriodId() ==null){ + return AjaxResult.error("1001","默认时段费率id为空"); + } + + //判断费率和费率时间段 是否有值 + if(xhpcChargingStationDto.getXhpcRateList() ==null && xhpcChargingStationDto.getXhpcRateList().size()==0){ + return AjaxResult.error(1001,"费率不能为空"); + } + if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){ + return AjaxResult.error(1001,"费率时段不能为空"); + } + List xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList(); + + for (int i = 0; i < xhpcRateTimeList.size(); i++) { + XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i); + 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])"; + Pattern compile = Pattern.compile(pattern); + Matcher m =compile.matcher(start); + boolean isMatch = m.matches(); + if(!isMatch){ + return AjaxResult.error("1003","时间格式不对"); + } + Matcher m1 =compile.matcher(end); + boolean isMatch1 = m1.matches(); + 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","开始时间不能大于结束时间"); + } + } + //判断是否有重叠 + for (int i = 0; i < xhpcRateTimeList.size(); i++) { + 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++) { + 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","时间段有重叠"); + } + } + } + + //添加费率计费模型 + XhpcRateModel xhpcRateModel = new XhpcRateModel(); + BeanUtils.copyProperties(xhpcChargingStationDto,xhpcRateModel); + xhpcRateModel.setRemark("修改"); + int i = xhpcChargingStationMapper.addXhpcRateModel(xhpcRateModel); + if(i==0){ + return AjaxResult.error("1005","费率计费模型添加失败"); + } + //费率模型id + Long rateModelId = xhpcRateModel.getRateModelId(); + Long chargingStationId = xhpcChargingStationDto.getChargingStationId(); + //获取之前的模板id + XhpcChargingStation xhpc= xhpcChargingStationMapper.selectXhpcChargingStationById(chargingStationId); + xhpc.setRateModelId(rateModelId); + xhpcChargingStationMapper.updateXhpcChargingStation(xhpc); + + //删除之前费率、费率时段 + xhpcChargingStationMapper.updateXhpcRateTime(chargingStationId); + xhpcChargingStationMapper.updateXhpcRate(chargingStationId); + + //添加费率 + 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.setChargingStationId(chargingStationId); + xhpcRate.setName(xhpcRateDto.getName()); + xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); + xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); + xhpcRate.setRateModelId(rateModelId); + xhpcChargingStationMapper.addXhpcRate(xhpcRate); + map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); + } + + //添加费率时段 + //冒泡排序(结束时间小于开始时间排前面) + //存费率时段,从Map中获取费率id + //每个时间段都要存 + //返回计费模型 24:00 转成 00:00 + XhpcRateTimeDto [] xhpcRateTimeDtosArr =new XhpcRateTimeDto[xhpcRateTimeList.size()]; + xhpcRateTimeList.toArray(xhpcRateTimeDtosArr); + XhpcRateTimeDto [] xhpcRateTimeDtos = bubbleSort(xhpcRateTimeDtosArr); + //排序好的费率时段 + List list = Arrays.asList(xhpcRateTimeDtos); + //默认时段费率Id + Long defaultPeriodId=null; + if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ + defaultPeriodId=map.get(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()); + if(k==0){ + if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ + //添加一条默认费率时段 + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2); + } + //并把本条数据也添加上 + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1); + }else if(k> getXhpcTerminalList(String serialNumber, Integer type, Integer status, String workStatus, Long 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); + return AjaxResult.success(); + } + + @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) { + XhpcTerminal xhpcTerminal = xhpcTerminalMapper.selectXhpcTerminalById(terminalId); + xhpcTerminal.setName(name); + xhpcTerminal.setSerialNumber(serialNumber); + xhpcTerminalMapper.updateXhpcTerminal(xhpcTerminal); + return AjaxResult.success(); + } + + @Override + public AjaxResult selectXhpcTerminalPileMessage(Long terminalId) { + + Map map = xhpcTerminalMapper.selectXhpcTerminalPileMessage(terminalId); + 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); + + //统计终端(充redis获取终端信息) + map.putAll(xhpcTerminalMapper.getXhpcRateTimeOrderStatistics(chargingStationId,gunNumber)); + 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 new file mode 100644 index 00000000..3a5c0da2 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingPileMapper.xml @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + insert into xhpc_charging_pile + + + 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 + + + + + #{chargingStationId}, + + + #{name}, + + + #{nationalStandard}, + + + #{power}, + + + #{auxiliaryPowerSupply}, + + + #{inputVoltage}, + + + #{maxVoltage}, + + + #{minVoltage}, + + + #{maxElectricCurrent}, + + + #{minElectriCurrent}, + + + #{serialNumber}, + + + #{type}, + + + #{programVersion}, + + + #{networkLinkType}, + + + #{gunNumber}, + + + #{communicationProtocolVersion}, + + + #{communicationOperator}, + + + #{simCard}, + + + #{rateModelId}, + + + #{chargingPileNumber}, + + + #{status}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark} + + + + + + + + \ No newline at end of file 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 6b1e39df..673a3d80 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 @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -144,6 +144,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, remark = #{remark}, rate_model_id = #{rateModelId}, + business_instructions = #{businessInstructions}, + reminder_instructions = #{reminderInstructions}, + img_id = #{imgId}, + station_type = #{stationType}, where charging_station_id = #{chargingStationId} @@ -261,7 +265,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" url as url from xhpc_img where del_flag=0 and status=0 - img_id in + and img_id in #{chargingStationId} @@ -393,7 +397,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" img_id, - + business_instructions, @@ -470,8 +474,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{imgId}, - - #{pbusinessInstructions}, + + #{businessInstructions}, #{reminderInstructions}, @@ -707,19 +711,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select max(real_time_order_id) from xhpc_real_time_order WHERE to_days(create_time) = to_days(now()) and charging_station_id=#{chargingStationId} group by charging_order_id ) - + + 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 + \ No newline at end of file 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 9cf1b85b..779c087c 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 @@ -22,6 +22,10 @@ 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 + + + + + + + + + + update xhpc_terminal + + charging_pile_id = #{chargingPileId}, + charging_station_id = #{chargingStationId}, + name = #{name}, + serial_number = #{serialNumber}, + pile_serial_number = #{pileSerialNumber}, + gun_status = #{gunStatus}, + work_status = #{workStatus}, + status = #{status}, + del_flag = #{delFlag}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + + where terminal_id = #{terminalId} + + + + insert into xhpc_terminal + + + 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 + + + + + #{chargingPileId}, + + + #{chargingStationId}, + + + #{name}, + + + #{serialNumber}, + + + #{pileSerialNumber}, + + + #{gunstatus}, + + + #{workStatus}, + + + #{status}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark} + + + + + + + + + + \ No newline at end of file