Files
smart_grid_iot/server/src/controller/survey_order.controller.ts
T
andyesfly 22d27a940d feat: 重构勘察业务为明细模式并新增定时任务人性化配置
- 重构勘察业务:移除SOP相关表,新增勘察明细表支持建筑/楼层/房间/照片管理
- 新增定时任务人性化频率配置,支持分钟/小时/天/周/月/自定义六种模式
- 新增频率预览接口,支持配置转换为cron表达式与执行时间预览
- 更新系统品牌名称为鑫潼智电,修改全局标题与登录页文案
2026-10-17 10:08:42 +08:00

48 lines
2.2 KiB
TypeScript

import { Controller, Get, Post, Put, Del, Inject, Query, Body, Param } from "@midwayjs/core";
import { Context } from "@midwayjs/koa";
import { SurveyOrderService } from "../service/survey_order.service";
@Controller("/api/survey-orders")
export class SurveyOrderController {
@Inject() ctx!: Context;
@Inject() surveyOrderService!: SurveyOrderService;
@Get("/") async list(@Query() query: any) { return this.surveyOrderService.list(query, this.ctx); }
// 以下静态路径必须声明在 /:id 之前,否则会被动态路由吞掉
@Get("/stats") async stats() { return this.surveyOrderService.stats(this.ctx); }
@Get("/quote") async quote(@Query("loopCount") loopCount: string) { return this.surveyOrderService.quote(loopCount); }
// 批量指派
@Post("/batch-assign") async batchAssign(@Body() body: any) { return this.surveyOrderService.batchAssign(body, this.ctx); }
@Get("/:id") async detail(@Param("id") id: string) { return this.surveyOrderService.detail(Number(id), this.ctx); }
@Post("/") async create(@Body() body: any) { return this.surveyOrderService.create(body, this.ctx); }
@Put("/:id") async update(@Param("id") id: string, @Body() body: any) { return this.surveyOrderService.update(Number(id), body, this.ctx); }
// 勘察明细:全量替换(新增/编辑/删除统一走此接口)
@Put("/:id/details") async saveDetails(@Param("id") id: string, @Body() body: any) {
return this.surveyOrderService.saveDetails(Number(id), body, this.ctx);
}
// 指派 / 改派共享电工
@Put("/:id/assign") async assign(@Param("id") id: string, @Body() body: any) {
return this.surveyOrderService.assign(Number(id), body, this.ctx);
}
// 技术复核:pass 归档 / reject 退回现场
@Put("/:id/review") async review(@Param("id") id: string, @Body() body: any) {
return this.surveyOrderService.review(Number(id), body, this.ctx);
}
// 催办
@Post("/:id/urge") async urge(@Param("id") id: string) { return this.surveyOrderService.urge(Number(id), this.ctx); }
// 取消工单
@Put("/:id/cancel") async cancel(@Param("id") id: string, @Body() body: any) {
return this.surveyOrderService.cancel(Number(id), body, this.ctx);
}
@Del("/:id") async delete(@Param("id") id: string) { return this.surveyOrderService.delete(Number(id), this.ctx); }
}