update 电单车协议

This commit is contained in:
Guoqs
2024-09-05 15:56:13 +08:00
parent 8c273e5a39
commit eea76805f6

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ebike.EBikeDataProtocol;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.EBikeChargingStopReasonEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
@@ -75,7 +76,7 @@ public class SettlementUploadHandler extends AbstractEBikeHandler {
EBikeMessageCmd03.SettlementInfo settlementInfo = message.getSettlementInfo();
log.info("结算消费信息上传:{}", JSON.toJSONString(message));
String transactionCode = settlementInfo.getOrderNumber();
int transactionCode = settlementInfo.getOrderNumber();
// 处理订单加锁/结算电单车订单
String lockKey = "settle_order_" + transactionCode;
String uuid = IdUtils.fastUUID();
@@ -83,7 +84,7 @@ public class SettlementUploadHandler extends AbstractEBikeHandler {
// redis锁
Boolean isLock = redisCache.lock(lockKey, uuid, 1500);
if (isLock) {
processOrder(message);
// processOrder(message);
}
} catch (Exception e) {
log.error("处理订单transactionCode:{}, 发生异常", transactionCode, e);
@@ -102,13 +103,13 @@ public class SettlementUploadHandler extends AbstractEBikeHandler {
*/
private void processOrder(EBikeMessageCmd03 message) {
EBikeMessageCmd03.SettlementInfo settlementInfo = message.getSettlementInfo();
String transactionCode = settlementInfo.getOrderNumber();
String transactionCode = settlementInfo.getOrderNumber() + "";
// 根据交易流水号查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (orderBasicInfo != null) {
// 平台存在订单
String stopReason = settlementInfo.getStopReason();
// orderBasicInfo.setReason(data.getStopReasonMsg());
int stopReason = settlementInfo.getStopReason();
orderBasicInfo.setReason(EBikeChargingStopReasonEnum.getMsgByCode(stopReason));
// 如果订单状态为 异常,则改为 待结算
if (StringUtils.equals(OrderStatusEnum.ABNORMAL.getValue(), orderBasicInfo.getOrderStatus())) {
orderBasicInfo.setOrderStatus(OrderStatusEnum.STAY_SETTLEMENT.getValue());