修改实时订单搜索
This commit is contained in:
parent
e98550539d
commit
682de75a23
@ -412,76 +412,90 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
try{
|
||||
//小时统计
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(500,0);
|
||||
if(list !=null && list.size()>0){
|
||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||
Date startTime = xhpc.getStartTime();
|
||||
Date endTime = xhpc.getEndTime();
|
||||
Long rateModelId = xhpc.getRateModelId();
|
||||
Long operatorId =xhpc.getOperatorId();
|
||||
Long chargingStationId = xhpc.getChargingStationId();
|
||||
Long terminalId = xhpc.getTerminalId();
|
||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||
Date data = Calendar.getInstance().getTime();
|
||||
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
//每分钟多少度电
|
||||
BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
if(v.compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
int endHour = DateUtil.hour(endTime, true);
|
||||
|
||||
//没有跨时段
|
||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||
xhpcSt.setStatus(endHour+1);
|
||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setChargingNumber(1);
|
||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
||||
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
||||
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
||||
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
||||
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
||||
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
||||
xhpcSt.setOperatorId(operatorId);
|
||||
xhpcSt.setChargingStationId(chargingStationId);
|
||||
xhpcSt.setCreateTime(data);
|
||||
xhpcSt.setTerminalId(terminalId);
|
||||
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||
if(xhpc.getSource()==1){
|
||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||
try{
|
||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||
Date startTime = xhpc.getStartTime();
|
||||
Date endTime = xhpc.getEndTime();
|
||||
Long rateModelId = xhpc.getRateModelId();
|
||||
Long operatorId =xhpc.getOperatorId();
|
||||
Long chargingStationId = xhpc.getChargingStationId();
|
||||
Long terminalId = xhpc.getTerminalId();
|
||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||
Date data = Calendar.getInstance().getTime();
|
||||
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
//每分钟多少度电
|
||||
BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
if(v.compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
int endHour = DateUtil.hour(endTime, true);
|
||||
|
||||
//没有跨时段
|
||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||
xhpcSt.setStatus(endHour+1);
|
||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setChargingNumber(1);
|
||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
||||
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
||||
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
||||
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
||||
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
||||
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
||||
xhpcSt.setOperatorId(operatorId);
|
||||
xhpcSt.setChargingStationId(chargingStationId);
|
||||
xhpcSt.setCreateTime(data);
|
||||
xhpcSt.setTerminalId(terminalId);
|
||||
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||
if(xhpc.getSource()==1){
|
||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||
}
|
||||
|
||||
//时间没有跨天
|
||||
// DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
// DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
// long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// if(betweenDay==0){
|
||||
// List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), rateModelId);
|
||||
// map = reatTimeList.get(0);
|
||||
// }else{
|
||||
// //明天
|
||||
// DateTime tomorrow = DateUtil.offsetDay(startTime,1);
|
||||
// Date startTime3 =DateUtil.beginOfDay(tomorrow);
|
||||
// List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime), rateModelId);
|
||||
// map = reatTimeList.get(0);
|
||||
// }
|
||||
// xhpcSt.setElecPriceEvcs(new BigDecimal(map.get("powerFee").toString()));
|
||||
// xhpcSt.setServicePriceEvcs(new BigDecimal(map.get("serviceFee").toString()));
|
||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||
}catch (Exception e){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||
}
|
||||
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), rateModelId);
|
||||
Map<String, Object> map = reatTimeList.get(0);
|
||||
xhpcSt.setElecPriceEvcs(new BigDecimal(map.get("powerFee").toString()));
|
||||
xhpcSt.setServicePriceEvcs(new BigDecimal(map.get("serviceFee").toString()));
|
||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@
|
||||
and co.serial_number like concat('%', #{transactionNumber}, '%')
|
||||
</if>
|
||||
<if test="chargingStationName !=null and chargingStationName !=''">
|
||||
and co.serial_number like concat('%', #{chargingStationName}, '%')
|
||||
and ct.name like concat('%', #{chargingStationName}, '%')
|
||||
</if>
|
||||
<if test="terminalName !=null and terminalName !=''">
|
||||
and ter.name like concat('%', #{terminalName}, '%')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user