fix delete file and report
This commit is contained in:
parent
35b06d8c67
commit
3ce799f9be
3 changed files with 95 additions and 80 deletions
|
|
@ -22,7 +22,7 @@ import {
|
|||
listFile,
|
||||
updateFile,
|
||||
} from "../services/edm";
|
||||
import { s3DownloadFile, s3ListFile, s3UploadFile } from "../services/minio";
|
||||
import { s3DeleteFile, s3DownloadFile, s3ListFile, s3UploadFile } from "../services/minio";
|
||||
|
||||
@Route("api/v1/salary/file/{name}/{group}")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -337,6 +337,20 @@ export class FileController extends Controller {
|
|||
@Path() id: string,
|
||||
@Path() file: string,
|
||||
) {
|
||||
if (name !== "ระบบประเมิน"){
|
||||
const rawPath = [
|
||||
name,
|
||||
group,
|
||||
id,
|
||||
file
|
||||
];
|
||||
const fullPath = rawPath
|
||||
.filter((path) => path !== undefined && path !== null)
|
||||
.join("/");
|
||||
|
||||
const path = fullPath;
|
||||
return await s3DeleteFile(path);
|
||||
}
|
||||
const result = await deleteFile([name, group, id], file);
|
||||
|
||||
if (!result) {
|
||||
|
|
|
|||
|
|
@ -2009,13 +2009,13 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullname: profile.prefix + profile.firstName + " " + profile.lastName,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
affiliation: affiliation,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
posNumber: profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()) : "-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
reason: null, //เหตุผล
|
||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-", //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
remark: profile.remark, //หมายเหตุ
|
||||
|
|
@ -2074,6 +2074,7 @@ export class ReportController extends Controller {
|
|||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
type: Not(In(["NONE","PENDING"])),
|
||||
isReserve : Not(true),
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
|
|
@ -2103,7 +2104,7 @@ export class ReportController extends Controller {
|
|||
const formattedData = salaryProfile.map((item, index) => ({
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
fullname: item.prefix + item.firstName + " " + item.lastName,
|
||||
position: item.position,
|
||||
position: item.position??"-",
|
||||
affiliation:
|
||||
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
|
||||
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
|
||||
|
|
@ -2130,11 +2131,12 @@ export class ReportController extends Controller {
|
|||
(item.amountSpecial > 0
|
||||
? `(${Extension.ToThaiNumber(String(item.positionSalaryAmount))})`
|
||||
: ""),
|
||||
remark:
|
||||
`${item.type === "FULL" ? "หนึ่งขั้น" : ""}\n` +
|
||||
`${item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` +
|
||||
`${item.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` +
|
||||
`${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`,
|
||||
remark: [
|
||||
item.type === "FULL" ? "หนึ่งขั้น" : "",
|
||||
item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "",
|
||||
item.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ" : "",
|
||||
item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""
|
||||
].filter(Boolean).join("\n")
|
||||
}));
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -2648,11 +2650,11 @@ export class ReportController extends Controller {
|
|||
position: profile.position,
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: null,
|
||||
posNumber:
|
||||
: "-",
|
||||
posNumber: profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()) : "-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-",
|
||||
reason: profile.remark,
|
||||
};
|
||||
|
|
@ -2778,6 +2780,7 @@ export class ReportController extends Controller {
|
|||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: In(["HAFT", "FULL", "FULLHAFT"]),
|
||||
amountSpecial: MoreThan(0),
|
||||
isNext: true,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
|
|
@ -2814,13 +2817,13 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
posNumber:
|
||||
posNumber: profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()) : "-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
|
|
@ -2828,11 +2831,11 @@ export class ReportController extends Controller {
|
|||
amountSpecialFormated:
|
||||
profile.amountSpecial > 0
|
||||
? "(" + Extension.ToThaiNumber(profile.amountSpecial.toString()) + ")"
|
||||
: "",
|
||||
: "-",
|
||||
amountSpecial:
|
||||
profile.amountSpecial > 0
|
||||
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
|
||||
: "",
|
||||
: "-",
|
||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-", //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
reason: profile.remark,
|
||||
};
|
||||
|
|
@ -2902,18 +2905,18 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
posNumber:
|
||||
posNumber:profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()): "-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: "-",
|
||||
reasonSign: "-",
|
||||
reasonSign: "",
|
||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-", //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
reason: profile.remark, //เหตุผลที่ไม่สมควรหรือไม่อาจเลื่อนขั้นค่าจ้าง
|
||||
};
|
||||
|
|
@ -2984,7 +2987,7 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
|
|
@ -2997,7 +3000,7 @@ export class ReportController extends Controller {
|
|||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: "-",
|
||||
reasonSign: "-",
|
||||
reasonSign: "",
|
||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-", //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
reason: profile.remark, //เหตุผลที่ไม่สมควรหรือไม่อาจเลื่อนขั้นค่าจ้าง
|
||||
};
|
||||
|
|
@ -3125,7 +3128,7 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
posNumber:
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
|
|
@ -4398,12 +4401,12 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
posLevel: Extension.ToThaiNumber(profile.posLevel.toLocaleString()),
|
||||
posNumber:
|
||||
position: profile.position??"-",
|
||||
posLevel: profile.posLevel?Extension.ToThaiNumber(profile.posLevel.toLocaleString()):"-",
|
||||
posNumber: profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()) : "-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
//เมษา ปีก่อนหน้า
|
||||
typeOld2:
|
||||
aprPreviousYear2 && aprPreviousYearProfile2.length > 0
|
||||
|
|
@ -4422,7 +4425,7 @@ export class ReportController extends Controller {
|
|||
}
|
||||
return null;
|
||||
})()
|
||||
: null,
|
||||
: "-",
|
||||
yearOld:
|
||||
octPreviousYear == null ? null : Extension.ToThaiNumber(octPreviousYear.year.toString()),
|
||||
//ตุลา ปีก่อนหน้า
|
||||
|
|
@ -4443,7 +4446,7 @@ export class ReportController extends Controller {
|
|||
}
|
||||
return null;
|
||||
})()
|
||||
: null,
|
||||
: "-",
|
||||
typeOld:
|
||||
aprPreviousYearProfileCurrent.length > 0
|
||||
? (() => {
|
||||
|
|
@ -4460,7 +4463,7 @@ export class ReportController extends Controller {
|
|||
? "๑.๕ ขั้น"
|
||||
: "ไม่ได้เลื่อนขั้นฯ";
|
||||
})()
|
||||
: null, //เมษา
|
||||
: "-", //เมษา
|
||||
type:
|
||||
profile.type === "HAFT"
|
||||
? "๐.๕ ขั้น"
|
||||
|
|
@ -4469,8 +4472,8 @@ export class ReportController extends Controller {
|
|||
: profile.type === "FULLHAFT"
|
||||
? "๑.๕ ขั้น"
|
||||
: "ไม่ได้เลื่อนขั้นฯ",
|
||||
score1: profile.result,
|
||||
score2: null,
|
||||
score1: profile.result?? "-",
|
||||
score2: "-",
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -4564,8 +4567,8 @@ export class ReportController extends Controller {
|
|||
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
|
||||
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
|
||||
(profile.root == undefined && profile.root == null ? "" : profile.root),
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
posNumber:
|
||||
profile.orgShortName || profile.posMasterNo
|
||||
|
|
@ -5301,8 +5304,8 @@ export class ReportController extends Controller {
|
|||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
: null,
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -5695,17 +5698,17 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: profile.position,
|
||||
position: profile.position??"-",
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
: null,
|
||||
posNumber:
|
||||
: "-",
|
||||
posNumber: profile.orgShortName || profile.posMasterNo ?
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()):"-",
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
||||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: null,
|
||||
: "-",
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
|
@ -5776,25 +5779,13 @@ export class ReportController extends Controller {
|
|||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
const positionParts = [
|
||||
profile.position,
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
];
|
||||
|
||||
const position = positionParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`;
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position: position,
|
||||
position: profile.position?profile.position:"-",
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
: "-",
|
||||
|
|
@ -5841,6 +5832,8 @@ export class ReportController extends Controller {
|
|||
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: Not(In(["NONE","PENDING"])),
|
||||
amountSpecial: MoreThan(0),
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
|
|
@ -5848,6 +5841,7 @@ export class ReportController extends Controller {
|
|||
},
|
||||
},
|
||||
order: {
|
||||
type: "DESC",
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
|
|
@ -5871,41 +5865,48 @@ export class ReportController extends Controller {
|
|||
const affiliation = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
const positionParts = [
|
||||
profile.position,
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
];
|
||||
|
||||
const position = positionParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`;
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
affiliation: affiliation,
|
||||
position:
|
||||
profile.position +
|
||||
"/" +
|
||||
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
|
||||
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
|
||||
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
|
||||
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
|
||||
(profile.root == undefined && profile.root == null ? "" : profile.root),
|
||||
position: position,
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
: null,
|
||||
: "-",
|
||||
posNumber:
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: null,
|
||||
: "-",
|
||||
precentTwo:
|
||||
profile.positionSalaryAmount == 0.02
|
||||
profile.positionSalaryAmountPer == 0.02
|
||||
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
|
||||
: null, //ร้อยละ 2
|
||||
: "-", //ร้อยละ 2
|
||||
precentFour:
|
||||
profile.positionSalaryAmount == 0.04
|
||||
profile.positionSalaryAmountPer == 0.04
|
||||
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
|
||||
: null, //ร้อยละ 4
|
||||
: "-", //ร้อยละ 4
|
||||
precentSix:
|
||||
profile.positionSalaryAmount == 0.06
|
||||
profile.positionSalaryAmountPer == 0.06
|
||||
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
|
||||
: null, //ร้อยละ 6
|
||||
: "-", //ร้อยละ 6
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
|
@ -5981,8 +5982,8 @@ export class ReportController extends Controller {
|
|||
affiliation: affiliation,
|
||||
position: profile.position ?? "-",
|
||||
posLevel: profile.posLevel
|
||||
? Extension.ToThaiNumber(profile.posLevel.toLocaleString())
|
||||
: "-",
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: "-",
|
||||
posNumber:
|
||||
profile.orgShortName || profile.posMasterNo
|
||||
? Extension.ToThaiNumber(profile.orgShortName) +
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ export async function setFile(path: string, exp = 6 * 60 * 60) {
|
|||
return await minio.presignedPutObject(MINIO_BUCKET, path, exp);
|
||||
}
|
||||
|
||||
export async function deleteFile(path: string) {
|
||||
export async function s3DeleteFile(path: string) {
|
||||
await minio.removeObject(MINIO_BUCKET, path, { forceDelete: true });
|
||||
}
|
||||
|
||||
export async function deleteFolder(path: string) {
|
||||
export async function s3DeleteFolder(path: string) {
|
||||
new Promise<string[]>((resolve, reject) => {
|
||||
const item: string[] = [];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue