| | |
| | | private static final String DESCRIBE = "哦应:"; |
| | | private static final String ORDER_KEY = "oying:order"; |
| | | private static final String ORDER_STORE_KEY = "oying:order:store"; |
| | | private static final String ORDER_CODE = "ORDER"; |
| | | |
| | | @Override |
| | | public PageResult<Order> queryAll(OrderQueryCriteria criteria, Page<Object> page) { |
| | |
| | | public OrderResponse getByOrderNum(String orderNum) { |
| | | return new OrderResponse(orderMapper.getByOrderNum(orderNum), |
| | | addressSnapshotService.queryByOrderNum(orderNum), |
| | | operationLogService.getByOrderNum(orderNum, null)); |
| | | operationLogService.getByOrderNum(orderNum, ORDER_CODE)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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); |
| | | } |
| | | |