空订单写入tenant id
This commit is contained in:
parent
256c590f8c
commit
54144c8629
@ -1,9 +1,11 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.StartChargeRequest;
|
||||
@ -13,6 +15,7 @@ import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -39,6 +42,8 @@ public class QueryStartChargeController {
|
||||
private PileOrderService pileOrderService;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
@PostMapping(value = "/v1/query_start_charge")
|
||||
public CommonResponse queryStartCharge(@RequestBody CommonRequest<StartChargeRequest> commonRequest) throws Exception {
|
||||
@ -121,7 +126,14 @@ public class QueryStartChargeController {
|
||||
|
||||
private void emptyHorder(String startChargeSeq, String connectorId, EtOrderMapping etOrderMapping) {
|
||||
|
||||
XhpcChargingStation stationExample = new XhpcChargingStation();
|
||||
final Long stationId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "stationId");
|
||||
stationExample.setId(stationId);
|
||||
Example<XhpcChargingStation> example = Example.of(stationExample);
|
||||
XhpcChargingStation xhpcChargingStation = xhpcChargingStationRepository.findOne(example).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
XhpcHistoryOrder emptyHorder = new XhpcHistoryOrder();
|
||||
emptyHorder.setTenantId(xhpcChargingStation.getTenantId());
|
||||
Date now = DateUtils.getNowDate();
|
||||
emptyHorder.setStartTime(now);
|
||||
emptyHorder.setEndTime(now);
|
||||
@ -138,11 +150,12 @@ public class QueryStartChargeController {
|
||||
emptyHorder.setType(1);
|
||||
emptyHorder.setSource(1);
|
||||
emptyHorder.setState(-1);
|
||||
emptyHorder.setChargingStationId(REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "stationId"));
|
||||
emptyHorder.setChargingStationId(stationId);
|
||||
emptyHorder.setTerminalId(xhpcTerminalRepository.queryDbId(connectorId));
|
||||
emptyHorder.setConfirmResult(-1);
|
||||
xhpcHistoryOrderRepository.save(emptyHorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user