From e10fde5e9af7dceb32e27547645a7c09f25a9b3d Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Wed, 21 Jul 2021 19:54:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E7=AB=99=E6=B7=BB=E5=8A=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcChargingStationController.java | 12 ++++++ .../station/domain/XhpcChargingStation.java | 15 +++++++ .../charging/station/domain/XhpcRate.java | 40 +++++++++++++++++++ .../station/dto/XhpcChargingStationDto.java | 37 +++++++++++++++++ .../station/mapper/XhpcRateMapper.java | 10 +++++ .../service/IXhpcChargingStationService.java | 9 +++++ .../station/service/IXhpcRateService.java | 10 +++++ .../XhpcChargingStationServiceImpl.java | 39 ++++++++++++++++++ .../station/service/XhpcRateServiceImpl.java | 13 ++++++ .../mapper/XhpcChargingStationMapper.xml | 3 +- .../main/resources/mapper/XhpcRateMapper.xml | 22 ++++++++++ 11 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcRate.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcChargingStationDto.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateMapper.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateService.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateServiceImpl.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml 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 8ab8874e..7a50284b 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 @@ -8,6 +8,7 @@ import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.PreAuthorize; import com.xhpc.charging.station.domain.XhpcChargingStation; +import com.xhpc.charging.station.dto.XhpcChargingStationDto; import com.xhpc.charging.station.service.IXhpcChargingStationService; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; @@ -138,6 +139,17 @@ public class XhpcChargingStationController extends BaseController { } + /** + * 添加场点 + * @param xhpcChargingStationDto + * @return + */ + @GetMapping(value = "/addXhpcChargingStation") + public AjaxResult addXhpcChargingStation(@Param("xhpcChargingStationDto") XhpcChargingStationDto xhpcChargingStationDto) + { + return xhpcChargingStationService.addXhpcChargingStation(xhpcChargingStationDto); + } + /** * 微信小程序电站列表 * @param name 电站名称 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 a0b346bb..4272b955 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 @@ -84,6 +84,10 @@ public class XhpcChargingStation extends BaseEntity { @Excel(name = "当前计费模型id") private Long rateModelId; + /** 图片id */ + @Excel(name = "图片id") + private String imgId; + public void setChargingStationId(Long chargingStationId) { this.chargingStationId = chargingStationId; @@ -246,4 +250,15 @@ public class XhpcChargingStation extends BaseEntity { { return rateModelId; } + + public String getImgId() { + + return imgId; + } + + public void setImgId(String imgId) { + + this.imgId = imgId; + } + } diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcRate.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcRate.java new file mode 100644 index 00000000..f42b0395 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/domain/XhpcRate.java @@ -0,0 +1,40 @@ +package com.xhpc.charging.station.domain; + +import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.poi.hpsf.Decimal; + +/** + * 费率对象 xhpc_rate + * + * @author yuyang + * @date 2021-07-21 + */ +public class XhpcRate extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** 费率id */ + private Long rateId; + + /** 电站id */ + private Long chargingStationId; + + /** 电费 */ + private Decimal powerFee; + + /** 服务费 */ + private Decimal serviceFee; + + /** 名称 */ + private String name; + + /** 状态(0正常 1停用) */ + private Integer status; + + /** 删除标志(0代表存在 2代表删除) */ + private Integer delFlag; + + /** 费率模型id */ + private Long rateModelId; + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcChargingStationDto.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcChargingStationDto.java new file mode 100644 index 00000000..1cfab8a3 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcChargingStationDto.java @@ -0,0 +1,37 @@ +package com.xhpc.charging.station.dto; + +import com.xhpc.charging.station.domain.XhpcChargingStation; +import com.xhpc.charging.station.domain.XhpcRate; +import com.xhpc.charging.station.domain.XhpcRateTime; + +import java.util.List; + +public class XhpcChargingStationDto extends XhpcChargingStation { + + //费率 + List xhpcRateList; + + //费率时段 + List xhpcRateTimeList; + + public List getXhpcRateList() { + + return xhpcRateList; + } + + public void setXhpcRateList(List xhpcRateList) { + + this.xhpcRateList = xhpcRateList; + } + + public List getXhpcRateTimeList() { + + return xhpcRateTimeList; + } + + public void setXhpcRateTimeList(List xhpcRateTimeList) { + + this.xhpcRateTimeList = xhpcRateTimeList; + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateMapper.java new file mode 100644 index 00000000..de324bee --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcRateMapper.java @@ -0,0 +1,10 @@ +package com.xhpc.charging.station.mapper; +/** + * 费率Mapper接口 + * + * @author yuyang + * @date 2021-07-19 + */ +public interface XhpcRateMapper { + +} 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 46421f93..f9722832 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 @@ -1,6 +1,8 @@ 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 java.util.List; import java.util.Map; @@ -89,6 +91,13 @@ public interface IXhpcChargingStationService { */ public List> stationInternetBlackList(Long chargingStationId); + /** + * 添加场点 + * @param xhpcChargingStationDto + * @return + */ + AjaxResult addXhpcChargingStation(XhpcChargingStationDto xhpcChargingStationDto); + /** diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateService.java new file mode 100644 index 00000000..9748474b --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcRateService.java @@ -0,0 +1,10 @@ +package com.xhpc.charging.station.service; +/** + * 费率Service接口 + * + * @author yuyang + * @date 2021-07-21 + */ +public interface IXhpcRateService { + +} 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 79a3822e..ef55983b 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 @@ -2,7 +2,10 @@ package com.xhpc.charging.station.service; import cn.hutool.core.date.DateUtil; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.xhpc.charging.station.domain.XhpcChargingStation; +import com.xhpc.charging.station.domain.XhpcRateTime; +import com.xhpc.charging.station.dto.XhpcChargingStationDto; import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -176,6 +179,42 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi return xhpcChargingStationMapper.stationInternetBlackList(chargingStationId); } + @Override + public AjaxResult addXhpcChargingStation(XhpcChargingStationDto xhpcChargingStationDto) { + + //判断费率和费率时间段 是否有值 + 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(); + + boolean s =false; + for (int i = 0; i < xhpcRateTimeList.size(); i++) { + XhpcRateTime xhpcRateTime = xhpcRateTimeList.get(i); + + + + } + + //判断开始时间是否有00:00 + + + + + //判断结束时间是否小于开始时间 + //检查格式是否正确 + //冒泡排序(结束时间小于开始时间) + + + + + + return null; + } + @Override public List> wxList(String name, String serviceFacilities, Integer code, String longitude, String latitude) { diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateServiceImpl.java new file mode 100644 index 00000000..8457ed33 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcRateServiceImpl.java @@ -0,0 +1,13 @@ +package com.xhpc.charging.station.service; +import org.springframework.stereotype.Service; + +/** + * 费率Service业务层处理 + * + * @author yuyang + * @date 2021-07-21 + */ +@Service +public class XhpcRateServiceImpl implements IXhpcRateService{ + +} 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 db7b95db..07d8171a 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 @@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" cs.name as name, ope.name as operatorName, cs.address as address, - (select url from xhpc_img where charging_station_id = cs.charging_station_id limit 1) as url, + (select url from xhpc_img where img_id = cs.img_id and del_flag =0 limit 1) as url, cs.client_visible as clientVisible, cs.status as status from xhpc_charging_station as cs diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml new file mode 100644 index 00000000..51ce7eda --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file