ออกคำสั่ง 10
This commit is contained in:
parent
5e117d1703
commit
8fd229fa8a
1 changed files with 69 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import { EvaluateCommander } from "../entities/EvaluateCommander"
|
||||||
import CallAPI from "../interfaces/call-api"
|
import CallAPI from "../interfaces/call-api"
|
||||||
import { Double, In } from "typeorm"
|
import { Double, In } from "typeorm"
|
||||||
import Extension from "../interfaces/extension"
|
import Extension from "../interfaces/extension"
|
||||||
|
import { Appoint } from "../entities/Appoint"
|
||||||
|
|
||||||
@Route("api/v1/probation/report")
|
@Route("api/v1/probation/report")
|
||||||
@Tags("Report")
|
@Tags("Report")
|
||||||
|
|
@ -30,6 +31,7 @@ export class ReportController extends Controller {
|
||||||
private assignDirectorRepository = AppDataSource.getRepository(AssignDirector)
|
private assignDirectorRepository = AppDataSource.getRepository(AssignDirector)
|
||||||
private evaluateAchievementRepository = AppDataSource.getRepository(EvaluateAchievement)
|
private evaluateAchievementRepository = AppDataSource.getRepository(EvaluateAchievement)
|
||||||
private evaluateCommanderRepository = AppDataSource.getRepository(EvaluateCommander)
|
private evaluateCommanderRepository = AppDataSource.getRepository(EvaluateCommander)
|
||||||
|
private appointRepository = AppDataSource.getRepository(Appoint)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API สำหรับออกรายงาน
|
* API สำหรับออกรายงาน
|
||||||
|
|
@ -1199,4 +1201,71 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
return new HttpSuccess()
|
return new HttpSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post("command10/officer/report/excecute")
|
||||||
|
public async command10Excecute(
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
refIds: {
|
||||||
|
refId: string
|
||||||
|
commandAffectDate: Date | null
|
||||||
|
commandNo: string | null
|
||||||
|
commandYear: number
|
||||||
|
templateDoc: string | null
|
||||||
|
amount: Double | null
|
||||||
|
positionSalaryAmount: Double | null
|
||||||
|
mouthSalaryAmount: Double | null
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const lists = await this.appointRepository.find({
|
||||||
|
where: { id: In(body.refIds.map(x => x.refId)) },
|
||||||
|
})
|
||||||
|
await Promise.all(
|
||||||
|
lists.map(async list => {
|
||||||
|
list.status = "DONE"
|
||||||
|
await this.appointRepository.save(list)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return new HttpSuccess()
|
||||||
|
}
|
||||||
|
@Post("command10/officer/report")
|
||||||
|
public async command10(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
refIds: string[]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const lists = await this.appointRepository.find({
|
||||||
|
where: { id: In(body.refIds) },
|
||||||
|
})
|
||||||
|
await Promise.all(
|
||||||
|
lists.map(async list => {
|
||||||
|
list.status = "PENDING"
|
||||||
|
await this.appointRepository.save(list)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return new HttpSuccess()
|
||||||
|
}
|
||||||
|
@Post("command10/officer/report/delete")
|
||||||
|
public async command10Delete(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
refIds: string[]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const lists = await this.appointRepository.find({
|
||||||
|
where: { id: In(body.refIds) },
|
||||||
|
})
|
||||||
|
await Promise.all(
|
||||||
|
lists.map(async list => {
|
||||||
|
list.status = "REPORT"
|
||||||
|
await this.appointRepository.save(list)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return new HttpSuccess()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue