migrate
This commit is contained in:
parent
aff5aa452e
commit
defec8a70e
3 changed files with 105 additions and 4 deletions
|
|
@ -102,8 +102,8 @@ export class ReportController extends Controller {
|
|||
|
||||
return new HttpSuccess({ template: "SalaryRank", reportName: "SalaryRank",
|
||||
data: {
|
||||
nameType: salarys.salaryType == "OFFICER" ? "ผังข้าราชการกรุงเทพมหานครสามัญ" :
|
||||
salarys.salaryType == "EMPLOYEE" ? "ผังลูกจ้างประจำกรุงเทพมหานคร" : "",
|
||||
nameType: salarys.name == "OFFICER" ? "ผังข้าราชการกรุงเทพมหานครสามัญ" :
|
||||
salarys.name == "EMPLOYEE" ? "ผังลูกจ้างประจำกรุงเทพมหานคร" : "",
|
||||
level: posLevel?.posLevelName == null ? "" : posLevel?.posLevelName,
|
||||
type: posType?.posTypeName == null ? "" : posType?.posTypeName,
|
||||
date: salarys.date == null ? "" :
|
||||
|
|
|
|||
|
|
@ -39,6 +39,81 @@ export class Report_1_Controller extends Controller {
|
|||
private salaryOrgRepository = AppDataSource.getRepository(SalaryOrg);
|
||||
private salaryProfile = AppDataSource.getRepository(SalaryProfile);
|
||||
|
||||
/**
|
||||
* API รายงานแบบ 1 กท รอบเมษายน
|
||||
*
|
||||
* @summary รายงานแบบ 1 กท รอบเมษายน
|
||||
*
|
||||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
*/
|
||||
@Get("03/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReport3(
|
||||
// @Path() rootId : string = "c6164a42-539d-401a-b289-653282c08e37",
|
||||
// @Path() salaryPeriodId: string = "31cfc7de-b93b-4998-bbf1-25c21f141ac2",
|
||||
@Path() rootId : string,
|
||||
@Path() salaryPeriodId: string,
|
||||
) {
|
||||
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
period: "APR",
|
||||
isActive: true
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||
}
|
||||
|
||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP2",
|
||||
},
|
||||
order: {
|
||||
group: "ASC"
|
||||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
|
||||
const salaryProfile = await this.salaryProfile.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: "FULL", //หนึ่งขั้น
|
||||
},
|
||||
select: [
|
||||
"id", "prefix" , "firstName", "lastName", "root",
|
||||
"position", "posType", "posLevel", "orgShortName",
|
||||
"posMasterNo", "amount", "amountSpecial"
|
||||
]
|
||||
});
|
||||
|
||||
const mapData = {
|
||||
effectiveDate : salaryPeriod?.effectiveDate,
|
||||
// root: salaryProfile[0]?.root,
|
||||
profile: salaryProfile.map((item, index) => ({
|
||||
no: Extension.ToThaiNumber(String(index+1)),
|
||||
fullname: item.prefix + item.firstName +" "+ item.lastName,
|
||||
position: item.position + "/" +
|
||||
(item.child4==undefined && item.child4==null ? "" : item.child4+"/")+
|
||||
(item.child3==undefined && item.child3==null ? "" : item.child3+"/")+
|
||||
(item.child2==undefined && item.child2==null ? "" : item.child2+"/")+
|
||||
(item.child1==undefined && item.child1==null ? "" : item.child1+"/")+
|
||||
(item.root==undefined && item.root==null ? "" : item.root),
|
||||
posLevel: item.posLevel,
|
||||
orgShortName: item.orgShortName+item.posMasterNo,
|
||||
amount: item.amount == undefined || item.amount == null ? "๐" : Extension.ToThaiNumber(String(item.amount)),
|
||||
amountSpecial: item.amountSpecial == undefined || item.amountSpecial == null ? "๐" : Extension.ToThaiNumber(String(item.amountSpecial)),
|
||||
score: null, //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
remark: null //หมายเหตุ
|
||||
}))
|
||||
}
|
||||
return mapData
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายงานแบบ 1 กท รอบเมษายน
|
||||
*
|
||||
|
|
@ -75,8 +150,8 @@ export class Report_1_Controller extends Controller {
|
|||
},
|
||||
order: {
|
||||
group: "ASC"
|
||||
}
|
||||
// relations: ["salaryProfiles"],
|
||||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
|
||||
const salaryProfile = await this.salaryProfile.find({
|
||||
|
|
|
|||
26
src/migration/1709797298860-rename_fiels.ts
Normal file
26
src/migration/1709797298860-rename_fiels.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RenameFiels1709797298860 implements MigrationInterface {
|
||||
name = 'RenameFiels1709797298860'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` CHANGE \`salaryType\` \`name\` varchar(255) NOT NULL COMMENT 'ประเภทผัง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryPeriod\` ADD \`isClose\` tinyint NOT NULL COMMENT 'ปิดรอบ' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` DROP COLUMN \`name\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` ADD \`name\` varchar(255) NOT NULL COMMENT 'ชื่อผัง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountSpecial\` \`amountSpecial\` double NOT NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountUse\` \`amountUse\` double NOT NULL COMMENT 'จำนวนเงินที่ใช้เลื่อน' DEFAULT '0'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`positionSalaryAmount\` \`positionSalaryAmount\` double NOT NULL COMMENT 'เงินเดือนหลังเลื่อน' DEFAULT '0'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`positionSalaryAmount\` \`positionSalaryAmount\` double NULL COMMENT 'เงินเดือนหลังเลื่อน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountUse\` \`amountUse\` double NULL COMMENT 'จำนวนเงินที่ใช้เลื่อน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountSpecial\` \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` DROP COLUMN \`name\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` ADD \`name\` varchar(255) NOT NULL COMMENT 'ประเภทผัง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salaryPeriod\` DROP COLUMN \`isClose\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` CHANGE \`name\` \`salaryType\` varchar(255) NOT NULL COMMENT 'ประเภทผัง'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue