适配费率模型为半个小时时段

This commit is contained in:
yuyang 2022-08-12 17:30:22 +08:00
parent b20e7ae470
commit 31fbd083f0
2 changed files with 55 additions and 5 deletions

View File

@ -535,11 +535,23 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
String str = startTime.split(":")[0];
int st= Integer.valueOf(str);
String str1 = startTime.split(":")[1];
if("30".equals(str1)){
st=st*2+1;
}else{
st=st*2;
}
String endT = endTime.split(":")[0];
int end= Integer.valueOf(endT);
for (int l = st*2; l <end*2 ; l++) {
String endT1 = endTime.split(":")[1];
if("30".equals(endT1)){
end=end*2+1;
}else{
end=end*2;
}
for (int l = st; l <end ; l++) {
tfPricesSeq[l]=rateValues;
//System.out.println("=====tfPricesSeq["+l+"]=========="+rateValues+"===========");
}
if(list.size() == 1){
@ -1169,11 +1181,24 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
String str = startTime.split(":")[0];
int st= Integer.valueOf(str);
String str1 = startTime.split(":")[1];
if("30".equals(str1)){
st=st*2+1;
}else{
st=st*2;
}
String endT = endTime.split(":")[0];
int end= Integer.valueOf(endT);
for (int l = st*2; l <end*2 ; l++) {
String endT1 = endTime.split(":")[1];
if("30".equals(endT1)){
end=end*2+1;
}else{
end=end*2;
}
for (int l = st; l <end ; l++) {
tfPricesSeq[l]=rateValues;
//System.out.println("=====tfPricesSeq["+l+"]=========="+rateValues+"===========");
}
if(list.size() == 1){
@ -1518,4 +1543,15 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
}
public static void main(String[] args) {
String st="14:30:00";
String end="15:30:00";
long sttime = DateUtil.parse(st, "HH:mm:ss").getTime();
long endtime = DateUtil.parse(end, "HH:mm:ss").getTime();
System.out.println((endtime-sttime)/1800000);
}
}

View File

@ -242,10 +242,24 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
Long defaultPeriodIdMap = map.get(rateValues);
String str = startTime.split(":")[0];
int st= Integer.valueOf(str);
String str1 = startTime.split(":")[1];
if("30".equals(str1)){
st=st*2+1;
}else{
st=st*2;
}
String endT = endTime.split(":")[0];
int end= Integer.valueOf(endT);
for (int l = st*2; l <end*2 ; l++) {
String endT1 = endTime.split(":")[1];
if("30".equals(endT1)){
end=end*2+1;
}else{
end=end*2;
}
for (int l = st; l <end ; l++) {
tfPricesSeq[l]=rateValues;
//System.out.println("=====tfPricesSeq["+l+"]=========="+rateValues+"===========");
}
if(list.size() == 1){
if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){