1259 lines
45 KiB
Plaintext
Executable File
1259 lines
45 KiB
Plaintext
Executable File
package com.fp.frontend.controller.armas.eval;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.faces.bean.ManagedBean;
|
|
import javax.faces.bean.ManagedProperty;
|
|
import javax.faces.bean.ViewScoped;
|
|
import javax.faces.context.FacesContext;
|
|
|
|
import org.primefaces.event.FileUploadEvent;
|
|
import org.primefaces.event.SelectEvent;
|
|
import org.primefaces.model.UploadedFile;
|
|
|
|
import com.fp.dto.Request;
|
|
import com.fp.dto.Response;
|
|
import com.fp.dto.query.DtoQuery;
|
|
import com.fp.dto.query.Filter;
|
|
import com.fp.dto.query.SubQuery;
|
|
import com.fp.dto.save.DtoSave;
|
|
import com.fp.frontend.controller.AbstractController;
|
|
import com.fp.frontend.controller.alfresco.AlfrescoController;
|
|
import com.fp.frontend.controller.armas.parametros.GuardiasController;
|
|
import com.fp.frontend.controller.pcustomer.lov.PersonLovController;
|
|
import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController;
|
|
import com.fp.frontend.controller.pgeneral.gene.ParametersController;
|
|
import com.fp.frontend.helper.MessageHelper;
|
|
import com.fp.frontend.utility.MsgControlArmas;
|
|
import com.fp.frontend.utility.Utilidades;
|
|
import com.fp.frontend.utility.ValidateIdentification;
|
|
import com.fp.frontend.webservices.snap.cedula.ClienteCedula;
|
|
import com.fp.frontend.webservices.snap.ruc.ClienteRUC;
|
|
import com.fp.persistence.parmas.eval.TarmEvaluacion;
|
|
import com.fp.persistence.parmas.soli.TarmGuardias;
|
|
import com.fp.persistence.pcustomer.gene.TcustPersonDetail;
|
|
import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail;
|
|
import com.fp.persistence.pgeneral.gene.TgeneParameters;
|
|
import com.fp.persistence.pgeneral.safe.TsafeUserDetail;
|
|
|
|
import ec.gob.registrocivil.consultacedula.Cedula;
|
|
import ec.gov.sri.wsconsultacontribuyente.Contribuyente;
|
|
|
|
|
|
/**
|
|
* Clase controladora del bean TarmEvaluacion.
|
|
*
|
|
* @author Andres Cevallos.
|
|
* @version 2.1
|
|
*/
|
|
@SuppressWarnings("serial")
|
|
@ManagedBean
|
|
@ViewScoped
|
|
public class EvaluacionController extends AbstractController<TarmEvaluacion> {
|
|
|
|
@ManagedProperty(value = "#{alfrescoController}")
|
|
private AlfrescoController alfrescoController;
|
|
|
|
@ManagedProperty(value = "#{guardiasController}")
|
|
private GuardiasController guardiasController;
|
|
// private TcustPersonDetail evaluado;
|
|
private Boolean aprobado;
|
|
TgeneCatalogDetail lTipoPersona;
|
|
private TgeneCatalogDetail centromed;
|
|
public String centro;
|
|
public List<TgeneCatalogDetail> lcentro;
|
|
// private List<TgeneCatalogDetail> lTipoEvaluacion;
|
|
TgeneCatalogDetail tipoEvaluacion;
|
|
private TcustPersonDetail empresa;
|
|
private UploadedFile file;
|
|
private Date fecha;
|
|
private Date fechaactual;
|
|
private Date fechadeposito;
|
|
private TcustPersonDetail personafiltro;
|
|
private TcustPersonDetail personafiltroSNAP;
|
|
private List<String> eliminar;
|
|
private boolean subio=false;
|
|
private String deposito;
|
|
private String papeleta;
|
|
private Boolean centroMedico;
|
|
private String nombreArchivo;
|
|
private Boolean isGuardia;
|
|
private String tipoTest;
|
|
|
|
private Boolean isPasaporte;
|
|
/**
|
|
* codigo del ruc
|
|
*/
|
|
private String codigoRuc;
|
|
/**
|
|
* codigo del ruc
|
|
*/
|
|
private String codigoCedula;
|
|
/**
|
|
* codigo del pasaporte
|
|
*/
|
|
private String codigoPasaporte;
|
|
/**
|
|
* Atributo para la lista de objetos TgeneCatalogDetail
|
|
*/
|
|
private List<TgeneCatalogDetail> tipoDocumentoLst;
|
|
|
|
/**
|
|
* Atributo para setear el psicologo responsable
|
|
*/
|
|
private TcustPersonDetail tcustPersonDetailPsicologo;
|
|
|
|
/**
|
|
* Constructor
|
|
* @throws Exception
|
|
*/
|
|
public EvaluacionController() throws Exception {
|
|
super(TarmEvaluacion.class);
|
|
}
|
|
|
|
/**
|
|
* Metodo invocado despues de instanciar el controlador
|
|
*/
|
|
@PostConstruct
|
|
private void postconstruct() {
|
|
this.init();
|
|
// Inicializa autoconsulta
|
|
super.startQuery();
|
|
querydatabase();
|
|
}
|
|
|
|
/**
|
|
* Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador.
|
|
*/
|
|
private void init() {
|
|
try {
|
|
this.recperpage = 15; // Cambiar al # reg a mirar.
|
|
this.lrecord = new ArrayList<>();
|
|
eliminar=new ArrayList<String>();
|
|
this.beanalias = "EVALUACION";
|
|
this.tipoTest = "PSICOLOGICA";
|
|
aprobado=false;
|
|
fecha=new Date();
|
|
codigoRuc=codigos("CODIGO.RUC");
|
|
codigoCedula=codigos("CODIGO.CEDULA");
|
|
codigoPasaporte=codigos("CODIGO.PASAPORTE");
|
|
tipoDocumentoLst = CatalogDetailController.find("IDENTIFICATION");
|
|
// lTipoEvaluacion=CatalogDetailController.find("TIPOEVALUACION");
|
|
tipoEvaluacion=CatalogDetailController.findCatalogo("TIPOEVALUACION", "PSICOLOGICA");
|
|
lcentro=CatalogDetailController.find("CENTROMEDICO");
|
|
setFechaactual(new Date());
|
|
centroMedico=Boolean.FALSE;
|
|
|
|
// CARGAR INFORMACION DEL USUARIO LOGUEADO DEL SNAP
|
|
TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL");
|
|
|
|
personafiltro = PersonLovController.find(tsafeUserDetail.getPk().getPersoncode().toString());
|
|
lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode());
|
|
super.create();
|
|
this.record.setPersoncode(personafiltro.getPk().getPersoncode());
|
|
this.record.getModifiedData().put("nombre", personafiltro.getName());
|
|
this.record.getModifiedData().put("identificacion", personafiltro.getIdentification());
|
|
this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription());
|
|
|
|
|
|
|
|
if(personafiltro.getIdentification() == null || personafiltro.getIdentification() == null){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula"));
|
|
return;
|
|
}
|
|
|
|
if(personafiltro.getIdentificationcatalog().equals("CED")){
|
|
// valido validez CEDULA
|
|
if(!ValidateIdentification.cedula(personafiltro.getIdentification())){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido"));
|
|
return;
|
|
}
|
|
personafiltroSNAP=buscarPersonaSnap(personafiltro.getIdentification(),personafiltro.getIdentificationcatalog());
|
|
|
|
}else if(personafiltro.getIdentificationcatalog().equals("RUC")){
|
|
// valido validez RUC
|
|
if(!ValidateIdentification.ruc(personafiltro.getIdentification())){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido"));
|
|
return;
|
|
}
|
|
personafiltroSNAP=buscarPersonaSnap(personafiltro.getIdentification(),personafiltro.getIdentificationcatalog());
|
|
}
|
|
else{
|
|
// PASAPORTE
|
|
personafiltroSNAP = new TcustPersonDetail();
|
|
personafiltroSNAP.setName(personafiltro.getName());
|
|
personafiltroSNAP.setIdentification(personafiltro.getIdentification());
|
|
personafiltroSNAP.setIdentificationcatalog("PAS");
|
|
personafiltroSNAP.setIdentificationcatalogcode("IDENTIFICATION");
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Método para obtener los codigos
|
|
*/
|
|
public String codigos(String parametro){
|
|
TgeneParameters tgeneParameters= ParametersController.find(parametro, "1");
|
|
return tgeneParameters.getTextvalue();
|
|
}
|
|
|
|
/**
|
|
* Método para obtener los codigos
|
|
*/
|
|
public Integer valorInt(String parametro){
|
|
TgeneParameters tgeneParameters= ParametersController.find(parametro, "1");
|
|
return tgeneParameters.getNumbervalue().intValue();
|
|
}
|
|
|
|
public String getCentro() {
|
|
return centro;
|
|
}
|
|
|
|
public void setCentro(String centro) {
|
|
this.centro = centro;
|
|
}
|
|
|
|
public List<TgeneCatalogDetail> getLcentro() {
|
|
return lcentro;
|
|
}
|
|
|
|
public void setLcentro(List<TgeneCatalogDetail> lcentro) {
|
|
this.lcentro = lcentro;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.fp.frontend.controller.AbstractController#querydatabase()
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
protected void querydatabase() {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
dto.setOrderby("t.fecha,t.tipoevaluacion"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
SubQuery snombre= new SubQuery
|
|
("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery snumerodocumento= new SubQuery
|
|
("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery persontipe= new SubQuery
|
|
("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery persontipecode= new SubQuery
|
|
("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery identificationcatalogcode= new SubQuery
|
|
("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery tipoevaluacion = new SubQuery
|
|
("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo");
|
|
|
|
|
|
Filter filtrofecha=new Filter();
|
|
// filtrofecha.setSql("t.fecha=(select max(te.fecha) from TarmEvaluacion te where te.personcode=t.personcode and te.tipoevaluacion=t.tipoevaluacion)");
|
|
filtrofecha.setSql("t.personcode="+personafiltro.getPk().getPersoncode().toString()+" and t.tipoevaluacion='"+tipoTest+"'"); //
|
|
dto.addFiltro(filtrofecha);
|
|
dto.addSubQuery(snombre);
|
|
dto.addSubQuery(snumerodocumento);
|
|
dto.addSubQuery(persontipe);
|
|
dto.addSubQuery(identificationcatalogcode);
|
|
dto.addSubQuery(persontipecode);
|
|
dto.addSubQuery(tipoevaluacion);
|
|
// dto.addSubQuery(maxdate);
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
completar();
|
|
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
public void cargarDeposito(){
|
|
centromed = CatalogDetailController.findxCodigoCodcatalogo(centro, "CENTROMEDICO");
|
|
this.record.setCentromedico(centro);
|
|
TgeneParameters parameters= ParametersController.find("CODIGO.OTROS", "1");
|
|
centroMedico=Boolean.FALSE;
|
|
if(centro.equals(parameters.getTextvalue())){
|
|
fechadeposito= new Date();
|
|
record.setNopapeleta(null);
|
|
centroMedico=Boolean.TRUE;
|
|
}
|
|
}
|
|
/**
|
|
* Conpleta la informacion de la Evaluacion
|
|
*/
|
|
@SuppressWarnings("deprecation")
|
|
public void completar(){
|
|
for(int i=0;i< this.lrecord.size();i++){
|
|
try{
|
|
if(lrecord.get(i).getModifiedData().get("tipoevaluaciondesc").toString().equals("EVALUACION DE CONOCIMIENTOS"))
|
|
this.lrecord.get(i).getModifiedData().put("eliminar", "true");
|
|
else if(fecha.getDay()!=lrecord.get(i).getFecha().getDay() || fecha.getMonth()!=lrecord.get(i).getFecha().getMonth() || fecha.getYear()!=lrecord.get(i).getFecha().getYear())
|
|
this.lrecord.get(i).getModifiedData().put("eliminar", "true");
|
|
//else if(lrecord.get(i))
|
|
else
|
|
this.lrecord.get(i).getModifiedData().put("eliminar", "false");
|
|
|
|
|
|
|
|
TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipopersona").toString(), this.lrecord.get(i).getModifiedData().get("tipopersonacode").toString());
|
|
this.lrecord.get(i).getModifiedData().put("tipopersonadesc", tipo.getDescription());
|
|
|
|
if(lrecord.get(i).getFechaexpiracion()!=null && lrecord.get(i).getFechaexpiracion().after(new Date())){
|
|
this.lrecord.get(i).getModifiedData().put("estadovig", "VIGENTE");
|
|
}else{
|
|
this.lrecord.get(i).getModifiedData().put("estadovig", "NO VIGENTE");
|
|
}
|
|
}
|
|
catch (Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Ruta para la evaluacion de conocimientos
|
|
* @param eva
|
|
* @return
|
|
*/
|
|
public String getRutaDocumentoPrueba(TarmEvaluacion eva) {
|
|
Calendar calendar = Calendar.getInstance();
|
|
calendar.setTime(new Date());
|
|
StringBuilder ruta = new StringBuilder("cm:Pruebas");
|
|
ruta = ruta.append("/cm:ID-").append(eva.modifiedData().get("identificacion").toString());
|
|
ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR));
|
|
ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1));
|
|
return ruta.toString();
|
|
}
|
|
|
|
/**
|
|
* Valida la fecha
|
|
* @param fech
|
|
*/
|
|
public void validarfecha(Date fech){
|
|
if(fech.getTime()>(new Date()).getTime()){
|
|
fecha=new Date();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Evento el cual carga los archivos
|
|
* @param event
|
|
*/
|
|
public void upload(FileUploadEvent event) {
|
|
|
|
file = event.getFile();
|
|
subio=true;
|
|
nombreArchivo=Utilidades.recorteNombre(file.getFileName());
|
|
|
|
}
|
|
/**
|
|
* Crea un registro de actualizacion
|
|
*/
|
|
@SuppressWarnings("deprecation")
|
|
public void actualizar(){
|
|
|
|
try {
|
|
if(personafiltro==null){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona"));
|
|
return;
|
|
}
|
|
|
|
// if(empresa==null){
|
|
// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona"));
|
|
// return;
|
|
// }
|
|
|
|
if(file==null){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_debesubir"));
|
|
return;
|
|
}
|
|
|
|
Date horas=new Date();
|
|
fecha.setHours(horas.getHours());
|
|
fecha.setMinutes(horas.getMinutes());
|
|
fecha.setSeconds(horas.getSeconds());
|
|
this.record.getModifiedData().put("file", file);
|
|
String xPathLocation= getRutaDocumentoPrueba(record);
|
|
this.record.setTipoevaluacion("PSICOLOGICA");
|
|
this.record.setTipoevaluacioncodigo("TIPOEVALUACION");
|
|
this.record.setTipdoccodepsicologo("IDENTIFICATION");
|
|
this.record.setInformexpath(xPathLocation + "/cm:Pruebas/cm:"+"Psicologico.pdf");
|
|
this.record.setFecha(new java.sql.Timestamp(new Date().getTime()) );
|
|
aprobar();
|
|
// Para validar el estado del guardia
|
|
Integer numTestPsicologicosAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "PSICOLOGICA");
|
|
Integer numTestConocimientososAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "CONOCIMIENTO");
|
|
if(this.record.getResultado().equalsIgnoreCase("APROBADO")){
|
|
// En caso de que el actual test sea aprobado sumo uno a los antes aprobados
|
|
numTestPsicologicosAPB++;
|
|
Date fechaexpiracion=new Date();
|
|
//fechaexpiracion.setYear(fechaexpiracion.getYear()+2);
|
|
Integer month= valorInt("VIGENCIA_MES_EVAL");
|
|
fechaexpiracion.setMonth(fechaexpiracion.getMonth()+month);
|
|
this.record.setFechaexpiracion(new java.sql.Date(fechaexpiracion.getTime()));
|
|
}
|
|
this.record.setCentromedico(centromed.getPk().getCatalog());
|
|
if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){
|
|
this.record.setEmpresapersoncode(empresa.getPk().getPersoncode());
|
|
}
|
|
this.record.setCentromedicocode("CENTROMEDICO");
|
|
this.record.setFechadeposito(new java.sql.Date(fechadeposito.getTime()));
|
|
this.record.getModifiedData().put("tipopersonadesc",lTipoPersona.getDescription());
|
|
this.record.getModifiedData().put("tipoevaluaciondesc",CatalogDetailController.findxCodigoCodcatalogo(this.record.getTipoevaluacion(), this.record.getTipoevaluacioncodigo()).getDescription());
|
|
TarmEvaluacion oeva=EvaluacionController.findVigencia(record.getPersoncode().toString(), record.getTipoevaluacion());
|
|
|
|
if(oeva==null || record.getFecha().before(oeva.getFecha())){
|
|
record.setVigente("N");
|
|
update();
|
|
TarmGuardias guardia;
|
|
guardia=GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString());
|
|
|
|
if(guardia!=null){
|
|
guardiasController.setRecord(guardia);
|
|
guardiasController.getRecord().setIsnew(false);
|
|
}
|
|
else{
|
|
guardiasController.create();
|
|
}
|
|
if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){
|
|
guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode());
|
|
}
|
|
|
|
guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode());
|
|
|
|
if(numTestPsicologicosAPB<=0 || numTestConocimientososAPB <=0 ){
|
|
guardiasController.getRecord().setEstado("NAPT");
|
|
}
|
|
else{
|
|
guardiasController.getRecord().setEstado("APT");
|
|
}
|
|
guardiasController.update();
|
|
|
|
return;
|
|
}
|
|
record.setVigente("Y");
|
|
update();
|
|
TarmGuardias guardia;
|
|
guardia=GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString());
|
|
|
|
if(guardia!=null){
|
|
guardiasController.setRecord(guardia);
|
|
guardiasController.getRecord().setIsnew(false);
|
|
}
|
|
else{
|
|
guardiasController.create();
|
|
}
|
|
if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){
|
|
guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode());
|
|
}
|
|
guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode());
|
|
if(numTestPsicologicosAPB<=0 || numTestConocimientososAPB <=0 ){
|
|
guardiasController.getRecord().setEstado("NAPT");
|
|
}
|
|
else{
|
|
guardiasController.getRecord().setEstado("APT");
|
|
}
|
|
guardiasController.update();
|
|
|
|
oeva.setVigente("N");
|
|
oeva.setIsnew(false);
|
|
this.record=oeva;
|
|
update();
|
|
}catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public GuardiasController getGuardiasController() {
|
|
return guardiasController;
|
|
}
|
|
|
|
public void setGuardiasController(GuardiasController guardiasController) {
|
|
this.guardiasController = guardiasController;
|
|
}
|
|
|
|
/**
|
|
* Abre el lov de persona
|
|
*/
|
|
public void openPersonLov() {
|
|
Map<String, List<String>> params = new HashMap<>();
|
|
PersonLovController.openLov(params);
|
|
}
|
|
|
|
// /**
|
|
// * Retorna y carga datos de la persona
|
|
// * @param event
|
|
// * @throws Exception
|
|
// */
|
|
// public void onReturnPersonLov(SelectEvent event) throws Exception {
|
|
//// setEvaluado( (TcustPersonDetail) event.getObject());
|
|
// lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode());
|
|
// this.record.setPersoncode(personafiltro.getPk().getPersoncode());
|
|
// this.record.getModifiedData().put("nombre", personafiltro.getName());
|
|
// this.record.getModifiedData().put("identificacion", personafiltro.getIdentification());
|
|
// try{
|
|
// this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription());
|
|
// }
|
|
// catch(Exception e){
|
|
// e.printStackTrace();
|
|
// }
|
|
// }
|
|
|
|
public void onRetrunPersonLovEmpresa(SelectEvent event) throws Exception{
|
|
setEmpresa((TcustPersonDetail) event.getObject());
|
|
this.record.setEmpresapersoncode(empresa.getPk().getPersoncode());
|
|
}
|
|
// /**
|
|
// * Regresa una persona para guardarla en un nuevo registro de evaluacio psicologica
|
|
// * @param event
|
|
// * @throws Exceptionq
|
|
// */
|
|
// public void onReturnPersonLov2(SelectEvent event) throws Exception{
|
|
// personafiltro=(TcustPersonDetail) event.getObject();
|
|
// this.addFilter("personcode", personafiltro.getPk().getPersoncode().toString());
|
|
// }
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.fp.frontend.controller.AbstractController#save()
|
|
*/
|
|
|
|
/**
|
|
* Metodo de guardado de la evaluacion. Ademas sube el archivo alfresco seleccionado
|
|
*/
|
|
@Override
|
|
public void save(){
|
|
try {
|
|
for(int i=0;i<lrecord.size();i++){
|
|
if(lrecord.get(i).isnew){
|
|
if(lrecord.get(i).getModifiedData().get("file")!=null){
|
|
UploadedFile archivo=(UploadedFile) lrecord.get(i).modifiedData().get("file");
|
|
String xPathLocation= getRutaDocumentoPrueba(lrecord.get(i)) + "/cm:Pruebas";
|
|
lrecord.get(i).modifiedData().clear();
|
|
alfrescoController.uploadFile(archivo.getInputstream(),"Psicologico.pdf", xPathLocation);
|
|
if(this.lrecord.get(i).getFechaexpiracion()!=null && this.lrecord.get(i).getFechaexpiracion().after(new Date())){
|
|
this.lrecord.get(i).getModifiedData().put("estadovig", "VIGENTE");
|
|
}else{
|
|
this.lrecord.get(i).getModifiedData().put("estadovig", "NO VIGENTE");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoSave dtosave = super.getDtoSave();
|
|
if(!dtosave.pendingProcess()){
|
|
return;
|
|
}
|
|
dtosave.setPosition(1);
|
|
HashMap<String, DtoSave> msave = new HashMap<String, DtoSave>();
|
|
msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla.
|
|
DtoSave dtoguardias = this.guardiasController.getDtoSave(true);
|
|
msave.put(guardiasController.getBeanalias(), dtoguardias); // adicionar metadata de mantenimiento para cada tabla.
|
|
dtoguardias.setPosition(2);
|
|
request.setSaveTables(msave);
|
|
Response resp = this.callerhelper.executeSave(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) {
|
|
this.postCommit(resp);
|
|
MessageHelper.setMessageInfo(resp);
|
|
} else {
|
|
MessageHelper.setMessageError(resp);
|
|
}
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
postconstruct();
|
|
}
|
|
|
|
/**
|
|
* Metodo el cual borra un registro. Revisa si el registro coincide con la fecha maxima.
|
|
*/
|
|
@SuppressWarnings("deprecation")
|
|
@Override
|
|
public void remove(){
|
|
fecha=new Date();
|
|
if(fecha.getDay()==record.getFecha().getDay() && fecha.getMonth()==record.getFecha().getMonth() && fecha.getYear()==record.getFecha().getYear()){
|
|
try {
|
|
eliminar.add(record.getInformexpath());
|
|
super.remove();
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
else{
|
|
MessageHelper.setMessageError("NO SE PUEDE BORRAR ESTE REGISTRO");
|
|
}
|
|
}
|
|
/**
|
|
* aprueba la o reprueba la evaluacion
|
|
*/
|
|
public void aprobar(){
|
|
if(aprobado){
|
|
this.record.setResultado("APROBADO");
|
|
this.record.setResultadocodigo("RESULTADO");
|
|
}
|
|
else{
|
|
this.record.setResultado("REPROBADO");
|
|
this.record.setResultadocodigo("RESULTADO");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* find para encontrar los registros anteriores
|
|
*/
|
|
public static Integer findIntentos(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300000;
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydata(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.size();
|
|
}
|
|
return 0;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* find para encontrar evaluaciones aprobadas anteriores en estado vigente
|
|
*/
|
|
public static Integer findEvaluacionesAprobadasVigentes(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300000;
|
|
cc.addFilter("resultado", "APROBADO");
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydatabaseVigentes(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.size();
|
|
}
|
|
return 0;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* find para encontrar los registros anteriores
|
|
*/
|
|
public static Integer findIntentosReprobados(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300000;
|
|
cc.addFilter("resultado", "REPROBADO");
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydata(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.size();
|
|
}
|
|
return 0;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
// /* (non-Javadoc)
|
|
// * @see com.fp.frontend.controller.AbstractController#create()
|
|
// */
|
|
// @Override
|
|
// public void create(){
|
|
// limpiar();
|
|
// try {
|
|
// super.create();
|
|
// } catch (Exception e) {
|
|
// // TODO Auto-generated catch block
|
|
// e.printStackTrace();
|
|
// }
|
|
// }
|
|
|
|
|
|
/**
|
|
* Limpia los registros anteriores
|
|
*/
|
|
public void limpiar(){
|
|
personafiltro=null;
|
|
file=null;
|
|
lTipoPersona=null;
|
|
subio=false;
|
|
fechadeposito=new Date();
|
|
empresa=new TcustPersonDetail();
|
|
deposito="";
|
|
nombreArchivo=null;
|
|
init();
|
|
}
|
|
|
|
|
|
/**
|
|
* Find para encontrar la fecha en la que debe rendir la prueba
|
|
* @param personcode
|
|
* @param tipoevaluacion
|
|
* @return
|
|
*/
|
|
public static TarmEvaluacion findFecha(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300;
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydat(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.get(0);
|
|
}
|
|
return null;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* find para encontrar evaluaciones aprobadas anteriores en estado vigente
|
|
*/
|
|
public static TarmEvaluacion findEvaluacionesVigentes(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 100;
|
|
cc.addFilter("resultado", "APROBADO");
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydataVigentes(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.get(0);
|
|
}
|
|
return null;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public void querydataVigentes(String personcode, String tipoevaluacion) {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
dto.setOrderby("t.fecha desc");
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Encuentra la evaluacion vigente
|
|
* @param personcode
|
|
* @param tipoevaluacion
|
|
* @return
|
|
*/
|
|
public static TarmEvaluacion findVigencia(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300;
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.addFilter("vigente","Y");
|
|
cc.querydat(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
return cc.lrecord.get(0);
|
|
}
|
|
return null;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static TarmEvaluacion find(String personcode, String tipoevaluacion) {
|
|
try {
|
|
EvaluacionController cc = new EvaluacionController();
|
|
cc.init();
|
|
cc.recperpage = 300000;
|
|
cc.addFilter("personcode", personcode);
|
|
cc.addFilter("tipoevaluacion",tipoevaluacion);
|
|
cc.querydat(personcode,tipoevaluacion);
|
|
|
|
if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) {
|
|
if(cc.lrecord.get(0).getFechaexpiracion()!=null && cc.lrecord.get(0).getFechaexpiracion().after(new Date())){
|
|
return cc.lrecord.get(0);
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
return null;
|
|
}
|
|
|
|
}
|
|
/**
|
|
* consulta en la cual se busca la fecha proxima para rendir la evaluacion
|
|
* @param personcode
|
|
* @param tipoevaluacion
|
|
*/
|
|
public void querydat(String personcode, String tipoevaluacion) {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
Filter sql= new Filter();
|
|
sql.setSql("t.fecha=(select max(fecha) from TarmEvaluacion where personcode='"+personcode+"' and tipoevaluacion='"+tipoevaluacion+"')");
|
|
dto.addFiltro(sql);
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
|
|
public void queryByTipoEvaluacion(String personcode, String tipoevaluacion) {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
this.lrecord = new ArrayList<>();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
this.recperpage = 300000;
|
|
SubQuery snombre= new SubQuery
|
|
("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery snumerodocumento= new SubQuery
|
|
("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery persontipe= new SubQuery
|
|
("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery persontipecode= new SubQuery
|
|
("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery identificationcatalogcode= new SubQuery
|
|
("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)");
|
|
SubQuery tipoevaluacionSQ = new SubQuery
|
|
("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo");
|
|
Filter filtropersona=new Filter();//
|
|
filtropersona.setSql("t.personcode="+personcode+" and t.tipoevaluacion='"+tipoevaluacion+"' ");
|
|
dto.addFiltro(filtropersona);
|
|
dto.addSubQuery(snombre);
|
|
dto.addSubQuery(snumerodocumento);
|
|
dto.addSubQuery(persontipe);
|
|
dto.addSubQuery(identificationcatalogcode);
|
|
dto.addSubQuery(persontipecode);
|
|
dto.addSubQuery(tipoevaluacionSQ);
|
|
// this.getMfilters().put("t.personcode", personcode);
|
|
// this.getMfilters().put("t.tipoevaluacion", tipoevaluacion);
|
|
dto.setOrderby("t.fechaexpiracion desc"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
completar();
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
|
|
public void querydata(String personcode, String tipoevaluacion) {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
|
|
public void querydatabaseVigentes(String personcode, String tipoevaluacion) {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
Filter filtro = new Filter();
|
|
filtro.setSql("t.fechaexpiracion>=sysdate");
|
|
dto.addFiltro(filtro);
|
|
dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Query hacia la base de datos
|
|
*/
|
|
public void querybase() {
|
|
try {
|
|
Request request = this.callerhelper.getRequest();
|
|
DtoQuery dto = super.getDtoQuery(true);
|
|
dto.setOrderby("t.fecha"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais").
|
|
|
|
HashMap<String, DtoQuery> mtables = new HashMap<String, DtoQuery>();
|
|
mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla.
|
|
request.setQueryTables(mtables);
|
|
Response resp = this.callerhelper.executeQuery(request);
|
|
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) {
|
|
this.lrecord = new ArrayList<TarmEvaluacion>();
|
|
MessageHelper.setMessageError(resp);
|
|
} else {
|
|
this.lrecord = (List<TarmEvaluacion>) resp.get(this.beanalias);
|
|
super.postQuery(this.lrecord);
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
public void onChangeTipoDocumento(){
|
|
if(this.getRecord().getTipdocpsicologo().equalsIgnoreCase("CED")|| this.getRecord().getTipdocpsicologo().equalsIgnoreCase("RUC")){
|
|
this.setIsPasaporte(Boolean.FALSE);
|
|
this.getRecord().setNumdocpsicologo(null);
|
|
this.getRecord().setPsicologoresponsable(null);
|
|
}else{
|
|
this.setIsPasaporte(Boolean.TRUE);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Método que valida la persona portadora del arma o explosivo
|
|
* en las tablas de maia y en la snap
|
|
*
|
|
*/
|
|
public void validarPsicologoResponsable(){
|
|
if(this.getRecord().getNumdocpsicologo() ==null || this.getRecord().getTipdocpsicologo() ==null){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula"));
|
|
return;
|
|
}
|
|
if(this.getRecord().getTipdocpsicologo().equals(codigoCedula)){
|
|
// SI ES CEDULA
|
|
if(!ValidateIdentification.cedula(this.getRecord().getNumdocpsicologo())){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido"));
|
|
return;
|
|
}
|
|
//envia a buscar en la SNAP
|
|
tcustPersonDetailPsicologo=buscarPersonaSnap(this.getRecord().getNumdocpsicologo(),this.getRecord().getTipdocpsicologo());
|
|
}else if(this.getRecord().getTipdocpsicologo().equals(codigoRuc)){
|
|
// SI ES RUC
|
|
if(!ValidateIdentification.ruc(this.getRecord().getNumdocpsicologo())){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido"));
|
|
return;
|
|
}
|
|
// envia a buscar en la snap
|
|
tcustPersonDetailPsicologo=buscarPersonaSnap(this.getRecord().getNumdocpsicologo(),this.getRecord().getTipdocpsicologo());
|
|
}
|
|
if(tcustPersonDetailPsicologo!=null){
|
|
this.record.setPsicologoresponsable(tcustPersonDetailPsicologo.getName());
|
|
}
|
|
else if(this.getRecord().getTipdocpsicologo().equals(codigoCedula)||this.getRecord().getTipdocpsicologo().equals(codigoRuc)){
|
|
MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_psicologoinvalido"));
|
|
this.record.setPsicologoresponsable(null);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Método para buscar a la persona en la snap
|
|
* @param documento
|
|
*/
|
|
public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){
|
|
if(tipoDocumento.equals("CED")){
|
|
Cedula cedula= ClienteCedula.obtenerCedula(documento);
|
|
if(cedula!=null){
|
|
TcustPersonDetail detail= new TcustPersonDetail();
|
|
detail.setName(cedula.getNombre());
|
|
detail.setIdentification(cedula.getCedula());
|
|
detail.setIdentificationcatalog("CED");
|
|
detail.setIdentificationcatalogcode("IDENTIFICATION");
|
|
return detail;
|
|
}else{
|
|
return null;
|
|
}
|
|
}else {
|
|
Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento);
|
|
if(contribuyente!=null){
|
|
TcustPersonDetail detail= new TcustPersonDetail();
|
|
detail.setName(contribuyente.getRazonSocial());
|
|
detail.setIdentification(contribuyente.getNumeroRuc());
|
|
detail.setIdentificationcatalog("RUC");
|
|
detail.setIdentificationcatalogcode("IDENTIFICATION");
|
|
return detail;
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public Boolean getAprobado() {
|
|
return aprobado;
|
|
}
|
|
|
|
public void setAprobado(Boolean aprobado) {
|
|
this.aprobado = aprobado;
|
|
}
|
|
|
|
|
|
public TgeneCatalogDetail getlTipoPersona() {
|
|
return lTipoPersona;
|
|
}
|
|
|
|
public void setlTipoPersona(TgeneCatalogDetail lTipoPersona) {
|
|
this.lTipoPersona = lTipoPersona;
|
|
}
|
|
|
|
public UploadedFile getFile() {
|
|
return file;
|
|
}
|
|
|
|
public void setFile(UploadedFile file) {
|
|
this.file = file;
|
|
}
|
|
|
|
public AlfrescoController getAlfrescoController() {
|
|
return alfrescoController;
|
|
}
|
|
|
|
public void setAlfrescoController(AlfrescoController alfrescoController) {
|
|
this.alfrescoController = alfrescoController;
|
|
}
|
|
|
|
public Date getFecha() {
|
|
return fecha;
|
|
}
|
|
|
|
public void setFecha(Date fecha) {
|
|
this.fecha = fecha;
|
|
}
|
|
|
|
public TcustPersonDetail getPersonafiltro() {
|
|
return personafiltro;
|
|
}
|
|
|
|
public void setPersonafiltro(TcustPersonDetail personafiltro) {
|
|
this.personafiltro = personafiltro;
|
|
}
|
|
|
|
public Date getFechaactual() {
|
|
return fechaactual;
|
|
}
|
|
|
|
public void setFechaactual(Date fechaactual) {
|
|
this.fechaactual = fechaactual;
|
|
}
|
|
|
|
public List<String> getEliminar() {
|
|
return eliminar;
|
|
}
|
|
|
|
public void setEliminar(List<String> eliminar) {
|
|
this.eliminar = eliminar;
|
|
}
|
|
|
|
public TgeneCatalogDetail getTipoEvaluacion() {
|
|
return tipoEvaluacion;
|
|
}
|
|
|
|
public void setTipoEvaluacion(TgeneCatalogDetail tipoEvaluacion) {
|
|
this.tipoEvaluacion = tipoEvaluacion;
|
|
}
|
|
|
|
public boolean isSubio() {
|
|
return subio;
|
|
}
|
|
|
|
public void setSubio(boolean subio) {
|
|
this.subio = subio;
|
|
}
|
|
|
|
public TcustPersonDetail getEmpresa() {
|
|
return empresa;
|
|
}
|
|
|
|
public void setEmpresa(TcustPersonDetail empresa) {
|
|
this.empresa = empresa;
|
|
}
|
|
|
|
public Date getFechadeposito() {
|
|
return fechadeposito;
|
|
}
|
|
|
|
public void setFechadeposito(Date fechadeposito) {
|
|
this.fechadeposito = fechadeposito;
|
|
}
|
|
|
|
public String getDeposito() {
|
|
return deposito;
|
|
}
|
|
|
|
public void setDeposito(String deposito) {
|
|
this.deposito = deposito;
|
|
}
|
|
|
|
public TgeneCatalogDetail getCentromed() {
|
|
return centromed;
|
|
}
|
|
|
|
public void setCentromed(TgeneCatalogDetail centromed) {
|
|
this.centromed = centromed;
|
|
}
|
|
|
|
public String getPapeleta() {
|
|
return papeleta;
|
|
}
|
|
|
|
public void setPapeleta(String papeleta) {
|
|
this.papeleta = papeleta;
|
|
}
|
|
|
|
public Boolean getCentroMedico() {
|
|
return centroMedico;
|
|
}
|
|
|
|
public void setCentroMedico(Boolean centroMedico) {
|
|
this.centroMedico = centroMedico;
|
|
}
|
|
|
|
public String getNombreArchivo() {
|
|
return nombreArchivo;
|
|
}
|
|
|
|
public void setNombreArchivo(String nombreArchivo) {
|
|
this.nombreArchivo = nombreArchivo;
|
|
}
|
|
|
|
public Boolean getIsGuardia() {
|
|
return isGuardia;
|
|
}
|
|
|
|
public void setIsGuardia(Boolean isGuardia) {
|
|
this.isGuardia = isGuardia;
|
|
}
|
|
|
|
public TcustPersonDetail getPersonafiltroSNAP() {
|
|
return personafiltroSNAP;
|
|
}
|
|
|
|
public void setPersonafiltroSNAP(TcustPersonDetail personafiltroSNAP) {
|
|
this.personafiltroSNAP = personafiltroSNAP;
|
|
}
|
|
|
|
public String getTipoTest() {
|
|
return tipoTest;
|
|
}
|
|
|
|
public void setTipoTest(String tipoTest) {
|
|
this.tipoTest = tipoTest;
|
|
}
|
|
|
|
public List<TgeneCatalogDetail> getTipoDocumentoLst() {
|
|
return tipoDocumentoLst;
|
|
}
|
|
|
|
public void setTipoDocumentoLst(List<TgeneCatalogDetail> tipoDocumentoLst) {
|
|
this.tipoDocumentoLst = tipoDocumentoLst;
|
|
}
|
|
|
|
public TcustPersonDetail getTcustPersonDetailPsicologo() {
|
|
return tcustPersonDetailPsicologo;
|
|
}
|
|
|
|
public void setTcustPersonDetailPsicologo(
|
|
TcustPersonDetail tcustPersonDetailPsicologo) {
|
|
this.tcustPersonDetailPsicologo = tcustPersonDetailPsicologo;
|
|
}
|
|
|
|
public Boolean getIsPasaporte() {
|
|
return isPasaporte;
|
|
}
|
|
public void setIsPasaporte(Boolean isPasaporte) {
|
|
this.isPasaporte = isPasaporte;
|
|
}
|
|
|
|
|
|
}
|