Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SalidasAutomaticas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Billy Larru
SalidasAutomaticas
Commits
2c7ca7d5
Commit
2c7ca7d5
authored
Jun 27, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok - agregando cambios
parent
1e776281
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
64 deletions
+23
-64
SalidasDAO.java
src/salidasautomaticas/dao/SalidasDAO.java
+0
-1
Main.java
src/salidasautomaticas/main/Main.java
+3
-2
SalidasMysqlDAO.java
src/salidasautomaticas/mysqldao/SalidasMysqlDAO.java
+13
-37
ActualizarSalidaTask.java
src/salidasautomaticas/schedule/ActualizarSalidaTask.java
+0
-7
ProgramarSalidasTask.java
src/salidasautomaticas/schedule/ProgramarSalidasTask.java
+7
-6
SalidasServices.java
src/salidasautomaticas/services/SalidasServices.java
+0
-11
No files found.
src/salidasautomaticas/dao/SalidasDAO.java
View file @
2c7ca7d5
...
...
@@ -17,5 +17,4 @@ public interface SalidasDAO {
public
JSONArray
obtenerHorariosSalida
()
throws
Exception
;
public
JSONArray
obtenerAsistencias
(
String
horaProgramada
)
throws
Exception
;
public
JSONObject
actualizarSalida
(
String
horaSalida
)
throws
Exception
;
public
JSONObject
asignarHorarioSalida
()
throws
Exception
;
}
src/salidasautomaticas/main/Main.java
View file @
2c7ca7d5
...
...
@@ -16,10 +16,11 @@ public class Main {
private
static
final
Logger
log
=
LogManager
.
getLogger
(
Main
.
class
);
public
static
void
main
(
String
[]
args
){
setLogLevel
(
Level
.
TRACE
);
setLogLevel
(
Level
.
TRACE
);
//DESARROLLO
// setLogLevel(Level.INFO);//PRODUCCION
log
.
info
(
"Inicializando programa [Salidas Automaticas]..."
);
Date
horaInicio
=
Metodos
.
getHoraEjecucion
(
"1
2:0
0"
);
Date
horaInicio
=
Metodos
.
getHoraEjecucion
(
"1
1:3
0"
);
int
periodo
=
86400000
;
//El codigo se ejecutará cada 24h, 86400000 representa 24h en milisegundos
TimerTask
task
=
new
ProgramarSalidasTask
();
...
...
src/salidasautomaticas/mysqldao/SalidasMysqlDAO.java
View file @
2c7ca7d5
...
...
@@ -40,15 +40,16 @@ public class SalidasMysqlDAO implements SalidasDAO {
+
"FROM"
+
" asistencia a "
+
"INNER JOIN personal p ON a.codper = p.codper "
+
"INNER JOIN salidas_update su ON p.codcargo = su.codcargo "
//
+ "INNER JOIN salidas_update su ON p.codcargo = su.codcargo "
+
"WHERE "
+
"estado in (1, 2, 5) "
//Que sean asistencias 1=Asistio, 2=No marco y 5=Tardanza
+
"AND p.codtipo!=3 "
//Que registren asistencia
+
"AND a.fecha_asis=? "
+
"AND p.retirado = 0 "
+
"AND p.horaing = su.horaLV "
+
"AND p.mining = su.minutoLV "
+
"AND p.horaingsabado = su.sabadoLV "
+
"AND p.miningsabado = su.sabadoS "
//
+ "AND p.horaing = su.horaLV "
//
+ "AND p.mining = su.minutoLV "
//
+ "AND p.horaingsabado = su.sabadoLV "
//
+ "AND p.miningsabado = su.sabadoS "
+
"AND NOT p.codlocal IN ('L035', 'L053', 'L038') "
//Que no sea profesores por horas, pronoe belisario y grupo MH
+
"AND NOT p.pronoe = 1 "
//Que no sea pronoe
+
"AND NOT p.codcargo IN (71, 13, 96, 41) "
//Que no sea policia ni de cafeteria ni vigilante ni interna psicologa
...
...
@@ -62,10 +63,10 @@ public class SalidasMysqlDAO implements SalidasDAO {
query
=
query
.
replaceAll
(
"\\{campo_salida\\}"
,
"tabla.salidaS"
);
}
JSONArray
parametros
=
new
JSONArray
();
parametros
.
put
(
getFechaHoy
());
JSONArray
parametros
Query
=
new
JSONArray
();
parametros
Query
.
put
(
getFechaHoy
());
jsonArray
=
EstandarDAO
.
getInstance
().
consultar
(
cn
,
query
,
parametros
);
jsonArray
=
EstandarDAO
.
getInstance
().
consultar
(
cn
,
query
,
parametros
Query
);
return
jsonArray
;
}
...
...
@@ -131,6 +132,7 @@ public class SalidasMysqlDAO implements SalidasDAO {
+
"AND NOT ( (WEEKDAY(asistencia.fecha_asis) + 1)=6 and personal.codcargo in ({cod_cargo_primaria}) ) "
//Que no sean de primaria los sabados
+
"AND asistencia.estado in (1, 2, 5) "
//Que sean asistio, tardanza y no marco
// + "AND personal.tmp_id not in (99998, 9998, 99999, 9888) "//Que esten en planilla
+
"AND personal.codtipo!=3 "
//Que si registren asistencia
+
"AND personal.retirado=0) as tabla "
+
"where tabla.salida!=''"
;
...
...
@@ -247,32 +249,5 @@ public class SalidasMysqlDAO implements SalidasDAO {
return
aleatorio
;
}
@Override
public
JSONObject
asignarHorarioSalida
()
throws
Exception
{
Connection
cn
=
MysqlDAOFactory
.
obtenerConexion
(
"nuevo"
);
String
query
=
"update personal p, "
+
" ("
+
" SELECT p.codper, su.salidaLV, su.salidaS FROM personal p INNER JOIN salidas_update su ON p.codcargo=su.codcargo "
+
" WHERE retirado=0 AND p.horaing=su.horaLV and p.mining=su.minutoLV "
+
" and p.horaingsabado=su.sabadoLV AND p.miningsabado=su.sabadoS and NOT p.codlocal in('L035','L053','L038') "
+
" AND NOT pronoe=1 "
+
" AND not p.codcargo in (71, 13, 96, 41) "
//Que no sea policia, cafeteria, vigilante ni interna psicologa
// + " AND p.tmp_id not in (99998, 9998, 99999, 9888) "//Que esten en planilla
+
" AND p.codtipo!=3 "
//Que si registren asistencia
+
" and horaing < 19 and (nullif(p.salidaLV,'') is null and nullif(p.salidaS, '') is null) "
+
" ) as tbl "
+
"SET p.salidaLV=tbl.salidaLV, "
+
" p.salidaS=tbl.salidaS "
+
"where tbl.codper=p.codper"
;
JSONObject
resultado
=
EstandarDAO
.
getInstance
().
ejecutar
(
cn
,
query
);
return
resultado
;
}
public
static
void
main
(
String
[]
args
)
{
}
}
}
\ No newline at end of file
src/salidasautomaticas/schedule/ActualizarSalidaTask.java
View file @
2c7ca7d5
...
...
@@ -36,13 +36,6 @@ public class ActualizarSalidaTask extends TimerTask {
services
.
actualizarSalidas
(
horaSalida
);
log
.
info
(
"Se generaron salidas"
);
JSONObject
objSalidaAsignada
=
services
.
asignarHorarioSalida
();
if
(
objSalidaAsignada
.
getInt
(
"msg"
)
>
0
)
{
log
.
info
(
"Se asignaron horarios de salida correctamente, filas afectadas="
+
objSalidaAsignada
.
getInt
(
"msg"
));
}
else
{
log
.
info
(
"No hubo horarios de salida que asignar"
);
}
log
.
trace
(
"Matando timer"
);
timer
.
cancel
();
...
...
src/salidasautomaticas/schedule/ProgramarSalidasTask.java
View file @
2c7ca7d5
...
...
@@ -22,25 +22,26 @@ import salidasautomaticas.util.Metodos;
* @author sistem19user
*/
public
class
ProgramarSalidasTask
extends
TimerTask
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
ProgramarSalidasTask
.
class
);
private
static
SalidasServices
service
=
new
SalidasServices
();
@Override
public
void
run
()
{
try
{
// JSONArray listaHorarios = service.obtenerHorariosSalida();
JSONArray
listaHorarios
=
new
JSONArray
();
String
[]
arraySalidas
=
{
"1
5:26
"
,
"14:46"
,
"14:50"
,
"17:00"
,
"17:30"
,
"18:00"
};
String
[]
arraySalidas
=
{
"1
6:13
"
,
"14:46"
,
"14:50"
,
"17:00"
,
"17:30"
,
"18:00"
};
for
(
String
salida
:
arraySalidas
)
{
listaHorarios
.
put
(
new
JSONObject
().
put
(
"salida"
,
salida
));
}
Timer
timer
;
TimerTask
task
;
log
.
info
(
"horario leido= "
+
listaHorarios
);
for
(
Iterator
it
=
listaHorarios
.
iterator
();
it
.
hasNext
();)
{
log
.
info
(
"horario leido= "
+
listaHorarios
);
for
(
Iterator
it
=
listaHorarios
.
iterator
();
it
.
hasNext
();)
{
JSONObject
obj
=
(
JSONObject
)
it
.
next
();
String
horaSalida
=
obj
.
getString
(
"salida"
);
...
...
src/salidasautomaticas/services/SalidasServices.java
View file @
2c7ca7d5
...
...
@@ -38,15 +38,4 @@ public class SalidasServices {
}
return
valor
;
}
public
JSONObject
asignarHorarioSalida
(){
JSONObject
valor
=
new
JSONObject
();
try
{
valor
=
salidadao
.
asignarHorarioSalida
();
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
}
return
valor
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment