| | |
| | | //查询充电桩是否存在正在进行中的订单 |
| | | C3mOrder c3mOrder = getOne(Wrappers.lambdaQuery(C3mOrder.class) |
| | | .eq(C3mOrder::getC3Udid, c3m.getMcuUdid()).eq(C3mOrder::getChargingStates, 1).last("limit 1")); |
| | | if (c3mOrder != null) { |
| | | throw new BusinessException("该充电桩已存在正在进行中的订单"); |
| | | } |
| | | if (!c3mOrder.getUserCode().equals(wxCode)) { |
| | | |
| | | if (c3mOrder != null && !c3mOrder.getUserCode().equals(wxCode)) { |
| | | throw new BusinessException("该充电桩正在被别人使用"); |
| | | } |
| | | Pole pole = poleService.getById(streetlightId); |
| | |
| | | userOrder.setOutTradeNo(transactionId); |
| | | userOrder.setPayTimestamp(new Date().getTime()); |
| | | userOrder.setOrderStatus(OrderStatusEnums.PAID.getCode()); |
| | | if (!updateById(userOrder)) { |
| | | return WxPayNotifyResponse.fail("更新数据已失效"); |
| | | } |
| | | /** |
| | | * 调起开始充电接口 |
| | | */ |
| | |
| | | if (s.isEmpty() || s == null) { |
| | | throw new BusinessException("开启充电失败"); |
| | | } |
| | | userOrder.setChargingStates(0); |
| | | if (!updateById(userOrder)) { |
| | | return WxPayNotifyResponse.fail("更新数据已失效"); |
| | | } |
| | | |
| | | return WxPayNotifyResponse.success("更新数据成功"); |
| | | } |