59 lines
1.7 KiB
Plaintext
Executable File
59 lines
1.7 KiB
Plaintext
Executable File
package com.fp.viaticos.rules.query.general;
|
|
|
|
import java.util.List;
|
|
|
|
import com.fp.bpm.query.QueryJsf;
|
|
import com.fp.dto.Response;
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
import com.fp.persistence.pviaticos.hra.Empleado;
|
|
import com.fp.persistence.pviaticos.hra.EmpleadoJpql;
|
|
import com.fp.persistence.pviaticos.param.ViaDiasAcumulados;
|
|
import com.fp.viaticos.rules.query.destino.DestinoQuery;
|
|
|
|
public class DiasAcumulados extends QueryRule{
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
public QueryRequest process(QueryRequest pQrequest) throws Exception {
|
|
Response response = pQrequest.getResponse();
|
|
QueryJsf query = new QueryJsf();
|
|
query.execute(pQrequest);
|
|
List<Object> acumulados = (List<Object>)response.get("DIASACUMULADOS");
|
|
this.completarDatos(acumulados);
|
|
return pQrequest;
|
|
}
|
|
|
|
/**
|
|
* Método que completa los datos de los comentarios
|
|
* @param comentarios Lista de objetos tipo ViaSolicitudComentarios
|
|
*/
|
|
private void completarDatos(List<Object> acumulados) throws Exception{
|
|
if(acumulados==null || acumulados.isEmpty()){
|
|
return;
|
|
}
|
|
for(Object objeto: acumulados){
|
|
ViaDiasAcumulados acumulado = (ViaDiasAcumulados)objeto;
|
|
Empleado emp = null;
|
|
EmpleadoJpql e = new EmpleadoJpql();
|
|
//empleado
|
|
emp = e.find(acumulado.getPk().getCod_empleado());
|
|
if(emp!=null){
|
|
acumulado.modifiedData.put("empleado", emp.getNombre());
|
|
}
|
|
|
|
//Destino
|
|
DestinoQuery qry = new DestinoQuery();
|
|
Object[] destino = (Object[])qry.find(acumulado.getPk().getCod_destino());
|
|
if(destino!=null){
|
|
acumulado.modifiedData.put("destino", destino[1]);
|
|
}
|
|
}
|
|
}
|
|
}
|