修改订单统计
This commit is contained in:
parent
8031059d31
commit
d59212d23b
@ -945,22 +945,16 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//检查统计没有入库的订单
|
//检查统计没有入库的订单(小时)
|
||||||
@Scheduled(cron = "0 1 * * * ?")
|
@Scheduled(cron = "0 5 * * * ?")
|
||||||
@GetMapping("/getInvo")
|
@GetMapping("/getInvoTime")
|
||||||
public void getNoStatisticsOrderTime(){
|
public void getNoStatisticsOrderTime(){
|
||||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(500);
|
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(3000);
|
||||||
if(list !=null && list.size()>0){
|
if(list !=null && list.size()>0){
|
||||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||||
try{
|
try{
|
||||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId);
|
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){
|
if(count==0){
|
||||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||||
Long operatorId =xhpc.getOperatorId();
|
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){
|
if(listOrder !=null && listOrder.size()>0){
|
||||||
for (XhpcChargeHistoryOrder xhpc:listOrder) {
|
for (XhpcChargeHistoryOrder xhpc:listOrder) {
|
||||||
|
try{
|
||||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
for (int i = 1; i <4 ; i++) {
|
for (int i = 1; i <4 ; i++) {
|
||||||
//查询统计表是否有已添加的数据
|
//查询统计表是否有已添加的数据
|
||||||
@ -1063,6 +1062,10 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
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){
|
if(list !=null && list.size()>0){
|
||||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
|
try{
|
||||||
for (int i = type; i <4 ; i++) {
|
for (int i = type; i <4 ; i++) {
|
||||||
|
|
||||||
//查询统计表是否有已添加的数据
|
//查询统计表是否有已添加的数据
|
||||||
int count = xhpcStatisticsService.getStatisticsStationHistoryOrderId(historyOrderId, i);
|
int count = xhpcStatisticsService.getStatisticsStationHistoryOrderId(historyOrderId, i);
|
||||||
|
|
||||||
@ -1083,7 +1088,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
||||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||||
if(xhpc.getChargingTimeNumber() !=null){
|
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.setChargingNumber(1);
|
||||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||||
@ -1119,6 +1124,9 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||||
|
}
|
||||||
//修改历史订单表状态
|
//修改历史订单表状态
|
||||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,type+1);
|
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,type+1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,8 @@ public interface XhpcHistoryOrderMapper {
|
|||||||
*/
|
*/
|
||||||
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(@Param("number")int number);
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(@Param("number")int number);
|
||||||
|
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(@Param("number")int number);
|
||||||
|
|
||||||
List<XhpcChargeHistoryOrder> getNoStatisticsOrder(@Param("number")int number);
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrder(@Param("number")int number);
|
||||||
|
|
||||||
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
|
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
|
||||||
|
|||||||
@ -95,12 +95,19 @@ public interface IXhpcHistoryOrderService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取为统计的历史订单
|
* 获取为统计的历史订单(时段)
|
||||||
* @param number
|
* @param number
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number);
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单(日期、电站)
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(int number);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取为统计的历史订单
|
* 获取为统计的历史订单
|
||||||
* @param number
|
* @param number
|
||||||
|
|||||||
@ -467,6 +467,18 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number) {
|
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number) {
|
||||||
return xhpcHistoryOrderMapper.getNoStatisticsOrderTime(number);
|
return xhpcHistoryOrderMapper.getNoStatisticsOrderTime(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单(日期、电站)
|
||||||
|
*
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(int number) {
|
||||||
|
return xhpcHistoryOrderMapper.getNoStatisticsOrderDay(number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取为统计的历史订单
|
* 获取为统计的历史订单
|
||||||
*
|
*
|
||||||
|
|||||||
@ -469,7 +469,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
xhpcHistoryOrder.setStatus(0);
|
xhpcHistoryOrder.setStatus(0);
|
||||||
xhpcHistoryOrder.setDelFlag(0);
|
xhpcHistoryOrder.setDelFlag(0);
|
||||||
addSettlement(powerPrice, servicePrice, money, surplusPowerPrice, surplusServicePrice, xhpcChargeOrder, userId, userMessage,0,null,xhpcHistoryOrder);
|
addSettlement(powerPrice, servicePrice, money, surplusPowerPrice, surplusServicePrice, xhpcChargeOrder, userId, userMessage,0,null,xhpcHistoryOrder);
|
||||||
|
logger.info("======================异常订单结算===================="+xhpcChargeOrder.getSerialNumber());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -935,7 +935,7 @@
|
|||||||
ho.start_time as startTime,
|
ho.start_time as startTime,
|
||||||
ho.end_time as endTime,
|
ho.end_time as endTime,
|
||||||
co.charging_time_number as chargingTimeNumber,
|
co.charging_time_number as chargingTimeNumber,
|
||||||
co.charging_degree as chargingDegree,
|
ho.total_power as chargingDegree,
|
||||||
co.rate_model_id as rateModelId,
|
co.rate_model_id as rateModelId,
|
||||||
cs.operator_id as operatorId,
|
cs.operator_id as operatorId,
|
||||||
te.charging_pile_id as chargingPileId,
|
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_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_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
|
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 )
|
where ho.history_order_id not in (select history_order_id from xhpc_statistics_time_interval where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= create_time)
|
||||||
and ho.total_price is not null and now() >DATE_ADD(ho.end_time,interval 6 hour)
|
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ho.end_time and now() >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) <= create_time)
|
||||||
|
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ho.end_time and now() >DATE_ADD(ho.end_time,interval 6 hour)
|
||||||
limit 0,#{number}
|
limit 0,#{number}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -618,7 +618,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
|
|||||||
xhpcInvoiceMapHistoryOrderMapper.insertSelective(xhpcInvoiceMapHistoryOrder);
|
xhpcInvoiceMapHistoryOrderMapper.insertSelective(xhpcInvoiceMapHistoryOrder);
|
||||||
totalPowerPrice += xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
|
totalPowerPrice += xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
|
||||||
totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().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);
|
BigDecimal bigDecimal = saveInvoiceInfoRequest.getInvoiceMoney().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user