filter by dna
This commit is contained in:
parent
2178caa0c1
commit
309f295391
1 changed files with 145 additions and 108 deletions
|
|
@ -97,10 +97,22 @@ export class EvaluationController {
|
||||||
|
|
||||||
const performance = list.map((item) => ({
|
const performance = list.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
year: item.lastUpdatedAt?Extension.ToThaiYear(item.lastUpdatedAt.getFullYear()):null,
|
year: item.lastUpdatedAt ? Extension.ToThaiYear(item.lastUpdatedAt.getFullYear()) : null,
|
||||||
type: item.type == "EXPERT" ? "ชำนาญการ" : item.type == "EXPERTISE" ? "เชียวชาญ" : item.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ": null,
|
type:
|
||||||
subject: item.subject?item.subject[0]:null,
|
item.type == "EXPERT"
|
||||||
evaluationResult: item.evaluationResult == "PASS" ? "ผ่าน" : item.evaluationResult == "NOTPASS" ? "ไม่ผ่าน" : null,
|
? "ชำนาญการ"
|
||||||
|
: item.type == "EXPERTISE"
|
||||||
|
? "เชียวชาญ"
|
||||||
|
: item.type == "SPECIAL_EXPERT"
|
||||||
|
? "ชำนาญการพิเศษ"
|
||||||
|
: null,
|
||||||
|
subject: item.subject ? item.subject[0] : null,
|
||||||
|
evaluationResult:
|
||||||
|
item.evaluationResult == "PASS"
|
||||||
|
? "ผ่าน"
|
||||||
|
: item.evaluationResult == "NOTPASS"
|
||||||
|
? "ไม่ผ่าน"
|
||||||
|
: null,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return new HttpSuccess(performance);
|
return new HttpSuccess(performance);
|
||||||
|
|
@ -134,6 +146,12 @@ export class EvaluationController {
|
||||||
try {
|
try {
|
||||||
// await new permission().PermissionList(request, "SYS_EVA_REQ");
|
// await new permission().PermissionList(request, "SYS_EVA_REQ");
|
||||||
let _data = await new permission().PermissionOrgList(request, "SYS_EVA_REQ");
|
let _data = await new permission().PermissionOrgList(request, "SYS_EVA_REQ");
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "/org/finddna", _data)
|
||||||
|
.then((x) => {
|
||||||
|
_data = x;
|
||||||
|
})
|
||||||
|
.catch((x) => {});
|
||||||
const [evaluation, total] = await AppDataSource.getRepository(Evaluation)
|
const [evaluation, total] = await AppDataSource.getRepository(Evaluation)
|
||||||
.createQueryBuilder("evaluation")
|
.createQueryBuilder("evaluation")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -360,7 +378,10 @@ export class EvaluationController {
|
||||||
@Get("get-announce-template/{id}")
|
@Get("get-announce-template/{id}")
|
||||||
async getAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser) {
|
async getAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser) {
|
||||||
try {
|
try {
|
||||||
const evaluation = await this.evaluationRepository.findOne({ where: { id } , select: ["id","detailAnnounceStep5Body","detailAnnounceStep5Footer"]});
|
const evaluation = await this.evaluationRepository.findOne({
|
||||||
|
where: { id },
|
||||||
|
select: ["id", "detailAnnounceStep5Body", "detailAnnounceStep5Footer"],
|
||||||
|
});
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||||
}
|
}
|
||||||
|
|
@ -510,13 +531,20 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
return `not found data`;
|
return `not found data`;
|
||||||
}
|
}
|
||||||
let _code = requestBody.type == "EXPERT" ? "ST05-1" : requestBody.type == "EXPERTISE" ? "ST05-1" : requestBody.type == "SPECIAL_EXPERT" ? "ST05-2" : "ST05-1";
|
let _code =
|
||||||
|
requestBody.type == "EXPERT"
|
||||||
|
? "ST05-1"
|
||||||
|
: requestBody.type == "EXPERTISE"
|
||||||
|
? "ST05-1"
|
||||||
|
: requestBody.type == "SPECIAL_EXPERT"
|
||||||
|
? "ST05-2"
|
||||||
|
: "ST05-1";
|
||||||
const announceTemplate5 = await this.announceTemplateRepository.findOne({
|
const announceTemplate5 = await this.announceTemplateRepository.findOne({
|
||||||
where:{
|
where: {
|
||||||
code : _code
|
code: _code,
|
||||||
},
|
},
|
||||||
select: ["detailBody","detailFooter"]
|
select: ["detailBody", "detailFooter"],
|
||||||
})
|
});
|
||||||
const before = null;
|
const before = null;
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
||||||
|
|
@ -538,10 +566,16 @@ export class EvaluationController {
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
evaluation.lastUpdatedAt = new Date();
|
evaluation.lastUpdatedAt = new Date();
|
||||||
evaluation.userId = request.user.sub;
|
evaluation.userId = request.user.sub;
|
||||||
evaluation.detailAnnounceStep5Body = announceTemplate5?.detailBody??_null;
|
evaluation.detailAnnounceStep5Body = announceTemplate5?.detailBody ?? _null;
|
||||||
evaluation.detailAnnounceStep5Footer = announceTemplate5?.detailFooter??_null;
|
evaluation.detailAnnounceStep5Footer = announceTemplate5?.detailFooter ?? _null;
|
||||||
evaluation.positionArea = requestBody.positionArea && requestBody.positionArea !== "" ? requestBody.positionArea : _null;
|
evaluation.positionArea =
|
||||||
evaluation.posExecutive = requestBody.posExecutive && requestBody.posExecutive !== "" ? requestBody.posExecutive : _null;
|
requestBody.positionArea && requestBody.positionArea !== ""
|
||||||
|
? requestBody.positionArea
|
||||||
|
: _null;
|
||||||
|
evaluation.posExecutive =
|
||||||
|
requestBody.posExecutive && requestBody.posExecutive !== ""
|
||||||
|
? requestBody.posExecutive
|
||||||
|
: _null;
|
||||||
await this.evaluationRepository.save(evaluation, { data: request });
|
await this.evaluationRepository.save(evaluation, { data: request });
|
||||||
setLogDataDiff(request, { before, after: evaluation });
|
setLogDataDiff(request, { before, after: evaluation });
|
||||||
|
|
||||||
|
|
@ -1807,7 +1841,7 @@ export class EvaluationController {
|
||||||
})
|
})
|
||||||
.catch((x) => {});
|
.catch((x) => {});
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
_director.map((director:any) => {
|
_director.map((director: any) => {
|
||||||
return new CallAPI()
|
return new CallAPI()
|
||||||
.PostData(request, "/placement/noti/keycloak", {
|
.PostData(request, "/placement/noti/keycloak", {
|
||||||
subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
||||||
|
|
@ -1818,10 +1852,9 @@ export class EvaluationController {
|
||||||
isSendInbox: true,
|
isSendInbox: true,
|
||||||
isSendNotification: true,
|
isSendNotification: true,
|
||||||
})
|
})
|
||||||
.then((x) => {
|
.then((x) => {})
|
||||||
})
|
|
||||||
.catch((x) => {});
|
.catch((x) => {});
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
@ -2123,7 +2156,11 @@ export class EvaluationController {
|
||||||
* @param {string} id id ข้อมูลการประเมิน
|
* @param {string} id id ข้อมูลการประเมิน
|
||||||
*/
|
*/
|
||||||
@Put("edit-announce-template/{id}")
|
@Put("edit-announce-template/{id}")
|
||||||
async editAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser, @Body() body: {detailBody: string, detailFooter: string}) {
|
async editAnnounceTemp(
|
||||||
|
@Path() id: string,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
@Body() body: { detailBody: string; detailFooter: string },
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
await new permission().PermissionUpdate(request, "SYS_EVA_REQ");
|
await new permission().PermissionUpdate(request, "SYS_EVA_REQ");
|
||||||
|
|
||||||
|
|
@ -2951,19 +2988,19 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
const _null:any = null;
|
const _null: any = null;
|
||||||
evaluation.author = body.author;
|
evaluation.author = body.author;
|
||||||
evaluation.subject = body.subject;
|
evaluation.subject = body.subject;
|
||||||
evaluation.commanderFullname = body.commanderFullname;
|
evaluation.commanderFullname = body.commanderFullname;
|
||||||
evaluation.commanderOrg = body.commanderOrg??_null;
|
evaluation.commanderOrg = body.commanderOrg ?? _null;
|
||||||
evaluation.commanderOrgOld = body.commanderOrgOld??_null;
|
evaluation.commanderOrgOld = body.commanderOrgOld ?? _null;
|
||||||
evaluation.commanderPosition = body.commanderPosition;
|
evaluation.commanderPosition = body.commanderPosition;
|
||||||
evaluation.commanderPositionOld = body.commanderPositionOld??_null;
|
evaluation.commanderPositionOld = body.commanderPositionOld ?? _null;
|
||||||
evaluation.commanderAboveFullname = body.commanderAboveFullname;
|
evaluation.commanderAboveFullname = body.commanderAboveFullname;
|
||||||
evaluation.commanderAboveOrg = body.commanderAboveOrg??_null;
|
evaluation.commanderAboveOrg = body.commanderAboveOrg ?? _null;
|
||||||
evaluation.commanderAboveOrgOld = body.commanderAboveOrgOld??_null;
|
evaluation.commanderAboveOrgOld = body.commanderAboveOrgOld ?? _null;
|
||||||
evaluation.commanderAbovePosition = body.commanderAbovePosition;
|
evaluation.commanderAbovePosition = body.commanderAbovePosition;
|
||||||
evaluation.commanderAbovePositionOld = body.commanderAbovePositionOld??_null;
|
evaluation.commanderAbovePositionOld = body.commanderAbovePositionOld ?? _null;
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
evaluation.lastUpdatedAt = new Date();
|
evaluation.lastUpdatedAt = new Date();
|
||||||
|
|
@ -3024,20 +3061,20 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
const _null:any = null;
|
const _null: any = null;
|
||||||
evaluation.authorDoc2 = body.authorDoc2;
|
evaluation.authorDoc2 = body.authorDoc2;
|
||||||
evaluation.subjectDoc2 = body.subjectDoc2;
|
evaluation.subjectDoc2 = body.subjectDoc2;
|
||||||
evaluation.assignedPosition = body.assignedPosition;
|
evaluation.assignedPosition = body.assignedPosition;
|
||||||
evaluation.commanderFullnameDoc2 = body.commanderFullnameDoc2;
|
evaluation.commanderFullnameDoc2 = body.commanderFullnameDoc2;
|
||||||
evaluation.commanderOrgDoc2 = body.commanderOrgDoc2??_null;
|
evaluation.commanderOrgDoc2 = body.commanderOrgDoc2 ?? _null;
|
||||||
evaluation.commanderOrgOldDoc2 = body.commanderOrgOldDoc2??_null;
|
evaluation.commanderOrgOldDoc2 = body.commanderOrgOldDoc2 ?? _null;
|
||||||
evaluation.commanderPositionDoc2 = body.commanderPositionDoc2;
|
evaluation.commanderPositionDoc2 = body.commanderPositionDoc2;
|
||||||
evaluation.commanderPositionOldDoc2 = body.commanderPositionOldDoc2??_null;
|
evaluation.commanderPositionOldDoc2 = body.commanderPositionOldDoc2 ?? _null;
|
||||||
evaluation.commanderAboveFullnameDoc2 = body.commanderAboveFullnameDoc2;
|
evaluation.commanderAboveFullnameDoc2 = body.commanderAboveFullnameDoc2;
|
||||||
evaluation.commanderAboveOrgDoc2 = body.commanderAboveOrgDoc2??_null;
|
evaluation.commanderAboveOrgDoc2 = body.commanderAboveOrgDoc2 ?? _null;
|
||||||
evaluation.commanderAboveOrgOldDoc2 = body.commanderAboveOrgOldDoc2??_null;
|
evaluation.commanderAboveOrgOldDoc2 = body.commanderAboveOrgOldDoc2 ?? _null;
|
||||||
evaluation.commanderAbovePositionDoc2 = body.commanderAbovePositionDoc2;
|
evaluation.commanderAbovePositionDoc2 = body.commanderAbovePositionDoc2;
|
||||||
evaluation.commanderAbovePositionOldDoc2 = body.commanderAbovePositionOldDoc2??_null;
|
evaluation.commanderAbovePositionOldDoc2 = body.commanderAbovePositionOldDoc2 ?? _null;
|
||||||
evaluation.isUpdated = true;
|
evaluation.isUpdated = true;
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue