f6d97b4ee8
CI / verify (pull_request) Has been cancelled
同城有仓按仓库绑定承运商自动推单或自管填单,无仓/跨城走总部快递;新增仓配注册表、FulfillmentService 及三端运单追踪。 Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import { Body, Controller, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
|
|
import { HqAuthGuard } from '../../common/guards/hq-auth.guard';
|
|
import { SuperAdminGuard } from '../../common/guards/super-admin.guard';
|
|
import { HqOperation } from '../../common/hq-operation/hq-operation.decorator';
|
|
import { HqOperationAction } from '../../common/hq-operation/hq-operation.constants';
|
|
import { AdminOrdersService } from './admin-orders.service';
|
|
import { AdminShipOrderDto, BatchDeleteOrdersDto, HqLogisticsShipDto, UpdateOrderStatusDto } from './dto/admin-mutate.dto';
|
|
import { AdminOrdersQueryDto } from './dto/admin-query.dto';
|
|
|
|
@Controller('admin/orders')
|
|
@UseGuards(HqAuthGuard)
|
|
export class AdminOrdersController {
|
|
constructor(private readonly ordersService: AdminOrdersService) {}
|
|
|
|
@Get()
|
|
list(@Query() query: AdminOrdersQueryDto) {
|
|
return this.ordersService.list(query);
|
|
}
|
|
|
|
@Post('batch-delete')
|
|
@UseGuards(SuperAdminGuard)
|
|
@HqOperation({
|
|
action: HqOperationAction.ORDER_BATCH_DELETE,
|
|
refType: 'ORDER',
|
|
batch: true,
|
|
includeBody: true,
|
|
})
|
|
batchDelete(@Body() dto: BatchDeleteOrdersDto) {
|
|
return this.ordersService.batchDeleteOrders(dto.ids.map((id) => BigInt(id)));
|
|
}
|
|
|
|
@Get('ship-defaults')
|
|
shipDefaults() {
|
|
return this.ordersService.getShipDefaults();
|
|
}
|
|
|
|
@Get(':id')
|
|
detail(@Param('id') id: string) {
|
|
return this.ordersService.detail(BigInt(id));
|
|
}
|
|
|
|
/** HQ 发货:调用小飞侠创建运单并更新配送信息 */
|
|
@Post(':id/ship')
|
|
@HqOperation({
|
|
action: HqOperationAction.ORDER_SHIP,
|
|
refType: 'ORDER',
|
|
refIdParam: 'id',
|
|
includeBody: true,
|
|
})
|
|
ship(@Param('id') id: string, @Body() dto: AdminShipOrderDto) {
|
|
return this.ordersService.shipOrder(BigInt(id), dto);
|
|
}
|
|
|
|
@Post(':id/logistics-ship')
|
|
@HqOperation({
|
|
action: HqOperationAction.ORDER_SHIP,
|
|
refType: 'ORDER',
|
|
refIdParam: 'id',
|
|
includeBody: true,
|
|
})
|
|
shipLogistics(@Param('id') id: string, @Body() dto: HqLogisticsShipDto) {
|
|
return this.ordersService.shipLogistics(BigInt(id), dto);
|
|
}
|
|
|
|
/** preV1 调试:直接改订单状态,不走业务校验 */
|
|
@Put(':id/status')
|
|
@HqOperation({
|
|
action: HqOperationAction.ORDER_STATUS_DEBUG,
|
|
refType: 'ORDER',
|
|
refIdParam: 'id',
|
|
includeBody: true,
|
|
})
|
|
updateStatus(@Param('id') id: string, @Body() dto: UpdateOrderStatusDto) {
|
|
return this.ordersService.updateStatusDebug(BigInt(id), dto.status);
|
|
}
|
|
}
|