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

parent 6272171f
......@@ -534,17 +534,39 @@ public class ExcelApi {
}
}
@POST
@Path(("/procedure"))
public Response procedure(String json) throws Exception {
JSONObject salida = new JSONObject();
try {
JSONObject entrada = new JSONObject(json);
salida = new ExcelServices().procedure(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("/procedure")
public Response procedure(String json){
@Path("/procedureArray")
public Response procedureArray(String json){
JSONObject salida = new JSONObject();
try {
JSONObject entrada = new JSONObject(json);
salida = new ExcelServices().procedure(entrada);
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());
salida.put("message", ex.getMessage());
throw new WebApplicationException(Response.status(400).entity(salida.toString()).build());
} catch (BadRequestException ex) {
salida = new JSONObject(ex.getMessage());
......@@ -556,4 +578,4 @@ public class ExcelApi {
}
}
}
}
\ No newline at end of file
......@@ -50,6 +50,8 @@ public interface ExcelDAO{
JSONObject listar_aniversario_reporte (JSONObject entrada) throws Exception;
JSONObject procedureArray (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 {
}
@Override
public JSONObject procedure(JSONObject entrada) throws Exception {
public JSONObject procedureArray(JSONObject entrada) throws Exception {
String sql = entrada.getString("procedure");
JSONArray array = entrada.optJSONArray("array");
JSONArray errores = new JSONArray();
......@@ -732,5 +732,12 @@ public class PostgreSqlExcel implements ExcelDAO {
return new JSONObject().put("status",true).put("message","ok");
}
}
}
@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
......@@ -72,4 +72,4 @@ public class PostgreSqlFactoryDAO extends FactoryDAO{
return new PostgreSqlTabla();
}
}
}
\ No newline at end of file
......@@ -543,8 +543,12 @@ public class ExcelServices {
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);
}
}
}
\ No newline at end of file
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