แก้ import data ไมพบข้อมูลในทะเบียนประวัติ
This commit is contained in:
parent
8c39019f4a
commit
78ce7fa612
2 changed files with 92 additions and 6 deletions
|
|
@ -36,10 +36,7 @@ import { Province } from "../entities/Province";
|
||||||
import { PosType } from "../entities/PosType";
|
import { PosType } from "../entities/PosType";
|
||||||
import { PosLevel } from "../entities/PosLevel";
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
import { PlannedGoalPosition } from "../entities/PlannedGoalPosition";
|
import { PlannedGoalPosition } from "../entities/PlannedGoalPosition";
|
||||||
import {
|
import { CreateDevelopmentHistoryOBO, DevelopmentHistory } from "../entities/DevelopmentHistory";
|
||||||
CreateDevelopmentHistoryOBO,
|
|
||||||
DevelopmentHistory,
|
|
||||||
} from "../entities/DevelopmentHistory";
|
|
||||||
import { DevelopmentProjectType } from "../entities/DevelopmentProjectType";
|
import { DevelopmentProjectType } from "../entities/DevelopmentProjectType";
|
||||||
import {
|
import {
|
||||||
CreateDevelopmentEvaluation,
|
CreateDevelopmentEvaluation,
|
||||||
|
|
@ -2544,7 +2541,7 @@ export class DevelopmentController extends Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item["ประเภท"] == undefined) return;
|
if (item["ประเภท"] == undefined) return;
|
||||||
if (item["ประเภท"] == "ข้าราชการกรุงเทพมหานครสามัญ") {
|
if (item["ประเภท"] == "ข้าราชการกรุงเทพมหานครสามัญ" || item["ประเภท"] == "ขรก.กทม. สามัญ") {
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/unauthorize/officer/citizen/${item["รหัสประจำตัวประชาชน"]}`)
|
.GetData(request, `/org/unauthorize/officer/citizen/${item["รหัสประจำตัวประชาชน"]}`)
|
||||||
.then(async (x: any) => {
|
.then(async (x: any) => {
|
||||||
|
|
@ -2628,7 +2625,7 @@ export class DevelopmentController extends Controller {
|
||||||
await this.developmentHistoryRepository.save(development, { data: request });
|
await this.developmentHistoryRepository.save(development, { data: request });
|
||||||
setLogDataDiff(request, { before, after: development });
|
setLogDataDiff(request, { before, after: development });
|
||||||
});
|
});
|
||||||
} else {
|
} else if (item["ประเภท"] == "ลูกจ้างประจำ") {
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/unauthorize/employee/citizen/${item["รหัสประจำตัวประชาชน"]}`)
|
.GetData(request, `/org/unauthorize/employee/citizen/${item["รหัสประจำตัวประชาชน"]}`)
|
||||||
.then(async (x: any) => {
|
.then(async (x: any) => {
|
||||||
|
|
@ -2712,6 +2709,49 @@ export class DevelopmentController extends Controller {
|
||||||
await this.developmentHistoryRepository.save(development, { data: request });
|
await this.developmentHistoryRepository.save(development, { data: request });
|
||||||
setLogDataDiff(request, { before, after: development });
|
setLogDataDiff(request, { before, after: development });
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
let development = new DevelopmentHistory();
|
||||||
|
let _null: any = null;
|
||||||
|
development.prefix = item["คำนำหน้า"] == undefined ? null : item["คำนำหน้า"];
|
||||||
|
development.firstName = item["ชื่อ"] == undefined ? null : item["ชื่อ"];
|
||||||
|
development.lastName = item["นามสกุล"] == undefined ? null : item["นามสกุล"];
|
||||||
|
development.position = item["ตำแหน่ง"] == undefined ? null : item["ตำแหน่ง"];
|
||||||
|
development.org = item["สังกัด"] == undefined ? null : item["สังกัด"];
|
||||||
|
development.dateStart =
|
||||||
|
item["วันที่เริ่มต้น"] == undefined ? null : item["วันที่เริ่มต้น"];
|
||||||
|
development.dateEnd = item["วันที่สิ้นสุด"] == undefined ? null : item["วันที่สิ้นสุด"];
|
||||||
|
development.citizenId =
|
||||||
|
item["รหัสประจำตัวประชาชน"] == undefined ? _null : item["รหัสประจำตัวประชาชน"];
|
||||||
|
development.type = "OTHER";
|
||||||
|
development.order =
|
||||||
|
item["เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"] == undefined
|
||||||
|
? null
|
||||||
|
: item["เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"];
|
||||||
|
development.dateOrder =
|
||||||
|
item["คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"] == undefined
|
||||||
|
? _null
|
||||||
|
: new Date(item["คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"]);
|
||||||
|
development.trainingDays =
|
||||||
|
item["จำนวนวันที่อบรม"] == undefined ? null : item["จำนวนวันที่อบรม"];
|
||||||
|
development.posLevelId = null;
|
||||||
|
development.posTypeId = null;
|
||||||
|
development.employeePosLevelId = null;
|
||||||
|
development.employeePosTypeId = null;
|
||||||
|
development.developmentId = id;
|
||||||
|
development.createdUserId = request.user.sub;
|
||||||
|
development.createdFullName = request.user.name;
|
||||||
|
development.lastUpdateUserId = request.user.sub;
|
||||||
|
development.lastUpdateFullName = request.user.name;
|
||||||
|
development.createdAt = new Date();
|
||||||
|
development.lastUpdatedAt = new Date();
|
||||||
|
development.isProfile = false;
|
||||||
|
// addLogSequence(request, {
|
||||||
|
// action: "database",
|
||||||
|
// status: "success",
|
||||||
|
// description: "Store DevelopmentHistory.",
|
||||||
|
// });
|
||||||
|
await this.developmentHistoryRepository.save(development, { data: request });
|
||||||
|
setLogDataDiff(request, { before, after: development });
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -359,6 +359,52 @@ export class DevelopmentScholarshipController extends Controller {
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API แก้ไขทุนการศึกษา/ฝึกอบรม
|
||||||
|
*
|
||||||
|
* @summary DEV_012 - แก้ไขทุนการศึกษา/ฝึกอบรม #12
|
||||||
|
*
|
||||||
|
* @param {string} id Id ข้าราชการฯที่ได้รับทุนการศึกษา
|
||||||
|
*/
|
||||||
|
@Put("admin/{id}")
|
||||||
|
async UpdateDevelopmentScholarshipAdminById(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() requestBody: UpdateDevelopmentScholarship,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
await new permission().PermissionUpdate(request, "SYS_DEV_SCHOLARSHIP");
|
||||||
|
const development = await this.developmentScholarshipRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
});
|
||||||
|
if (!development) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
|
||||||
|
}
|
||||||
|
if (requestBody.posTypeId != null) {
|
||||||
|
const checkId = await this.posTypeRepository.findOne({
|
||||||
|
where: { id: requestBody.posTypeId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestBody.posLevelId != null) {
|
||||||
|
const checkId = await this.posLevelRepository.findOne({
|
||||||
|
where: { id: requestBody.posLevelId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const before = structuredClone(development);
|
||||||
|
Object.assign(development, requestBody);
|
||||||
|
development.lastUpdateUserId = request.user.sub;
|
||||||
|
development.lastUpdateFullName = request.user.name;
|
||||||
|
development.lastUpdatedAt = new Date();
|
||||||
|
await this.developmentScholarshipRepository.save(development, { data: request });
|
||||||
|
setLogDataDiff(request, { before, after: development });
|
||||||
|
return new HttpSuccess(development.id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายละเอียดทุนการศึกษา/ฝึกอบรม ADMIN
|
* API รายละเอียดทุนการศึกษา/ฝึกอบรม ADMIN
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue