report 10
This commit is contained in:
parent
437632f39c
commit
a53cf4212f
2 changed files with 30 additions and 32 deletions
|
|
@ -19,7 +19,7 @@ import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { Command } from "../entities/Command";
|
import { Command } from "../entities/Command";
|
||||||
import { Brackets, LessThan, MoreThan, Double, In, Not ,Between } from "typeorm";
|
import { Brackets, LessThan, MoreThan, Double, In, Not, Between } from "typeorm";
|
||||||
import { CommandType } from "../entities/CommandType";
|
import { CommandType } from "../entities/CommandType";
|
||||||
import { CommandSend } from "../entities/CommandSend";
|
import { CommandSend } from "../entities/CommandSend";
|
||||||
import { Profile, CreateProfileAllFields } from "../entities/Profile";
|
import { Profile, CreateProfileAllFields } from "../entities/Profile";
|
||||||
|
|
@ -1013,11 +1013,10 @@ export class CommandController extends Controller {
|
||||||
if (command.commandExcecuteDate == null)
|
if (command.commandExcecuteDate == null)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล");
|
||||||
|
|
||||||
let profiles = command && command.commandRecives.length > 0
|
let profiles =
|
||||||
? command.commandRecives
|
command && command.commandRecives.length > 0
|
||||||
.filter((x) => x.profileId != null)
|
? command.commandRecives.filter((x) => x.profileId != null).map((x) => x.profileId)
|
||||||
.map((x) => x.profileId)
|
: [];
|
||||||
: [];
|
|
||||||
|
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, "/placement/noti/profiles", {
|
.PostData(request, "/placement/noti/profiles", {
|
||||||
|
|
@ -1073,12 +1072,12 @@ export class CommandController extends Controller {
|
||||||
|
|
||||||
const command = await this.commandRepository.find({
|
const command = await this.commandRepository.find({
|
||||||
relations: ["commandType", "commandRecives"],
|
relations: ["commandType", "commandRecives"],
|
||||||
where:{
|
where: {
|
||||||
commandExcecuteDate: Between(today, tomorrow),
|
commandExcecuteDate: Between(today, tomorrow),
|
||||||
status: "WAITING"
|
status: "WAITING",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
client_id: "gettoken",
|
client_id: "gettoken",
|
||||||
client_secret: process.env.AUTH_ACCOUNT_SECRET,
|
client_secret: process.env.AUTH_ACCOUNT_SECRET,
|
||||||
|
|
@ -1100,27 +1099,27 @@ export class CommandController extends Controller {
|
||||||
]);
|
]);
|
||||||
if (_data == null) {
|
if (_data == null) {
|
||||||
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
||||||
}
|
}
|
||||||
|
|
||||||
command.forEach(async (x) => {
|
command.forEach(async (x) => {
|
||||||
const path = this.commandTypePath(x.commandType.code);
|
const path = this.commandTypePath(x.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
const msg = {
|
const msg = {
|
||||||
data: {
|
data: {
|
||||||
id: x.id,
|
id: x.id,
|
||||||
status: "REPORTED",
|
status: "REPORTED",
|
||||||
lastUpdateUserId: "system",
|
lastUpdateUserId: "system",
|
||||||
lastUpdateFullName: "system",
|
lastUpdateFullName: "system",
|
||||||
// lastUpdateUserId: _data.user.sub,
|
// lastUpdateUserId: _data.user.sub,
|
||||||
// lastUpdateFullName: _data.user.name,
|
// lastUpdateFullName: _data.user.name,
|
||||||
lastUpdatedAt: new Date(),
|
lastUpdatedAt: new Date(),
|
||||||
},
|
},
|
||||||
user: _data.user,
|
user: _data.user,
|
||||||
token: _data.access_token,
|
token: _data.access_token,
|
||||||
};
|
};
|
||||||
sendToQueue(msg);
|
sendToQueue(msg);
|
||||||
})
|
});
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2782,7 +2781,7 @@ export class CommandController extends Controller {
|
||||||
case "C-PM-09":
|
case "C-PM-09":
|
||||||
return "/retirement/other/out/report";
|
return "/retirement/other/out/report";
|
||||||
case "C-PM-10":
|
case "C-PM-10":
|
||||||
return "/xxxxxx";
|
return "/probation/report/command10/officer/report";
|
||||||
case "C-PM-11":
|
case "C-PM-11":
|
||||||
return "/probation/report/command11/officer/report";
|
return "/probation/report/command11/officer/report";
|
||||||
case "C-PM-12":
|
case "C-PM-12":
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Body, Controller, Get, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
import { Body, Controller, Get, Post, Request, Route, Security, Tags } from "tsoa";
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
|
|
@ -14,7 +14,6 @@ import { StateUserComment } from "../entities/StateUserComment";
|
||||||
import { MetaWorkflow } from "../entities/MetaWorkflow";
|
import { MetaWorkflow } from "../entities/MetaWorkflow";
|
||||||
import { MetaState } from "../entities/MetaState";
|
import { MetaState } from "../entities/MetaState";
|
||||||
import { MetaStateOperator } from "../entities/MetaStateOperator";
|
import { MetaStateOperator } from "../entities/MetaStateOperator";
|
||||||
import { PosMasterAssign } from "../entities/PosMasterAssign";
|
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
import { IsNull, Not } from "typeorm";
|
import { IsNull, Not } from "typeorm";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue