Commit 272fe34e by Aaron Josue Yaya Maza

[FIXED] listarCargosDeUsuario

parent 17543977
...@@ -338,18 +338,7 @@ public class UsuarioServlet extends HttpServlet { ...@@ -338,18 +338,7 @@ public class UsuarioServlet extends HttpServlet {
out.println(rs); out.println(rs);
} }
//private java.util.List<pe.siso.planillaws.service.TipoDocumento> listarTipoDocumento() { private JSONObject listarPersonalPorTipoDocNumDoc(java.lang.String tipoDocumento, java.lang.String numeroDocumento, java.lang.String estado) throws IOException {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
/*pe.siso.planillaws.service.TipoDocumentoService port = service.getTipoDocumentoServicePort();
return port.listarTipoDocumento();
}*/
private JSONObject listarPersonalPorTipoDocNumDoc(java.lang.String tipoDocumento, java.lang.String numeroDocumento, java.lang.String estado) throws IOException {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
/*pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort();
return port.listarPersonalPorTipoDocNumDoc(tipoDocumento, numeroDocumento, estado);*/
JSONObject respuesta = null; JSONObject respuesta = null;
JSONObject obj = new JSONObject() JSONObject obj = new JSONObject()
.put("tipoDocumento", tipoDocumento) .put("tipoDocumento", tipoDocumento)
...@@ -362,10 +351,6 @@ public class UsuarioServlet extends HttpServlet { ...@@ -362,10 +351,6 @@ public class UsuarioServlet extends HttpServlet {
} }
private JSONObject listarPersonalPorCodigo(java.lang.String tipoDocumento) throws IOException { private JSONObject listarPersonalPorCodigo(java.lang.String tipoDocumento) throws IOException {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
/*pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort();
return port.listarPersonalPorCodigo(tipoDocumento);*/
JSONObject respuesta = null; JSONObject respuesta = null;
JSONObject obj = new JSONObject() JSONObject obj = new JSONObject()
.put("tipoDocumento", tipoDocumento); .put("tipoDocumento", tipoDocumento);
...@@ -390,7 +375,7 @@ public class UsuarioServlet extends HttpServlet { ...@@ -390,7 +375,7 @@ public class UsuarioServlet extends HttpServlet {
JSONObject _final = new JSONObject(); JSONObject _final = new JSONObject();
JSONObject obj = lista.getJSONObject(i); JSONObject obj = lista.getJSONObject(i);
String codigoTrabajador = obj.getString("codigoTrabajador"); String codigoTrabajador = obj.getString("codigoTrabajador");
JSONObject prs = new JSONObject(listarPersonalPorCodigo(codigoTrabajador)); JSONObject prs = listarPersonalPorCodigo(codigoTrabajador);
String nombreCompleto = prs.getString("nomPer") + " " + prs.getString("apePatPer") + " " + prs.getString("apeMatPer"); String nombreCompleto = prs.getString("nomPer") + " " + prs.getString("apePatPer") + " " + prs.getString("apeMatPer");
String cargo = prs.getString("nomCar"); String cargo = prs.getString("nomCar");
if (tipo == 4 && (nombreCompleto.toUpperCase()).contains(busqueda.toUpperCase())) { if (tipo == 4 && (nombreCompleto.toUpperCase()).contains(busqueda.toUpperCase())) {
...@@ -427,9 +412,9 @@ public class UsuarioServlet extends HttpServlet { ...@@ -427,9 +412,9 @@ public class UsuarioServlet extends HttpServlet {
JSONArray lista = json.getJSONArray("results"); JSONArray lista = json.getJSONArray("results");
for (int i = 0; i < lista.length(); i++) { for (int i = 0; i < lista.length(); i++) {
JSONObject obj = lista.getJSONObject(i); JSONObject obj = lista.getJSONObject(i);
JSONObject prs = new JSONObject(listarPersonalPorCodigo(obj.getString("codigoTrabajador"))); JSONObject prs = listarPersonalPorCodigo(obj.getString("codigoTrabajador"));
if (!cargos.contains(prs.getString("nomCar"))) { if (!cargos.contains(prs.getString("nom_car"))) {
cargos.add(prs.getString("nomCar")); cargos.add(prs.getString("nom_car"));
} }
} }
out.print(new JSONArray(cargos)); out.print(new JSONArray(cargos));
......
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