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
c7db95d2
Commit
c7db95d2
authored
Dec 10, 2022
by
Mauro Paolo Josue Zuñiga Mallqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
b8a8936e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
10 deletions
+88
-10
ExcelApi.java
src/main/java/pe/so/api/formulario/api/ExcelApi.java
+12
-0
ExcelDAO.java
src/main/java/pe/so/api/formulario/dao/ExcelDAO.java
+2
-0
PostgreSqlExcel.java
...ava/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
+70
-10
ExcelServices.java
...ain/java/pe/so/api/formulario/services/ExcelServices.java
+4
-0
No files found.
src/main/java/pe/so/api/formulario/api/ExcelApi.java
View file @
c7db95d2
...
...
@@ -94,5 +94,17 @@ public class ExcelApi {
}
}
@POST
@Path
(
"/ejecutar_avance"
)
public
Response
ejecutar_avance
(
String
json
)
throws
Exception
{
JSONObject
entrada
=
new
JSONObject
(
json
);
ExcelServices
excelServices
=
new
ExcelServices
();
MSJ_RESPUESTA
=
excelServices
.
execute_avance
(
entrada
);
return
Response
.
status
(
200
).
entity
(
MSJ_RESPUESTA
.
toString
()).
build
();
}
}
src/main/java/pe/so/api/formulario/dao/ExcelDAO.java
View file @
c7db95d2
...
...
@@ -10,4 +10,6 @@ public interface ExcelDAO{
JSONObject
ejecutar
(
JSONObject
json
)
throws
Exception
;
JSONObject
execute_avance
(
JSONObject
json
)
throws
Exception
;
}
src/main/java/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
View file @
c7db95d2
package
pe
.
so
.
api
.
formulario
.
postgresdao
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
pe.so.api.formulario.dao.ExcelDAO
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Timestamp
;
import
java.util.Date
;
import
java.util.logging.*
;
public
class
PostgreSqlExcel
implements
ExcelDAO
{
import
javax.json.JsonObject
;
public
class
PostgreSqlExcel
implements
ExcelDAO
{
@Override
public
JSONObject
execute_encuesta
(
JSONObject
json
)
throws
Exception
{
public
JSONObject
execute_encuesta
(
JSONObject
json
)
throws
Exception
{
JSONObject
respuesta
=
new
JSONObject
();
Connection
conexion
=
null
;
...
...
@@ -48,7 +53,7 @@ public class PostgreSqlExcel implements ExcelDAO{
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"status"
,
false
);
respuesta
.
put
(
"mensaje"
,
e
.
getMessage
());
}
finally
{
}
finally
{
if
(
conexion
!=
null
)
{
conexion
.
close
();
}
...
...
@@ -57,7 +62,7 @@ public class PostgreSqlExcel implements ExcelDAO{
}
@Override
public
JSONObject
execute_balotario
(
JSONObject
json
)
throws
Exception
{
public
JSONObject
execute_balotario
(
JSONObject
json
)
throws
Exception
{
JSONObject
respuesta
=
new
JSONObject
();
Connection
conexion
=
null
;
...
...
@@ -81,7 +86,7 @@ public class PostgreSqlExcel implements ExcelDAO{
String
sql
=
"select academico.func_balotario_procesar_alumno(?,?,?,?,?,?,?,?)"
;
PreparedStatement
ps
=
conexion
.
prepareStatement
(
sql
);
ps
.
setString
(
1
,
p_drive_respuesta
);
ps
.
setString
(
2
,
p_fecha_registro
);
ps
.
setString
(
2
,
p_fecha_registro
);
ps
.
setInt
(
3
,
p_fila_drive
);
ps
.
setString
(
4
,
p_correo_alumno
);
ps
.
setString
(
5
,
p_nota
);
...
...
@@ -102,7 +107,7 @@ public class PostgreSqlExcel implements ExcelDAO{
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"status"
,
false
);
respuesta
.
put
(
"mensaje"
,
e
.
getMessage
());
}
finally
{
}
finally
{
if
(
conexion
!=
null
)
{
conexion
.
close
();
}
...
...
@@ -123,7 +128,8 @@ public class PostgreSqlExcel implements ExcelDAO{
String
p_drive_origen
=
json
.
getString
(
"p_drive_origen"
);
int
p_drive_fila
=
json
.
getInt
(
"p_drive_fila"
);
String
p_fecha_hora_registro
=
json
.
isNull
(
"p_fecha_hora_registro"
)
?
sqlTime
.
toString
()
:
json
.
getString
(
"p_fecha_hora_registro"
);
String
p_fecha_hora_registro
=
json
.
isNull
(
"p_fecha_hora_registro"
)
?
sqlTime
.
toString
()
:
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"
);
...
...
@@ -175,9 +181,9 @@ public class PostgreSqlExcel implements ExcelDAO{
respuesta
.
put
(
rs
.
getMetaData
().
getColumnName
(
i
),
rs
.
getObject
(
i
));
}
if
(
respuesta
.
getString
(
"func_informe_registrar"
).
contains
(
"_informe_id"
))
{
if
(
respuesta
.
getString
(
"func_informe_registrar"
).
contains
(
"_informe_id"
))
{
respuesta
.
put
(
"status"
,
true
);
}
else
{
}
else
{
respuesta
.
put
(
"status"
,
false
);
}
...
...
@@ -186,7 +192,7 @@ public class PostgreSqlExcel implements ExcelDAO{
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"status"
,
false
);
respuesta
.
put
(
"mensaje"
,
e
.
getMessage
());
}
finally
{
}
finally
{
if
(
conexion
!=
null
)
{
conexion
.
close
();
}
...
...
@@ -194,6 +200,60 @@ public class PostgreSqlExcel implements ExcelDAO{
return
respuesta
;
}
@Override
public
JSONObject
execute_avance
(
JSONObject
json
)
throws
Exception
{
JSONObject
respuesta
=
new
JSONObject
();
Connection
conexion
=
null
;
try
{
int
p_tipo_operacion
=
json
.
getInt
(
"p_tipo_operacion"
);
int
p_aula_id
=
json
.
isNull
(
"p_aula_id"
)
?
0
:
json
.
getInt
(
"p_aula_id"
);
int
p_curso_id
=
json
.
isNull
(
"p_curso_id"
)
?
0
:
json
.
getInt
(
"p_curso_id"
);
conexion
=
PostgreSqlFactoryDAO
.
obtenerConexion
(
"siiaa"
);
String
sql
=
"select academico.func_balotario_alumno(?,?,?)"
;
PreparedStatement
ps
=
conexion
.
prepareStatement
(
sql
);
Statement
st
=
conexion
.
createStatement
();
ps
.
setInt
(
1
,
p_tipo_operacion
);
ps
.
setInt
(
2
,
p_aula_id
);
ps
.
setInt
(
3
,
p_curso_id
);
ResultSet
rs
=
ps
.
executeQuery
();
if
(
rs
.
next
())
{
int
columnCount
=
rs
.
getMetaData
().
getColumnCount
();
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
respuesta
.
put
(
rs
.
getMetaData
().
getColumnName
(
i
),
new
JSONObject
(
rs
.
getObject
(
i
).
toString
()));
}
}
JSONArray
data
=
respuesta
.
getJSONObject
(
"func_balotario_alumno"
).
getJSONArray
(
"data"
);
JSONArray
respuesta2
=
new
JSONArray
();
data
.
forEach
(
item
->
{
String
sql2
=
""
;
JSONObject
obj
=
(
JSONObject
)
item
;
sql2
=
obj
.
getString
(
"script"
);
try
{
st
.
executeQuery
(
sql2
);
}
catch
(
SQLException
e
)
{
}
});
respuesta
.
put
(
"salida"
,
respuesta2
);
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"error"
,
e
.
getMessage
());
}
finally
{
if
(
conexion
!=
null
)
{
conexion
.
close
();
}
}
return
respuesta
;
}
}
src/main/java/pe/so/api/formulario/services/ExcelServices.java
View file @
c7db95d2
...
...
@@ -18,4 +18,8 @@ public class ExcelServices{
public
JSONObject
ejecutar
(
JSONObject
json
)
throws
Exception
{
return
dao
.
ejecutar
(
json
);
}
public
JSONObject
execute_avance
(
JSONObject
json
)
throws
Exception
{
return
dao
.
execute_avance
(
json
);
}
}
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