เพิ่มแนบไฟล์คำสั่งในรายการแจ้งเตือน #1784
This commit is contained in:
parent
ef7a8bc0e8
commit
35eec3a5f5
2 changed files with 25 additions and 2 deletions
|
|
@ -561,6 +561,27 @@ export function chunkArray(array: any, size: number) {
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function PayloadSendNoti(commandId: string) {
|
||||
if (!commandId)
|
||||
return "";
|
||||
const commandRepository = AppDataSource.getRepository(Command);
|
||||
const _command = await commandRepository.findOne({
|
||||
where: {
|
||||
id: commandId,
|
||||
},
|
||||
relations: ["commandType"],
|
||||
});
|
||||
const _payload = {
|
||||
name: _command && _command.commandType
|
||||
? `คำสั่ง${_command.commandType.name}`
|
||||
: "",
|
||||
url: `${process.env.API_URL}/salary/file/ระบบออกคำสั่ง/คำสั่ง/${commandId}/คำสั่ง`,
|
||||
isReport: true,
|
||||
isTemplate: false,
|
||||
}
|
||||
return JSON.stringify(_payload);
|
||||
}
|
||||
|
||||
export function commandTypePath(commandCode: string): string | null {
|
||||
switch (commandCode) {
|
||||
case "C-PM-01":
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { PosMasterAct } from "../entities/PosMasterAct";
|
|||
import { PermissionOrg } from "../entities/PermissionOrg";
|
||||
import { sendWebSocket } from "./webSocket";
|
||||
import { CreatePosMasterHistoryOfficer } from "./PositionService";
|
||||
import { PayloadSendNoti } from "../interfaces/utils";
|
||||
|
||||
export let sendToQueue: (payload: any) => void;
|
||||
export let sendToQueueOrg: (payload: any) => void;
|
||||
|
|
@ -83,7 +84,7 @@ export async function init() {
|
|||
|
||||
console.log("[AMQ] Listening for message...");
|
||||
createConsumer(queue, channel, handler), //----> (3) Process Consumer
|
||||
createConsumer(queue_org, channel, handler_org);
|
||||
createConsumer(queue_org, channel, handler_org);
|
||||
createConsumer(queue_org_draft, channel, handler_org_draft);
|
||||
createConsumer(queue_command_noti, channel, handler_command_noti);
|
||||
// createConsumer(queue2, channel, handler2);
|
||||
|
|
@ -445,6 +446,7 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
|||
}))
|
||||
: [];
|
||||
|
||||
const payloadStr = await PayloadSendNoti(command.id);
|
||||
const profilesSendRequest = new CallAPI()
|
||||
.PostData(
|
||||
{ headers: { authorization: token } },
|
||||
|
|
@ -453,7 +455,7 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
|||
subject: `${command.issue}`,
|
||||
body: `${command.issue}`,
|
||||
receiverUserIds: profilesSend,
|
||||
payload: "", // แนบไฟล์ (ถ้าจำเป็น)
|
||||
payload: payloadStr, // แนบไฟล์ (ถ้าจำเป็น)
|
||||
},
|
||||
false,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue