update current
This commit is contained in:
parent
b0f5ff78d8
commit
8b7de2a0ba
6 changed files with 86 additions and 54 deletions
|
|
@ -3120,7 +3120,10 @@ export class CommandController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
|
||||
const positionOld = await this.positionRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -3148,6 +3151,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = item.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.conditionReason = _null;
|
||||
posMaster.isCondition = false;
|
||||
if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld);
|
||||
|
|
@ -3304,7 +3308,10 @@ export class CommandController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
// if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
|
|
@ -3333,6 +3340,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = item.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.next_holderId = null;
|
||||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
|
|
@ -3561,6 +3569,7 @@ export class CommandController extends Controller {
|
|||
await this.positionRepository.save(clearPosition);
|
||||
}
|
||||
posMaster.current_holderId = profile.id;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.conditionReason = _null;
|
||||
posMaster.isCondition = false;
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
|
|
@ -5987,7 +5996,10 @@ export class CommandController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
|
||||
const positionOld = await this.positionRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -6015,6 +6027,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = profile.id;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.conditionReason = _null;
|
||||
posMaster.isCondition = false;
|
||||
if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld);
|
||||
|
|
@ -6364,7 +6377,10 @@ export class CommandController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
// if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
|
|
@ -6393,6 +6409,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
posMaster.current_holderId = profile.id;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.next_holderId = null;
|
||||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
|
|
|
|||
|
|
@ -372,18 +372,22 @@ export class EmployeePositionController extends Controller {
|
|||
// });
|
||||
// }
|
||||
findData = await this.employeePosDictRepository
|
||||
.createQueryBuilder("posDict")
|
||||
.leftJoinAndSelect("posDict.posType", "posType")
|
||||
.leftJoinAndSelect("posDict.posLevel", "posLevel")
|
||||
.where( keyword
|
||||
? "CONCAT(posType.posTypeShortName, ' ', posLevel.posLevelName) LIKE :keyword":"1=1", {keyword: `%${keyword}%`})
|
||||
.orderBy("posDict.posDictName", "ASC")
|
||||
.addOrderBy("posDict.createdAt", "DESC")
|
||||
.addOrderBy("posType.posTypeRank", "ASC")
|
||||
.addOrderBy("posType.createdAt", "DESC")
|
||||
.addOrderBy("posLevel.posLevelName", "ASC")
|
||||
.addOrderBy("posLevel.createdAt", "DESC")
|
||||
.getMany();
|
||||
.createQueryBuilder("posDict")
|
||||
.leftJoinAndSelect("posDict.posType", "posType")
|
||||
.leftJoinAndSelect("posDict.posLevel", "posLevel")
|
||||
.where(
|
||||
keyword
|
||||
? "CONCAT(posType.posTypeShortName, ' ', posLevel.posLevelName) LIKE :keyword"
|
||||
: "1=1",
|
||||
{ keyword: `%${keyword}%` },
|
||||
)
|
||||
.orderBy("posDict.posDictName", "ASC")
|
||||
.addOrderBy("posDict.createdAt", "DESC")
|
||||
.addOrderBy("posType.posTypeRank", "ASC")
|
||||
.addOrderBy("posType.createdAt", "DESC")
|
||||
.addOrderBy("posLevel.posLevelName", "ASC")
|
||||
.addOrderBy("posLevel.createdAt", "DESC")
|
||||
.getMany();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -2258,6 +2262,7 @@ export class EmployeePositionController extends Controller {
|
|||
|
||||
dataMaster.isSit = requestBody.isSit;
|
||||
dataMaster.current_holderId = requestBody.profileId;
|
||||
dataMaster.lastUpdatedAt = new Date();
|
||||
// dataMaster.next_holderId = requestBody.profileId;
|
||||
await this.employeePosMasterRepository.save(dataMaster);
|
||||
|
||||
|
|
@ -2394,7 +2399,10 @@ export class EmployeePositionController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
// if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
|
|
@ -2429,6 +2437,7 @@ export class EmployeePositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
||||
posMaster.current_holderId = body.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
// posMaster.next_holderId = body.profileId;
|
||||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
|
|
|
|||
|
|
@ -2001,6 +2001,7 @@ export class EmployeeTempPositionController extends Controller {
|
|||
|
||||
dataMaster.isSit = requestBody.isSit;
|
||||
dataMaster.current_holderId = requestBody.profileId;
|
||||
dataMaster.lastUpdatedAt = new Date();
|
||||
// dataMaster.next_holderId = requestBody.profileId;
|
||||
await this.employeeTempPosMasterRepository.save(dataMaster);
|
||||
|
||||
|
|
@ -2137,7 +2138,10 @@ export class EmployeeTempPositionController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
// if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
|
|
@ -2172,6 +2176,7 @@ export class EmployeeTempPositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
||||
posMaster.current_holderId = body.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
// posMaster.next_holderId = body.profileId;
|
||||
if (posMasterOld != null) await this.employeeTempPosMasterRepository.save(posMasterOld);
|
||||
await this.employeeTempPosMasterRepository.save(posMaster);
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ export class OrgRootController extends Controller {
|
|||
const before = structuredClone(orgRoot);
|
||||
orgRoot.lastUpdateUserId = request.user.sub;
|
||||
orgRoot.lastUpdateFullName = request.user.name;
|
||||
orgRoot.lastUpdatedAt = new Date();
|
||||
// orgRoot.lastUpdatedAt = new Date();
|
||||
this.orgRootRepository.merge(orgRoot, {
|
||||
...requestBody,
|
||||
DEPARTMENT_CODE: requestBody.DEPARTMENT_CODE != null ? requestBody.DEPARTMENT_CODE : _null,
|
||||
|
|
|
|||
|
|
@ -1431,13 +1431,7 @@ export class PositionController extends Controller {
|
|||
@Get("position/{id}")
|
||||
async detailPosition(@Path() id: string) {
|
||||
const posMaster = await this.posMasterRepository.findOne({
|
||||
relations: [
|
||||
"orgRoot",
|
||||
"orgChild1",
|
||||
"orgChild2",
|
||||
"orgChild3",
|
||||
"orgChild4",
|
||||
],
|
||||
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||
where: { id },
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -1474,7 +1468,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
shortName = posMaster.orgRoot.orgRootShortName;
|
||||
orgId = posMaster.orgRootId;
|
||||
orgId = posMaster.orgRootId;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
|
|
@ -1482,7 +1476,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
shortName = posMaster.orgChild1.orgChild1ShortName;
|
||||
orgId = posMaster.orgChild1Id;
|
||||
orgId = posMaster.orgChild1Id;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
|
|
@ -1490,7 +1484,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id == null
|
||||
) {
|
||||
shortName = posMaster.orgChild2.orgChild2ShortName;
|
||||
orgId = posMaster.orgChild2Id;
|
||||
orgId = posMaster.orgChild2Id;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
|
|
@ -1498,7 +1492,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
shortName = posMaster.orgChild3.orgChild3ShortName;
|
||||
orgId = posMaster.orgChild3Id;
|
||||
orgId = posMaster.orgChild3Id;
|
||||
} else if (
|
||||
posMaster.orgRootId !== null &&
|
||||
posMaster.orgChild1Id !== null &&
|
||||
|
|
@ -1506,7 +1500,7 @@ export class PositionController extends Controller {
|
|||
posMaster.orgChild3Id !== null
|
||||
) {
|
||||
shortName = posMaster.orgChild4.orgChild4ShortName;
|
||||
orgId = posMaster.orgChild4Id;
|
||||
orgId = posMaster.orgChild4Id;
|
||||
}
|
||||
const positions = await this.positionRepository.find({
|
||||
where: { posMasterId: posMaster.id },
|
||||
|
|
@ -3596,6 +3590,7 @@ export class PositionController extends Controller {
|
|||
const before = null;
|
||||
dataMaster.isSit = requestBody.isSit;
|
||||
dataMaster.next_holderId = requestBody.profileId;
|
||||
dataMaster.lastUpdatedAt = new Date();
|
||||
//add on
|
||||
dataMaster.conditionReason = _null;
|
||||
dataMaster.isCondition = false;
|
||||
|
|
@ -4736,7 +4731,10 @@ export class PositionController extends Controller {
|
|||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) {
|
||||
posMasterOld.current_holderId = null;
|
||||
posMasterOld.lastUpdatedAt = new Date();
|
||||
}
|
||||
|
||||
const positionOld = await this.positionRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -4770,6 +4768,7 @@ export class PositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
||||
posMaster.current_holderId = body.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
const _null: any = null;
|
||||
posMaster.conditionReason = _null;
|
||||
posMaster.isCondition = false;
|
||||
|
|
@ -5323,6 +5322,7 @@ export class PositionController extends Controller {
|
|||
if (!profile) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
||||
|
||||
posMaster.next_holderId = requestBody.profileId;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
posMaster.lastUpdateUserId = request.user.sub;
|
||||
posMaster.lastUpdateFullName = request.user.name;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
|
|
|
|||
|
|
@ -1321,7 +1321,7 @@ export class ProfileController extends Controller {
|
|||
"profileLeave.dateLeaveEnd AS dateLeaveEnd",
|
||||
"profileLeave.leaveDays AS leaveDays",
|
||||
"profileLeave.reason AS reason",
|
||||
"leaveType.name as name"
|
||||
"leaveType.name as name",
|
||||
])
|
||||
.where("profileLeave.profileId = :profileId", { profileId: id })
|
||||
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
|
||||
|
|
@ -1331,10 +1331,12 @@ export class ProfileController extends Controller {
|
|||
const leaves2 =
|
||||
leave2_raw.length > 0
|
||||
? leave2_raw.map((item) => ({
|
||||
date: item.dateLeaveStart && item.dateLeaveEnd
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) + " - "
|
||||
+ Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd))
|
||||
: "-",
|
||||
date:
|
||||
item.dateLeaveStart && item.dateLeaveEnd
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) +
|
||||
" - " +
|
||||
Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd))
|
||||
: "-",
|
||||
type: item.name || "-",
|
||||
leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "-",
|
||||
reason: item.reason || "-",
|
||||
|
|
@ -1684,24 +1686,22 @@ export class ProfileController extends Controller {
|
|||
)
|
||||
: "";
|
||||
|
||||
let portfolios:any
|
||||
await new CallAPI()
|
||||
.GetData(req, `/development/portfolio/kk1/${profiles?.keycloak}`)
|
||||
.then((x) => {
|
||||
portfolios = x;
|
||||
})
|
||||
.catch(() => {});
|
||||
let portfolios: any;
|
||||
await new CallAPI()
|
||||
.GetData(req, `/development/portfolio/kk1/${profiles?.keycloak}`)
|
||||
.then((x) => {
|
||||
portfolios = x;
|
||||
})
|
||||
.catch(() => {});
|
||||
if (!portfolios) {
|
||||
portfolios = [{ name: "-", year: "-" }]
|
||||
}
|
||||
else {
|
||||
portfolios = portfolios.map((x:any) => ({
|
||||
portfolios = [{ name: "-", year: "-" }];
|
||||
} else {
|
||||
portfolios = portfolios.map((x: any) => ({
|
||||
name: x.name ? Extension.ToThaiNumber(x.name) : "-",
|
||||
year: x.year ? Extension.ToThaiNumber(x.year.toString()) : "-"
|
||||
}))
|
||||
year: x.year ? Extension.ToThaiNumber(x.year.toString()) : "-",
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const data = {
|
||||
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||
prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||
|
|
@ -1855,7 +1855,7 @@ export class ProfileController extends Controller {
|
|||
assessments,
|
||||
profileAbility,
|
||||
otherIncome,
|
||||
portfolios
|
||||
portfolios,
|
||||
};
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -2855,7 +2855,8 @@ export class ProfileController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||
posMaster.current_holderId = "";
|
||||
posMaster.current_holderId = null;
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
// return new HttpSuccess({ data: [], total: 0 });
|
||||
} else if ((posMaster?.current_holder?.posLevel?.posLevelAuthority ?? null) == "GOVERNOR") {
|
||||
return new HttpSuccess({ data: [], total: 0 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue