import mis
This commit is contained in:
parent
60a72243e8
commit
083a482b3a
26 changed files with 4711 additions and 0 deletions
|
|
@ -73,6 +73,25 @@ import { HR_CHILDEN } from "../entities/HR_CHILDEN";
|
|||
import { HR_CHILDEN_EMP } from "../entities/HR_CHILDEN_EMP";
|
||||
import { HR_CHANGENAME } from "../entities/HR_CHANGENAME";
|
||||
import { HR_CHANGENAME_EMP } from "../entities/HR_CHANGENAME_EMP";
|
||||
import { ProfileHonor } from "../entities/ProfileHonor";
|
||||
import { ProfileAbility } from "../entities/ProfileAbility";
|
||||
import { ProfileDuty } from "../entities/ProfileDuty";
|
||||
import { ProfileNopaid } from "../entities/ProfileNopaid";
|
||||
import { ProfileOther } from "../entities/ProfileOther";
|
||||
import { ProfileCertificate } from "../entities/ProfileCertificate";
|
||||
import { ProfileAbilitys } from "../entities/ProfileAbilitys";
|
||||
import { ProfileCertificates } from "../entities/ProfileCertificates";
|
||||
import { ProfileDutys } from "../entities/ProfileDutys";
|
||||
import { ProfileHonors } from "../entities/ProfileHonors";
|
||||
import { ProfileNopaids } from "../entities/ProfileNopaids";
|
||||
import { ProfileOthers } from "../entities/ProfileOthers";
|
||||
import { ProfileDisciplines } from "../entities/ProfileDisciplines";
|
||||
import { ProfileChangeNames } from "../entities/ProfileChangeNames";
|
||||
import { ProfileChildrens } from "../entities/ProfileChildrens";
|
||||
import { ProfileEducations } from "../entities/ProfileEducations";
|
||||
import { ProfileInsignias } from "../entities/ProfileInsignias";
|
||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||
import { ProfileLeaves } from "../entities/ProfileLeaves";
|
||||
@Route("api/v1/org/upload")
|
||||
@Tags("UPLOAD")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -140,6 +159,31 @@ export class ImportDataController extends Controller {
|
|||
private posMasterEmpRepo = AppDataSource.getRepository(EmployeePosMaster);
|
||||
private posExecutiveRepo = AppDataSource.getRepository(PosExecutive);
|
||||
private insigniaRepo = AppDataSource.getRepository(Insignia);
|
||||
|
||||
private ProfileHonorsRepo = AppDataSource.getRepository(ProfileHonors);
|
||||
private HonorRepo = AppDataSource.getRepository(ProfileHonor);
|
||||
private ProfileOthersRepo = AppDataSource.getRepository(ProfileOthers);
|
||||
private OtherRepo = AppDataSource.getRepository(ProfileOther);
|
||||
private ProfileNopaidsRepo = AppDataSource.getRepository(ProfileNopaids);
|
||||
private NopaidRepo = AppDataSource.getRepository(ProfileNopaid);
|
||||
private ProfileAbilitysRepo = AppDataSource.getRepository(ProfileAbilitys);
|
||||
private AbilityRepo = AppDataSource.getRepository(ProfileAbility);
|
||||
private ProfileDutysRepo = AppDataSource.getRepository(ProfileDutys);
|
||||
private DutyRepo = AppDataSource.getRepository(ProfileDuty);
|
||||
private ProfileDisciplinesRepo = AppDataSource.getRepository(ProfileDisciplines);
|
||||
private DisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
|
||||
private ProfileCertificatesRepo = AppDataSource.getRepository(ProfileCertificates);
|
||||
private CertificateRepo = AppDataSource.getRepository(ProfileCertificate);
|
||||
private ProfileChangeNamesRepo = AppDataSource.getRepository(ProfileChangeNames);
|
||||
private ChangeNameRepo = AppDataSource.getRepository(ProfileChangeName);
|
||||
private ProfileChildrensRepo = AppDataSource.getRepository(ProfileChildrens);
|
||||
private ChildrenRepo = AppDataSource.getRepository(ProfileChildren);
|
||||
private ProfileEducationsRepo = AppDataSource.getRepository(ProfileEducations);
|
||||
private EducationRepo = AppDataSource.getRepository(ProfileEducation);
|
||||
private ProfileLeaveSummarysRepo = AppDataSource.getRepository(ProfileLeaves);
|
||||
private LeaveSummaryRepo = AppDataSource.getRepository(ProfileLeave);
|
||||
private ProfileInsigniasRepo = AppDataSource.getRepository(ProfileInsignias);
|
||||
private InsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||
/**
|
||||
* @summary ทะเบียนประวัติ ข้าราชการ
|
||||
*/
|
||||
|
|
@ -4112,4 +4156,594 @@ export class ImportDataController extends Controller {
|
|||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ประกาศเกียรติคุณ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileHonor-OfficerEntry")
|
||||
async UploadFileSQLHonorEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileHonorsRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileHonor();
|
||||
profile.profileId = item.id;
|
||||
profile.detail = _item.detail;
|
||||
profile.issueDate = _item.issueDate;
|
||||
profile.issuer = _item.issuer;
|
||||
profile.refCommandDate = _item.refCommandDate;
|
||||
profile.refCommandNo = _item.refCommandNo;
|
||||
profile.isDate = _item.isDate;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.HonorRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ข้อมูลอื่นๆ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileOther-OfficerEntry")
|
||||
async UploadFileSQLOtherEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileOthersRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileOther();
|
||||
profile.profileId = item.id;
|
||||
profile.detail = _item.detail;
|
||||
profile.date = _item.date;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.OtherRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary บันทึกวันที่ไม่ได้รับเงินเงินเดือนฯ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileNopaid-OfficerEntry")
|
||||
async UploadFileSQLNopaidEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileNopaidsRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileNopaid();
|
||||
profile.profileId = item.id;
|
||||
profile.date = _item.date;
|
||||
profile.detail = _item.detail;
|
||||
profile.reference = _item.reference;
|
||||
profile.refCommandDate = _item.refCommandDate;
|
||||
profile.refCommandNo = _item.refCommandNo;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.NopaidRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ความสามารถพิเศษ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileAbility-OfficerEntry")
|
||||
async UploadFileSQLAbilityEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileAbilitysRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileAbility();
|
||||
profile.profileId = item.id;
|
||||
profile.remark = _item.remark;
|
||||
profile.detail = _item.detail;
|
||||
profile.reference = _item.reference;
|
||||
profile.dateStart = _item.dateStart;
|
||||
profile.dateEnd = _item.dateEnd;
|
||||
profile.field = _item.field;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.AbilityRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ปฏิบัติราชการพิเศษ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileDuty-OfficerEntry")
|
||||
async UploadFileSQLDutyEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileDutysRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileDuty();
|
||||
profile.profileId = item.id;
|
||||
profile.dateStart = _item.dateStart;
|
||||
profile.dateEnd = _item.dateEnd;
|
||||
profile.detail = _item.detail;
|
||||
profile.reference = _item.reference;
|
||||
profile.refCommandDate = _item.refCommandDate;
|
||||
profile.refCommandNo = _item.refCommandNo;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.DutyRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary วินัย ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileDiscipline-OfficerEntry")
|
||||
async UploadFileSQLDisciplineEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileDisciplinesRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileDiscipline();
|
||||
profile.profileId = item.id;
|
||||
profile.date = _item.date;
|
||||
profile.level = _item.level;
|
||||
profile.detail = _item.detail;
|
||||
profile.refCommandDate = _item.refCommandDate;
|
||||
profile.refCommandNo = _item.refCommandNo;
|
||||
profile.unStigma = _item.unStigma;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.DisciplineRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ใบอนุญาตประกอบวิชาชีพ ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileCertificate-OfficerEntry")
|
||||
async UploadFileSQLCertificateEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileCertificatesRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileCertificate();
|
||||
profile.profileId = item.id;
|
||||
profile.expireDate = _item.expireDate;
|
||||
profile.issueDate = _item.issueDate;
|
||||
profile.certificateNo = _item.certificateNo;
|
||||
profile.certificateType = _item.certificateType;
|
||||
profile.issuer = _item.issuer;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.CertificateRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ประวัติการเปลี่ยนชื่อ - นามสกุล ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileChangeName-OfficerEntry")
|
||||
async UploadFileSQLChangeNameEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileChangeNamesRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileChangeName();
|
||||
profile.profileId = item.id;
|
||||
profile.prefix = _item.prefix;
|
||||
profile.firstName = _item.firstName;
|
||||
profile.lastName = _item.lastName;
|
||||
profile.status = _item.status;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.ChangeNameRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary ข้อมูลบุตร ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileChildren-OfficerEntry")
|
||||
async UploadFileSQLChildrenEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileChildrensRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileChildren();
|
||||
profile.profileId = item.id;
|
||||
profile.childrenCareer = _item.childrenCareer;
|
||||
profile.childrenFirstName = _item.childrenFirstName;
|
||||
profile.childrenLastName = _item.childrenLastName;
|
||||
profile.childrenPrefix = _item.childrenPrefix;
|
||||
profile.childrenLive = _item.childrenLive;
|
||||
profile.childrenCitizenId = _item.childrenCitizenId;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.ChildrenRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary การศึกษา ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileEducation-OfficerEntry")
|
||||
async UploadFileSQLEducationEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.profileRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
// const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.ProfileEducationsRepo.find({
|
||||
where: { createdFullName: _item.citizenId },
|
||||
order: {
|
||||
startDate: "ASC",
|
||||
},
|
||||
});
|
||||
const eduLevel = await this.profileEducationRepo.findOne({
|
||||
where: { profileId: _item.id },
|
||||
order: {
|
||||
startDate: "DESC",
|
||||
},
|
||||
});
|
||||
let order = 1;
|
||||
if (eduLevel != null) {
|
||||
order = eduLevel.level + 1;
|
||||
}
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileEducation();
|
||||
profile.profileId = _item.id;
|
||||
profile.country = item.country;
|
||||
profile.degree = item.degree;
|
||||
profile.duration = item.duration;
|
||||
profile.durationYear = item.durationYear;
|
||||
profile.field = item.field;
|
||||
profile.finishDate = item.finishDate;
|
||||
profile.fundName = item.fundName;
|
||||
profile.gpa = item.gpa;
|
||||
profile.institute = item.institute;
|
||||
profile.other = item.other;
|
||||
profile.startDate = item.startDate;
|
||||
profile.endDate = item.endDate;
|
||||
profile.educationLevel = item.educationLevel;
|
||||
// profile.educationLevelId = item.educationLevelId;
|
||||
profile.positionPath = item.positionPath;
|
||||
profile.note = item.note;
|
||||
profile.positionPathId = item.positionPathId;
|
||||
profile.isDate = item.isDate;
|
||||
profile.isEducation = item.isEducation;
|
||||
profile.level = order;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.EducationRepo.save(profile);
|
||||
order = order + 1;
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary เครื่องราช ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileInsignia-OfficerEntry")
|
||||
async UploadFileSQLInsigniaEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileInsigniasRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileInsignia();
|
||||
profile.profileId = item.id;
|
||||
profile.year = _item.year;
|
||||
profile.no = _item.no;
|
||||
profile.volume = _item.volume;
|
||||
profile.section = _item.section;
|
||||
profile.page = _item.page;
|
||||
profile.receiveDate = _item.receiveDate;
|
||||
profile.dateAnnounce = _item.dateAnnounce;
|
||||
profile.issue = _item.issue;
|
||||
profile.volumeNo = _item.volumeNo;
|
||||
profile.refCommandDate = _item.refCommandDate;
|
||||
profile.refCommandNo = _item.refCommandNo;
|
||||
profile.note = _item.note;
|
||||
profile.insigniaId = _item.insigniaId;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.InsigniaRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary การลา ข้าราชการ
|
||||
*/
|
||||
@Post("uploadProfileLeaveSummary-OfficerEntry")
|
||||
async UploadFileSQLLeaveSummaryEntry(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let _null: any = null;
|
||||
const existingProfile = await this.ProfileLeaveSummarysRepo.find({
|
||||
// order: {
|
||||
// citizenId: "ASC",
|
||||
// },
|
||||
});
|
||||
for await (const _item of existingProfile) {
|
||||
const citizenId: any = _item.createdFullName ?? "";
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { citizenId: citizenId },
|
||||
// order: {
|
||||
// Order: "ASC",
|
||||
// },
|
||||
});
|
||||
let order = 1;
|
||||
for await (const item of profiles) {
|
||||
rowCount++;
|
||||
const profile: any = new ProfileLeave();
|
||||
profile.profileId = item.id;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
profile.status = "approve";
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
// profile.totalLeave = _item.insigniaId;
|
||||
|
||||
profile.isEntry = true;
|
||||
profile.createdUserId = request.user.sub;
|
||||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||
await this.LeaveSummaryRepo.save(profile);
|
||||
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||
}
|
||||
order = 1;
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue