log
This commit is contained in:
parent
ce8bb41bda
commit
0f79425d65
17 changed files with 611 additions and 202 deletions
|
|
@ -31,6 +31,7 @@ import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
|
|||
import { isNullOrUndefined } from "util";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/salary/period")
|
||||
@Tags("Salary")
|
||||
|
|
@ -297,7 +298,7 @@ export class SalaryPeriodController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขอเงินเดือนผู้ใช้งานนี้ในระบบ");
|
||||
}
|
||||
|
||||
await this.salaryProfileRepository.remove(salaryProfile);
|
||||
await this.salaryProfileRepository.remove(salaryProfile, { data: req });
|
||||
|
||||
const _salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
|
|
@ -328,7 +329,7 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrg.quantityUsed = amountFullType;
|
||||
const calRemainQuota = salaryOrg.fifteenPercent - amountFullType;
|
||||
salaryOrg.remainQuota = calRemainQuota;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg,{data:req});
|
||||
}
|
||||
}
|
||||
} else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") {
|
||||
|
|
@ -382,7 +383,7 @@ export class SalaryPeriodController extends Controller {
|
|||
? 0
|
||||
: sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg,{data:req});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -578,8 +579,9 @@ export class SalaryPeriodController extends Controller {
|
|||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
}
|
||||
|
||||
await this.salaryProfileRepository.save(salaryProfile);
|
||||
const before = null;
|
||||
await this.salaryProfileRepository.save(salaryProfile, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryProfile });
|
||||
|
||||
const _salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
|
|
@ -610,7 +612,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrg.quantityUsed = amountFullType;
|
||||
const calRemainQuota = salaryOrg.fifteenPercent - amountFullType;
|
||||
salaryOrg.remainQuota = calRemainQuota;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
} else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") {
|
||||
|
|
@ -664,7 +667,8 @@ export class SalaryPeriodController extends Controller {
|
|||
? 0
|
||||
: sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -701,9 +705,12 @@ export class SalaryPeriodController extends Controller {
|
|||
if (!salaryOrg) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกลุ่มการขอเลื่อนเงินเดือน");
|
||||
}
|
||||
const before = null;
|
||||
|
||||
salaryProfile.salaryOrgId = salaryOrg.id;
|
||||
await this.salaryProfileRepository.save(salaryProfile);
|
||||
await this.salaryProfileRepository.save(salaryProfile, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryProfile });
|
||||
|
||||
const _salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: { id: salaryProfile.id },
|
||||
|
|
@ -733,7 +740,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrg.quantityUsed = amountFullType;
|
||||
const calRemainQuota = salaryOrg.fifteenPercent - amountFullType;
|
||||
salaryOrg.remainQuota = calRemainQuota;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
} else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") {
|
||||
|
|
@ -787,7 +795,8 @@ export class SalaryPeriodController extends Controller {
|
|||
? 0
|
||||
: sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1017,7 +1026,9 @@ export class SalaryPeriodController extends Controller {
|
|||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
}
|
||||
await this.salaryProfileRepository.save(salaryProfile);
|
||||
const before = null;
|
||||
await this.salaryProfileRepository.save(salaryProfile, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryProfile });
|
||||
|
||||
const _salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
|
|
@ -1048,7 +1059,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrg.quantityUsed = amountFullType;
|
||||
const calRemainQuota = salaryOrg.fifteenPercent - amountFullType;
|
||||
salaryOrg.remainQuota = calRemainQuota;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
} else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") {
|
||||
|
|
@ -1102,7 +1114,8 @@ export class SalaryPeriodController extends Controller {
|
|||
? 0
|
||||
: sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: req });
|
||||
setLogDataDiff(req, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1221,6 +1234,7 @@ export class SalaryPeriodController extends Controller {
|
|||
if (!salaryProfile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเพิ่มเงินเดือนของบุคคลนี้");
|
||||
}
|
||||
const before = structuredClone(salaryProfile);
|
||||
salaryProfile.isPunish = body.isPunish;
|
||||
salaryProfile.isSuspension = body.isSuspension;
|
||||
salaryProfile.isAbsent = body.isAbsent;
|
||||
|
|
@ -1228,7 +1242,9 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfile.lastUpdateUserId = request.user.sub;
|
||||
salaryProfile.lastUpdateFullName = request.user.name;
|
||||
salaryProfile.lastUpdatedAt = new Date();
|
||||
await this.salaryProfileRepository.save(salaryProfile);
|
||||
await this.salaryProfileRepository.save(salaryProfile, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryProfile });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -1446,12 +1462,14 @@ export class SalaryPeriodController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
}
|
||||
|
||||
const before = null;
|
||||
salaryProfile.salaryOrgId = salaryOrg.id;
|
||||
salaryProfile.createdUserId = request.user.sub;
|
||||
salaryProfile.createdFullName = request.user.name;
|
||||
salaryProfile.lastUpdateUserId = request.user.sub;
|
||||
salaryProfile.lastUpdateFullName = request.user.name;
|
||||
await this.salaryProfileRepository.save(salaryProfile);
|
||||
await this.salaryProfileRepository.save(salaryProfile, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryProfile });
|
||||
|
||||
const _salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
|
|
@ -1482,7 +1500,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrg.quantityUsed = amountFullType;
|
||||
const calRemainQuota = salaryOrg.fifteenPercent - amountFullType;
|
||||
salaryOrg.remainQuota = calRemainQuota;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
} else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") {
|
||||
|
|
@ -1536,7 +1555,8 @@ export class SalaryPeriodController extends Controller {
|
|||
? 0
|
||||
: sumAmountUse.totalAmount;
|
||||
salaryOrg.remainingAmount = calRemainAmount;
|
||||
await this.salaryOrgRepository.save(salaryOrg);
|
||||
await this.salaryOrgRepository.save(salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrg });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1554,15 +1574,18 @@ export class SalaryPeriodController extends Controller {
|
|||
* @param {string} id Guid, *Id รอบเงินเดือน
|
||||
*/
|
||||
@Get("close/{id}")
|
||||
async closeSalaryPeriod_ById(@Path() id: string) {
|
||||
async closeSalaryPeriod_ById(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
}
|
||||
const before = structuredClone(salaryPeriod);
|
||||
salaryPeriod.isClose = !salaryPeriod.isClose;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryPeriodRepository.save(salaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryPeriod });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -1598,13 +1621,14 @@ export class SalaryPeriodController extends Controller {
|
|||
"ประเภทผังปี " + Extension.ToThaiYear(salaryPeriod.year) + " ซ้ำ",
|
||||
);
|
||||
}
|
||||
|
||||
const before = null;
|
||||
salaryPeriod.period = salaryPeriod.period.toUpperCase();
|
||||
salaryPeriod.createdUserId = request.user.sub;
|
||||
salaryPeriod.createdFullName = request.user.name;
|
||||
salaryPeriod.lastUpdateUserId = request.user.sub;
|
||||
salaryPeriod.lastUpdateFullName = request.user.name;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryPeriodRepository.save(salaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryPeriod });
|
||||
|
||||
if (salaryPeriod.period == "SPECIAL") {
|
||||
const snapshot = "SNAP1";
|
||||
|
|
@ -1614,8 +1638,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrg.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryOrgRepository.remove(salaryOrg);
|
||||
await this.salaryProfileRepository.remove(salaryProfile);
|
||||
await this.salaryOrgRepository.remove(salaryOrg, { data: request });
|
||||
await this.salaryProfileRepository.remove(salaryProfile, { data: request });
|
||||
|
||||
const salaryOrgEmployee = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: salaryPeriod.id, snapshot: snapshot },
|
||||
|
|
@ -1623,14 +1647,15 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfileEmployee = await this.salaryProfileEmployeeRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrgEmployee.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee, { data: request });
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee, { data: request });
|
||||
|
||||
let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
|
||||
let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
|
||||
|
||||
salaryPeriod.revisionId = revisionId;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryPeriodRepository.save(salaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryPeriod });
|
||||
|
||||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
|
|
@ -1646,7 +1671,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
}),
|
||||
);
|
||||
await Promise.all(
|
||||
|
|
@ -1663,7 +1689,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
@ -1709,13 +1736,15 @@ export class SalaryPeriodController extends Controller {
|
|||
"ประเภทผังปี " + (requestBody.effectiveDate.getFullYear() + 543) + " ซ้ำ",
|
||||
);
|
||||
}
|
||||
|
||||
const beforeChk_SalaryPeriod = structuredClone(chk_SalaryPeriod);
|
||||
chk_SalaryPeriod.period = requestBody.period.toUpperCase();
|
||||
chk_SalaryPeriod.lastUpdateUserId = request.user.sub;
|
||||
chk_SalaryPeriod.lastUpdateFullName = request.user.name;
|
||||
chk_SalaryPeriod.lastUpdatedAt = new Date();
|
||||
this.salaryPeriodRepository.merge(chk_SalaryPeriod, requestBody);
|
||||
await this.salaryPeriodRepository.save(chk_SalaryPeriod);
|
||||
await this.salaryPeriodRepository.save(chk_SalaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before: beforeChk_SalaryPeriod, after: chk_SalaryPeriod });
|
||||
|
||||
if (chk_SalaryPeriod.period == "SPECIAL") {
|
||||
const snapshot = "SNAP1";
|
||||
const salaryOrg = await this.salaryOrgRepository.find({
|
||||
|
|
@ -1724,8 +1753,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrg.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryOrgRepository.remove(salaryOrg);
|
||||
await this.salaryProfileRepository.remove(salaryProfile);
|
||||
await this.salaryOrgRepository.remove(salaryOrg, { data: request });
|
||||
await this.salaryProfileRepository.remove(salaryProfile, { data: request });
|
||||
|
||||
const salaryOrgEmployee = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: chk_SalaryPeriod.id, snapshot: snapshot },
|
||||
|
|
@ -1733,18 +1762,21 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfileEmployee = await this.salaryProfileEmployeeRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrgEmployee.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee, { data: request });
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee, { data: request });
|
||||
|
||||
let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
|
||||
let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
|
||||
|
||||
chk_SalaryPeriod.revisionId = revisionId;
|
||||
await this.salaryPeriodRepository.save(chk_SalaryPeriod);
|
||||
await this.salaryPeriodRepository.save(chk_SalaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before: beforeChk_SalaryPeriod, after: chk_SalaryPeriod });
|
||||
|
||||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
let salaryOrgNew = Object.assign(new SalaryOrg());
|
||||
const beforeSalaryOrgNew = structuredClone(salaryOrgNew);
|
||||
|
||||
salaryOrgNew.salaryPeriodId = chk_SalaryPeriod.id;
|
||||
salaryOrgNew.status = "PENDING";
|
||||
salaryOrgNew.rootId = root.rootId;
|
||||
|
|
@ -1756,13 +1788,16 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
}),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
let salaryOrgNew = Object.assign(new SalaryOrgEmployee());
|
||||
const beforeSalaryOrgNew = structuredClone(salaryOrgNew);
|
||||
|
||||
salaryOrgNew.salaryPeriodId = chk_SalaryPeriod.id;
|
||||
salaryOrgNew.status = "PENDING";
|
||||
salaryOrgNew.rootId = root.rootId;
|
||||
|
|
@ -1774,7 +1809,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
@ -1805,8 +1841,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfile = SalaryOrg.find((x) => x.salaryProfiles.length > 0);
|
||||
if (salaryProfile) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้");
|
||||
|
||||
await this.salaryOrgRepository.remove(SalaryOrg);
|
||||
await this.salaryPeriodRepository.remove(SalaryPeriod);
|
||||
await this.salaryOrgRepository.remove(SalaryOrg, { data: request });
|
||||
await this.salaryPeriodRepository.remove(SalaryPeriod, { data: request });
|
||||
return new HttpSuccess();
|
||||
} else {
|
||||
const SalaryOrg = await this.salaryOrgRepository.findOne({
|
||||
|
|
@ -1814,7 +1850,7 @@ export class SalaryPeriodController extends Controller {
|
|||
});
|
||||
if (SalaryOrg) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้");
|
||||
|
||||
await this.salaryPeriodRepository.remove(SalaryPeriod);
|
||||
await this.salaryPeriodRepository.remove(SalaryPeriod, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -1963,7 +1999,7 @@ export class SalaryPeriodController extends Controller {
|
|||
async SnapshotSalary(
|
||||
@Path() snapshot: string,
|
||||
salaryPeriodId: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
snapshot = snapshot.toLocaleUpperCase();
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
|
|
@ -1979,8 +2015,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrg.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryProfileRepository.remove(salaryProfile);
|
||||
await this.salaryOrgRepository.remove(salaryOrg);
|
||||
await this.salaryProfileRepository.remove(salaryProfile, { data: request });
|
||||
await this.salaryOrgRepository.remove(salaryOrg, { data: request });
|
||||
|
||||
const salaryOrgEmployee = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: salaryPeriod.id, snapshot: snapshot },
|
||||
|
|
@ -1988,8 +2024,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfileEmployee = await this.salaryProfileEmployeeRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrgEmployee.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee, { data: request });
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee, { data: request });
|
||||
let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
|
||||
let total = 1000;
|
||||
let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/salary/gen", {
|
||||
|
|
@ -2050,13 +2086,17 @@ export class SalaryPeriodController extends Controller {
|
|||
}
|
||||
let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
|
||||
|
||||
const beforeSalaryPeriod = structuredClone(salaryPeriod);
|
||||
salaryPeriod.revisionId = revisionId;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryPeriodRepository.save(salaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryPeriod, after: salaryPeriod });
|
||||
|
||||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
let salaryOrgNew = Object.assign(new SalaryOrg());
|
||||
delete salaryOrgNew.id;
|
||||
const beforeSalaryOrgNew = structuredClone(salaryOrgNew);
|
||||
|
||||
salaryOrgNew.salaryPeriodId = salaryPeriod.id;
|
||||
salaryOrgNew.status = "PENDING";
|
||||
salaryOrgNew.rootId = root.rootId;
|
||||
|
|
@ -2068,11 +2108,14 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2080,6 +2123,8 @@ export class SalaryPeriodController extends Controller {
|
|||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
let salaryOrgNew = Object.assign(new SalaryOrgEmployee());
|
||||
const beforeSalaryOrgNew = structuredClone(salaryOrgNew);
|
||||
|
||||
salaryOrgNew.salaryPeriodId = salaryPeriod.id;
|
||||
salaryOrgNew.status = "PENDING";
|
||||
salaryOrgNew.rootId = root.rootId;
|
||||
|
|
@ -2091,11 +2136,14 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2125,6 +2173,9 @@ export class SalaryPeriodController extends Controller {
|
|||
if (salaryOrgNew != null) {
|
||||
let salaryProfileNew = Object.assign(new SalaryProfile(), profile);
|
||||
delete salaryProfileNew.id;
|
||||
|
||||
const beforeSalaryProfileNew = structuredClone(salaryProfileNew);
|
||||
|
||||
salaryProfileNew.salaryOrgId = salaryOrgNew.id;
|
||||
salaryProfileNew.revisionId = salaryPeriod.revisionId;
|
||||
salaryProfileNew.createdUserId = request.user.sub;
|
||||
|
|
@ -2153,7 +2204,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfileNew.isReserve = salaryOld == null ? false : salaryOld.isReserve;
|
||||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||
}
|
||||
await this.salaryProfileRepository.save(salaryProfileNew);
|
||||
await this.salaryProfileRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2171,6 +2223,8 @@ export class SalaryPeriodController extends Controller {
|
|||
if (salaryOrgNew != null) {
|
||||
let salaryProfileNew = Object.assign(new SalaryProfileEmployee(), profile);
|
||||
delete salaryProfileNew.id;
|
||||
const beforeSalaryProfileNew = structuredClone(salaryProfileNew);
|
||||
|
||||
salaryProfileNew.salaryOrgId = salaryOrgNew.id;
|
||||
salaryProfileNew.revisionId = salaryPeriod.revisionId;
|
||||
salaryProfileNew.createdUserId = request.user.sub;
|
||||
|
|
@ -2199,7 +2253,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfileNew.isReserve = salaryOld == null ? false : salaryOld.isReserve;
|
||||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||
}
|
||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew);
|
||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2239,6 +2294,7 @@ export class SalaryPeriodController extends Controller {
|
|||
: Extension.sumObjectValues(salaryOrgSnap2Old.salaryProfiles, "amountUse");
|
||||
}
|
||||
|
||||
const before_salaryOrg = structuredClone(_salaryOrg);
|
||||
if (snapshot == "SNAP2") {
|
||||
const salaryOrgSnap1 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -2265,6 +2321,7 @@ export class SalaryPeriodController extends Controller {
|
|||
}
|
||||
} else {
|
||||
const totalProfile = Extension.sumObjectValues(_salaryOrg.salaryProfiles, "amount");
|
||||
|
||||
_salaryOrg.currentAmount = totalProfile;
|
||||
_salaryOrg.total = _salaryOrg.salaryProfiles.length;
|
||||
_salaryOrg.sixPercentAmount = totalProfile * 0.06;
|
||||
|
|
@ -2272,12 +2329,15 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainingAmount = totalProfile * 0.06 - totalAmount;
|
||||
}
|
||||
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
await this.salaryOrgRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before: before_salaryOrg, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
await Promise.all(
|
||||
salaryOrgEmployeeNew.map(async (_salaryOrg: SalaryOrgEmployee) => {
|
||||
let totalAmount = 0;
|
||||
const before_salaryOrg = structuredClone(_salaryOrg);
|
||||
|
||||
if (salaryPeriodAPROld != null) {
|
||||
const salaryOrgSnap2Old: any = await this.salaryOrgEmployeeRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -2327,12 +2387,15 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainingAmount = totalProfile * 0.06 - totalAmount;
|
||||
}
|
||||
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg);
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before: before_salaryOrg, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
} else if (salaryPeriod.period == "APR") {
|
||||
await Promise.all(
|
||||
salaryOrgNew.map(async (_salaryOrg: SalaryOrg) => {
|
||||
const before_salaryOrg = structuredClone(_salaryOrg);
|
||||
|
||||
if (snapshot == "SNAP2") {
|
||||
const salaryOrgSnap1 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -2361,11 +2424,14 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainQuota = Math.floor((_salaryOrg.salaryProfiles.length * 15) / 100);
|
||||
}
|
||||
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
await this.salaryOrgRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before: before_salaryOrg, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
await Promise.all(
|
||||
salaryOrgEmployeeNew.map(async (_salaryOrg: SalaryOrgEmployee) => {
|
||||
const before_salaryOrg = structuredClone(_salaryOrg);
|
||||
|
||||
if (snapshot == "SNAP2") {
|
||||
const salaryOrgSnap1 = await this.salaryOrgEmployeeRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -2394,7 +2460,8 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainQuota = Math.floor((_salaryOrg.salaryProfiles.length * 15) / 100);
|
||||
}
|
||||
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg);
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before: before_salaryOrg, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
@ -2471,8 +2538,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrg.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryOrgRepository.remove(salaryOrg);
|
||||
await this.salaryProfileRepository.remove(salaryProfile);
|
||||
await this.salaryOrgRepository.remove(salaryOrg, { data: request });
|
||||
await this.salaryProfileRepository.remove(salaryProfile, { data: request });
|
||||
|
||||
const salaryOrgEmployee = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: salaryPeriod.id, snapshot: snapshot },
|
||||
|
|
@ -2480,8 +2547,8 @@ export class SalaryPeriodController extends Controller {
|
|||
const salaryProfileEmployee = await this.salaryProfileEmployeeRepository.find({
|
||||
where: { salaryOrgId: In(salaryOrgEmployee.map((x) => x.id)) },
|
||||
});
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee, { data: request });
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee, { data: request });
|
||||
|
||||
let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
|
||||
let total = 1000;
|
||||
|
|
@ -2541,9 +2608,10 @@ export class SalaryPeriodController extends Controller {
|
|||
}
|
||||
}
|
||||
let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
|
||||
|
||||
const before = null;
|
||||
salaryPeriod.revisionId = revisionId;
|
||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||
await this.salaryPeriodRepository.save(salaryPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryPeriod });
|
||||
|
||||
await Promise.all(
|
||||
orgs.map(async (root: any) => {
|
||||
|
|
@ -2559,11 +2627,14 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2582,11 +2653,14 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdateUserId = request.user.sub;
|
||||
salaryOrgNew.lastUpdateFullName = request.user.name;
|
||||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew);
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryOrgNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2645,7 +2719,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfileNew.isReserve = salaryOld == null ? false : salaryOld.isReserve;
|
||||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||
}
|
||||
await this.salaryProfileRepository.save(salaryProfileNew);
|
||||
await this.salaryProfileRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryProfileNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2691,7 +2766,8 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfileNew.isReserve = salaryOld == null ? false : salaryOld.isReserve;
|
||||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||
}
|
||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew);
|
||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaryProfileNew });
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2764,7 +2840,8 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainingAmount = totalProfile * 0.06 - totalAmount;
|
||||
}
|
||||
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
await this.salaryOrgRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
await Promise.all(
|
||||
|
|
@ -2819,7 +2896,8 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainingAmount = totalProfile * 0.06 - totalAmount;
|
||||
}
|
||||
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg);
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
} else if (salaryPeriod.period == "APR") {
|
||||
|
|
@ -2853,7 +2931,8 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainQuota = Math.floor((_salaryOrg.salaryProfiles.length * 15) / 100);
|
||||
}
|
||||
|
||||
await this.salaryOrgRepository.save(_salaryOrg);
|
||||
await this.salaryOrgRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
await Promise.all(
|
||||
|
|
@ -2886,7 +2965,8 @@ export class SalaryPeriodController extends Controller {
|
|||
_salaryOrg.remainQuota = Math.floor((_salaryOrg.salaryProfiles.length * 15) / 100);
|
||||
}
|
||||
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg);
|
||||
await this.salaryOrgEmployeeRepository.save(_salaryOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: _salaryOrg });
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
@ -2900,7 +2980,11 @@ export class SalaryPeriodController extends Controller {
|
|||
* @param {string} rootId Guid, *Id สำนัก
|
||||
*/
|
||||
@Get("officer/approve/{periodId}/{rootId}")
|
||||
async OfficerApprove(@Path() periodId: string, rootId: string) {
|
||||
async OfficerApprove(
|
||||
@Path() periodId: string,
|
||||
rootId: string,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
|
|
@ -2911,8 +2995,10 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
const before = structuredClone(x);
|
||||
x.status = "WAITHEAD1";
|
||||
await this.salaryOrgRepository.save(x);
|
||||
await this.salaryOrgRepository.save(x, { data: request });
|
||||
setLogDataDiff(request, { before, after: x });
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -2926,7 +3012,7 @@ export class SalaryPeriodController extends Controller {
|
|||
* @param {string} rootId Guid, *Id สำนัก
|
||||
*/
|
||||
@Get("head/approve/{periodId}/{rootId}")
|
||||
async HeadApprove(@Path() periodId: string, rootId: string) {
|
||||
async HeadApprove(@Path() periodId: string, rootId: string, @Request() request: RequestWithUser) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
|
|
@ -2938,8 +3024,10 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
const before = structuredClone(x);
|
||||
x.status = "WAITOWNER1";
|
||||
await this.salaryOrgRepository.save(x);
|
||||
await this.salaryOrgRepository.save(x, { data: request });
|
||||
setLogDataDiff(request, { before, after: x });
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -2953,7 +3041,11 @@ export class SalaryPeriodController extends Controller {
|
|||
* @param {string} rootId Guid, *Id สำนัก
|
||||
*/
|
||||
@Get("owner/approve/{periodId}/{rootId}")
|
||||
async OwnerApprove(@Path() periodId: string, rootId: string) {
|
||||
async OwnerApprove(
|
||||
@Path() periodId: string,
|
||||
rootId: string,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
|
|
@ -2965,8 +3057,10 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
const before = structuredClone(x);
|
||||
x.status = "REPORT";
|
||||
await this.salaryOrgRepository.save(x);
|
||||
await this.salaryOrgRepository.save(x, { data: request });
|
||||
setLogDataDiff(request, { before, after: x });
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -3001,9 +3095,12 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
const before = structuredClone(x);
|
||||
x.status = "WAITHEAD2";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryOrgRepository.save(x);
|
||||
await this.salaryOrgRepository.save(x,{data:request});
|
||||
setLogDataDiff(request, { before, after: x });
|
||||
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -3038,9 +3135,12 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryPeriod.salaryOrgs
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x) => {
|
||||
const before = structuredClone(x);
|
||||
x.status = "REPORT";
|
||||
x.ownerRecommend = body.titleRecommend;
|
||||
await this.salaryOrgRepository.save(x);
|
||||
await this.salaryOrgRepository.save(x,{data:request});
|
||||
setLogDataDiff(request, { before, after: x });
|
||||
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue