[ADD] SE AGREGO UN ENDPOINT MAS PARA FICHA PRE DATOS

parent 6272171f
...@@ -535,8 +535,8 @@ public class ExcelApi { ...@@ -535,8 +535,8 @@ public class ExcelApi {
} }
@POST @POST
@Path("/procedure") @Path(("/procedure"))
public Response procedure(String json){ public Response procedure(String json) throws Exception {
JSONObject salida = new JSONObject(); JSONObject salida = new JSONObject();
try { try {
JSONObject entrada = new JSONObject(json); JSONObject entrada = new JSONObject(json);
...@@ -556,4 +556,26 @@ public class ExcelApi { ...@@ -556,4 +556,26 @@ public class ExcelApi {
} }
} }
@POST
@Path("/procedureArray")
public Response procedureArray(String json){
JSONObject salida = new JSONObject();
try {
JSONObject entrada = new JSONObject(json);
salida = new ExcelServices().procedureArray(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());
}
}
} }
\ No newline at end of file
...@@ -50,6 +50,8 @@ public interface ExcelDAO{ ...@@ -50,6 +50,8 @@ public interface ExcelDAO{
JSONObject listar_aniversario_reporte (JSONObject entrada) throws Exception; JSONObject listar_aniversario_reporte (JSONObject entrada) throws Exception;
JSONObject procedureArray (JSONObject entrada) throws Exception;
JSONObject procedure (JSONObject entrada) throws Exception; JSONObject procedure (JSONObject entrada) throws Exception;
} }
\ No newline at end of file
...@@ -710,7 +710,7 @@ public class PostgreSqlExcel implements ExcelDAO { ...@@ -710,7 +710,7 @@ public class PostgreSqlExcel implements ExcelDAO {
} }
@Override @Override
public JSONObject procedure(JSONObject entrada) throws Exception { public JSONObject procedureArray(JSONObject entrada) throws Exception {
String sql = entrada.getString("procedure"); String sql = entrada.getString("procedure");
JSONArray array = entrada.optJSONArray("array"); JSONArray array = entrada.optJSONArray("array");
JSONArray errores = new JSONArray(); JSONArray errores = new JSONArray();
...@@ -733,4 +733,11 @@ public class PostgreSqlExcel implements ExcelDAO { ...@@ -733,4 +733,11 @@ public class PostgreSqlExcel implements ExcelDAO {
} }
} }
@Override
public JSONObject procedure(JSONObject entrada) throws Exception {
String sql = entrada.getString("procedure");
JSONObject response = PostgreSqlFactoryDAO.queryPSSingle("siiaa", sql, entrada.getJSONArray("params"));
JSONObject json = new JSONObject(response.getString("json"));
return json;
}
} }
\ No newline at end of file
...@@ -543,7 +543,11 @@ public class ExcelServices { ...@@ -543,7 +543,11 @@ public class ExcelServices {
return dao.listar_aniversario_reporte(entrada); return dao.listar_aniversario_reporte(entrada);
} }
public JSONObject procedure(JSONObject json) throws Exception { public JSONObject procedureArray(JSONObject json) throws Exception {
return dao.procedureArray(json);
}
public JSONObject procedure (JSONObject json) throws Exception{
return dao.procedure(json); return dao.procedure(json);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment