小时统计
This commit is contained in:
parent
8b7c3a4d82
commit
a968b77ccf
@ -350,7 +350,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
||||
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
||||
Map<String, Object> userMessage =new HashMap<>();
|
||||
if(xhpcChargeOrder.getSource()==1 && xhpcChargeOrder.getInternetSerialNumber() !=null){
|
||||
if(xhpcChargeOrder.getSource()==0){
|
||||
userMessage = xhpcChargeOrderService.getUserMessage(userId);
|
||||
if (userMessage == null || userMessage.get("balance") == null) {
|
||||
//订单异常
|
||||
@ -360,6 +360,9 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
R.ok();
|
||||
}
|
||||
}else{
|
||||
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
|
||||
xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
|
||||
}
|
||||
|
||||
//结算
|
||||
|
||||
@ -452,14 +452,15 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
|
||||
BigDecimal number = new BigDecimal(endHour + 1 - startHour);
|
||||
for (int i = startHour; i < endHour + 1; i++) {
|
||||
String end = String.format("%02d", i);
|
||||
//获取费率
|
||||
if (i == startHour) {
|
||||
//开始时间、结束时间
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, DateUtil.formatTime(startTime), i + ":59:59",yyyyMMdd,multiply);
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, DateUtil.formatTime(startTime), end + ":59:59",yyyyMMdd,multiply);
|
||||
} else if (i != endHour) {
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, i + ":00:00", i + ":59:59",yyyyMMdd,multiply);
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, end + ":00:00", end + ":59:59",yyyyMMdd,multiply);
|
||||
} else {
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, i + ":00:00", DateUtil.formatTime(endTime),yyyyMMdd,multiply);
|
||||
addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, end + ":00:00", DateUtil.formatTime(endTime),yyyyMMdd,multiply);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,5 +623,12 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
|
||||
System.out.println(date2.getTime()-date1.getTime());
|
||||
|
||||
|
||||
int i =4;
|
||||
int i1 =04;
|
||||
|
||||
|
||||
String end = String.format("%02d", i);
|
||||
System.out.println(end);
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,10 +238,10 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
if(operatorIdEvcs !=null){
|
||||
//未完成
|
||||
if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){
|
||||
Integer commissionType = Integer.parseInt(operatorIdEvcs.get("commissionType").toString());
|
||||
BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString());
|
||||
//0总金额提成 1服务费提成
|
||||
if(commissionType==0){
|
||||
if(new BigDecimal(0).compareTo(commissionRate)==-1){
|
||||
if("0".equals(operatorIdEvcs.get("commissionType").toString())){
|
||||
internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
actPrice = actPrice.multiply(internetCommission);
|
||||
}else{
|
||||
@ -251,6 +251,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( source== 0) {
|
||||
BigDecimal balance = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(100));
|
||||
String state = "";
|
||||
@ -382,11 +383,12 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
Date date = new Date();
|
||||
xhpcHistoryOrder.setCreateTime(date);
|
||||
xhpcHistoryOrder.setChargeModelEvcs(3);
|
||||
if(xhpcChargeOrder.getPower()!=null){
|
||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||
}
|
||||
if(source==0){
|
||||
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
||||
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||
|
||||
if(source==0){
|
||||
//扣除用户实际消费金额,添加消费记录
|
||||
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
|
||||
//剩余的钱
|
||||
|
||||
@ -594,6 +594,7 @@
|
||||
ho.internet_serial_number as internetSerialNumber,
|
||||
ho.total_price as totalPrice,
|
||||
ho.act_price as actPrice,
|
||||
ho.confirm_Result as confirmResult,
|
||||
co.charging_time as chargingTime,
|
||||
co.charging_degree as chargingDegree,
|
||||
co.start_time as startTime,
|
||||
@ -673,7 +674,7 @@
|
||||
and (
|
||||
(rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} )
|
||||
OR
|
||||
(rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') <= #{endTime})
|
||||
(rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} )
|
||||
OR
|
||||
(rt.start_time <= #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} )
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user