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
e052969d
Commit
e052969d
authored
Nov 14, 2022
by
Mauro Paolo Josue Zuñiga Mallqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
141122
parent
c4ea7690
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
96 deletions
+37
-96
saveactions_settings.xml
.idea/saveactions_settings.xml
+19
-0
ApiConfig.java
src/main/java/pe/so/api/formulario/api/ApiConfig.java
+4
-0
CORSFilter.java
src/main/java/pe/so/api/formulario/api/CORSFilter.java
+0
-21
ExampleApi.java
src/main/java/pe/so/api/formulario/api/ExampleApi.java
+0
-24
ExcelApi.java
src/main/java/pe/so/api/formulario/api/ExcelApi.java
+1
-1
PostgreSqlExcel.java
...ava/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
+13
-50
No files found.
.idea/saveactions_settings.xml
0 → 100644
View file @
e052969d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"SaveActionSettings"
>
<option
name=
"actions"
>
<set>
<option
value=
"activateOnShortcut"
/>
<option
value=
"reload"
/>
<option
value=
"executeAction"
/>
</set>
</option>
<option
name=
"configurationPath"
value=
""
/>
<option
name=
"quickLists"
>
<list>
<option
value=
"-1109336397"
/>
</list>
</option>
</component>
</project>
\ No newline at end of file
src/main/java/pe/so/api/formulario/api/ApiConfig.java
View file @
e052969d
package
pe
.
so
.
api
.
formulario
.
api
;
import
pe.so.api.formulario.filters.CorsFilter
;
import
javax.ws.rs.ApplicationPath
;
import
javax.ws.rs.core.Application
;
import
java.util.*
;
...
...
@@ -12,7 +14,9 @@ public class ApiConfig extends Application {
public
ApiConfig
()
{
singletons
.
add
(
new
CorsFilter
());
classes
.
add
(
ExcelApi
.
class
);
}
@Override
...
...
src/main/java/pe/so/api/formulario/api/CORSFilter.java
deleted
100644 → 0
View file @
c4ea7690
package
pe
.
so
.
api
.
formulario
.
api
;
import
java.io.IOException
;
import
javax.ws.rs.container.ContainerRequestContext
;
import
javax.ws.rs.container.ContainerResponseContext
;
import
javax.ws.rs.container.ContainerResponseFilter
;
import
javax.ws.rs.ext.Provider
;
@Provider
public
class
CORSFilter
implements
ContainerResponseFilter
{
@Override
public
void
filter
(
ContainerRequestContext
requestContext
,
ContainerResponseContext
responseContext
)
throws
IOException
{
responseContext
.
getHeaders
().
add
(
"Access-Control-Allow-Origin"
,
"*"
);
responseContext
.
getHeaders
().
add
(
"Access-Control-Allow-Headers"
,
"origin, content-type, accept, authorization"
);
responseContext
.
getHeaders
().
add
(
"Access-Control-Allow-Credentials"
,
"true"
);
responseContext
.
getHeaders
().
add
(
"Access-Control-Allow-Methods"
,
"GET, POST, PUT"
);
responseContext
.
getHeaders
().
add
(
"Access-Control-Max-Age"
,
"1209600"
);
}
}
src/main/java/pe/so/api/formulario/api/ExampleApi.java
deleted
100644 → 0
View file @
c4ea7690
package
pe
.
so
.
api
.
formulario
.
api
;
import
javax.ws.rs.*
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.ext.Provider
;
import
org.json.JSONObject
;
@Provider
@Path
(
"test"
)
public
class
ExampleApi
{
@GET
@Path
(
"/"
)
@Produces
(
"application/json"
)
public
Response
testGet
()
{
JSONObject
salida
=
new
JSONObject
();
salida
.
put
(
"status"
,
true
)
.
put
(
"message"
,
"Éxito"
);
return
Response
.
status
(
200
).
entity
(
salida
.
toString
()).
build
();
}
}
src/main/java/pe/so/api/formulario/api/ExcelApi.java
View file @
e052969d
...
...
@@ -12,7 +12,7 @@ import javax.ws.rs.ext.Provider;
@Consumes
(
"application/json"
)
@Produces
(
"application/json"
)
public
class
ExcelApi
{
private
final
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
"
};
private
final
String
[]
jsonString
=
{
"p_
encuesta_id"
,
"p_grupo_encuesta"
,
"p_correo_alumno"
,
"p_unidad_interna_id
"
};
private
JSONObject
MSJ_RESPUESTA
=
new
JSONObject
();
...
...
src/main/java/pe/so/api/formulario/postgresdao/PostgreSqlExcel.java
View file @
e052969d
...
...
@@ -21,69 +21,32 @@ public class PostgreSqlExcel implements ExcelDAO{
java
.
sql
.
Date
sqlDate
=
new
java
.
sql
.
Date
(
date
.
getTime
());
java
.
sql
.
Timestamp
sqlTime
=
new
java
.
sql
.
Timestamp
(
date
.
getTime
());
//
String[] jsonString = {"p_drive_origen", "p_drive_fila", "p_fecha_hora_registro", "p_sede", "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
"};
//
private final String[] jsonString = {"p_encuesta_id","p_grupo_encuesta","p_correo_alumno
"};
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_sede
=
json
.
getString
(
"p_sede"
);
String
p_medio_atencion
=
json
.
getString
(
"p_medio_atencion"
);
String
p_contacto_nombres
=
json
.
getString
(
"p_contacto_nombres"
);
String
p_contacto_apellidos
=
json
.
getString
(
"p_contacto_apellidos"
);
String
p_numero_documento
=
json
.
getString
(
"p_numero_documento"
);
String
p_contacto_correo
=
json
.
getString
(
"p_contacto_correo"
);
String
p_atencion_usuario
=
json
.
getString
(
"p_atencion_usuario"
);
String
p_grado
=
json
.
getString
(
"p_grado"
);
String
p_contacto_telefono
=
json
.
getString
(
"p_contacto_telefono"
);
String
p_colegio_procedencia
=
json
.
getString
(
"p_colegio_procedencia"
);
String
p_distrito
=
json
.
getString
(
"p_distrito"
);
String
p_atencion_fecha
=
json
.
getString
(
"p_atencion_fecha"
);
String
p_atencion_estado
=
json
.
getString
(
"p_atencion_estado"
);
String
p_atencion_medio_atencion
=
json
.
getString
(
"p_atencion_medio_atencion"
);
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"
);
int
p_encuensta_id
=
json
.
isNull
(
"p_encuesta_id"
)
?
0
:
json
.
getInt
(
"p_encuesta_id"
);
String
p_grupo_encuesta
=
json
.
isNull
(
"p_grupo_encuesta"
)
?
""
:
json
.
getString
(
"p_grupo_encuesta"
);
String
p_correo_alumno
=
json
.
isNull
(
"p_correo_alumno"
)
?
""
:
json
.
getString
(
"p_correo_alumno"
);
int
p_unidad_interna_id
=
json
.
isNull
(
"p_unidad_interna_id"
)
?
0
:
json
.
getInt
(
"p_unidad_interna_id"
);
conexion
=
PostgreSqlFactoryDAO
.
obtenerConexion
(
"siiaa"
);
String
sql
=
"select
matricula.func_informe_registrar(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?)"
;
String
sql
=
"select
horario.func_encuesta_procesar_alumno(
?,?,?,?)"
;
PreparedStatement
ps
=
conexion
.
prepareStatement
(
sql
);
ps
.
setString
(
1
,
p_drive_origen
);
ps
.
setInt
(
2
,
p_drive_fila
);
ps
.
setString
(
3
,
sqlTime
.
toString
());
ps
.
setString
(
4
,
p_sede
);
ps
.
setString
(
5
,
p_medio_atencion
);
ps
.
setString
(
6
,
p_contacto_nombres
);
ps
.
setString
(
7
,
p_contacto_apellidos
);
ps
.
setString
(
8
,
p_numero_documento
);
ps
.
setString
(
9
,
p_contacto_correo
);
ps
.
setString
(
10
,
p_contacto_telefono
);
ps
.
setString
(
11
,
p_distrito
);
ps
.
setString
(
12
,
p_grado
);
ps
.
setString
(
13
,
p_colegio_procedencia
);
ps
.
setString
(
14
,
p_medio_difusion_nombre
);
ps
.
setString
(
15
,
p_atencion_usuario
);
ps
.
setString
(
16
,
p_atencion_fecha
);
ps
.
setString
(
17
,
p_atencion_estado
);
ps
.
setString
(
18
,
p_atencion_medio_atencion
);
ps
.
setString
(
19
,
p_atencion_hora
);
ps
.
setString
(
20
,
p_atencion_observacion
);
ps
.
setInt
(
1
,
p_encuensta_id
);
ps
.
setString
(
2
,
p_grupo_encuesta
);
ps
.
setString
(
3
,
p_correo_alumno
);
ps
.
setInt
(
4
,
p_unidad_interna_id
);
ResultSet
rs
=
ps
.
executeQuery
();
if
(
rs
.
next
())
{
int
columnCount
=
((
ResultSet
)
rs
)
.
getMetaData
().
getColumnCount
();
int
columnCount
=
rs
.
getMetaData
().
getColumnCount
();
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
respuesta
.
put
(
rs
.
getMetaData
().
getColumnName
(
i
),
rs
.
getObject
(
i
));
}
if
(
respuesta
.
getString
(
"func_informe_registrar"
).
contains
(
"_informe_id"
)){
respuesta
.
put
(
"status"
,
true
);
}
else
{
respuesta
.
put
(
"status"
,
false
);
}
}
respuesta
.
put
(
"status"
,
true
);
}
catch
(
Exception
e
)
{
respuesta
.
put
(
"status"
,
false
);
...
...
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