场站添加接口
This commit is contained in:
parent
81421fc675
commit
3f4f5aad93
@ -144,8 +144,8 @@ public class XhpcChargingStationController extends BaseController {
|
||||
* @param xhpcChargingStationDto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/addXhpcChargingStation")
|
||||
public AjaxResult addXhpcChargingStation(@Param("xhpcChargingStationDto") XhpcChargingStationDto xhpcChargingStationDto)
|
||||
@PostMapping(value = "/addXhpcChargingStation")
|
||||
public AjaxResult addXhpcChargingStation(@RequestBody XhpcChargingStationDto xhpcChargingStationDto)
|
||||
{
|
||||
return xhpcChargingStationService.addXhpcChargingStation(xhpcChargingStationDto);
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class XhpcChargingStation extends BaseEntity {
|
||||
private String detailedAddress;
|
||||
|
||||
/** 进度 */
|
||||
@Excel(name = "进度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
/** 维度 */
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.xhpc.charging.station.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 费率模板 xhpc_rate_model
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-24
|
||||
*/
|
||||
public class XhpcRateModel extends BaseEntity {
|
||||
|
||||
/** 费率模板id */
|
||||
private Long rateModelId;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private Integer status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private Integer delFlag;
|
||||
|
||||
public Integer getStatus() {
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer 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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.charging.station.domain;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@ -1,37 +1,48 @@
|
||||
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<XhpcRate> xhpcRateList;
|
||||
List<XhpcRateDto> xhpcRateList;
|
||||
|
||||
//费率时段
|
||||
List<XhpcRateTime> xhpcRateTimeList;
|
||||
List<XhpcRateTimeDto> xhpcRateTimeList;
|
||||
|
||||
public List<XhpcRate> getXhpcRateList() {
|
||||
//默认时段费率
|
||||
Long defaultPeriodId;
|
||||
|
||||
public List<XhpcRateDto> getXhpcRateList() {
|
||||
|
||||
return xhpcRateList;
|
||||
}
|
||||
|
||||
public void setXhpcRateList(List<XhpcRate> xhpcRateList) {
|
||||
public void setXhpcRateList(List<XhpcRateDto> xhpcRateList) {
|
||||
|
||||
this.xhpcRateList = xhpcRateList;
|
||||
}
|
||||
|
||||
public List<XhpcRateTime> getXhpcRateTimeList() {
|
||||
public List<XhpcRateTimeDto> getXhpcRateTimeList() {
|
||||
|
||||
return xhpcRateTimeList;
|
||||
}
|
||||
|
||||
public void setXhpcRateTimeList(List<XhpcRateTime> xhpcRateTimeList) {
|
||||
public void setXhpcRateTimeList(List<XhpcRateTimeDto> xhpcRateTimeList) {
|
||||
|
||||
this.xhpcRateTimeList = xhpcRateTimeList;
|
||||
}
|
||||
|
||||
public Long getDefaultPeriodId() {
|
||||
|
||||
return defaultPeriodId;
|
||||
}
|
||||
|
||||
public void setDefaultPeriodId(Long defaultPeriodId) {
|
||||
|
||||
this.defaultPeriodId = defaultPeriodId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xhpc.charging.station.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 费率
|
||||
*/
|
||||
public class XhpcRateDto {
|
||||
|
||||
/** 费率id(非数据库id,用于绑定费率时段使用) */
|
||||
private Long id;
|
||||
|
||||
/** 费率名称 */
|
||||
private String name;
|
||||
|
||||
/** 电费 */
|
||||
private BigDecimal powerFee;
|
||||
|
||||
/** 服务费 */
|
||||
private BigDecimal serviceFee;
|
||||
|
||||
public Long getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public BigDecimal getPowerFee() {
|
||||
|
||||
return powerFee;
|
||||
}
|
||||
|
||||
public void setPowerFee(BigDecimal powerFee) {
|
||||
|
||||
this.powerFee = powerFee;
|
||||
}
|
||||
|
||||
public BigDecimal getServiceFee() {
|
||||
|
||||
return serviceFee;
|
||||
}
|
||||
|
||||
public void setServiceFee(BigDecimal serviceFee) {
|
||||
|
||||
this.serviceFee = serviceFee;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.xhpc.charging.station.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 费率时段
|
||||
*/
|
||||
public class XhpcRateTimeDto {
|
||||
|
||||
/** 启始时间 */
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
|
||||
/** 费率id(非数据库id,用于绑定费率使用) */
|
||||
private Long id;
|
||||
|
||||
public String getStartTime() {
|
||||
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
package com.xhpc.charging.station.mapper;
|
||||
|
||||
import com.xhpc.charging.station.domain.XhpcChargingStation;
|
||||
import com.xhpc.charging.station.domain.XhpcRate;
|
||||
import com.xhpc.charging.station.domain.XhpcRateModel;
|
||||
import com.xhpc.charging.station.domain.XhpcRateTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -141,4 +144,26 @@ public interface XhpcChargingStationMapper {
|
||||
* @return 电站
|
||||
*/
|
||||
List<Map<String,Object>> getXhpcTerminalMassage(@Param("chargingStationId")Long chargingStationId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加费率模型
|
||||
*/
|
||||
int addXhpcRateModel(XhpcRateModel xhpcRateModel);
|
||||
|
||||
/**
|
||||
* 添加场站信息
|
||||
*/
|
||||
int addXhpcChargingStation(XhpcChargingStation xhpcChargingStation);
|
||||
|
||||
/**
|
||||
* 添加费率
|
||||
*/
|
||||
int addXhpcRate(XhpcRate xhpcRate);
|
||||
|
||||
|
||||
/**
|
||||
* 添加费率时段
|
||||
*/
|
||||
int addXhpcRateTime(XhpcRateTime xhpcRateTime);
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.xhpc.charging.station.mapper;
|
||||
/**
|
||||
* 费率模板Mapper接口
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-24
|
||||
*/
|
||||
public interface XhpcRateModelMapper {
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
/**
|
||||
* 费率模板Service接口
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-24
|
||||
*/
|
||||
public interface IXhpcRateModelService {
|
||||
|
||||
}
|
||||
@ -4,13 +4,21 @@ 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.XhpcRate;
|
||||
import com.xhpc.charging.station.domain.XhpcRateModel;
|
||||
import com.xhpc.charging.station.domain.XhpcRateTime;
|
||||
import com.xhpc.charging.station.dto.XhpcChargingStationDto;
|
||||
import com.xhpc.charging.station.dto.XhpcRateDto;
|
||||
import com.xhpc.charging.station.dto.XhpcRateTimeDto;
|
||||
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 电站Service业务层处理
|
||||
@ -180,8 +188,43 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult addXhpcChargingStation(XhpcChargingStationDto xhpcChargingStationDto) {
|
||||
|
||||
if(xhpcChargingStationDto.getName()==null || "".equals(xhpcChargingStationDto.getName())){
|
||||
return AjaxResult.error(1001,"电站名称不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getOperatorId()==null){
|
||||
return AjaxResult.error(1001,"运营商不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getAreaCode()==null){
|
||||
return AjaxResult.error(1001,"电站地址不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getAddress()==null){
|
||||
return AjaxResult.error(1001,"详细地址不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getServiceFacilities()==null){
|
||||
return AjaxResult.error(1001,"服务设施不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getSerialNumber()==null){
|
||||
return AjaxResult.error(1001,"站编号不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getParkingInstructions()==null){
|
||||
return AjaxResult.error(1001,"停车说明不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getPbusinessInstructions()==null){
|
||||
return AjaxResult.error(1001,"营业时间说明不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getReminderInstructions()==null){
|
||||
return AjaxResult.error(1001,"温馨提示说明不能为空");
|
||||
}
|
||||
if(xhpcChargingStationDto.getRemark()==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,"费率不能为空");
|
||||
@ -189,30 +232,142 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){
|
||||
return AjaxResult.error(1001,"费率时段不能为空");
|
||||
}
|
||||
List<XhpcRateTime> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
|
||||
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
|
||||
|
||||
boolean s =false;
|
||||
for (int i = 0; i < xhpcRateTimeList.size(); i++) {
|
||||
XhpcRateTime xhpcRateTime = xhpcRateTimeList.get(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("1003","时间段有重叠");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//判断开始时间是否有00:00
|
||||
//添加费率计费模型
|
||||
XhpcRateModel xhpcRateModel = new XhpcRateModel();
|
||||
BeanUtils.copyProperties(xhpcChargingStationDto,xhpcRateModel);
|
||||
int i = xhpcChargingStationMapper.addXhpcRateModel(xhpcRateModel);
|
||||
if(i==0){
|
||||
return AjaxResult.error("1004","费率计费模型添加失败");
|
||||
}
|
||||
//费率模型id
|
||||
Long rateModelId = xhpcRateModel.getRateModelId();
|
||||
//添加电站基本信息
|
||||
XhpcChargingStation xhpcChargingStation =new XhpcChargingStation();
|
||||
BeanUtils.copyProperties(xhpcChargingStationDto,xhpcChargingStation);
|
||||
xhpcChargingStation.setRateModelId(rateModelId);
|
||||
int j = xhpcChargingStationMapper.addXhpcChargingStation(xhpcChargingStation);
|
||||
if(j==0){
|
||||
return AjaxResult.error("1003","电站基本信息添加失败");
|
||||
}
|
||||
Long chargingStationId = xhpcChargingStation.getChargingStationId();
|
||||
|
||||
//添加费率
|
||||
|
||||
Map<Long,Long> map =new HashMap<>();
|
||||
List<XhpcRateDto> 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<XhpcRateTimeDto> 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(rateModelId,defaultPeriodId,"00:00:00",startTime,sort);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(rateModelId,defaultPeriodIdMap,startTime,endTime,sort);
|
||||
}else{
|
||||
//判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段
|
||||
String endTimeK = list.get(k - 1).getEndTime();
|
||||
if(!endTimeK.equals(startTime)){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(rateModelId,defaultPeriodId,endTimeK,startTime,sort);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(rateModelId,defaultPeriodIdMap,startTime,endTime,sort);
|
||||
|
||||
if(k==(list.size()-1) && !endTimeK.equals("24:00:00")){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(rateModelId,defaultPeriodId,startTime,"24:00:00",sort);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
private int addXhpcRateTime(Long rateModelId, Long defaultPeriodId,String startTime,String endTime, int sort) {
|
||||
XhpcRateTime xhpcRateTime =new XhpcRateTime();
|
||||
xhpcRateTime.setRateId(defaultPeriodId);
|
||||
Date start = DateUtil.parse(startTime);
|
||||
xhpcRateTime.setStartTime(start);
|
||||
Date emd = DateUtil.parse(endTime);
|
||||
xhpcRateTime.setEndTime(emd);
|
||||
xhpcRateTime.setRateTimeId(rateModelId);
|
||||
xhpcRateTime.setSort(sort);
|
||||
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
||||
sort++;
|
||||
return sort;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -312,4 +467,26 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
return list;
|
||||
}
|
||||
|
||||
public static XhpcRateTimeDto [] bubbleSort(XhpcRateTimeDto [] args){
|
||||
//冒泡排序算法
|
||||
for(int i=0;i<args.length-1;i++){
|
||||
|
||||
for(int j=i+1;j<args.length;j++){
|
||||
String start = args[i].getEndTime();
|
||||
String end = args[j].getStartTime();
|
||||
if(DateUtil.parse(start).getTime()>DateUtil.parse(end).getTime()){
|
||||
XhpcRateTimeDto temp=args[i];
|
||||
|
||||
args[i]=args[j];
|
||||
|
||||
args[j]=temp;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 费率模板Service业务层处理
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-24
|
||||
*/
|
||||
@Service
|
||||
public class XhpcRateModelServiceImpl implements IXhpcRateModelService{
|
||||
|
||||
}
|
||||
@ -265,4 +265,372 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||
where te.charging_station_id =#{chargingStationId} and te.status=0 and te.del_flag=0
|
||||
</select>
|
||||
|
||||
<insert id="addXhpcRateModel" parameterType="com.xhpc.charging.station.domain.XhpcRateModel" useGeneratedKeys="true" keyProperty="rateModelId">
|
||||
insert into xhpc_rate_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="addXhpcChargingStation" parameterType="com.xhpc.charging.station.domain.XhpcChargingStation" useGeneratedKeys="true" keyProperty="chargingStationId">
|
||||
insert into xhpc_charging_station
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != name and '' != name">
|
||||
name,
|
||||
</if>
|
||||
<if test="null != operatorId ">
|
||||
operator_id,
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
type,
|
||||
</if>
|
||||
<if test="null != constructionSite and '' != constructionSite">
|
||||
construction_site,
|
||||
</if>
|
||||
<if test="null != serviceFacilities and '' != serviceFacilities">
|
||||
service_facilities,
|
||||
</if>
|
||||
<if test="null != peripheryFacilities and '' != peripheryFacilities">
|
||||
periphery_facilities,
|
||||
</if>
|
||||
<if test="null != areaCode ">
|
||||
area_code,
|
||||
</if>
|
||||
<if test="null != address and '' != address">
|
||||
address,
|
||||
</if>
|
||||
<if test="null != detailedAddress and '' != detailedAddress">
|
||||
detailed_address,
|
||||
</if>
|
||||
<if test="null != longitude and '' != longitude">
|
||||
longitude,
|
||||
</if>
|
||||
<if test="null != latitude and '' != latitude">
|
||||
latitude,
|
||||
</if>
|
||||
<if test="null != parkingInstructions and '' != parkingInstructions">
|
||||
parking_instructions,
|
||||
</if>
|
||||
<if test="null != serialNumber and '' != serialNumber">
|
||||
serial_number,
|
||||
</if>
|
||||
<if test="null != clientVisible and '' != clientVisible">
|
||||
client_visible,
|
||||
</if>
|
||||
<if test="null != rateModelId and '' != rateModelId">
|
||||
rate_model_id,
|
||||
</if>
|
||||
<if test="null != imgId and '' != imgId">
|
||||
img_id,
|
||||
</if>
|
||||
<if test="null != pbusinessInstructions and '' != pbusinessInstructions">
|
||||
business_instructions,
|
||||
</if>
|
||||
<if test="null != reminderInstructions and '' != reminderInstructions">
|
||||
reminder_instructions,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != name and '' != name">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="null != operatorId ">
|
||||
#{operatorId},
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != constructionSite and '' != constructionSite">
|
||||
#{constructionSite},
|
||||
</if>
|
||||
<if test="null != serviceFacilities and '' != serviceFacilities">
|
||||
#{serviceFacilities},
|
||||
</if>
|
||||
<if test="null != peripheryFacilities and '' != peripheryFacilities">
|
||||
#{peripheryFacilities},
|
||||
</if>
|
||||
<if test="null != areaCode ">
|
||||
#{areaCode},
|
||||
</if>
|
||||
<if test="null != address and '' != address">
|
||||
#{address},
|
||||
</if>
|
||||
<if test="null != detailedAddress and '' != detailedAddress">
|
||||
#{detailedAddress},
|
||||
</if>
|
||||
<if test="null != longitude and '' != longitude">
|
||||
#{longitude},
|
||||
</if>
|
||||
<if test="null != latitude and '' != latitude">
|
||||
#{latitude},
|
||||
</if>
|
||||
<if test="null != parkingInstructions and '' != parkingInstructions">
|
||||
#{parkingInstructions},
|
||||
</if>
|
||||
<if test="null != serialNumber and '' != serialNumber">
|
||||
#{serialNumber},
|
||||
</if>
|
||||
<if test="null != clientVisible and '' != clientVisible">
|
||||
#{clientVisible},
|
||||
</if>
|
||||
<if test="null != rateModelId and '' != rateModelId">
|
||||
#{rateModelId},
|
||||
</if>
|
||||
<if test="null != imgId and '' != imgId">
|
||||
#{imgId},
|
||||
</if>
|
||||
<if test="null != pbusinessInstructions and '' != pbusinessInstructions">
|
||||
#{pbusinessInstructions},
|
||||
</if>
|
||||
<if test="null != reminderInstructions and '' != reminderInstructions">
|
||||
#{reminderInstructions},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="addXhpcRate" parameterType="com.xhpc.charging.station.domain.XhpcRate" useGeneratedKeys="true" keyProperty="rateId">
|
||||
insert into xhpc_rate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != powerFee ">
|
||||
power_fee,
|
||||
</if>
|
||||
<if test="null != serviceFee ">
|
||||
service_fee,
|
||||
</if>
|
||||
<if test="null != name and '' != name">
|
||||
name,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != powerFee ">
|
||||
#{powerFee},
|
||||
</if>
|
||||
<if test="null != serviceFee ">
|
||||
#{serviceFee},
|
||||
</if>
|
||||
<if test="null != name and '' != name">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="addXhpcRateTime" parameterType="com.xhpc.charging.station.domain.XhpcRateTime" useGeneratedKeys="true" keyProperty="rateId">
|
||||
insert into xhpc_rate_time
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != rateId ">
|
||||
rate_id,
|
||||
</if>
|
||||
<if test="null != startTime ">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="null != endTime ">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="null != rateModelId ">
|
||||
rate_model_id,
|
||||
</if>
|
||||
<if test="null != sort ">
|
||||
sort,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != rateId ">
|
||||
#{rateId},
|
||||
</if>
|
||||
<if test="null != startTime ">
|
||||
#{startTime},
|
||||
</if>
|
||||
<if test="null != endTime ">
|
||||
#{endTime},
|
||||
</if>
|
||||
<if test="null != rateModelId ">
|
||||
#{rateModelId},
|
||||
</if>
|
||||
<if test="null != sort ">
|
||||
sort,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.charging.station.mapper.XhpcRateModelMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.charging.station.domain.XhpcRateModel">
|
||||
<result property="rateModelId" column="rate_model_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user