0x19充电停止,只更新个别字段

This commit is contained in:
2024-02-21 16:52:56 +08:00
parent 58aa5c662b
commit 3990c55d55

View File

@@ -4,6 +4,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
@@ -105,14 +106,25 @@ public class ChargeEndHandler extends AbstractHandler{
// 查询订单,改为待结算 将结束soc传入
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (Objects.nonNull(orderInfo)) {
Date nowDate = DateUtils.getNowDate(); // 当前时间
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
orderInfo.setOrderStatus(OrderStatusEnum.STAY_SETTLEMENT.getValue());
}
orderInfo.setEndSoc(stopSoc);
if (orderInfo.getChargeEndTime() == null) {
orderInfo.setChargeEndTime(new Date()); // 结束充电时间
orderInfo.setChargeEndTime(nowDate); // 结束充电时间
}
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
// orderBasicInfoService.updateOrderBasicInfo(orderInfo);
// 只更新个别字段
OrderBasicInfo updateOrder = new OrderBasicInfo();
updateOrder.setId(orderInfo.getId());
updateOrder.setEndSoc(stopSoc);
if (orderInfo.getChargeEndTime() == null) {
updateOrder.setChargeEndTime(nowDate); // 结束充电时间
}
updateOrder.setUpdateTime(nowDate);
orderBasicInfoService.updateOrderBasicInfo(updateOrder);
}
return null;