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 3433acc0..b7d66b72 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 @@ -1,7 +1,6 @@ package com.xhpc.charging.station.mapper; import com.xhpc.common.domain.XhpcChargingPile; -import com.xhpc.common.domain.XhpcChargingStation; import org.apache.ibatis.annotations.Param; import java.util.List; 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 74be454e..a2bd42c2 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 @@ -306,7 +306,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi Long chargingStationId = xhpcChargingStation.getChargingStationId(); //添加费率 - Map map =new HashMap<>(); + Map map =new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id @@ -317,6 +317,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); xhpcRate.setRateModelId(rateModelId); + xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); } @@ -336,39 +337,43 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); } + //默认费率类型值 + String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); int sort =1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); String endTime = xhpcRateTimeDto.getEndTime(); - Long defaultPeriodIdMap = map.get(xhpcRateTimeDto.getId()); + String rateValues = xhpcRateTimeDto.getId(); + Long defaultPeriodIdMap = map.get(rateValues); + 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,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); } //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); }else if(k map =new HashMap<>(); + Map map =new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id @@ -643,6 +649,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); xhpcRate.setRateModelId(rateModelId); + xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); } @@ -662,39 +669,42 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); } + //默认费率类型值 + String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); int sort =1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); String endTime = xhpcRateTimeDto.getEndTime(); Long defaultPeriodIdMap = map.get(xhpcRateTimeDto.getId()); + String rateValues = xhpcRateTimeDto.getId(); if(k==0){ if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); } //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); }else if(k - + update xhpc_charging_pile charging_station_id = #{chargingStationId}, 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 cf7e1ee2..dca26a0e 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 @@ -156,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update xhpc_charging_station set del_flag =1 where charging_station_id = #{chargingStationId} - + update xhpc_charging_station set del_flag =1 where charging_station_id in #{chargingStationId} @@ -726,7 +726,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update xhpc_rate_time set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0 - select serial_number as pileNo from xhpc_charging_pile 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 index 4b4998ef..6c5ca284 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml @@ -17,6 +17,7 @@ + \ No newline at end of file diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml index 4af2d986..a7674e55 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml @@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +