修改订单统计

This commit is contained in:
yuyang 2022-07-12 09:59:21 +08:00
parent 8031059d31
commit d59212d23b
7 changed files with 171 additions and 98 deletions

View File

@ -945,22 +945,16 @@ public class XhpcHistoryOrderController extends BaseController {
//检查统计没有入库的订单
@Scheduled(cron = "0 1 * * * ?")
@GetMapping("/getInvo")
//检查统计没有入库的订单小时)
@Scheduled(cron = "0 5 * * * ?")
@GetMapping("/getInvoTime")
public void getNoStatisticsOrderTime(){
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(500);
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(3000);
if(list !=null && list.size()>0){
for (XhpcChargeHistoryOrder xhpc:list) {
try{
Long historyOrderId = xhpc.getHistoryOrderId();
int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId);
if(count>0){
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(historyOrderId,null);
if(historyOrder.getState()==0){
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,1);
}
}
if(count==0){
//开始时间结束时间模型id状态用户id运营商订单id场站id终端id历史订单id时间
Long operatorId =xhpc.getOperatorId();
@ -1015,10 +1009,15 @@ public class XhpcHistoryOrderController extends BaseController {
}
}
}
List<XhpcChargeHistoryOrder> listOrder = xhpcHistoryOrderService.getNoStatisticsOrder(500);
}
//检查统计没有入库的订单日期电站
@Scheduled(cron = "0 30 * * * ?")
@GetMapping("/getInvoDay")
public void getInvoDay(){
List<XhpcChargeHistoryOrder> listOrder = xhpcHistoryOrderService.getNoStatisticsOrderDay(500);
if(listOrder !=null && listOrder.size()>0){
for (XhpcChargeHistoryOrder xhpc:listOrder) {
try{
Long historyOrderId = xhpc.getHistoryOrderId();
for (int i = 1; i <4 ; i++) {
//查询统计表是否有已添加的数据
@ -1063,6 +1062,10 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcStatisticsService.addStatisticsStation(xhpcSt);
}
}
}catch (Exception e){
e.printStackTrace();
logger.info(">>>>>>>>>>>>>>>>>>>>>>日期电站统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
}
}
}
}
@ -1075,7 +1078,9 @@ public class XhpcHistoryOrderController extends BaseController {
if(list !=null && list.size()>0){
for (XhpcChargeHistoryOrder xhpc:list) {
Long historyOrderId = xhpc.getHistoryOrderId();
try{
for (int i = type; i <4 ; i++) {
//查询统计表是否有已添加的数据
int count = xhpcStatisticsService.getStatisticsStationHistoryOrderId(historyOrderId, i);
@ -1083,7 +1088,7 @@ public class XhpcHistoryOrderController extends BaseController {
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
if(xhpc.getChargingTimeNumber() !=null){
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_HALF_UP));
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 4, BigDecimal.ROUND_HALF_UP));
}
xhpcSt.setChargingNumber(1);
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
@ -1119,6 +1124,9 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcStatisticsService.addStatisticsStation(xhpcSt);
}
}
}catch (Exception e){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
}
//修改历史订单表状态
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,type+1);
}

View File

@ -110,6 +110,8 @@ public interface XhpcHistoryOrderMapper {
*/
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(@Param("number")int number);
List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(@Param("number")int number);
List<XhpcChargeHistoryOrder> getNoStatisticsOrder(@Param("number")int number);
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);

View File

@ -95,12 +95,19 @@ public interface IXhpcHistoryOrderService {
/**
* 获取为统计的历史订单
* 获取为统计的历史订单(时段)
* @param number
* @return
*/
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number);
/**
* 获取为统计的历史订单日期电站
* @param number
* @return
*/
List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(int number);
/**
* 获取为统计的历史订单
* @param number

View File

@ -467,6 +467,18 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number) {
return xhpcHistoryOrderMapper.getNoStatisticsOrderTime(number);
}
/**
* 获取为统计的历史订单日期电站
*
* @param number
* @return
*/
@Override
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(int number) {
return xhpcHistoryOrderMapper.getNoStatisticsOrderDay(number);
}
/**
* 获取为统计的历史订单
*

View File

@ -469,7 +469,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
xhpcHistoryOrder.setStatus(0);
xhpcHistoryOrder.setDelFlag(0);
addSettlement(powerPrice, servicePrice, money, surplusPowerPrice, surplusServicePrice, xhpcChargeOrder, userId, userMessage,0,null,xhpcHistoryOrder);
logger.info("======================异常订单结算===================="+xhpcChargeOrder.getSerialNumber());
return AjaxResult.success();
}

View File

@ -935,7 +935,7 @@
ho.start_time as startTime,
ho.end_time as endTime,
co.charging_time_number as chargingTimeNumber,
co.charging_degree as chargingDegree,
ho.total_power as chargingDegree,
co.rate_model_id as rateModelId,
cs.operator_id as operatorId,
te.charging_pile_id as chargingPileId,
@ -993,8 +993,52 @@
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
where ho.history_order_id not in (select history_order_id from xhpc_statistics_station where type =2 )
and ho.total_price is not null and now() >DATE_ADD(ho.end_time,interval 6 hour)
where ho.history_order_id not in (select history_order_id from xhpc_statistics_time_interval where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= create_time)
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= ho.end_time and now() &gt;DATE_ADD(ho.end_time,interval 6 hour)
limit 0,#{number}
</select>
<select id="getNoStatisticsOrderDay" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select
ho.history_order_id as historyOrderId,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.promotion_discount as promotionDiscount,
ho.total_price as totalPrice,
ho.act_price as actPrice,
ho.act_power_price as actPowerPrice,
ho.act_service_price as actServicePrice,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.internet_degree_commission as internetDegreeCommission,
ho.platform_commission as platformCommission,
ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission,
co.source as source,
co.charge_order_id as chargeOrderId,
co.charging_station_id as chargingStationId,
co.terminal_id as terminalId,
ho.start_time as startTime,
ho.end_time as endTime,
co.charging_time_number as chargingTimeNumber,
co.charging_degree as chargingDegree,
co.rate_model_id as rateModelId,
cs.operator_id as operatorId,
te.charging_pile_id as chargingPileId,
co.user_id as userId,
co.user_id as internetUserId,
ho.charging_mode as chargingMode,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.create_time as createTime
from xhpc_history_order ho
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
where ho.history_order_id not in (select history_order_id from xhpc_statistics_station where type =2 and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= create_time)
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= ho.end_time and now() &gt;DATE_ADD(ho.end_time,interval 6 hour)
limit 0,#{number}
</select>

View File

@ -618,7 +618,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
xhpcInvoiceMapHistoryOrderMapper.insertSelective(xhpcInvoiceMapHistoryOrder);
totalPowerPrice += xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue());
totalActPrice += xhpcHistoryOrder.getTotalPrice().doubleValue();
totalActPrice += xhpcHistoryOrder.getActPrice().doubleValue();
}
BigDecimal bigDecimal = saveInvoiceInfoRequest.getInvoiceMoney().setScale(2, BigDecimal.ROUND_HALF_UP);