Job insert ข้อมูลราชการ&ลูกจ้าง #1406
This commit is contained in:
parent
52fca7813c
commit
b5e534413a
3 changed files with 48 additions and 4 deletions
|
|
@ -81,6 +81,8 @@ async function main() {
|
||||||
await profileSalaryController.cronjobTenureExecutivePositionOfficer();
|
await profileSalaryController.cronjobTenureExecutivePositionOfficer();
|
||||||
await profileSalaryController.cronjobTenurePositionEmployee();
|
await profileSalaryController.cronjobTenurePositionEmployee();
|
||||||
await profileSalaryController.cronjobTenureLevelEmployee();
|
await profileSalaryController.cronjobTenureLevelEmployee();
|
||||||
|
await profileSalaryController.Registry();
|
||||||
|
await profileSalaryController.RegistryEmployee();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error executing function from controller:", error);
|
console.error("Error executing function from controller:", error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,8 +326,7 @@ export class ProfileInsigniaController extends Controller {
|
||||||
child4: x.orgChild4,
|
child4: x.orgChild4,
|
||||||
age: age,
|
age: age,
|
||||||
amount: x.amount,
|
amount: x.amount,
|
||||||
remark: x.remark,
|
remark: x.remark
|
||||||
commandCode: x.commandCode
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return new HttpSuccess(mapData);
|
return new HttpSuccess(mapData);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,10 @@ import { OrgRoot } from "../entities/OrgRoot";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { Position } from "../entities/Position";
|
import { Position } from "../entities/Position";
|
||||||
import Extension from "../interfaces/extension";
|
import Extension from "../interfaces/extension";
|
||||||
|
import { viewRegistryOfficer } from "../entities/view/viewRegistryOfficer";
|
||||||
|
import { viewRegistryEmployee } from "../entities/view/viewRegistryEmployee";
|
||||||
|
import { Registry } from "../entities/Registry";
|
||||||
|
import { RegistryEmployee } from "../entities/RegistryEmployee";
|
||||||
@Route("api/v1/org/profile/salary")
|
@Route("api/v1/org/profile/salary")
|
||||||
@Tags("ProfileSalary")
|
@Tags("ProfileSalary")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -51,6 +54,8 @@ export class ProfileSalaryController extends Controller {
|
||||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||||
private positionRepo = AppDataSource.getRepository(Position);
|
private positionRepo = AppDataSource.getRepository(Position);
|
||||||
|
private registryRepo = AppDataSource.getRepository(Registry);
|
||||||
|
private registryEmployeeRepo = AppDataSource.getRepository(RegistryEmployee);
|
||||||
|
|
||||||
@Get("TenurePositionOfficer")
|
@Get("TenurePositionOfficer")
|
||||||
public async cronjobTenurePositionOfficer() {
|
public async cronjobTenurePositionOfficer() {
|
||||||
|
|
@ -332,6 +337,44 @@ export class ProfileSalaryController extends Controller {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get("Registry")
|
||||||
|
public async Registry() {
|
||||||
|
await this.registryRepo.clear();
|
||||||
|
const profile = await this.profileRepo.find();
|
||||||
|
for await (const x of profile) {
|
||||||
|
const _regis = await AppDataSource.getRepository(viewRegistryOfficer)
|
||||||
|
.createQueryBuilder("registryOfficer")
|
||||||
|
.where("registryOfficer.profileId IN (:id)", { id: x.id })
|
||||||
|
.getMany();
|
||||||
|
|
||||||
|
const mapData = _regis.map(x => ({
|
||||||
|
...x,
|
||||||
|
Educations: x.Educations ? JSON.stringify(x.Educations) : "",
|
||||||
|
}));
|
||||||
|
await this.registryRepo.save(mapData);
|
||||||
|
}
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get("RegistryEmployee")
|
||||||
|
public async RegistryEmployee() {
|
||||||
|
await this.registryEmployeeRepo.clear();
|
||||||
|
const profileEmp = await this.profileEmployeeRepo.find();
|
||||||
|
for await (const x of profileEmp) {
|
||||||
|
const _regisEmp = await AppDataSource.getRepository(viewRegistryEmployee)
|
||||||
|
.createQueryBuilder("registryEmployee")
|
||||||
|
.where("registryEmployee.profileEmployeeId IN (:id)", { id: x.id })
|
||||||
|
.getMany();
|
||||||
|
|
||||||
|
const mapData = _regisEmp.map(x => ({
|
||||||
|
...x,
|
||||||
|
Educations: x.Educations ? JSON.stringify(x.Educations) : "",
|
||||||
|
}));
|
||||||
|
await this.registryEmployeeRepo.save(mapData);
|
||||||
|
}
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@Get("user")
|
@Get("user")
|
||||||
public async getSalaryUser(@Request() request: { user: Record<string, any> }) {
|
public async getSalaryUser(@Request() request: { user: Record<string, any> }) {
|
||||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue