Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
formulario-api
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
Denys Tito Urbano
formulario-api
Commits
032f2942
Commit
032f2942
authored
Dec 18, 2023
by
Denys Tito Urbano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIXED] Parametro fecha_hora_registro del endpoint ejecutar
parent
8fe58636
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
49 deletions
+39
-49
ExcelApi.java
src/main/java/pe/so/api/formulario/api/ExcelApi.java
+21
-14
ExcelDAO.java
src/main/java/pe/so/api/formulario/dao/ExcelDAO.java
+1
-1
PostgreSqlExcel.java
...ava/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
+9
-32
ExcelServices.java
...ain/java/pe/so/api/formulario/services/ExcelServices.java
+8
-2
No files found.
src/main/java/pe/so/api/formulario/api/ExcelApi.java
View file @
032f2942
...
...
@@ -74,23 +74,16 @@ public class ExcelApi {
@POST
@Path
(
"/ejecutar"
)
public
Response
ejecutar
(
String
json
)
throws
Exception
{
String
[]
jsonString
=
{
"p_drive_origen"
,
"p_drive_fila"
,
"p_sede"
,
"p_fecha_hora_registro"
,
"p_medio_atencion"
,
"p_contacto_nombres"
,
"p_contacto_apellidos"
,
"p_numero_documento"
,
"p_contacto_correo"
,
"p_contacto_telefono"
,
"p_distrito"
,
"p_grado"
,
"p_colegio_procedencia"
,
"p_medio_difusion_nombre"
,
"p_atencion_usuario"
,
"p_atencion_fecha"
,
"p_atencion_estado"
,
"p_atencion_medio_atencion"
,
"p_atencion_hora"
,
"p_atencion_observacion"
};
String
[]
jsonString
=
{
"p_drive_origen"
,
"p_drive_fila"
,
"p_sede"
,
"p_fecha_hora_registro"
,
"p_medio_atencion"
,
"p_contacto_nombres"
,
"p_contacto_apellidos"
,
"p_numero_documento"
,
"p_contacto_correo"
,
"p_contacto_telefono"
,
"p_distrito"
,
"p_grado"
,
"p_colegio_procedencia"
,
"p_medio_difusion_nombre"
,
"p_atencion_usuario"
,
"p_atencion_fecha"
,
"p_atencion_estado"
,
"p_atencion_medio_atencion"
,
"p_atencion_hora"
,
"p_atencion_observacion"
};
JSONObject
entrada
=
new
JSONObject
(
json
);
JSONObject
formato
=
Commons
.
formatoJSON
(
jsonString
);
if
(
Commons
.
validarFormato
(
jsonString
,
json
)){
if
(
Commons
.
validarFormato
(
jsonString
,
json
))
{
ExcelServices
excelServices
=
new
ExcelServices
();
MSJ_RESPUESTA
=
excelServices
.
ejecutar
(
entrada
);
return
Response
.
status
(
200
).
entity
(
MSJ_RESPUESTA
.
toString
()).
build
();
}
else
{
}
else
{
return
Response
.
status
(
500
).
entity
(
MSJ_RESPUESTA
.
put
(
"status"
,
false
)
.
put
(
"mensaje"
,
"Error en el formato de entrada"
)
...
...
@@ -138,15 +131,29 @@ public class ExcelApi {
@POST
@Path
(
"/ejecutar_reporte_sedes"
)
public
Response
ejecutar_reporte_sedes
(
String
json
)
throws
Exception
{
JSONObject
salida
=
new
JSONObject
();
JSONObject
entrada
=
new
JSONObject
(
json
);
ExcelServices
excelServices
=
new
ExcelServices
();
MSJ_RESPUESTA
=
excelServices
.
execute_reporte_sedes
(
entrada
);
try
{
JSONObject
entrada
=
new
JSONObject
(
json
);
return
Response
.
status
(
200
).
entity
(
MSJ_RESPUESTA
.
toString
()).
build
(
);
salida
=
new
ExcelServices
().
execute_reporte_sedes
(
entrada
);
return
Response
.
status
(
200
).
entity
(
salida
.
toString
()).
build
();
}
catch
(
JSONException
ex
)
{
salida
.
put
(
"status"
,
false
);
salida
.
put
(
"message"
,
ex
.
getMessage
());
throw
new
WebApplicationException
(
Response
.
status
(
400
).
entity
(
salida
.
toString
()).
build
());
}
catch
(
BadRequestException
ex
)
{
salida
=
new
JSONObject
(
ex
.
getMessage
());
throw
new
WebApplicationException
(
Response
.
status
(
500
).
entity
(
salida
.
toString
()).
build
());
}
catch
(
Exception
ex
)
{
salida
.
put
(
"status"
,
false
);
salida
.
put
(
"message"
,
ex
.
getMessage
());
throw
new
WebApplicationException
(
Response
.
status
(
500
).
entity
(
salida
.
toString
()).
build
());
}
}
@POST
@Path
(
"/ejecutar_reporte_correos"
)
public
Response
ejecutar_reporte_correos
(
String
json
)
throws
Exception
{
...
...
src/main/java/pe/so/api/formulario/dao/ExcelDAO.java
View file @
032f2942
...
...
@@ -16,7 +16,7 @@ public interface ExcelDAO{
JSONObject
execute_VU
(
JSONObject
json
)
throws
Exception
;
JSONObject
execute_reporte_sedes
(
JSONObject
json
)
throws
Exception
;
JSONObject
execute_reporte_sedes
(
JSONObject
entrada
)
throws
Exception
;
JSONObject
execute_reporte_correos
(
JSONObject
json
)
throws
Exception
;
...
...
src/main/java/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
View file @
032f2942
...
...
@@ -111,12 +111,9 @@ public class PostgreSqlExcel implements ExcelDAO {
Connection
conexion
=
null
;
try
{
Date
date
=
new
Date
();
java
.
sql
.
Timestamp
sqlTime
=
new
java
.
sql
.
Timestamp
(
date
.
getTime
());
String
p_drive_origen
=
json
.
getString
(
"p_drive_origen"
);
int
p_drive_fila
=
json
.
getInt
(
"p_drive_fila"
);
String
p_fecha_hora_registro
=
json
.
getString
(
"p_fecha_hora_registro"
);
String
p_sede
=
json
.
getString
(
"p_sede"
);
String
p_medio_atencion
=
json
.
getString
(
"p_medio_atencion"
);
String
p_contacto_nombres
=
json
.
getString
(
"p_contacto_nombres"
);
...
...
@@ -134,14 +131,15 @@ public class PostgreSqlExcel implements ExcelDAO {
String
p_atencion_hora
=
json
.
getString
(
"p_atencion_hora"
);
String
p_atencion_observacion
=
json
.
getString
(
"p_atencion_observacion"
);
String
p_medio_difusion_nombre
=
json
.
getString
(
"p_medio_difusion_nombre"
);
String
p_elija_fecha
=
json
.
getString
(
"p_elija_fecha"
);
conexion
=
PostgreSqlFactoryDAO
.
obtenerConexion
(
"siiaa"
);
String
sql
=
"select matricula.func_informe_registrar(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
;
String
sql
=
"select matricula.func_informe_registrar(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?
)"
;
PreparedStatement
ps
=
conexion
.
prepareStatement
(
sql
);
ps
.
setString
(
1
,
p_drive_origen
);
ps
.
setInt
(
2
,
p_drive_fila
);
ps
.
setString
(
3
,
sqlTime
.
toString
()
);
ps
.
setString
(
3
,
p_fecha_hora_registro
);
ps
.
setString
(
4
,
p_sede
);
ps
.
setString
(
5
,
p_medio_atencion
);
ps
.
setString
(
6
,
p_contacto_nombres
);
...
...
@@ -159,6 +157,7 @@ public class PostgreSqlExcel implements ExcelDAO {
ps
.
setString
(
18
,
p_atencion_medio_atencion
);
ps
.
setString
(
19
,
p_atencion_hora
);
ps
.
setString
(
20
,
p_atencion_observacion
);
ps
.
setString
(
21
,
p_elija_fecha
);
ResultSet
rs
=
ps
.
executeQuery
();
...
...
@@ -303,32 +302,10 @@ public class PostgreSqlExcel implements ExcelDAO {
}
@Override
public
JSONObject
execute_reporte_sedes
(
JSONObject
json
)
throws
Exception
{
JSONObject
respuesta
=
new
JSONObject
();
Connection
conexion
=
null
;
conexion
=
PostgreSqlFactoryDAO
.
obtenerConexion
(
"siiaa"
);
try
{
String
sql
=
"select * from matricula.func_reporte_general_matricula()"
;
ResultSet
rs
=
conexion
.
prepareStatement
(
sql
).
executeQuery
();
if
(
rs
.
next
())
{
int
columnCount
=
rs
.
getMetaData
().
getColumnCount
();
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
respuesta
.
put
(
rs
.
getMetaData
().
getColumnName
(
i
),
rs
.
getObject
(
i
));
}
}
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"error"
,
e
.
getMessage
());
}
finally
{
if
(
conexion
!=
null
)
{
conexion
.
close
();
}
}
return
respuesta
;
public
JSONObject
execute_reporte_sedes
(
JSONObject
entrada
)
throws
Exception
{
String
sql
=
"SELECT * FROM matricula.func_reporte_general_matricula ( ? );"
;
JSONObject
salida
=
PostgreSqlFactoryDAO
.
queryPSSingle
(
"siiaa"
,
sql
,
entrada
.
getJSONArray
(
"params"
));
return
new
JSONObject
(
salida
.
getString
(
"json"
));
}
@Override
...
...
src/main/java/pe/so/api/formulario/services/ExcelServices.java
View file @
032f2942
...
...
@@ -36,9 +36,15 @@ public class ExcelServices {
public
JSONObject
execute_VU
(
JSONObject
json
)
throws
Exception
{
return
dao
.
execute_VU
(
json
);
}
public
JSONObject
execute_reporte_sedes
(
JSONObject
entrada
)
throws
Exception
{
JSONArray
params
=
new
JSONArray
();
params
.
put
(
0
,
entrada
.
getString
(
"tipo_operacion"
));
entrada
.
put
(
"params"
,
params
);
public
JSONObject
execute_reporte_sedes
(
JSONObject
json
)
throws
Exception
{
return
dao
.
execute_reporte_sedes
(
json
);
return
dao
.
execute_reporte_sedes
(
entrada
);
}
public
JSONObject
execute_reporte_correos
(
JSONObject
json
)
throws
Exception
{
...
...
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