update issue #1436 (fix report kk1)
This commit is contained in:
parent
1eadad89da
commit
0ce9846044
1 changed files with 48 additions and 32 deletions
|
|
@ -83,6 +83,7 @@ import { OrgChild2 } from "../entities/OrgChild2";
|
||||||
import { OrgChild3 } from "../entities/OrgChild3";
|
import { OrgChild3 } from "../entities/OrgChild3";
|
||||||
import { OrgChild4 } from "../entities/OrgChild4";
|
import { OrgChild4 } from "../entities/OrgChild4";
|
||||||
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
||||||
|
import { ProfileAssistance } from "../entities/ProfileAssistance";
|
||||||
|
|
||||||
@Route("api/v1/org/profile")
|
@Route("api/v1/org/profile")
|
||||||
@Tags("Profile")
|
@Tags("Profile")
|
||||||
|
|
@ -134,6 +135,7 @@ export class ProfileController extends Controller {
|
||||||
private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment);
|
private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment);
|
||||||
private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility);
|
private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility);
|
||||||
private permissionProflileRepository = AppDataSource.getRepository(PermissionProfile);
|
private permissionProflileRepository = AppDataSource.getRepository(PermissionProfile);
|
||||||
|
private profileAssistanceRepository = AppDataSource.getRepository(ProfileAssistance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* report ประวัติแบบย่อ ข้าราชการ
|
* report ประวัติแบบย่อ ข้าราชการ
|
||||||
|
|
@ -1073,7 +1075,7 @@ export class ProfileController extends Controller {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const training_raw = await this.trainingRepository.find({
|
const training_raw = await this.trainingRepository.find({
|
||||||
select: ["startDate", "endDate", "place", "department", "name"],
|
select: ["place", "department", "name", "duration"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
@ -1081,36 +1083,21 @@ export class ProfileController extends Controller {
|
||||||
training_raw.length > 0
|
training_raw.length > 0
|
||||||
? training_raw.map((item) => ({
|
? training_raw.map((item) => ({
|
||||||
institute: item.department ?? "",
|
institute: item.department ?? "",
|
||||||
start:
|
degree: item.name ? Extension.ToThaiNumber(item.name) : "",
|
||||||
item.startDate == null
|
place: item.place ? Extension.ToThaiNumber(item.place) : "",
|
||||||
? ""
|
duration: item.duration ? Extension.ToThaiNumber(item.duration) : "",
|
||||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)),
|
|
||||||
end:
|
|
||||||
item.endDate == null
|
|
||||||
? ""
|
|
||||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)),
|
|
||||||
date:
|
|
||||||
item.startDate && item.endDate
|
|
||||||
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
|
||||||
: "",
|
|
||||||
level: "",
|
|
||||||
degree: item.name,
|
|
||||||
field: "",
|
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
institute: "-",
|
institute: "-",
|
||||||
start: "-",
|
|
||||||
end: "-",
|
|
||||||
date: "-",
|
|
||||||
level: "-",
|
|
||||||
degree: "-",
|
degree: "-",
|
||||||
field: "-",
|
place: "-",
|
||||||
|
duration: "-"
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const discipline_raw = await this.disciplineRepository.find({
|
const discipline_raw = await this.disciplineRepository.find({
|
||||||
select: ["refCommandDate", "refCommandNo", "detail"],
|
select: ["refCommandDate", "refCommandNo", "detail", "level"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
@ -1251,6 +1238,7 @@ export class ProfileController extends Controller {
|
||||||
refCommandDate: item.refCommandDate
|
refCommandDate: item.refCommandDate
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
||||||
: "",
|
: "",
|
||||||
|
note: item.note ? Extension.ToThaiNumber(item.note) : "",
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
|
|
@ -1453,10 +1441,17 @@ export class ProfileController extends Controller {
|
||||||
];
|
];
|
||||||
|
|
||||||
const actposition_raw = await this.profileActpositionRepo.find({
|
const actposition_raw = await this.profileActpositionRepo.find({
|
||||||
|
select: ["dateStart", "dateEnd", "position"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const actposition =
|
const assistance_raw = await this.profileAssistanceRepository.find({
|
||||||
|
select: ["dateStart", "dateEnd", "commandName", "agency", "document"],
|
||||||
|
where: { profileId: id },
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
|
});
|
||||||
|
|
||||||
|
const _actposition =
|
||||||
actposition_raw.length > 0
|
actposition_raw.length > 0
|
||||||
? actposition_raw.map((item) => ({
|
? actposition_raw.map((item) => ({
|
||||||
date: item.dateStart
|
date: item.dateStart
|
||||||
|
|
@ -1464,22 +1459,43 @@ export class ProfileController extends Controller {
|
||||||
: "" + item.dateEnd
|
: "" + item.dateEnd
|
||||||
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
|
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
|
||||||
: "",
|
: "",
|
||||||
refCommandDate: item.refCommandDate
|
position: item.position ? Extension.ToThaiNumber(item.position) : "",
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
commandName: "รักษาการในตำแหน่ง",
|
||||||
: "",
|
agency: "",
|
||||||
refCommandNo: item.refCommandNo ? Extension.ToThaiNumber(item.refCommandNo) : "",
|
document: ""
|
||||||
position: item.position,
|
|
||||||
posNo: item.posNo,
|
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
date: "-",
|
date: "-",
|
||||||
refCommandDate: "-",
|
|
||||||
refCommandNo: "-",
|
|
||||||
position: "-",
|
position: "-",
|
||||||
posNo: "-",
|
commandName: "-",
|
||||||
|
agency: "-",
|
||||||
|
document: "-"
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const _assistance =
|
||||||
|
assistance_raw.length > 0
|
||||||
|
? assistance_raw.map((item) => ({
|
||||||
|
date: item.dateStart
|
||||||
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||||
|
: "" + item.dateEnd
|
||||||
|
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
|
||||||
|
: "",
|
||||||
|
position: "",
|
||||||
|
commandName: item.commandName ? Extension.ToThaiNumber(item.commandName): "",
|
||||||
|
agency: item.agency ? Extension.ToThaiNumber(item.agency): "",
|
||||||
|
document: item.document ? Extension.ToThaiNumber(item.document): "",
|
||||||
|
}))
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
date: "-",
|
||||||
|
position: "-",
|
||||||
|
commandName: "-",
|
||||||
|
agency: "-",
|
||||||
|
document: "-"
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const actposition = [..._actposition, ..._assistance]
|
||||||
const duty_raw = await this.dutyRepository.find({
|
const duty_raw = await this.dutyRepository.find({
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue