添加费率,id Long变成String类型
This commit is contained in:
parent
a517cc1033
commit
8c24b294ea
@ -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;
|
||||
|
||||
@ -306,7 +306,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
Long chargingStationId = xhpcChargingStation.getChargingStationId();
|
||||
|
||||
//添加费率
|
||||
Map<Long,Long> map =new HashMap<>();
|
||||
Map<String,Long> map =new HashMap<>();
|
||||
List<XhpcRateDto> 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<list.size()){
|
||||
//判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段
|
||||
String endTimeK = list.get(k - 1).getEndTime();
|
||||
if(!endTimeK.equals(startTime)){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||
}else{
|
||||
String endTimeK = list.get(k - 1).getEndTime();
|
||||
if(!endTimeK.equals(startTime)){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||
if(!endTime.equals("24:00:00")){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2,rateValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -411,7 +416,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
return map;
|
||||
}
|
||||
|
||||
private int addXhpcRateTime(Long chargingStationId,Long rateModelId, Long defaultPeriodId,String startTime,String endTime, int sort,int type) {
|
||||
private int addXhpcRateTime(Long chargingStationId,Long rateModelId, Long defaultPeriodId,String startTime,String endTime, int sort,int type,String rateValue) {
|
||||
XhpcRateTime xhpcRateTime =new XhpcRateTime();
|
||||
xhpcRateTime.setChargingStationId(chargingStationId);
|
||||
xhpcRateTime.setRateId(defaultPeriodId);
|
||||
@ -422,6 +427,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
xhpcRateTime.setRateModelId(rateModelId);
|
||||
xhpcRateTime.setSort(sort);
|
||||
xhpcRateTime.setType(type);
|
||||
xhpcRateTime.setRateValue(rateValue);
|
||||
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
||||
sort++;
|
||||
return sort;
|
||||
@ -632,7 +638,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
xhpcChargingStationMapper.updateXhpcRate(chargingStationId);
|
||||
|
||||
//添加费率
|
||||
Map<Long,Long> map =new HashMap<>();
|
||||
Map<String,Long> map =new HashMap<>();
|
||||
List<XhpcRateDto> 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<list.size()){
|
||||
//判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段
|
||||
String endTimeK = list.get(k - 1).getEndTime();
|
||||
if(!endTimeK.equals(startTime)){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||
}else{
|
||||
String endTimeK = list.get(k - 1).getEndTime();
|
||||
if(!endTimeK.equals(startTime)){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||
}
|
||||
//并把本条数据也添加上
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||
if(!endTime.equals("24:00:00")){
|
||||
//添加一条默认费率时段
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2);
|
||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2,rateValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where charging_pile_id = #{chargingPileId}
|
||||
</select>
|
||||
|
||||
<update id="updaeXhpcChargingPile" parameterType="Long">
|
||||
<update id="updaeXhpcChargingPile" parameterType="Integer">
|
||||
update xhpc_charging_pile
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="chargingStationId != null">charging_station_id = #{chargingStationId},</if>
|
||||
|
||||
@ -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>
|
||||
|
||||
<update id="updateXhpcChargingStationByIds" parameterType="java.long.String">
|
||||
<update id="updateXhpcChargingStationByIds" parameterType="java.lang.String">
|
||||
update xhpc_charging_station set del_flag =1 where charging_station_id in
|
||||
<foreach item="chargingStationId" collection="array" open="(" separator="," close=")">
|
||||
#{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
|
||||
</update>
|
||||
|
||||
<select id="getXchargingPileList" resultType="Set">
|
||||
<select id="getXchargingPileList" resultType="java.lang.String">
|
||||
select
|
||||
serial_number as pileNo
|
||||
from xhpc_charging_pile
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="rateValue" column="rate_value"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="type" column="type" />
|
||||
<result property="rateValue" column="rate_value"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getXhpcRateTime" resultType="map">
|
||||
|
||||
@ -258,6 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
cp.max_voltage as maxVoltage,
|
||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||
ct.parking_instructions as parkingInstructions,
|
||||
ct.create_time as createTime,
|
||||
ter.charging_station_id as chargingStationId
|
||||
from xhpc_terminal as ter
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id=ter.charging_pile_id
|
||||
|
||||
@ -13,7 +13,7 @@ public class XhpcChargingStationDto extends XhpcChargingStation {
|
||||
List<XhpcRateTimeDto> xhpcRateTimeList;
|
||||
|
||||
//默认时段费率
|
||||
Long defaultPeriodId;
|
||||
String defaultPeriodId;
|
||||
|
||||
public List<XhpcRateDto> getXhpcRateList() {
|
||||
|
||||
@ -35,12 +35,12 @@ public class XhpcChargingStationDto extends XhpcChargingStation {
|
||||
this.xhpcRateTimeList = xhpcRateTimeList;
|
||||
}
|
||||
|
||||
public Long getDefaultPeriodId() {
|
||||
public String getDefaultPeriodId() {
|
||||
|
||||
return defaultPeriodId;
|
||||
}
|
||||
|
||||
public void setDefaultPeriodId(Long defaultPeriodId) {
|
||||
public void setDefaultPeriodId(String defaultPeriodId) {
|
||||
|
||||
this.defaultPeriodId = defaultPeriodId;
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import java.math.BigDecimal;
|
||||
public class XhpcRateDto {
|
||||
|
||||
/** 费率id(非数据库id,用于绑定费率时段使用) */
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
/** 费率名称 */
|
||||
private String name;
|
||||
@ -19,12 +19,12 @@ public class XhpcRateDto {
|
||||
/** 服务费 */
|
||||
private BigDecimal serviceFee;
|
||||
|
||||
public Long getId() {
|
||||
public String getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public void setId(String id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class XhpcRateTimeDto {
|
||||
private String endTime;
|
||||
|
||||
/** 费率id(非数据库id,用于绑定费率使用) */
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
public String getStartTime() {
|
||||
|
||||
@ -36,12 +36,12 @@ public class XhpcRateTimeDto {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public String getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public void setId(String id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -38,6 +38,9 @@ public class XhpcRate extends BaseEntity {
|
||||
/** 费率模型id */
|
||||
private Long rateModelId;
|
||||
|
||||
/** 费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率 */
|
||||
private String rateValue;
|
||||
|
||||
public Long getRateId() {
|
||||
|
||||
return rateId;
|
||||
@ -118,4 +121,14 @@ public class XhpcRate extends BaseEntity {
|
||||
this.rateModelId = rateModelId;
|
||||
}
|
||||
|
||||
public String getRateValue() {
|
||||
|
||||
return rateValue;
|
||||
}
|
||||
|
||||
public void setRateValue(String rateValue) {
|
||||
|
||||
this.rateValue = rateValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,6 +44,9 @@ public class XhpcRateTime extends BaseEntity {
|
||||
/** 1 设置时间段 2默认时间段 */
|
||||
private Integer type;
|
||||
|
||||
/** 费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率 */
|
||||
private String rateValue;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
|
||||
return serialVersionUID;
|
||||
@ -149,4 +152,15 @@ public class XhpcRateTime extends BaseEntity {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getRateValue() {
|
||||
|
||||
return rateValue;
|
||||
}
|
||||
|
||||
public void setRateValue(String rateValue) {
|
||||
|
||||
this.rateValue = rateValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user