no message
This commit is contained in:
parent
d21704baaf
commit
e9a6f00431
4 changed files with 230 additions and 386 deletions
|
|
@ -109,188 +109,7 @@ export class DevelopmentController extends Controller {
|
||||||
" มีอยู่ในระบบแล้ว",
|
" มีอยู่ในระบบแล้ว",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let _null: any = null;
|
|
||||||
const development = Object.assign(new Development(), requestBody);
|
const development = Object.assign(new Development(), requestBody);
|
||||||
switch (requestBody.strategyChildPlannedNode) {
|
|
||||||
case 1: {
|
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 1",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 3",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5PlannedId = checkId.id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผน");
|
|
||||||
}
|
|
||||||
switch (requestBody.strategyChildActualNode) {
|
|
||||||
case 1: {
|
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 1",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 3",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 4",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 5",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5ActualId = checkId.id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริง");
|
|
||||||
}
|
|
||||||
development.createdUserId = request.user.sub;
|
development.createdUserId = request.user.sub;
|
||||||
development.createdFullName = request.user.name;
|
development.createdFullName = request.user.name;
|
||||||
development.lastUpdateUserId = request.user.sub;
|
development.lastUpdateUserId = request.user.sub;
|
||||||
|
|
@ -335,187 +154,6 @@ export class DevelopmentController extends Controller {
|
||||||
" มีอยู่ในระบบแล้ว",
|
" มีอยู่ในระบบแล้ว",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let _null: any = null;
|
|
||||||
switch (requestBody.strategyChildPlannedNode) {
|
|
||||||
case 1: {
|
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 1",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 3",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildPlannedId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4PlannedId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5PlannedId = checkId.id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผน");
|
|
||||||
}
|
|
||||||
switch (requestBody.strategyChildActualNode) {
|
|
||||||
case 1: {
|
|
||||||
const checkId = await this.strategyChild1Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 1",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.id;
|
|
||||||
development.strategyChild2ActualId = _null;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
const checkId = await this.strategyChild2Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 2",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.id;
|
|
||||||
development.strategyChild3ActualId = _null;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
const checkId = await this.strategyChild3Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 3",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.id;
|
|
||||||
development.strategyChild4ActualId = _null;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: {
|
|
||||||
const checkId = await this.strategyChild4Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 4",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.id;
|
|
||||||
development.strategyChild5ActualId = _null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5: {
|
|
||||||
const checkId = await this.strategyChild5Repository.findOne({
|
|
||||||
where: { id: requestBody.strategyChildActualId },
|
|
||||||
});
|
|
||||||
if (!checkId) {
|
|
||||||
throw new HttpError(
|
|
||||||
HttpStatusCode.NOT_FOUND,
|
|
||||||
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 5",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
|
||||||
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
|
||||||
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
|
||||||
development.strategyChild4ActualId = checkId.strategyChild4Id;
|
|
||||||
development.strategyChild5ActualId = checkId.id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริง");
|
|
||||||
}
|
|
||||||
Object.assign(development, requestBody);
|
Object.assign(development, requestBody);
|
||||||
development.lastUpdateUserId = request.user.sub;
|
development.lastUpdateUserId = request.user.sub;
|
||||||
development.lastUpdateFullName = request.user.name;
|
development.lastUpdateFullName = request.user.name;
|
||||||
|
|
@ -1000,6 +638,197 @@ export class DevelopmentController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const _null: any = null;
|
||||||
|
if (
|
||||||
|
requestBody.strategyChildPlannedNode != undefined &&
|
||||||
|
requestBody.strategyChildPlannedNode != null
|
||||||
|
) {
|
||||||
|
switch (requestBody.strategyChildPlannedNode) {
|
||||||
|
case 1: {
|
||||||
|
const checkId = await this.strategyChild1Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 1",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.id;
|
||||||
|
development.strategyChild2ActualId = _null;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
const checkId = await this.strategyChild2Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.id;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
const checkId = await this.strategyChild3Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.id;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
const checkId = await this.strategyChild4Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 3",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4PlannedId = checkId.id;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
const checkId = await this.strategyChild5Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildPlannedId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผนระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1PlannedId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2PlannedId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3PlannedId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4PlannedId = checkId.strategyChild4Id;
|
||||||
|
development.strategyChild5PlannedId = checkId.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามแผน");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
requestBody.strategyChildActualNode != undefined &&
|
||||||
|
requestBody.strategyChildActualNode != null
|
||||||
|
) {
|
||||||
|
switch (requestBody.strategyChildActualNode) {
|
||||||
|
case 1: {
|
||||||
|
const checkId = await this.strategyChild1Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildActualId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 1",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.id;
|
||||||
|
development.strategyChild2ActualId = _null;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
const checkId = await this.strategyChild2Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildActualId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 2",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.id;
|
||||||
|
development.strategyChild3ActualId = _null;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
const checkId = await this.strategyChild3Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildActualId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 3",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.id;
|
||||||
|
development.strategyChild4ActualId = _null;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
const checkId = await this.strategyChild4Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildActualId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 4",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4ActualId = checkId.id;
|
||||||
|
development.strategyChild5ActualId = _null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
const checkId = await this.strategyChild5Repository.findOne({
|
||||||
|
where: { id: requestBody.strategyChildActualId },
|
||||||
|
});
|
||||||
|
if (!checkId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริงระดับ 5",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
development.strategyChild1ActualId = checkId.strategyChild1Id;
|
||||||
|
development.strategyChild2ActualId = checkId.strategyChild2Id;
|
||||||
|
development.strategyChild3ActualId = checkId.strategyChild3Id;
|
||||||
|
development.strategyChild4ActualId = checkId.strategyChild4Id;
|
||||||
|
development.strategyChild5ActualId = checkId.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลยุทธศาสตร์เป้าหมายตามจริง");
|
||||||
|
}
|
||||||
|
}
|
||||||
return new HttpSuccess(development.id);
|
return new HttpSuccess(development.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1361,16 +1190,6 @@ export class DevelopmentController extends Controller {
|
||||||
"rootId",
|
"rootId",
|
||||||
"orgRootShortName",
|
"orgRootShortName",
|
||||||
"orgRevisionId",
|
"orgRevisionId",
|
||||||
"strategyChild1Planned",
|
|
||||||
"strategyChild2Planned",
|
|
||||||
"strategyChild3Planned",
|
|
||||||
"strategyChild4Planned",
|
|
||||||
"strategyChild5Planned",
|
|
||||||
"strategyChild1Actual",
|
|
||||||
"strategyChild2Actual",
|
|
||||||
"strategyChild3Actual",
|
|
||||||
"strategyChild4Actual",
|
|
||||||
"strategyChild5Actual",
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!getDevelopment) {
|
if (!getDevelopment) {
|
||||||
|
|
@ -1456,6 +1275,7 @@ export class DevelopmentController extends Controller {
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
groupTarget: x.groupTarget,
|
groupTarget: x.groupTarget,
|
||||||
groupTargetSub: x.groupTargetSub,
|
groupTargetSub: x.groupTargetSub,
|
||||||
|
type: x.type,
|
||||||
position: x.plannedGoalPositions.map((y) => ({
|
position: x.plannedGoalPositions.map((y) => ({
|
||||||
position: y.position,
|
position: y.position,
|
||||||
posTypeId: y.posTypePlannedId,
|
posTypeId: y.posTypePlannedId,
|
||||||
|
|
@ -1509,6 +1329,16 @@ export class DevelopmentController extends Controller {
|
||||||
developmentProjectTechniqueActuals: getDevelopment.developmentProjectTechniqueActuals
|
developmentProjectTechniqueActuals: getDevelopment.developmentProjectTechniqueActuals
|
||||||
.map((x) => x.name)
|
.map((x) => x.name)
|
||||||
.sort(),
|
.sort(),
|
||||||
|
strategyChild1Planned: getDevelopment.strategyChild1Planned,
|
||||||
|
strategyChild2Planned: getDevelopment.strategyChild2Planned,
|
||||||
|
strategyChild3Planned: getDevelopment.strategyChild3Planned,
|
||||||
|
strategyChild4Planned: getDevelopment.strategyChild4Planned,
|
||||||
|
strategyChild5Planned: getDevelopment.strategyChild5Planned,
|
||||||
|
strategyChild1Actual: getDevelopment.strategyChild1Actual,
|
||||||
|
strategyChild2Actual: getDevelopment.strategyChild2Actual,
|
||||||
|
strategyChild3Actual: getDevelopment.strategyChild3Actual,
|
||||||
|
strategyChild4Actual: getDevelopment.strategyChild4Actual,
|
||||||
|
strategyChild5Actual: getDevelopment.strategyChild5Actual,
|
||||||
};
|
};
|
||||||
return new HttpSuccess(_getDevelopment);
|
return new HttpSuccess(_getDevelopment);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -538,14 +538,6 @@ export class CreateDevelopment {
|
||||||
orgRootShortName: string;
|
orgRootShortName: string;
|
||||||
@Column()
|
@Column()
|
||||||
orgRevisionId: string;
|
orgRevisionId: string;
|
||||||
@Column()
|
|
||||||
strategyChildPlannedId: string;
|
|
||||||
@Column()
|
|
||||||
strategyChildPlannedNode: number;
|
|
||||||
@Column()
|
|
||||||
strategyChildActualId: string;
|
|
||||||
@Column()
|
|
||||||
strategyChildActualNode: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateDevelopment1 {
|
export class UpdateDevelopment1 {
|
||||||
|
|
@ -617,6 +609,14 @@ export class UpdateDevelopment3 {
|
||||||
projectNigthHoldActual?: number | null;
|
projectNigthHoldActual?: number | null;
|
||||||
@Column()
|
@Column()
|
||||||
developmentProjectTechniqueActuals?: string[];
|
developmentProjectTechniqueActuals?: string[];
|
||||||
|
@Column()
|
||||||
|
strategyChildPlannedId?: string;
|
||||||
|
@Column()
|
||||||
|
strategyChildPlannedNode?: number;
|
||||||
|
@Column()
|
||||||
|
strategyChildActualId?: string;
|
||||||
|
@Column()
|
||||||
|
strategyChildActualNode?: number;
|
||||||
}
|
}
|
||||||
export class UpdateDevelopment4 {
|
export class UpdateDevelopment4 {
|
||||||
// @Column()
|
// @Column()
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ export class PlannedGoal extends EntityBase {
|
||||||
// @JoinColumn({ name: "posLevelPlannedId" })
|
// @JoinColumn({ name: "posLevelPlannedId" })
|
||||||
// posLevelPlanned: PosLevel;
|
// posLevelPlanned: PosLevel;
|
||||||
|
|
||||||
// @Column({
|
@Column({
|
||||||
// nullable: true,
|
nullable: true,
|
||||||
// comment: "ประเภท(กลุ่มอาชีพ คุณสมบัติ)",
|
comment: "ประเภท(กลุ่มอาชีพ คุณสมบัติ)",
|
||||||
// default: null,
|
default: null,
|
||||||
// })
|
})
|
||||||
// type: string;
|
type: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
||||||
14
src/migration/1713341677475-update_table_devhis_add_type.ts
Normal file
14
src/migration/1713341677475-update_table_devhis_add_type.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableDevhisAddType1713341677475 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableDevhisAddType1713341677475'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`plannedGoal\` ADD \`type\` varchar(255) NULL COMMENT 'ประเภท(กลุ่มอาชีพ คุณสมบัติ)'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`plannedGoal\` DROP COLUMN \`type\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue