不是三方订单不推送
This commit is contained in:
parent
4403368565
commit
72aece098f
@ -8,6 +8,7 @@ import com.xhpc.evcs.dto.CommonRequest;
|
|||||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||||
import com.xhpc.evcs.utils.JSONUtil;
|
import com.xhpc.evcs.utils.JSONUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -18,6 +19,7 @@ import java.util.Map;
|
|||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class NotificationStopChargeResultTask extends CoreDispatcher {
|
public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||||
|
|
||||||
@ -55,28 +57,29 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
|||||||
Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified");
|
Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified");
|
||||||
if (isStopNotified == null || !isStopNotified) {
|
if (isStopNotified == null || !isStopNotified) {
|
||||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||||
if (internetSerialNumber != null) {
|
if (internetSerialNumber == null) {
|
||||||
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
log.error("null isn: {}", pushOrderKey);
|
||||||
AuthSecretToken authSecretTokenOut =
|
|
||||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,
|
|
||||||
SECRET_TOKEN_TYPE_OUT).orElse(null);
|
|
||||||
CommonRequest<ChargeResultRequest> commonRequest = new CommonRequest<>();
|
|
||||||
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
|
||||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
|
||||||
//使用指定包装类封装数据
|
|
||||||
chargeResultRequest.setConnectorID(orderkey.substring(0, 16));
|
|
||||||
chargeResultRequest.setStartChargeSeqStat(4);
|
|
||||||
chargeResultRequest.setSuccStat(0);
|
|
||||||
chargeResultRequest.setFailReason(3);
|
|
||||||
//将其转换为json
|
|
||||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
|
||||||
commonRequest.setData(jsonData);
|
|
||||||
String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut);
|
|
||||||
ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result,
|
|
||||||
ChargeResultResponse.class, authSecretTokenOut);
|
|
||||||
pushOrder.put("isStopNotified", true);
|
|
||||||
REDIS.setCacheMap(pushOrderKey, pushOrder);
|
|
||||||
}
|
}
|
||||||
|
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
||||||
|
AuthSecretToken authSecretTokenOut =
|
||||||
|
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,
|
||||||
|
SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||||
|
CommonRequest<ChargeResultRequest> commonRequest = new CommonRequest<>();
|
||||||
|
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
||||||
|
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||||
|
//使用指定包装类封装数据
|
||||||
|
chargeResultRequest.setConnectorID(orderkey.substring(0, 16));
|
||||||
|
chargeResultRequest.setStartChargeSeqStat(4);
|
||||||
|
chargeResultRequest.setSuccStat(0);
|
||||||
|
chargeResultRequest.setFailReason(3);
|
||||||
|
//将其转换为json
|
||||||
|
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||||
|
commonRequest.setData(jsonData);
|
||||||
|
String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut);
|
||||||
|
ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result,
|
||||||
|
ChargeResultResponse.class, authSecretTokenOut);
|
||||||
|
pushOrder.put("isStopNotified", true);
|
||||||
|
REDIS.setCacheMap(pushOrderKey, pushOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user