| | |
| | | }) |
| | | @GetMapping("/confirm/{orderId}") |
| | | public R<Void> confirm(@PathVariable("orderId") Long orderId){ |
| | | boolean update = orderService.update(new LambdaUpdateWrapper<Order>() |
| | | .eq(Order::getId, orderId) |
| | | .eq(Order::getOrderStatus, OrderStatus.PENDING_RECEIPT.getCode()) |
| | | .set(Order::getOrderStatus, OrderStatus.COMPLETED.getCode())); |
| | | if(!update){ |
| | | return R.fail("订单状态异常"); |
| | | } |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5); |
| | | if (R.isError(baseSettingR)) { |
| | | return R.fail("售后设置获取失败"); |
| | |
| | | String content = baseSetting.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | Long days = jsonObject.getLong("days"); |
| | | commissionService.addToCommissionDelayQueue(orderId, LocalDateTime.now().plusDays(days)); |
| | | Order order = orderService.getById(orderId); |
| | | order.setAfterSaleTime(LocalDateTime.now().plusDays(days)); |
| | | order.setIsCommission(0); |
| | | order.setOrderStatus(OrderStatus.COMPLETED.getCode()); |
| | | orderService.updateById(order); |
| | | return R.ok(); |
| | | } |
| | | |