ปรับ endpont + emp-10

This commit is contained in:
Bright 2024-04-01 17:19:32 +07:00
parent 139da05b0c
commit ff63e650fb

View file

@ -2117,7 +2117,7 @@ export class ReportController extends Controller {
* @summary 01-
*
*/
@Get("emp1-01/{rootId}/{salaryPeriodId}")
@Get("emp-01/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_1(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2180,7 +2180,7 @@ export class ReportController extends Controller {
* @summary 02- 1
*
*/
@Get("emp1-02/{rootId}/{salaryPeriodId}")
@Get("emp-02/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_2(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2252,7 +2252,7 @@ export class ReportController extends Controller {
* @summary 03-
*
*/
@Get("emp1-03/{rootId}/{salaryPeriodId}")
@Get("emp-03/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_3(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2341,7 +2341,7 @@ export class ReportController extends Controller {
* @summary 04- ..1-
*
*/
@Get("emp1-04/{rootId}/{salaryPeriodId}")
@Get("emp-04/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_4(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2419,7 +2419,7 @@ export class ReportController extends Controller {
* @summary 05- ..1-1-
*
*/
@Get("emp1-05/{rootId}/{salaryPeriodId}")
@Get("emp-05/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_5(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2501,7 +2501,7 @@ export class ReportController extends Controller {
* @summary 06- ..2-
*
*/
@Get("emp1-06/{rootId}/{salaryPeriodId}")
@Get("emp-06/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_6(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2578,7 +2578,7 @@ export class ReportController extends Controller {
* @summary 07- ..2-1-
*
*/
@Get("emp1-07/{rootId}/{salaryPeriodId}")
@Get("emp-07/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_7(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2672,7 +2672,7 @@ export class ReportController extends Controller {
* @summary 09- 1 3
*
*/
@Get("emp1-09/{rootId}/{salaryPeriodId}")
@Get("emp-09/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_9(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2846,30 +2846,82 @@ export class ReportController extends Controller {
});
}
// /**
// * API 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น
// *
// * @summary 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น
// *
// */
// @Get("emp-10/{rootId}/{salaryPeriodId}")
// async SalaryReportEmp1_10(@Path() rootId: string, @Path() salaryPeriodId: string) {
// const salaryPeriod = await this.salaryPeriodRepository.findOne({
// where: {
// id: salaryPeriodId,
// },
// });
// if (!salaryPeriod) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
// }
// }
/**
* API 10-
*
* @summary 10-
*
*/
@Get("emp-10/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_10(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg"],
where: {
salaryOrg: {
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: Not("NONE"),
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
});
if (!salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = salaryProfileEmp[0] == null ? "" : salaryProfileEmp[0].root;
const formattedData = salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
profile.child2,
profile.child1,
profile.root,
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
];
const fullName = fullNameParts
.filter((part) => part !== undefined && part !== null)
.join("/");
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position: profile.position,
posLevel: profile.posLevel,
}
});
return new HttpSuccess({
template: "emp1-10",
reportName: "emp1-10",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
});
}
/**
* API 11-
*
* @summary 11-
*
*/
@Get("emp1-11/{rootId}/{salaryPeriodId}")
@Get("emp-11/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_11(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -2941,7 +2993,7 @@ export class ReportController extends Controller {
* @summary 12- ()
*
*/
@Get("emp1-12/{rootId}/{salaryPeriodId}")
@Get("emp-12/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_12(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3023,7 +3075,7 @@ export class ReportController extends Controller {
* @summary 13-
*
*/
@Get("emp1-13/{rootId}/{salaryPeriodId}")
@Get("emp-13/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_13(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3097,7 +3149,7 @@ export class ReportController extends Controller {
* @summary 14-
*
*/
@Get("emp1-14/{rootId}/{salaryPeriodId}")
@Get("emp-14/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_14(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3178,7 +3230,7 @@ export class ReportController extends Controller {
* @summary 15-()
*
*/
@Get("emp1-15/{rootId}/{salaryPeriodId}")
@Get("emp-15/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_15(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3261,7 +3313,7 @@ export class ReportController extends Controller {
* @summary 16-
*
*/
@Get("emp1-16/{rootId}/{salaryPeriodId}")
@Get("emp-16/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_16(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3334,7 +3386,7 @@ export class ReportController extends Controller {
* @summary 17-
*
*/
@Get("emp1-17/{rootId}/{salaryPeriodId}")
@Get("emp-17/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_17(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
@ -3406,7 +3458,7 @@ export class ReportController extends Controller {
* @summary 18-
*
*/
@Get("emp1-18/{rootId}/{salaryPeriodId}")
@Get("emp-18/{rootId}/{salaryPeriodId}")
async SalaryReportEmp1_18(@Path() rootId: string, @Path() salaryPeriodId: string) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {