feat: 新增电工APP端与定时任务管理功能
- 新增电工APP独立鉴权中间件与登录注册接口 - 新增定时任务管理模块,支持任务配置、执行日志与手动触发 - 新增运维费定价与电工派单成本价目管理 - 新增电工资质证照管理与到期提醒定时任务 - 完善数据库实体与DTO校验,优化权限控制
This commit is contained in:
1 parent
1803ad679c
commit
f4454ad014
57 files changed
+9388
-200
No files matched your search
@@ -0,0 +1,79 @@
|
||||
import { Controller, Get, Post, Put, Del, Inject, Body, Param } from "@midwayjs/core";
|
||||
import { Context } from "@midwayjs/koa";
|
||||
import { WorkerAppService } from "../service/worker_app.service";
|
||||
import {
|
||||
WorkerRegisterDTO,
|
||||
WorkerLoginDTO,
|
||||
WorkerProfileUpdateDTO,
|
||||
WorkerAppCertDTO
|
||||
} from "../dto/worker_app.dto";
|
||||
|
||||
@Controller("/api/worker-app")
|
||||
export class WorkerAppController {
|
||||
@Inject()
|
||||
ctx!: Context;
|
||||
|
||||
@Inject()
|
||||
workerAppService!: WorkerAppService;
|
||||
|
||||
// 注册(匿名)
|
||||
@Post("/auth/register")
|
||||
async register(@Body() body: WorkerRegisterDTO) {
|
||||
return this.workerAppService.register(body);
|
||||
}
|
||||
|
||||
// 登录(匿名)
|
||||
@Post("/auth/login")
|
||||
async login(@Body() body: WorkerLoginDTO) {
|
||||
return this.workerAppService.login(body);
|
||||
}
|
||||
|
||||
// 个人资料
|
||||
@Get("/profile")
|
||||
async profile() {
|
||||
return this.workerAppService.profile(this.currentWorkerId());
|
||||
}
|
||||
|
||||
@Put("/profile")
|
||||
async updateProfile(@Body() body: WorkerProfileUpdateDTO) {
|
||||
return this.workerAppService.updateProfile(this.currentWorkerId(), body);
|
||||
}
|
||||
|
||||
// 资质证照:静态路径必须声明在动态路径之前
|
||||
@Get("/certs")
|
||||
async listCerts() {
|
||||
return this.workerAppService.listCerts(this.currentWorkerId());
|
||||
}
|
||||
|
||||
@Post("/certs")
|
||||
async createCert(@Body() body: WorkerAppCertDTO) {
|
||||
return this.workerAppService.createCert(this.currentWorkerId(), body);
|
||||
}
|
||||
|
||||
@Put("/certs/:id")
|
||||
async updateCert(@Param("id") id: string, @Body() body: WorkerAppCertDTO) {
|
||||
return this.workerAppService.updateCert(this.currentWorkerId(), Number(id), body);
|
||||
}
|
||||
|
||||
@Del("/certs/:id")
|
||||
async removeCert(@Param("id") id: string) {
|
||||
return this.workerAppService.removeCert(this.currentWorkerId(), Number(id));
|
||||
}
|
||||
|
||||
// 重新提交审核
|
||||
@Post("/audit/resubmit")
|
||||
async resubmit() {
|
||||
return this.workerAppService.resubmit(this.currentWorkerId());
|
||||
}
|
||||
|
||||
// 证照到期提醒
|
||||
@Get("/notices")
|
||||
async listNotices() {
|
||||
return this.workerAppService.listNotices(this.currentWorkerId());
|
||||
}
|
||||
|
||||
// 当前登录电工 ID(由 WorkerAuthMiddleware 写入)
|
||||
private currentWorkerId(): number {
|
||||
return this.ctx.state.worker?.workerId;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user