完善notification_equip_charge_status逻辑;重构一番

This commit is contained in:
ZZ 2021-10-29 12:04:07 +08:00
parent 4f8198248b
commit fc5a5ca894
17 changed files with 18 additions and 19 deletions

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException; import java.io.IOException;
@RestController() @RestController()
public class CheckChargeOrderController extends CoreDispatcher { public class CheckChargeOrderController {
@PostMapping("/v1/check_charge_orders") @PostMapping("/v1/check_charge_orders")
public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CheckChargeOrderRequestData> commonRequest) throws IOException { public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CheckChargeOrderRequestData> commonRequest) throws IOException {

View File

@ -12,7 +12,7 @@ import java.io.IOException;
@Slf4j @Slf4j
@RestController() @RestController()
public class ChargeOrderInfoController extends CoreDispatcher { public class NotificationChargeOrderInfoController {
@PostMapping("/v1/notification_charge_order_info") @PostMapping("/v1/notification_charge_order_info")
public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest) throws IOException { public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest) throws IOException {

View File

@ -17,7 +17,7 @@ import java.io.IOException;
@Slf4j @Slf4j
@RestController() @RestController()
public class StartChargeResultController extends CoreDispatcher { public class NotificationStartChargeResultController {
@Autowired @Autowired
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException; import java.io.IOException;
@RestController() @RestController()
public class StationStatusController extends CoreDispatcher { public class NotificationStationStatusController {
@PostMapping("/v1/notification_stationStatus") @PostMapping("/v1/notification_stationStatus")
public CommonResponse notificationStationStatus(@RequestBody CommonRequest<ConnectorStatusInfo> commonRequest) throws IOException { public CommonResponse notificationStationStatus(@RequestBody CommonRequest<ConnectorStatusInfo> commonRequest) throws IOException {

View File

@ -17,7 +17,7 @@ import java.io.IOException;
@Slf4j @Slf4j
@RestController() @RestController()
public class StopChargeResultController extends CoreDispatcher { public class NotificationStopChargeResultController {
@Autowired @Autowired
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;

View File

@ -23,7 +23,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
*/ */
@RestController @RestController
public class QueryEquipAuthController extends CoreDispatcher { public class QueryEquipAuthController {
@Autowired @Autowired
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo; private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;

View File

@ -1,12 +1,12 @@
package com.xhpc.evcs.api; package com.xhpc.evcs.api;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.evcs.dto.*; import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.encryption.EvcsConst; import com.xhpc.evcs.encryption.EvcsConst;
import com.xhpc.evcs.http.ServerInternalException; import com.xhpc.evcs.http.ServerInternalException;
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository; import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
import com.xhpc.evcs.utils.DateUtil; import com.xhpc.evcs.utils.DateUtil;
import com.xhpc.evcs.utils.JSONUtil; import com.xhpc.evcs.utils.JSONUtil;
import com.xhpc.order.domain.XhpcHistoryOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -16,7 +16,7 @@ import java.io.IOException;
import java.util.Date; import java.util.Date;
@RestController() @RestController()
public class EquipChargeStatusController extends CoreDispatcher { public class QueryEquipChargeStatusController {
@Autowired @Autowired
XhpcHistoryOrderRepository xhpcHistoryOrderRepository; XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
@ -30,7 +30,8 @@ public class EquipChargeStatusController extends CoreDispatcher {
String responseBody = ""; String responseBody = "";
String startChargeSeq = chargeInfoRequest.getStartChargeSeq(); String startChargeSeq = chargeInfoRequest.getStartChargeSeq();
// todo 三方对接 到et_order_mapping表查找xh_order_no // todo 三方对接 到et_order_mapping表查找xh_order_no
XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderRepository.findById(startChargeSeq).orElse(null); XhpcHistoryOrder xhpcHistoryOrder =
xhpcHistoryOrderRepository.findByInternetSerialNumberOrEvcsOrderNo(startChargeSeq).orElse(null);
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(xhpcHistoryOrder); ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(xhpcHistoryOrder);
if (chargeOrderInfo == null) { if (chargeOrderInfo == null) {
throw new ServerInternalException("未查询到该订单编号数据"); throw new ServerInternalException("未查询到该订单编号数据");

View File

@ -13,7 +13,7 @@ import static cn.hutool.core.util.NumberUtil.isInteger;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@RestController @RestController
public class QueryStationStatusController extends CoreDispatcher { public class QueryStationStatusController {
@PostMapping("/v1/query_station_status") @PostMapping("/v1/query_station_status")

View File

@ -27,7 +27,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@Slf4j @Slf4j
@RestController @RestController
public class StationsInfoController extends CoreDispatcher { public class QueryStationsInfoController {
@Autowired @Autowired
private XhpcChargingPileRepository xhpcChargingPileRepository; private XhpcChargingPileRepository xhpcChargingPileRepository;

View File

@ -24,7 +24,7 @@ import java.util.UUID;
@Slf4j @Slf4j
@RestController() @RestController()
public class QueryTokenController extends CoreDispatcher { public class QueryTokenController {
@Autowired @Autowired
private AuthSecretTokenRepository authSecretTokenRepository; private AuthSecretTokenRepository authSecretTokenRepository;

View File

@ -7,11 +7,14 @@ import org.springframework.data.repository.query.QueryByExampleExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Optional;
@Repository @Repository
public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrder, String>, public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrder, Long>,
QueryByExampleExecutor<XhpcHistoryOrder>, JpaSpecificationExecutor<XhpcHistoryOrder> { QueryByExampleExecutor<XhpcHistoryOrder>, JpaSpecificationExecutor<XhpcHistoryOrder> {
List<XhpcHistoryOrder> findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i); List<XhpcHistoryOrder> findByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i);
Optional<XhpcHistoryOrder> findByInternetSerialNumberOrEvcsOrderNo(String startChargeSeq);
} }

View File

@ -1,4 +1,4 @@
package com.xhpc.evcs.api; package com.xhpc.evcs.notification;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;

View File

@ -1,6 +1,5 @@
package com.xhpc.evcs.notification; package com.xhpc.evcs.notification;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.domain.AuthSecretToken; import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.domain.EtOrderMapping; import com.xhpc.evcs.domain.EtOrderMapping;
import com.xhpc.evcs.domain.XhpcChargingStation; import com.xhpc.evcs.domain.XhpcChargingStation;

View File

@ -3,7 +3,6 @@ package com.xhpc.evcs.notification;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.domain.AuthSecretToken; import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.*; import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository; import com.xhpc.evcs.jpa.AuthSecretTokenRepository;

View File

@ -1,6 +1,5 @@
package com.xhpc.evcs.notification; package com.xhpc.evcs.notification;
import com.xhpc.evcs.api.CoreDispatcher;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@ -1,7 +1,6 @@
package com.xhpc.evcs.notification; package com.xhpc.evcs.notification;
import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.domain.AuthSecretToken; import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.*; import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository; import com.xhpc.evcs.jpa.AuthSecretTokenRepository;

View File

@ -2,7 +2,6 @@ package com.xhpc.evcs.notification;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.xhpc.common.data.redis.CacheOrderData; import com.xhpc.common.data.redis.CacheOrderData;
import com.xhpc.evcs.api.CoreDispatcher;
import com.xhpc.evcs.dto.ChargeResultRequest; import com.xhpc.evcs.dto.ChargeResultRequest;
import com.xhpc.evcs.dto.CommonRequest; import com.xhpc.evcs.dto.CommonRequest;
import com.xhpc.evcs.utils.JSONUtil; import com.xhpc.evcs.utils.JSONUtil;