update
This commit is contained in:
parent
a6f1c3fea5
commit
c5235e960d
2 changed files with 64 additions and 27 deletions
|
|
@ -903,7 +903,17 @@ export class KeycloakController extends Controller {
|
|||
});
|
||||
|
||||
for await (const _item of profiles) {
|
||||
const result = await changeUserPassword(_item.keycloak, "P@ssw0rd");
|
||||
let password = _item.citizenId;
|
||||
if (_item.birthDate != null) {
|
||||
const gregorianYear = _item.birthDate.getFullYear() + 543;
|
||||
|
||||
const formattedDate =
|
||||
_item.birthDate.toISOString().slice(8, 10) +
|
||||
_item.birthDate.toISOString().slice(5, 7) +
|
||||
gregorianYear;
|
||||
password = formattedDate;
|
||||
}
|
||||
const result = await changeUserPassword(_item.keycloak, password);
|
||||
if (!result) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Body, Controller, Get, Path, Post, Put, Request, Route, Security, Tags, } from "tsoa";
|
||||
import { Body, Controller, Get, Path, Post, Put, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
|
|
@ -658,7 +658,7 @@ export class WorkflowController extends Controller {
|
|||
receiverUserIds: [
|
||||
{
|
||||
receiverUserId: body.profileId,
|
||||
notiLink: `${process.env.VITE_URL_SSO}/${assign.path}/${state.workflow.refId}`,
|
||||
notiLink: `${process.env.VITE_URL_MGT}/${assign.path}/${state.workflow.refId}`,
|
||||
},
|
||||
],
|
||||
payload: "", //แนบไฟล์
|
||||
|
|
@ -802,6 +802,18 @@ export class WorkflowController extends Controller {
|
|||
pageSize: number;
|
||||
},
|
||||
) {
|
||||
let userId = "";
|
||||
if (xxx) {
|
||||
} else {
|
||||
const posMasterUser = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||
current_holder: { keycloak: request.user.sub },
|
||||
},
|
||||
relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"],
|
||||
});
|
||||
}
|
||||
|
||||
const posMasterUser = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||
|
|
@ -825,6 +837,19 @@ export class WorkflowController extends Controller {
|
|||
};
|
||||
|
||||
if (type.trim().toUpperCase() == "OPERATE") {
|
||||
condition = {
|
||||
isDirector: true,
|
||||
orgRootId: posMasterUser.orgRootId,
|
||||
orgRevisionId: posMasterUser.orgRevisionId,
|
||||
// orgChild1Id: IsNull(),
|
||||
// orgChild2Id: IsNull(),
|
||||
// orgChild3Id: IsNull(),
|
||||
// orgChild4Id: IsNull(),
|
||||
};
|
||||
condition.orgChild1Id = IsNull();
|
||||
condition.orgChild2Id = IsNull();
|
||||
condition.orgChild3Id = IsNull();
|
||||
condition.orgChild4Id = IsNull();
|
||||
} else {
|
||||
if (
|
||||
(posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&
|
||||
|
|
@ -1144,46 +1169,48 @@ export class WorkflowController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API เช็ค สกจ
|
||||
*
|
||||
* @summary เช็ค สกจ
|
||||
*
|
||||
*/
|
||||
@Post("find/director")
|
||||
async getProfileDirectorByProfileId(@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
refId: string[];
|
||||
},) {
|
||||
async getProfileDirectorByProfileId(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
refId: string[];
|
||||
},
|
||||
) {
|
||||
const _posMaster = await this.posMasterRepo.find({
|
||||
where: {
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
current_holderId: In(body.refId),
|
||||
},
|
||||
select:["orgRootId","orgChild1Id","orgChild2Id","orgChild3Id","orgChild4Id"]
|
||||
select: ["orgRootId", "orgChild1Id", "orgChild2Id", "orgChild3Id", "orgChild4Id"],
|
||||
});
|
||||
const _data:any = _posMaster.map((x) => ({
|
||||
orgRootId: x.orgRootId,
|
||||
orgChild1Id: x.orgChild1Id,
|
||||
orgChild2Id: x.orgChild2Id,
|
||||
orgChild3Id: x.orgChild3Id,
|
||||
orgChild4Id: x.orgChild4Id,
|
||||
isDirector: true,
|
||||
current_holder: Not(IsNull()),
|
||||
}));
|
||||
const _data: any = _posMaster.map((x) => ({
|
||||
orgRootId: x.orgRootId,
|
||||
orgChild1Id: x.orgChild1Id,
|
||||
orgChild2Id: x.orgChild2Id,
|
||||
orgChild3Id: x.orgChild3Id,
|
||||
orgChild4Id: x.orgChild4Id,
|
||||
isDirector: true,
|
||||
current_holder: Not(IsNull()),
|
||||
}));
|
||||
const posMaster = await this.posMasterRepo.find({
|
||||
where: _data,
|
||||
relations:["current_holder"]
|
||||
relations: ["current_holder"],
|
||||
});
|
||||
|
||||
|
||||
const data = posMaster.map((x) => ({
|
||||
id: x.current_holder.id,
|
||||
citizenId: x.current_holder.citizenId,
|
||||
prefix: x.current_holder.prefix,
|
||||
firstName: x.current_holder.firstName,
|
||||
lastName: x.current_holder.lastName,
|
||||
}));
|
||||
id: x.current_holder.id,
|
||||
citizenId: x.current_holder.citizenId,
|
||||
prefix: x.current_holder.prefix,
|
||||
firstName: x.current_holder.firstName,
|
||||
lastName: x.current_holder.lastName,
|
||||
}));
|
||||
return new HttpSuccess(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue