fix issue #1572
This commit is contained in:
parent
ce7c03bc77
commit
4ca001e2ff
2 changed files with 35 additions and 16 deletions
|
|
@ -3397,6 +3397,10 @@ export class CommandController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||||
}
|
}
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
const returnWork = await checkReturnCommandType(String(item.commandId));
|
const returnWork = await checkReturnCommandType(String(item.commandId));
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileId: item.profileId },
|
where: { profileId: item.profileId },
|
||||||
|
|
@ -3425,7 +3429,6 @@ export class CommandController extends Controller {
|
||||||
history.profileSalaryId = data.id;
|
history.profileSalaryId = data.id;
|
||||||
await this.salaryHistoryRepo.save(history, { data: req });
|
await this.salaryHistoryRepo.save(history, { data: req });
|
||||||
}
|
}
|
||||||
|
|
||||||
const _null: any = null;
|
const _null: any = null;
|
||||||
profile.isLeave = item.isLeave;
|
profile.isLeave = item.isLeave;
|
||||||
profile.leaveReason = item.leaveReason ?? _null;
|
profile.leaveReason = item.leaveReason ?? _null;
|
||||||
|
|
@ -3447,7 +3450,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
profile.leaveDate = item.commandDateAffect ?? _null;
|
profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
profile.leaveType = clearProfile.LeaveType ?? _null;
|
profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -3683,7 +3686,10 @@ export class CommandController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileEmployeeId: item.profileId },
|
where: { profileEmployeeId: item.profileId },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
|
|
@ -3737,7 +3743,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
profile.leaveDate = item.commandDateAffect ?? _null;
|
profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
profile.leaveType = clearProfile.LeaveType ?? _null;
|
profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -3845,7 +3851,10 @@ export class CommandController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||||
}
|
}
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileId: item.profileId },
|
where: { profileId: item.profileId },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
|
|
@ -3879,7 +3888,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
profile.isLeave = item.isLeave;
|
profile.isLeave = item.isLeave;
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
profile.leaveDate = item.commandDateAffect ?? _null;
|
profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
profile.leaveType = clearProfile.LeaveType ?? _null;
|
profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -4148,6 +4157,10 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
|
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
|
||||||
const profile = await this.profileRepository.findOne({
|
const profile = await this.profileRepository.findOne({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
@ -4314,7 +4327,7 @@ export class CommandController extends Controller {
|
||||||
if (exceptClear.status) {
|
if (exceptClear.status) {
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
_profile.leaveReason = item.leaveReason ?? _null;
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||||
|
|
@ -4333,7 +4346,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -4513,7 +4526,7 @@ export class CommandController extends Controller {
|
||||||
if (exceptClear.status) {
|
if (exceptClear.status) {
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
_profile.leaveReason = item.leaveReason ?? _null;
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||||
|
|
@ -4532,7 +4545,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -4654,6 +4667,10 @@ export class CommandController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||||
}
|
}
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
// const orgRevision = await this.orgRevisionRepo.findOne({
|
// const orgRevision = await this.orgRevisionRepo.findOne({
|
||||||
// where: {
|
// where: {
|
||||||
// orgRevisionIsCurrent: true,
|
// orgRevisionIsCurrent: true,
|
||||||
|
|
@ -4798,7 +4815,7 @@ export class CommandController extends Controller {
|
||||||
if (exceptClear.status) {
|
if (exceptClear.status) {
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
_profile.leaveReason = item.leaveReason ?? _null;
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||||
|
|
@ -4817,7 +4834,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
@ -5132,6 +5149,10 @@ export class CommandController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
}
|
}
|
||||||
|
let _commandYear = item.commandYear;
|
||||||
|
if (item.commandYear) {
|
||||||
|
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear+543
|
||||||
|
}
|
||||||
const _profile = await this.profileRepository.findOne({
|
const _profile = await this.profileRepository.findOne({
|
||||||
where: { id: item.profileId },
|
where: { id: item.profileId },
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
|
|
@ -5247,7 +5268,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${item.commandYear}`;
|
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
||||||
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
_profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||||
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
_profile.leaveType = clearProfile.LeaveType ?? _null;
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise<boolean> {
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
refId: x.refId,
|
refId: x.refId,
|
||||||
commandNo: command.commandNo,
|
commandNo: command.commandNo,
|
||||||
commandYear: command.commandYear > 2500
|
commandYear: command.commandYear,
|
||||||
? command.commandYear
|
|
||||||
: command.commandYear + 543,
|
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
remark: command.positionDetail,
|
remark: command.positionDetail,
|
||||||
amount: x.amount,
|
amount: x.amount,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue