Update attendances module
Add services files directory configuration to application.properties
This commit is contained in:
@@ -10,10 +10,12 @@ import org.quartz.JobExecutionException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
import com.axelor.app.AppSettings;
|
||||||
|
|
||||||
public class FetchAttendanceJob implements Job {
|
public class FetchAttendanceJob implements Job {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(FetchCheckInOutJob.class);
|
private final Logger log = LoggerFactory.getLogger(FetchCheckInOutJob.class);
|
||||||
|
private final String pythonScriptDir = AppSettings.get().get("services.dir");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException{
|
public void execute(JobExecutionContext context) throws JobExecutionException{
|
||||||
@@ -22,9 +24,14 @@ public class FetchAttendanceJob implements Job {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pythonScriptDir == null || pythonScriptDir.isEmpty()) {
|
||||||
|
log.error("Python script path is not configured in AppSettings.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Define the command to run the Python script with the correct path (V3)
|
// Define the command to run the Python script with the correct path (V3)
|
||||||
String[] args = {"python", "C:\\Users\\administrator\\Desktop\\Scrape\\main.py"};
|
String[] args = {"python", pythonScriptDir + "\\Scrape\\main.py"};
|
||||||
|
|
||||||
// Execute the command
|
// Execute the command
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ import org.slf4j.LoggerFactory;
|
|||||||
import com.axelor.inject.Beans;
|
import com.axelor.inject.Beans;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
import com.axelor.app.AppSettings;
|
||||||
|
|
||||||
public class FetchCheckInOutJob implements Job {
|
public class FetchCheckInOutJob implements Job {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(FetchCheckInOutJob.class);
|
private final Logger log = LoggerFactory.getLogger(FetchCheckInOutJob.class);
|
||||||
|
private final String pythonScriptDir = AppSettings.get().get("services.dir");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
@@ -26,6 +28,11 @@ public class FetchCheckInOutJob implements Job {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pythonScriptDir == null || pythonScriptDir.isEmpty()) {
|
||||||
|
log.error("Python script path is not configured in AppSettings.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
@@ -35,11 +42,10 @@ public class FetchCheckInOutJob implements Job {
|
|||||||
.all()
|
.all()
|
||||||
.filter("self.date_attendance = :today")
|
.filter("self.date_attendance = :today")
|
||||||
.bind("today", today)
|
.bind("today", today)
|
||||||
.fetch()
|
.fetch().size();
|
||||||
.size();
|
|
||||||
|
|
||||||
// Define the command to run the Python script with the correct path (V3)
|
// Define the command to run the Python script with the correct path (V3)
|
||||||
String[] args = {"python", "C:\\Users\\administrator\\Desktop\\Scrape\\main2.py", String.valueOf(lenCheckInOutList)};
|
String[] args = {"python", pythonScriptDir + "\\Scrape\\main2.py", String.valueOf(lenCheckInOutList)};
|
||||||
|
|
||||||
// Execute the command
|
// Execute the command
|
||||||
Process p = Runtime.getRuntime().exec(args);
|
Process p = Runtime.getRuntime().exec(args);
|
||||||
|
|||||||
@@ -8,16 +8,20 @@
|
|||||||
# ~~~~~
|
# ~~~~~
|
||||||
db.default.driver = org.postgresql.Driver
|
db.default.driver = org.postgresql.Driver
|
||||||
db.default.ddl = update
|
db.default.ddl = update
|
||||||
db.default.url = jdbc:postgresql://localhost:5432/postgres5
|
db.default.url = jdbc:postgresql://localhost:5432/bdd_test2
|
||||||
db.default.user = postgres
|
db.default.user = postgres
|
||||||
db.default.password = Mal@Ben$$23
|
db.default.password = Mal@Ben$$23
|
||||||
|
|
||||||
# API
|
# Api
|
||||||
# ~~~~~
|
# ~~~~~
|
||||||
portail.api.baseurl = http://127.0.0.1:8000/api/
|
portail.api.baseurl = http://127.0.0.1:8000/api/
|
||||||
portail.api.user = admin
|
portail.api.user = admin
|
||||||
portail.api.password = 0000
|
portail.api.password = 0000
|
||||||
|
|
||||||
|
# Services file directory
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
services.dir = {user.home}/axelor/services
|
||||||
|
|
||||||
# Application Information
|
# Application Information
|
||||||
# ~~~~~
|
# ~~~~~
|
||||||
application.name = SOPHAL SPA
|
application.name = SOPHAL SPA
|
||||||
@@ -193,8 +197,8 @@ logging.level.com.axelor = DEBUG
|
|||||||
|
|
||||||
# Quartz scheduler
|
# Quartz scheduler
|
||||||
# ~~~~~
|
# ~~~~~
|
||||||
quartz.enable = false
|
quartz.enable = true
|
||||||
# quartz.threadCount = 5
|
quartz.threadCount = 1
|
||||||
|
|
||||||
# Allows to open maximum 10 Tabs
|
# Allows to open maximum 10 Tabs
|
||||||
view.tabs.max = 10
|
view.tabs.max = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user