comment
This commit is contained in:
parent
a5b57f287d
commit
e87e760075
3 changed files with 97 additions and 15 deletions
|
|
@ -2344,6 +2344,7 @@ export class DevelopmentController extends Controller {
|
||||||
relations: ["posLevel", "posType", "employeePosLevel", "employeePosType"],
|
relations: ["posLevel", "posType", "employeePosLevel", "employeePosType"],
|
||||||
order: {
|
order: {
|
||||||
isDone: "ASC",
|
isDone: "ASC",
|
||||||
|
isDoneIDP: "ASC",
|
||||||
citizenId: "ASC",
|
citizenId: "ASC",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -2380,6 +2381,7 @@ export class DevelopmentController extends Controller {
|
||||||
dateStart: item.dateStart,
|
dateStart: item.dateStart,
|
||||||
dateEnd: item.dateEnd,
|
dateEnd: item.dateEnd,
|
||||||
isDone: item.isDone,
|
isDone: item.isDone,
|
||||||
|
isDoneIDP: item.isDoneIDP,
|
||||||
isProfile: item.isProfile,
|
isProfile: item.isProfile,
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess(_getDevelopment);
|
return new HttpSuccess(_getDevelopment);
|
||||||
|
|
@ -2461,6 +2463,90 @@ export class DevelopmentController extends Controller {
|
||||||
return new HttpSuccess(getDevelopment);
|
return new HttpSuccess(getDevelopment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API รายละเอียดโครงการ/หลักสูตรการฝึกอบรม tab6 IDP ส่งบันทึกทะเบียนประวัติ
|
||||||
|
*
|
||||||
|
* @summary DEV_00 - รายละเอียดโครงการ/หลักสูตรการฝึกอบรมtab6 IDP ส่งบันทึกทะเบียนประวัติ #
|
||||||
|
*
|
||||||
|
* @param {string} id Id โครงการ
|
||||||
|
*/
|
||||||
|
@Get("tab6/done-idp/{id}")
|
||||||
|
async GetDevelopemtTab6IDPDoneById(@Path() id: string, @Request() request: RequestWithUser) {
|
||||||
|
const getDevelopment = await this.developmentHistoryRepository.find({
|
||||||
|
where: { developmentId: id, isDoneIDP: false },
|
||||||
|
relations: ["development"],
|
||||||
|
});
|
||||||
|
await Promise.all(
|
||||||
|
getDevelopment.map(async (x) => {
|
||||||
|
const _data = Object.assign(new DevelopmentHistory(), x);
|
||||||
|
if (x.type == "OFFICER") {
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "/org/profile/development", {
|
||||||
|
type: "DEVELOP",
|
||||||
|
profileId: x.profileId,
|
||||||
|
name: "",
|
||||||
|
target: "",
|
||||||
|
// achievement10: x.development.achievement10,
|
||||||
|
// achievement5: x.development.achievement5,
|
||||||
|
// achievement0: x.development.achievement0,
|
||||||
|
kpiDevelopmentId: x.development.id,
|
||||||
|
reasonDevelopment70: x.development.reasonActual70,
|
||||||
|
reasonDevelopment20: x.development.reasonActual20,
|
||||||
|
reasonDevelopment10: x.development.reasonActual10,
|
||||||
|
isDevelopment70: false,
|
||||||
|
isDevelopment20: false,
|
||||||
|
isDevelopment10: false,
|
||||||
|
// summary: x.development.summary,
|
||||||
|
// point: x.development.point,
|
||||||
|
})
|
||||||
|
.then((x) => {
|
||||||
|
_data.isDoneIDP = true;
|
||||||
|
})
|
||||||
|
.catch((x) => {
|
||||||
|
_data.isDoneIDP = false;
|
||||||
|
});
|
||||||
|
} else if (x.type == "EMPLOYEE") {
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "/org/profile-employee/development", {
|
||||||
|
type: "DEVELOP",
|
||||||
|
profileEmployeeId: x.profileId,
|
||||||
|
name: "",
|
||||||
|
target: "",
|
||||||
|
// achievement10: x.development.achievement10,
|
||||||
|
// achievement5: x.development.achievement5,
|
||||||
|
// achievement0: x.development.achievement0,
|
||||||
|
kpiDevelopmentId: x.development.id,
|
||||||
|
reasonDevelopment70: x.development.reasonActual70,
|
||||||
|
reasonDevelopment20: x.development.reasonActual20,
|
||||||
|
reasonDevelopment10: x.development.reasonActual10,
|
||||||
|
isDevelopment70: false,
|
||||||
|
isDevelopment20: false,
|
||||||
|
isDevelopment10: false,
|
||||||
|
// summary: x.development.summary,
|
||||||
|
// point: x.development.point,
|
||||||
|
})
|
||||||
|
.then((x) => {
|
||||||
|
_data.isDoneIDP = true;
|
||||||
|
})
|
||||||
|
.catch((x) => {
|
||||||
|
_data.isDoneIDP = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_data.lastUpdateUserId = request.user.sub;
|
||||||
|
_data.lastUpdateFullName = request.user.name;
|
||||||
|
_data.lastUpdatedAt = new Date();
|
||||||
|
// addLogSequence(request, {
|
||||||
|
// action: "database",
|
||||||
|
// status: "success",
|
||||||
|
// description: "Store DevelopmentHistory.",
|
||||||
|
// });
|
||||||
|
await this.developmentHistoryRepository.save(_data, { data: request });
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess(getDevelopment);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API list หน่วยงาน
|
* API list หน่วยงาน
|
||||||
*
|
*
|
||||||
|
|
@ -2634,7 +2720,10 @@ export class DevelopmentController extends Controller {
|
||||||
});
|
});
|
||||||
} else if (item["ประเภท"] == "ลูกจ้างประจำ") {
|
} else if (item["ประเภท"] == "ลูกจ้างประจำ") {
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/unauthorize/employee-prem/citizen/${item["รหัสประจำตัวประชาชน"]}`)
|
.GetData(
|
||||||
|
request,
|
||||||
|
`/org/unauthorize/employee-prem/citizen/${item["รหัสประจำตัวประชาชน"]}`,
|
||||||
|
)
|
||||||
.then(async (x: any) => {
|
.then(async (x: any) => {
|
||||||
let development = Object.assign(new DevelopmentHistory(), x);
|
let development = Object.assign(new DevelopmentHistory(), x);
|
||||||
development.dateStart =
|
development.dateStart =
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,12 @@ export class DevelopmentHistory extends EntityBase {
|
||||||
})
|
})
|
||||||
isDone: boolean;
|
isDone: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "บันทึก IDP ที่ทะเบียนประวัติ",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isDoneIDP: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "มีข้อมูลอยู่ในทะเบียนประวัติ",
|
comment: "มีข้อมูลอยู่ในทะเบียนประวัติ",
|
||||||
default: false,
|
default: false,
|
||||||
|
|
@ -320,4 +326,3 @@ export class CreateDevelopmentHistoryOBO {
|
||||||
@Column()
|
@Column()
|
||||||
dateEnd: Date | null;
|
dateEnd: Date | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,4 @@
|
||||||
import {
|
import { Path } from "tsoa";
|
||||||
Controller,
|
|
||||||
Request,
|
|
||||||
Get,
|
|
||||||
Post,
|
|
||||||
Put,
|
|
||||||
Delete,
|
|
||||||
Patch,
|
|
||||||
Route,
|
|
||||||
Security,
|
|
||||||
Tags,
|
|
||||||
Path,
|
|
||||||
} from "tsoa";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { addLogSequence } from "./utils";
|
import { addLogSequence } from "./utils";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue