| | |
| | | OrderResponse response = getByOrderNum(orderNum); |
| | | Order order = response.getOrder(); |
| | | if (order == null) { |
| | | throw new BadRequestException("订单不存在"); |
| | | throw new BadRequestException("订单不存在!"); |
| | | } |
| | | if (!SecurityUtils.getCurrentUserId().equals(order.getUserId())) { |
| | | throw new BadRequestException("不能修改他人订单"); |
| | |
| | | case HWC: |
| | | case HWC2: |
| | | JSONObject object = swiftPassService.query(orderNum, anEnum); |
| | | if (object.getString("trade_state").equals(PayStateEnum.NOTPAY.getKey())) { |
| | | if (!object.getString("trade_state").equals(PayStateEnum.NOTPAY.getKey())) { |
| | | throw new BadRequestException(PayStateEnum.getValue(order.getPayState())); |
| | | } |
| | | swiftPassService.closeOrder(orderNum, anEnum); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteAll(List<Long> ids) { |
| | | Long userid = SecurityUtils.getCurrentUserId(); |
| | | for (Long id : ids) { |
| | | Order order = getById(id); |
| | | if (order == null) { |
| | | throw new BadRequestException("订单不存在!"); |
| | | } |
| | | if (!order.getUserId().equals(userid)) { |
| | | throw new BadRequestException("不能删除他人订单"); |
| | | } |
| | | if (!order.getPayState().equals(PayStateEnum.NOTPAY.getKey())) { |
| | | throw new BadRequestException("只能删除未支付订单"); |
| | | } |
| | | } |
| | | orderMapper.deleteBatchIds(ids); |
| | | } |
| | | |