ออกคำสั่ง
This commit is contained in:
parent
505baa7bba
commit
40f45b01e6
5 changed files with 203 additions and 3 deletions
|
|
@ -299,6 +299,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.posLevelName = x.posLevelName;
|
||||
kpiUserEvaluation.posTypeName = x.posTypeName;
|
||||
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
|
||||
kpiUserEvaluation.org = x.root;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
|
|
@ -315,11 +316,23 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.posLevelName = x.posLevelName;
|
||||
kpiUserEvaluation.posTypeName = x.posTypeName;
|
||||
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
|
||||
kpiUserEvaluation.org = x.root;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
}
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/profileid/position/" + requestBody.evaluatorId)
|
||||
.then((x) => {
|
||||
kpiUserEvaluation.prefixEvaluator = x.prefix;
|
||||
kpiUserEvaluation.firstNameEvaluator = x.firstName;
|
||||
kpiUserEvaluation.lastNameEvaluator = x.lastName;
|
||||
kpiUserEvaluation.positionEvaluator = x.position;
|
||||
kpiUserEvaluation.posLevelNameEvaluator = x.posLevelName;
|
||||
kpiUserEvaluation.posTypeNameEvaluator = x.posTypeName;
|
||||
kpiUserEvaluation.orgEvaluator = x.root;
|
||||
});
|
||||
kpiUserEvaluation.evaluationStatus = "NEW";
|
||||
kpiUserEvaluation.evaluationResults = "PENDING";
|
||||
kpiUserEvaluation.createdUserId = request.user.sub;
|
||||
|
|
@ -701,6 +714,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
totalPoint2_2: kpiUserEvaluation.totalPoint2_2,
|
||||
summaryPoint: kpiUserEvaluation.summaryPoint,
|
||||
isOpen: kpiUserEvaluation.isOpen,
|
||||
openDate: kpiUserEvaluation.openDate,
|
||||
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
|
||||
durationKPI:
|
||||
kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,
|
||||
|
|
@ -1041,6 +1055,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
);
|
||||
}
|
||||
kpiUserEvaluation.isOpen = true;
|
||||
kpiUserEvaluation.openDate = new Date();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,80 @@ export class ReportController extends Controller {
|
|||
where: { kpiPeriodId: period?.id },
|
||||
});
|
||||
|
||||
formattedData = {};
|
||||
formattedData = {
|
||||
fullname:
|
||||
kpiUserEvaluation.prefix + kpiUserEvaluation.firstName + " " + kpiUserEvaluation.lastName,
|
||||
position: kpiUserEvaluation.position,
|
||||
posTypeName: kpiUserEvaluation.posTypeName,
|
||||
posLevelName: kpiUserEvaluation.posLevelName,
|
||||
org: kpiUserEvaluation.org,
|
||||
|
||||
fullnameEvaluator:
|
||||
kpiUserEvaluation.prefixEvaluator +
|
||||
kpiUserEvaluation.firstNameEvaluator +
|
||||
" " +
|
||||
kpiUserEvaluation.lastNameEvaluator,
|
||||
positionEvaluator: kpiUserEvaluation.positionEvaluator,
|
||||
posTypeNameEvaluator: kpiUserEvaluation.posTypeNameEvaluator,
|
||||
posLevelNameEvaluator: kpiUserEvaluation.posLevelNameEvaluator,
|
||||
rootEvaluator: kpiUserEvaluation.orgEvaluator,
|
||||
|
||||
year: Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(kpiUserEvaluation.kpiPeriod.year)),
|
||||
),
|
||||
|
||||
startDateApr:
|
||||
kpiUserEvaluation.kpiPeriod == null ||
|
||||
kpiUserEvaluation.kpiPeriod.startDate == null ||
|
||||
kpiUserEvaluation.kpiPeriod.durationKPI != "APR"
|
||||
? "-"
|
||||
: Extension.ToThaiNumber(
|
||||
Extension.ToThaiFullDate(kpiUserEvaluation.kpiPeriod.startDate),
|
||||
),
|
||||
endDateApr:
|
||||
kpiUserEvaluation.kpiPeriod == null ||
|
||||
kpiUserEvaluation.kpiPeriod.endDate == null ||
|
||||
kpiUserEvaluation.kpiPeriod.durationKPI != "APR"
|
||||
? "-"
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate(kpiUserEvaluation.kpiPeriod.endDate)),
|
||||
startDateOct:
|
||||
kpiUserEvaluation.kpiPeriod == null ||
|
||||
kpiUserEvaluation.kpiPeriod.startDate == null ||
|
||||
kpiUserEvaluation.kpiPeriod.durationKPI != "OCT"
|
||||
? "-"
|
||||
: Extension.ToThaiNumber(
|
||||
Extension.ToThaiFullDate(kpiUserEvaluation.kpiPeriod.startDate),
|
||||
),
|
||||
endDateOct:
|
||||
kpiUserEvaluation.kpiPeriod == null ||
|
||||
kpiUserEvaluation.kpiPeriod.endDate == null ||
|
||||
kpiUserEvaluation.kpiPeriod.durationKPI != "OCT"
|
||||
? "-"
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate(kpiUserEvaluation.kpiPeriod.endDate)),
|
||||
|
||||
evaluationResults: kpiUserEvaluation.evaluationResults,
|
||||
totalPoint1: Extension.ToThaiNumber(kpiUserEvaluation.totalPoint1.toLocaleString()),
|
||||
totalPoint2: Extension.ToThaiNumber(
|
||||
kpiUserEvaluation.totalPoint2_2 + kpiUserEvaluation.totalPoint2_1.toLocaleString(),
|
||||
),
|
||||
summaryPoint: Extension.ToThaiNumber(kpiUserEvaluation.summaryPoint.toLocaleString()),
|
||||
weightPoint1: Extension.ToThaiNumber(kpiUserEvaluation.weightPoint1.toLocaleString()),
|
||||
weightPoint2: Extension.ToThaiNumber(kpiUserEvaluation.weightPoint2.toLocaleString()),
|
||||
summaryWeight: Extension.ToThaiNumber(kpiUserEvaluation.summaryWeight.toLocaleString()),
|
||||
|
||||
topicEvaluator: kpiUserEvaluation.topicEvaluator,
|
||||
developEvaluator: kpiUserEvaluation.developEvaluator,
|
||||
timeEvaluator: kpiUserEvaluation.timeEvaluator,
|
||||
reasonEvaluator: kpiUserEvaluation.reasonEvaluator,
|
||||
isReasonCommander: kpiUserEvaluation.isReasonCommander,
|
||||
reasonCommander: kpiUserEvaluation.reasonCommander,
|
||||
isReasonCommanderHigh: kpiUserEvaluation.isReasonCommanderHigh,
|
||||
reasonCommanderHigh: kpiUserEvaluation.reasonCommanderHigh,
|
||||
openDate:
|
||||
kpiUserEvaluation.openDate == null
|
||||
? null
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate(kpiUserEvaluation.openDate)),
|
||||
};
|
||||
}
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -167,5 +240,3 @@ export class ReportController extends Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,70 @@ export class KpiUserEvaluation extends EntityBase {
|
|||
})
|
||||
posExecutiveName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "สังกัด",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
org: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำนำหน้าผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
prefixEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
firstNameEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "สกุลผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
lastNameEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่งผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
positionEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเภทตำแหน่งผู้ประเมิน",
|
||||
length: 100,
|
||||
default: null,
|
||||
})
|
||||
posTypeNameEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับตำแหน่งผู้ประเมิน",
|
||||
length: 100,
|
||||
default: null,
|
||||
})
|
||||
posLevelNameEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "สังกัดผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
orgEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
|
|
@ -281,6 +345,14 @@ export class KpiUserEvaluation extends EntityBase {
|
|||
})
|
||||
isOpen: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วันที่การรับทราบผลการประเมิน",
|
||||
default: null,
|
||||
})
|
||||
openDate: Date | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
|
|
|
|||
14
src/migration/1719559101541-add_table_add_date.ts
Normal file
14
src/migration/1719559101541-add_table_add_date.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableAddDate1719559101541 implements MigrationInterface {
|
||||
name = 'AddTableAddDate1719559101541'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`openDate\` datetime NULL COMMENT 'วันที่การรับทราบผลการประเมิน'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`openDate\``);
|
||||
}
|
||||
|
||||
}
|
||||
28
src/migration/1719561526299-add_table_add_root.ts
Normal file
28
src/migration/1719561526299-add_table_add_root.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableAddRoot1719561526299 implements MigrationInterface {
|
||||
name = 'AddTableAddRoot1719561526299'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`org\` varchar(255) NULL COMMENT 'สังกัด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`prefixEvaluator\` varchar(255) NULL COMMENT 'คำนำหน้าผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`firstNameEvaluator\` varchar(255) NULL COMMENT 'ชื่อผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`lastNameEvaluator\` varchar(255) NULL COMMENT 'สกุลผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`positionEvaluator\` varchar(255) NULL COMMENT 'ตำแหน่งผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`posTypeNameEvaluator\` varchar(100) NULL COMMENT 'ประเภทตำแหน่งผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`posLevelNameEvaluator\` varchar(100) NULL COMMENT 'ระดับตำแหน่งผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`orgEvaluator\` varchar(255) NULL COMMENT 'สังกัดผู้ประเมิน'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`orgEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`posLevelNameEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`posTypeNameEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`positionEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`lastNameEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`firstNameEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`prefixEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`org\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue