commit 67a085b1d7d0c7ea3956956e560136dd6b9e711e Author: llopez Date: Mon Mar 25 09:23:45 2024 -0500 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6f89c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3bdda30 --- /dev/null +++ b/pom.xml @@ -0,0 +1,204 @@ + + + 4.0.0 + com.qsoft + werp-domain + 1.0-SNAPSHOT + jar + + + com.stripe + stripe-java + 20.6.0 + + + com.wildbit.java + postmark + 1.7.4 + + + com.sparkjava + spark-core + 2.5 + + + + org.reflections + reflections + 0.9.12 + + + + com.github.librepdf + openpdf + 1.3.20 + + + io.rubrica + rubrica + 0.1.2 + + + com.auth0 + java-jwt + 3.9.0 + + + org.mapstruct + mapstruct + 1.3.1.Final + + + com.qsoft + werp-model + 1.0-SNAPSHOT + jar + + + com.qsoft.util + qsoft-util + 1.1.1-SNAPSHOT + jar + + + org.seleniumhq.selenium + selenium-java + test + 2.44.0 + + + org.quartz-scheduler + quartz + 2.3.2 + + + com.opera + operadriver + test + 1.5 + + + org.seleniumhq.selenium + selenium-remote-driver + + + + + junit + junit + test + 4.11 + + + com.fasterxml.jackson.core + jackson-databind + 2.10.1 + jar + + + com.qsoft + otp-util + 1.0.0 + jar + + + commons-io + commons-io + 2.5 + jar + + + com.fasterxml.jackson.core + jackson-core + 2.12.0 + jar + + + javax + javaee-api + 8.0 + jar + + + javax + javaee-web-api + 7.0 + jar + provided + + + commons-codec + commons-codec + 1.14 + + + org.apache.poi + poi + 4.1.2 + + + net.sf.jasperreports + jasperreports + 6.17.0 + + + net.sf.jasperreports + jasperreports-fonts + 6.17.0 + + + com.itextpdf + itextpdf + 5.5.13.1 + + + xalan + xalan + 2.7.2 + + + org.codehaus.groovy + groovy-all + 2.5.8 + pom + + + org.apache.pdfbox + pdfbox + 2.0.18 + + + org.apache.pdfbox + pdfbox-tools + 2.0.18 + + + + + UTF-8 + 11 + 11 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 11 + 11 + + + org.mapstruct + mapstruct-processor + 1.3.1.Final + + + + + + + diff --git a/src/main/java/com/qsoft/erp/constantes/AccionEnum.java b/src/main/java/com/qsoft/erp/constantes/AccionEnum.java new file mode 100644 index 0000000..d509bea --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/AccionEnum.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +/** + * + * @author james + */ +public enum AccionEnum { + + CONSULTA(0x000), + REGISTRO(0x001), + ACTUALIZA(0x002), + ELIMINACION(0x003), + CONSULTA_COMPLEJA(0x00A), + REGITRO_COMPLEJO(0x00B), + ACTUALIZACION_COMPLEJA(0x00C), + ELIMINACION_COMPLEJA(0x00D); + + private int codigo; + + private AccionEnum(int codigo) { + this.codigo = codigo; + } + + public int getCodigo() { + return codigo; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/CatalogoEnum.java b/src/main/java/com/qsoft/erp/constantes/CatalogoEnum.java new file mode 100644 index 0000000..8e40225 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/CatalogoEnum.java @@ -0,0 +1,52 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Catalogo; +import java.util.TreeMap; + +/** + * + * @author james + */ +public enum CatalogoEnum { + PERIO(27), + ESTPOL(18), + GENER(28), + TIPM(11); + + private Catalogo plantilla; + private final Integer codigo; + private TreeMap parametros; + + private CatalogoEnum(Integer codigo) { + this.codigo = codigo; + this.plantilla = new Catalogo(codigo); + } + + public Integer getCodigo() { + return codigo; + } + + /** + * + * @return + */ + public Catalogo getCatalogo() { + if (plantilla.getCatNemonico() == null && this.codigo != null) { + DaoGenerico dao = new DaoGenerico<>(Catalogo.class); + try { + this.plantilla = dao.cargar(this.codigo); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO PLANTILLA " + ex); + } + } + return this.plantilla; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/ComprobanteEnum.java b/src/main/java/com/qsoft/erp/constantes/ComprobanteEnum.java new file mode 100644 index 0000000..7d5c1f8 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/ComprobanteEnum.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.DetalleCatalogo; + +/** + * + * @author james + */ +public enum ComprobanteEnum { + FACVEN("COMPROBANTE"), + COTIZA("COMPROBANTE"), + NOTVEN("COMPROBANTE"), + FACCOM("COMPROBANTE"), + LIQCOM("COMPROBANTE"); + + private String tipo; + private DetalleCatalogo detalle; + + private ComprobanteEnum(String tipo) { + this.tipo = tipo; + } + + public String getTipo() { + return tipo; + } + + public DetalleCatalogo getDetalle() { + if (this.detalle.getDetNemonico() == null && this.tipo != null) { + DaoGenerico dao = new DaoGenerico<>(DetalleCatalogo.class); + try { + this.detalle = new DetalleCatalogo(); + this.detalle.setDetNemonico(this.name()); + this.detalle.setDetTipo(tipo); + this.detalle = dao.buscarUnico(detalle); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO DETALLE CATALOGO " + ex); + } + } + return detalle; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/DetalleCatalogoEnum.java b/src/main/java/com/qsoft/erp/constantes/DetalleCatalogoEnum.java new file mode 100644 index 0000000..055d077 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/DetalleCatalogoEnum.java @@ -0,0 +1,70 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Catalogo; +import com.qsoft.erp.model.DetalleCatalogo; + +/** + * + * @author james + */ +public enum DetalleCatalogoEnum { + CED(2), RUC(2), PAS(2), + OTPREI(1), CRONCP(1), WSDL(1), + PASCPN(1), URLFIL(1), USRCPN(1), + COPMAI(1), URLPAS(1), DIAWS(1), + URLLIQ(1), URLPOL(1), URLREP(1), + URLACE(1), URLCBT(1), URLFPC(1), + REPLIQ(1), URLAGE(1), URLSMS(1), + STRAKY(1), + PTITU(12), HABIL(8), + ESINI(18), ESFIR(18), ESTBLO(18), + ESTACT(18), ESTAMO(18), ESTAOTP(18), + ESTAINA(18), ESTCAN(18), ESTCAD(18), + ESTSUS(18), + TIPLQPR(22), TIPLQRE(22), + ATAH(24), ATHE(24), ATHOS(24), + DEBCTA(38), PAGEFE(38), + I0079(25), TMM(11), TELEF(31), + TICAH(26),TICCO(26), TICTC(26), + PAG(32), PAG1(32), PAGM(32), PAGC(32), + ESTALI(23), ESTDI(23), ESTLI(23), + ESTAU(23), ESTLIC(23), ESTPAG(23), + ESTAFHI(40), ESTAFIN(40), ESTAFV(40); + + private DetalleCatalogo detalle; + + private Integer codigo; + + private DetalleCatalogoEnum(int codigo) { + this.codigo = codigo; + this.detalle = new DetalleCatalogo(); + } + + public Integer getCodigo() { + return codigo; + } + + public DetalleCatalogo getDetalle(){ + if (this.codigo != null) { + DaoGenerico dao = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo dc = new DetalleCatalogo(); + dc.setCatCodigo(new Catalogo(codigo)); + dc.setDetNemonico(this.name()); + try { + this.detalle = dao.buscarUnico(dc); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO DETALLE CATALOGO " + ex); + } + } + return detalle; + } + + +} diff --git a/src/main/java/com/qsoft/erp/constantes/DominioConstantes.java b/src/main/java/com/qsoft/erp/constantes/DominioConstantes.java new file mode 100644 index 0000000..cd97f88 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/DominioConstantes.java @@ -0,0 +1,143 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * + * @author james + */ +public class DominioConstantes { + + public final static Integer ROL_CLI = 5; + public static final String CIUDAD = "Quito"; + public static final String PERSONA = "PERSONA"; + public final static String POLIZA = "POLIZA"; + public final static String LIQUIDACION = "LIQUIDACION"; + public final static String JOBGROUP_NAME = "WMP_GROUP"; + public final static String TRIGGER_NAME = "CPN_TRIGGER"; + public final static String TGGROUP_NAME = "WMP_GROUP"; + public final static String JOB_NAME = "CPNJob"; + public final static String ACTUALIZAR = "-Actualizar-"; + public final static String PERIODICIDAD = "PERIODICIDAD"; + public final static Integer DIAS_COBERTURA = 365; + public final static String FORMATO_FECHA_FRONT = "yyyy-MM-dd HH:mm:ss"; + public final static String FORMATO_FECHA_HORA = "dd/MM/yyyy HH:mm:ss"; + public final static String FORMATO_BDD = "yyyy-MM-dd HH:mm:ss"; + public final static String FORMATO_FECHA = "dd/MM/yyyy"; + public final static String FECHA_OBSERVACION_FORMATO = "yyyy-MM-dd"; + public final static String FECHA_AÑO = "yyyy"; + + public static final SimpleDateFormat FORMAT_DT = new SimpleDateFormat(FORMATO_FECHA_HORA); + public static final SimpleDateFormat FORMAT_D = new SimpleDateFormat(FORMATO_FECHA); + public static final SimpleDateFormat FORMAT_DB = new SimpleDateFormat(FORMATO_BDD); + public static final SimpleDateFormat FORMAT_OBS = new SimpleDateFormat(FECHA_OBSERVACION_FORMATO); + public static final SimpleDateFormat FORMAT_AÑO_SDF = new SimpleDateFormat(FECHA_AÑO); + + public static final String TIPO_AGENDA = "tipoAgendamiento"; + public static final String BENEFICIARIO = "perBeneficiario"; + public static final String POL_CODIGO = "polCodigo"; + public static final String COBERTURA = "copCodigo"; + public static final String USUARIO = "user"; + public static final String EXISTENCIAS = "existencias"; + public static final String PASSWORD = "password"; + public static final String TOKEN = "token"; + public static final String OTP = "otp"; + public static final String EMAIL = "email"; + public static final String SEPARADOR = ":"; + public static final String RESET = "RESET"; + public static final String WE_SECRET_KEY = "QSoft2020&EnigmaBuilWeMedicalProKey"; + public static final Short ACTIVO = 1; + public static final Integer REINTENTOS_OTP = 3; + public static final Integer TOPE_MESES_MORA = 3; + public static final Integer DELAY_JOB = 60000; + public static final Integer CPN = 2; + public static final Long MES_MILIS = 2592000000l; ///un mes en milisegundos + public static final Integer TIEMPO_RESET = 86400; //24 horas en segundos + public static final Short INACTIVO = 0; + public static final Short CANCELADO = 2; + public static final String NO_INFO = "No posee información bancaria"; + public static final String ESTADO_INI = "ESTADO FINANCIERO INICIAL"; + public static final String NOMBRE_APP = "USUARIO APP"; + public static final String APELLIDO_APP = "APELLIDOS APP"; + public static final String NACIONALIDAD = "ECUATORIANO"; + public static final String DATO_AUTO = "DATO CARGADO DESDE EL SISTEMA"; + public static final String DATO_MASIVO_POLIZA = "DATO CARGADO DESDE EL SISTEMA - MASIVO POLIZA"; + + public static final String MENSAJE_AUTO = "LIQUIDACION ABIERTA AFILIADO"; + public static final String PARAMETRO_URL = "URL_TOKEN"; + public static final String DESCRIPCION_POLIZA = "INACTIVA - POLIZA CREADA"; + public static final String DESCRIPCION_POLIZA_ACTIVA = "POLIZA ACTIVO - POLIZA CREADA"; + public static final String DESCRIPCION_POLIZA_SUSPENDIDA_BATCH = "POLIZA SUSPENDIDA AUTOMATICO - EXCEDE LA EDAD %s"; + public static final String DESCRIPCION_POLIZA_FALTA_PAGO = "POLIZA SUSPENDIDA AUTOMATICO - ADEUDA %s CUOTAS POR UN VALOR DE %S"; + public static final String DESCRIPCION_POLIZA_CADUCADA = "POLIZA VENCIDA AUTOMATICO"; + + public static final String ORIGEN_POLIZA = "APP-CARIDEL"; + public static final String DESCRIPCION_POLIZA_AC = "ACTIVA - POLIZA CREADA PAGO CPN"; + public static final String URL_CARIDEL = "https://salud.caridel.net/"; + public static final String CARIDEL = "MEDI-MEDICINA PREPAGADA"; + public static final String MAIL_CARIDEL = "notificaciones@segurosmedi.com"; + public static final String URL_WMP = "http://wmp.qsoftec.com/"; + public final static Integer CONSULTA = 1; + public final static Integer COUNT = 2; + public final static Integer IMAGEN = 3; + public final static Integer ARCHIVOS_MASIVO = 4; /*--------> de momento solo por liquidacion*/ + + public final static String IMAGE = "/data/wmp/poliza/logo.png"; + public final static String FONDO = "/data/wmp/poliza/fondo.png"; + public final static String FONDOV = "/data/wmp/poliza/fondov.png"; + public final static String FORMA_PAGO = "DEBITO BANCARIO"; + public final static String PAG_OBSERVACION_DEBITO = "DEBITO"; + public final static String PAG_OBSERVACION_TARJETA_CREDITO = "TARJETA DE CRÉDITO"; + + public static String getDateTime() { + return DominioConstantes.FORMAT_DT.format(new Date()); + } + + public static String getDate() { + return DominioConstantes.FORMAT_D.format(new Date()); + } + + public static String getBddDate() { + return DominioConstantes.FORMAT_DB.format(new Date()); + } + + public static String getBddDate(Date date) { + return DominioConstantes.FORMAT_DB.format(date); + } + + public static String getDateTime(Date fecha) { + return DominioConstantes.FORMAT_DT.format(fecha); + } + + public static String getDate(Date fecha) { + return DominioConstantes.FORMAT_D.format(fecha); + } + + public static Date getDateTime(String fecha) { + Date resul = null; + try { + resul = DominioConstantes.FORMAT_DT.parse(fecha); + } catch (ParseException ex) { + resul = getDate(fecha); + } + return resul; + } + + public static Date getDate(String fecha) { + Date resul = null; + try { + resul = DominioConstantes.FORMAT_D.parse(fecha); + } catch (ParseException ex) { + ex.printStackTrace(System.err); + } + return resul; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/EntidadEnum.java b/src/main/java/com/qsoft/erp/constantes/EntidadEnum.java new file mode 100644 index 0000000..013098d --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/EntidadEnum.java @@ -0,0 +1,88 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; +import com.qsoft.erp.dto.*; +import com.qsoft.erp.dominio.mapper.*; +import com.qsoft.erp.model.*; + +/** + * + * @author james + */ +public enum EntidadEnum { + Agendamiento(Agendamiento.class, AgendamientoDTO.class, AgendamientoMapper.class), + EstadoAgendamiento(EstadoAgendamiento.class, EstadoAgendamientoDTO.class, EstadoAgendamientoMapper.class), + Catalogo(Catalogo.class, CatalogoDTO.class, CatalogoMapper.class), + CuentaBancaria(CuentaBancaria.class, CuentaBancariaDTO.class, CuentaBancariaMapper.class), + CoberturasPlan(CoberturasPlan.class, CoberturasPlanDTO.class, CoberturasPlanMapper.class), + Opcion(Opcion.class, OpcionDTO.class, OpcionMapper.class), + Liquidacion(Liquidacion.class, LiquidacionDTO.class, LiquidacionMapper.class), + EstadoLiquidacion(EstadoLiquidacion.class, EstadoLiquidacionDTO.class, EstadoLiquidacionMapper.class), + Documento(Documento.class, DocumentoDTO.class, DocumentoMapper.class), + DetalleLiquidacion(DetalleLiquidacion.class, DetalleLiquidacionDTO.class, DetalleLiquidacionMapper.class), + Empresa(Empresa.class, EmpresaDTO.class, EmpresaMapper.class), + DetalleCatalogo(DetalleCatalogo.class, DetalleCatalogoDTO.class, DetalleCatalogoMapper.class), + UsuarioPassword(UsuarioPassword.class, UsuarioPasswordDTO.class, UsuarioPasswordMapper.class), + Privilegio(Privilegio.class, PrivilegioDTO.class, PrivilegioMapper.class), + Persona(Persona.class, PersonaDTO.class, PersonaMapper.class), + PersonaPoliza(PersonaPoliza.class, PersonaPolizaDTO.class, PersonaPolizaMapper.class), + Telefono(Telefono.class, TelefonoDTO.class, TelefonoMapper.class), + Tarifario(Tarifario.class, TarifarioDTO.class, TarifarioMapper.class), + TarifaLiquidacion(TarifaLiquidacion.class, TarifaLiquidacionDTO.class, TarifaLiquidacionMapper.class), + Rol(Rol.class, RolDTO.class, RolMapper.class), + Formulario(Formulario.class, FormularioDTO.class, FormularioMapper.class), + Plan(Plan.class, PlanDTO.class, PlanMapper.class), + PlanBroker(PlanBroker.class, PlanBrokerDTO.class, PlanBrokerMapper.class), + Poliza(Poliza.class, PolizaDTO.class, PolizaMapper.class), + Prestador(Prestador.class, PrestadorDTO.class, PrestadorMapper.class), + Pago(Pago.class, PagoDTO.class, PagoMapper.class), + Usuario(Usuario.class, UsuarioDTO.class, UsuarioMapper.class), + Email(Email.class, EmailDTO.class, EmailMapper.class), + Honorario(Honorario.class, HonorarioDTO.class, HonorarioMapper.class), + HonorarioPlan(HonorarioPlan.class, HonorarioPlanDTO.class, HonorarioPlanMapper.class), + PlantillaSmtp(PlantillaSmtp.class, PlantillaSmtpDTO.class, PlantillaSmtpMapper.class), + Localizacion(Localizacion.class, LocalizacionDTO.class, LocalizacionMapper.class), + Otp(Otp.class, OtpDTO.class, OtpMapper.class), + RolUsuario(RolUsuario.class, RolUsuarioDTO.class, RolUsuarioMapper.class), + Servicios(Servicios.class, ServiciosDTO.class, ServiciosMapper.class), + SucursalEmpresa(SucursalEmpresa.class, SucursalEmpresaDTO.class, SucursalEmpresaMapper.class), + Plantilla(Plantilla.class, PlantillaDTO.class, PlantillaMapper.class), + Mensaje(Mensaje.class, MensajeDTO.class, MensajeMapper.class), + Parametro(Parametro.class, ParametroDTO.class, ParametroMapper.class), + Secuencia(Secuencia.class, SecuenciaDTO.class, SecuenciaMapper.class), + Auditoria(Auditoria.class, AuditoriaDTO.class, AuditoriaMapper.class), + VwUsuarioPersonaPolizaPlan(VwUsuarioPersonaPolizaPlan.class, VwUsuarioPersonaPolizaPlanDTO.class, VwUsuarioPersonaPolizaPlanMapper.class), + VwPolPerBan(VwPolPerBan.class, VwPolPerBanDTO.class, VwPolPerBanMapper.class), + VwLiqperpol(VwLiqperpol.class, VwLiqperpolDTO.class, VwLiqperpolMapper.class), + VwLiqto(VwLiqto.class, VwLiqtoDTO.class, VwLiqtoMapper.class), + VwRepprimaPlan(VwRepprimaPlan.class, VwRepprimaPlanDTO.class, VwRepprimaPlanMapper.class), + VwPagosCpn(VwPagosCpn.class, VwPagosCpnDTO.class, VwPagosCpnMapper.class), + VwReporteProduccion(VwReporteProduccion.class, VwReporteProduccionDTO.class, VwReporteProduccionMapper.class), + VwPrestacionesPlan(VwPrestacionesPlan.class, VwPrestacionesPlanDTO.class, VwPrestacionesPlanMapper.class),; + + private final Class entidad; + private final Class dto; + private final Class mapper; + + private EntidadEnum(Class entidad, Class dto, Class mapper) { + this.entidad = entidad; + this.dto = dto; + this.mapper = mapper; + } + + public Class getEntidad() { + return entidad; + } + + public Class getDto() { + return dto; + } + + public Class getMapper() { + return mapper; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/EstadoLiquidacionEnum.java b/src/main/java/com/qsoft/erp/constantes/EstadoLiquidacionEnum.java new file mode 100644 index 0000000..113d5f9 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/EstadoLiquidacionEnum.java @@ -0,0 +1,169 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.RolUsuario; +import com.qsoft.erp.model.Usuario; +import java.util.List; + +/** + * + * @author james + */ +public enum EstadoLiquidacionEnum { + + ESTALI(1, "CLI"), + ESTLI(2, "LIQUI"), + ESTAU(3, "AUD"), + ESTLQC(4, "LIQUI"), + ESTLIC(5, "CONT"), + ESTPAG(6, "CONT"), + ESTFIN(7 , "LIQUI"), + ESTCAN(-1, "LIQUI"); + + private static final String TIPO = "ESTADOLIQ"; + + private static List estados; + + private final Integer orden; + private final String rolNemonico; + + private EstadoLiquidacionEnum(int codigo, String rolNemonico) { + this.orden = codigo; + this.rolNemonico =rolNemonico; + } + + public Integer getOrden() { + return orden; + } + + /** + * + * @param detCodigo + * @param avanza + * @return + */ + public static DetalleCatalogo getSiguiente(int detCodigo, boolean avanza) { + DetalleCatalogo estado = null; + int nuevo = Integer.parseInt(getDetalleCodigo(detCodigo).getDetOrigen()); + if (avanza) { + nuevo++; + } else { + nuevo--; + } + for (DetalleCatalogo de : getEstados()) { + if (de.getDetOrigen().equalsIgnoreCase("" + nuevo)) { + estado = de; + break; + } + } + return estado; + } + + public String getRolNemonico() { + return rolNemonico; + } + + private static List getEstados() { + if (estados == null || estados.isEmpty()) { + try { + DaoGenerico dao = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo plantilla = new DetalleCatalogo(); + plantilla.setDetTipo(TIPO); + plantilla.setDetEstado(DominioConstantes.ACTIVO); + estados = dao.buscarLista(plantilla); + } catch (DaoException ex) { + System.out.println("Error cargando estados de poliza " + ex); + } + } + return estados; + } + + /** + * + * @param detCodigo + * @return + */ + public static DetalleCatalogo getDetalleCodigo(int detCodigo) { + DetalleCatalogo detalle = null; + for (DetalleCatalogo de : getEstados()) { + if (de.getDetCodigo() == detCodigo) { + detalle = de; + } + } + return detalle; + } + + /** + * + * @return + */ + public DetalleCatalogo getDetalleOrden() { + DetalleCatalogo detalle = null; + if (this.orden != null) { + for (DetalleCatalogo de : getEstados()) { + if (de.getDetOrigen().equalsIgnoreCase("" + this.orden)) { + detalle = de; + } + } + } + return detalle; + } + + /** + * + * @return + */ + public DetalleCatalogo getDetalleNemonico() { + DetalleCatalogo detalle = null; + if (this.orden != null) { + for (DetalleCatalogo de : getEstados()) { + if (de.getDetNemonico().equalsIgnoreCase(this.name())) { + detalle = de; + } + } + } + return detalle; + } + + /** + * + * @return + */ + public DetalleCatalogo getDetalle() { + DetalleCatalogo detalle = null; + if (this.name() != null) { + for (DetalleCatalogo de : getEstados()) { + if (de.getDetNemonico().equals(this.name())) { + detalle = de; + } + } + } + return detalle; + } + + /** + * + * @return + */ + public Usuario getUsuarioGenerico(){ + DaoGenerico dao = new DaoGenerico<>(RolUsuario.class); + String query = String.format(QueryEnum.USUGEN.getParametro().getParValor(), rolNemonico); + List usuarios = dao.ejecutarConsultaNativaList(query); + Usuario usuario = new Usuario(); + for(Fila fila: usuarios){ + if (fila.getEntero(0) != null){ + usuario.setUsuCodigo(fila.getEntero(0)); + } + } + return usuario; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/ParametroEnum.java b/src/main/java/com/qsoft/erp/constantes/ParametroEnum.java new file mode 100644 index 0000000..34d2ce8 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/ParametroEnum.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Parametro; + +/** + * + * @author james + */ +public enum ParametroEnum { + OTPUSR(13), REIN(-8), + CAD(-7), FALL(-6), + ENV(-5), PRO(-4), + ENC(-3), REG(-2), + OTPREI(-27), OPTOK(-26), + OTPFAL(-25), OTPCAD(-24), + OTPNOT(-23), OTPCOL(-22), + OTPGEN(-21); + + private Parametro parametro; + private final Integer codigo; + + private ParametroEnum(Integer codigo) { + this.codigo = codigo; + this.parametro = new Parametro(codigo); + } + + public Integer getCodigo() { + return codigo; + } + + public Parametro getParametro() { + if (parametro.getParNemonico() == null && this.codigo != null) { + DaoGenerico dao = new DaoGenerico<>(Parametro.class); + try { + this.parametro = dao.cargar(this.codigo); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO PARAMETRO " + ex); + } + } + return this.parametro; + } +} diff --git a/src/main/java/com/qsoft/erp/constantes/PlantillaEnum.java b/src/main/java/com/qsoft/erp/constantes/PlantillaEnum.java new file mode 100644 index 0000000..b484b0c --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/PlantillaEnum.java @@ -0,0 +1,73 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Plantilla; +import java.util.TreeMap; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author james + */ +public enum PlantillaEnum { + NOTFAC(1), NOTOTP(2), + NOTCAR(3), NOTRES(4), + NOTPOL(5), NOTLQG(6), + NOTLQO(7), NOTLQE(8), + NOTAPO(9), SMSAPO(10), + NOTPOM(13), NOTANP(14) + ; + + private Plantilla plantilla; + private final Integer codigo; + private TreeMap parametros; + + private PlantillaEnum(Integer codigo) { + this.codigo = codigo; + this.plantilla = new Plantilla(codigo); + } + + public Integer getCodigo() { + return codigo; + } + + /** + * + * @return + */ + public Plantilla getPlantilla() { + if (plantilla.getPlaNemonico() == null && this.codigo != null) { + DaoGenerico dao = new DaoGenerico<>(Plantilla.class); + try { + this.plantilla = dao.cargar(this.codigo); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO PLANTILLA " + ex); + } + } + return this.plantilla; + } + + /** + * + * @return + */ + public TreeMap getParametros() { + ObjectMapper obj = new ObjectMapper(); + try { + this.parametros = obj.readValue(this.getPlantilla().getPlaParametros(), TreeMap.class); + } catch (JsonProcessingException ex) { + Logger.getLogger(PlantillaEnum.class.getName()).log(Level.SEVERE, null, ex); + } + return parametros; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/QueryEnum.java b/src/main/java/com/qsoft/erp/constantes/QueryEnum.java new file mode 100644 index 0000000..be0209a --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/QueryEnum.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Parametro; + +/** + * + * @author james + */ +public enum QueryEnum { + LOGIN, USULIQ, USUGEN, AUDINS, LIQTOT, LIQPOL, + LOGIN2, LOGROL, AGEVAL, AGELIQ, AGELCO; + + private static final String TIPO = "QUERY"; + private Parametro parametro; + + private QueryEnum() { + } + + public Parametro getParametro() { + Parametro p = new Parametro(); + p.setParTipo(TIPO); + p.setParNemonico(this.name()); + DaoGenerico dao = new DaoGenerico<>(Parametro.class); + try { + this.parametro = dao.buscarUnico(p); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO PARAMETRO " + ex); + } + + return this.parametro; + } + + public String getQuery(){ + Parametro par = this.getParametro(); + return par != null? par.getParValor(): null; + } + +} diff --git a/src/main/java/com/qsoft/erp/constantes/SecuenciaEnum.java b/src/main/java/com/qsoft/erp/constantes/SecuenciaEnum.java new file mode 100644 index 0000000..997949e --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/SecuenciaEnum.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +/** + * + * @author james + */ +public enum SecuenciaEnum { + FAV001, FAV002, FAV003, + AGEMED, + POLMED, LIQMED, PAGMED; + +} diff --git a/src/main/java/com/qsoft/erp/constantes/TransaccionEnum.java b/src/main/java/com/qsoft/erp/constantes/TransaccionEnum.java new file mode 100644 index 0000000..a781103 --- /dev/null +++ b/src/main/java/com/qsoft/erp/constantes/TransaccionEnum.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.constantes; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.DetalleCatalogo; + +/** + * + * @author james + */ +public enum TransaccionEnum { + CONSUL("0101000"), ACCION("0101100"), + LOGIN("0101001"), RECPASS("0101002"), RESPASS("0101005"), + ENVOTP("0101003"), VALOTP("0101004"), + ALIQUI("0101110"),DETLIQ("0101102"), CLIQUI("0101111"), + PERPOL("0101101"), REPORTE("0101010"), + VALPER("0101011"), CUENTA("0101012"), AGEVAL("0101013"), + POLIZA("0101112"), STRIPE("0101150"), STRSUS("0101151"), + PERSONA("0101113"), AGENDA("0101114"), PLAN("0101115"), + USER("0101116"), DOCUM("0101117"), CSVPAG("0101118"), CSVPPP("0101119"), CSVSIN("0101120"), CONDOC("0101121"), CSVPOC("0101122"), CSVPCR("0101123"), + NOTIFI("0101130"); + + private final static String tipo = "TRANSACCION"; + + private DetalleCatalogo detalle; + + private final String codigo; + + private TransaccionEnum(String codigo) { + this.codigo = codigo; + } + + public String getCodigo() { + return codigo; + } + + public DetalleCatalogo getDetalle() { + if (this.detalle.getDetNemonico() == null && this.codigo != null) { + DaoGenerico dao = new DaoGenerico<>(DetalleCatalogo.class); + try { + this.detalle = new DetalleCatalogo(); + this.detalle.setDetNemonico(this.name()); + this.detalle.setDetTipo(tipo); + this.detalle = dao.buscarUnico(detalle); + } catch (DaoException ex) { + System.out.println("ERROR CARGANDO DETALLE CATALOGO " + ex); + } + } + return detalle; + } +} diff --git a/src/main/java/com/qsoft/erp/dominio/AccionGenerica.java b/src/main/java/com/qsoft/erp/dominio/AccionGenerica.java new file mode 100644 index 0000000..1b65aa0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/AccionGenerica.java @@ -0,0 +1,252 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio; + +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.constantes.TransaccionEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.AgendamientoMapper; +import com.qsoft.erp.dominio.mapper.DetalleLiquidacionMapper; +import com.qsoft.erp.dominio.mapper.EmailMapper; +import com.qsoft.erp.dominio.mapper.PersonaMapper; +import com.qsoft.erp.dominio.mapper.PersonaPolizaMapper; +import com.qsoft.erp.dominio.mapper.PlanMapper; +import com.qsoft.erp.dominio.mapper.PolizaMapper; +import com.qsoft.erp.dominio.mapper.UsuarioMapper; +import com.qsoft.erp.dominio.transaccion.Stripe; +import com.qsoft.erp.dominio.transaccion.UsuarioTransaccion; +import com.qsoft.erp.dominio.util.AgendaUtil; +import com.qsoft.erp.dominio.util.LiquidacionUtil; +import com.qsoft.erp.dominio.util.NotificadorUtil; +import com.qsoft.erp.dominio.util.PersonaUtil; +import com.qsoft.erp.dominio.util.PlanUtil; +import com.qsoft.erp.dominio.util.PolizaUtil; +import com.qsoft.erp.model.Agendamiento; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.Email; +import com.qsoft.erp.model.Pago; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Plan; +import java.io.IOException; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Usuario; +import com.stripe.exception.StripeException; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; + +/** + * + * @author james + */ +@Stateless +public class AccionGenerica { + + public final static int CONSULTA = 0x000; + public final static int GUARDA = 0x001; + public final static int ACTUALIZA = 0x002; + public final static int ELIMINA = 0x003; + public final static int CANCELA = 0x005; + public final static int GUARDA_ONSITE = 0x006; + public final static int ACTUALIZA_ONSITE = 0x007; + + @EJB + private PersonaUtil personaUtil; + + @EJB + private DominioUtil dominioUtil; + + @EJB + private PolizaUtil polizaUtil; + + @EJB + private Stripe stripeUtil; + + @EJB + private PlanUtil planUtil; + + @EJB + private AgendaUtil agendaUtil; + + @EJB + private UsuarioTransaccion usuarioTransaccion; + + @EJB + private LiquidacionUtil liquidacionUtil; + + @EJB + private NotificadorUtil notificadorUtil; + + /** + * select * from LOCALIZACION WHERE LOC_PADRE = 9 + * + * @param header + * @param entidad + * @param entidades + * @param tipoAccion + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public List accionGenerica(HeaderMS header, EntidadEnum entidad, List> entidades, int tipoAccion) throws DominioExcepcion, IOException, StripeException, DaoException { + List data = new ArrayList<>(); + String tipoTransaccion = header.getTipoTransaccion() != null ? header.getTipoTransaccion() : "000000"; + if (TransaccionEnum.PERPOL.getCodigo().equals(tipoTransaccion)) { + for (PersonaPoliza perpol : this.personaUtil.crearPersonaPoliza(header, entidades, tipoAccion)) { + data.add(PersonaPolizaMapper.INSTANCE.getDto(perpol)); + } + } else if (TransaccionEnum.DETLIQ.getCodigo().equals(tipoTransaccion)) { + for (DetalleLiquidacion det : this.liquidacionUtil.procesarDetalleLiquidacion(header, entidades, tipoAccion)) { + data.add(DetalleLiquidacionMapper.INSTANCE.getDto(det)); + } + } else if (TransaccionEnum.PERSONA.getCodigo().equals(tipoTransaccion)) { + for (Persona p : this.personaUtil.procesarPersona(header, entidades, tipoAccion)) { + data.add(PersonaMapper.INSTANCE.getDto(p)); + } + } else if (TransaccionEnum.USER.getCodigo().equals(tipoTransaccion)) { + for (Usuario object : this.usuarioTransaccion.procesarUsuario(header, entidades, tipoAccion)) { + data.add(UsuarioMapper.INSTANCE.getDto(object)); + } + } else if (TransaccionEnum.POLIZA.getCodigo().equals(tipoTransaccion)) { + for (Poliza pol : this.polizaUtil.procesarPoliza(header, entidades, tipoAccion)) { + data.add(PolizaMapper.INSTANCE.getDto(pol)); + } + } else if (TransaccionEnum.NOTIFI.getCodigo().equals(tipoTransaccion)) { + for (Email object : this.notificadorUtil.notificar(header, entidades, tipoAccion)) { + data.add(EmailMapper.INSTANCE.getDto(object)); + } + } else if (TransaccionEnum.AGENDA.getCodigo().equals(tipoTransaccion)) { + for (Agendamiento agenda : this.agendaUtil.procesarAgenda(header, entidades, tipoAccion)) { + data.add(AgendamientoMapper.INSTANCE.getDto(agenda)); + } + } else if (TransaccionEnum.STRIPE.getCodigo().equals(tipoTransaccion)) { + Map generate = this.stripeUtil.generatePayment(header, entidades, tipoAccion); + data.add(generate); + } else if (TransaccionEnum.STRSUS.getCodigo().equals(tipoTransaccion)) { + Map generate = this.stripeUtil.generatePayment(header, entidades, tipoAccion); + data.add(generate); + } else if (TransaccionEnum.PLAN.getCodigo().equals(tipoTransaccion)) { + for (Plan p : this.planUtil.procesarPlan(header, entidades, tipoAccion)) { + data.add(PlanMapper.INSTANCE.getDto(p)); + } + } else if (TransaccionEnum.ACCION.getCodigo().equals(tipoTransaccion)) { + for (Map ent : entidades) { + Serializable objeto = (Serializable) dominioUtil.getEntidad(entidad.getMapper(), + dominioUtil.crearObjeto(entidad.getDto(), ent)); + Object res = afectaBdd(header, tipoAccion, entidad, objeto); + if (res != null) { + data.add(dominioUtil.getDto(entidad.getMapper(), res)); + } + } + } + else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "No existe una transaccion asociada al codigo " + header.getTipoTransaccion()); + } + + return data; + } + + //entrada.getReceta(), entrada.getRec_items(), entrada.getRec_facturacion(), entrada.getRec_credito(), entrada.getTipo_facturacion() + public Map accionFarmaenlace(Map receta, List> rec_itemas, Map rec_facturacion, Map rec_credito, String tipo_facturacion) throws DominioExcepcion { + Map results = new HashMap(); + results.put("receta", receta); + results.put("rec_items", rec_itemas); + results.put("rec_facturacion", rec_facturacion); + results.put("rec_credito", rec_credito); + results.put("tipo_facturacion", tipo_facturacion); + return results; + } + + /** + * + * @param tipoAccion + * @param dao + * @param objeto + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private Object afectaBdd(HeaderMS header, int tipoAccion, EntidadEnum entidad, Serializable objeto) throws DominioExcepcion { + DaoGenerico dao = dominioUtil.generarDao(entidad); + if (dao == null) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_DAO_NULO, "No se puede establecer la conexion a BDD"); + } + Object en = null; + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para este controlador"); + } +// break; + case GUARDA: { + en = procesaTransaccionGuardar(header, dao, objeto); + } + break; + case ACTUALIZA: { + try { + if (en instanceof Pago) { + Pago p = (Pago) en; + if (p.getPagFechaPago() == null) { + p.setPagFechaPago(new Date()); + } + } + en = dao.actualizar(objeto); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no implementada"); + } +// break; + } + return en; + } + + /** + * + * @param header + * @param dao + * @param entidad + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public Object procesaTransaccionGuardar(HeaderMS header, DaoGenerico dao, Serializable entidad) throws DominioExcepcion { + try { + for (Field f : entidad.getClass().getDeclaredFields()) { + if (f != null && Date.class.isAssignableFrom(f.getType()) + && f.getName().toLowerCase().endsWith("fecharegistro")) { + Boolean acces = f.canAccess(entidad); + f.setAccessible(Boolean.TRUE); + f.set(entidad, new Date()); + f.setAccessible(acces); + } + } + dao.guardar(entidad); + } catch (DaoException | IllegalArgumentException | IllegalAccessException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + return entidad; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/ConsultaGenerica.java b/src/main/java/com/qsoft/erp/dominio/ConsultaGenerica.java new file mode 100644 index 0000000..d891c83 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/ConsultaGenerica.java @@ -0,0 +1,404 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio; + +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.dao.util.Valor; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.TransaccionEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.transaccion.UsuarioTransaccion; +import com.qsoft.erp.dominio.util.DBUtil; +import com.qsoft.erp.dominio.util.PolizaUtil; +import com.qsoft.erp.dominio.util.LiquidacionUtil; +import com.qsoft.erp.dto.DetalleCatalogoDTO; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Parametro; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.reportes.PoiExport; +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.ejb.EJB; +import javax.ejb.Stateless; + +/** + * + * @author james + */ +@Stateless +public class ConsultaGenerica { + + @EJB + private UsuarioTransaccion usuarioTransaccion; + + @EJB + private DominioUtil dominioUtil; + + @EJB + private PolizaUtil polizaUtil; + + @EJB + private DBUtil dBUtil; + + @EJB + private LiquidacionUtil liquidacionUtil; + + /** + * select * from LOCALIZACION WHERE LOC_PADRE = 9 + * + * @param header + * @param nombreEntidad + * @param parametros + * @param orden + * @param maxRegistros + * @param inicio + * @param tipo + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public List consultaGenerica(HeaderMS header, String nombreEntidad, Map parametros, List orden, + Integer maxRegistros, Integer inicio, Integer tipo) throws DominioExcepcion { + String tipoTransaccion = header.getTipoTransaccion() != null ? header.getTipoTransaccion() : "000000"; + List data = new ArrayList(); + + if (TransaccionEnum.REPORTE.getCodigo().equals(tipoTransaccion)) { + data = this.generaReporte(nombreEntidad, parametros, tipo); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "No existen datos para el query solicitado"); + } + } else { + EntidadEnum entidad = null; + try { + entidad = Enum.valueOf(EntidadEnum.class, nombreEntidad); + } catch (Exception e) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "No se puede identificar la entidad a la cual se desea acceder" + e.toString()); + } + DaoGenerico dao = dominioUtil.generarDao(entidad, maxRegistros); + if (dao == null) { + System.out.println("=> ERROR FATAL EL DAO ES NULO "); + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_DAO_NULO, "No se puede establecer la conexion a BDD"); + } else { + try { + data = procesarConsulta(header, dao, entidad, parametros, orden, inicio, tipo, tipoTransaccion); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, ex.toString()); + } + } + } + return data; + } + + /** + * + * @param transaccion + * @return + */ + public List consultaGet(String cedula, String diagnostico) throws DominioExcepcion, DaoException { + List data = new ArrayList(); + data = procesarConsultaDatos(cedula, diagnostico); + return data; + } + + /** + * + * @param cedula + * @param diagnostico + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + private List procesarConsultaDatos(String cedula, String diagnostico) throws DominioExcepcion, DaoException { + List data = new ArrayList(); + data = this.polizaUtil.obtenerTitularDependienteFarma(cedula, diagnostico); + return data; + } + + /** + * + * @param header + * @param dao + * @param entidad + * @param parametros + * @param inicio + * @param tipoConsulta + * @param tipoTransaccion + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + private List procesarConsulta(HeaderMS header, DaoGenerico dao, EntidadEnum entidad, Map parametros, + List orden, Integer inicio, Integer tipoConsulta, String tipoTransaccion) throws DominioExcepcion, DaoException { + List data = new ArrayList(); + if(TransaccionEnum.CONDOC.getCodigo().equals(tipoTransaccion)){ + if(parametros.containsKey("liqCodigo")){ + Integer liqCodigo = Integer.parseInt(parametros.get("liqCodigo").toString()); + data.add(liquidacionUtil.obtenerTodosDocumentosLiquidacion(liqCodigo)); + } + } + else if ("0101666".equals(tipoTransaccion)) { + data = this.usuarioTransaccion.login2(header, dao, + parametros.get(DominioConstantes.USUARIO).toString().trim(), parametros.get(DominioConstantes.PASSWORD).toString().trim()); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "Verifique que el usuario y contraseña sean válidos"); + } + } else if (TransaccionEnum.LOGIN.getCodigo().equals(tipoTransaccion)) { + data = this.usuarioTransaccion.login(header, dao, + parametros.get(DominioConstantes.USUARIO).toString().trim(), parametros.get(DominioConstantes.PASSWORD).toString().trim()); + + + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "Verifique que el usuario y contraseña sean válidos"); + } + } else if (TransaccionEnum.AGEVAL.getCodigo().equals(tipoTransaccion)) { + String tipo = this.getValueString(parametros, DominioConstantes.TIPO_AGENDA); + String beneficiario = this.getValueString(parametros, DominioConstantes.BENEFICIARIO); + String poliza = this.getValueString(parametros, DominioConstantes.POL_CODIGO); + String cobertura = "" + this.getValue(parametros, DominioConstantes.COBERTURA); + + data = this.dBUtil.getValoresAgenda(header, tipo, beneficiario, poliza, cobertura); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "No se encontraron datos para la consulta"); + } + } else if (TransaccionEnum.RECPASS.getCodigo().equals(tipoTransaccion)) { + data = this.usuarioTransaccion.recuperaPassword(header, dao, + parametros.get(DominioConstantes.USUARIO).toString().trim(), parametros.get(DominioConstantes.EMAIL).toString().trim()); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "No existe ningun usuario que coincida"); + } + } else if (TransaccionEnum.ENVOTP.getCodigo().equals(tipoTransaccion)) { + data = this.usuarioTransaccion.enviaOtp(header, dao, parametros.get(DominioConstantes.USUARIO).toString().trim()); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "Ha ocurrido un error en el envio de OTP"); + } + } else if (TransaccionEnum.VALOTP.getCodigo().equals(tipoTransaccion)) { + data = this.usuarioTransaccion.validaOtp(header, dao, parametros.get( + DominioConstantes.USUARIO).toString(), parametros.get(DominioConstantes.OTP).toString().trim()); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "Error en validacion de OTP"); + } + } else if (TransaccionEnum.RESPASS.getCodigo().equals(tipoTransaccion)) { + data = this.usuarioTransaccion.cambiaPassword(header, dao, parametros.get( + DominioConstantes.TOKEN).toString().trim(), parametros.get(DominioConstantes.PASSWORD).toString().trim()); + if (data == null || data.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "No existe ningun usuario que coincida"); + } + } else if (TransaccionEnum.VALPER.getCodigo().equals(tipoTransaccion)) { + Persona plantilla = (Persona) dominioUtil.getEntidad(entidad.getMapper(), dominioUtil.crearObjeto(entidad.getDto(), parametros)); + + if (this.polizaUtil.existePoliza(plantilla.getPerIdentificacion(), plantilla.getDetTipoIdentificacion().getDetCodigo(), plantilla.getPerCodigo())) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "Error el cliente " + + plantilla.getPerIdentificacion() + " ya posee una poliza activa no se modificara la informacion actual"); + } + if(!this.polizaUtil.evaluarSiniestrado(plantilla.getPerIdentificacion())){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD,String.format("Socio %s identificado como 'Socio siniestroso', no tiene permitido relacionar una poliza al mismo", plantilla.getPerIdentificacion()) ); + } + try { + data = consultar(dao, plantilla, entidad, orden, inicio, tipoConsulta); + } catch (DaoException ex) { + ex.printStackTrace(System.err); + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, ex.toString()); + } + } else if (TransaccionEnum.CONSUL.getCodigo().equals(tipoTransaccion)) { + Serializable plantilla = (Serializable) dominioUtil.getEntidad(entidad.getMapper(), + dominioUtil.crearObjeto(entidad.getDto(), parametros)); + try { + data = consultar(dao, plantilla, entidad, orden, inicio, tipoConsulta); + } catch (DaoException ex) { + ex.printStackTrace(System.err); + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, ex.toString()); + } + } else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "No existe una transaccion asociada al codigo " + header.getTipoTransaccion()); + } + return data; + } + + /** + * + * @param nemonico + * @param parametros + * @param tipo + * @return + * @throws DominioExcepcion + */ + public List generaReporte(String nemonico, Map parametros, int tipo) throws DominioExcepcion { + List data = new ArrayList(); + Parametro param = this.dominioUtil.getParametro(nemonico, DominioUtil.TIPO_QUERY); + if (param == null || param.getParValor() == null || param.getParValor().trim().isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No existe consulta asociada al codigo solicitado"); + } + String query = param.getParValor(); + String[] labels; + for (Object s : parametros.values()) { + query = query.replaceFirst("%s", s.toString()); + } + + DaoGenerico dao = new DaoGenerico<>(Parametro.class); + List result = dao.ejecutarConsultaNativaList(query); + if (result == null || result.isEmpty()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "La consulta no arrojo resultados"); + } + + if (param.getParDescripcion() != null && !param.getParDescripcion().trim().isEmpty()) { + labels = param.getParDescripcion().split(DominioConstantes.SEPARADOR); + } else { + Fila f = result.get(0); + labels = new String[f.size()]; + for (int i = 0; i < f.size(); i++) { + labels[i] = "CAMPO_" + (i + 1); + } + } + if (tipo == DominioConstantes.CONSULTA) { + for (Fila f : result) { + Map fila = new LinkedHashMap<>(); + int i = 0; + for (Valor v : f) { + if (v.getValor() instanceof Date) { + Date fec = (Date) v.getValor(); + fila.put(labels[i], DominioConstantes.getBddDate(fec)); + } else { + fila.put(labels[i], v.getValor()); + } + i++; + } + data.add(fila); + } + } else if (tipo == DominioConstantes.COUNT) { //Generar CSV + Map fila = new HashMap<>(); + try { + fila.put(param.getParNombre(), PoiExport.getCSV(this.getData(labels, result))); + } catch (IOException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No se puede generar el recurso CSV " + ex); + } + data.add(fila); + } else if (tipo == DominioConstantes.IMAGEN) { //Generar XLS + Map fila = new HashMap<>(); + try { + fila.put(param.getParNombre(), PoiExport.getExcel(this.getData(labels, result), param.getParNombre())); + } catch (IOException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No se puede generar el recurso XLS " + ex); + } + data.add(fila); + } else { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No existe operacion asociada al codigo de consulta"); + } + return data; + } + + /** + * + * @param parametros + * @param name + * @return + */ + private Object getValue(Map parametros, String name) { + Object result = null; + if (parametros.containsKey(name)) { + result = parametros.get(name); + } + return result; + } + + /** + * + * @param parametros + * @param name + * @return + */ + private String getValueString(Map parametros, String name) throws DominioExcepcion { + String result = null; + if (parametros.containsKey(name)) { + result = parametros.get(name).toString().trim(); + } else { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, "Error, el campo " + name + "es obligatorio"); + } + return result; + } + + /** + * + * @param labels + * @param result + * @return + */ + private List> getData(String[] labels, List result) { + List> matrix = new LinkedList<>(); + List header = new LinkedList<>(); + for (String l : labels) { + header.add(l); + } + matrix.add(header); + for (Fila f : result) { + List fila = new LinkedList<>(); + for (Valor v : f) { + fila.add(v.getValor()); + } + matrix.add(fila); + } + return matrix; + } + + /** + * Permite realizar consultas a BDD de forma generica y retornar un listado de DTO corespondiente + * + * @param dao + * @param plantilla + * @param entidad + * @param orden + * @param inicio + * @param tipo + * @return + * @throws DaoException + */ + public List consultar(DaoGenerico dao, Serializable plantilla, EntidadEnum entidad, List orden, Integer inicio, int tipo) throws DaoException { + List data = new ArrayList(); + if (tipo == DominioConstantes.CONSULTA) { + if (orden != null && !orden.isEmpty()) { + String[] or = new String[orden.size()]; + for (Object o : dao.buscarLista(plantilla, inicio, orden.toArray(or))) { + data.add(dominioUtil.getDto(entidad.getMapper(), o)); + } + } else { + for (Object o : dao.buscarLista(plantilla, inicio)) { + data.add(dominioUtil.getDto(entidad.getMapper(), o)); + } + } + } else if (tipo == DominioConstantes.COUNT) { + Map contador = new HashMap<>(); + contador.put(DominioConstantes.EXISTENCIAS, dao.contarExistencias(plantilla)); + data.add(contador); + } else if (tipo == DominioConstantes.IMAGEN) { + for (Object o : dao.buscarLista(plantilla)) { + Object dto = dominioUtil.getDto(entidad.getMapper(), o); + if (dto instanceof DetalleCatalogoDTO) { + DetalleCatalogoDTO dec = (DetalleCatalogoDTO) dto; + dec.setArchivo(DominioUtil.getArchivo(dec.getDetOrigen())); + dec.setDetDestino(DominioUtil.getNombreArchivo(dec.getDetOrigen())); + } + data.add(dto); + } + } + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/MultipartService.java b/src/main/java/com/qsoft/erp/dominio/MultipartService.java new file mode 100644 index 0000000..d6d37c8 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/MultipartService.java @@ -0,0 +1,137 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio; + +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.constantes.TransaccionEnum; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.util.DocumentoUtil; +import com.qsoft.erp.dominio.util.LiquidacionUtil; +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.dto.LiquidacionDTO; +import com.qsoft.erp.dto.PagoDTO; +import com.qsoft.erp.dto.PersonaDTO; +import com.qsoft.erp.dto.PersonaPolizaDTO; +import com.qsoft.erp.dto.PolizaDTO; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Pago; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.Poliza; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import javax.ejb.EJB; +import javax.ejb.Stateless; + +/** + * + * @author james + */ +@Stateless +public class MultipartService { + + @EJB + private LiquidacionUtil liquidacionUtil; + + @EJB + private DocumentoUtil documentoUtil; + + @EJB + private DominioUtil dominioUtil; + + /** + * select * from LOCALIZACION WHERE LOC_PADRE = 9 + * + * @param header + * @param entidad + * @param datos + * @param tipoAccion + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public List multipartLiquidacion(HeaderMS header, EntidadEnum entidad, Map datos, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + List dataL = new ArrayList<>(); + if (header.getTipoTransaccion().equals(TransaccionEnum.CLIQUI.getCodigo())) { + dataL = this.liquidacionUtil.guardarLiquidacion(header, datos); + } else if (header.getTipoTransaccion().equals(TransaccionEnum.ALIQUI.getCodigo())) { + dataL = this.liquidacionUtil.actualizarLiquidacion(header, datos, tipoAccion); + } else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "No existe una transaccion asociada al codigo " + header.getTipoTransaccion()); + } + if (dataL != null && !dataL.isEmpty()) { + for (Liquidacion liq : dataL) { + LiquidacionDTO liquidacion = (LiquidacionDTO) dominioUtil.getDto(EntidadEnum.Liquidacion.getMapper(), liq); + data.add(liquidacion); + } + } + return data; + } + + /** + * + * @param header + * @param entidad + * @param entidades + * @param tipoAccion + * @param documentoDTOs + * @return + * @throws DominioExcepcion + */ + public List multipartGenerico(HeaderMS header, EntidadEnum entidad, List> entidades, int tipoAccion, List documentoDTOs) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + List dataL = new ArrayList<>(); + + if (header.getTipoTransaccion().equals(TransaccionEnum.DOCUM.getCodigo())) { + dataL = this.documentoUtil.guardarDocumento(header, entidades, documentoDTOs, tipoAccion); + for (Documento liq : dataL) { + DocumentoDTO liquidacion = (DocumentoDTO) dominioUtil.getDto(EntidadEnum.Documento.getMapper(), liq); + data.add(liquidacion); + } + } else if(header.getTipoTransaccion().equals(TransaccionEnum.CSVPAG.getCodigo())){ + for (Pago pago : this.documentoUtil.procesarCSV(header, entidades, documentoDTOs, tipoAccion)) { + PagoDTO pagoDTO = (PagoDTO) dominioUtil.getDto(EntidadEnum.Pago.getMapper(), pago); + data.add(pagoDTO); + } + + }else if(header.getTipoTransaccion().equals(TransaccionEnum.CSVPPP.getCodigo())){ + for (Pago pago : this.documentoUtil.analizarCSV(header, entidades, documentoDTOs, tipoAccion)) { + PagoDTO pagoDTO = (PagoDTO) dominioUtil.getDto(EntidadEnum.Pago.getMapper(), pago); + data.add(pagoDTO); + } + } + else if(header.getTipoTransaccion().equals(TransaccionEnum.CSVSIN.getCodigo())){ + for (Persona persona : this.documentoUtil.procesarSiniestrosCSV(header, entidades, documentoDTOs, tipoAccion)) { + PersonaDTO personaDTO = (PersonaDTO) dominioUtil.getDto(EntidadEnum.Persona.getMapper(), persona); + data.add(personaDTO); + } + } + else if(header.getTipoTransaccion().equals(TransaccionEnum.CSVPOC.getCodigo())){ + for (Poliza poliza : this.documentoUtil.procesarCancelacion(header, entidades, documentoDTOs, tipoAccion)) { + PolizaDTO polizaDTO = (PolizaDTO) dominioUtil.getDto(EntidadEnum.Poliza.getMapper(), poliza); + data.add(polizaDTO); + } + } + else if(header.getTipoTransaccion().equals(TransaccionEnum.CSVPCR.getCodigo())){ + for (Poliza poliza : this.documentoUtil.procesarCreacionCsv(header, entidades, documentoDTOs, tipoAccion)) { + PolizaDTO polizaDTO = (PolizaDTO) dominioUtil.getDto(EntidadEnum.Poliza.getMapper(), poliza); + data.add(polizaDTO); + } + } + else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "No existe una transaccion asociada al codigo " + header.getTipoTransaccion()); + } + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/exception/DominioExcepcion.java b/src/main/java/com/qsoft/erp/dominio/exception/DominioExcepcion.java new file mode 100644 index 0000000..45fda90 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/exception/DominioExcepcion.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.exception; + +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; + +/** + * + * @author james + */ +public class DominioExcepcion extends Exception{ + + private final ErrorTipo tipo; + private final CodigoRespuesta codigo; + private final String mensaje; + + public DominioExcepcion(ErrorTipo tipo, CodigoRespuesta codigo, String mensaje) { + super(mensaje); + this.tipo = tipo; + this.codigo = codigo; + this.mensaje = mensaje; + } + + public ErrorTipo getTipo() { + return tipo; + } + + public CodigoRespuesta getCodigo() { + return codigo; + } + + public String getMensaje() { + return mensaje; + } + + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/AgendamientoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/AgendamientoMapper.java new file mode 100644 index 0000000..88ca63c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/AgendamientoMapper.java @@ -0,0 +1,79 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.AgendamientoDTO; +import com.qsoft.erp.model.Agendamiento; +import com.qsoft.erp.model.EstadoAgendamiento; +import java.util.ArrayList; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface AgendamientoMapper { + + AgendamientoMapper INSTANCE = Mappers.getMapper(AgendamientoMapper.class); + + @Mapping(source = "locCodigo", target = "locCodigo.locCodigo") + @Mapping(source = "perBeneficiario", target = "perBeneficiario.perCodigo") + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "preCodigo", target = "preCodigo.preCodigo") + @Mapping(source = "usuCodigo", target = "usuCodigo.usuCodigo") + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "locNombre", target = "locCodigo.locNombre") + @Mapping(source = "perNombres", target = "perBeneficiario.perNombres") + @Mapping(source = "perApellidos", target = "perBeneficiario.perApellidos") + @Mapping(source = "perIdentificacion", target = "perBeneficiario.perIdentificacion") + @Mapping(source = "polContrato", target = "polCodigo.polContrato") + @Mapping(source = "preNombre", target = "preCodigo.preNombre") + @Mapping(source = "detNemonico", target = "detTipo.detNemonico") + @Mapping(source = "detNombre", target = "detTipo.detNombre") + @Mapping(source = "usuUsuario", target = "usuCodigo.usuUsuario") + Agendamiento getEntidad(AgendamientoDTO agendamientoDTO); + + @Mapping(target = "locCodigo", source = "locCodigo.locCodigo") + @Mapping(target = "perBeneficiario", source = "perBeneficiario.perCodigo") + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "preCodigo", source = "preCodigo.preCodigo") + @Mapping(target = "usuCodigo", source = "usuCodigo.usuCodigo") + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "locNombre", source = "locCodigo.locNombre") + @Mapping(target = "perNombres", source = "perBeneficiario.perNombres") + @Mapping(target = "perApellidos", source = "perBeneficiario.perApellidos") + @Mapping(target = "perIdentificacion", source = "perBeneficiario.perIdentificacion") + @Mapping(target = "polContrato", source = "polCodigo.polContrato") + @Mapping(target = "preNombre", source = "preCodigo.preNombre") + @Mapping(target = "detNemonico", source = "detTipo.detNemonico") + @Mapping(target = "detNombre", source = "detTipo.detNombre") + @Mapping(target = "usuUsuario", source = "usuCodigo.usuUsuario") + AgendamientoDTO getDto(Agendamiento agendamiento); + + + @AfterMapping + default void validaObjetos(Agendamiento agendamiento, @MappingTarget AgendamientoDTO agendamientoDTO) { + agendamientoDTO.setEstado(new ArrayList<>()); + if (agendamiento.getEstadoAgendamientoCollection() != null && !agendamiento.getEstadoAgendamientoCollection().isEmpty()) { + for (EstadoAgendamiento ea : agendamiento.getEstadoAgendamientoCollection()) { + agendamientoDTO.getEstado().add(EstadoAgendamientoMapper.INSTANCE.getDto(ea)); + } + } + } + + @AfterMapping + default void validaNulos(AgendamientoDTO agendamientoDTO, @MappingTarget Agendamiento agendamiento) { + if (agendamiento.getPreCodigo() != null && agendamiento.getPreCodigo().getPreCodigo() == null) { + agendamiento.setPreCodigo(null); + } + if (agendamiento.getPerBeneficiario() != null && agendamiento.getPerBeneficiario().getPerCodigo() == null) { + agendamiento.setPerBeneficiario(null); + } + if (agendamiento.getLocCodigo() != null && agendamiento.getLocCodigo().getLocCodigo() == null) { + agendamiento.setLocCodigo(null); + } + if (agendamiento.getDetTipo()!= null && agendamiento.getDetTipo().getDetCodigo()== null) { + agendamiento.setDetTipo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/AuditoriaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/AuditoriaMapper.java new file mode 100644 index 0000000..9dc2abe --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/AuditoriaMapper.java @@ -0,0 +1,17 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.AuditoriaDTO; +import com.qsoft.erp.model.Auditoria; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface AuditoriaMapper { + + AuditoriaMapper INSTANCE = Mappers.getMapper(AuditoriaMapper.class); + + Auditoria getEntidad(AuditoriaDTO auditoriaDTO); + + AuditoriaDTO getDto(Auditoria auditoria); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/CatalogoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/CatalogoMapper.java new file mode 100644 index 0000000..6d14391 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/CatalogoMapper.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.CatalogoDTO; +import com.qsoft.erp.model.Catalogo; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface CatalogoMapper { + + CatalogoMapper INSTANCE = Mappers.getMapper(CatalogoMapper.class); + + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + Catalogo getEntidad(CatalogoDTO catalogoDTO); + + @Mapping(source = "empCodigo.empCodigo", target = "empCodigo") + CatalogoDTO getDto(Catalogo catalogo); + + @AfterMapping + default void validaObjetos(CatalogoDTO catalogoDTO, @MappingTarget Catalogo catalogo){ + if(MapperUtil.isEmptyDTO(catalogo.getEmpCodigo())){ + catalogo.setEmpCodigo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/CoberturasPlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/CoberturasPlanMapper.java new file mode 100644 index 0000000..9ea0cce --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/CoberturasPlanMapper.java @@ -0,0 +1,89 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.CoberturasPlanDTO; +import com.qsoft.erp.model.CoberturasPlan; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface CoberturasPlanMapper { + + CoberturasPlanMapper INSTANCE = Mappers.getMapper(CoberturasPlanMapper.class); + + @Mapping(source = "detPrestacion", target = "detPrestacion.detCodigo") + @Mapping(source = "detTipoModalidad", target = "detTipoModalidad.detCodigo") + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "detPais", target = "detPais.detCodigo") + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + @Mapping(source = "modalidadNemonico", target = "detTipoModalidad.detNemonico") + @Mapping(source = "paisNemonico", target = "detPais.detNemonico") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + @Mapping(source = "prestacionNemonico", target = "detPrestacion.detNemonico") + @Mapping(source = "modalidadNombre", target = "detTipoModalidad.detNombre") + @Mapping(source = "paisNombre", target = "detPais.detNombre") + @Mapping(source = "tipoNombre", target = "detTipo.detNombre") + @Mapping(source = "prestacionNombre", target = "detPrestacion.detNombre") + @Mapping(source = "modalidadDescripcion", target = "detTipoModalidad.detDescripcion") + @Mapping(source = "paisDescripcion", target = "detPais.detDescripcion") + @Mapping(source = "tipoDescripcion", target = "detTipo.detDescripcion") + @Mapping(source = "prestacionDescripcion", target = "detPrestacion.detDescripcion") + @Mapping(source = "detTipoDeducible", target = "detTipoDeducible.detCodigo") + @Mapping(source = "tipoDeducibleNemonico", target = "detTipoDeducible.detNemonico") + @Mapping(source = "tipoDeducibleNombre", target = "detTipoDeducible.detNombre") + CoberturasPlan getEntidad(CoberturasPlanDTO coberturasPlanDTO); + + @Mapping(target = "detPrestacion", source = "detPrestacion.detCodigo") + @Mapping(target = "detTipoModalidad", source = "detTipoModalidad.detCodigo") + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "detPais", source = "detPais.detCodigo") + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + @Mapping(target = "prestacionNemonico", source = "detPrestacion.detNemonico") + @Mapping(target = "modalidadNemonico", source = "detTipoModalidad.detNemonico") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "paisNemonico", source = "detPais.detNemonico") + @Mapping(target = "modalidadNombre", source = "detTipoModalidad.detNombre") + @Mapping(target = "paisNombre", source = "detPais.detNombre") + @Mapping(target = "tipoNombre", source = "detTipo.detNombre") + @Mapping(target = "prestacionNombre", source = "detPrestacion.detNombre") + @Mapping(target = "modalidadDescripcion", source = "detTipoModalidad.detDescripcion") + @Mapping(target = "paisDescripcion", source = "detPais.detDescripcion") + @Mapping(target = "tipoDescripcion", source = "detTipo.detDescripcion") + @Mapping(target = "prestacionDescripcion", source = "detPrestacion.detDescripcion") + @Mapping(target = "detTipoDeducible", source = "detTipoDeducible.detCodigo") + @Mapping(target = "tipoDeducibleNemonico", source = "detTipoDeducible.detNemonico") + @Mapping(target = "tipoDeducibleNombre", source = "detTipoDeducible.detNombre") + CoberturasPlanDTO getDto(CoberturasPlan coberturasPlan); + + @AfterMapping + default void validaNulos(CoberturasPlanDTO coberturasPlanDTO, @MappingTarget CoberturasPlan coberturasPlan) { + + if (coberturasPlan.getDetPrestacion() != null && coberturasPlan.getDetPrestacion().getDetCodigo() == null) { + coberturasPlan.setDetPrestacion(null); + } + if (coberturasPlan.getDetPais() != null && coberturasPlan.getDetPais().getDetCodigo() == null) { + coberturasPlan.setDetPais(null); + } + if (coberturasPlan.getDetTipoModalidad() != null && coberturasPlan.getDetTipoModalidad().getDetCodigo() == null) { + coberturasPlan.setDetTipoModalidad(null); + } + if (coberturasPlan.getDetTipo() != null && coberturasPlan.getDetTipo().getDetCodigo() == null) { + coberturasPlan.setDetTipo(null); + } + if (coberturasPlan.getPlaCodigo() != null && coberturasPlan.getPlaCodigo().getPlaCodigo() == null) { + coberturasPlan.setPlaCodigo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/CuentaBancariaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/CuentaBancariaMapper.java new file mode 100644 index 0000000..e6a0cad --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/CuentaBancariaMapper.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.CuentaBancariaDTO; +import com.qsoft.erp.dto.LiquidacionDTO; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.Liquidacion; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface CuentaBancariaMapper { + + CuentaBancariaMapper INSTANCE = Mappers.getMapper(CuentaBancariaMapper.class); + + @Mapping(source = "perCodigo", target = "perCodigo.perCodigo") + @Mapping(source = "detIfi", target = "detIfi.detCodigo") + @Mapping(source = "detTipoCuenta", target = "detTipoCuenta.detCodigo") + @Mapping(source = "detNombreIfi", target = "detIfi.detNombre") + @Mapping(source = "detNombreTipoCuenta", target = "detTipoCuenta.detNombre") + CuentaBancaria getEntidad(CuentaBancariaDTO cuentaBancariaDTO); + + @Mapping(target = "perCodigo", source = "perCodigo.perCodigo") + @Mapping(target = "detIfi", source = "detIfi.detCodigo") + @Mapping(target = "detTipoCuenta", source = "detTipoCuenta.detCodigo") + @Mapping(target = "detNombreIfi", source = "detIfi.detNombre") + @Mapping(target = "detNombreTipoCuenta", source = "detTipoCuenta.detNombre") + CuentaBancariaDTO getDto(CuentaBancaria cuentaBancaria); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/DetalleCatalogoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/DetalleCatalogoMapper.java new file mode 100644 index 0000000..29b0546 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/DetalleCatalogoMapper.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.DetalleCatalogoDTO; +import com.qsoft.erp.model.DetalleCatalogo; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface DetalleCatalogoMapper { + + DetalleCatalogoMapper INSTANCE = Mappers.getMapper(DetalleCatalogoMapper.class); + + @Mapping(source = "catCodigo", target = "catCodigo.catCodigo") + @Mapping(source = "catNemonico", target = "catCodigo.catNemonico") + @Mapping(source = "empCodigo", target = "catCodigo.empCodigo.empCodigo") + DetalleCatalogo getEntidad(DetalleCatalogoDTO detalleCatalogoDTO); + + @Mapping(target = "catCodigo", source = "catCodigo.catCodigo") + @Mapping(target = "catNemonico", source = "catCodigo.catNemonico") + @Mapping(target = "empCodigo", source = "catCodigo.empCodigo.empCodigo") + DetalleCatalogoDTO getDto(DetalleCatalogo detalleCatalogo); + + @AfterMapping + default void validaNulos(DetalleCatalogoDTO detalleCatalogoDTO, @MappingTarget DetalleCatalogo detalleCatalogo) { + +// if (detalleCatalogo.getDetOrigen() != null && detalleCatalogo.getDetOrigen().isBlank()) { +// detalleCatalogo.setDetOrigen(null); +// } +// if (detalleCatalogo.getDetDestino() != null && detalleCatalogo.getDetDestino().isBlank()) { +// detalleCatalogo.setDetDestino(null); +// } +// if (detalleCatalogo.getDetDescripcion() != null && detalleCatalogo.getDetDescripcion().isBlank()) { +// detalleCatalogo.setDetDescripcion(null); +// } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/DetalleLiquidacionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/DetalleLiquidacionMapper.java new file mode 100644 index 0000000..f909d9c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/DetalleLiquidacionMapper.java @@ -0,0 +1,67 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.DetalleLiquidacionDTO; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.TarifaLiquidacion; +import java.util.ArrayList; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface DetalleLiquidacionMapper { + + DetalleLiquidacionMapper INSTANCE = Mappers.getMapper(DetalleLiquidacionMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "liqCodigo", target = "liqCodigo.liqCodigo") + @Mapping(source = "preCodigo", target = "preCodigo.preCodigo") + @Mapping(source = "copCodigo", target = "copCodigo.copCodigo") + @Mapping(source = "detCie10", target = "detCie10.detCodigo") + @Mapping(source = "cie10Nemonico", target = "detCie10.detNemonico") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + DetalleLiquidacion getEntidad(DetalleLiquidacionDTO detalleLiquidacionDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "liqCodigo", source = "liqCodigo.liqCodigo") + @Mapping(target = "preCodigo", source = "preCodigo.preCodigo") + @Mapping(target = "copCodigo", source = "copCodigo.copCodigo") + @Mapping(target = "detCie10", source = "detCie10.detCodigo") + @Mapping(target = "cie10Nemonico", source = "detCie10.detNemonico") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + DetalleLiquidacionDTO getDto(DetalleLiquidacion detalleLiquidacion); + + @AfterMapping + default void validaNulos(DetalleLiquidacionDTO detalleLiquidacionDTO, @MappingTarget DetalleLiquidacion detalleLiquidacion) { + + if (detalleLiquidacion.getDetCie10() != null && detalleLiquidacion.getDetCie10().getDetCodigo() == null) { + detalleLiquidacion.setDetCie10(null); + } + if (detalleLiquidacion.getDetTipo() != null && detalleLiquidacion.getDetTipo().getDetCodigo() == null) { + detalleLiquidacion.setDetTipo(null); + } + if (detalleLiquidacion.getPreCodigo() != null && detalleLiquidacion.getPreCodigo().getPreCodigo() == null) { + detalleLiquidacion.setPreCodigo(null); + } + } + + @AfterMapping + default void recuperarTarifa(DetalleLiquidacion detalleLiquidacion, @MappingTarget DetalleLiquidacionDTO detalleLiquidacionDTO) { + detalleLiquidacionDTO.setDetalle(new ArrayList<>()); + for (TarifaLiquidacion tarli : detalleLiquidacion.getTarifaLiquidacionCollection()) { + detalleLiquidacionDTO.getDetalle().add(TarifaLiquidacionMapper.INSTANCE.getDto(tarli)); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/DocumentoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/DocumentoMapper.java new file mode 100644 index 0000000..369724d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/DocumentoMapper.java @@ -0,0 +1,65 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.model.Documento; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface DocumentoMapper { + + DocumentoMapper INSTANCE = Mappers.getMapper(DocumentoMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "liqCodigo", target = "liqCodigo.liqCodigo") + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "ageCodigo", target = "ageCodigo.ageCodigo") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + Documento getEntidad(DocumentoDTO documentoDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "liqCodigo", source = "liqCodigo.liqCodigo") + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "ageCodigo", source = "ageCodigo.ageCodigo") + DocumentoDTO getDto(Documento documento); + + @AfterMapping + default void cargaArchivo(Documento documento, @MappingTarget DocumentoDTO documentoDTO) { + if (documentoDTO.getDocUrl() != null && !documentoDTO.getDocUrl().trim().isEmpty()) { + documentoDTO.setDocumento(DominioUtil.getArchivo(documentoDTO.getDocUrl())); + documentoDTO.setDocUrl(DominioUtil.getNombreArchivo(documentoDTO.getDocUrl())); + } + } + + @AfterMapping + default void validaNulos(DocumentoDTO documentoDTO, @MappingTarget Documento documento) { + if (documento.getLiqCodigo()!= null && documento.getLiqCodigo().getLiqCodigo() == null) { + documento.setLiqCodigo(null); + } + if (documento.getDetTipo()!= null && documento.getDetTipo().getDetCodigo()== null) { + documento.setDetTipo(null); + } + if (documento.getAgeCodigo()!= null && documento.getAgeCodigo().getAgeCodigo() == null) { + documento.setAgeCodigo(null); + } + + if (documento.getPolCodigo()!= null && documento.getPolCodigo().getPolCodigo() == null) { + documento.setPolCodigo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/EmailMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/EmailMapper.java new file mode 100644 index 0000000..4b84454 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/EmailMapper.java @@ -0,0 +1,22 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Email; +import com.qsoft.erp.dto.EmailDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface EmailMapper { + + EmailMapper INSTANCE = Mappers.getMapper(EmailMapper.class); + + @Mapping(source = "parEstado", target = "parEstado.parCodigo") + @Mapping(source = "plsmCodigo", target = "plsmCodigo.plsmCodigo") + Email getEntidad(EmailDTO email); + + @Mapping(target = "parEstado", source = "parEstado.parCodigo") + @Mapping(target = "plsmCodigo", source = "plsmCodigo.plsmCodigo") + EmailDTO getDto(Email email); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/EmpresaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/EmpresaMapper.java new file mode 100644 index 0000000..0498443 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/EmpresaMapper.java @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.EmpresaDTO; +import com.qsoft.erp.model.Empresa; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface EmpresaMapper { + + EmpresaMapper INSTANCE = Mappers.getMapper(EmpresaMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + @Mapping(source = "locCodigo", target = "locCodigo.locCodigo") + @Mapping(source = "locNombre", target = "locCodigo.locNombre") + Empresa getEntidad(EmpresaDTO empresaDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "locCodigo", source = "locCodigo.locCodigo") + @Mapping(target = "locNombre", source = "locCodigo.locNombre") + EmpresaDTO getDto(Empresa empresa); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/EstadoAgendamientoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/EstadoAgendamientoMapper.java new file mode 100644 index 0000000..7c8d6ec --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/EstadoAgendamientoMapper.java @@ -0,0 +1,30 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.EstadoAgendamientoDTO; +import com.qsoft.erp.model.EstadoAgendamiento; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface EstadoAgendamientoMapper { + + EstadoAgendamientoMapper INSTANCE = Mappers.getMapper(EstadoAgendamientoMapper.class); + + @Mapping(source = "ageCodigo", target = "ageCodigo.ageCodigo") + @Mapping(source = "detEstado", target = "detEstado.detCodigo") + @Mapping(source = "usuCodigo", target = "usuCodigo.usuCodigo") + @Mapping(source = "estadoNombre", target = "detEstado.detNombre") + @Mapping(source = "usuUsuario", target = "usuCodigo.usuUsuario") + @Mapping(source = "usuNombre", target = "usuCodigo.usuNombre") + EstadoAgendamiento getEntidad(EstadoAgendamientoDTO estadoAgendamientoDTO); + + @Mapping(target = "ageCodigo", source = "ageCodigo.ageCodigo") + @Mapping(target = "detEstado", source = "detEstado.detCodigo") + @Mapping(target = "usuCodigo", source = "usuCodigo.usuCodigo") + @Mapping(target = "estadoNombre", source = "detEstado.detNombre") + @Mapping(target = "usuUsuario", source = "usuCodigo.usuUsuario") + @Mapping(target = "usuNombre", source = "usuCodigo.usuNombre") + EstadoAgendamientoDTO getDto(EstadoAgendamiento agendamiento); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/EstadoLiquidacionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/EstadoLiquidacionMapper.java new file mode 100644 index 0000000..a591539 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/EstadoLiquidacionMapper.java @@ -0,0 +1,37 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.EstadoLiquidacionDTO; +import com.qsoft.erp.model.EstadoLiquidacion; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface EstadoLiquidacionMapper { + + EstadoLiquidacionMapper INSTANCE = Mappers.getMapper(EstadoLiquidacionMapper.class); + + @Mapping(source = "detEstado", target = "detEstado.detCodigo") + @Mapping(source = "liqCodigo", target = "liqCodigo.liqCodigo") + @Mapping(source = "usuCodigo", target = "usuCodigo.usuCodigo") + @Mapping(source = "usuUsuario", target = "usuCodigo.usuUsuario") + @Mapping(source = "usuNombre", target = "usuCodigo.usuNombre") + EstadoLiquidacion getEntidad(EstadoLiquidacionDTO estadoLiquidacionDTO); + + @Mapping(target = "detEstado", source = "detEstado.detCodigo") + @Mapping(target = "liqCodigo", source = "liqCodigo.liqCodigo") + @Mapping(target = "usuCodigo", source = "usuCodigo.usuCodigo") + @Mapping(target = "usuUsuario", source = "usuCodigo.usuUsuario") + @Mapping(target = "usuNombre", source = "usuCodigo.usuNombre") + EstadoLiquidacionDTO getDto(EstadoLiquidacion estadoLiquidacion); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/FormularioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/FormularioMapper.java new file mode 100644 index 0000000..4b590fc --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/FormularioMapper.java @@ -0,0 +1,94 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.FormularioDTO; +import com.qsoft.erp.model.Formulario; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface FormularioMapper { + + FormularioMapper INSTANCE = Mappers.getMapper(FormularioMapper.class); + + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + @Mapping(source = "liqCodigo", target = "liqCodigo.liqCodigo") + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "perTitular", target = "perTitular.perCodigo") + @Mapping(source = "perPaciente", target = "perPaciente.perCodigo") + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "cueCodigo", target = "cueCodigo.cueCodigo") + @Mapping(source = "detProcedimiento", target = "detProcedimiento.detCodigo") + @Mapping(source = "detCie10", target = "detCie10.detCodigo") + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + @Mapping(source = "preCodigo", target = "preCodigo.preCodigo") + @Mapping(source = "cie10Nemonico", target = "detCie10.detNemonico") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + @Mapping(source = "procedimientoNemonico", target = "detProcedimiento.detNemonico") + Formulario getEntidad(FormularioDTO formularioDTO); + + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + @Mapping(target = "liqCodigo", source = "liqCodigo.liqCodigo") + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "perTitular", source = "perTitular.perCodigo") + @Mapping(target = "perPaciente", source = "perPaciente.perCodigo") + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "cueCodigo", source = "cueCodigo.cueCodigo") + @Mapping(target = "detProcedimiento", source = "detProcedimiento.detCodigo") + @Mapping(target = "detCie10", source = "detCie10.detCodigo") + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + @Mapping(target = "preCodigo", source = "preCodigo.preCodigo") + @Mapping(target = "cie10Nemonico", source = "detCie10.detNemonico") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "procedimientoNemonico", source = "detProcedimiento.detNemonico") + FormularioDTO getDto(Formulario formulario); + + @AfterMapping + default void validaObjetos(FormularioDTO formularioDTO, @MappingTarget Formulario formulario) { + if (formulario.getEmpCodigo().getEmpCodigo() == null) { + formulario.setEmpCodigo(null); + } + if (formulario.getLiqCodigo().getLiqCodigo() == null) { + formulario.setLiqCodigo(null); + } + if (formulario.getDetTipo().getDetCodigo() == null) { + formulario.setDetTipo(null); + } + if (formulario.getPerPaciente().getPerCodigo() == null) { + formulario.setPerPaciente(null); + } + if (formulario.getPerTitular().getPerCodigo() == null) { + formulario.setPerTitular(null); + } + if (formulario.getPolCodigo().getPolCodigo() == null) { + formulario.setPolCodigo(null); + } + if (formulario.getCueCodigo().getCueCodigo() == null) { + formulario.setCueCodigo(null); + } + if (formulario.getDetProcedimiento().getDetCodigo() == null) { + formulario.setDetProcedimiento(null); + } + if (formulario.getDetCie10().getDetCodigo() == null) { + formulario.setDetCie10(null); + } + if (formulario.getPlaCodigo().getPlaCodigo() == null) { + formulario.setPlaCodigo(null); + } + if (formulario.getPreCodigo().getPreCodigo() == null) { + formulario.setPreCodigo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioMapper.java new file mode 100644 index 0000000..08abf4d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioMapper.java @@ -0,0 +1,20 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.HonorarioDTO; +import com.qsoft.erp.model.Honorario; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface HonorarioMapper { + + HonorarioMapper INSTANCE = Mappers.getMapper(HonorarioMapper.class); + + @Mapping(source = "detGrupo", target = "detGrupo.detCodigo") + Honorario getEntidad(HonorarioDTO honorarioDTO); + + @Mapping(target = "detGrupo", source = "detGrupo.detCodigo") + HonorarioDTO getDto(Honorario email); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioPlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioPlanMapper.java new file mode 100644 index 0000000..45776bb --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/HonorarioPlanMapper.java @@ -0,0 +1,22 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.HonorarioPlanDTO; +import com.qsoft.erp.model.HonorarioPlan; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface HonorarioPlanMapper { + + HonorarioPlanMapper INSTANCE = Mappers.getMapper(HonorarioPlanMapper.class); + + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + @Mapping(source = "detAtencion", target = "detAtencion.detCodigo") + HonorarioPlan getEntidad(HonorarioPlanDTO email); + + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + @Mapping(target = "detAtencion", source = "detAtencion.detCodigo") + HonorarioPlanDTO getDto(HonorarioPlan email); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/LiquidacionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/LiquidacionMapper.java new file mode 100644 index 0000000..f22b41b --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/LiquidacionMapper.java @@ -0,0 +1,107 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.dto.LiquidacionDTO; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import java.util.ArrayList; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface LiquidacionMapper { + + LiquidacionMapper INSTANCE = Mappers.getMapper(LiquidacionMapper.class); + + @Mapping(source = "cueOrigen", target = "cueOrigen.cueCodigo") + @Mapping(source = "cueDestino", target = "cueDestino.cueCodigo") + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "detIfi", target = "detIfi.detCodigo") + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "perBeneficiario", target = "perBeneficiario.perCodigo") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + @Mapping(source = "ifiNemonico", target = "detIfi.detNemonico") + @Mapping(source = "beneficiarioIdentificacion", target = "perBeneficiario.perIdentificacion") + @Mapping(source = "beneficiarioNombre", target = "perBeneficiario.perNombres") + @Mapping(source = "beneficiarioApellido", target = "perBeneficiario.perApellidos") + @Mapping(source = "detAtencion", target = "detAtencion.detCodigo") + @Mapping(source = "atencionNombre", target = "detAtencion.detNombre") + Liquidacion getEntidad(LiquidacionDTO liquidacionDTO); + + @Mapping(target = "cueOrigen", source = "cueOrigen.cueCodigo") + @Mapping(target = "cueDestino", source = "cueDestino.cueCodigo") + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "detIfi", source = "detIfi.detCodigo") + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "perBeneficiario", source = "perBeneficiario.perCodigo") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "ifiNemonico", source = "detIfi.detNemonico") + @Mapping(target = "beneficiarioIdentificacion", source = "perBeneficiario.perIdentificacion") + @Mapping(target = "beneficiarioNombre", source = "perBeneficiario.perNombres") + @Mapping(target = "beneficiarioApellido", source = "perBeneficiario.perApellidos") + @Mapping(target = "detAtencion", source = "detAtencion.detCodigo") + @Mapping(target = "atencionNombre", source = "detAtencion.detNombre") + LiquidacionDTO getDto(Liquidacion liquidacion); + + @AfterMapping + default void validaNulos(LiquidacionDTO liquidacionDTO, @MappingTarget Liquidacion liquidacion) { + if (liquidacion.getCueDestino() != null && liquidacion.getCueDestino().getCueCodigo() == null) { + liquidacion.setCueDestino(null); + } + if (liquidacion.getCueOrigen() != null && liquidacion.getCueOrigen().getCueCodigo() == null) { + liquidacion.setCueOrigen(null); + } + if (liquidacion.getDetIfi() != null && liquidacion.getDetIfi().getDetCodigo() == null) { + liquidacion.setDetIfi(null); + } + if (liquidacion.getDetTipo() != null && liquidacion.getDetTipo().getDetCodigo() == null) { + liquidacion.setDetTipo(null); + } + if (liquidacion.getDetAtencion() != null && liquidacion.getDetAtencion().getDetCodigo() == null) { + liquidacion.setDetAtencion(null); + } + if (liquidacion.getPerBeneficiario() != null && liquidacion.getPerBeneficiario().getPerCodigo() == null) { + liquidacion.setPerBeneficiario(null); + } + } + + @AfterMapping + default void validaObjetos(Liquidacion liquidacion, @MappingTarget LiquidacionDTO liquidacionDTO) { + liquidacionDTO.setEstados(new ArrayList<>()); + liquidacionDTO.setDocumentos(new ArrayList<>()); + if (liquidacion.getEstadoLiquidacionCollection() != null && !liquidacion.getEstadoLiquidacionCollection().isEmpty()) { + for (EstadoLiquidacion el : liquidacion.getEstadoLiquidacionCollection()) { + liquidacionDTO.getEstados().add(EstadoLiquidacionMapper.INSTANCE.getDto(el)); + } + } + if (liquidacion.getDocumentoCollection() != null && !liquidacion.getDocumentoCollection().isEmpty()) { + for (Documento doc : liquidacion.getDocumentoCollection()) { + if (doc.getDocEstado().equals(DominioConstantes.ACTIVO)) { + DocumentoDTO dcto = new DocumentoDTO(); + dcto.setDocCodigo(doc.getDocCodigo()); + dcto.setDocNombre(doc.getDocNombre()); + liquidacionDTO.getDocumentos().add(dcto); + } + } + } + if (liquidacion.getLiqReporte() != null && !liquidacion.getLiqReporte().isBlank()) { + liquidacionDTO.setLiqReporte(DominioUtil.getArchivo(liquidacion.getLiqReporte())); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/LocalizacionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/LocalizacionMapper.java new file mode 100644 index 0000000..cf0946e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/LocalizacionMapper.java @@ -0,0 +1,20 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Localizacion; +import com.qsoft.erp.dto.LocalizacionDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface LocalizacionMapper { + + LocalizacionMapper INSTANCE = Mappers.getMapper(LocalizacionMapper.class); + + @Mapping(source = "locPadre", target = "locPadre.locCodigo") + Localizacion getEntidad(LocalizacionDTO localizacion); + + @Mapping(target = "locPadre", source = "locPadre.locCodigo") + LocalizacionDTO getDto(Localizacion localizacion); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/MapperUtil.java b/src/main/java/com/qsoft/erp/dominio/mapper/MapperUtil.java new file mode 100644 index 0000000..dc9d1f1 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/MapperUtil.java @@ -0,0 +1,36 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.dao.bdd.DaoBDDUtil; +import java.lang.reflect.Field; + +/** + * + * @author james + */ +public class MapperUtil { + + public static synchronized boolean isEmptyDTO(Object dto) { + boolean estado = true; + Object dato; + + for (Field f : dto.getClass().getDeclaredFields()) { + try { + dato = DaoBDDUtil.getValue(f, dto); + if (dato != null) { + estado = false; + break; + } + } catch (IllegalArgumentException | IllegalAccessException ex) { + ex.printStackTrace(System.err); + } + } + + return estado; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/MensajeMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/MensajeMapper.java new file mode 100644 index 0000000..9e14713 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/MensajeMapper.java @@ -0,0 +1,28 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Mensaje; +import com.qsoft.erp.dto.MensajeDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface MensajeMapper { + + MensajeMapper INSTANCE = Mappers.getMapper(MensajeMapper.class); + + @Mapping(source = "detIdioma", target = "detIdioma.detCodigo") + @Mapping(source = "detAplicacion", target = "detAplicacion.detCodigo") + @Mapping(source = "detServicio", target = "detServicio.detCodigo") + @Mapping(source = "detTipoMensaje", target = "detTipoMensaje.detCodigo") + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + Mensaje getEntidad(MensajeDTO mensaje); + + @Mapping(target = "detIdioma", source = "detIdioma.detCodigo") + @Mapping(target = "detAplicacion", source = "detAplicacion.detCodigo") + @Mapping(target = "detServicio", source = "detServicio.detCodigo") + @Mapping(target = "detTipoMensaje", source = "detTipoMensaje.detCodigo") + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + MensajeDTO getDto(Mensaje mensaje); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/OpcionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/OpcionMapper.java new file mode 100644 index 0000000..476b5d2 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/OpcionMapper.java @@ -0,0 +1,32 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.OpcionDTO; +import com.qsoft.erp.model.Opcion; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface OpcionMapper { + + OpcionMapper INSTANCE = Mappers.getMapper(OpcionMapper.class); + + @Mapping(source = "opcPadre", target = "opcPadre.opcCodigo") + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + Opcion getEntidad(OpcionDTO opcionDTO); + + @Mapping(source = "opcPadre.opcCodigo", target = "opcPadre") + @Mapping(source = "detTipo.detCodigo", target = "detTipo") + OpcionDTO getDto(Opcion opcion); + + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/OtpMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/OtpMapper.java new file mode 100644 index 0000000..e4d4371 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/OtpMapper.java @@ -0,0 +1,12 @@ +package com.qsoft.erp.dominio.mapper; + +//@Mapper +public interface OtpMapper { + +// OtpMapper INSTANCE = Mappers.getMapper(OtpMapper.class); +// +// Otp getEntidad(OtpDTO otp); +// +// OtpDTO getDto(Otp otp); + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PagoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PagoMapper.java new file mode 100644 index 0000000..306ec6f --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PagoMapper.java @@ -0,0 +1,52 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.dto.PagoDTO; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.Pago; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PagoMapper { + + PagoMapper INSTANCE = Mappers.getMapper(PagoMapper.class); + + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "polContrato", target = "polCodigo.polContrato") + @Mapping(source = "detEstado", target = "detEstado.detCodigo") + @Mapping(source = "detNombre", target = "detEstado.detNombre") + @Mapping(source = "detNemonico", target = "detEstado.detNemonico") + Pago getEntidad(PagoDTO pagoDTO); + + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "polContrato", source = "polCodigo.polContrato") + @Mapping(target = "detEstado", source = "detEstado.detCodigo") + @Mapping(target = "detNombre", source = "detEstado.detNombre") + @Mapping(target = "detNemonico", source = "detEstado.detNemonico") + PagoDTO getDto(Pago pago); + + @AfterMapping + default void validaNulos(PagoDTO documentoDTO, @MappingTarget Pago documento) { + + if (documento.getPolCodigo()!= null && documento.getPolCodigo().getPolCodigo()== null) { + documento.setPolCodigo(null); + } + if (documento.getDetEstado()!= null && documento.getDetEstado().getDetCodigo()== null) { + documento.setDetEstado(null); + } + + } +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/ParametroMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/ParametroMapper.java new file mode 100644 index 0000000..840bd94 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/ParametroMapper.java @@ -0,0 +1,20 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Parametro; +import com.qsoft.erp.dto.ParametroDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface ParametroMapper { + + ParametroMapper INSTANCE = Mappers.getMapper(ParametroMapper.class); + + @Mapping(source = "parCodigoPadre", target = "parCodigoPadre.parCodigo") + Parametro getEntidad(ParametroDTO parametro); + + @Mapping(target = "parCodigoPadre", source = "parCodigoPadre.parCodigo") + ParametroDTO getDto(Parametro parametro); + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PersonaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PersonaMapper.java new file mode 100644 index 0000000..71b2fe1 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PersonaMapper.java @@ -0,0 +1,76 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PersonaDTO; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.Telefono; +import java.util.ArrayList; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PersonaMapper { + + PersonaMapper INSTANCE = Mappers.getMapper(PersonaMapper.class); + + @Mapping(source = "detTipoIdentificacion", target = "detTipoIdentificacion.detCodigo") + @Mapping(source = "detGenero", target = "detGenero.detCodigo") + @Mapping(source = "locCodigo", target = "locCodigo.locCodigo") + @Mapping(source = "locNombre", target = "locCodigo.locNombre") + @Mapping(source = "detEstadoPoliza", target = "detEstadoPoliza.detCodigo") + Persona getEntidad(PersonaDTO personaDTO); + + @Mapping(target = "detTipoIdentificacion", source = "detTipoIdentificacion.detCodigo") + @Mapping(target = "detGenero", source = "detGenero.detCodigo") + @Mapping(target = "locCodigo", source = "locCodigo.locCodigo") + @Mapping(target = "locNombre", source = "locCodigo.locNombre") + @Mapping(target = "detEstadoPoliza", source = "detEstadoPoliza.detCodigo") + PersonaDTO getDto(Persona persona); + + @AfterMapping + default void validaObjetos(Persona persona, @MappingTarget PersonaDTO personaDTO) { + personaDTO.setTelefono(new ArrayList<>()); + if (persona.getTelefonoCollection() != null && !persona.getTelefonoCollection().isEmpty()) { + for (Telefono el : persona.getTelefonoCollection()) { + personaDTO.getTelefono().add(TelefonoMapper.INSTANCE.getDto(el)); + } + } + personaDTO.setCuentasBancarias(new ArrayList<>()); + if (persona.getCuentaBancariaCollection()!= null && !persona.getCuentaBancariaCollection().isEmpty()) { + for (CuentaBancaria el : persona.getCuentaBancariaCollection()) { + personaDTO.getCuentasBancarias().add(CuentaBancariaMapper.INSTANCE.getDto(el)); + } + } + + } + @AfterMapping + default void validarNulos(Persona persona, @MappingTarget PersonaDTO personaDTO) { + if (persona.getDetTipoIdentificacion()!= null && persona.getDetTipoIdentificacion().getDetCodigo()== null) { + persona.setDetTipoIdentificacion(null); + } + + if (persona.getDetGenero()!= null && persona.getDetGenero().getDetCodigo()== null) { + persona.setDetGenero(null); + } + if (persona.getDetEstadoPoliza()!= null && persona.getDetEstadoPoliza().getDetCodigo()== null) { + persona.setDetEstadoPoliza(null); + } + if (persona.getLocCodigo()!= null && persona.getLocCodigo().getLocCodigo()== null) { + persona.setLocCodigo(null); + } + + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PersonaPolizaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PersonaPolizaMapper.java new file mode 100644 index 0000000..fe9e6ac --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PersonaPolizaMapper.java @@ -0,0 +1,55 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PersonaPolizaDTO; +import com.qsoft.erp.model.PersonaPoliza; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PersonaPolizaMapper { + + PersonaPolizaMapper INSTANCE = Mappers.getMapper(PersonaPolizaMapper.class); + + @Mapping(source = "detTipoPersona", target = "detTipoPersona.detCodigo") + @Mapping(source = "perCodigo", target = "perCodigo.perCodigo") + @Mapping(source = "polCodigo", target = "polCodigo.polCodigo") + @Mapping(source = "polContrato", target = "polCodigo.polContrato") + @Mapping(source = "perGenero", target = "perCodigo.detGenero.detCodigo") + @Mapping(source = "perDireccion", target = "perCodigo.perDireccion") + @Mapping(source = "perFechaNacimiento", target = "perCodigo.perFechaNacimiento") + @Mapping(source = "detTipoIdentificacion", target = "perCodigo.detTipoIdentificacion.detCodigo") + @Mapping(source = "perEstado", target = "perCodigo.perEstado") + @Mapping(source = "perMail", target = "perCodigo.perMail") + @Mapping(source = "perNacionalidad", target = "perCodigo.perNacionalidad") + @Mapping(source = "perApellidos", target = "perCodigo.perApellidos") + @Mapping(source = "perNombres", target = "perCodigo.perNombres") + @Mapping(source = "perIdentificacion", target = "perCodigo.perIdentificacion") + PersonaPoliza getEntidad(PersonaPolizaDTO personaPolizaDTO); + + @Mapping(target = "detTipoPersona", source = "detTipoPersona.detCodigo") + @Mapping(target = "perCodigo", source = "perCodigo.perCodigo") + @Mapping(target = "polCodigo", source = "polCodigo.polCodigo") + @Mapping(target = "polContrato", source = "polCodigo.polContrato") + @Mapping(target = "perGenero", source = "perCodigo.detGenero.detCodigo") + @Mapping(target = "perDireccion", source = "perCodigo.perDireccion") + @Mapping(target = "perFechaNacimiento", source = "perCodigo.perFechaNacimiento") + @Mapping(target = "detTipoIdentificacion", source = "perCodigo.detTipoIdentificacion.detCodigo") + @Mapping(target = "perEstado", source = "perCodigo.perEstado") + @Mapping(target = "perMail", source = "perCodigo.perMail") + @Mapping(target = "perNacionalidad", source = "perCodigo.perNacionalidad") + @Mapping(target = "perApellidos", source = "perCodigo.perApellidos") + @Mapping(target = "perNombres", source = "perCodigo.perNombres") + @Mapping(target = "perIdentificacion", source = "perCodigo.perIdentificacion") + PersonaPolizaDTO getDto(PersonaPoliza personaPoliza); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PlanBrokerMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PlanBrokerMapper.java new file mode 100644 index 0000000..8e60709 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PlanBrokerMapper.java @@ -0,0 +1,43 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PlanBrokerDTO; +import com.qsoft.erp.model.PlanBroker; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PlanBrokerMapper { + + PlanBrokerMapper INSTANCE = Mappers.getMapper(PlanBrokerMapper.class); + + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + @Mapping(source = "plaNombre", target = "plaCodigo.plaNombre") + @Mapping(source = "plaProducto", target = "plaCodigo.plaProducto") + @Mapping(source = "plaValorAnual", target = "plaCodigo.plaValorAnual") + @Mapping(source = "plaValorMensual", target = "plaCodigo.plaValorMensual") + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + @Mapping(source = "empIdentificacion", target = "empCodigo.empIdentificacion") + @Mapping(source = "empRazonSocial", target = "empCodigo.empRazonSocial") + PlanBroker getEntidad(PlanBrokerDTO planBrokerDTO); + + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + @Mapping(target = "plaNombre", source = "plaCodigo.plaNombre") + @Mapping(target = "plaProducto", source = "plaCodigo.plaProducto") + @Mapping(target = "plaValorAnual", source = "plaCodigo.plaValorAnual") + @Mapping(target = "plaValorMensual", source = "plaCodigo.plaValorMensual") + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + @Mapping(target = "empIdentificacion", source = "empCodigo.empIdentificacion") + @Mapping(target = "empRazonSocial", source = "empCodigo.empRazonSocial") + PlanBrokerDTO getDto(PlanBroker planBroker); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PlanMapper.java new file mode 100644 index 0000000..ee24b4d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PlanMapper.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PlanDTO; +import com.qsoft.erp.model.CoberturasPlan; +import com.qsoft.erp.model.Plan; +import java.util.ArrayList; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PlanMapper { + + PlanMapper INSTANCE = Mappers.getMapper(PlanMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "detModalidad", target = "detModalidad.detCodigo") + @Mapping(source = "detDeducible", target = "detDeducible.detCodigo") + @Mapping(source = "detTarifario", target = "detTarifario.detCodigo") + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + Plan getEntidad(PlanDTO rolDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "detModalidad", source = "detModalidad.detCodigo") + @Mapping(target = "detDeducible", source = "detDeducible.detCodigo") + @Mapping(target = "detTarifario", source = "detTarifario.detCodigo") + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + PlanDTO getDto(Plan rol); + + @AfterMapping + default void validaObjetos(Plan plan, @MappingTarget PlanDTO planDTO) { + planDTO.setCoberturasPlan(new ArrayList<>()); + if (plan.getCoberturasPlanCollection() != null && !plan.getCoberturasPlanCollection().isEmpty()) { + for (CoberturasPlan el : plan.getCoberturasPlanCollection()) { + planDTO.getCoberturasPlan().add(CoberturasPlanMapper.INSTANCE.getDto(el)); + } + } + + + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaMapper.java new file mode 100644 index 0000000..959dcce --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaMapper.java @@ -0,0 +1,17 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Plantilla; +import com.qsoft.erp.dto.PlantillaDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface PlantillaMapper { + + PlantillaMapper INSTANCE = Mappers.getMapper(PlantillaMapper.class); + + Plantilla getEntidad(PlantillaDTO plantilla); + + PlantillaDTO getDto(Plantilla plantilla); + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaSmtpMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaSmtpMapper.java new file mode 100644 index 0000000..d411b4e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PlantillaSmtpMapper.java @@ -0,0 +1,22 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.PlantillaSmtp; +import com.qsoft.erp.dto.PlantillaSmtpDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface PlantillaSmtpMapper { + + PlantillaSmtpMapper INSTANCE = Mappers.getMapper(PlantillaSmtpMapper.class); + + @Mapping(source = "parCodigo", target = "parCodigo.parCodigo") + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + PlantillaSmtp getEntidad(PlantillaSmtpDTO plantillaSmtp); + + @Mapping(target = "parCodigo", source = "parCodigo.parCodigo") + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + PlantillaSmtpDTO getDto(PlantillaSmtp plantillaSmtp); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PolizaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PolizaMapper.java new file mode 100644 index 0000000..7b4a73d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PolizaMapper.java @@ -0,0 +1,94 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.dominio.util.PolizaUtil; +import com.qsoft.erp.dto.PolizaDTO; +import com.qsoft.erp.model.EstadoPoliza; +import com.qsoft.erp.model.Poliza; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PolizaMapper { + + PolizaMapper INSTANCE = Mappers.getMapper(PolizaMapper.class); + + @Mapping(source = "detModalidad", target = "detModalidad.detCodigo") + @Mapping(source = "detSucursalIfi", target = "detSucursalIfi.detCodigo") + @Mapping(source = "detFormaPago", target = "detFormaPago.detCodigo") + @Mapping(source = "detPeriodicidad", target = "detPeriodicidad.detCodigo") + @Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo") + @Mapping(source = "modalidadNemonico", target = "detModalidad.detNemonico") + @Mapping(source = "periodicidadNemonico", target = "detPeriodicidad.detNemonico") + @Mapping(source = "formaPagoNemonico", target = "detFormaPago.detNemonico") + @Mapping(source = "detIfi", target = "detIfi.detCodigo") + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + Poliza getEntidad(PolizaDTO pagoDTO); + + @Mapping(target = "detModalidad", source = "detModalidad.detCodigo") + @Mapping(target = "detSucursalIfi", source = "detSucursalIfi.detCodigo") + @Mapping(target = "detPeriodicidad", source = "detPeriodicidad.detCodigo") + @Mapping(target = "detFormaPago", source = "detFormaPago.detCodigo") + @Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo") + @Mapping(target = "modalidadNemonico", source = "detModalidad.detNemonico") + @Mapping(target = "periodicidadNemonico", source = "detPeriodicidad.detNemonico") + @Mapping(target = "formaPagoNemonico", source = "detFormaPago.detNemonico") + @Mapping(target = "detIfi", source = "detIfi.detCodigo") + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + PolizaDTO getDto(Poliza pago); + + @AfterMapping + default void cargaArchivos(Poliza poliza, @MappingTarget PolizaDTO polizaDTO) { + if (poliza.getPolObservacion() != null && !poliza.getPolObservacion().isBlank()) { + polizaDTO.setPoliza(DominioUtil.getArchivo(poliza.getPolObservacion())); + polizaDTO.setPolObservacion(DominioUtil.getNombreArchivo(poliza.getPolObservacion().trim())); + } + + if (poliza.getPolAceptacion() != null && !poliza.getPolAceptacion().isBlank()) { + polizaDTO.setPolAceptacion(DominioUtil.getArchivo(poliza.getPolAceptacion().trim())); + } + } + + @AfterMapping + default void validarNulos(Poliza poliza, @MappingTarget PolizaDTO polizaDTO){ + if(poliza.getPlaCodigo() != null && poliza.getPlaCodigo().getPlaCodigo() == null){ + poliza.setPlaCodigo(null); + } + if(poliza.getDetIfi() != null && poliza.getDetIfi().getDetCodigo() == null){ + poliza.setDetIfi(null); + } + if(poliza.getDetSucursalIfi()!= null && poliza.getDetSucursalIfi().getDetCodigo() == null){ + poliza.setDetSucursalIfi(null); + } + } + + @AfterMapping + default void cargarEstadoActual(Poliza poliza, @MappingTarget PolizaDTO polizaDTO){ + PolizaUtil polUtil = new PolizaUtil(); + try { + EstadoPoliza ultimo = polUtil.buscarUltimoEstadoActivo(poliza, new DaoGenerico<>(EstadoPoliza.class)); + if(ultimo != null){ + polizaDTO.setDetEstado(ultimo.getDetEstado().getDetCodigo()); + polizaDTO.setEstadoNemonico(ultimo.getDetEstado().getDetNemonico()); + } + } catch (DaoException ex) { + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PrestadorMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PrestadorMapper.java new file mode 100644 index 0000000..8e9df4b --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PrestadorMapper.java @@ -0,0 +1,65 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PrestadorDTO; +import com.qsoft.erp.model.Prestador; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PrestadorMapper { + + PrestadorMapper INSTANCE = Mappers.getMapper(PrestadorMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "preTipo", target = "detTipo.detNombre") + @Mapping(source = "tipoNemonico", target = "detTipo.detNemonico") + @Mapping(source = "detIfi", target = "detIfi.detCodigo") + @Mapping(source = "ifiNombre", target = "detIfi.detNombre") + @Mapping(source = "ifiNemonico", target = "detIfi.detNemonico") + @Mapping(source = "detTipoCuenta", target = "detTipoCuenta.detCodigo") + @Mapping(source = "tipoCuentaNombre", target = "detTipoCuenta.detNombre") + @Mapping(source = "tipoCuentanemonico", target = "detTipoCuenta.detNemonico") + @Mapping(source = "locCodigo", target = "locCodigo.locCodigo") + @Mapping(source = "locNombre", target = "locCodigo.locNombre") + Prestador getEntidad(PrestadorDTO prestadorDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "preTipo", source = "detTipo.detNombre") + @Mapping(target = "tipoNemonico", source = "detTipo.detNemonico") + @Mapping(target = "detIfi", source = "detIfi.detCodigo") + @Mapping(target = "ifiNombre", source = "detIfi.detNombre") + @Mapping(target = "ifiNemonico", source = "detIfi.detNemonico") + @Mapping(target = "detTipoCuenta", source = "detTipoCuenta.detCodigo") + @Mapping(target = "tipoCuentaNombre", source = "detTipoCuenta.detNombre") + @Mapping(target = "tipoCuentanemonico", source = "detTipoCuenta.detNemonico") + @Mapping(target = "locCodigo", source = "locCodigo.locCodigo") + @Mapping(target = "locNombre", source = "locCodigo.locNombre") + PrestadorDTO getDto(Prestador prestador); + + @AfterMapping + default void validaNulos(PrestadorDTO prestadorDTO, @MappingTarget Prestador prestador) { + if (prestador.getDetTipo() != null && prestador.getDetTipo().getDetCodigo() == null) { + prestador.setDetTipo(null); + } + if (prestador.getDetIfi()!= null && prestador.getDetIfi().getDetCodigo() == null) { + prestador.setDetIfi(null); + } + if (prestador.getDetTipoCuenta()!= null && prestador.getDetTipoCuenta().getDetCodigo() == null) { + prestador.setDetTipoCuenta(null); + } + + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/PrivilegioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/PrivilegioMapper.java new file mode 100644 index 0000000..22e4382 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/PrivilegioMapper.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.PrivilegioDTO; +import com.qsoft.erp.model.Privilegio; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface PrivilegioMapper { + + PrivilegioMapper INSTANCE = Mappers.getMapper(PrivilegioMapper.class); + + @Mapping(source = "opcCodigo", target = "opcCodigo.opcCodigo") + @Mapping(source = "rolCodigo", target = "rolCodigo.rolCodigo") + Privilegio getEntidad(PrivilegioDTO privilegioDTO); + + @Mapping(source = "opcCodigo.opcCodigo", target = "opcCodigo") + @Mapping(source = "rolCodigo.rolCodigo", target = "rolCodigo") + PrivilegioDTO getDto(Privilegio privilegio); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/RolMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/RolMapper.java new file mode 100644 index 0000000..3bab60d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/RolMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.RolDTO; +import com.qsoft.erp.model.Rol; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface RolMapper { + + RolMapper INSTANCE = Mappers.getMapper(RolMapper.class); + + Rol getEntidad(RolDTO rolDTO); + + RolDTO getDto(Rol rol); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/RolUsuarioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/RolUsuarioMapper.java new file mode 100644 index 0000000..14d1861 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/RolUsuarioMapper.java @@ -0,0 +1,22 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.RolUsuarioDTO; +import com.qsoft.erp.model.RolUsuario; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface RolUsuarioMapper { + + RolUsuarioMapper INSTANCE = Mappers.getMapper(RolUsuarioMapper.class); + + @Mapping(source = "rolCodigo", target = "rolCodigo.rolCodigo") + @Mapping(source = "usuCodigo", target = "usuCodigo.usuCodigo") + RolUsuario getEntidad(RolUsuarioDTO rolUsuario); + + @Mapping(target = "rolCodigo", source = "rolCodigo.rolCodigo") + @Mapping(target = "usuCodigo", source = "usuCodigo.usuCodigo") + RolUsuarioDTO getDto(RolUsuario rolUsuario); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/SecuenciaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/SecuenciaMapper.java new file mode 100644 index 0000000..b374622 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/SecuenciaMapper.java @@ -0,0 +1,17 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.Secuencia; +import com.qsoft.erp.dto.SecuenciaDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface SecuenciaMapper { + + SecuenciaMapper INSTANCE = Mappers.getMapper(SecuenciaMapper.class); + + Secuencia getEntidad(SecuenciaDTO secuencia); + + SecuenciaDTO getDto(Secuencia secuencia); + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/ServiciosMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/ServiciosMapper.java new file mode 100644 index 0000000..1fc52e8 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/ServiciosMapper.java @@ -0,0 +1,10 @@ +package com.qsoft.erp.dominio.mapper; + +public interface ServiciosMapper { + +// ServiciosMapper INSTANCE = Mappers.getMapper(ServiciosMapper.class); +// +// Servicios getEntidad(ServiciosDTO servicios); +// +// ServiciosDTO getDto(Servicios servicios); +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/SucursalEmpresaMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/SucursalEmpresaMapper.java new file mode 100644 index 0000000..1d9b1eb --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/SucursalEmpresaMapper.java @@ -0,0 +1,20 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.SucursalEmpresa; +import com.qsoft.erp.dto.SucursalEmpresaDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface SucursalEmpresaMapper { + + SucursalEmpresaMapper INSTANCE = Mappers.getMapper(SucursalEmpresaMapper.class); + + @Mapping(source = "empCodigo", target = "empCodigo.empCodigo") + SucursalEmpresa getEntidad(SucursalEmpresaDTO sucursalEmpresa); + + @Mapping(target = "empCodigo", source = "empCodigo.empCodigo") + SucursalEmpresaDTO getDto(SucursalEmpresa sucursalEmpresa); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/TarifaLiquidacionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/TarifaLiquidacionMapper.java new file mode 100644 index 0000000..90e073f --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/TarifaLiquidacionMapper.java @@ -0,0 +1,57 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.TarifaLiquidacionDTO; +import com.qsoft.erp.model.TarifaLiquidacion; +import java.util.Objects; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface TarifaLiquidacionMapper { + + TarifaLiquidacionMapper INSTANCE = Mappers.getMapper(TarifaLiquidacionMapper.class); + + @Mapping(source = "delCodigo", target = "delCodigo.delCodigo") + @Mapping(source = "tarCodigo", target = "tarCodigo.tarCodigo") + @Mapping(source = "honCodigo", target = "honCodigo.honCodigo") + @Mapping(source = "tarNombre", target = "tarCodigo.tarNombre") + @Mapping(source = "tarFormaFarma", target = "tarCodigo.tarFormaFarma") + @Mapping(source = "tarPresentacion", target = "tarCodigo.tarPresentacion") + @Mapping(source = "tarConcentracion", target = "tarCodigo.tarConcentracion") + TarifaLiquidacion getEntidad(TarifaLiquidacionDTO tarifaLiquidacionDTO); + + @Mapping(target = "delCodigo", source = "delCodigo.delCodigo") + @Mapping(target = "tarCodigo", source = "tarCodigo.tarCodigo") + @Mapping(target = "honCodigo", source = "honCodigo.honCodigo") + @Mapping(target = "tarNombre", source = "tarCodigo.tarNombre") + @Mapping(target = "tarFormaFarma", source = "tarCodigo.tarFormaFarma") + @Mapping(target = "tarPresentacion", source = "tarCodigo.tarPresentacion") + @Mapping(target = "tarConcentracion", source = "tarCodigo.tarConcentracion") + TarifaLiquidacionDTO getDto(TarifaLiquidacion tarifaLiquidacion); + + @AfterMapping + default void validaNulos(TarifaLiquidacionDTO tarifaLiquidacionDTO, @MappingTarget TarifaLiquidacion tarifaLiquidacion) { + System.out.println(String.format("Esta enviando del talCodigo = %s, el valor .%s.", tarifaLiquidacion.getTalCodigo(), tarifaLiquidacionDTO.getTarCodigo())); + if (tarifaLiquidacion.getTarCodigo().getTarCodigo() == null) { + tarifaLiquidacion.setTarCodigo(null); + } + + + if (tarifaLiquidacion.getHonCodigo().getHonCodigo() == null) { + tarifaLiquidacion.setHonCodigo(null); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/TarifarioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/TarifarioMapper.java new file mode 100644 index 0000000..1dae623 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/TarifarioMapper.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.TarifarioDTO; +import com.qsoft.erp.model.Tarifario; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface TarifarioMapper { + + TarifarioMapper INSTANCE = Mappers.getMapper(TarifarioMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "tipoNombre", target = "detTipo.detNemonico") + @Mapping(source = "tipoNemonico", target = "detTipo.detNombre") + Tarifario getEntidad(TarifarioDTO tarifarioDTO); + + @Mapping(target = "detTipo", source = "detTipo.detCodigo") + @Mapping(target = "tipoNombre", source = "detTipo.detNemonico") + @Mapping(target = "tipoNemonico", source = "detTipo.detNombre") + TarifarioDTO getDto(Tarifario tarifario); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/TelefonoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/TelefonoMapper.java new file mode 100644 index 0000000..4211648 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/TelefonoMapper.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.TelefonoDTO; +import com.qsoft.erp.model.Telefono; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface TelefonoMapper { + + TelefonoMapper INSTANCE = Mappers.getMapper(TelefonoMapper.class); + + @Mapping(source = "detTipo", target = "detTipo.detCodigo") + @Mapping(source = "detNombreTipo", target = "detTipo.detNombre") + @Mapping(source = "perCodigo", target = "perCodigo.perCodigo") + Telefono getEntidad(TelefonoDTO telefonoDTO); + + @Mapping(source = "detTipo.detCodigo", target = "detTipo") + @Mapping(source = "detTipo.detNombre", target = "detNombreTipo") + @Mapping(source = "perCodigo.perCodigo", target = "perCodigo") + TelefonoDTO getDto(Telefono telefono); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioMapper.java new file mode 100644 index 0000000..ba48008 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioMapper.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.UsuarioDTO; +import com.qsoft.erp.model.Usuario; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface UsuarioMapper { + + UsuarioMapper INSTANCE = Mappers.getMapper(UsuarioMapper.class); + + Usuario getEntidad(UsuarioDTO usuarioDTO); + + UsuarioDTO getDto(Usuario usuario); + + @AfterMapping + default void validaObjetos(UsuarioDTO usuarioDTO, @MappingTarget Usuario usuario){ + + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioPasswordMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioPasswordMapper.java new file mode 100644 index 0000000..cdf6370 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/UsuarioPasswordMapper.java @@ -0,0 +1,29 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.UsuarioPasswordDTO; +import com.qsoft.erp.model.UsuarioPassword; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface UsuarioPasswordMapper { + + UsuarioPasswordMapper INSTANCE = Mappers.getMapper(UsuarioPasswordMapper.class); + + @Mapping(source = "usuCodigo", target = "usuCodigo.usuCodigo") + UsuarioPassword getEntidad(UsuarioPasswordDTO usuarioPasswordDTO); + + @Mapping(source = "usuCodigo.usuCodigo", target = "usuCodigo") + UsuarioPasswordDTO getDto(UsuarioPassword usuarioPassword); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqperpolMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqperpolMapper.java new file mode 100644 index 0000000..e10453d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqperpolMapper.java @@ -0,0 +1,58 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dto.VwLiqperpolDTO; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.VwLiqperpol; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwLiqperpolMapper { + + VwLiqperpolMapper INSTANCE = Mappers.getMapper(VwLiqperpolMapper.class); + + VwLiqperpol getEntidad(VwLiqperpolDTO vwLiqperpolDTO); + + VwLiqperpolDTO getDto(VwLiqperpol vwLiqperpol); + + @AfterMapping + default void validaObjetos(VwLiqperpol liquidacion, @MappingTarget VwLiqperpolDTO liquidacionDTO) { + liquidacionDTO.setDocumentos(new ArrayList<>()); + DaoGenerico daol = new DaoGenerico<>(Liquidacion.class); + try { + Liquidacion liq = daol.cargar(liquidacion.getLiqCodigo()); + + if (liq.getDocumentoCollection() != null && !liq.getDocumentoCollection().isEmpty()) { + for (Documento doc : liq.getDocumentoCollection()) { + if (doc.getDocEstado().equals(DominioConstantes.ACTIVO)) { + Map fila = new HashMap<>(); + fila.put("docCodigo", "" + doc.getDocCodigo()); + fila.put("docNombre", doc.getDocNombre()); + liquidacionDTO.getDocumentos().add(fila); + } + } + } + } catch (DaoException ex) { + System.out.println("ERROR consultando liquidacion " + ex); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqtoMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqtoMapper.java new file mode 100644 index 0000000..9ff708c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwLiqtoMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwLiqtoDTO; +import com.qsoft.erp.model.VwLiqto; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwLiqtoMapper { + + VwLiqtoMapper INSTANCE = Mappers.getMapper(VwLiqtoMapper.class); + + VwLiqto getEntidad(VwLiqtoDTO vwPeliqpreDTO); + + VwLiqtoDTO getDto(VwLiqto vwPeliqpre); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwPagosCpnMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwPagosCpnMapper.java new file mode 100644 index 0000000..28680b6 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwPagosCpnMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwPagosCpnDTO; +import com.qsoft.erp.model.VwPagosCpn; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwPagosCpnMapper { + + VwPagosCpnMapper INSTANCE = Mappers.getMapper(VwPagosCpnMapper.class); + + VwPagosCpn getEntidad(VwPagosCpnDTO vwPolPerBanDTO); + + VwPagosCpnDTO getDto(VwPagosCpn vwPolPerBan); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwPeliqpreMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwPeliqpreMapper.java new file mode 100644 index 0000000..0170b6d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwPeliqpreMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwPeliqpreDTO; +import com.qsoft.erp.model.VwPeliqpre; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwPeliqpreMapper { + + VwPeliqpreMapper INSTANCE = Mappers.getMapper(VwPeliqpreMapper.class); + + VwPeliqpre getEntidad(VwPeliqpreDTO vwPeliqpreDTO); + + VwPeliqpreDTO getDto(VwPeliqpre vwPeliqpre); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwPolPerBanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwPolPerBanMapper.java new file mode 100644 index 0000000..e4e3d76 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwPolPerBanMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwPolPerBanDTO; +import com.qsoft.erp.model.VwPolPerBan; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwPolPerBanMapper { + + VwPolPerBanMapper INSTANCE = Mappers.getMapper(VwPolPerBanMapper.class); + + VwPolPerBan getEntidad(VwPolPerBanDTO vwPolPerBanDTO); + + VwPolPerBanDTO getDto(VwPolPerBan vwPolPerBan); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwPrestacionesPlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwPrestacionesPlanMapper.java new file mode 100644 index 0000000..1bf3beb --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwPrestacionesPlanMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwPrestacionesPlanDTO; +import com.qsoft.erp.model.VwPrestacionesPlan; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwPrestacionesPlanMapper { + + VwPrestacionesPlanMapper INSTANCE = Mappers.getMapper(VwPrestacionesPlanMapper.class); + + VwPrestacionesPlan getEntidad(VwPrestacionesPlanDTO vwPrestacionesPlanDTO); + + VwPrestacionesPlanDTO getDto(VwPrestacionesPlan vwPrestacionesPlan); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwRepdrMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwRepdrMapper.java new file mode 100644 index 0000000..a0b0b6e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwRepdrMapper.java @@ -0,0 +1,17 @@ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.model.VwRepdr; +import com.qsoft.erp.dto.VwRepdrDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface VwRepdrMapper { + + VwRepdrMapper INSTANCE = Mappers.getMapper(VwRepdrMapper.class); + + VwRepdr getEntidad(VwRepdrDTO vwRepdr); + + VwRepdrDTO getDto(VwRepdr vwRepdr); + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwReporteProduccionMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwReporteProduccionMapper.java new file mode 100644 index 0000000..7476922 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwReporteProduccionMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwReporteProduccionDTO; +import com.qsoft.erp.model.VwReporteProduccion; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwReporteProduccionMapper { + + VwReporteProduccionMapper INSTANCE = Mappers.getMapper(VwReporteProduccionMapper.class); + + VwReporteProduccion getEntidad(VwReporteProduccionDTO vwReporteProduccionDTO); + + VwReporteProduccionDTO getDto(VwReporteProduccion vwReporteProduccion); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwRepprimaPlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwRepprimaPlanMapper.java new file mode 100644 index 0000000..a8576f9 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwRepprimaPlanMapper.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dto.VwRepprimaPlanDTO; +import com.qsoft.erp.model.VwRepprimaPlan; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwRepprimaPlanMapper { + + VwRepprimaPlanMapper INSTANCE = Mappers.getMapper(VwRepprimaPlanMapper.class); + + VwRepprimaPlan getEntidad(VwRepprimaPlanDTO vwReprimaPlanDTO); + + VwRepprimaPlanDTO getDto(VwRepprimaPlan vwReprimaPlan); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/mapper/VwUsuarioPersonaPolizaPlanMapper.java b/src/main/java/com/qsoft/erp/dominio/mapper/VwUsuarioPersonaPolizaPlanMapper.java new file mode 100644 index 0000000..5c55526 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/mapper/VwUsuarioPersonaPolizaPlanMapper.java @@ -0,0 +1,29 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.mapper; + +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.dto.VwUsuarioPersonaPolizaPlanDTO; +import com.qsoft.erp.model.VwUsuarioPersonaPolizaPlan; +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Mapper +public interface VwUsuarioPersonaPolizaPlanMapper { + + VwUsuarioPersonaPolizaPlanMapper INSTANCE = Mappers.getMapper(VwUsuarioPersonaPolizaPlanMapper.class); + + VwUsuarioPersonaPolizaPlan getEntidad(VwUsuarioPersonaPolizaPlanDTO vwUsuarioPersonaPolizaPlanDTO); + + VwUsuarioPersonaPolizaPlanDTO getDto(VwUsuarioPersonaPolizaPlan vwUsuarioPersonaPolizaPlan); + +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/AuxLiquidacion.java b/src/main/java/com/qsoft/erp/dominio/transaccion/AuxLiquidacion.java new file mode 100644 index 0000000..0c080d3 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/AuxLiquidacion.java @@ -0,0 +1,131 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.CoberturasPlan; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.Plan; +import com.qsoft.erp.model.TarifaLiquidacion; +import com.qsoft.erp.model.Tarifario; + +/** + * + * @author james + */ +public class AuxLiquidacion { + + private Plan plaCodigo; + private Persona perBeneficiario; + private Liquidacion liqCodigo; + private EstadoLiquidacion eslCodigo; + private DetalleLiquidacion delCodigo; + private TarifaLiquidacion talCodigo; + private CoberturasPlan copCodigo; + private Tarifario tarCodigo; + private DetalleCatalogo detPrestacion; + private DetalleCatalogo detCie10; + + /** + * + */ + public void guardaTarifa() { + try { + if (this.getTalCodigo() != null && this.getTalCodigo().getTalCodigo() != null ) { + DaoGenerico daoTl = new DaoGenerico<>(TarifaLiquidacion.class); + daoTl.actualizar(this.getTalCodigo()); + } + } catch (DaoException ex) { + System.out.println("No se puede actualizar Tarifa " + ex); + } + } + + public Plan getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Plan plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Persona getPerBeneficiario() { + return perBeneficiario; + } + + public void setPerBeneficiario(Persona perBeneficiario) { + this.perBeneficiario = perBeneficiario; + } + + public Liquidacion getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Liquidacion liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public DetalleCatalogo getDetCie10() { + return detCie10; + } + + public void setDetCie10(DetalleCatalogo detCie10) { + this.detCie10 = detCie10; + } + + public EstadoLiquidacion getEslCodigo() { + return eslCodigo; + } + + public void setEslCodigo(EstadoLiquidacion eslCodigo) { + this.eslCodigo = eslCodigo; + } + + public DetalleLiquidacion getDelCodigo() { + return delCodigo; + } + + public void setDelCodigo(DetalleLiquidacion delCodigo) { + this.delCodigo = delCodigo; + } + + public TarifaLiquidacion getTalCodigo() { + return talCodigo; + } + + public void setTalCodigo(TarifaLiquidacion talCodigo) { + this.talCodigo = talCodigo; + } + + public CoberturasPlan getCopCodigo() { + return copCodigo; + } + + public void setCopCodigo(CoberturasPlan copCodigo) { + this.copCodigo = copCodigo; + } + + public Tarifario getTarCodigo() { + return tarCodigo; + } + + public void setTarCodigo(Tarifario tarCodigo) { + this.tarCodigo = tarCodigo; + } + + public DetalleCatalogo getDetPrestacion() { + return detPrestacion; + } + + public void setDetPrestacion(DetalleCatalogo detPrestacion) { + this.detPrestacion = detPrestacion; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/LiquidacionSum.java b/src/main/java/com/qsoft/erp/dominio/transaccion/LiquidacionSum.java new file mode 100644 index 0000000..9efff33 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/LiquidacionSum.java @@ -0,0 +1,457 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; + +import com.qsoft.erp.dto.ValoresLiquidacion; +import com.qsoft.erp.model.CoberturasPlan; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.Plan; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class LiquidacionSum { + + private final static String LIMITE_CUPO = "Ha alcanzado el limite de cobertura para el asegurado"; + + ArrayList data; + ArrayList histo; + private Liquidacion liquidacion; + + public LiquidacionSum(Liquidacion liquidacion) { + this(); + this.liquidacion = liquidacion; + } + + public LiquidacionSum() { + this.data = new ArrayList<>(); + this.histo = new ArrayList<>(); + } + + public ArrayList getData() { + return data; + } + + public ArrayList getHisto() { + return histo; + } + + public void setData(ArrayList data) { + this.data = data; + } + + public void setHisto(ArrayList histo) { + this.histo = histo; + } + + public Liquidacion getLiquidacion() { + return liquidacion; + } + + public void setLiquidacion(Liquidacion liquidacion) { + this.liquidacion = liquidacion; + } + + /** + * + */ + public void mayorizar() { + this.liquidacion.setLiqCopago(0.0); + this.liquidacion.setLiqDeducible(0.0); + this.liquidacion.setLiqObjetado(0.0); + this.liquidacion.setLiqRegistrado(0.0); + this.liquidacion.setLiqTotalLiquidado(0.0); + this.liquidacion.setLiqRetenido(0.0); + System.out.println("************************* Mayorizar..."); + + for (DetalleLiquidacion del : this.getDetalles()) { + Double delCopa = 0.0; + Double delDedu = 0.0; + Double delPag = 0.0; + StringBuilder observa = new StringBuilder(); + for (AuxLiquidacion aux : this.data) { + if (del.getDelCodigo().equals(aux.getDelCodigo().getDelCodigo()) + && aux.getTalCodigo().getTarObservacion() != null && !aux.getTalCodigo().getTarObservacion().isBlank()) { + observa.append(aux.getTalCodigo().getTarObservacion()).append("\n"); + } + if (del.getDelCodigo().equals(aux.getDelCodigo().getDelCodigo()) + && aux.getTalCodigo().getTalValorCopago() != null && aux.getTalCodigo().getTalValorCopago() > 0.0) { + delCopa += aux.getTalCodigo().getTalValorCopago(); + } + if (del.getDelCodigo().equals(aux.getDelCodigo().getDelCodigo()) + && aux.getTalCodigo().getTalValorDeducible() != null && aux.getTalCodigo().getTalValorDeducible() > 0.0) { + delDedu += aux.getTalCodigo().getTalValorDeducible(); + } + if (del.getDelCodigo().equals(aux.getDelCodigo().getDelCodigo()) + && aux.getTalCodigo().getTalValorPagado() != null && aux.getTalCodigo().getTalValorPagado() > 0.0) { + delPag += aux.getTalCodigo().getTalValorPagado(); + } + } + del.setDelDescripcion(observa.toString()); + del.setDelCopagoPagado(delCopa); + del.setDelDeduciblePagado(delDedu); + del.setDelValorPagado(delPag); + System.out.println("\t************ OK DETALLE " + del.getDelCodigo() + " =>COP: " + del.getDelCopagoPagado() + + " =>DED: " + del.getDelDeduciblePagado() + " PAG: " + del.getDelValorPagado()); + this.liquidacion.setLiqRegistrado(this.liquidacion.getLiqRegistrado() + del.getDelValorRegistrado()); + this.liquidacion.setLiqObjetado(this.liquidacion.getLiqObjetado() + del.getDelValorObjetado()); + this.liquidacion.setLiqCopago(this.liquidacion.getLiqCopago() + del.getDelCopagoPagado()); + this.liquidacion.setLiqDeducible(this.liquidacion.getLiqDeducible() + del.getDelDeduciblePagado()); + this.liquidacion.setLiqTotalLiquidado(this.liquidacion.getLiqTotalLiquidado() + del.getDelValorPagado()); + } + } + + /** + * + * @param copagos + * @param deducible + * @param maxPoliza + */ + public void procesarPorCobertura(Map copagos, ValoresLiquidacion deducible, Double maxPoliza) { + for (Map.Entry entry : copagos.entrySet()) { + double maxCobertura = 0.0; + if (entry.getValue().getCoberturaDisponible() <= maxPoliza) { + maxCobertura = entry.getValue().getCoberturaDisponible(); + } else { + maxCobertura = maxPoliza * 1.0; + } + double maxCopago = entry.getKey().getCopCopago(); + System.out.println(">>>>========== COPAGO => " + entry.getKey().getDetTipo().getDetDescripcion()); + System.out.println(">>>>========== MAXIMA COBERTURA=> " + maxCobertura); + for (AuxLiquidacion aux : this.getData()) { + if (aux.getCopCodigo().getCopCodigo().equals(entry.getKey().getCopCodigo())) { + double objetado = 0.0; + if (aux.getTalCodigo().getTalValorObjetado() != null && aux.getTalCodigo().getTalValorObjetado() > 0.0) { + objetado = aux.getTalCodigo().getTalValorObjetado(); + } + //TODO: validar + /* + objetado = this.procesaDeducible(aux, deducible, objetado); + if (aux.getCopCodigo().getCopCodigo().equals(entry.getKey().getCopCodigo()) && objetado > 0.0) { + Double[] data = this.procesaPago(aux, objetado, maxCobertura, maxCopago); + objetado = data[0]; + maxCobertura = data[1]; + maxCopago = data[2]; + maxPoliza -= aux.getTalCodigo().getTalValorPagado() != null? aux.getTalCodigo().getTalValorPagado(): 0.0; + } + */ + //objetado = this.procesaDeducible(aux, deducible, objetado); + if (objetado > 0.0) { + Double[] data = this.procesaPago(aux, objetado, maxCobertura, maxCopago, deducible); + objetado = data[0]; + maxCobertura = data[1]; + maxCopago = data[2]; + maxPoliza -= aux.getTalCodigo().getTalValorPagado() != null ? aux.getTalCodigo().getTalValorPagado() : 0.0; + } + } + + } + } + } + + /** + * + * @param aux + * @param objetado + * @param maxCobertura + * @param maxCopago + * @return + */ + private Double[] procesaPago(AuxLiquidacion aux, Double objetado, Double maxCobertura, Double maxCopago, ValoresLiquidacion deducible) { + double paga = 0.0; + double copago = 0.0; + if (maxCopago > 1.0) { + objetado = this.procesaDeducible(aux, deducible, objetado); //TODO : pilas aqui + if (objetado >= maxCopago) { + copago = maxCopago; + objetado -= copago; + maxCopago = 0.0; + } else { + copago = objetado; + objetado = 0.0; + maxCopago -= objetado; + } + aux.getTalCodigo().setTalValorCopago(copago); + if (objetado <= maxCobertura) { + paga = objetado; + maxCobertura -= objetado; + objetado = 0.0; + } else { + paga = maxCobertura; + objetado -= paga; + maxCobertura = 0.0; + } + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t >>> COPAGO POR VALOR max: " + maxCobertura + " cop: " + copago + " => pag: " + paga); + } + aux.getTalCodigo().setTalValorPagado(paga); + } else { //COPAGO EN PORCENTAJE + copago = objetado * maxCopago; + objetado -= copago; + double dedu = this.getDeducible(aux, deducible, objetado); //TODO : pilas aqui + objetado -= dedu; + if (objetado <= maxCobertura) { + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t\t >>> Reduce maximo cobertura(IF) max: " + maxCobertura + " paga: " + objetado); + } + paga = objetado; + maxCobertura -= objetado; + objetado = 0.0; + } else { //TODO: revisar + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t\t >>> Reduce maximo cobertura(ELSE) max: " + maxCobertura + " paga: " + objetado); + } + paga = maxCobertura * (1 - maxCopago); + copago = maxCobertura - paga; + objetado -= (paga + copago); + maxCobertura = 0.0; + } + aux.getTalCodigo().setTalValorCopago(copago); + aux.getTalCodigo().setTalValorPagado(paga); + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t >>> COPAGO POR PORCENTAJE max: " + maxCobertura + " cop: " + copago + " pag: " + paga); + } + } + return new Double[]{objetado, maxCobertura, maxCopago}; + } + + /** + * + * @param aux + * @param deducible + * @param objetado + */ + private Double procesaDeducible(AuxLiquidacion aux, ValoresLiquidacion deducible, Double objetado) { + if (deducible.getDeduciblePendiente() > 0.0 && objetado > 0.0) { ///TODO: esta c ondicion no necesariamente esta bien + if (aux.getTalCodigo().getTalValorObjetado() >= deducible.getDeduciblePendiente()) { + aux.getTalCodigo().setTalValorDeducible(deducible.getDeduciblePendiente()); + deducible.setDeduciblePendiente(0.0); + } else { + aux.getTalCodigo().setTalValorDeducible(aux.getTalCodigo().getTalValorObjetado()); + deducible.setDeduciblePendiente(deducible.getDeduciblePendiente() - aux.getTalCodigo().getTalValorObjetado()); + } + objetado = aux.getTalCodigo().getTalValorObjetado() - aux.getTalCodigo().getTalValorDeducible(); + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t >>> CALCULO DEDUCIBLE ded: " + aux.getTalCodigo().getTalValorDeducible() + " max: " + objetado); + } + } + return objetado; + } + + /** + * + * @param aux + * @param deducible + * @param maximo + */ + private Double getDeducible(AuxLiquidacion aux, ValoresLiquidacion deducible, Double maximo) { + Double ded = 0.0; + if (deducible.getDeduciblePendiente() > 0.0 && maximo > 0.0) { ///TODO: esta condicion no necesariamente esta bien + if (maximo >= deducible.getDeduciblePendiente()) { + aux.getTalCodigo().setTalValorDeducible(deducible.getDeduciblePendiente()); + deducible.setDeduciblePendiente(0.0); + } else { + aux.getTalCodigo().setTalValorDeducible(maximo); + deducible.setDeduciblePendiente(deducible.getDeduciblePendiente() - maximo); + } + ded = aux.getTalCodigo().getTalValorDeducible(); + if (aux.getDelCodigo().getDelCodigo() == 2496) { + System.out.println("\t >>> CALCULO DEDUCIBLE ded: " + ded + " max: " + maximo); + } + } + return ded; + } + + /** + * + * @param histo + * @return + */ + public Map getCopagos() { + Map copagos = new HashMap<>(); + for (CoberturasPlan cob : this.getCoberturas()) { + ValoresLiquidacion valCob = new ValoresLiquidacion(); + valCob.setCopago(cob.getCopCopago()); + valCob.setCobertura(cob.getCopTope()); + valCob.setCoberturaPagada(this.getPagoCubierto(cob, this.getBeneficiario())); + valCob.setCoberturaDisponible(valCob.getCobertura() - valCob.getCoberturaPagada()); + valCob.setValorObjetado(this.getPagoObjetado(cob, this.getBeneficiario())); + copagos.put(cob, valCob); + System.out.println(">>>> TOPES COBERTURA " + cob.getCopCodigo() + " - " + cob.getDetTipo().getDetDescripcion() + "\n\t>> tope: " + cob.getCopTope() + + " pagada: " + valCob.getCoberturaPagada() + " dispo: " + valCob.getCoberturaDisponible() + " obje: " + valCob.getValorObjetado()); + } + return copagos; + } + + /** + * + * @param histo + * @return + */ + public Map getDeducibles() { + Map deducibles = new HashMap<>(); + for (DetalleCatalogo cie : this.getCie10()) { + ValoresLiquidacion valCie = new ValoresLiquidacion(); + valCie.setDeducible(this.getPlan().getPlaValorDeducible()); + valCie.setDeduciblePendiente(this.getDeduciblePendiente(cie, this.getBeneficiario(), this.getPlan())); + valCie.setDeduciblePagado(0.0); + deducibles.put(cie, valCie); + } + return deducibles; + } + + /** + * + * @param cie10 + * @param beneficiario + * @param plan + * @return + */ + private Double getDeduciblePendiente(DetalleCatalogo cie10, Persona beneficiario, Plan plan) { + Double deducible = plan.getPlaValorDeducible(); + for (AuxLiquidacion aux : this.histo) { + if (aux.getPerBeneficiario().getPerCodigo().equals(beneficiario.getPerCodigo()) + && aux.getDetCie10().getDetCodigo().equals(cie10.getDetCodigo())) { + deducible -= aux.getTalCodigo().getTalValorDeducible() != null ? aux.getTalCodigo().getTalValorDeducible() : 0; + } + } + return deducible; + } + + /** + * + * @param cobertura + * @param beneficiario + * @return + */ + private Double getPagoObjetado(CoberturasPlan cobertura, Persona beneficiario) { + Double pago = 0.0; + for (AuxLiquidacion aux : this.data) { + if (aux.getPerBeneficiario().getPerCodigo().equals(beneficiario.getPerCodigo()) + && aux.getCopCodigo().getCopCodigo().equals(cobertura.getCopCodigo())) { + pago += aux.getTalCodigo().getTalValorObjetado() != null ? aux.getTalCodigo().getTalValorObjetado() : 0; + } + } + return pago; + } + + /** + * + * @param cobertura + * @param beneficiario + * @return + */ + private Double getPagoObjetado(Persona beneficiario) { + Double pago = 0.0; + for (AuxLiquidacion aux : this.data) { + if (aux.getPerBeneficiario().getPerCodigo().equals(beneficiario.getPerCodigo())) { + pago += aux.getTalCodigo().getTalValorObjetado() != null ? aux.getTalCodigo().getTalValorObjetado() : 0; + } + } + return pago; + } + + /** + * + * @param beneficiario + * @return + */ + public Double getPagoCubierto(Persona beneficiario) { + Double pago = 0.0; + for (AuxLiquidacion aux : this.histo) { + if (aux.getPerBeneficiario().getPerCodigo().equals(beneficiario.getPerCodigo())) { + pago += aux.getTalCodigo().getTalValorPagado() != null ? aux.getTalCodigo().getTalValorPagado() : 0; + } + } + return pago; + } + + /** + * + * @param cobertura + * @param beneficiario + * @return + */ + public Double getPagoCubierto(CoberturasPlan cobertura, Persona beneficiario) { + Double pago = 0.0; + for (AuxLiquidacion aux : this.data) { + if (aux.getPerBeneficiario().getPerCodigo().equals(beneficiario.getPerCodigo()) + && aux.getCopCodigo().getCopCodigo().equals(cobertura.getCopCodigo())) { + pago += aux.getTalCodigo().getTalValorPagado() != null ? aux.getTalCodigo().getTalValorPagado() : 0.0; + } + } + return pago; + } + + /** + * + * @return + */ + public Persona getBeneficiario() { + for (AuxLiquidacion fila : this.data) { + if (fila.getPerBeneficiario() != null) { + return fila.getPerBeneficiario(); + } + } + return null; + } + + /** + * + * @return + */ + public Plan getPlan() { + for (AuxLiquidacion fila : this.data) { + if (fila.getPlaCodigo() != null) { + return fila.getPlaCodigo(); + } + } + return null; + } + + /** + * + * @return + */ + private Set getCoberturas() { + Set data = new HashSet<>(); + for (AuxLiquidacion fila : this.data) { + data.add(fila.getCopCodigo()); + } + return data; + } + + /** + * + * @return + */ + private Set getCie10() { + Set data = new HashSet<>(); + for (AuxLiquidacion fila : this.data) { + data.add(fila.getDetCie10()); + } + return data; + } + + /** + * + * @param cobertura + * @return + */ + public Set getDetalles() { + Set data = new HashSet<>(); + for (AuxLiquidacion fila : this.data) { + data.add(fila.getDelCodigo()); + } + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/Model.java b/src/main/java/com/qsoft/erp/dominio/transaccion/Model.java new file mode 100644 index 0000000..e37d762 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/Model.java @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; + +/** + * + * @author pedantic + */ + +public class Model { + private String month; + private int numberOfHours; + + public String getMonth() { + return month; + } + + public void setMonth(String month) { + this.month = month; + } + + public int getNumberOfHours() { + return numberOfHours; + } + + public void setNumberOfHours(int numberOfHours) { + this.numberOfHours = numberOfHours; + } + + +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/PaymentService.java b/src/main/java/com/qsoft/erp/dominio/transaccion/PaymentService.java new file mode 100644 index 0000000..3f840ff --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/PaymentService.java @@ -0,0 +1,109 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; + +import com.stripe.Stripe; +import com.stripe.exception.*; +import com.stripe.model.Charge; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; +import com.stripe.model.Charge; +import com.stripe.model.Customer; +import com.stripe.model.PaymentMethod; +import com.stripe.model.Price; +import com.stripe.model.Product; +import com.stripe.model.Subscription; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +/** + * + * @author pedantic + */ +@Stateless +public class PaymentService { + + + public Charge charge(String token, BigDecimal chargeAmount, String paymentCurrency) throws StripeException { + + Map chargeParams = new HashMap<>(); + DecimalFormat df = new DecimalFormat("#.00"); + String valueAmount = df.format(Double.parseDouble(chargeAmount.toString())); + + valueAmount = valueAmount.replace(".", ""); + valueAmount = valueAmount.replace(",", ""); + Integer amount = Integer.parseInt(valueAmount); + chargeParams.put("amount", amount); + chargeParams.put("currency", "usd"); + chargeParams.put("source", token); + chargeParams.put("description", "Pago Sistema de medicina prepagada Medicompanies S.A"); + + return Charge.create(chargeParams); + } + + public Customer createCustomer(String name, String mail) throws StripeException{ + Stripe.apiKey = "sk_test_51HRpHhJSiwKtwzlBGIMZWp5xHo2ywzD8d9Nq8cBP79wZKZA8XdEOcg9bU16xyxTiA5fO0w2XDGkd3yCfcHv5X2qF00fAwHG3ou"; + + Map params = new HashMap<>(); + params.put("description","Cliente creado desde el sistema de medicina prepagada Medicompanies S.A"); + params.put("currency","usd"); + params.put("name",name); + params.put("email",mail); + + + return Customer.create(params); + } + + public Subscription createSuscription(Price price,Customer customer, Date inicioPeriodo, Date finPeriodo) throws StripeException{ + + List items = new ArrayList<>(); + Map item1 = new HashMap<>(); + item1.put( + "price", + price.getId() + ); + items.add(item1); + Map params = new HashMap<>(); + params.put("customer", customer.getId()); + params.put("items", items); + params.put("current_period_start", inicioPeriodo.getTime()); + params.put("current_period_end", finPeriodo.getTime()); + + + return Subscription.create(params); + } + + public Price createPrice (String interval, Double unitAmount, Product product) throws StripeException{ + + Map recurring = new HashMap<>(); + recurring.put("interval", interval );//"month" + Map params = new HashMap<>(); + params.put("unit_amount", unitAmount); + params.put("currency", "usd"); + params.put("recurring", recurring); + params.put("product", product.getId()); + + return Price.create(params); + } + + public Product createProduct(String name) throws StripeException{ + Map params = new HashMap<>(); + params.put("name", name); + + return Product.create(params); + } + + public PaymentMethod agregarPaymentMethodACustomer(String paymentMethodId, Customer customer) throws StripeException{ + PaymentMethod paymentMethod = PaymentMethod.retrieve(paymentMethodId); + Map params = new HashMap<>(); + params.put("customer", customer.getId()); + return paymentMethod.attach(params); + } +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/Stripe.java b/src/main/java/com/qsoft/erp/dominio/transaccion/Stripe.java new file mode 100644 index 0000000..6bfe9b6 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/Stripe.java @@ -0,0 +1,166 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.annotations.SerializedName; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import static com.qsoft.erp.constantes.EntidadEnum.PersonaPoliza; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.Pago; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Poliza; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.stripe.exception.StripeException; +import com.stripe.model.Card; +import com.stripe.model.Charge; +import com.stripe.model.Customer; +import com.stripe.model.ExternalAccountCollection; +import com.stripe.model.PaymentIntent; +import com.stripe.model.PaymentMethod; +import com.stripe.model.PaymentSourceCollection; +import com.stripe.model.Price; +import com.stripe.model.Product; +import com.stripe.model.Subscription; +import com.stripe.model.Token; +import com.stripe.param.PaymentIntentCreateParams; +import java.math.BigDecimal; +import java.nio.file.Paths; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.inject.Inject; +import static spark.Spark.staticFiles; +/** + * + * @author christian + */ +@Stateless +public class Stripe { + + + + @EJB + private PaymentService paymentService; + + static class CreatePayment { + @SerializedName("items") + Object[] items; + + public Object[] getItems() { + return items; + } + } + + static class CreatePaymentResponse { + private String clientSecret; + + public CreatePaymentResponse(String clientSecret) { + this.clientSecret = clientSecret; + } + } + + public Map generatePayment(HeaderMS header, List> entidades, int tipoAccion) throws StripeException, JsonProcessingException, DaoException{ + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + + com.stripe.Stripe.apiKey = DetalleCatalogoEnum.STRAKY.getDetalle().getDetOrigen(); + + Map data = new HashMap<>(); + + for (Map entidade : entidades) { + + Map < String, Object> tokenParam = new HashMap< String, Object> (); + tokenParam.put("card", entidade.get("card")); + + /** --------------------Pago -----*/ + Pago plantillaPago = new Pago(); + plantillaPago.setPagCodigo(Integer.parseInt(entidade.get("pagCodigo").toString())); + Pago pago = daopag.buscarUnico(plantillaPago); + + Charge charge = paymentService.charge(entidade.get("stripeToken").toString(), new BigDecimal(pago.getPagMonto()), "usd"); + + DetalleCatalogo plantillaDetCat = new DetalleCatalogo(); + plantillaDetCat.setDetNemonico("PAG"); + + DetalleCatalogo detEstado = daodet.buscarUnico(plantillaDetCat); + pago.setDetEstado(detEstado); + pago.setPagFechaPago(new Date()); + pago.setPagObservacion(entidade.get("stripeToken").toString()); + + daopag.actualizar(pago); + ObjectMapper mapper = new ObjectMapper(); + data.put("Pago_".concat(pago.getPagCodigo().toString()), mapper.readValue(charge.toJson(), Map.class)); + + + } + + return data; + } + + public Map createSuscription(HeaderMS header, List> entidades, int tipoAccion) throws StripeException, JsonProcessingException, DaoException{ + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daoperpol = new DaoGenerico<>(PersonaPoliza.class); + + //com.stripe.Stripe.apiKey = "sk_test_SVuYrJqSaU7VbjrfZVCI04Ow00gClipHQE"; + com.stripe.Stripe.apiKey = "sk_test_51HRpHhJSiwKtwzlBGIMZWp5xHo2ywzD8d9Nq8cBP79wZKZA8XdEOcg9bU16xyxTiA5fO0w2XDGkd3yCfcHv5X2qF00fAwHG3ou"; + + Map data = new HashMap<>(); + + for (Map entidade : entidades) { + + //Charge charge = paymentService.charge(entidade.get("stripeToken").toString(), new BigDecimal(pago.getPagMonto()), "usd"); + Poliza polizaPlantilla = new Poliza(); + polizaPlantilla.setPolCodigo((Integer) entidade.get("polCodigo")); + + Persona personaPlantilla = new Persona(); + DetalleCatalogo detalleCatalogoPlantilla = new DetalleCatalogo(); + detalleCatalogoPlantilla.setDetNemonico("PTITU"); + + PersonaPoliza personaPolizaPlantilla = new PersonaPoliza(); + personaPolizaPlantilla.setPolCodigo(polizaPlantilla); + personaPolizaPlantilla.setDetTipoPersona(detalleCatalogoPlantilla); + + PersonaPoliza personaPoliza = daoperpol.buscarUnico(personaPolizaPlantilla); + if(personaPoliza.getPolCodigo().getDetPeriodicidad().getDetNemonico().equals("MENS")){ + Pago plantillaPago = new Pago(); + plantillaPago.setPolCodigo(personaPoliza.getPolCodigo()); + List pagosPoliza = daopag.buscarLista(plantillaPago, new String[]{"pagFechaVencimiento","DESC"}); + Product product = paymentService.createProduct(personaPoliza.getPolCodigo().getPolContrato()); + Price price = paymentService.createPrice(entidade.get("intervalo").toString(), pagosPoliza.get(0).getPagMonto(), product); + + Customer customer = paymentService.createCustomer(personaPoliza.getPerCodigo().getPerNombres().concat(" ").concat(personaPoliza.getPerCodigo().getPerApellidos()), personaPoliza.getPerCodigo().getPerMail()); + PaymentMethod paymentMethod = paymentService.agregarPaymentMethodACustomer(entidade.get("paymentMethodId").toString(), customer); + Date fechaInicial = pagosPoliza.get(0).getPagFechaVencimiento(); + Date fechaFInal = pagosPoliza.get(pagosPoliza.size()-1).getPagFechaVencimiento(); + + Subscription subscription = paymentService.createSuscription(price, customer, fechaInicial, fechaFInal); + + data.put(subscription.getId(), subscription.toJson()); + + } + + + } + + return data; + } + + + + +} diff --git a/src/main/java/com/qsoft/erp/dominio/transaccion/UsuarioTransaccion.java b/src/main/java/com/qsoft/erp/dominio/transaccion/UsuarioTransaccion.java new file mode 100644 index 0000000..ebb7c72 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/transaccion/UsuarioTransaccion.java @@ -0,0 +1,659 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.transaccion; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTCreationException; +import com.auth0.jwt.exceptions.JWTVerificationException; +import com.auth0.jwt.interfaces.DecodedJWT; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.otp.OTP; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.ParametroEnum; +import com.qsoft.erp.constantes.QueryEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.UsuarioMapper; +import com.qsoft.erp.dominio.util.DBUtil; +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.dominio.util.NotificadorUtil; +import com.qsoft.erp.dominio.util.OTPUtil; +import com.qsoft.erp.dto.UsuarioDTO; +import com.qsoft.erp.model.Otp; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Usuario; +import com.qsoft.erp.model.UsuarioPassword; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import org.apache.commons.codec.digest.DigestUtils; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import com.qsoft.erp.dto.PrivilegioDTO; +import com.qsoft.erp.dto.RolDTO; + +/** + * + * @author james + */ +@Stateless +public class UsuarioTransaccion { + + @EJB + private DBUtil dBUtil; + + @EJB + private OTPUtil otpUtil; + + @EJB + private NotificadorUtil notificadorUtil; + + @EJB + private DominioUtil dominioUtil; + + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarUsuario(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + UsuarioDTO tramiteDTO = (UsuarioDTO) dominioUtil.crearObjeto(UsuarioDTO.class, ent); + Usuario result = crudUsuario(header, tramiteDTO, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param header + * @param usuario + * @param tipoAccion + * @param ent + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private Usuario crudUsuario(HeaderMS header, UsuarioDTO usuario, int tipoAccion) throws DominioExcepcion { + DaoGenerico daousu = new DaoGenerico<>(Usuario.class); + Usuario result; + result = UsuarioMapper.INSTANCE.getEntidad(usuario); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + String passwd = usuario.getUsuPassword(); + if (passwd == null || passwd.isBlank()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "Error, el Password es requerido"); + } + if (result.getUsuUsuario() == null || result.getUsuUsuario().isBlank()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "Error, el Usuario es requerido"); + } + if (result.getUsuNombre() == null || result.getUsuNombre().isBlank()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "Error, el Nombre es requerido"); + } + if (result.getUsuEmail() == null || result.getUsuEmail().isBlank()) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "Error, el Email es requerido"); + } + String hash = dominioUtil.getSHAUsuario(usuario.getUsuUsuario(), passwd); + UsuarioPassword up = new UsuarioPassword(); + up.setUsuCodigo(result); + up.setPasFecha(new Date()); + up.setPasEstado(DominioConstantes.ACTIVO); + up.setPasValor(hash); + result.setUsuarioPasswordCollection(new ArrayList<>()); + result.getUsuarioPasswordCollection().add(up); + daousu.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + daousu.actualizar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param header + * @param dao + * @param token + * @param password + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List cambiaPassword(HeaderMS header, DaoGenerico dao, String token, String password) throws DominioExcepcion, DaoException { + List result = new ArrayList<>(); + List usuarios = getUsuarioToken(dao, token); + if (usuarios != null) { + for (Usuario user : usuarios) { + Calendar compara = Calendar.getInstance(); + compara.setTime(user.getUsuFechaToken()); + compara.add(Calendar.SECOND, user.getUsuTiempoToken()); + if (compara.getTimeInMillis() >= System.currentTimeMillis()) { + result.add(crearNuevoPassword(dao, user, password)); + } else { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "Error el token a caducado por favor solicite nuevamente el cambio de clave "); + } + } + } + System.out.println("OK CAMBIA PASS " + result.size()); + return result; + } + + /** + * + * @param dao + * @param user + */ + private UsuarioDTO crearNuevoPassword(DaoGenerico dao, Usuario user, String password) throws DaoException, DominioExcepcion { + user.setUsuFechaToken(null); + user.setUsuToken(null); + user.setUsuTiempoToken(null); + dao.actualizar(user); + DaoGenerico daop = new DaoGenerico<>(UsuarioPassword.class); + for (UsuarioPassword up : user.getUsuarioPasswordCollection()) { + up.setPasEstado(DominioConstantes.INACTIVO); + daop.actualizar(up); + } + UsuarioPassword pas = new UsuarioPassword(); + pas.setUsuCodigo(user); + pas.setPasEstado(DominioConstantes.ACTIVO); + pas.setPasFecha(new Date()); + pas.setPasValor(dominioUtil.getSHAUsuario(user.getUsuUsuario(), password)); + daop.guardar(pas); + UsuarioDTO udto = (UsuarioDTO) dominioUtil.getDto(UsuarioMapper.class, user); + return udto; + } + + /** + * + * @param header + * @param dao + * @param usuario + * @param email + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List recuperaPassword(HeaderMS header, DaoGenerico dao, String usuario, String email) + throws DominioExcepcion, DaoException { + List result = new ArrayList<>(); + List usuarios = null; + if (usuario != null && !usuario.isBlank()) { + usuarios = getUsuarios(dao, usuario); + } else if (email != null && !email.isBlank()) { + usuarios = getUsuarioMail(dao, email); + } + if (usuarios != null) { + for (Usuario user : usuarios) { + UsuarioDTO udto = (UsuarioDTO) dominioUtil.getDto(UsuarioMapper.class, user); + System.out.println("PRUEBA DE ENVIO PARA USUARIO " + udto.getUsuNombre()); + String token = this.getToken(header, true); + System.out.println("TOKEN " + token); + user.setUsuFechaToken(new Date()); + user.setUsuToken(token); + user.setUsuTiempoToken(DominioConstantes.TIEMPO_RESET); + dao.actualizar(user); + result.add(udto); + this.notificadorUtil.notificarReset(user); + } + } + System.out.println("OK RECUPERA PASS " + result.size()); + return result; + } + + /** + * + * @param header + * @param dao + * @param usuario + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List enviaOtp(HeaderMS header, DaoGenerico dao, String usuario) + throws DominioExcepcion, DaoException { + List result = new ArrayList<>(); + List usuarios = null; + if (usuario != null) { + usuarios = getUsuarios(dao, usuario); + } + if (usuarios != null) { + for (Usuario user : usuarios) { + UsuarioDTO udto = (UsuarioDTO) dominioUtil.getDto(UsuarioMapper.class, user); + System.out.println("ENVIA OTP " + udto.getUsuNombre()); + Otp otp = otpUtil.generarOtp(user, ParametroEnum.OTPUSR); + user.setUsuFechaToken(null); + user.setUsuToken(null); + user.setUsuTiempoToken(null); + Poliza poliza = dBUtil.actualizaPoliza(user, DetalleCatalogoEnum.ESTAOTP, true); + if (poliza.getPolObservacion() != null && !poliza.getPolObservacion().isBlank()) { + udto.setPoliza(DominioUtil.getArchivo(poliza.getPolObservacion().trim())); + } + if (poliza.getPolAceptacion() != null && !poliza.getPolAceptacion().isBlank()) { + udto.setAceptacion(DominioUtil.getArchivo(poliza.getPolAceptacion().trim())); + } + + dao.actualizar(user); + result.add(udto); + this.notificadorUtil.notificarOTP(user, otp.getOptValor()); + } + } + System.out.println("OK ENVIA OTP " + result.size()); + return result; + } + + /** + * + * @param header + * @param dao + * @param usuario + * @param otpCodigo + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List validaOtp(HeaderMS header, DaoGenerico dao, String usuario, String otpCodigo) + throws DominioExcepcion, DaoException { + List result = new ArrayList<>(); + System.out.println("===================> VALIDA OTP... "); + List usuarios = null; + if (usuario != null) { + usuarios = getUsuarios(dao, usuario); + } + if (usuarios != null) { + for (Usuario user : usuarios) { + UsuarioDTO udto = (UsuarioDTO) dominioUtil.getDto(UsuarioMapper.class, user); + System.out.println("VALIDAR OTP " + udto.getUsuNombre()); + Otp otp = otpUtil.validarOtp(user, otpCodigo); + user.setUsuFechaToken(null); + user.setUsuToken(null); + user.setUsuTiempoToken(null); + if (otp != null && otp.getOtpCodigo() != null) { + Poliza poliza = dBUtil.actualizaPoliza(user, DetalleCatalogoEnum.ESTACT, false); + dao.actualizar(user); + this.notificadorUtil.notificarBienvenida(user, poliza); + result.add(udto); + } + } + } + return result; + } + + /** + * + * @param header + * @param dao + * @param usuario + * @param password + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List login2(HeaderMS header, DaoGenerico dao, String usuario, String password) + throws DominioExcepcion, DaoException{ + + List result = new ArrayList<>(); + String hash = dominioUtil.getSHAUsuario(usuario, password); + String query = String.format(QueryEnum.LOGIN.getParametro().getParValor(), hash); + List usuarios = dao.ejecutarConsultaNativaList(query); + List roles = new ArrayList<>(); + UsuarioDTO udto = null; + if (usuarios != null && !usuarios.isEmpty()) { + boolean imagen = true; + String token = this.getToken(header, false); + Set idRol = new HashSet<>(); + for (Fila f : usuarios) { + RolDTO rdt = new RolDTO(); + rdt.setRolCodigo(f.getEntero(9)); + rdt.setRolNemonico(f.getString(10)); + rdt.setRolNombre(f.getString(11)); + if (!roles.contains(rdt)) { + idRol.add(rdt.getRolCodigo()); + roles.add(rdt); + } + if (udto == null) { + udto = this.crearDto(f, token); + if (imagen && udto.getUsuUrlImagen() != null && !udto.getUsuUrlImagen().isBlank()) { + udto.setImagen(DominioUtil.getArchivo(udto.getUsuUrlImagen())); + udto.setUsuUrlImagen(DominioUtil.getNombreArchivo(udto.getUsuUrlImagen())); + imagen = false; + } + } + } + String ids = idRol.toString().replace("[", "").replace("]", ""); + query = String.format(QueryEnum.LOGROL.getParametro().getParValor(), ids, ids, ids, ids); + List priv = dao.ejecutarConsultaNativaList(query); + roles = crearPrivilegios(priv, roles); + + udto.setRol(roles); + result.add(udto); + } + return result; + } + + /** + * + * @param priv + * @param roles + * @return + */ + public List crearPrivilegios(List priv, List roles) { + List tmp = new ArrayList<>(); + if (priv != null && !priv.isEmpty()) { + for (Fila f : priv) { + PrivilegioDTO pdto = new PrivilegioDTO(); + pdto.setRolCodigo(f.getEntero(0)); + pdto.setPriLectura(f.getEntero(1)); + pdto.setPriEscritura(f.getEntero(2)); + pdto.setPriCreacion(f.getEntero(3)); + pdto.setPriActualizacion(f.getEntero(4)); + pdto.setOpcCodigo(f.getEntero(5)); + pdto.setOpcPadre(f.getEntero(6)); + pdto.setOpcNemonico(f.getString(7)); + pdto.setOpcNombre(f.getString(8)); + pdto.setOpcDescripcion(f.getString(9)); + pdto.setOpcComando(f.getString(10)); + pdto.setOpcEjecucion(f.getString(11)); + pdto.setOpcIcono(f.getString(12)); + tmp.add(pdto); + } + } + for (RolDTO rol : roles) { + rol.setOpciones(new ArrayList<>()); + for (PrivilegioDTO pv : tmp) { + if (pv.getRolCodigo() != null && pv.getRolCodigo().equals(rol.getRolCodigo())) { + if (pv.getOpcPadre() != null) { + try { + this.setHijoPadre(tmp, rol, pv); + } catch (CloneNotSupportedException ex) { + System.out.println("ERROR FATAL " + ex); + } + } else { + rol.getOpciones().add(pv); + } + } + } + } + return roles; + } + + /** + * Permite recuperar el padre de un determinado Privilegio + * + * @param data + * @param codPadre + * @return + */ + private void setHijoPadre(List data, RolDTO rol, PrivilegioDTO hijo) throws CloneNotSupportedException { + PrivilegioDTO pv = null; + for (PrivilegioDTO p : rol.getOpciones()) { + if (p.getOpcCodigo().equals(hijo.getOpcPadre())) { + pv = p; + if (p.getSubmenu() == null) { + p.setSubmenu(new ArrayList<>()); + } + p.getSubmenu().add(hijo); + break; + } + } + if (pv == null) { + for (PrivilegioDTO p : data) { + if (p.getOpcCodigo().equals(hijo.getOpcPadre())) { + pv = (PrivilegioDTO) p.clone(); + if (pv.getSubmenu() == null) { + pv.setSubmenu(new ArrayList<>()); + } + pv.getSubmenu().add(hijo); + rol.getOpciones().add(pv); + break; + } + } + } + } + + /** + * + * @param header + * @param dao + * @param usuario + * @param password + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List login(HeaderMS header, DaoGenerico dao, String usuario, String password) + throws DominioExcepcion, DaoException { + List result = new ArrayList<>(); + List lstNoCancelados = new ArrayList<>(); + + String hash = dominioUtil.getSHAUsuario(usuario, password); + + String query = String.format(QueryEnum.LOGIN.getParametro().getParValor(), hash); + List usuarios = dao.ejecutarConsultaNativaList(query); + Set roles = new HashSet<>(); + if (usuarios != null && !usuarios.isEmpty()) { + boolean imagen = true; + String token = this.getToken(header, false); + for (Fila f : usuarios) { + roles.add(f.getString(16)); + UsuarioDTO udto = this.crearDto(f, token); + if (imagen && udto.getUsuUrlImagen() != null && !udto.getUsuUrlImagen().trim().isEmpty()) { + udto.setImagen(DominioUtil.getArchivo(udto.getUsuUrlImagen())); + udto.setUsuUrlImagen(DominioUtil.getNombreArchivo(udto.getUsuUrlImagen())); + imagen = false; + } + result.add(udto); + } + } + + if (roles.size() < result.size()) { + int polCancela = 0; + for(UsuarioDTO udto: result){ + if(udto.getPolEstado().equals(DetalleCatalogoEnum.ESTCAN.name())){ + polCancela ++; + } + } + + + if(polCancela < result.size()){ + for(UsuarioDTO udto: result){ + if(!udto.getPolEstado().equals(DetalleCatalogoEnum.ESTCAN.name())){ + lstNoCancelados.add(udto); + // result.remove(udto); + } + } + result = lstNoCancelados; + + } + } + System.out.println("OK LOGIN " + result.size()); + return result; + } + + /** + * + * @param f + * @param token + * @return + */ + private UsuarioDTO crearDto(Fila f, String token) { + UsuarioDTO udto = new UsuarioDTO(); + udto.setUsuCodigo(f.getEntero(0)); + udto.setUsuUsuario(f.getString(1)); + udto.setUsuNombre(f.getString(2)); + udto.setUsuDescripcion(f.getString(3)); + udto.setUsuUrlImagen(f.getString(4)); + udto.setUsuEstado(f.getEntero(7).shortValue()); + udto.setPerCodigo(f.getString(8)); + udto.setPerIdentificacion(f.getString(9)); + udto.setUsuIdOrigen(f.getString(10)); + udto.setUsuOrigen(f.getString(11)); + udto.setUsuEmail(f.getString(12)); + Integer polCodigo = f.getEntero(13); + udto.setPolCodigo(polCodigo == null ? -1 : polCodigo); + udto.setPolEstado(f.getString(14)); + udto.setRolCodigo(f.getEntero(15)); + udto.setRolNemonico(f.getString(16)); + udto.setRolNombre(f.getString(17)); + udto.setEmpCodigo(f.getEntero(18)); + udto.setToken(token); + return udto; + } + + /** + * + * @param header + * @param reset + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public String getToken(HeaderMS header, boolean reset) throws DominioExcepcion { + String token = null; + try { + if (reset) { + header.setUsuario(DominioConstantes.USUARIO); + } + String user = this.getUserString(header); + if (reset) { + user = user.concat(DominioConstantes.SEPARADOR).concat(DominioConstantes.RESET); + } + String uuid = UUID.nameUUIDFromBytes(user.getBytes()).toString().replace("-", ""); + String valorOtp = OTP.generate("" + uuid, "" + System.nanoTime(), 64, OTP.TOTP); + token = DigestUtils.sha256Hex(valorOtp); + //Algorithm algorithm = Algorithm.HMAC256(DominioConstantes.WE_SECRET_KEY); + //token = JWT.create().withIssuer(user).sign(algorithm); + } catch (JWTCreationException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No se puede generar el token, " + ex); + } + return token; + } + + /** + * + * @param header + * @param token + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public boolean verificarToken(HeaderMS header, String token) throws DominioExcepcion { + boolean estado = false; + try { + if (header.getAplicacion() != null && header.getUsuario() != null && header.getDispositivo() != null) { + Algorithm algorithm = Algorithm.HMAC256(DominioConstantes.WE_SECRET_KEY); + JWTVerifier verifier = JWT.require(algorithm) + .withIssuer(getUserString(header)) + .build(); + DecodedJWT jwt = verifier.verify(token); + System.out.println("> " + jwt.getPayload()); + System.out.println("> " + jwt.getHeader()); + System.out.println("> " + jwt.getSignature()); + } + } catch (JWTVerificationException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No se puede validar el token, " + ex); + } + return estado; + } + + /** + * Permite obtener el usuario para obtener y validar el token + * + * @param header + * @return + */ + private String getUserString(HeaderMS header) throws DominioExcepcion { + if (header.getAplicacion() != null && header.getUsuario() != null && header.getDispositivo() != null) { + return header.getUsuario().concat(DominioConstantes.SEPARADOR).concat(header.getAplicacion()).concat(DominioConstantes.SEPARADOR). + concat(header.getDispositivo()); + } else { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No se puede generar el token, usuario, dispositivo y aplicacion no pueden ser nulos"); + } + + } + + /** + * + * @param dao + * @param email + * @return + * @throws com.qsoft.dao.exception.DaoException + */ + public List getUsuarioMail(DaoGenerico dao, String email) throws DaoException { + Usuario user = new Usuario(); + user.setUsuEmail(email); + user.setUsuEstado(DominioConstantes.ACTIVO); + return dao.buscarLista(user); + } + + /** + * + * @param dao + * @param token + * @return + * @throws com.qsoft.dao.exception.DaoException + */ + public List getUsuarioToken(DaoGenerico dao, String token) throws DaoException { + Usuario user = new Usuario(); + user.setUsuToken(token); + user.setUsuEstado(DominioConstantes.ACTIVO); + return dao.buscarLista(user); + } + + /** + * + * @param dao + * @param usuario + * @return + * @throws com.qsoft.dao.exception.DaoException + */ + public List getUsuarios(DaoGenerico dao, String usuario) throws DaoException { + Usuario user = new Usuario(); + user.setUsuUsuario(usuario); + user.setUsuEstado(DominioConstantes.ACTIVO); + return dao.buscarLista(user); + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/AgendaUtil.java b/src/main/java/com/qsoft/erp/dominio/util/AgendaUtil.java new file mode 100644 index 0000000..5d2a58e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/AgendaUtil.java @@ -0,0 +1,172 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.AgendamientoMapper; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.erp.dto.EstadoAgendamientoDTO; +import com.qsoft.erp.constantes.SecuenciaEnum; +import com.qsoft.erp.model.EstadoAgendamiento; +import com.fasterxml.jackson.core.JsonParser; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.erp.dto.AgendamientoDTO; +import com.qsoft.erp.model.Agendamiento; +import com.qsoft.util.ms.pojo.HeaderMS; +import javax.transaction.Transactional; +import javax.annotation.PostConstruct; +import com.qsoft.erp.dao.DaoGenerico; +import java.util.ArrayList; +import javax.ejb.Stateless; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.ejb.EJB; + +/** + * + * @author james + */ +@Stateless +public class AgendaUtil { + + @EJB + private DominioUtil dominioUtil; + + @EJB + private SecuenciaUtil secuenciaUtil; + + @PostConstruct + public void postConstruct() { + + } + + /** + * Permite registrar la persona con los telefonos + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarAgenda(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + AgendamientoDTO agenda = (AgendamientoDTO) dominioUtil.crearObjeto(AgendamientoDTO.class, ent); + System.out.println("AGENDA VALORES=> " + agenda.getAgeCobertura() + " => " + agenda.getAgeObservaMedico()); + List lista = new ArrayList<>(); + + ObjectMapper maper = new ObjectMapper(); + maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); + if (ent.containsKey("estado")) { + System.out.println("========> OK ESTADOS"); + for (Object row : (List) ent.get("estado")) { + EstadoAgendamientoDTO col = (EstadoAgendamientoDTO) dominioUtil.crearObjeto(EstadoAgendamientoDTO.class, (Map) row); + lista.add(col); + } + } + agenda.setEstado(lista); + Agendamiento result = crudAgendamiento(agenda, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param agendamiento + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private Agendamiento crudAgendamiento(AgendamientoDTO agendamiento, int tipoAccion) throws DominioExcepcion { + DaoGenerico daoage = new DaoGenerico<>(Agendamiento.class); + Agendamiento result; + result = AgendamientoMapper.INSTANCE.getEntidad(agendamiento); + result.setEstadoAgendamientoCollection(this.crearEstados(agendamiento, result)); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + result.setAgeFechaRegistro(new Date()); + long cod = this.secuenciaUtil.getSecuencia(SecuenciaEnum.AGEMED); + result.setAgeNemonico(this.dominioUtil.getCodAgendamiento(cod)); + daoage.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + DaoGenerico daoest = new DaoGenerico<>(EstadoAgendamiento.class); + EstadoAgendamiento esa = new EstadoAgendamiento(); + esa.setAgeCodigo(new Agendamiento(result.getAgeCodigo())); + for (EstadoAgendamiento es : daoest.buscarLista(esa)) { + if (Objects.equals(DominioConstantes.ACTIVO, es.getEsaEstado())) { + es.setEsaEstado(DominioConstantes.INACTIVO); + es.setEsaFechaFin(new Date()); + daoest.actualizar(es); + } + } + for (EstadoAgendamiento estado : result.getEstadoAgendamientoCollection()) { + if (estado.getEsaCodigo() == null) { + daoest.guardar(estado); + } + } + result = daoage.actualizar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, + CodigoRespuesta.CODIGO_ERROR_GENERICO, "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, + CodigoRespuesta.CODIGO_ERROR_GENERICO, "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param agendamientoDTO + * @return + * @throws DaoException + */ + private List crearEstados(AgendamientoDTO agendamientoDTO, Agendamiento agendamiento) { + List data = new ArrayList<>(); + for (EstadoAgendamientoDTO estadoDTO : agendamientoDTO.getEstado()) { + EstadoAgendamiento estado = (EstadoAgendamiento) this.dominioUtil.getEntidad(EntidadEnum.EstadoAgendamiento.getMapper(), estadoDTO); + estado.setEsaEstado(DominioConstantes.ACTIVO); + estado.setEsaFechaInicio(new Date()); + estado.setAgeCodigo(agendamiento); + data.add(estado); + } + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/AuditoriaUtil.java b/src/main/java/com/qsoft/erp/dominio/util/AuditoriaUtil.java new file mode 100644 index 0000000..eb65d86 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/AuditoriaUtil.java @@ -0,0 +1,63 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.erp.constantes.QueryEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dto.AuditoriaDTO; +import com.qsoft.erp.model.Auditoria; +import java.util.LinkedList; +import java.util.List; +import javax.ejb.Asynchronous; +import javax.ejb.Stateless; +import javax.persistence.Query; + +/** + * + * @author james + */ +@Stateless +public class AuditoriaUtil { + + private static List auditoriaDTOs; + private final static Integer MAX_AUDIT = 10; + private final static Long MAX_TIME = 30 * 60 * 1000l; + private static Long time; + + /** + * + * @param auditoria + */ + @Asynchronous + public void AddAuditoria(AuditoriaDTO auditoria){ + if(auditoriaDTOs == null){ + auditoriaDTOs = new LinkedList<>(); + time = System.currentTimeMillis(); + } + auditoriaDTOs.add(auditoria); + if(auditoriaDTOs.size() >= MAX_AUDIT || System.currentTimeMillis() <= (time + MAX_TIME)){ + insertAuditoria(auditoriaDTOs.toString()); + auditoriaDTOs.clear(); + time = System.currentTimeMillis(); + } + } + + /** + * Permite ejecutar el insert en la tabla auditoria + * @param data + */ + private void insertAuditoria(String data){ +// String insert = QueryEnum.AUDINS.getParametro().getParValor(); +// String objects = data; +// objects = objects.substring(objects.indexOf("[") + 1, objects.lastIndexOf("]")); +// insert = String.format(insert, objects); +// DaoGenerico dao = new DaoGenerico<>(Auditoria.class); +// Query query = dao.getEm().createNativeQuery(insert); +// query.executeUpdate(); + } + + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/CatalogoUtil.java b/src/main/java/com/qsoft/erp/dominio/util/CatalogoUtil.java new file mode 100644 index 0000000..aa5799b --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/CatalogoUtil.java @@ -0,0 +1,205 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Catalogo; +import com.qsoft.erp.model.DetalleCatalogo; +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; + +/** + * + * @author james + */ +@Stateless +public class CatalogoUtil { + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param codigo + * @return + */ + public DetalleCatalogo cargar(Integer codigo) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + if (codigo != null) { + det = generico.cargar(codigo); + } + } catch (DaoException ex) { + det = null; + } + return det; + } + + /** + * Permite obtener un detalle catalogo desde un nemonico + * + * @param nemonico + * @param tipo + * @return + */ + public DetalleCatalogo getDetallePorNemonicoTipo(String nemonico, String tipo) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetNemonico(nemonico); + det.setDetTipo(tipo); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + + /** + * Permite obtener un detalle catalogo desde un nemonico + * + * @param nemonico + * @param tipo + * @return + */ + public String validarDetalleNemonico(String nemonico,String nombreCampo){ + String error = null; + if(getDetallePorNemonico(nemonico)== null){ + error = String.format("Error: no se ha encontrado el dato con nemónico \"%s\" referente al campo %s", nemonico, nombreCampo); + } + return error; + } + public String validarDetalleOrigen(String origen,String nombreCampo){ + String error = null; + if(getDetallePorOrigen(origen)== null){ + error = String.format("Error: no se ha encontrado el dato relacionado con \"%s\" referente al campo %s", origen, nombreCampo); + } + return error; + } + public String validarDetalleOrigenTipo(String origen,String tipo,String nombreCampo){ + String error = null; + if(getDetallePorOrigenTipo(origen, tipo)== null){ + error = String.format("Error: no se ha encontrado el dato relacionado con \"%s\" de tipo \"%s\" referente al campo %s", origen, tipo,nombreCampo); + } + return error; + } + public DetalleCatalogo getDetallePorNemonicoPadre(String nemonico, String padreNemonico) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + Catalogo padre = new Catalogo(); + padre.setCatNemonico(padreNemonico); + det = new DetalleCatalogo(); + det.setDetNemonico(nemonico); + det.setCatCodigo(padre); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + public DetalleCatalogo getDetallePorOrigenTipo(String origen, String tipo) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetOrigen(origen); + det.setDetTipo(tipo); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + /** + * Permite obtener un detalle catalogo desde un nemonico + * + * @param nemonico + * @param tipo + * @return + */ + public String getOrigenPorNemonicoTipo(String nemonico, String tipo) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetNemonico(nemonico); + det.setDetTipo(tipo); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det != null ? det.getDetOrigen() : ""; + } + + /** + * Permite obtener un detalle catalogo desde un nemonico + * + * @param nemonico + * @return + */ + public DetalleCatalogo getDetallePorNemonico(String nemonico) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetNemonico(nemonico); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + + public DetalleCatalogo getDetallePorNemonicoDao(String nemonico, DaoGenerico generico) { + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetNemonico(nemonico); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + + /** + * Permite obtener un detalle catalogo desde un codigo de origen + * + * @param origen + * @return + */ + public DetalleCatalogo getDetallePorOrigen(String origen) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(); + det.setDetOrigen(origen); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + + public DetalleCatalogo getDetallePorCodigo(Integer detCodigo) { + DaoGenerico generico = new DaoGenerico<>(DetalleCatalogo.class); + DetalleCatalogo det = null; + try { + det = new DetalleCatalogo(detCodigo); + det = generico.buscarUnico(det); + } catch (DaoException ex) { + det = null; + } + return det; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/DBUtil.java b/src/main/java/com/qsoft/erp/dominio/util/DBUtil.java new file mode 100644 index 0000000..e1081c5 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/DBUtil.java @@ -0,0 +1,267 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.ParametroEnum; +import com.qsoft.erp.constantes.QueryEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.model.Agendamiento; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Email; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.EstadoPoliza; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Usuario; +import com.qsoft.erp.reportes.UtilitarioReporte; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import org.apache.commons.lang3.math.NumberUtils; + +/** + * + * @author james + */ +@Stateless +public class DBUtil { + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param usuario + * @return + * @throws DaoException + */ + public Poliza getPolizaFromUser(Usuario usuario) throws DaoException { + DaoGenerico daoppol = new DaoGenerico<>(PersonaPoliza.class); + Poliza poliza = null; + PersonaPoliza perpol = new PersonaPoliza(); + perpol.setPerCodigo(new Persona(NumberUtils.createInteger(usuario.getUsuIdOrigen()))); + perpol.setPepEstado(DominioConstantes.ACTIVO); + perpol.setDetTipoPersona(DetalleCatalogoEnum.PTITU.getDetalle()); + for (PersonaPoliza pp : daoppol.buscarLista(perpol)) { + poliza = pp.getPolCodigo(); + System.out.println("=================> POLIZA CONSULTADA " + poliza.getPolCodigo()); + } + return poliza; + } + + /** + * + * @param usuario + * @param estado + * @param generar + * @return + * @throws DaoException + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public Poliza actualizaPoliza(Usuario usuario, DetalleCatalogoEnum estado, boolean generar) throws DaoException, DominioExcepcion { + DaoGenerico daoppol = new DaoGenerico<>(PersonaPoliza.class); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + Poliza poliza = null; + PersonaPoliza perpol = new PersonaPoliza(); + perpol.setPerCodigo(new Persona(NumberUtils.createInteger(usuario.getUsuIdOrigen()))); + perpol.setPepEstado(DominioConstantes.ACTIVO); + perpol.setDetTipoPersona(DetalleCatalogoEnum.PTITU.getDetalle()); + Persona persona = null; + for (PersonaPoliza pp : daoppol.buscarLista(perpol)) { + poliza = daopol.cargar(pp.getPolCodigo().getPolCodigo()); + persona = pp.getPerCodigo(); + } + for(EstadoPoliza es: poliza.getEstadoPolizaCollection()){ + if ((Objects.equals(DominioConstantes.ACTIVO, es.getEspEstado()))) { + es.setEspFechaFin(new Date()); + es.setEspEstado(DominioConstantes.INACTIVO); + } + } + poliza.getEstadoPolizaCollection().add(this.crearEstado(poliza, estado.getDetalle(), new Date(), null, true)); + String url = null; + String acepta = null; + if (generar) { + try { + System.out.println("===========> GENERAR REPORTE "); + UtilitarioReporte reporte = new UtilitarioReporte(); + url = reporte.generarContrato(poliza, persona); + System.out.println("===========> EVALUA EMPRESA " + poliza.getEmpCodigo().getEmpDinamico()); + if (poliza.getEmpCodigo().getEmpDinamico() == null || poliza.getEmpCodigo().getEmpDinamico().isBlank() + || !poliza.getEmpCodigo().getEmpDinamico().replace(" ", "").contains("\"ifi\":1")) { + acepta = reporte.generarAceptacion(poliza, persona); + poliza.setPolAceptacion(acepta); + } + } catch (Exception ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, "ERROR no se pudo generar el contrato " + ex); + } + poliza.setPolObservacion(url); + } + if (estado.equals(DetalleCatalogoEnum.ESTACT)) { + + } + daopol.actualizar(poliza); + return poliza; + } + + /** + * + * @param poliza + * @param estado + * @param fecIni + * @param fecFin + * @param activo + * @return + */ + public EstadoPoliza crearEstado(Poliza poliza, DetalleCatalogo estado, Date fecIni, Date fecFin, boolean activo) { + EstadoPoliza es = new EstadoPoliza(); + es.setDetEstado(estado); + es.setEspEstado(activo? DominioConstantes.ACTIVO: DominioConstantes.INACTIVO); + es.setEspFechaInicio(fecIni); + es.setEspFechaFin(fecFin); + es.setPolCodigo(poliza); + es.setEspObservacion("Cambio de estado " + es.getDetEstado().getDetDescripcion()); + return es; + } + + /** + * + * @param header + * @param tipoAgendamiento + * @param perBeneficiario + * @param polCodigo + * @param copCodigo + * @return + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List> getValoresAgenda(HeaderMS header, String tipoAgendamiento, String perBeneficiario, String polCodigo, String copCodigo) { + List> data = new ArrayList<>(); + Map fila = this.getValoresAgendamiento(tipoAgendamiento, perBeneficiario, polCodigo); + + String query = QueryEnum.AGELIQ.getQuery(); + query = String.format(query, fila.get("coberturas"), "" + polCodigo, "" + perBeneficiario); + System.out.println("QUERY AGELIQ => " + query); + fila.remove("coberturas"); + DaoGenerico dao = new DaoGenerico<>(Agendamiento.class); + List result = dao.ejecutarConsultaNativaList(query); + Double registrado = 0.0; + Double objetado = 0.0; + Double pagado = 0.0; + for (Fila f : result) { + //l.LIQ_CODIGO, p.POL_CODIGO, l.PER_BENEFICIARIO, dl.DEL_VALOR_REGISTRADO, dl.DEL_VALOR_OBJETADO, dl.DEL_VALOR_PAGADO , dc2.DET_NOMBRE + registrado += f.getDouble(3) == null ? 0.0 : f.getDouble(3); + objetado += f.getDouble(4) == null ? 0.0 : f.getDouble(4); + pagado += f.getDouble(5) == null ? 0.0 : f.getDouble(5); + } + fila.put("liqRegistrado", registrado); + fila.put("liqObjetado", objetado); + fila.put("liqFacturado", pagado); + data.add(fila); + return data; + } + + /** + * + * @param tipoAgendamiento + * @param perBeneficiario + * @param polCodigo + * @return + */ + private Map getValoresAgendamiento(String tipoAgendamiento, String perBeneficiario, String polCodigo) { + String query = QueryEnum.AGEVAL.getQuery(); + query = String.format(query, perBeneficiario, polCodigo, tipoAgendamiento); + System.out.println("QUERY AGEVAL => " + query); + DaoGenerico dao = new DaoGenerico<>(Agendamiento.class); + Double valor = 0.0; + Double facturado = 0.0; + Double cubierto = 0.0; + Double cobertura = 0.0; + Double topeCobertura = 0.0; + String tipoAge = null; + String estadoAge = null; + String codDet = null; + + for (Fila f : dao.ejecutarConsultaNativaList(query)) { + //a.PER_BENEFICIARIO, a.POL_CODIGO, a.AGE_CODIGO, dc1.DET_NOMBRE, a.AGE_VALOR, a.AGE_FACTURADO, a.AGE_CUBIERTO, a.AGE_COBERTURA, dc.DET_NOMBRE , ea.ESA_ESTADO, dc1.DET_ORIGEN + tipoAge = f.getString(3); + valor += f.getDouble(4) == null ? 0.0 : f.getDouble(4); + facturado += f.getDouble(5) == null ? 0.0 : f.getDouble(5); + cubierto += f.getDouble(6) == null ? 0.0 : f.getDouble(6); + cobertura += f.getDouble(7) == null ? 0.0 : f.getDouble(7); + estadoAge = f.getString(8); + if (f.getString(10) != null && !f.getString(10).isBlank()) { + codDet = f.getString(10); + } + } + + query = QueryEnum.AGELCO.getQuery(); + query = String.format(query, polCodigo, tipoAgendamiento); + System.out.println("QUERY AGELCO => " + query); + codDet = ""; + for (Fila f : dao.ejecutarConsultaNativaList(query)) { + codDet += f.getEntero(0) + ","; + topeCobertura = f.getDouble(1); + } + if (codDet.endsWith(",")) { + codDet = codDet.substring(0, codDet.lastIndexOf(",")); + } + + codDet = codDet == null ? "null" : codDet.isBlank() ? "null" : codDet; + + System.out.println(">>>OK TOPE " + topeCobertura); + Map data = new HashMap<>(); + data.put("tipoAgendamiento", tipoAge); + data.put("ageValor", valor); + data.put("ageFacturado", facturado); + data.put("ageCubierto", cubierto); + data.put("ageCobertura", cobertura); + data.put("topeCobertura", topeCobertura); + data.put("estadoAgendamiento", estadoAge); + data.put("estadoAgendamiento", estadoAge); + data.put("coberturas", codDet); + return data; + } + + /** + * + * @param emaCodigo + * @param observacion + * @param estado + * @param add + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public synchronized void actualizarNotificacion(Integer emaCodigo, String observacion, ParametroEnum estado, boolean add) { + try { + DaoGenerico dao = new DaoGenerico<>(Email.class); + Email email = dao.cargar(emaCodigo); + email.setParEstado(estado.getParametro()); + email.setEmaObservacion(observacion); + if (add) { + email.setEmaIntento((short) (email.getEmaIntento() + 1)); + } + dao.actualizar(email); + } catch (Exception ex) { + System.out.println("ERROR al actualizar " + emaCodigo + ": " + ex.toString()); + } + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/DocumentoUtil.java b/src/main/java/com/qsoft/erp/dominio/util/DocumentoUtil.java new file mode 100644 index 0000000..267b1b0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/DocumentoUtil.java @@ -0,0 +1,1089 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.TransaccionEnum; + +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.dao.DaoGenerico; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.DocumentoMapper; +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.dto.PersonaDTO; +import com.qsoft.erp.dto.PolizaDTO; +import com.qsoft.erp.model.Agendamiento; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.EstadoPoliza; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Localizacion; +import com.qsoft.erp.model.Pago; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Plan; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Telefono; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import javax.xml.datatype.DatatypeConfigurationException; + +/** + * + * @author james + */ +@Stateless +public class DocumentoUtil { + + @EJB + private DominioUtil dominioUtil; + @EJB + private CatalogoUtil catalogoUtil; + @EJB + private PolizaUtil polizaUtil; + @EJB + private PersonaUtil personaUtil; + @EJB + private PlanUtil planUtil; + @PostConstruct + public void postConstruct() { + + } + + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List guardarDocumento(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + try { + if (entidades.size() == documentoDTOs.size()) { + data = this.generaDocumento(documentoDTOs, tipoAccion); + } else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, "Diferente tamano de documentos de la trama ". + concat(entidades.size() + "").concat(" con los documentos enviados ".concat(documentoDTOs.size() + ""))); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + + /** + * + * @param header + * @param entidades + * @param documentoDTOs + * @param tipoAccion + * @return + * @throws DominioExcepcion + * @throws Exception + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarCSV(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + + try { + if (entidades.size() == documentoDTOs.size()) { + data = this.generaCSV(documentoDTOs, tipoAccion, daopag, daopol, daodet); + } else { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, "Diferente tamano de documentos de la trama ". + concat(entidades.size() + "").concat(" con los documentos enviados ".concat(documentoDTOs.size() + ""))); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + + /** + * + * @param header + * @param entidades + * @param documentoDTOs + * @param tipoAccion + * @return + * @throws DominioExcepcion + * @throws Exception + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List analizarCSV(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico daopep = new DaoGenerico<>(PersonaPoliza.class); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + + try { + if (entidades.size() == documentoDTOs.size()) { + + data = this.recorrerCSVIdentificaciones(documentoDTOs, tipoAccion, daopag, daoper, daopep, daopol); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + /**----------------------------------- para creacion masiva de polizas ---------------------------------------*/ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarCreacionCsv(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico daopep = new DaoGenerico<>(PersonaPoliza.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + DaoGenerico daoloc = new DaoGenerico<>(Localizacion.class); + DaoGenerico daotel = new DaoGenerico<>(Telefono.class); + DaoGenerico daocuen = new DaoGenerico<>(CuentaBancaria.class); + + try { + if (entidades.size() == documentoDTOs.size()) { + + data = this.recorrerCSVPoliza(documentoDTOs, tipoAccion, daopag, daoper, daopep, daodet, daoloc, daotel, daocuen); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarCancelacion(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daoestpol = new DaoGenerico<>(EstadoPoliza.class); + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daopp = new DaoGenerico<>(PersonaPoliza.class); + DaoGenerico daocb = new DaoGenerico<>(CuentaBancaria.class); + try { + if (entidades.size() == documentoDTOs.size()) { + data = this.recorrerCSVPolizasCanceladas(documentoDTOs, tipoAccion, daopol, daoestpol, daopag, daopp, daocb); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + + + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarSiniestrosCSV(HeaderMS header, List> entidades, List documentoDTOs, + int tipoAccion) throws DominioExcepcion, Exception { + List data = new ArrayList<>(); + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + + try { + if (entidades.size() == documentoDTOs.size()) { + data = this.recorrerCSVIdentificacionesSiniestros(documentoDTOs, tipoAccion, daoper, daodet); + } + } catch (DaoException ex) { + Logger.getLogger(DocumentoUtil.class.getName()).log(Level.SEVERE, null, ex); + } + + return data; + } + + @Transactional(Transactional.TxType.SUPPORTS) + private Documento crudDocumentos(DocumentoDTO documento, int tipoAccion) throws DominioExcepcion { + DaoGenerico daodoc = new DaoGenerico<>(Documento.class); + Documento result; + result = DocumentoMapper.INSTANCE.getEntidad(documento); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + result.setDocEstado(DominioConstantes.ACTIVO); + result.setDocFechaRegistro(new Date()); + System.out.println(">>>>>>>>> Crud documento Guardar"); + daodoc.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + System.out.println(">>>> Documento debe actualizar"); + result = daodoc.actualizar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param documentosDTO + */ + private List generaDocumento(List documentosDTO, int tipoAccion) throws DaoException, DominioExcepcion { + List documentos = new ArrayList<>(); + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + String url = this.grabaDocumento(doc); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return documentos; + } + + private List generaCSV(List documentosDTO, int tipoAccion, DaoGenerico daopag, + DaoGenerico daopol, DaoGenerico daodet) throws DaoException, DominioExcepcion, Exception { + List documentos = new ArrayList<>(); + List pagosActualizados = new ArrayList<>(); + DetalleCatalogo detTipo = catalogoUtil.getDetallePorNemonico("URLFDE"); + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + doc.setDetTipo(detTipo.getDetCodigo()); + String url = this.grabaDocumento(doc); + pagosActualizados.addAll(leerCSV(doc, daopag, daopol, daodet)); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return pagosActualizados; + } + + private List recorrerCSVPoliza(List documentosDTO, int tipoAccion, DaoGenerico daopag, + DaoGenerico daoper, DaoGenerico daopep, DaoGenerico daodet, DaoGenerico daoloc + , DaoGenerico daotel, DaoGenerico daocuen + ) + throws DaoException, DominioExcepcion, Exception { + List documentos = new ArrayList<>(); + List lstPagosActualizados = new ArrayList<>(); + DetalleCatalogo detTipo = catalogoUtil.getDetallePorNemonico("URLFCP"); + + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + doc.setDetTipo(detTipo.getDetCodigo()); + String url = this.grabaDocumento(doc); + lstPagosActualizados.addAll(analizarCsvPolizasCrear(doc, daoper, daodet, daoloc, daotel, daocuen)); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return lstPagosActualizados; + } + private List recorrerCSVIdentificaciones(List documentosDTO, int tipoAccion, DaoGenerico daopag, + DaoGenerico daoper, DaoGenerico daopep, DaoGenerico daopol) + throws DaoException, DominioExcepcion, Exception { + List documentos = new ArrayList<>(); + List lstPagosActualizados = new ArrayList<>(); + DetalleCatalogo detTipo = catalogoUtil.getDetallePorNemonico("URLFTC"); + + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + doc.setDetTipo(detTipo.getDetCodigo()); + String url = this.grabaDocumento(doc); + lstPagosActualizados.addAll(analizarIdentificacionesCSV(doc, daoper, daopep, daopag, daopol)); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return lstPagosActualizados; + } + private List recorrerCSVPolizasCanceladas(List documentosDTO, int tipoAccion, DaoGenerico daopol, DaoGenerico daoestpol, DaoGenerico daopag, DaoGenerico daopp, + DaoGenerico daocb) throws DaoException, DominioExcepcion, Exception { + List documentos = new ArrayList<>(); + List lstPolizasCanceladas = new ArrayList<>(); + DetalleCatalogo detTipo = catalogoUtil.getDetallePorNemonico("URLFCC"); + + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + doc.setDetTipo(detTipo.getDetCodigo()); + String url = this.grabaDocumento(doc); + lstPolizasCanceladas.addAll(analizarNemonicoPCanceladas(doc, daopol, daoestpol, daopag, daopp, daocb)); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return lstPolizasCanceladas; + } + private List recorrerCSVIdentificacionesSiniestros(List documentosDTO, int tipoAccion, DaoGenerico daoper, DaoGenerico daodet) throws DaoException, DominioExcepcion, Exception { + List documentos = new ArrayList<>(); + List lstPersonas = new ArrayList<>(); + DetalleCatalogo detTipo = catalogoUtil.getDetallePorNemonico("URLFUS"); + + if (documentosDTO != null) { + for (DocumentoDTO doc : documentosDTO) { + doc.setDetTipo(detTipo.getDetCodigo()); + String url = this.grabaDocumento(doc); + lstPersonas.addAll(analizarIdentificacionesSiniestrosCSV(doc, daoper, daodet)); + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDocEstado(DominioConstantes.ACTIVO); + doc.setDocUrl(url); + dcto.setDocUrl(url); + Documento dc = crudDocumentos(doc, tipoAccion); + documentos.add(dc); + } + } + return lstPersonas; + } + /**---------------------------- Para analizar polizas con nemonico canceladas --------------------------*/ +private List analizarNemonicoPCanceladas(DocumentoDTO doc, DaoGenerico daopol, + DaoGenerico daoestpol, DaoGenerico daopag, DaoGenerico daopp, DaoGenerico daocb) throws DaoException, DominioExcepcion, Exception { + InputStream is = null; + BufferedReader bfReader = null; + String polNemonico = null; + + List lstPoliza = new ArrayList<>(); + try { + is = new ByteArrayInputStream(doc.getData()); + InputStreamReader isr = new InputStreamReader(is); + bfReader = new BufferedReader(isr); + String temp = null; + Poliza plantilla = null; + Poliza poliza = null; + String polDescripcion = "CANCELADA CSV - MASIVO "; + DetalleCatalogo detEstadoPoliza = catalogoUtil.getDetallePorNemonico("ESTCAN"); + + while ((temp = bfReader.readLine()) != null) { + String[] fila = temp.split(";"); + polNemonico = fila[0].replace("\"", "").trim(); + polDescripcion = fila.length >1 ? fila[1].replace("\"", "").trim() : polDescripcion.concat(DominioConstantes.FORMAT_DB.format(new Date())); + plantilla = new Poliza(); + plantilla.setPolContrato(polNemonico); + poliza = daopol.buscarUnico(plantilla); + if (poliza == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("No se ha encontrado una poliza con contrato %s, recuerda que el archivo csv debe estar separado por PUNTO Y COMA (;)", polNemonico)); + } + polizaUtil.anularEstadosPorPoliza(new ArrayList(poliza.getEstadoPolizaCollection()), daoestpol); + polizaUtil.crearEstadoPoliza(detEstadoPoliza, poliza, String.format("CANCELADO POR ARCHIVO MASIVO %s", doc.getDocNombre().toUpperCase()) , daoestpol); + poliza.setPolFechaCancela(new Date()); + poliza.setPolDescripcion(polDescripcion); + daopol.actualizar(poliza); + polizaUtil.cancelaPolizaDao(poliza, daopag, daopp, daocb); + lstPoliza.add(poliza); + } + } catch (Exception e) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("Error al procesar el archivo: %s", e.toString())); + } + return lstPoliza; + } + + private List analizarIdentificacionesSiniestrosCSV(DocumentoDTO doc, DaoGenerico daoper, + DaoGenerico daodet) throws DaoException, DominioExcepcion, Exception { + InputStream is = null; + BufferedReader bfReader = null; + String identificacion = null; + + List lstPersonas = new ArrayList<>(); + try { + is = new ByteArrayInputStream(doc.getData()); + InputStreamReader isr = new InputStreamReader(is, "ISO-8859-1"); + bfReader = new BufferedReader(isr); + String temp = null; + Persona plantilla = null; + Persona persona = null; + DetalleCatalogo detallePlantilla = null; + DetalleCatalogo detEstadoPoliza = null; + + while ((temp = bfReader.readLine()) != null) { + String[] fila = temp.split(","); + identificacion = fila[0].replace("\"", "").trim(); + plantilla = new Persona(); + plantilla.setPerIdentificacion(identificacion); + persona = daoper.buscarUnico(plantilla); + if (persona == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("No se ha encontrado una persona con identificación %s", identificacion)); + } + detallePlantilla = new DetalleCatalogo(); + detallePlantilla.setDetEstado(DominioConstantes.ACTIVO); + detallePlantilla.setDetNemonico("SINIES"); + detEstadoPoliza = daodet.buscarUnico(detallePlantilla); + if (detEstadoPoliza == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("Estado %s no registrado en la Base de datos", detallePlantilla.getDetNemonico())); + } + persona.setDetEstadoPoliza(detEstadoPoliza); + daoper.actualizar(persona); + lstPersonas.add(persona); + } + } catch (Exception e) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("Error al procesar el archivo: %s", e.toString())); + } + return lstPersonas; + } + public static void contarRepetidosLista(List list, List lstErrores) + { + + + Set st = new HashSet(list); + int valRepetidos = 0; + int fila = 0; + for (String s : st){ + fila++; + valRepetidos = Collections.frequency(list, s); + if(valRepetidos > 1){ + lstErrores.add(String.format("Error en la fila %s: la identificación %s esta repetida", fila, s )); + } + } + + } + private List analizarCsvPolizasCrear(DocumentoDTO doc, DaoGenerico daoper, + DaoGenerico daodet, DaoGenerico daoloc, DaoGenerico daotel, DaoGenerico daocuen) throws DaoException, DominioExcepcion, Exception { + InputStream is = null; + BufferedReader bfReader = null; + String perApellidos = null; + String perNombres = null; + String perTipoIdentificacion = null; + String perIdentificacion = null; + String perMail = null; + String perTelefono = null; + String perGenero = null; + String perFechaNacimiento = null; + String locCodigo =null; + String perAsesor = null; + String cedulaDebito = null; + String nombreDebito = null; + String cueCuenta = null; + String periodicidad = null; + String ifi = null; + String fechaInicia = null; + String codigoSucursal = null; + String tipoCobro = null; + String polDescripcion = null; + String polObservacion = DominioConstantes.DATO_MASIVO_POLIZA; + String tipoCuenta = null; + Integer plaCodigo = Integer.parseInt(doc.getDocDescripcion()); + Integer empCodigo = Integer.parseInt(doc.getDocObservacion()); + Plan plan = planUtil.getPlanPorCodigo(plaCodigo); + String error = null; + if(plan == null){ + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "Plan no encontrado"); + } + List lstErrores = new ArrayList<>(); + List lstPolizas = new ArrayList<>(); + List lstIdentificaciones = new ArrayList<>(); + + String []operacion = {"log","opera"}; + for (String op : operacion) { + is = new ByteArrayInputStream(doc.getData()); + InputStreamReader isr = new InputStreamReader(is); + bfReader = new BufferedReader(isr); + String temp = null; + Persona plantilla = null; + Persona persona = null; + + + int nfila = 0; + + while ((temp = bfReader.readLine()) != null) { + if(op.equals("opera") ){ + contarRepetidosLista(lstIdentificaciones, lstErrores); + if((!lstErrores.isEmpty())&& lstErrores.size()>0){ + error = "Error(es) encontrado(s), corrija y vuelva a subir el archivo por favor:".concat(System.getProperty("line.separator")).concat(dominioUtil.aStringLn(lstErrores)); + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, error); + } + + } + String[] fila = temp.split(";"); + if(op.equals("log") && fila.length != 20){ + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, String.format("Error: Se requieren 20 elementos por fila en el archivo, se han encontrado %s, recuerde que el archivo debe ir separador por PUNTO Y COMA(;)", fila.length)); + } + nfila++; + perApellidos = !fila[0].replace("\"", "").trim().equals("") ? fila[0].replace("\"", "").trim(): null; + perNombres = !fila[1].replace("\"", "").trim().equals("") ? fila[1].replace("\"", "").trim() : null; + perTipoIdentificacion = !fila[2].replace("\"", "").trim().equals("") ? fila[2].replace("\"", "").trim() : null; + perIdentificacion = !fila[3].replace("\"", "").trim().equals("") ? fila[3].replace("\"", "").trim() : null; + if(op.equals("log") && perIdentificacion != null){ + System.out.println("Ahorita vamos a ver "+nfila); + lstIdentificaciones.add(perIdentificacion); + + } + + perMail = !fila[4].replace("\"", "").trim().equals("") ? fila[4].replace("\"", "").trim() : null; + perTelefono = !fila[5].replace("\"", "").trim().equals("") ? fila[5].replace("\"", "").trim() : null; + perGenero = !fila[6].replace("\"", "").trim().equals("") ? fila[6].replace("\"", "").trim() : null; + perFechaNacimiento = !fila[7].replace("\"", "").trim().equals("") ? fila[7].replace("\"", "").trim() : null; + locCodigo = !fila[8].replace("\"", "").trim().equals("") ? fila[8].replace("\"", "").trim() : null; + perAsesor = !fila[9].replace("\"", "").trim().equals("") ? fila[9].replace("\"", "").trim() : null; + cedulaDebito = !fila[10].replace("\"", "").trim().equals("") ? fila[10].replace("\"", "").trim() : null; + nombreDebito = !fila[11].replace("\"", "").trim().equals("") ? fila[11].replace("\"", "").trim() : null; + cueCuenta = !fila[12].replace("\"", "").trim().equals("") ? fila[12].replace("\"", "").trim() : null; + tipoCuenta = !fila[13].replace("\"", "").trim().equals("") ? fila[13].replace("\"", "").trim() : null; + + periodicidad = !fila[14].replace("\"", "").trim().equals("") ? fila[14].replace("\"", "").trim() : null; + ifi = !fila[15].replace("\"", "").trim().equals("") ? fila[15].replace("\"", "").trim() : null; + fechaInicia = !fila[16].replace("\"", "").trim().equals("") ? fila[16].replace("\"", "").trim() : null; + codigoSucursal = !fila[17].replace("\"", "").trim().equals("") ? fila[17].replace("\"", "").trim() : null; + tipoCobro = !fila[18].replace("\"", "").trim().equals("") ? fila[18].replace("\"", "").trim() : null; + polDescripcion = !fila[19].replace("\"", "").trim().equals("") ? fila[19].replace("\"", "").trim() : null; + + plantilla = new Persona(); + plantilla.setPerIdentificacion(perIdentificacion); + persona = daoper.buscarUnico(plantilla); + if (persona == null) { + if(op.equals("log")){ + logCrearPersonaCsv(lstErrores, daoloc, perTipoIdentificacion, perGenero, locCodigo, nfila, perFechaNacimiento, perIdentificacion); + + if(perIdentificacion != null){ + + } + + + }else if(op.equals("opera")){ + persona = personaUtil.crearPersonaDTOCsv(perGenero, locCodigo, perTipoIdentificacion,perIdentificacion, perNombres, perApellidos, perMail, perFechaNacimiento, perTelefono, ifi, + tipoCuenta, cedulaDebito, cueCuenta, nombreDebito, DominioConstantes.ACTIVO, daoper, daotel, daocuen); + } + }else{ + addErrorExistePoliza(lstErrores, perIdentificacion, persona.getDetTipoIdentificacion().getDetCodigo(), nfila); + } + if(op.equals("log")){ + + logCrearPoliza(lstErrores, nfila, fechaInicia, codigoSucursal, tipoCobro, periodicidad); + if(cueCuenta != null && !cueCuenta.equals("000")){ + logCrearCuentaCsv(lstErrores, nfila, cedulaDebito, ifi, tipoCuenta); + } + }else if(op.equals("opera")){ + + PolizaDTO pDTO = polizaUtil.crearPolizaDTO(empCodigo, plaCodigo, perAsesor,catalogoUtil.getDetallePorNemonico(periodicidad).getDetCodigo() , + catalogoUtil.getDetallePorNemonico(codigoSucursal).getDetCodigo(), catalogoUtil.getDetallePorNemonico(tipoCobro).getDetCodigo(), polDescripcion + , plan.getDetModalidad().getDetCodigo(), catalogoUtil.getDetallePorNemonico(ifi).getDetCodigo(), fechaInicia, polObservacion); + Poliza poliza = polizaUtil.crearPolizaMasivo(persona, pDTO, null); + polizaUtil.creaUsuarioExt(persona, poliza); + lstPolizas.add(poliza); + + } + + + } + } + + + return lstPolizas; + } + private void logCrearPersonaCsv(List lstErrores, DaoGenerico daoloc, String detTipoIdentificacion, String detGenero, String locCodigo,Integer fila, + String perFechaNacimiento, String perIdentificacion) throws DaoException, DominioExcepcion{ + addErrorDetalleOrigenTipo(lstErrores, detTipoIdentificacion, "IDENTIFICACION", "Identificación", fila); + + if(detTipoIdentificacion.equals("C") && !dominioUtil.validarCedulaSinException(perIdentificacion)){ + lstErrores.add(String.format("Error en la fila %s: La cédula %s de persona no es válida", fila, perIdentificacion)); + } + if(perIdentificacion.length()>15){ + lstErrores.add(String.format("Error en la fila %s: La identificación %s contiene %s caracteres", fila, perIdentificacion,perIdentificacion.length())); + + } + addErrorDetalleOrigenTipo(lstErrores, detGenero, "GENERO", "género", fila); + addErrorLocalizacion(lstErrores, locCodigo, daoloc, fila); + addErrorFecha(lstErrores, perFechaNacimiento, fila); + } + + private void logCrearPoliza(List lstErrores,int fila, String fechaInicio,String codigoSucursal,String tipoCobro, String periodicidad) throws DominioExcepcion{ + addErrorFecha(lstErrores, fechaInicio, fila); + addErrorDetalleNemonico(lstErrores, codigoSucursal, "Código de sucursal", fila); + addErrorDetalleNemonico(lstErrores, tipoCobro, "tipo de cobro", fila); + addErrorDetalleNemonico(lstErrores, periodicidad, "periodicidad", fila); + } + private void logCrearCuentaCsv(List lstErrores, int fila, String cedula,String ifi,String tipoCuenta) throws DominioExcepcion{ + if(cedula != null && !dominioUtil.validarCedulaSinException(cedula)){ + lstErrores.add(String.format("Error en la fila %s: La cédula %s de propietario de cuenta no es válida", fila, cedula)); + } + addErrorDetalleNemonico(lstErrores, ifi, "institución financiera", fila); + addErrorDetalleOrigenTipo(lstErrores, tipoCuenta, "TIPOCUEN", "tipo de cuenta", fila); + } + public void addErrorExistePoliza(List lstErrores, String perIdentificacion, Integer tipoIdentificacion, int fila) throws DaoException{ + if (polizaUtil.existePoliza(perIdentificacion, tipoIdentificacion, null)) { + lstErrores.add(String.format("Error en la fila %s: El cliente %s ya posee una poliza activa no se modificara la informacion actual", fila, perIdentificacion)); + } + } + public void addErrorLocalizacion(List lstErrores, String locCodigo, DaoGenerico daoloc, Integer fila) throws DaoException{ + Localizacion plantilla = new Localizacion() ; + plantilla.setLocCodigo(locCodigo); + plantilla.setLocEstado(DominioConstantes.ACTIVO); + if (daoloc.buscarUnico(plantilla) == null) { + lstErrores.add(String.format("Error en la fila %s: No se ha podido encontrar una localización correspondiente a \"%s\"", fila, locCodigo)); + } + } + public void addErrorFecha(List lstErrores, String fecha, int fila){ + if(!dominioUtil.validarFecha(fecha,DominioConstantes.FORMAT_D)){ + lstErrores.add(String.format("Error en la fila %s: la fecha %s no cumple con el formato %s", fila, fecha, DominioConstantes.FORMATO_FECHA)); + } + } + public void addErrorDetalleOrigenTipo(List lstErrores, String detOrigen, String tipo,String nombreCampo, Integer fila){ + String existeError =catalogoUtil.validarDetalleOrigenTipo(detOrigen,tipo, nombreCampo); + if(existeError!=null){ + lstErrores.add(String.format("Error en la fila %s: %s", fila, existeError)); + } + } + public void addErrorDetalleOrigen(List lstErrores, String detOrigen, String nombreCampo, Integer fila){ + String existeError =catalogoUtil.validarDetalleOrigen(detOrigen, nombreCampo); + if(existeError!=null){ + lstErrores.add(String.format("Error en la fila %s: %s", fila,existeError)); + } + } + + public void addErrorDetalleNemonico(List lstErrores, String detNemonico, String nombreCampo, Integer fila){ + String existeError =catalogoUtil.validarDetalleNemonico(detNemonico, nombreCampo); + if(existeError !=null){ + lstErrores.add(String.format("Error en la fila %s: %s", fila, existeError)); + } + } + private List analizarIdentificacionesCSV(DocumentoDTO doc, DaoGenerico daoper, DaoGenerico daopep, DaoGenerico daopag, DaoGenerico daopol) throws DaoException, DominioExcepcion, Exception { + InputStream is = null; + BufferedReader bfReader = null; + String identificacion = null; + String fecha = null; + String observacion = null; + List lstErrores = new ArrayList<>(); + List lstPagos = new ArrayList<>(); + List lstPagosTotales = new ArrayList<>(); + List lstPolizasCanceladas = null; + + try { + is = new ByteArrayInputStream(doc.getData()); + InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); + bfReader = new BufferedReader(isr); + String temp = null; + Persona plantilla = null; + Persona persona = null; + PersonaPoliza perPolPlantilla = null; + List lstPersonasPoliza = null; + List lstPagosPoliza = null; + List lstPagosPersona = null; + + String fechaPago = null; + Double valor = null; + String[] sepFechaCsv = null; + String[] fechaBase = null; + Integer nFila = 0; + Date fechaParseada = null; + while ((temp = bfReader.readLine()) != null) { + nFila++; + System.out.print("--------------> fila " + ">" + temp + "<"); + if (temp.trim().equals("")) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("La fila %s esta vacia, verifique que no exista ningun espacio no deseado", nFila)); + + } + String[] fila = temp.split(","); + + identificacion = fila[0].replace("\"", "").trim(); + + if (fila.length < 4) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, String.format("Se han encontrado unicamente " + + "%s valores, recuerde que el formato por fila es [identificación, valor de pago, fecha, observacion]", fila.length)); + + } + + valor = Double.parseDouble(fila[1].replace("\"", "").trim()); + fecha = fila[2].replace("\"", "").trim(); + observacion = fila[3].replace("\"", "").trim(); + + try { + fechaParseada = DominioConstantes.FORMAT_D.parse(fecha); + } catch (ParseException e) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("La fecha debe cumplir %s no cumple con el formato %s", fecha, DominioConstantes.FORMATO_FECHA)); + + } + fecha = DominioConstantes.FORMAT_D.format(fechaParseada); + sepFechaCsv = fecha.split("/"); + + plantilla = new Persona(); + plantilla.setPerIdentificacion(identificacion); + persona = daoper.buscarUnico(plantilla); + if (persona == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("No se ha encontrado una persona con identificación %s", identificacion)); + } + perPolPlantilla = new PersonaPoliza(); + perPolPlantilla.setPerCodigo(persona); + lstPersonasPoliza = daopep.buscarLista(perPolPlantilla, new String[]{"polCodigo.polCodigo", "ASC"}); + + if (lstPersonasPoliza != null && !lstPersonasPoliza.isEmpty()) { + + for (PersonaPoliza personaPoliza : lstPersonasPoliza) { + lstPolizasCanceladas = new ArrayList<>(); + lstPagosPersona = new ArrayList<>(); + if (!this.getEstadoActivo(personaPoliza.getPolCodigo()).getDetEstado().getDetNemonico().equals("ESTCAN")) { + //lstErrores.add(String.format("la poliza con identificación %s no posee pagos pendientes",polNemonico)); + lstPagosPoliza = buscarPagosPendientesPorPoliza(personaPoliza.getPolCodigo(), daopag); + lstPagos = new ArrayList<>(); + + if (lstPagosPoliza != null && !lstPersonasPoliza.isEmpty()) { + for (Pago pago1 : lstPagosPoliza) { + fechaPago = DominioConstantes.FORMAT_D.format(pago1.getPagFechaVencimiento()); + fechaBase = fechaPago.split("/"); + if (sepFechaCsv[2].equals(fechaBase[2]) && sepFechaCsv[1].equals(fechaBase[1]) && Double.compare(valor, pago1.getPagMonto()) == 0) { + pago1.setPagObservacion(observacion); + lstPagos.add(pago1); + } + } + } + + if (!lstPagos.isEmpty()) { + lstPagosPersona.addAll(lstPagos); + } + + } else { + lstPolizasCanceladas.add(personaPoliza.getPolCodigo()); + } + + if (lstPagosPersona.isEmpty()) { + String errorPagos = String.format("No se ha encontrado ningun pago para la identificación %s con valor %s, y fecha " + + "perteneciente al mes %s y año %s que este en estado pendiente de pago", identificacion, valor, sepFechaCsv[1], sepFechaCsv[2]); + String polizasCanceladasError = ""; + String acumPolizas = ""; + + if (!lstPolizasCanceladas.isEmpty() && lstPersonasPoliza.size() == lstPolizasCanceladas.size()) { + for (int i = 0; i < lstPolizasCanceladas.size(); i++) { + if (i == 0) { + acumPolizas += lstPolizasCanceladas.get(i).getPolContrato(); + } else { + acumPolizas += ", ".concat(lstPolizasCanceladas.get(i).getPolContrato()); + } + } + EstadoPoliza estado = this.getEstadoActivo(lstPolizasCanceladas.get(0)); + polizasCanceladasError = String.format("El usuario con identificación %s solo posee %s poliza(s) %s en estado %s", + identificacion, lstPolizasCanceladas.size(), acumPolizas, + estado.getDetEstado().getDetNombre()); + errorPagos = polizasCanceladasError; + } + lstErrores.add(errorPagos); + } else if (lstPagosPersona.size() > 1) { + lstErrores.add(String.format("Se han encontrado %s pagos para la identificación %s con valor %s, y fecha perteneciente " + + "al mes %s y año %s", lstPagos.size(), identificacion, valor, sepFechaCsv[1], sepFechaCsv[2])); + } else { + lstPagosTotales.addAll(lstPagosPersona); + } + } + + } else { + lstErrores.add(String.format("No se ha encontrado poliza perteneciente a la identificación %s, por favor verifique que la poliza " + + "no se encuentre en estado cancelado", identificacion)); + } + + } + + } catch (DaoException | DominioExcepcion | IOException | NumberFormatException e) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, "Error al procesar el archivo: ".concat(e.toString())); + } + return ProcesarActualizaciones(lstErrores, lstPagosTotales, daopag, daopol); + } + + /** + * + * @param poliza + * @return + */ + private EstadoPoliza getEstadoActivo(Poliza poliza) { + EstadoPoliza result = null; + for (EstadoPoliza es : poliza.getEstadoPolizaCollection()) { + if (es.getEspEstado().equals(DominioConstantes.ACTIVO)) { + result = es; + } + } + return result; + } + + public List ProcesarActualizaciones(List lstErrores, List lstPagos, DaoGenerico daopag, + DaoGenerico daopol) throws DominioExcepcion, DaoException { + List lstPagosActualizados = new ArrayList<>(); + if (lstErrores.size() > 0) { + StringBuilder erroresSB = new StringBuilder(""); + for (String error : lstErrores) { + erroresSB.append(error).append(System.lineSeparator()); + } + + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("Error(es) al procesar el archivo: %s", erroresSB.toString())); + } else { + DetalleCatalogo detallePagado = DetalleCatalogoEnum.PAG.getDetalle(); + for (Pago pago : lstPagos) { + Pago pgo = actualizarPago(pago, daopag, detallePagado, pago.getPagObservacion()); + Poliza poliza = actualizarPolizaPago(pago.getPolCodigo(), daopol); + lstPagosActualizados.add(pgo); + } + + } + + return lstPagosActualizados; + } + + public List buscarPagosPendientesPorPoliza(Poliza poliza, DaoGenerico daopag) throws DaoException { + Pago pagoPlantilla = new Pago(); + pagoPlantilla.setPolCodigo(poliza); + pagoPlantilla.setDetEstado(DetalleCatalogoEnum.PAG1.getDetalle()); + return daopag.buscarLista(pagoPlantilla, new String[]{"pagCodigo", "ASC"}); + + } + + /** + * + * @param doc + * @param contrato + * @param nemonico + * @return + */ + private List leerCSV(DocumentoDTO doc, DaoGenerico daopag, DaoGenerico daopol, + DaoGenerico daodet) throws DaoException, DominioExcepcion, Exception { + InputStream is = null; + BufferedReader bfReader = null; + String estado = null; + Double valor = null; + String observaciones = null; + List lstErrores = new ArrayList<>(); + DetalleCatalogo detallePagado = DetalleCatalogoEnum.PAG.getDetalle(); + List lstEjecutarPagos = new ArrayList<>(); + + try { + is = new ByteArrayInputStream(doc.getData()); + InputStreamReader isr = new InputStreamReader(is, "ISO-8859-1"); + bfReader = new BufferedReader(isr); + String temp = null; + int i = 1; + while ((temp = bfReader.readLine()) != null) { + String[] fila = temp.split(","); + estado = fila[6].replace("\"", "").trim(); + if (estado.equals("OPI ACREDITADA")) { + valor = Double.parseDouble(fila[2].replace("\"", "").trim()); + observaciones = fila[7].replace("\"", "").trim(); + String[] arrayObservacion = observaciones.split(" "); + Integer pagCodigo = Integer.parseInt(arrayObservacion[2]); + + Pago pagoBuscado = daopag.buscarUnico(new Pago(pagCodigo)); + + if (pagoBuscado == null) { + lstErrores.add("No se ha encontrado el pago ".concat(pagCodigo.toString())); + + }else{ + if(pagoBuscado.getPagMonto() == null){ + lstErrores.add(String.format("El valor de monto del pago %s en la fila %s no puede ser vacio", pagCodigo,i)); + + } + if (Double.compare(pagoBuscado.getPagMonto(), valor) != 0) { + lstErrores.add(String.format("El valor subido en el archivo %s es diferente del monto %s para el pago %s", valor, pagoBuscado.getPagMonto(), pagCodigo)); + + } + if (!pagoBuscado.getDetEstado().getDetNemonico().equals("PAG1")) { + lstErrores.add(String.format("El pago %s NO se encuentra en estado pendiente", pagCodigo)); + } + + } + + lstEjecutarPagos.add(pagoBuscado); + //Pago pago = actualizarPago(pagoBuscado, daopag, detallePagado, DominioConstantes.PAG_OBSERVACION_DEBITO ); + //pagosActualizados.add(pago); + //Poliza poliza = actualizarPolizaPago(pagoBuscado.getPolCodigo(), daopol); + } + i++; + } + } catch (DaoException | IOException | NumberFormatException e) { + throw new Exception("ERROR FATAL: Error al procesar el archivo ".concat(e.getMessage())); + + } + + return procesarAlmacenamientoPagos(lstEjecutarPagos, lstErrores, daopag, detallePagado, daopol); + } + + public List procesarAlmacenamientoPagos(List lstPagos, List lstErrores, DaoGenerico daopag, + DetalleCatalogo detallePagado, DaoGenerico daopol) throws DaoException, DominioExcepcion { + + List result = new ArrayList<>(); + if (lstErrores.size() > 0) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + String.format("Error(es) al procesar los pagos: %s", ListaAString(lstErrores))); + } + for (Pago pago : lstPagos) { + Pago pagoActualizado = actualizarPago(pago, daopag, detallePagado, DominioConstantes.PAG_OBSERVACION_DEBITO); + result.add(pagoActualizado); + actualizarPolizaPago(pago.getPolCodigo(), daopol); + } + return result; + } + + public String ListaAString(List lstString) { + StringBuilder erroresSB = new StringBuilder(""); + for (String string : lstString) { + erroresSB.append(string).append(System.lineSeparator()); + } + + return erroresSB.toString(); + } + + public Pago actualizarPago(Pago pago, DaoGenerico daopag, DetalleCatalogo detEstadoPago, String observacion) throws DaoException, DominioExcepcion { + + System.out.println("actualizar pago>>>> " + pago.getPagCodigo() + " - " + pago.getPagMonto()); + pago.setDetEstado(detEstadoPago); + pago.setPagFechaPago(new Date()); + pago.setPagFechaRegistro(new Date()); + pago.setPagObservacion(observacion); + daopag.actualizar(pago); + return pago; + } + + public Poliza actualizarPolizaPago(Poliza poliza, DaoGenerico daopol) throws DaoException, DominioExcepcion { + if (poliza == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "No se ha encontrado poliza atada al pago "); + } + poliza.setPolEstado(DominioConstantes.ACTIVO); + poliza.setPolDescripcion(DominioConstantes.DESCRIPCION_POLIZA_ACTIVA); + daopol.actualizar(poliza); + return poliza; + } + + private String grabaDocumento(DocumentoDTO doc) throws DominioExcepcion { + + String nemonico = "Documentos"; + String url = DetalleCatalogoEnum.URLFIL.getDetalle().getDetOrigen(); + DetalleCatalogo detTipo = null; + if (doc.getDetTipo() != null) { + detTipo = catalogoUtil.getDetallePorCodigo(doc.getDetTipo()); + } + + if (doc.getAgeCodigo() != null) { + DaoGenerico dao = new DaoGenerico(Agendamiento.class); + url = DetalleCatalogoEnum.URLAGE.getDetalle().getDetOrigen(); + try { + Agendamiento age = dao.cargar(doc.getAgeCodigo()); + if (age == null) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No esxiste registro agendamiento para el codigo " + doc.getAgeCodigo()); + } + nemonico = age.getAgeNemonico(); + int year = Calendar.getInstance().get(Calendar.YEAR); + url = String.format(url, "" + year, nemonico); + } catch (DaoException ex) { + } + } else if (doc.getLiqCodigo() != null) { + DaoGenerico dao = new DaoGenerico(Liquidacion.class); + url = DetalleCatalogoEnum.URLLIQ.getDetalle().getDetOrigen(); + try { + Liquidacion liq = dao.cargar(doc.getLiqCodigo()); + if (liq == null) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No esxiste registro agendamiento para el codigo " + doc.getLiqCodigo()); + } + + nemonico = liq.getLiqNemonico(); + String anio = dominioUtil.obtenerAnioDeFecha(liq.getLiqFechaRegistro()); + //int year = Calendar.getInstance().get(Calendar.YEAR); + url = String.format(url, "" + anio, nemonico); + } catch (DaoException ex) { + } + } else if (doc.getPolCodigo() != null) { + DaoGenerico dao = new DaoGenerico(Poliza.class); + url = DetalleCatalogoEnum.URLPOL.getDetalle().getDetOrigen(); + try { + Poliza pol = dao.cargar(doc.getPolCodigo()); + if (pol == null) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, + "No esxiste registro agendamiento para el codigo " + doc.getPolCodigo()); + } + int year = Calendar.getInstance().get(Calendar.YEAR); + nemonico = year + System.getProperty("file.separator") + pol.getPolContrato(); + url = String.format(url, nemonico); + } catch (DaoException ex) { + } + } else if (detTipo != null && (detTipo.getDetNemonico().equals("URLFDE") || detTipo.getDetNemonico().equals("URLFTC") || detTipo.getDetNemonico().equals("URLFUS")|| detTipo.getDetNemonico().equals("URLFCC") || detTipo.getDetNemonico().equals("URLFCP"))) { + int year = Calendar.getInstance().get(Calendar.YEAR); + url = String.format(detTipo.getDetOrigen(), year); + + } + + File file = new File(url); + try { + file.mkdirs(); + url = url.concat(doc.getDocNombre()); + FileOutputStream writer; + writer = new FileOutputStream(new File(url)); + writer.write(doc.getData()); + writer.close(); + } catch (IOException | NullPointerException ex) { + url = null; + } + return url; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/DominioUtil.java b/src/main/java/com/qsoft/erp/dominio/util/DominioUtil.java new file mode 100644 index 0000000..be33385 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/DominioUtil.java @@ -0,0 +1,537 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.ConfiguracionEnum; +import com.qsoft.dao.util.Constantes; +import com.qsoft.dao.util.Fila; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.mapper.QParser; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.constantes.QueryEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.model.Parametro; +import com.qsoft.erp.model.Usuario; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import javax.ejb.Stateless; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.mapstruct.factory.Mappers; + +/** + * + * @author james + */ +@Stateless +public class DominioUtil { + + private static final String METODO_DTO = "getDto"; + private static final String METODO_ENTIDAD = "getEntidad"; + private static final String SEPARADOR = ":"; + private static final String PATRON_LIQUIDACION = "LQ%s"; + private static final String PATRON_AGENDA = "AGE%s"; + private static final String PATRON_POLIZA = "POL%s"; + private static final int LONGITUD = 10; + public static final String TIPO_QUERY = "QUERY"; + + /** + * + * @param liquidacion + * @return + */ + public Usuario getTitularLiquidacion(Integer liquidacion) { + Usuario usuario = new Usuario(); + DaoGenerico dao = new DaoGenerico<>(Usuario.class); + String query = String.format(QueryEnum.USULIQ.getParametro().getParValor(), liquidacion); + System.out.println("======> EJECUTAR QUERY " + query); + List usuarios = dao.ejecutarConsultaNativaList(query); + for (Fila fila : usuarios) { + System.out.println("FILA " + fila); + if (fila.getEntero(0) != null) { + try { + usuario = dao.cargar(fila.getEntero(0)); + } catch (DaoException ex) { + usuario = new Usuario(); + } + } + } + return usuario; + } + + /** + * * + * Permite generar un ZIP con el contenido de una carpeta permite indicar la carpeta el nombre del archivo de salida + * + * @param folder + * @param nombreZip + * @param incluirCarpetas + * @return {@link ZipOutputStream} + */ + public File crearZip(String folder, String nombreZip, boolean incluirCarpetas) { + File salida = new File(folder + Constantes.SEPARADOR + nombreZip); + try { + FileOutputStream fos = new FileOutputStream(salida); + ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos)); + this.addFiles(salida,zos, new File(folder), folder, incluirCarpetas); + zos.close(); + System.out.println("OK creado el ZIP"); + } catch (IOException ex) { + ex.printStackTrace(System.err); + } + return salida; + } + + public void copiarArchivos(String origen, String destino, boolean incluirCarpetas) { + try { + Path origenPath = Paths.get(origen); + Path destinoPath = Paths.get(destino); + Files.copy(origenPath, destinoPath, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + e.printStackTrace(System.err); + } + } + + public String obtenerAnioDeFecha(Date fecha){ + return DominioConstantes.FORMAT_AÑO_SDF.format(fecha); + } + /** + * Permite agregar archivos de forma recursiva a un ZIP + * + * @param zos + * @param folder + * @param incluirCarpetas + */ + private void addFiles(File zip, ZipOutputStream zos, File folder, String baseFolder, boolean incluirCarpetas) { + for (File f : folder.listFiles()) { + if (f.isDirectory()) { + if (incluirCarpetas) { + addFiles(zip,zos, f, baseFolder, incluirCarpetas); + } + } else { + try { + String nombreArchivo = f.getAbsolutePath().replace(baseFolder, ""); + nombreArchivo = nombreArchivo.startsWith("/") ? nombreArchivo.replaceFirst("/", "") : nombreArchivo; + if(!zip.getName().equals(nombreArchivo)){ + FileInputStream in = new FileInputStream(f); + zos.putNextEntry(new ZipEntry(nombreArchivo )); + zos.write(in.readAllBytes()); + in.close(); + zos.closeEntry(); + } + + + + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + } + + /** + * Validador de cedula ecuatoriana + * + * @param cedula + * @return + * @throws DominioExcepcion + */ + public String aStringLn(List lst){ + StringBuilder sb = new StringBuilder(""); + for (String string : lst) { + sb.append(string); + sb.append(System.getProperty("line.separator")); + + } + return sb.toString(); + } + public static String replaceLast(String text, String regex, String replacement) { + return text.replaceFirst("(?s)"+regex+"(?!.*?"+regex+")", replacement); + } + public boolean validarCedula(String cedula) throws DominioExcepcion { + boolean valida = false; + byte primeros2, tercerD, Dverificador, multiplicar, suma = 0, aux; + byte[] digitos = new byte[9]; + try { + if (cedula.length() != 10) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula debe contener 10 d\u00edgitos sin espacios<--\n"); + } + + Dverificador = Byte.parseByte("" + cedula.charAt(9)); + primeros2 = Byte.parseByte(cedula.substring(0, 2)); + tercerD = Byte.parseByte("" + cedula.charAt(2)); + for (byte i = 0; i < 9; i++) { + digitos[i] = Byte.parseByte("" + cedula.charAt(i)); + } + if (primeros2 >= 1 & primeros2 <= 24) { + if (tercerD <= 6) { + for (byte i = 0; i < 9; i = (byte) (i + 2)) { + multiplicar = (byte) (digitos[i] * 2); + if (multiplicar > 9) { + multiplicar = (byte) (multiplicar - 9); + } + suma = (byte) (suma + multiplicar); + } + for (byte i = 1; i < 9; i = (byte) (i + 2)) { + multiplicar = (byte) (digitos[i] * 1); + suma = (byte) (suma + multiplicar); + } + aux = suma; + while (aux % 10 != 0) { + aux = (byte) (aux + 1); + } + suma = (byte) (aux - suma); + valida = suma == Dverificador; + } + } + } catch (NumberFormatException e) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula debe contener solo d\u00edgitos num\u00e9ricos<--\n"); + } + return valida; + } + public boolean validarCedulaSinException(String cedula) throws DominioExcepcion { + boolean valida = false; + + byte primeros2, tercerD, Dverificador, multiplicar, suma = 0, aux; + byte[] digitos = new byte[9]; + try { + if (cedula.length() != 10) { + valida = false; + }else{ + Dverificador = Byte.parseByte("" + cedula.charAt(9)); + primeros2 = Byte.parseByte(cedula.substring(0, 2)); + tercerD = Byte.parseByte("" + cedula.charAt(2)); + for (byte i = 0; i < 9; i++) { + digitos[i] = Byte.parseByte("" + cedula.charAt(i)); + } + if (primeros2 >= 1 & primeros2 <= 24) { + if (tercerD <= 6) { + for (byte i = 0; i < 9; i = (byte) (i + 2)) { + multiplicar = (byte) (digitos[i] * 2); + if (multiplicar > 9) { + multiplicar = (byte) (multiplicar - 9); + } + suma = (byte) (suma + multiplicar); + } + for (byte i = 1; i < 9; i = (byte) (i + 2)) { + multiplicar = (byte) (digitos[i] * 1); + suma = (byte) (suma + multiplicar); + } + aux = suma; + while (aux % 10 != 0) { + aux = (byte) (aux + 1); + } + suma = (byte) (aux - suma); + valida = suma == Dverificador; + } + } + + + } + + + } catch (NumberFormatException e) { + valida = false; + } + return valida; + } + public boolean validarFecha(String fecha, SimpleDateFormat formato){ + boolean correcto = false; + try { + formato.setLenient(false); + formato.parse(fecha); + correcto = true; + } catch (ParseException e) { + correcto = false; + } + return correcto; + } + + /** + * + * @param numero + * @return + */ + public String getCodLiquidacion(long numero) { + String codigo = String.format(PATRON_LIQUIDACION, StringUtils.leftPad("" + numero, LONGITUD, "0")); + return codigo; + } + + /** + * + * @param numero + * @return + */ + public String getCodAgendamiento(long numero) { + String codigo = String.format(PATRON_AGENDA, StringUtils.leftPad("" + numero, LONGITUD, "0")); + return codigo; + } + + /** + * + * @param numero + * @return + */ + public String getCodPoliza(long numero) { + String codigo = String.format(PATRON_POLIZA, StringUtils.leftPad("" + numero, LONGITUD, "0")); + return codigo; + } + + public Parametro + getParametro(String nemonico, String tipo) { + DaoGenerico dao = new DaoGenerico<>(Parametro.class + ); + Parametro param = new Parametro(); + + param.setParNemonico(nemonico); + + param.setParTipo(tipo); + + try { + param = dao.buscarUnico(param); + } catch (DaoException ex) { + param = null; + } + return param; + } + + /** + * + * @param valor + * @return + * @throws DominioExcepcion + */ + public String getSHAValor(String valor) throws DominioExcepcion { + if (valor == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_IN_NULO, + "EL valor a cifrar no puede ser nulo"); + } + return DigestUtils.sha512Hex(valor); + } + + /** + * + * @param user + * @param password + * @return + * @throws DominioExcepcion + */ + public String getSHAUsuario(String user, String password) throws DominioExcepcion { + if (user == null || password == null) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_IN_NULO, + "EL usuario y password no puede ser nulo"); + } + return DigestUtils.sha512Hex(user + SEPARADOR + password); + } + + /** + * + * @param entidad + * @return + */ + public DaoGenerico + generarDao(String entidad) { + EntidadEnum en = Enum.valueOf(EntidadEnum.class, + entidad); + return generarDao(en, ConfiguracionEnum.MAXIMO_REGISTROS.getInteger()); + } + + /** + * + * @param entidad + * @param maxRegistros + * @return + */ + public DaoGenerico + generarDao(String entidad, Integer maxRegistros) { + EntidadEnum en = Enum.valueOf(EntidadEnum.class, + entidad); + return generarDao(en, maxRegistros); + } + + /** + * + * @param entidad + * @return + */ + public DaoGenerico generarDao(EntidadEnum entidad) { + return generarDao(entidad, null); + } + + /** + * + * @param archivo + * @return + */ + public static String getArchivo(String archivo) { + String data = null; + byte[] result = null; + try { + File f = new File(archivo); + if (f.exists()) { + result = FileUtils.readFileToByteArray(f); + data = Base64.encodeBase64String(result); + } else { + result = ("No existe el archivo " + archivo).getBytes(); + } + } catch (IOException ex) { + result = ex.toString().getBytes(); + } + return data; + } + + /** + * + * @param urlArchivo + * @return + */ + public static String getNombreArchivo(String urlArchivo) { + String name = urlArchivo; + File f = new File(urlArchivo); + if (f.exists()) { + name = f.getName(); + } + return name; + } + + /** + * + * @param entidad + * @param maxRegistros + * @return + */ + public DaoGenerico generarDao(EntidadEnum entidad, Integer maxRegistros) { + DaoGenerico dao = null; + if (entidad != null) { + if (maxRegistros != null && maxRegistros > 0) { + dao = new DaoGenerico(entidad.getEntidad(), maxRegistros); + } else { + dao = new DaoGenerico(entidad.getEntidad()); + } + } + return dao; + } + + /** + * @param tipo + * @param datos + * @return + */ + public Serializable crearObjeto(Class tipo, Map datos) { + Object obj = null; + try { + obj = tipo.getConstructor().newInstance(); + } catch (Exception ex) { + System.out.println("Error obteniendo contructor " + ex); + } + for (Map.Entry e : datos.entrySet()) { + Field f = null; + try { + f = obj.getClass().getDeclaredField(e.getKey()); + } catch (NoSuchFieldException | SecurityException ex) { + System.out.println("Error obteniendo variable " + ex); + } + if (f != null) { + try { + f.setAccessible(true); + if (Date.class.isAssignableFrom(f.getType()) && e.getValue() != null) { + if (e.getValue().toString().length() > 10) { + f.set(obj, DominioConstantes.getDateTime("" + e.getValue())); + } else { + f.set(obj, DominioConstantes.getDate("" + e.getValue())); + } + } else if (List.class.isAssignableFrom(f.getType())) { + //TODO: Aqui a futuro evaluar listas si no se contempla falla + } else if (!String.class.isAssignableFrom(f.getType()) && e.getValue() != null) { + f.set(obj, QParser.parse(e.getValue().toString(), f.getType())); + } else { + f.set(obj, e.getValue()); + } + } catch (SecurityException | IllegalAccessException | IllegalArgumentException ex) { + System.out.println("Error Parsning crear objeto " + ex); + } + } + } + return (Serializable) obj; + } + + /** + * + * @param mapper + * @param entidad + * @return + */ + public Object getDto(Class mapper, Object entidad) { + Object result = ejecutaMetodo(mapper, entidad, METODO_DTO); + return result; + } + + /** + * + * @param mapper + * @param dto + * @return + */ + public Object getEntidad(Class mapper, Object dto) { + Object result = ejecutaMetodo(mapper, dto, METODO_ENTIDAD); + return result; + } + + /** + * + * @param mapper + * @param entidad + * @param nombreMetodo + * @return + */ + public Object ejecutaMetodo(Class mapper, Object entidad, String nombreMetodo) { + Object o = Mappers.getMapper(mapper); + Method metodo = null; + for (Method m : mapper.getMethods()) { + if (m.getName().equals(nombreMetodo)) { + metodo = m; + break; + } + } + Object result = null; + if (metodo != null) { + try { + result = metodo.invoke(o, entidad); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { + ex.printStackTrace(System.out); + } + } + return result; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/LiquidacionCalc.java b/src/main/java/com/qsoft/erp/dominio/util/LiquidacionCalc.java new file mode 100644 index 0000000..3a618d0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/LiquidacionCalc.java @@ -0,0 +1,248 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.QueryEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.transaccion.AuxLiquidacion; +import com.qsoft.erp.dominio.transaccion.LiquidacionSum; +import com.qsoft.erp.dto.ValoresLiquidacion; +import com.qsoft.erp.model.CoberturasPlan; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Plan; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.TarifaLiquidacion; +import com.qsoft.erp.model.Tarifario; +import com.qsoft.erp.reportes.UtilitarioReporte; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ejb.Stateless; +import javax.transaction.Transactional; + +/** + * + * @author james + */ +@Stateless +public class LiquidacionCalc { + + private final static String LIMITE_CUPO = "Ha alcanzado el limite de cobertura para el asegurado"; + + /** + * + * @param liquidacion + * @param proveedor + * @return + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public Liquidacion procesarLiquidacion(Liquidacion liquidacion, boolean proveedor) { + LiquidacionSum liqSum = this.cargarValores(liquidacion); + try { + liqSum = this.cargarRelaciones(liqSum); + if (proveedor) { + this.setObjetados(liqSum); + } + Double maximo = liqSum.getPlan().getPlaCoberturaMaxima() - liqSum.getPagoCubierto(liqSum.getBeneficiario()); + List deducibles = new ArrayList<>(liqSum.getDeducibles().values()); + Map copagos = liqSum.getCopagos(); + System.out.println("============================= PROCESAR LIQUIDACION == " + copagos.size() + " => " + deducibles.size()); + if (maximo <= 0) { + for (AuxLiquidacion aux : liqSum.getData()) { + aux.getTalCodigo().setTarObservacion(LIMITE_CUPO); + aux.getTalCodigo().setTalValorPagado(0.0); + aux.getTalCodigo().setTalValorDeducible(0.0); + aux.getTalCodigo().setTalValorCopago(0.0); + } + } else { + liqSum.procesarPorCobertura(copagos, deducibles.isEmpty() ? null : deducibles.get(0), maximo); + } + Persona titular = new Persona(); + PersonaPoliza benf = null; + for (PersonaPoliza p : liqSum.getLiquidacion().getPolCodigo().getPersonaPolizaCollection()) { + if (p.getPerCodigo().getPerCodigo().equals(liqSum.getBeneficiario().getPerCodigo())) { + benf = p; + } + if (p.getDetTipoPersona().getDetNemonico().equals(DetalleCatalogoEnum.PTITU.name())) { + titular = p.getPerCodigo(); + } + } + System.out.println("*********************** FIN PROCESAR CALCULOS ***********************"); + this.registraBdd(liqSum); + UtilitarioReporte repor = new UtilitarioReporte(); + benf.getPerCodigo(); + String reporte = repor.generarLiquidacion(liqSum.getLiquidacion().getPolCodigo(), liqSum.getLiquidacion(), liqSum.getDetalles(), titular, benf); + liqSum.getLiquidacion().setLiqReporte(reporte); + DaoGenerico daoliq = new DaoGenerico<>(Liquidacion.class); + daoliq.actualizar(liqSum.getLiquidacion()); + System.out.println("============================= OK PROCESADA LIQUIDACION ============================="); + } catch (Exception ex) { + ex.printStackTrace(System.err); + System.out.println("Error procesando " + ex); + } + return liqSum.getLiquidacion(); + } + + /** + * + * @param liqSum + */ + private void setObjetados(LiquidacionSum liqSum) { + for (AuxLiquidacion aux : liqSum.getData()) { + aux.getTalCodigo().setTalValorObjetado(aux.getTalCodigo().getTalValorRegistrado()); + aux.getDelCodigo().setDelValorObjetado(aux.getDelCodigo().getDelValorRegistrado()); + } + } + + /** + * Permite cargar los valores de liquidacion + * + * @param liquidacion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private LiquidacionSum cargarValores(Liquidacion liquidacion) { + if (liquidacion == null || liquidacion.getPolCodigo() == null) { + throw new IllegalArgumentException("ERROR, Se requiere el numero de poliza para procesar la liquidacion"); + } + LiquidacionSum valor = new LiquidacionSum(liquidacion); + + String query = String.format(QueryEnum.LIQPOL.getQuery(), liquidacion.getLiqCodigo()); + String historico = String.format(QueryEnum.LIQTOT.getQuery(), + liquidacion.getPolCodigo().getPolCodigo(), liquidacion.getPerBeneficiario().getPerCodigo()); + DaoGenerico dao = new DaoGenerico<>(Poliza.class); + for (Fila f : dao.ejecutarConsultaNativaList(query)) { + AuxLiquidacion auxiliar = new AuxLiquidacion(); + auxiliar.setDetCie10(new DetalleCatalogo(f.getEntero(0))); + auxiliar.setDetPrestacion(new DetalleCatalogo(f.getEntero(1))); + auxiliar.setPlaCodigo(new Plan(f.getEntero(2))); + auxiliar.setLiqCodigo(new Liquidacion(f.getEntero(3))); + auxiliar.setPerBeneficiario(new Persona(f.getEntero(4))); + auxiliar.setEslCodigo(new EstadoLiquidacion(f.getEntero(5))); + auxiliar.setDelCodigo(new DetalleLiquidacion(f.getEntero(6))); + auxiliar.setTalCodigo(new TarifaLiquidacion(f.getEntero(7))); + auxiliar.setTarCodigo(new Tarifario(f.getEntero(8))); + auxiliar.setCopCodigo(new CoberturasPlan(f.getEntero(9))); + valor.getData().add(auxiliar); + } + for (Fila f : dao.ejecutarConsultaNativaList(historico)) { + AuxLiquidacion auxiliar = new AuxLiquidacion(); + auxiliar.setDetCie10(new DetalleCatalogo(f.getEntero(0))); + auxiliar.setDetPrestacion(new DetalleCatalogo(f.getEntero(1))); + auxiliar.setPlaCodigo(new Plan(f.getEntero(2))); + auxiliar.setLiqCodigo(new Liquidacion(f.getEntero(3))); + auxiliar.setPerBeneficiario(new Persona(f.getEntero(4))); + auxiliar.setEslCodigo(new EstadoLiquidacion(f.getEntero(5))); + auxiliar.setDelCodigo(new DetalleLiquidacion(f.getEntero(6))); + auxiliar.setTalCodigo(new TarifaLiquidacion(f.getEntero(7))); + auxiliar.setTarCodigo(new Tarifario(f.getEntero(8))); + auxiliar.setCopCodigo(new CoberturasPlan(f.getEntero(9))); + valor.getHisto().add(auxiliar); + } + return valor; + } + + /** + * + * @param liqSum + */ + private void registraBdd(LiquidacionSum liqSum) { + liqSum.mayorizar(); + for (AuxLiquidacion aux : liqSum.getData()) { + aux.guardaTarifa(); + } + for (DetalleLiquidacion del : liqSum.getDetalles()) { + try { + DaoGenerico daoDl = new DaoGenerico<>(DetalleLiquidacion.class); + daoDl.actualizar(del); + del.getCopCodigo().getDetTipo(); + } catch (DaoException ex) { + System.out.println("No se puede actualizar Tarifa " + ex); + } + } + } + + /** + * + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private LiquidacionSum cargarRelaciones(LiquidacionSum liqSum) { + DaoGenerico daoPla = new DaoGenerico<>(Plan.class); + DaoGenerico daoDc = new DaoGenerico<>(DetalleCatalogo.class); + DaoGenerico daoPer = new DaoGenerico<>(Persona.class); + DaoGenerico daoDl = new DaoGenerico<>(DetalleLiquidacion.class); + DaoGenerico daoCp = new DaoGenerico<>(CoberturasPlan.class); + DaoGenerico daoTl = new DaoGenerico<>(TarifaLiquidacion.class); + try { + Plan plan = null; + DetalleCatalogo cie10 = null; + Persona beneficiario = null; + Map detalles = new HashMap<>(); + Map coberturas = new HashMap<>(); + System.out.println(">>>>>>>>>> Cargar relaciones " + liqSum.getData().size()); + for (AuxLiquidacion aux : liqSum.getData()) { + if (plan == null) { + plan = daoPla.cargar(aux.getPlaCodigo().getPlaCodigo()); + } + if (cie10 == null) { + cie10 = daoDc.cargar(aux.getDetCie10().getDetCodigo()); + } + if (beneficiario == null) { + beneficiario = daoPer.cargar(aux.getPerBeneficiario().getPerCodigo()); + } + if (!detalles.containsKey(aux.getDelCodigo().getDelCodigo())) { + detalles.put(aux.getDelCodigo().getDelCodigo(), daoDl.cargar(aux.getDelCodigo().getDelCodigo())); + } + if (!coberturas.containsKey(aux.getCopCodigo().getCopCodigo())) { + coberturas.put(aux.getCopCodigo().getCopCodigo(), daoCp.cargar(aux.getCopCodigo().getCopCodigo())); + } + if (aux.getTalCodigo() != null && aux.getTalCodigo().getTalCodigo() != null) { + aux.setTalCodigo(daoTl.cargar(aux.getTalCodigo().getTalCodigo())); + } + aux.setDelCodigo(detalles.get(aux.getDelCodigo().getDelCodigo())); + aux.setCopCodigo(coberturas.get(aux.getCopCodigo().getCopCodigo())); + aux.setPlaCodigo(plan); + aux.setPerBeneficiario(beneficiario); + aux.setDetCie10(cie10); + } + } catch (DaoException ex) { + System.out.println("Error cargando datos " + ex); + } + try { + Plan plan = null; + + Map detalles = new HashMap<>(); + Map coberturas = new HashMap<>(); + System.out.println(">>>>>>>>>> Cargar histo " + liqSum.getHisto().size()); + for (AuxLiquidacion aux : liqSum.getHisto()) { + if (plan == null) { + plan = daoPla.cargar(aux.getPlaCodigo().getPlaCodigo()); + } + if (!detalles.containsKey(aux.getDelCodigo().getDelCodigo())) { + detalles.put(aux.getDelCodigo().getDelCodigo(), daoDl.cargar(aux.getDelCodigo().getDelCodigo())); + } + if (!coberturas.containsKey(aux.getCopCodigo().getCopCodigo())) { + coberturas.put(aux.getCopCodigo().getCopCodigo(), daoCp.cargar(aux.getCopCodigo().getCopCodigo())); + } + aux.setTalCodigo(daoTl.cargar(aux.getTalCodigo().getTalCodigo())); + aux.setDelCodigo(detalles.get(aux.getDelCodigo().getDelCodigo())); + aux.setPlaCodigo(plan); + } + } catch (DaoException ex) { + System.out.println("Error cargando datos " + ex); + } + return liqSum; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/LiquidacionUtil.java b/src/main/java/com/qsoft/erp/dominio/util/LiquidacionUtil.java new file mode 100644 index 0000000..7f55d33 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/LiquidacionUtil.java @@ -0,0 +1,450 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.erp.constantes.EstadoLiquidacionEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dto.DetalleLiquidacionDTO; +import com.qsoft.erp.dto.DocumentoDTO; +import com.qsoft.erp.dto.EstadoLiquidacionDTO; +import com.qsoft.erp.dto.LiquidacionDTO; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.Documento; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Usuario; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA_ONSITE; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.DetalleLiquidacionMapper; +import com.qsoft.erp.constantes.SecuenciaEnum; +import com.qsoft.erp.dto.TarifaLiquidacionDTO; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.TarifaLiquidacion; +import java.util.HashMap; +import java.util.Objects; +import javax.transaction.Transactional; + +/** + * + * @author james + */ +@Stateless +public class LiquidacionUtil { + + @EJB + private DominioUtil dominioUtil; + + @EJB + private LiquidacionCalc liquidacionCalcs; + + @EJB + private NotificadorUtil notificadorUtil; + + @EJB + private SecuenciaUtil secuenciaUtil; + + @EJB + private CatalogoUtil catalogoUtil; + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param header + * @param datos + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List guardarLiquidacion(HeaderMS header, Map datos) throws DominioExcepcion { + List data = new ArrayList<>(); + DaoGenerico daoliq = new DaoGenerico<>(Liquidacion.class); + DaoGenerico daousu = new DaoGenerico<>(Usuario.class); + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + for (Map.Entry entry : datos.entrySet()) { + try { + Liquidacion liq; + System.out.println("==============> GUARDAR LIQUIDACION....."); + liq = (Liquidacion) this.dominioUtil.getEntidad(EntidadEnum.Liquidacion.getMapper(), entry.getValue()); + long cod = this.secuenciaUtil.getSecuencia(SecuenciaEnum.LIQMED); + liq.setLiqNemonico(this.dominioUtil.getCodLiquidacion(cod)); + Poliza pol = daopol.cargar(entry.getValue().getPolCodigo()); + liq.setPolCodigo(pol); + liq.setLiqFechaRegistro(new Date()); + liq.setDocumentoCollection(this.crearDocumentos(liq, entry.getValue())); + liq.setEstadoLiquidacionCollection(new ArrayList<>()); + Usuario usuario = EstadoLiquidacionEnum.ESTLI.getUsuarioGenerico(); + liq.getEstadoLiquidacionCollection().add(this.crearEstadoInicial(liq, usuario)); + daoliq.guardar(liq); + Usuario user = new Usuario(); + user.setUsuUsuario(header.getUsuario()); + user.setUsuEstado(DominioConstantes.ACTIVO); + user = daousu.buscarUnico(user); + this.notificadorUtil.notificarLiquidacion(user, liq); + data.add(liq); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_VALOR_NULO, + "Error registrando liquidacion en BDD " + ex); + } + } + + return data; + } + + /** + * + * @param header + * @param datos + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List actualizarLiquidacion(HeaderMS header, Map datos, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + DaoGenerico daoliq = new DaoGenerico<>(Liquidacion.class); + for (Map.Entry entry : datos.entrySet()) { + LiquidacionDTO liquidacion = entry.getValue(); + Liquidacion liq = null; + //TODO: aqui puede ser consulta por CONTRATO + liq = daoliq.buscar(liquidacion.getLiqCodigo()); + if (liq != null) { + try { + boolean saltoFlujo = false; + EstadoLiquidacion estado = null; + liq.getDocumentoCollection().addAll(this.crearDocumentos(liq, liquidacion)); + if (tipoAccion != ACTUALIZA_ONSITE) { + EstadoLiquidacion previo = null; + for (EstadoLiquidacion es : liq.getEstadoLiquidacionCollection()) { + if (Objects.equals(DominioConstantes.ACTIVO, es.getEslEstado())) { + es.setEslEstado(DominioConstantes.INACTIVO); + es.setEslFechaFin(new Date()); + previo = es; + } + } + if (liquidacion.getEstados() != null && !liquidacion.getEstados().isEmpty()) { + System.out.println("=====> ATENCION? " + liq.getDetAtencion() + " => " + liquidacion.getDetAtencion()); + Integer codAt = liq.getDetAtencion() != null && liq.getDetAtencion().getDetCodigo() != null + ? liq.getDetAtencion().getDetCodigo() : liquidacion.getDetAtencion(); + DetalleCatalogo atencion = this.catalogoUtil.cargar(codAt); + + saltoFlujo = atencion != null && atencion.getDetNemonico().equals(DetalleCatalogoEnum.ATHE.name()) + || atencion != null && atencion.getDetNemonico().equals(DetalleCatalogoEnum.ATAH.name()) + || atencion != null && atencion.getDetNemonico().equals(DetalleCatalogoEnum.ATHOS.name()); + for (EstadoLiquidacionDTO es : liquidacion.getEstados()) { + estado = this.crearEstado(liq, es, previo, saltoFlujo, tipoAccion); + liq.getEstadoLiquidacionCollection().add(estado); + } + } + } + daoliq.actualizar(liq); + if (estado != null && estado.getDetEstado().getDetNemonico().equalsIgnoreCase(EstadoLiquidacionEnum.ESTLIC.name()) + && liq.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()) && !saltoFlujo && tipoAccion == GUARDA) { + System.out.println("PROCESAR LIQUIDACION PRESTADOR ESTLIC"); + liq = this.liquidacionCalcs.procesarLiquidacion(liq, true); + } + if (estado != null && estado.getDetEstado().getDetNemonico().equalsIgnoreCase(EstadoLiquidacionEnum.ESTLQC.name()) + && liq.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()) && saltoFlujo && tipoAccion == GUARDA) { + System.out.println("PROCESAR LIQUIDACION PRESTADOR ESTLQC"); + liq = this.liquidacionCalcs.procesarLiquidacion(liq, false); + } + if (estado != null && estado.getDetEstado().getDetNemonico().equalsIgnoreCase(EstadoLiquidacionEnum.ESTLQC.name()) + && !liq.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()) && tipoAccion == GUARDA) { + System.out.println("PROCESAR LIQUIDACION NO PRESTADOR ESTLQC"); + liq = this.liquidacionCalcs.procesarLiquidacion(liq, false); + } + + Usuario user = this.dominioUtil.getTitularLiquidacion(liq.getLiqCodigo()); + if (tipoAccion != ACTUALIZA_ONSITE && estado != null) { + this.notificadorUtil.notificarEstadoLiquidacion(liq, user, estado); + } + data.add(liq); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, "ERROR, " + ex); + } + } else { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "ERROR, No existe la liquidacion con el codigo " + liquidacion.getLiqCodigo()); + } + } + return data; + } + + /** + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarDetalleLiquidacion(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + DetalleLiquidacionDTO detalle = (DetalleLiquidacionDTO) dominioUtil.crearObjeto(DetalleLiquidacionDTO.class, ent); + List lista = new ArrayList<>(); + ObjectMapper maper = new ObjectMapper(); + maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); + if (ent.containsKey("detalle")) { + for (Object row : (List) ent.get("detalle")) { + TarifaLiquidacionDTO col = (TarifaLiquidacionDTO) dominioUtil.crearObjeto(TarifaLiquidacionDTO.class, (Map) row); + lista.add(col); + } + } + detalle.setDetalle(lista); + DetalleLiquidacion result = crudDetalle(detalle, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param detalle + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private DetalleLiquidacion crudDetalle(DetalleLiquidacionDTO detalle, int tipoAccion) throws DominioExcepcion { + DaoGenerico daodel = new DaoGenerico<>(DetalleLiquidacion.class); + DetalleLiquidacion result; + result = DetalleLiquidacionMapper.INSTANCE.getEntidad(detalle); + result.setTarifaLiquidacionCollection(this.crearTarifas(detalle, result)); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + daodel.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + DaoGenerico daotar = new DaoGenerico<>(TarifaLiquidacion.class); + for (TarifaLiquidacion tar : result.getTarifaLiquidacionCollection()) { + daotar.actualizar(tar); + } + result = daodel.actualizar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida, debe eliminar la Liquidacion"); + } + } + return result; + } + + /** + * + * @return + */ + private EstadoLiquidacion crearEstadoInicial(Liquidacion liquidacion, Usuario usuario) throws DaoException { + EstadoLiquidacion est = new EstadoLiquidacion(); + est.setDetEstado(EstadoLiquidacionEnum.ESTLI.getDetalle()); + est.setEslEstado(DominioConstantes.ACTIVO); + est.setEslFechaInicio(new Date()); + est.setEslMensaje(DominioConstantes.MENSAJE_AUTO); + est.setLiqCodigo(liquidacion); + est.setUsuCodigo(usuario); + return est; + } + + /** + * + * @param liquida + * @param liquidacion + * @throws DaoException + */ + private EstadoLiquidacion crearEstado(Liquidacion liquida, EstadoLiquidacionDTO estadoDto, + EstadoLiquidacion previo, boolean saltoFlujo, int tipoAccion) throws DaoException { + EstadoLiquidacion estado = new EstadoLiquidacion(); + DetalleCatalogo est = new DetalleCatalogo(); + + if (tipoAccion == GUARDA) { //TODO: Avanza estado + if (liquida.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()) + && previo.getDetEstado().getDetNemonico().equals(EstadoLiquidacionEnum.ESTLI.name()) && !saltoFlujo) { + est = EstadoLiquidacionEnum.ESTLIC.getDetalle(); + } else { + est = EstadoLiquidacionEnum.getSiguiente(previo.getDetEstado().getDetCodigo(), true); + } + } else if (tipoAccion == ACTUALIZA) {//TODO: Retroceder estado, siempre retrocede al usuario previo + if (liquida.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()) + && previo.getDetEstado().getDetNemonico().equals(EstadoLiquidacionEnum.ESTLIC.name()) && !saltoFlujo) { + est = EstadoLiquidacionEnum.ESTLI.getDetalle(); + } else { + est = EstadoLiquidacionEnum.getSiguiente(previo.getDetEstado().getDetCodigo(), false); + } + if (est != null && est.getDetNemonico().equalsIgnoreCase(EstadoLiquidacionEnum.ESTALI.name())) { + estado.setUsuCodigo(this.dominioUtil.getTitularLiquidacion(liquida.getLiqCodigo())); + } + } else if (tipoAccion == CANCELA) { + est = EstadoLiquidacionEnum.ESTCAN.getDetalle(); + estado.setUsuCodigo(previo.getUsuCodigo()); + } else { + throw new DaoException("Especificar si desea avanzar o retroceder de estado"); + } + for (EstadoLiquidacion esli : liquida.getEstadoLiquidacionCollection()) { + if (esli.getDetEstado().getDetNemonico().equals(est.getDetNemonico())) { + estado.setUsuCodigo(esli.getUsuCodigo()); + } + } + if (estado.getUsuCodigo() == null || estado.getUsuCodigo().getUsuCodigo() == null) { + EstadoLiquidacionEnum enu = EstadoLiquidacionEnum.valueOf(est.getDetNemonico()); + System.out.println("No hay usuario, vamos a obtener el generico " + enu); + estado.setUsuCodigo(enu.getUsuarioGenerico()); + } + estado.setDetEstado(est); + estado.setEslFechaInicio(new Date()); + estado.setEslEstado(DominioConstantes.ACTIVO); + estado.setEslMensaje(estadoDto.getEslMensaje()); + estado.setLiqCodigo(liquida); + return estado; + } + + public HashMap obtenerTodosDocumentosLiquidacion(Integer liqCodigo) throws DaoException, DominioExcepcion{ + DaoGenerico daoliq = new DaoGenerico<>(Liquidacion.class); + DaoGenerico daodoc = new DaoGenerico<>(Documento.class); + HashMap result = new HashMap<>(); + Liquidacion liquidacion = daoliq.buscarUnico(new Liquidacion(liqCodigo)); + //List result = new ArrayList<>(); + if(liquidacion == null){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "No se encontro la liquidacion para el codigo enviado"); + } + Documento documentoPlantilla = new Documento(); + documentoPlantilla.setDocEstado(DominioConstantes.ACTIVO); + documentoPlantilla.setLiqCodigo(liquidacion); + List lstDocumentos = daodoc.buscarLista(documentoPlantilla); + if(lstDocumentos == null || lstDocumentos.isEmpty()){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + String.format("No se ha encontrado documentos para la liquidacion %s", liquidacion.getLiqNemonico())); + } + + File archivoZip = procesarZipLiquidacion(liquidacion, lstDocumentos); + result.put("nombre",archivoZip.getName()); + result.put("documento",dominioUtil.getArchivo(archivoZip.getAbsolutePath())); + + archivoZip.delete(); + return result; + } + + private File procesarZipLiquidacion(Liquidacion liquidacion, List lstDocumentos){ + String url = DetalleCatalogoEnum.URLLIQ.getDetalle().getDetOrigen(); + Documento primero = lstDocumentos.get(0); + String nemonico = liquidacion.getLiqNemonico(); + String urlTmp = String.format("tmp", nemonico); + + String folderPrimero = primero.getDocUrl(); + String folderAnio[] = folderPrimero.split("/".concat(primero.getDocNombre())); + String folderArchivoPosible = folderAnio[0]; + File zip = dominioUtil.crearZip(folderArchivoPosible, liquidacion.getLiqNemonico().concat(".zip"), true); + // /data/wmp/liquidacion/2020/LQ0000000080/img076.pdf + + return zip; + } + + /** + * + * @param liquidacion + */ + private List crearDocumentos(Liquidacion liquida, LiquidacionDTO liquidacion) throws DaoException { + List documentos = new ArrayList<>(); + if (liquidacion.getDocumentos() != null) { + for (DocumentoDTO doc : liquidacion.getDocumentos()) { + Documento dcto = (Documento) dominioUtil.getEntidad(EntidadEnum.Documento.getMapper(), doc); + dcto.setDetTipo(DetalleCatalogoEnum.HABIL.getDetalle()); + dcto.setDocEstado(DominioConstantes.ACTIVO); + dcto.setLiqCodigo(liquida); + dcto.setPolCodigo(liquida.getPolCodigo()); + String url = this.grabaDocumento(doc, liquida.getLiqNemonico()); + dcto.setDocUrl(url); + documentos.add(dcto); + } + } + return documentos; + } + + /** + * + * @param doc + * @param contrato + * @param liquidacion + * @return + */ + private String grabaDocumento(DocumentoDTO doc, String liquidacion) { + String url = DetalleCatalogoEnum.URLLIQ.getDetalle().getDetOrigen(); + int year = Calendar.getInstance().get(Calendar.YEAR); + url = String.format(url, "" + year, liquidacion); + File file = new File(url); + try { + file.mkdirs(); + url = url.concat(doc.getDocNombre()); + FileOutputStream writer; + writer = new FileOutputStream(new File(url)); + writer.write(doc.getData()); + writer.close(); + } catch (IOException | NullPointerException ex) { + url = null; + } + return url; + } + + /** + * + * @param detalleDTO + * @return + * @throws DaoException + */ + private List crearTarifas(DetalleLiquidacionDTO detalleDTO, DetalleLiquidacion detalle) { + List data = new ArrayList<>(); + for (TarifaLiquidacionDTO tarDto : detalleDTO.getDetalle()) { + TarifaLiquidacion tarifa = (TarifaLiquidacion) dominioUtil.getEntidad(EntidadEnum.TarifaLiquidacion.getMapper(), tarDto); + tarifa.setDelCodigo(detalle); + data.add(tarifa); + } + System.out.println("=========> TARIFAS " + data); + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/NotificadorUtil.java b/src/main/java/com/qsoft/erp/dominio/util/NotificadorUtil.java new file mode 100644 index 0000000..e730944 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/NotificadorUtil.java @@ -0,0 +1,687 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.ParametroEnum; +import com.qsoft.erp.constantes.PlantillaEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.EmailMapper; +import com.qsoft.erp.dto.EmailDTO; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Email; +import com.qsoft.erp.model.EstadoLiquidacion; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.Plantilla; +import com.qsoft.erp.model.PlantillaSmtp; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Telefono; +import com.qsoft.erp.model.Usuario; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import javax.annotation.PostConstruct; +import javax.ejb.Asynchronous; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import org.apache.commons.lang3.math.NumberUtils; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import com.qsoft.erp.model.PersonaPoliza; +import java.util.Date; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author james + */ +@Stateless +public class NotificadorUtil { + + @EJB + private DominioUtil dominioUtil; + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRED) + public List notificar(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + EmailDTO emailDTO = (EmailDTO) this.dominioUtil.crearObjeto(EmailDTO.class, ent); + Email n = crudNotificacion(header, emailDTO, tipoAccion); + data.add(n); + } + return data; + } + + /** + * + * @param header + * @param emailDTO + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public Email crudNotificacion(HeaderMS header, EmailDTO emailDTO, int tipoAccion) throws DominioExcepcion{ + DaoGenerico daonot = new DaoGenerico<>(Email.class); + Email result; + result = EmailMapper.INSTANCE.getEntidad(emailDTO); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + result.setParEstado(ParametroEnum.REG.getParametro()); + result.setEmaIntento(DominioConstantes.INACTIVO); + daonot.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + result = daonot.actualizar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param usuario + * @param poliza + * @param password + * @throws com.qsoft.dao.exception.DaoException + */ + public void notificarBienvenida(Usuario usuario, Poliza poliza, String password) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + DaoGenerico daoPer = new DaoGenerico<>(Persona.class); + + Plantilla plantilla = PlantillaEnum.NOTCAR.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Persona persona = null; + if(usuario.getUsuIdOrigen() ==null || usuario.getUsuIdOrigen().trim().equals("")){ + Persona plantillaPersona = new Persona(); + plantillaPersona.setPerIdentificacion(usuario.getUsuUsuario()); + persona = daoPer.buscarUnico(plantillaPersona); + }else{ + persona = this.getPersona(usuario); + + } + Map parametros = getParametrosBienvenida(plantilla, persona, poliza, password); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion("NOTIFICACION DE BENVENIDA"); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + public void notificarBienvenida(Usuario usuario, Poliza poliza, String password, Persona persona) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTCAR.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosBienvenida(plantilla, persona, poliza, password); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion("NOTIFICACION DE BENVENIDA"); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + public void notificarMora(PersonaPoliza personaPoliza, Integer nMeses, Double valor) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + Plantilla plantilla = PlantillaEnum.NOTPOM.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosPolizaMora(plantilla, personaPoliza, nMeses, valor); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(personaPoliza.getPerCodigo().getPerMail()); + + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion("NOTIFICACION DE MORA"); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + if(!buscarNotificacionPoliza(plantilla.getPlaAsunto(), mail.getEmaAdjunto(), daoMail)){ + daoMail.guardar(mail); + } + + } + public boolean buscarNotificacionPoliza(String asunto, String emaContenido, DaoGenerico daoMail) throws DaoException{ + Email notificacion = new Email(); + notificacion.setEmaAsunto(asunto); + notificacion.setEmaContenido(emaContenido); + notificacion.setParEstado(ParametroEnum.ENV.getParametro()); + boolean retornar = false; + Email correoOriginal = daoMail.buscarUnico(notificacion); + if(correoOriginal != null){ + String observacion = correoOriginal.getEmaObservacion(); + if(observacion != null && observacion.contains(":")){ + String []fechaObservacion = observacion.split("T"); + String fechaActualString = DominioConstantes.FORMAT_OBS.format(new Date()); + if(fechaActualString.equals(fechaObservacion[0])){ + retornar = true; + } + } + } + return retornar; + + } + public void notificarAnulacion(PersonaPoliza personaPoliza, Integer nMeses, Double valor) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTANP.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosAnulacionPoliza(plantilla, personaPoliza, nMeses, valor); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(personaPoliza.getPerCodigo().getPerMail()); + + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion("NOTIFICACION DE ANULACION DE POLIZA"); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + if(!buscarNotificacionPoliza(plantilla.getPlaAsunto(), mail.getEmaAdjunto(), daoMail)){ + daoMail.guardar(mail); + } + + } + /** + * + * @param usuario + * @throws com.qsoft.dao.exception.DaoException + */ + public void notificarReset(Usuario usuario) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTRES.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosResetPassword(plantilla, usuario); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion(plantilla.getPlaAsunto()); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + + /** + * + * @param usuario + * @param poliza + * @throws com.qsoft.dao.exception.DaoException + */ + public void notificarBienvenida(Usuario usuario, Poliza poliza) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTPOL.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosBienvenida(plantilla, this.getPersona(usuario), poliza); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion(plantilla.getPlaAsunto()); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + mail.setEmaAdjunto(poliza.getPolObservacion()); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + + @Asynchronous + public void enviarMensajeBienvenida(Usuario usuario, Poliza poliza, String pass) throws DaoException, MalformedURLException, IOException { + URL url; + Plantilla smsApo = PlantillaEnum.SMSAPO.getPlantilla(); + + String formatoMensaje = smsApo.getPlaParametros(); + Persona persona = getPersona(usuario); + + String message = String.format(formatoMensaje, + poliza.getPlaCodigo().getPlaNombre(), + usuario.getUsuUsuario(), + pass + ); + + for (Telefono phoneNumber : persona.getTelefonoCollection()) { + if (phoneNumber.getDetTipo().getDetNemonico().equals("MOVIL")) { + + String urlString = String.format(smsApo.getPlaRuta(), phoneNumber.getTelNumero(), message.replaceAll(" ", "+")); + url = new URL(urlString); + URLConnection con = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String linea; + while ((linea = in.readLine()) != null) { + System.out.println(linea); + } + } + + } + + } + + /** + * + * @param usuario + * @param otp + * @throws com.qsoft.dao.exception.DaoException + */ + public void notificarOTP(Usuario usuario, String otp) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTOTP.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosOTP(plantilla, this.getPersona(usuario), otp); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion(plantilla.getPlaAsunto()); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + + /** + * + * @param usuario + * @param liquidacion + * @throws com.qsoft.dao.exception.DaoException + */ + @Asynchronous + public void notificarLiquidacion(Usuario usuario, Liquidacion liquidacion) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTLQG.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + + Map parametros = getParametrosLiquidacion(plantilla, this.getPersona(usuario), liquidacion); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaDestinatiario(usuario.getUsuEmail()); + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion(plantilla.getPlaAsunto()); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + + /** + * + * @param usuario + * @return + */ + private Persona getPersona(Usuario usuario) throws DaoException { + DaoGenerico daoPers = new DaoGenerico<>(Persona.class); + Persona persona = daoPers.cargar(NumberUtils.createInteger(usuario.getUsuIdOrigen())); + return persona; + } + + /** + * + * @param usuario + * @param estado + * @param liquidacion + * @throws com.qsoft.dao.exception.DaoException + */ + @Asynchronous + public void notificarEstadoLiquidacion(Liquidacion liquidacion, Usuario usuario, EstadoLiquidacion estado) throws DaoException { + DaoGenerico daoMail = new DaoGenerico<>(Email.class); + DaoGenerico daoPlsmt = new DaoGenerico<>(PlantillaSmtp.class); + + Plantilla plantilla = PlantillaEnum.NOTLQO.getPlantilla(); + Email mail = new Email(); + mail.setEmaAsunto(plantilla.getPlaAsunto()); + ObjectMapper obj = new ObjectMapper(); + Map parametros = getParametrosEstadoLiquida(plantilla, liquidacion, this.getPersona(usuario), estado); + try { + String jsonStr = obj.writeValueAsString(parametros); + mail.setEmaContenido(jsonStr); + } catch (JsonProcessingException ex) { + ex.printStackTrace(System.err); + } + mail.setEmaAdjunto(liquidacion.getLiqReporte()); + mail.setEmaDestinatiario(usuario.getUsuEmail()); + mail.setEmaCopiaOculta(DetalleCatalogoEnum.COPMAI.getDetalle().getDetOrigen()); + mail.setEmaObservacion(plantilla.getPlaAsunto()); + mail.setParEstado(ParametroEnum.REG.getParametro()); + mail.setEmaIntento(DominioConstantes.INACTIVO); + PlantillaSmtp psm = new PlantillaSmtp(); + psm.setPlaCodigo(plantilla); + psm = daoPlsmt.buscarUnico(psm); + mail.setPlsmCodigo(psm); + daoMail.guardar(mail); + + } + + + /** + * + * @param plantilla + * @param persona + * @return + */ + private Map getParametrosBienvenida(Plantilla plantilla, Persona persona, Poliza poliza, String password) { + //{"[ASUNTO]":"","[CLIENTE]":"","[COBERTURA]":"","[COMPROBANTE]":"","[EMAIL]":"","[EMISOR]":"","[EMISOR_MAIL]":"","[EMISOR_WEB] ":"","[FECHAEMI]":"","[IDENTIFICACION]":"","[MONTO]":"","[NUMDOC]":"","[PLAN]":""} + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[COMPROBANTE]", DominioConstantes.POLIZA); + parametros.put("[IDENTIFICACION]", persona.getPerIdentificacion()); + parametros.put("[CLIENTE]", persona.getPerNombres() + " " + persona.getPerApellidos()); + parametros.put("[NUMDOC]", poliza.getPolContrato()); + parametros.put("[FECHAEMI]", DominioConstantes.getDateTime(poliza.getPolFechaInicio())); + parametros.put("[COBERTURA]", "" + poliza.getPlaCodigo().getPlaCoberturaMaxima()); + parametros.put("[PLAN]", "" + poliza.getPlaCodigo().getPlaNombre()); + parametros.put("[PASSWORD]", password); + parametros.put("[EMAIL]", persona.getPerMail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + + return parametros; + } + private Map getParametrosAnulacionPoliza(Plantilla plantilla, PersonaPoliza personaPoliza,Integer nMeses, Double valor) { + //{"[ASUNTO]":"","[CLIENTE]":"","[COBERTURA]":"","[COMPROBANTE]":"","[EMAIL]":"","[EMISOR]":"","[EMISOR_MAIL]":"","[EMISOR_WEB] ":"","[FECHAEMI]":"","[IDENTIFICACION]":"","[MONTO]":"","[NUMDOC]":"","[PLAN]":""} + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[COMPROBANTE]", DominioConstantes.POLIZA); + parametros.put("[POLIZA]", personaPoliza.getPolCodigo().getPolContrato()); + parametros.put("[NMESES]", nMeses.toString()); + parametros.put("[VALOR]", valor.toString()); + parametros.put("[IDENTIFICACION]", personaPoliza.getPerCodigo().getPerIdentificacion()); + parametros.put("[CLIENTE]", personaPoliza.getPerCodigo().getPerNombres() + " " + personaPoliza.getPerCodigo().getPerApellidos()); + parametros.put("[NUMDOC]", personaPoliza.getPolCodigo().getPolContrato()); + parametros.put("[FECHAEMI]", DominioConstantes.getDateTime(personaPoliza.getPolCodigo().getPolFechaInicio())); + parametros.put("[COBERTURA]", "" + personaPoliza.getPolCodigo().getPlaCodigo().getPlaCoberturaMaxima()); + parametros.put("[PLAN]", "" + personaPoliza.getPolCodigo().getPlaCodigo().getPlaNombre()); + parametros.put("[EMAIL]", personaPoliza.getPerCodigo().getPerMail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + + return parametros; + } + + private Map getParametrosPolizaMora(Plantilla plantilla,PersonaPoliza personaPoliza,Integer nMeses, Double valor) { + //{"[ASUNTO]":"","[CLIENTE]":"","[COBERTURA]":"","[COMPROBANTE]":"","[EMAIL]":"","[EMISOR]":"","[EMISOR_MAIL]":"","[EMISOR_WEB] ":"","[FECHAEMI]":"","[IDENTIFICACION]":"","[MONTO]":"","[NUMDOC]":"","[PLAN]":""} + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[NMESES]", nMeses.toString()); + parametros.put("[VALOR]", valor.toString()); + parametros.put("[POLIZA]", personaPoliza.getPolCodigo().getPolContrato()); + parametros.put("[MESESTOPE]", DominioConstantes.TOPE_MESES_MORA.toString()); + parametros.put("[EMAIL]", personaPoliza.getPerCodigo().getPerMail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + + return parametros; + } + /** + * + * @param plantilla + * @param usuario + * @return + */ + private Map getParametrosBienvenida(Plantilla plantilla, Persona persona, Poliza poliza) { + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[COMPROBANTE]", DominioConstantes.POLIZA); + parametros.put("[IDENTIFICACION]", persona.getPerIdentificacion()); + parametros.put("[CLIENTE]", persona.getPerNombres() + " " + persona.getPerApellidos()); + parametros.put("[NUMDOC]", poliza.getPolContrato()); + parametros.put("[FECHAEMI]", DominioConstantes.getDateTime(poliza.getPolFechaInicio())); + parametros.put("[COBERTURA]", "" + poliza.getPlaCodigo().getPlaCoberturaMaxima()); + parametros.put("[PLAN]", "" + poliza.getPlaCodigo().getPlaNombre()); + parametros.put("[EMAIL]", persona.getPerMail()); + parametros.put("[ADJUNTO]", poliza.getPlaCodigo().getPlaRutaContrato()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + + return parametros; + } + + /** + * + * @param plantilla + * @param persona + * @return + */ + private Map getParametrosLiquidacion(Plantilla plantilla, Persona persona, Liquidacion liquidacion) { + Map parametros = new TreeMap<>(); + //{"[ASUNTO]":"","[LIQUIDACION]":"","[IDENTIFICACION]":"","[CLIENTE]":"","[NUMDOC]":"","[FECHAEMI]":"","[PLAN]":"","[EMAIL]":"","[EMISOR]":"","[EMISOR_MAIL]":""} + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[LIQUIDACION]", liquidacion.getLiqNemonico()); + parametros.put("[IDENTIFICACION]", persona.getPerIdentificacion()); + parametros.put("[CLIENTE]", persona.getPerNombres() + " " + persona.getPerApellidos()); + parametros.put("[NUMDOC]", liquidacion.getLiqNemonico()); + parametros.put("[FECHAEMI]", DominioConstantes.getDateTime(liquidacion.getLiqFechaRegistro())); + parametros.put("[PLAN]", "" + liquidacion.getPolCodigo().getPlaCodigo().getPlaNombre()); + parametros.put("[EMAIL]", persona.getPerMail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + + return parametros; + } + + /** + * + * @param plantilla + * @param persona + * @return + */ + private Map getParametrosEstadoLiquida(Plantilla plantilla, Liquidacion liquidacion, Persona persona, EstadoLiquidacion estado) { + //{"[ASUNTO]":"","[CLIENTE]":"","[LIQUIDACION]":"","[ESTADO]":"","[MENSAJE]":"","[IDENTIFICACION]":"","[FECHA]":"","[EMAIL]":"","[EMISOR]":"","[EMISOR_WEB]":"","[EMISOR_MAIL]":""} + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + parametros.put("[CLIENTE]", liquidacion.getPerBeneficiario().getPerNombres() + " " + liquidacion.getPerBeneficiario().getPerApellidos()); + parametros.put("[LIQUIDACION]", liquidacion.getLiqNemonico()); + parametros.put("[ESTADO]", estado.getDetEstado().getDetNombre()); + parametros.put("[MENSAJE]", estado.getEslMensaje()); + parametros.put("[IDENTIFICACION]", persona.getPerIdentificacion()); + parametros.put("[FECHA]", DominioConstantes.getDateTime(estado.getEslFechaInicio())); + parametros.put("[EMAIL]", persona.getPerMail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + return parametros; + } + + /** + * + * @param plantilla + * @param usuario + * @return + */ + private Map getParametrosResetPassword(Plantilla plantilla, Usuario usuario) { + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + DetalleCatalogo url = DetalleCatalogoEnum.URLPAS.getDetalle(); + parametros.put("[CAMBIO_CLAVE]", url.getDetOrigen().replace(DominioConstantes.PARAMETRO_URL, usuario.getUsuToken())); + parametros.put("[EMAIL]", usuario.getUsuEmail()); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + parametros.put("[FECHA]", DominioConstantes.getDateTime()); + return parametros; + } + + /** + * + * @param plantilla + * @param usuario + * @return + */ + private Map getParametrosOTP(Plantilla plantilla, Persona persona, String otp) { + Map parametros = new TreeMap<>(); + parametros.put("[ASUNTO]", plantilla.getPlaAsunto()); + DetalleCatalogo url = DetalleCatalogoEnum.URLPAS.getDetalle(); + parametros.put("[CLIENTE]", persona.getPerNombres() + " " + persona.getPerApellidos()); + parametros.put("[EMAIL]", persona.getPerMail()); + parametros.put("[IDENTIFICACION]", persona.getPerIdentificacion()); + parametros.put("[NUMOTP]", otp); + parametros.put("[EMISOR]", DominioConstantes.CARIDEL); + parametros.put("[EMISOR_MAIL]", DominioConstantes.MAIL_CARIDEL); + parametros.put("[EMISOR_WEB]", DominioConstantes.URL_CARIDEL); + parametros.put("[FECHA]", DominioConstantes.getDateTime()); + + return parametros; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/OTPUtil.java b/src/main/java/com/qsoft/erp/dominio/util/OTPUtil.java new file mode 100644 index 0000000..a6f5ad8 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/OTPUtil.java @@ -0,0 +1,99 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.otp.OTP; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.ParametroEnum; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Otp; +import com.qsoft.erp.model.Parametro; +import com.qsoft.erp.model.Usuario; +import java.util.Calendar; +import java.util.Date; +import java.util.UUID; +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; + +/** + * + * @author james + */ +@Stateless +public class OTPUtil { + + @PostConstruct + public void postConstructor() { + } + + public Otp validarOtp(Usuario usuario, String otpCodigo) { + DaoGenerico otpDao = new DaoGenerico<>(Otp.class); + + Otp otp = new Otp(); + String uuid = UUID.nameUUIDFromBytes(usuario.getUsuUsuario().getBytes()).toString().replace("-", ""); + otp.setOptUuid(uuid); + otp.setOptValor(otpCodigo); + try { + Calendar cal = Calendar.getInstance(); + for (Otp o : otpDao.buscarLista(otp)) { + cal.setTime(o.getOtpFechaRegistro()); + cal.add(Calendar.SECOND, o.getOtpTiempoVida()); + if (cal.getTimeInMillis() >= System.currentTimeMillis()) { + otp = o; + break; + } else { + o.setOtpFechaValidacion(new Date()); + o.setParEstado(new Parametro(ParametroEnum.OTPCAD.getCodigo())); + otpDao.guardar(o); + } + } + if (otp != null && otp.getOtpCodigo() != null) { + otp.setOtpFechaValidacion(new Date()); + otp.setParEstado(new Parametro(ParametroEnum.OPTOK.getCodigo())); + otpDao.guardar(otp); + } + } catch (DaoException ex) { + otp = null; + } + + return otp; + } + + /** + * Genera y registra en BDD una OTP + * + * @param usuario + * @param tipoOtp + * @return + */ + public Otp generarOtp(Usuario usuario, ParametroEnum tipoOtp) { + DaoGenerico otpDao = new DaoGenerico<>(Otp.class); + + Parametro param = tipoOtp.getParametro(); + Integer longitud = Integer.parseInt(param.getParDescripcion()); + Integer vida = Integer.parseInt(param.getParValor()); + String uuid = UUID.nameUUIDFromBytes(usuario.getUsuUsuario().getBytes()).toString().replace("-", ""); + String valorOtp = OTP.generate("" + uuid, "" + System.nanoTime(), longitud, OTP.TOTP); + Otp otp = new Otp(); + otp.setOptUuid(uuid); + otp.setOptValor(valorOtp); + otp.setOtpFechaRegistro(new Date()); + otp.setOtpIntentos(0); + otp.setOtpMaxIntentos(DominioConstantes.REINTENTOS_OTP); + otp.setOtpTiempoVida(vida); + otp.setParEstado(new Parametro(ParametroEnum.OTPGEN.getCodigo())); + otp.setParTipo(new Parametro(tipoOtp.getCodigo())); + try { + otpDao.guardar(otp); + } catch (DaoException ex) { + System.out.println("ERROR registrando OTP " + ex); + otp = null; + } + return otp; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/ParametroUtil.java b/src/main/java/com/qsoft/erp/dominio/util/ParametroUtil.java new file mode 100644 index 0000000..c2b29d9 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/ParametroUtil.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.dao.util.Fila; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Parametro; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; + +/** + * + * @author christian + */ +@Stateless +public class ParametroUtil { + + @PostConstruct + public void postConstruct() { + + } + public List ejecutarConsulta(String nemonicoParametro) throws DaoException{ + DaoGenerico dao = new DaoGenerico<>(Parametro.class); + Parametro plantillaQuery = new Parametro(); + plantillaQuery.setParNemonico(nemonicoParametro); + plantillaQuery.setParEstado(DominioConstantes.ACTIVO); + Parametro parQuery = dao.buscarUnico(plantillaQuery); + if(parQuery == null){ + System.err.println("QUERY ".concat(nemonicoParametro).concat(" no existente")); + } + + return dao.ejecutarConsultaNativaList(parQuery.getParValor()); + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/PersonaUtil.java b/src/main/java/com/qsoft/erp/dominio/util/PersonaUtil.java new file mode 100644 index 0000000..ebdd548 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/PersonaUtil.java @@ -0,0 +1,515 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.PersonaMapper; +import com.qsoft.erp.dto.PersonaDTO; +import com.qsoft.erp.dto.TelefonoDTO; +import com.qsoft.erp.model.Persona; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; + +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import com.qsoft.erp.dominio.mapper.CuentaBancariaMapper; +import com.qsoft.erp.dominio.mapper.PersonaPolizaMapper; +import com.qsoft.erp.dominio.mapper.TelefonoMapper; +import com.qsoft.erp.dto.CuentaBancariaDTO; +import com.qsoft.erp.dto.PersonaPolizaDTO; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Localizacion; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Telefono; +import com.qsoft.erp.model.Usuario; +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author james + */ +@Stateless +public class PersonaUtil { + + @EJB + private DominioUtil dominioUtil; + @EJB + private CatalogoUtil catalogoUtil; + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRED) + public List crearPersonaPoliza(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + PersonaPoliza personaPoliza = (PersonaPoliza) dominioUtil.getEntidad( + PersonaPolizaMapper.class, dominioUtil.crearObjeto(PersonaPolizaDTO.class, ent)); + PersonaPoliza result = null; + try { + Persona persona = personaPoliza.getPerCodigo(); + if (Objects.equals(DetalleCatalogoEnum.CED.getDetalle().getDetCodigo(), persona.getDetTipoIdentificacion().getDetCodigo())) { + if (!this.dominioUtil.validarCedula(persona.getPerIdentificacion())) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula no cumple la validacion de d\u00edgito autoverificador<--\n"); + } + } + LocalDate fin = Instant.ofEpochMilli(new Date().getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate ini = Instant.ofEpochMilli(persona.getPerFechaNacimiento().getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); + if (ChronoUnit.YEARS.between(ini, fin) >= 71) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "El beneficiario excede el limite maximo de edad de cobertura"); + } + + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + Poliza poliza = daopol.cargar(personaPoliza.getPolCodigo().getPolCodigo()); + Persona pers = new Persona(); + pers.setPerIdentificacion(persona.getPerIdentificacion()); + pers.setDetTipoIdentificacion(persona.getDetTipoIdentificacion()); + if (daoper.contarExistencias(pers) > 0) { + result = this.actualizarBeneficiario(personaPoliza, pers, persona, poliza); + } else { + pers = persona; + pers.setPerEstado(DominioConstantes.ACTIVO); + pers.setPerFechaRegistro(new Date()); + pers.setPersonaPolizaCollection(new ArrayList<>()); + result = this.crearPersonaPoliza(persona, poliza, personaPoliza.getDetTipoPersona()); + pers.getPersonaPolizaCollection().add(result); + daoper.guardar(pers); + } + data.add(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + System.out.println("========> RETORNAR PERSONA POLIZA " + result); + + } + return data; + } + + /** + * + * @param dto + * @param nueva + * @param persona + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + private PersonaPoliza actualizarBeneficiario(PersonaPoliza dto, Persona nueva, Persona persona, Poliza poliza) throws DominioExcepcion, DaoException { + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico daoppol = new DaoGenerico<>(PersonaPoliza.class); + nueva = daoper.buscarUnico(nueva); + + PersonaPoliza aux = new PersonaPoliza(); + aux.setPerCodigo(nueva); + aux.setPepEstado(DominioConstantes.ACTIVO); + if (daoppol.contarExistencias(aux) > 0) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, + "Error la persona ya esta registrada como beneficiario de una poliza"); + } + nueva.setPerApellidos(persona.getPerApellidos()); + nueva.setPerNombres(persona.getPerNombres()); + nueva.setPerFechaNacimiento(persona.getPerFechaNacimiento()); + nueva.setDetGenero(persona.getDetGenero()); + nueva.setPerNacionalidad(persona.getPerNacionalidad()); + nueva.setPerMail(persona.getPerMail()); + nueva.setPerDireccion(persona.getPerDireccion()); + nueva.setPerEstado(DominioConstantes.ACTIVO); + daoper.actualizar(nueva); + + aux = this.crearPersonaPoliza(nueva, poliza, dto.getDetTipoPersona()); + daoppol.guardar(aux); + + return aux; + } + + /** + * + * @param persona + * @param poliza + * @param tipo + * @return + */ + private PersonaPoliza crearPersonaPoliza(Persona persona, Poliza poliza, DetalleCatalogo tipo) { + PersonaPoliza personaPoliza = new PersonaPoliza(); + personaPoliza.setPolCodigo(poliza); + personaPoliza.setPerCodigo(persona); + personaPoliza.setDetTipoPersona(tipo); + personaPoliza.setPepEstado(DominioConstantes.ACTIVO); + personaPoliza.setPepMontoCobertura(poliza.getPlaCodigo().getPlaCoberturaMaxima()); + return personaPoliza; + } + + /** + * Permite registrar la persona con los telefonos + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarPersona(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + PersonaDTO persona = (PersonaDTO) dominioUtil.crearObjeto(PersonaDTO.class, ent); + List lista = new ArrayList<>(); + List listaCuentasBancaris = new ArrayList<>(); + + ObjectMapper maper = new ObjectMapper(); + maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); + if (ent.containsKey("telefono")) { + System.out.println("========> OK TELEFONOS " + ent.get("telefono")); + for (Object row : (List) ent.get("telefono")) { + TelefonoDTO col = (TelefonoDTO) dominioUtil.crearObjeto(TelefonoDTO.class, (Map) row); + lista.add(col); + } + } + + if (ent.containsKey("cuentasBancarias")) { + System.out.println("========> OK CUENTAS BANCARIAS " + ent.get("cuentasBancarias")); + for (Object row : (List) ent.get("cuentasBancarias")) { + CuentaBancariaDTO col = (CuentaBancariaDTO) dominioUtil.crearObjeto(CuentaBancariaDTO.class, (Map) row); + listaCuentasBancaris.add(col); + } + } + persona.setCuentasBancarias(listaCuentasBancaris); + persona.setTelefono(lista); + Persona result = crudPersona(persona, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param persona + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private Persona generarPersona(PersonaDTO persona) throws DominioExcepcion{ + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + + Persona result = PersonaMapper.INSTANCE.getEntidad(persona); + try { + result.setTelefonoCollection(this.crearTelefonos(persona, result)); + result.setCuentaBancariaCollection(this.crearCuentasBancarias(persona, result)); + + + daoper.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + return result; + } + @Transactional(Transactional.TxType.REQUIRED) + private Persona crudPersona(PersonaDTO persona, int tipoAccion) throws DominioExcepcion { + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + Persona result; + result = PersonaMapper.INSTANCE.getEntidad(persona); + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + if (Objects.equals(DetalleCatalogoEnum.CED.getDetalle().getDetCodigo(), result.getDetTipoIdentificacion().getDetCodigo())) { + if (!this.dominioUtil.validarCedula(result.getPerIdentificacion())) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula no cumple la validación de d\u00edgito autoverificador<--\n"); + } + } + if (this.validarIndice(daoper, result.getDetTipoIdentificacion(), result.getPerIdentificacion())) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, "Error, ya existe una persona " + + "con la identificación y tipo de identificación ingresada"); + } + result.setPerFechaRegistro(new Date()); + result.setPerEstado(DominioConstantes.ACTIVO); + result.setTelefonoCollection(this.crearTelefonos(persona, result)); + result.setCuentaBancariaCollection(this.crearCuentasBancarias(persona, result)); + + daoper.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + result = this.actualizarPersona(daoper, result, persona); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param daoper + * @param result + * @return + * @throws DominioExcepcion + */ + private Persona actualizarPersona(DaoGenerico daoper, Persona result, PersonaDTO persona) throws DominioExcepcion, DaoException { + DaoGenerico daotel = new DaoGenerico<>(Telefono.class); + DaoGenerico daousu = new DaoGenerico<>(Usuario.class); + DaoGenerico daocueban = new DaoGenerico<>(CuentaBancaria.class); + + if (Objects.equals(DetalleCatalogoEnum.CED.getDetalle().getDetCodigo(), result.getDetTipoIdentificacion().getDetCodigo())) { + if (!this.dominioUtil.validarCedula(result.getPerIdentificacion())) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula no cumple la validacion de d\u00edgito autoverificador<--\n"); + } + } + result.setTelefonoCollection(this.crearTelefonos(persona, result)); + for (Telefono telf : result.getTelefonoCollection()) { + if (telf.getTelCodigo() != null) { + daotel.actualizar(telf); + } else { + daotel.guardar(telf); + } + } + result.setCuentaBancariaCollection(this.crearCuentasBancarias(persona, result)); + for (CuentaBancaria cuenBan : result.getCuentaBancariaCollection()) { + if (cuenBan.getCueCodigo() != null) { + System.out.println("ACTUALIZAR CUENTA " + cuenBan.getCueEstado() + " > " + cuenBan.getCueCodigo()); + daocueban.actualizar(cuenBan); + } else { + System.out.println("GUARDAR CUENTA " + cuenBan.getCueEstado() + " > " + cuenBan.getCueCuenta()); + daocueban.guardar(cuenBan); + } + } + Persona prev = daoper.cargar(persona.getPerCodigo()); + String iden = prev != null ? prev.getPerIdentificacion() : ""; + result = daoper.actualizar(result); + + Usuario usu = new Usuario(); + usu.setUsuOrigen(DominioConstantes.PERSONA); + usu.setUsuIdOrigen("" + result.getPerCodigo()); + usu.setUsuUsuario(iden); + usu.setUsuEstado(DominioConstantes.ACTIVO); + usu = daousu.buscarUnico(usu); ///Que pasa si tiene mas de un usuario?? + if (usu != null && usu.getUsuCodigo() != null) { + usu.setUsuEmail(result.getPerMail()); + if (iden != null && !iden.equalsIgnoreCase(result.getPerIdentificacion())) { + for (PersonaPoliza perpol : result.getPersonaPolizaCollection()) { + if (perpol.getDetTipoPersona().getDetNemonico().equals(DetalleCatalogoEnum.PTITU.name()) + && !usu.getUsuUsuario().equals(result.getPerIdentificacion())) { + usu.setUsuUsuario(result.getPerIdentificacion()); + } + } + daousu.actualizar(usu); + } + } else { + + } + return result; + } + + /** + * + * @param daoper + * @param tipoID + * @param identificacion + * @return + * @throws DaoException + */ + private boolean validarIndice(DaoGenerico daoper, DetalleCatalogo tipoID, String identificacion) throws DaoException { + Persona verifi = new Persona(); + verifi.setPerIdentificacion(identificacion); + verifi.setDetTipoIdentificacion(tipoID); + return daoper.contarExistencias(verifi) > 0; + } + + /** + * + * @param personaDTO + * @return + * @throws DaoException + */ + private List crearTelefonos(PersonaDTO personaDTO, Persona persona) { + List data = new ArrayList<>(); + for (TelefonoDTO telf : personaDTO.getTelefono()) { + Telefono telefono = (Telefono) dominioUtil.getEntidad(EntidadEnum.Telefono.getMapper(), telf); + telefono.setPerCodigo(persona); + data.add(telefono); + } + return data; + } + + private List crearCuentasBancarias(PersonaDTO personaDTO, Persona persona) { + List data = new ArrayList<>(); + for (CuentaBancariaDTO cuen : personaDTO.getCuentasBancarias()) { + CuentaBancaria cuentaBancaria = (CuentaBancaria) dominioUtil.getEntidad(EntidadEnum.CuentaBancaria.getMapper(), cuen); + if (cuentaBancaria.getCueIdentificacion() == null || cuentaBancaria.getCueIdentificacion().isBlank()) { + cuentaBancaria.setCueIdentificacion(persona.getPerIdentificacion()); + } + if (cuentaBancaria.getCueNombreDebito() == null || cuentaBancaria.getCueNombreDebito().isBlank()) { + cuentaBancaria.setCueNombreDebito(persona.getPerNombres() + " " + persona.getPerApellidos()); + } + cuentaBancaria.setPerCodigo(persona); + data.add(cuentaBancaria); + } + return data; + } + @Transactional(Transactional.TxType.REQUIRES_NEW) + public Persona crearPersonaDTOCsv(String genero,String locCodigo, String tipoIdentificacion,String perIdentificacion, String perNombres, String perApellidos, String perMail, String fechaNacimiento, + String telefono,String detIfi,String detTipoCuenta, String cueIdentificacion, String cueCuenta, String cueNombreDebito, Short cueDebito, DaoGenerico daoper + , DaoGenerico daotel, DaoGenerico daocuen) throws DaoException, DominioExcepcion{ + PersonaDTO personaDTO = crearPersonaDTO(catalogoUtil.getDetallePorOrigenTipo(genero, "GENERO").getDetCodigo(), catalogoUtil.getDetallePorOrigenTipo(tipoIdentificacion, "IDENTIFICACION").getDetCodigo(), + locCodigo, perIdentificacion, perNombres, perApellidos, DominioConstantes.NACIONALIDAD, DominioConstantes.ACTUALIZAR, perMail, DominioConstantes.getDate(fechaNacimiento), null, null); + List lstTelefonos = new ArrayList<>(); + List lstCuentas = new ArrayList<>(); + + /**-------------------------------------------------telefono------------------------------------------------*/ + if(telefono != null){ + String []telefonos = telefono.split(","); + for (int i = 0; i < telefonos.length; i++) { + if(telefonos[i].length() == 10){ + lstTelefonos.add(crearTelefonoDTO(catalogoUtil.getDetallePorNemonico("MOVIL").getDetCodigo(), telefonos[i], DominioConstantes.DATO_MASIVO_POLIZA)); + }else if(telefonos[i].length() == 7 || (telefonos[i].length() == 9 && telefonos[i].startsWith("02"))){ + lstTelefonos.add(crearTelefonoDTO(catalogoUtil.getDetallePorNemonico("CASA").getDetCodigo(), telefonos[i], DominioConstantes.DATO_MASIVO_POLIZA)); + }else { + lstTelefonos.add(crearTelefonoDTO(catalogoUtil.getDetallePorNemonico("TELEF").getDetCodigo(), telefonos[i], DominioConstantes.DATO_MASIVO_POLIZA)); + } + + + } + } + /**-------------------------------------------------CuentaBancaria------------------------------------------------*/ + CuentaBancaria cB = null; + if(cueCuenta != null){ + if(cueCuenta.trim().equals("") || cueCuenta.equals("000") || cueCuenta.equals("0")){ + cueDebito = DominioConstantes.INACTIVO; + } + + lstCuentas.add(crearCuentaBancariaDTO(catalogoUtil.getDetallePorNemonico(detIfi).getDetCodigo() , catalogoUtil.getDetallePorOrigenTipo(detTipoCuenta, "TIPOCUEN").getDetCodigo(), cueIdentificacion, + cueCuenta, cueNombreDebito, cueDebito)); + } + + personaDTO.setTelefono(lstTelefonos); + personaDTO.setCuentasBancarias(lstCuentas); + Persona persona = generarPersona(personaDTO); + + return persona; + } + + public CuentaBancariaDTO crearCuentaBancariaDTO(Integer detIfi,Integer detTipoCuenta, String cueIdentificacion, String cueCuenta, String cueNombreDebito, Short cueDebito){ + CuentaBancariaDTO cuentaBancariaDTO = new CuentaBancariaDTO(); + cuentaBancariaDTO.setDetIfi(detIfi); + cuentaBancariaDTO.setDetTipoCuenta(detTipoCuenta); + cuentaBancariaDTO.setCueIdentificacion(cueIdentificacion); + cuentaBancariaDTO.setCueCuenta(cueCuenta); + cuentaBancariaDTO.setCueNombreDebito(cueNombreDebito); + cuentaBancariaDTO.setCueDebito(cueDebito); + cuentaBancariaDTO.setCueEstado(DominioConstantes.ACTIVO); + return cuentaBancariaDTO; + } + public TelefonoDTO crearTelefonoDTO(Integer detTipo,String telNumero, String telObservacion){ + TelefonoDTO telefonoDTO = new TelefonoDTO(); + telefonoDTO.setDetTipo(detTipo); + telefonoDTO.setTelNumero(telNumero); + telefonoDTO.setTelObservacion(telObservacion); + telefonoDTO.setTelEstado(DominioConstantes.ACTIVO); + return telefonoDTO; + } + + public Persona crearPersona(DetalleCatalogo detEstadoPoliza, DetalleCatalogo detGenero, DetalleCatalogo detTipoIdentificacion, Localizacion locCodigo, String perIdentificacion, + String perNombres, String perApellidos, String perNacionalidad, String perDireccion, String perMail, Date perFechaNacimiento,String perDinamico, Integer perIdOdo){ + + Persona persona = new Persona(); + persona.setDetEstadoPoliza(detEstadoPoliza); + persona.setDetGenero(detGenero); + persona.setDetTipoIdentificacion(detTipoIdentificacion); + persona.setLocCodigo(locCodigo); + persona.setPerIdentificacion(perIdentificacion); + persona.setPerNombres(perNombres); + persona.setPerApellidos(perApellidos); + persona.setPerNacionalidad(perNacionalidad); + persona.setPerDireccion(perDireccion); + persona.setPerMail(perMail); + persona.setPerFechaRegistro(new Date()); + persona.setPerFechaNacimiento(perFechaNacimiento); + persona.setPerDinamico(perDinamico); + persona.setPerIdOdo(perIdOdo); + persona.setPerEstado(DominioConstantes.ACTIVO); + return persona; + } + public PersonaDTO crearPersonaDTO(Integer detGenero, Integer detTipoIdentificacion,String locCodigo, String perIdentificacion, String perNombres, String perApellidos, String perNacionalidad, String perDireccion,String perMail, Date perFechaNacimiento, String perDinamico, Integer perIdOdo){ + PersonaDTO personaDTO = new PersonaDTO(); + personaDTO.setDetEstadoPoliza(catalogoUtil.getDetallePorNemonico("NOBK").getDetCodigo()); + personaDTO.setDetGenero(detGenero); + personaDTO.setDetTipoIdentificacion(detTipoIdentificacion); + personaDTO.setLocCodigo(locCodigo); + personaDTO.setPerIdentificacion(perIdentificacion); + personaDTO.setPerNombres(perNombres); + personaDTO.setPerApellidos(perApellidos); + personaDTO.setPerNacionalidad(perNacionalidad); + personaDTO.setPerDireccion(perDireccion); + personaDTO.setPerMail(perMail); + personaDTO.setPerFechaRegistro(new Date()); + personaDTO.setPerFechaNacimiento(perFechaNacimiento); + personaDTO.setPerDinamico(perDinamico); + personaDTO.setPerIdOdo(perIdOdo); + personaDTO.setPerEstado(DominioConstantes.ACTIVO); + return personaDTO; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/PlanUtil.java b/src/main/java/com/qsoft/erp/dominio/util/PlanUtil.java new file mode 100644 index 0000000..ddf1823 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/PlanUtil.java @@ -0,0 +1,335 @@ +package com.qsoft.erp.dominio.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.constantes.EntidadEnum; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dto.PersonaDTO; +import com.qsoft.erp.model.Persona; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; + +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CONSULTA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import com.qsoft.erp.dominio.mapper.PersonaPolizaMapper; +import com.qsoft.erp.dominio.mapper.PlanMapper; +import com.qsoft.erp.dto.CoberturasPlanDTO; +import com.qsoft.erp.dto.CuentaBancariaDTO; +import com.qsoft.erp.dto.PersonaPolizaDTO; +import com.qsoft.erp.dto.PlanDTO; +import com.qsoft.erp.model.CoberturasPlan; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Empresa; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Plan; +import com.qsoft.erp.model.PlanBroker; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Usuario; +import java.util.Objects; +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author christian + */ +@Stateless +public class PlanUtil { + + @EJB + private DominioUtil dominioUtil; + + @PostConstruct + public void postConstruct() { + + } + + /** + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRED) + public List crearPersonaPoliza(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + PersonaPoliza personaPoliza = (PersonaPoliza) dominioUtil.getEntidad( + PersonaPolizaMapper.class, dominioUtil.crearObjeto(PersonaPolizaDTO.class, ent)); + PersonaPoliza result = null; + try { + Persona persona = personaPoliza.getPerCodigo(); + if (Objects.equals(DetalleCatalogoEnum.CED.getDetalle().getDetCodigo(), persona.getDetTipoIdentificacion().getDetCodigo())) { + if (!this.dominioUtil.validarCedula(persona.getPerIdentificacion())) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, + "La c\u00e9dula no cumple la validacion de d\u00edgito autoverificador<--\n"); + } + } + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + Poliza poliza = daopol.cargar(personaPoliza.getPolCodigo().getPolCodigo()); + Persona pers = new Persona(); + pers.setPerIdentificacion(persona.getPerIdentificacion()); + pers.setDetTipoIdentificacion(persona.getDetTipoIdentificacion()); + if (daoper.contarExistencias(pers) > 0) { + result = this.actualizarBeneficiario(personaPoliza, pers, persona, poliza); + } else { + pers = persona; + pers.setPerEstado(DominioConstantes.ACTIVO); + pers.setPerFechaRegistro(new Date()); + pers.setPersonaPolizaCollection(new ArrayList<>()); + result = this.crearPersonaPoliza(persona, poliza, personaPoliza.getDetTipoPersona()); + pers.getPersonaPolizaCollection().add(result); + daoper.guardar(pers); + } + data.add(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + System.out.println("========> RETORNAR PERSONA POLIZA " + result); + + } + return data; + } + + /** + * + * @param dto + * @param nueva + * @param persona + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + private PersonaPoliza actualizarBeneficiario(PersonaPoliza dto, Persona nueva, Persona persona, Poliza poliza) throws DominioExcepcion, DaoException { + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico daoppol = new DaoGenerico<>(PersonaPoliza.class); + nueva = daoper.buscarUnico(nueva); + + PersonaPoliza aux = new PersonaPoliza(); + aux.setPerCodigo(nueva); + aux.setPepEstado(DominioConstantes.ACTIVO); + if (daoppol.contarExistencias(aux) > 0) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, + "Error la persona ya esta registrada como beneficiario de una poliza"); + } + nueva.setPerApellidos(persona.getPerApellidos()); + nueva.setPerNombres(persona.getPerNombres()); + nueva.setPerFechaNacimiento(persona.getPerFechaNacimiento()); + nueva.setDetGenero(persona.getDetGenero()); + nueva.setPerNacionalidad(persona.getPerNacionalidad()); + nueva.setPerMail(persona.getPerMail()); + nueva.setPerDireccion(persona.getPerDireccion()); + nueva.setPerEstado(DominioConstantes.ACTIVO); + daoper.actualizar(nueva); + + aux = this.crearPersonaPoliza(nueva, poliza, dto.getDetTipoPersona()); + daoppol.guardar(aux); + + return aux; + } + + /** + * + * @param persona + * @param poliza + * @param tipo + * @return + */ + private PersonaPoliza crearPersonaPoliza(Persona persona, Poliza poliza, DetalleCatalogo tipo) { + PersonaPoliza personaPoliza = new PersonaPoliza(); + personaPoliza.setPolCodigo(poliza); + personaPoliza.setPerCodigo(persona); + personaPoliza.setDetTipoPersona(tipo); + personaPoliza.setPepEstado(DominioConstantes.ACTIVO); + personaPoliza.setPepMontoCobertura(poliza.getPlaCodigo().getPlaCoberturaMaxima()); + return personaPoliza; + } + public Plan getPlanPorCodigo(Integer plaCodigo) { + DaoGenerico generico = new DaoGenerico<>(Plan.class); + Plan plan = null; + try { + plan = new Plan(); + plan.setPlaCodigo(plaCodigo); + plan = generico.buscarUnico(plan); + } catch (DaoException ex) { + plan = null; + } + return plan; + } + /** + * Permite registrar la persona con los telefonos + * + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRED) + public List procesarPlan(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion { + List data = new ArrayList<>(); + for (Map ent : entidades) { + PlanDTO plan = (PlanDTO) dominioUtil.crearObjeto(PlanDTO.class, ent); + List lista = new ArrayList<>(); + + ObjectMapper maper = new ObjectMapper(); + maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); + if (ent.containsKey("coberturasPlan")) { + System.out.println("========> OK COBERTURAS PLAN: " + ent.get("coberturasPlan")); + for (Object row : (List) ent.get("coberturasPlan")) { + CoberturasPlanDTO col = (CoberturasPlanDTO) dominioUtil.crearObjeto(CoberturasPlanDTO.class, (Map) row); + lista.add(col); + } + } + + + plan.setCoberturasPlan(lista); + Plan result = crudPlan(plan, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param plan + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.SUPPORTS) + private Plan crudPlan(PlanDTO plan, int tipoAccion) throws DominioExcepcion { + DaoGenerico daopla = new DaoGenerico<>(Plan.class); + Plan result; + result = PlanMapper.INSTANCE.getEntidad(plan); + + + switch (tipoAccion) { + case CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + try { + result.setPlaEstado(DominioConstantes.ACTIVO); + result.setCoberturasPlanCollection(this.crearCoberturasPlan(plan, result)); + if(plan.getPlaBroker() != null){ + result.setPlanBrokerCollection(this.procesaPlanBrokers(plan, result)); + } + daopla.guardar(result); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD, ex.toString()); + } + } + break; + case ACTUALIZA: { + try { + DaoGenerico daotel = new DaoGenerico<>(CoberturasPlan.class); + DaoGenerico daousu = new DaoGenerico<>(Usuario.class); + DaoGenerico daocueban = new DaoGenerico<>(CuentaBancaria.class); + result.setCoberturasPlanCollection(this.crearCoberturasPlan(plan, result)); + + for (CoberturasPlan cobplan : result.getCoberturasPlanCollection()) { + if (cobplan.getCopCodigo() != null) { + daotel.actualizar(cobplan); + } else { + daotel.guardar(cobplan); + } + } + + result = daopla.actualizar(result); + + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.FATAL, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, ex.toString()); + } + } + break; + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param personaDTO + * @return + * @throws DaoException + */ + private List procesaPlanBrokers(PlanDTO planDTO, Plan plan) throws DaoException, DominioExcepcion{ + List data = new ArrayList<>(); + DaoGenerico daoEmp = new DaoGenerico<>(Empresa.class); + Empresa plantillaEmpresa = new Empresa(); + plantillaEmpresa.setEmpCodigo(planDTO.getPlaBroker()); + plantillaEmpresa.setEmpEstado(DominioConstantes.ACTIVO); + Empresa empresaRetornar = daoEmp.buscarUnico(plantillaEmpresa); + + if(empresaRetornar == null){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, "Error, broker enviado no encontrado"); + } + PlanBroker plb = crearPlanBroker(empresaRetornar, plan, null, null, plan.getPlaNombre()); + data.add(plb); + return data; + } + public PlanBroker crearPlanBroker(Empresa empCodigo, Plan plan, Double descuento, Double oferta, String observacion){ + PlanBroker planBroker = new PlanBroker(); + planBroker.setEmpCodigo(empCodigo); + planBroker.setPlaCodigo(plan); + planBroker.setPlbDescuento(descuento); + planBroker.setPlbOferta(oferta); + planBroker.setPlbObservacion(observacion); + planBroker.setPlbEstado(DominioConstantes.ACTIVO); + return planBroker; + + } + private List crearCoberturasPlan(PlanDTO personaDTO, Plan plan) { + List data = new ArrayList<>(); + for (CoberturasPlanDTO cobpla : personaDTO.getCoberturasPlan()) { + CoberturasPlan coberturasPlan = (CoberturasPlan) dominioUtil.getEntidad(EntidadEnum.CoberturasPlan.getMapper(), cobpla); + + coberturasPlan.setPlaCodigo(plan); + data.add(coberturasPlan); + } + return data; + } + + private List crearCuentasBancarias(PersonaDTO personaDTO, Persona persona) { + List data = new ArrayList<>(); + for (CuentaBancariaDTO cuen : personaDTO.getCuentasBancarias()) { + CuentaBancaria cuentaBancaria = (CuentaBancaria) dominioUtil.getEntidad(EntidadEnum.CuentaBancaria.getMapper(), cuen); + cuentaBancaria.setPerCodigo(persona); + data.add(cuentaBancaria); + } + return data; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/PolizaUtil.java b/src/main/java/com/qsoft/erp/dominio/util/PolizaUtil.java new file mode 100644 index 0000000..2816d0a --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/PolizaUtil.java @@ -0,0 +1,862 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.dao.DaoGenerico; +import static com.qsoft.erp.dominio.AccionGenerica.ACTUALIZA; +import static com.qsoft.erp.dominio.AccionGenerica.CANCELA; +import static com.qsoft.erp.dominio.AccionGenerica.ELIMINA; +import static com.qsoft.erp.dominio.AccionGenerica.GUARDA; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.mapper.PersonaPolizaMapper; +import com.qsoft.erp.dominio.mapper.PolizaMapper; +import com.qsoft.erp.dto.PersonaPolizaDTO; +import com.qsoft.erp.constantes.SecuenciaEnum; +import com.qsoft.erp.dto.PolizaDTO; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.Empresa; +import com.qsoft.erp.model.EstadoPoliza; +import com.qsoft.erp.model.Localizacion; +import com.qsoft.erp.model.Pago; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Plan; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.Rol; +import com.qsoft.erp.model.RolUsuario; +import com.qsoft.erp.model.Usuario; +import com.qsoft.erp.model.UsuarioPassword; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import com.qsoft.util.ms.pojo.HeaderMS; +import java.io.IOException; +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 java.util.Objects; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import javax.xml.datatype.DatatypeConfigurationException; +import org.apache.commons.lang3.RandomStringUtils; + +/** + * + * @author james + */ +@Stateless +public class PolizaUtil { + + private static final int MESES = 12; + + @EJB + private DominioUtil dominioUtil; + + @EJB + private NotificadorUtil notificadorUtil; + + @EJB + private SecuenciaUtil contabilidadUtil; + @EJB + private CatalogoUtil catalogoUtil; + /** + * @param header + * @param entidades + * @param tipoAccion + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public List procesarPoliza(HeaderMS header, List> entidades, int tipoAccion) throws DominioExcepcion, IOException { + DaoGenerico daousu = new DaoGenerico<>(Usuario.class); + List data = new ArrayList<>(); + Usuario user = new Usuario(); + user.setUsuUsuario(header.getUsuario()); + user.setUsuEstado(DominioConstantes.ACTIVO); + try { + user = daousu.buscarUnico(user); + } catch (DaoException ex) { + ex.printStackTrace(); + } + + for (Map ent : entidades) { + PolizaDTO poliza = (PolizaDTO) dominioUtil.crearObjeto(PolizaDTO.class, ent); + Poliza result = crudPoliza(poliza, user, tipoAccion); + data.add(result); + } + return data; + } + + /** + * + * @param poliza + * @param tipoAccion + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private Poliza crudPoliza(PolizaDTO poliza, Usuario user, int tipoAccion) throws DominioExcepcion, IOException { + Poliza result; + result = PolizaMapper.INSTANCE.getEntidad(poliza); + switch (tipoAccion) { + case com.qsoft.erp.dominio.AccionGenerica.CONSULTA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CONSULTA no soportada para el controlador de Accion"); + } + case GUARDA: { + result = this.crearPoliza(poliza, user); + } + break; + case ACTUALIZA: { + + try { + + result = this.registrarPoliza(null, poliza, user, true); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, + "Error intentando actualizar la poliza: " + ex); + } + + } + break; + + case ELIMINA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion ELIMINACION aun no permitida"); + } + case CANCELA: { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Operacion CANCELAR aun no permitida"); + } + } + return result; + } + + /** + * + * @param poliza + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public void validarEstadoCreado(PolizaDTO poliza) throws DaoException, DominioExcepcion{ + DaoGenerico daoestpol = new DaoGenerico<>(EstadoPoliza.class); + EstadoPoliza estadoAntiguo = this.buscarUltimoEstadoActivoPolCodigo(poliza.getPolCodigo(), daoestpol); + if(Objects.equals(estadoAntiguo.getDetEstado().getDetCodigo(), DetalleCatalogoEnum.ESINI.getDetalle().getDetCodigo()) && (!Objects.equals(poliza.getDetEstado(), DetalleCatalogoEnum.ESTCAN.getDetalle().getDetCodigo()) )){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_ACTUALIZA_BDD, "Las polizas recientemente creadas solo pueden ser canceladas, recuerde seguir el proceso adecuadamente"); + } + } + + @Transactional(Transactional.TxType.REQUIRES_NEW) + public Poliza crearPolizaMasivo(Persona persona, PolizaDTO poliza, Usuario user) throws DaoException, DominioExcepcion{ + Poliza result = this.registrarPoliza(persona, poliza, user, false); + + return result; + } + public Poliza crearPoliza(PolizaDTO poliza, Usuario user) throws DominioExcepcion, IOException { + Poliza result = null; + try { + if (this.existePoliza(poliza.getPerCedulaTitular().trim(), poliza.getDetTipoIdentificacion(), null)) { + throw new DatatypeConfigurationException("Error el cliente " + poliza.getPerCedulaTitular().trim() + + " ya posee una poliza activa no se modificara la informacion actual"); + } + Persona persona = this.obtenerPersona(poliza); + result = this.registrarPoliza(persona, poliza, user, false); + this.crearUsuario(persona, result); + } catch (DaoException | DatatypeConfigurationException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + "Error al registrar poliza " + ex); + } + System.out.println("========================> OK REGISTRO POLIZA "); + return result; + } + + /** + * + * @param cedula + * @param diagnostico + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List obtenerTitularDependienteFarma(String cedula, String diagnostico) throws DominioExcepcion, DaoException { + DaoGenerico daoPerPol = new DaoGenerico<>(PersonaPoliza.class); + Persona plantillaTitular = new Persona(); + List data = new ArrayList<>(); + + plantillaTitular.setPerIdentificacion(cedula); + + PersonaPoliza plantillaPerPol = new PersonaPoliza(); + plantillaPerPol.setPerCodigo(plantillaTitular); + + List listPersonaPoliza = daoPerPol.buscarLista(plantillaPerPol); + + for (PersonaPoliza personaPoliza : listPersonaPoliza) { + Map recTitular = new HashMap(); + + String tipoident = personaPoliza.getPerCodigo().getDetTipoIdentificacion().getDetNombre().charAt(0) + ""; + List dependientes = this.getHijos(personaPoliza, daoPerPol); + recTitular.put("ti_tipoident", tipoident); + recTitular.put("ti_cedula", personaPoliza.getPerCodigo().getPerIdentificacion()); + recTitular.put("ti_estado", "R"); + //TODO: Codigo estatico, revisar + recTitular.put("ti_autnumcont", dependientes.size()); + //TODO: Codigo estatico, revisar + recTitular.put("ti_codplan", personaPoliza.getPolCodigo().getPlaCodigo().getPlaCodigo()); + //TODO: Codigo estatico, revisar + recTitular.put("ti_autcodigo", 1); + //TODO: Codigo estatico, revisar + recTitular.put("ti_nomplan", personaPoliza.getPolCodigo().getPlaCodigo().getPlaCodigo()); + //TODO: Codigo estatico, revisar + PersonaPolizaDTO dto = PersonaPolizaMapper.INSTANCE.getDto(personaPoliza); + recTitular.put("rec_dependiente", dependientes); + + data.add(recTitular); + } + + return data; + } + + /** + * + * @param padre + * @param daoPerPol + * @return + * @throws DominioExcepcion + * @throws DaoException + */ + public List getHijos(PersonaPoliza padre, DaoGenerico daoPerPol) throws DominioExcepcion, DaoException { + List listPerPolDTO = new ArrayList<>(); + PersonaPoliza plantilla = new PersonaPoliza(); + plantilla.setPolCodigo(padre.getPolCodigo()); + for (PersonaPoliza personaPoliza : daoPerPol.buscarLista(plantilla)) { + Map recDependiente = new HashMap(); + + String tipoident = personaPoliza.getPerCodigo().getDetTipoIdentificacion().getDetNombre().charAt(0) + ""; + recDependiente.put("de_tipoident", tipoident); + recDependiente.put("de_cedula", personaPoliza.getPerCodigo().getPerIdentificacion()); + recDependiente.put("de_nombre", personaPoliza.getPerCodigo().getPerNombres()); + recDependiente.put("de_mail", personaPoliza.getPerCodigo().getPerMail()); + recDependiente.put("de_tipo", personaPoliza.getDetTipoPersona().getDetNombre()); + recDependiente.put("de_autcodigo", 1); + + listPerPolDTO.add(recDependiente); + + } + + return listPerPolDTO; + + } + + /** + * Permite crear la poliza + * + * @param persona + * @param input + * @return + * @throws DaoException + */ + private Poliza registrarPoliza(Persona persona, PolizaDTO input, Usuario user, boolean actualiza) throws DaoException, DominioExcepcion { + DaoGenerico daopol = new DaoGenerico<>(Poliza.class); + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + DaoGenerico daopag = new DaoGenerico<>(Pago.class); + DaoGenerico daoestpol = new DaoGenerico<>(EstadoPoliza.class); + + Poliza polizaEstadoAnterior = daopol.buscarUnico(new Poliza(input.getPolCodigo())); + + Poliza poliza = new Poliza(); + poliza = PolizaMapper.INSTANCE.getEntidad(input); + DetalleCatalogo periodicidadMensual = catalogoUtil.getDetallePorNemonicoDao("MENS", daodet); + DetalleCatalogo periodicidadAnual = catalogoUtil.getDetallePorNemonicoDao("ANUA", daodet); + DetalleCatalogo estadoActual = null; + Integer planPrevio = null; + if (actualiza) { + boolean cancela = false; + + validarEstadoCreado(input); + + if(input.getDetEstado() != null){ + cancela = Objects.equals(input.getDetEstado(), DetalleCatalogoEnum.ESTCAN.getDetalle().getDetCodigo()); + EstadoPoliza estadoAnteriorPoliza = buscarUltimoEstadoActivo(polizaEstadoAnterior, daoestpol); + estadoActual = catalogoUtil.getDetallePorCodigo(input.getDetEstado()); + /**------------------------------- Buscar el ultimo estado valido*/ + if(estadoAnteriorPoliza == null || !estadoActual.getDetNemonico().equals(estadoAnteriorPoliza.getDetEstado().getDetNemonico()) ){ + this.anularEstadosPorPoliza(new ArrayList(polizaEstadoAnterior.getEstadoPolizaCollection()), daoestpol); + + + EstadoPoliza ep= generarEstadoPoliza(estadoActual, polizaEstadoAnterior, String.format("Estado %s", estadoActual.getDetNombre())); + daoestpol.guardar(ep); + } + + } + planPrevio = daopol.cargar(input.getPolCodigo()).getPlaCodigo().getPlaCodigo(); + + if (cancela) { + poliza.setPolFechaCancela(new Date()); + } + if(input.getDetPeriodicidad() != null ){ + if(Objects.equals(polizaEstadoAnterior.getDetPeriodicidad().getDetCodigo(), periodicidadMensual.getDetCodigo()) && Objects.equals(input.getDetPeriodicidad(), periodicidadAnual.getDetCodigo())){ + cambiarMensualAAnual(poliza, polizaEstadoAnterior, periodicidadAnual, daodet, daopag, daopol); + }else{ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, + String.format("Solo puede cambiarse de estado %s a estado %s en este momento", periodicidadMensual.getDetNombre(), periodicidadAnual.getDetNombre() )); + } + } + + daopol.actualizar(poliza); + if(poliza.getEstadoPolizaCollection() == null){ + poliza.setEstadoPolizaCollection(new ArrayList<>()); + } + this.actualizaPlan(planPrevio, poliza, user, daopol); + if (cancela) { + this.cancelaPoliza(poliza); + } + } else { + poliza.setEstadoPolizaCollection(new ArrayList<>()); + poliza = this.setData(poliza, user, input); + + long cont; + try { + cont = this.contabilidadUtil.getSecuencia(SecuenciaEnum.POLMED); + String contrat = this.dominioUtil.getCodPoliza(cont); + poliza.setPolCertificado(contrat); + poliza.setPolContrato(contrat); + } catch (DominioExcepcion ex) { + throw new DaoException(ex.getMensaje()); + } + DaoGenerico daopla = new DaoGenerico<>(Plan.class); + Plan plan = daopla.cargar(poliza.getPlaCodigo().getPlaCodigo()); + poliza.setPlaCodigo(plan); + poliza.setPagoCollection(this.crearPagos(poliza)); + poliza.setPersonaPolizaCollection(this.registrarPersonaPoliza(persona, poliza)); + daopol.guardar(poliza); + } + return poliza; + } + + public void cambiarMensualAAnual(Poliza polizaModificar,Poliza polizaAnterior, DetalleCatalogo periodicidadAnual, DaoGenerico daodet, DaoGenerico daopag, DaoGenerico daopol) throws DaoException{ + DetalleCatalogo tipoPagoPendiente = catalogoUtil.getDetallePorNemonicoDao("PAG1", daodet); + DetalleCatalogo tipoPagoCancelado = catalogoUtil.getDetallePorNemonicoDao("PAGC", daodet); + polizaModificar.setDetPeriodicidad(periodicidadAnual); + Pago pagoPlantilla = new Pago(); + pagoPlantilla.setPolCodigo(polizaAnterior); + pagoPlantilla.setDetEstado(tipoPagoPendiente); + List lstPagosPendientes = daopag.buscarLista(pagoPlantilla, new String[]{"pagFechaVencimiento","ASC"}); + Pago primerPagoCambiar = null; + double unPagoAnual = 0.0; + for (int i = 0; i < lstPagosPendientes.size(); i++) { + unPagoAnual += lstPagosPendientes.get(i).getPagMonto() != null ? lstPagosPendientes.get(i).getPagMonto() : 0.0; + if(i == 0){ + primerPagoCambiar = lstPagosPendientes.get(i); + }else{ + lstPagosPendientes.get(i).setDetEstado(tipoPagoCancelado); + daopag.actualizar(lstPagosPendientes.get(i)); + } + + } + + if(primerPagoCambiar != null){ + primerPagoCambiar.setPagMonto(unPagoAnual); + daopag.actualizar(primerPagoCambiar); + } + + } + + public EstadoPoliza buscarUltimoEstadoActivo(Poliza poliza,DaoGenerico daoestpol) throws DaoException{ + EstadoPoliza plantilla = new EstadoPoliza(); + plantilla.setPolCodigo(poliza); + plantilla.setEspEstado(DominioConstantes.ACTIVO); + + return daoestpol.buscarUnico(plantilla); + } + public EstadoPoliza buscarUltimoEstadoActivoPolCodigo(Integer polCodigo,DaoGenerico daoestpol) throws DaoException{ + return buscarUltimoEstadoActivo(new Poliza(polCodigo), daoestpol); + } + /** + * + * @param poliza + * @throws DaoException + */ + public void cancelaPolizaDao(Poliza poliza, DaoGenerico daopa,DaoGenerico daopp, DaoGenerico daocb) throws DaoException { + + Pago pag = new Pago(); + pag.setDetEstado(DetalleCatalogoEnum.PAG1.getDetalle()); + pag.setPolCodigo(new Poliza(poliza.getPolCodigo())); + + for (Pago p : daopa.buscarLista(pag)) { + if (this.esCancelable(p.getPagFechaVencimiento())) { + p.setDetEstado(DetalleCatalogoEnum.PAGC.getDetalle()); + daopa.actualizar(p); + } + } + PersonaPoliza perpol = new PersonaPoliza(); + perpol.setPolCodigo(new Poliza(poliza.getPolCodigo())); + CuentaBancaria cuenta = new CuentaBancaria(); + for (PersonaPoliza pp : daopp.buscarLista(perpol)) { + pp.setPepEstado(DominioConstantes.CANCELADO); + daopp.actualizar(pp); + if (pp.getDetTipoPersona().getDetNemonico().equals(DetalleCatalogoEnum.PTITU.name())) { + cuenta.setPerCodigo(new Persona(pp.getPerCodigo().getPerCodigo())); + } + } + cuenta.setCueDebito(DominioConstantes.ACTIVO); + for (CuentaBancaria cb : daocb.buscarLista(cuenta)) { + cb.setCueDebito(DominioConstantes.INACTIVO); + daocb.actualizar(cb); + } + } + public void cancelaPoliza(Poliza poliza) throws DaoException { + System.out.println("========>>> CANCELA POLIZA......"); + DaoGenerico daopa = new DaoGenerico<>(Pago.class); + DaoGenerico daopp = new DaoGenerico<>(PersonaPoliza.class); + DaoGenerico daocb = new DaoGenerico<>(CuentaBancaria.class); + cancelaPolizaDao(poliza, daopa, daopp, daocb); + } + + /** + * + * @param fecha + * @return + */ + private boolean esCancelable(Date fecha) { + boolean estado = false; + Calendar c = Calendar.getInstance(); + Calendar d = Calendar.getInstance(); + d.setTimeInMillis(fecha.getTime()); + c.set(Calendar.DAY_OF_MONTH, c.getMaximum(Calendar.DAY_OF_MONTH)); + estado = d.getTimeInMillis() > c.getTimeInMillis(); + System.out.println("\t====> " + DominioConstantes.getDate(d.getTime()) + " <=> " + DominioConstantes.getDate(c.getTime()) + + " => " + estado); + return estado; + } + + /** + * + * @param poliza + * @return + */ + private EstadoPoliza getEstadoActivo(Poliza poliza) { + EstadoPoliza result = null; + for (EstadoPoliza es : poliza.getEstadoPolizaCollection()) { + if (es.getEspEstado().equals(DominioConstantes.ACTIVO)) { + result = es; + } + } + return result; + } + + /** + * + * @param poliza + * @param usuario + * @param estado + * @return + */ + private EstadoPoliza getEstado(Poliza poliza, Usuario usuario, DetalleCatalogoEnum estado) { + EstadoPoliza es = new EstadoPoliza(); + es.setPolCodigo(poliza); + es.setDetEstado(estado.getDetalle()); + es.setEspEstado(DominioConstantes.ACTIVO); + es.setPolCodigo(poliza); + es.setEspFechaInicio(new Date()); + es.setUsuCodigo(usuario); + es.setEspObservacion("Cambio de estado " + es.getDetEstado().getDetDescripcion()); + return es; + } + + /** + * + * @param planPrevio + * @param poliza + * @param daopol + * @throws DaoException + */ + public void actualizaPlan(Integer planPrevio, Poliza poliza, Usuario user, DaoGenerico daopol) throws DaoException { + if ((poliza.getPlaCodigo() != null && poliza.getPlaCodigo().getPlaCodigo() != null ) && !Objects.equals(planPrevio, poliza.getPlaCodigo().getPlaCodigo())) { + System.out.print(">>> PlaNombre:"+ poliza.getPlaCodigo().getPlaNombre()); + System.out.print("Placodigo: "+ poliza.getPlaCodigo().getPlaCodigo()); + System.out.print("Placodigo: "+ poliza.getPlaCodigo()); + + DaoGenerico daopa = new DaoGenerico<>(Pago.class); + DaoGenerico daopla = new DaoGenerico<>(Plan.class); + DaoGenerico daopp = new DaoGenerico<>(PersonaPoliza.class); + Plan plan = daopla.cargar(poliza.getPlaCodigo().getPlaCodigo()); + Pago pag = new Pago(); + pag.setDetEstado(DetalleCatalogoEnum.PAG1.getDetalle()); + pag.setPolCodigo(new Poliza(poliza.getPolCodigo())); + for (Pago p : daopa.buscarLista(pag)) { + if (p.getPagFechaVencimiento().getTime() > System.currentTimeMillis()) { + p.setPagMonto(plan.getPlaValorMensual()); + daopa.actualizar(p); + } + } + PersonaPoliza perpol = new PersonaPoliza(); + perpol.setPolCodigo(poliza); + for (PersonaPoliza pp : daopp.buscarLista(perpol)) { + pp.setPepMontoCobertura(plan.getPlaCoberturaMaxima()); + daopp.actualizar(pp); + } + poliza.setPolFechaCambio(new Date()); + poliza.getEstadoPolizaCollection().add(this.getEstado(poliza, user, DetalleCatalogoEnum.ESINI)); + daopol.actualizar(poliza); + } + } + + /** + * + * @param poliza + * @param input + * @return + */ + private Poliza setData(Poliza poliza, Usuario user, PolizaDTO input) { + poliza.setPolPreexistencias(DominioConstantes.ACTIVO); + poliza.setPolOrigen(poliza.getPolOrigen() == null ? DominioConstantes.ORIGEN_POLIZA : poliza.getPolOrigen()); + poliza.setPolDescripcion(poliza.getPolDescripcion() == null ? DominioConstantes.DESCRIPCION_POLIZA : poliza.getPolDescripcion()); + poliza.setPolEstado(DominioConstantes.INACTIVO); + poliza.setPolDiasCobertura(DominioConstantes.DIAS_COBERTURA); + Calendar cal = Calendar.getInstance(); + if(input.getPolFechaInicio() == null){ + cal.add(Calendar.MONTH, 1); + cal.set(Calendar.DAY_OF_MONTH, 1); + poliza.setPolFechaInicio(cal.getTime()); + cal.add(Calendar.YEAR, 1); + poliza.setPolFechaFin(cal.getTime()); + }else{ + poliza.setPolFechaInicio(input.getPolFechaInicio()); + cal.setTime(input.getPolFechaInicio()); + cal.add(Calendar.YEAR, 1); + poliza.setPolFechaFin(cal.getTime()); + } + + poliza.setPolFechaRegistro(new Date()); + poliza.setEmpCodigo(new Empresa(input.getEmpCodigo())); + poliza.setDetPeriodicidad(new DetalleCatalogo(input.getDetPeriodicidad())); + poliza.getEstadoPolizaCollection().add(this.getEstado(poliza, user, DetalleCatalogoEnum.ESINI)); + poliza.setDetIfi(new DetalleCatalogo(input.getDetIfi())); + poliza.setDetSucursalIfi(new DetalleCatalogo(input.getDetSucursalIfi())); + poliza.setDetFormaPago(new DetalleCatalogo(input.getDetFormaPago())); + poliza.setDetModalidad(new DetalleCatalogo(input.getDetModalidad())); + poliza.setPlaCodigo(new Plan(input.getPlaCodigo())); + return poliza; + } + + /** + * + * @param cedula + * @param detTipoIden + * @param perCodigo + * @return + * @throws DaoException + */ + public boolean existePoliza(String cedula, Integer detTipoIden, Integer perCodigo) throws DaoException { + DaoGenerico daopp = new DaoGenerico<>(PersonaPoliza.class); + Persona per = new Persona(); + if (perCodigo != null) { + per.setPerCodigo(perCodigo); + } else { + per.setPerIdentificacion(cedula); + per.setDetTipoIdentificacion(new DetalleCatalogo(detTipoIden)); + } + PersonaPoliza pp = new PersonaPoliza(); + pp.setDetTipoPersona(DetalleCatalogoEnum.PTITU.getDetalle()); + pp.setPepEstado(DominioConstantes.ACTIVO); + pp.setPerCodigo(per); + return daopp.contarExistencias(pp) > 0; + } + + public boolean evaluarSiniestrado(String cedula) throws DaoException { + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + Persona personaPlantilla = new Persona(); + personaPlantilla.setPerIdentificacion(cedula); + + Persona persona = daoper.buscarUnico(personaPlantilla); + boolean evaluacion = true; + if (persona.getDetEstadoPoliza() != null) { + if (persona.getDetEstadoPoliza().getDetNemonico().equals("SINIES")) { + evaluacion = false; + } + } + return evaluacion; + } + + /** + * + * @param persona + * @param poliza + * @return + * @throws DaoException + * + */ + /**------------------------------ Crear usuario afuera -----------------------*/ + public Usuario creaUsuarioExt(Persona persona, Poliza poliza) throws DaoException, IOException{ + return crearUsuario(persona, poliza); + } + private Usuario crearUsuario(Persona persona, Poliza poliza) throws DaoException, IOException { + DaoGenerico daouser = new DaoGenerico<>(Usuario.class); + + Usuario user = new Usuario(); + user.setUsuUsuario(persona.getPerIdentificacion()); + String pass = "- SU PASSWORD ACTUAL -"; + if (daouser.contarExistencias(user) <= 0l) { + user.setUsuUsuario(persona.getPerIdentificacion()); + user.setUsuOrigen(DominioConstantes.PERSONA); + user.setUsuIdOrigen("" + persona.getPerCodigo()); + user.setUsuDescripcion(DominioConstantes.DATO_AUTO); + user.setUsuEstado(DominioConstantes.ACTIVO); + user.setUsuFechaRegistro(new Date()); + user.setUsuNombre(persona.getPerNombres()); + user.setUsuEmail(persona.getPerMail()); + pass = RandomStringUtils.randomAlphabetic(8); + user.setUsuarioPasswordCollection(this.crearPassword(user, pass)); + user.setRolUsuarioCollection(this.crearRol(user)); + daouser.guardar(user); + } else { + user = daouser.buscarUnico(user); + user.setUsuEmail(persona.getPerMail()); + daouser.actualizar(user); + } +// this.notificadorUtil.enviarMensajeBienvenida(user, poliza, pass); + this.notificadorUtil.notificarBienvenida(user, poliza, pass); + return user; + } + + /** + * + * @param user + * @return + */ + private List crearRol(Usuario user) { + List lista = new ArrayList<>(); + RolUsuario ru = new RolUsuario(); + ru.setRolCodigo(new Rol(DominioConstantes.ROL_CLI)); + ru.setRouDescripcion(DominioConstantes.DATO_AUTO); + ru.setRouEstado(DominioConstantes.ACTIVO); + ru.setRouFecha(new Date()); + ru.setUsuCodigo(user); + lista.add(ru); + return lista; + } + + /** + * + * @return + */ + private List crearPassword(Usuario user, String password) throws DaoException { + List lista = new ArrayList<>(); + try { + UsuarioPassword usp = new UsuarioPassword(); + usp.setPasEstado(DominioConstantes.ACTIVO); + usp.setPasFecha(new Date()); + usp.setUsuCodigo(user); + String cifpas = this.dominioUtil.getSHAUsuario(user.getUsuUsuario(), password); + usp.setPasValor(cifpas); + lista.add(usp); + } catch (DominioExcepcion ex) { + ex.printStackTrace(System.out); + } + return lista; + } + + /** + * + * @param poliza + * @return + */ + private List crearPagos(Poliza poliza) throws DaoException { + DaoGenerico daodet = new DaoGenerico<>(DetalleCatalogo.class); + + DetalleCatalogo periodicidad = daodet.cargar(poliza.getDetPeriodicidad().getDetCodigo()); + List pagos = new ArrayList<>(); + Integer num = Integer.parseInt(periodicidad.getDetDestino().trim()); + Calendar cal = Calendar.getInstance(); + if(poliza.getPolFechaInicio() != null){ + cal.setTime(poliza.getPolFechaInicio()); + //cal.set(Calendar.DAY_OF_MONTH, 3); + }else{ + cal.setTime(poliza.getPolFechaRegistro()); + cal.set(Calendar.DAY_OF_MONTH, 3); + cal.add(Calendar.MONTH, 1); + } + + DetalleCatalogo estado = DetalleCatalogoEnum.PAG1.getDetalle(); + Pago pago = null; + Double monto = poliza.getPlaCodigo().getPlaValorAnual(); + if (num == MESES) { + monto = poliza.getPlaCodigo().getPlaValorMensual(); + } + if (num == 2 && monto != null && monto > 0) { + monto = monto / 2.0; + } + int add = MESES / num; // 12/12 = 1 12/2 = 6 12/1 = 12 + if (monto == null && num < MESES) { + monto = poliza.getPlaCodigo().getPlaValorMensual(); + monto = monto * add; + } + System.out.println(">>>> PERIODICIDAD MENSUAL y CUOTA ??? " + num + " => " + add + " => " + monto); + for (Integer i = 0; i < num; i++) { + pago = new Pago(); + pago.setPagFechaVencimiento(cal.getTime()); + pago.setPagNumPago(i.shortValue()); + pago.setDetEstado(estado); + pago.setPagMonto(monto); + pago.setPolCodigo(poliza); + pagos.add(pago); + cal.add(Calendar.MONTH, add); + } + return pagos; + } + + /** + * + * @param poliza + * @return + */ + private Persona obtenerPersona(PolizaDTO poliza) throws DaoException { + DaoGenerico daoper = new DaoGenerico<>(Persona.class); + DaoGenerico dao = new DaoGenerico<>(Localizacion.class); + Persona per = new Persona(); + per.setPerIdentificacion(poliza.getPerCedulaTitular().trim()); + per.setDetTipoIdentificacion(new DetalleCatalogo(poliza.getDetTipoIdentificacion())); + if (daoper.contarExistencias(per) > 0) { + per = daoper.buscarUnico(per); + this.crearCuentas(poliza, per); + } else { + throw new DaoException("Error, la persona seleccionada no se encuentra en el sistema"); + } + return per; + } + + /** + * + * @param persona + * @param poliza + */ + public PolizaDTO crearPolizaDTO(Integer empCodigo, Integer plaCodigo, String polBroker, Integer periodicidad, Integer codigoSucursal, Integer tipoCobro, String polDescripcion, Integer detModalidad, Integer detIfi, String fechaInicio, String polObservacion){ + PolizaDTO polizaDTO = new PolizaDTO(); + polizaDTO.setPolBroker(polBroker); + polizaDTO.setPlaCodigo(plaCodigo); + polizaDTO.setDetPeriodicidad(periodicidad); + polizaDTO.setDetIfi(detIfi); + polizaDTO.setDetSucursalIfi(codigoSucursal); + polizaDTO.setEmpCodigo(empCodigo); + polizaDTO.setDetFormaPago(tipoCobro); + polizaDTO.setPolDescripcion(polDescripcion); + polizaDTO.setPolObservacion(polObservacion); + polizaDTO.setDetModalidad(detModalidad); + polizaDTO.setPolFechaInicio(DominioConstantes.getDate(fechaInicio)); + return polizaDTO; + } + private List registrarPersonaPoliza(Persona persona, Poliza poliza) throws DaoException { + List lista = new ArrayList<>(); + System.out.println("=============== REGISTRAR PERSONA POLIZA ==============="); + PersonaPoliza pp = new PersonaPoliza(); + pp.setDetTipoPersona(DetalleCatalogoEnum.PTITU.getDetalle()); + pp.setPepEstado(DominioConstantes.ACTIVO); + pp.setPepMontoCobertura(poliza.getPlaCodigo().getPlaCoberturaMaxima()); + pp.setPepObservacion(DominioConstantes.DATO_AUTO); + pp.setPerCodigo(persona); + pp.setPolCodigo(poliza); + lista.add(pp); + return lista; + } + + /** + * + * @return + */ + private List crearCuentas(PolizaDTO poliza, Persona persona) throws DaoException { + DaoGenerico daocue = new DaoGenerico<>(CuentaBancaria.class); + List cuentaBancarias = new ArrayList<>(); + CuentaBancaria cuenta = new CuentaBancaria(); + cuenta.setCueCuenta(poliza.getCuentaDebito()); + cuenta.setCueIdentificacion(poliza.getCedulaDebito()); + cuenta.setCueEstado(DominioConstantes.ACTIVO); + cuenta.setDetIfi(new DetalleCatalogo(poliza.getDetIfi())); + cuenta.setDetTipoCuenta(new DetalleCatalogo(poliza.getDetTipoCuenta())); + cuenta.setPerCodigo(persona); + cuenta.setCueDebito(DominioConstantes.ACTIVO); + cuentaBancarias.add(cuenta); + daocue.guardar(cuenta); + return cuentaBancarias; + } + + /*----------------------------------------*/ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public void actualizarPolizaCaducada(DetalleCatalogo estadoCaducado,Poliza caducarPoliza, String descripcion, DaoGenerico daopol, DaoGenerico daoestpol) throws DaoException{ + + anularEstadosPorPoliza(new ArrayList(caducarPoliza.getEstadoPolizaCollection()), daoestpol); + //caducarPoliza.setDetEstado(this.estadoCaducado); + EstadoPoliza estadoActual = crearEstadoPoliza(estadoCaducado, caducarPoliza, descripcion, daoestpol); + //caducarPoliza.setPolFechaca(new Date()); + caducarPoliza.setPolDescripcion(descripcion); + /**------------------------------TEMPORAL*/ + caducarPoliza.setPolEstado(DominioConstantes.INACTIVO); + daopol.actualizar(caducarPoliza); + } + /**--------------------------Matar EstadosPoliza */ + public void anularEstadosPorPoliza(List lstEstadosPoliza, DaoGenerico daoestpol) throws DaoException{ + for (EstadoPoliza estadoPoliza : lstEstadosPoliza) { + if(Objects.equals(DominioConstantes.ACTIVO, estadoPoliza.getEspEstado())){ + inactivarEstado(estadoPoliza, daoestpol); + } + } + } + /**-------------------------------------------------------------- inactivar EstadoPoliza**/ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public EstadoPoliza inactivarEstado(EstadoPoliza estadoPoliza, DaoGenerico daoestpol) throws DaoException{ + estadoPoliza.setEspEstado(DominioConstantes.INACTIVO); + estadoPoliza.setEspFechaFin(new Date()); + daoestpol.actualizar(estadoPoliza); + return estadoPoliza; + } + @Transactional(Transactional.TxType.REQUIRES_NEW) + public EstadoPoliza crearEstadoPoliza(DetalleCatalogo detEstadoNuevo, Poliza poliza, String espObservacion, DaoGenerico daoestpol ) throws DaoException{ + EstadoPoliza estadoPoliza = generarEstadoPoliza(detEstadoNuevo, poliza, espObservacion); + daoestpol.guardar(estadoPoliza); + return estadoPoliza; + } + public EstadoPoliza generarEstadoPoliza(DetalleCatalogo detEstadoNuevo, Poliza poliza, String espObservacion) throws DaoException{ + EstadoPoliza estadoPoliza = new EstadoPoliza(); + estadoPoliza.setPolCodigo(poliza); + estadoPoliza.setDetEstado(detEstadoNuevo); + estadoPoliza.setEspObservacion(espObservacion); + estadoPoliza.setEspFechaInicio(new Date()); + estadoPoliza.setEspEstado(DominioConstantes.ACTIVO); + return estadoPoliza; + } + /**------------------------------------------------ PARA LOS BATCHS*/ + @Transactional(Transactional.TxType.REQUIRES_NEW) + public void actualizarPolizaSuspenida(Poliza polizaSuspender, String descripcion, DaoGenerico daopol, DetalleCatalogo estadoSuspendido, DaoGenerico daoestPol) throws DaoException{ + //polizaSuspender.setDetEstado(estadoSuspendido); + anularEstadosPorPoliza(new ArrayList(polizaSuspender.getEstadoPolizaCollection()), daoestPol); + crearEstadoPoliza(estadoSuspendido, polizaSuspender, descripcion, daoestPol); + polizaSuspender.setPolFechaCancela(new Date()); + polizaSuspender.setPolDescripcion(descripcion); + /**------------------------------TEMPORAL*/ + polizaSuspender.setPolEstado(DominioConstantes.INACTIVO); + daopol.actualizar(polizaSuspender); + } + public void ejecutarCancelacionPersonasPoliza(Poliza poliza, DaoGenerico daoperpol) throws DaoException{ + PersonaPoliza plantilla = new PersonaPoliza(); + plantilla.setPolCodigo(poliza); + List lstPersonaPoliza = daoperpol.buscarLista(plantilla); + for (PersonaPoliza personaPoliza : lstPersonaPoliza) { + ejecutarCancelacionPersonaPoliza(personaPoliza, daoperpol); + } + } + public PersonaPoliza ejecutarCancelacionPersonaPoliza(PersonaPoliza personaPoliza, DaoGenerico daoperpol) throws DaoException{ + personaPoliza.setPepEstado(DominioConstantes.CANCELADO); + daoperpol.actualizar(personaPoliza); + return personaPoliza; + } + +} diff --git a/src/main/java/com/qsoft/erp/dominio/util/SecuenciaUtil.java b/src/main/java/com/qsoft/erp/dominio/util/SecuenciaUtil.java new file mode 100644 index 0000000..945965a --- /dev/null +++ b/src/main/java/com/qsoft/erp/dominio/util/SecuenciaUtil.java @@ -0,0 +1,143 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dominio.util; + +import com.qsoft.erp.constantes.SecuenciaEnum; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.model.Secuencia; +import com.qsoft.erp.model.SucursalEmpresa; +import com.qsoft.util.constantes.CodigoRespuesta; +import com.qsoft.util.constantes.ErrorTipo; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import javax.ejb.Stateless; +import javax.transaction.Transactional; +import org.apache.commons.lang3.StringUtils; + +/** + * + * @author james + */ +@Stateless +public class SecuenciaUtil { + + public static DateFormat format = new SimpleDateFormat("yyyy"); + + /** + * Perite obtener una secuencia de acuerdo a la sucursal, retorna los datos en el siguiente orden

+ * [0].- Codigo de establecimiento + * [1].- Codigo de punto de + * [2].- Secuencial + * @param codSucursal + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public String[] getSecuenciaFacturaVenta(Integer codSucursal) throws DominioExcepcion { + return getSecuencia(codSucursal, 0); + } + + /** + * Perite obtener una secuencia de acuerdo + * + * @param codSucursal + * @return + * @throws com.qsoft.erp.dominio.exception.DominioExcepcion + */ + public String[] getSecuenciaNotaVenta(Integer codSucursal) throws DominioExcepcion { + return getSecuencia(codSucursal, 1); + } + + /** + * @param codSucursal + * @param indice + * @return + * @throws DominioExcepcion + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private String[] getSecuencia(Integer codSucursal, Integer indice) throws DominioExcepcion { + String result[] = null; + String nemonico = null; + DaoGenerico dao = new DaoGenerico<>(SucursalEmpresa.class); + if (codSucursal == null) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "El codigo de sucursal no puede ser nulo"); + } + SucursalEmpresa sucursal; + try { + sucursal = dao.cargar(codSucursal); + } catch (DaoException ex) { + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_CONSULTA_BDD, "No existe la sucursal indicada"); + } + if (indice != null) { + nemonico = sucursal.getSucSecuencial().split(";")[indice]; + } else { + nemonico = sucursal.getSucSecuencial(); + } + Secuencia sec = this.nextValue(nemonico); + Integer valor = 0; + if (sec != null && sec.getSecSecuencia() != null) { + valor = sec.getSecSecuencia(); + result = new String[3]; + result[0] = sucursal.getSucEstablecimiento(); + result[1] = sucursal.getSucPtoEmision(); + result[2] = StringUtils.leftPad(valor.toString(), sec.getSecLongitud(), "0"); + } + return result; + } + + /** + * + * @param nemonico + * @return + * @throws DominioExcepcion + */ + public String getSecuenciaString(SecuenciaEnum nemonico) throws DominioExcepcion{ + if(nemonico == null || nemonico.name() == null ||nemonico.name().isBlank()){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No se puede buscar una secuencia nula"); + } + Secuencia sec = this.nextValue(nemonico.name()); + String result = StringUtils.leftPad(sec.getSecSecuencia().toString(), sec.getSecLongitud(), "0"); + return result; + } + + /** + * + * @param nemonico + * @return + * @throws DominioExcepcion + */ + public Integer getSecuencia(SecuenciaEnum nemonico) throws DominioExcepcion{ + Integer numero = null; + if(nemonico == null || nemonico.name() == null ||nemonico.name().isBlank()){ + throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No se puede buscar una secuencia nula"); + } + Secuencia sec = this.nextValue(nemonico.name()); + numero = sec.getSecSecuencia(); + return numero; + } + + /** + * + * @param nemonico + * @return + */ + @Transactional(Transactional.TxType.REQUIRES_NEW) + private synchronized Secuencia nextValue(String nemonico) { + DaoGenerico dao = new DaoGenerico<>(Secuencia.class); + Secuencia dato = new Secuencia(); + dato.setSecNemonico(nemonico); + try { + dato = dao.buscarUnico(dato); + dato.setSecSecuencia(dato.getSecSecuencia() + 1); + dao.actualizar(dato); + } catch (DaoException ex) { + dato = null; + } + return dato; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/AgendamientoDTO.java b/src/main/java/com/qsoft/erp/dto/AgendamientoDTO.java new file mode 100644 index 0000000..cd101a4 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/AgendamientoDTO.java @@ -0,0 +1,414 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class AgendamientoDTO implements Serializable { + + private static final long serialVersionUID = 20725437083742L; + + private Integer ageCodigo; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date ageFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date ageFechaAgenda; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date ageFechaCita; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date ageFechaConfirma; + private String ageSintomas; + private Double ageValor; + private String ageTelefono; + private String ageObservaciones; + private Short ageNotificado; + private String ageEspecialidad; + private String ageMedico; + private String ageDocumentos; + private String ageAprobacion; + private String ageExamenes; + private String ageDiagnostico; + private Short agePreexistencia; + private String ageIndicaciones; + private String ageNemonico; + private String locCodigo; + private Integer perBeneficiario; + private Integer preCodigo; + private Integer polCodigo; + private Integer detTipo; + private Integer usuCodigo; + private String locNombre; + private String perNombres; + private String perApellidos; + private String perIdentificacion; + private String polContrato; + private String preNombre; + private String detNemonico; + private String detNombre; + private String usuUsuario; + private Double ageCobertura; + private String ageObservaMedico; + private Double ageFacturado; + private Double ageCubierto; + private Double ageNoCubierto; + private Double ageCopago; + private Double ageDeducible; + private String ageMailPaciente; + private List estado; + + public Integer getAgeCodigo() { + return ageCodigo; + } + + public void setAgeCodigo(Integer ageCodigo) { + this.ageCodigo = ageCodigo; + } + + public Date getAgeFechaRegistro() { + return ageFechaRegistro; + } + + public void setAgeFechaRegistro(Date ageFechaRegistro) { + this.ageFechaRegistro = ageFechaRegistro; + } + + public Date getAgeFechaAgenda() { + return ageFechaAgenda; + } + + public List getEstado() { + return estado; + } + + public String getLocNombre() { + return locNombre; + } + + public Double getAgeCobertura() { + return ageCobertura; + } + + public void setAgeCobertura(Double ageCobertura) { + this.ageCobertura = ageCobertura; + } + + public Double getAgeFacturado() { + return ageFacturado; + } + + public void setAgeFacturado(Double ageFacturado) { + this.ageFacturado = ageFacturado; + } + + public Double getAgeCubierto() { + return ageCubierto; + } + + public void setAgeCubierto(Double ageCubierto) { + this.ageCubierto = ageCubierto; + } + + public Double getAgeNoCubierto() { + return ageNoCubierto; + } + + public void setAgeNoCubierto(Double ageNoCubierto) { + this.ageNoCubierto = ageNoCubierto; + } + + public Double getAgeCopago() { + return ageCopago; + } + + public void setAgeCopago(Double ageCopago) { + this.ageCopago = ageCopago; + } + + public Double getAgeDeducible() { + return ageDeducible; + } + + public void setAgeDeducible(Double ageDeducible) { + this.ageDeducible = ageDeducible; + } + + public String getAgeObservaMedico() { + return ageObservaMedico; + } + + public void setAgeObservaMedico(String ageObservaMedico) { + this.ageObservaMedico = ageObservaMedico; + } + + public void setAgeMailPaciente(String ageMailPaciente) { + this.ageMailPaciente = ageMailPaciente; + } + + public String getAgeMailPaciente() { + return ageMailPaciente; + } + + public void setLocNombre(String locNombre) { + this.locNombre = locNombre; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public String getPreNombre() { + return preNombre; + } + + public void setPreNombre(String preNombre) { + this.preNombre = preNombre; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getUsuUsuario() { + return usuUsuario; + } + + public void setUsuUsuario(String usuUsuario) { + this.usuUsuario = usuUsuario; + } + + public void setEstado(List estado) { + this.estado = estado; + } + + public void setAgeFechaAgenda(Date ageFechaAgenda) { + this.ageFechaAgenda = ageFechaAgenda; + } + + public Date getAgeFechaCita() { + return ageFechaCita; + } + + public void setAgeFechaCita(Date ageFechaCita) { + this.ageFechaCita = ageFechaCita; + } + + public Date getAgeFechaConfirma() { + return ageFechaConfirma; + } + + public void setAgeFechaConfirma(Date ageFechaConfirma) { + this.ageFechaConfirma = ageFechaConfirma; + } + + public String getAgeSintomas() { + return ageSintomas; + } + + public void setAgeSintomas(String ageSintomas) { + this.ageSintomas = ageSintomas; + } + + public String getAgeNemonico() { + return ageNemonico; + } + + public void setAgeNemonico(String ageNemonico) { + this.ageNemonico = ageNemonico; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Double getAgeValor() { + return ageValor; + } + + public void setAgeValor(Double ageValor) { + this.ageValor = ageValor; + } + + public String getAgeTelefono() { + return ageTelefono; + } + + public void setAgeTelefono(String ageTelefono) { + this.ageTelefono = ageTelefono; + } + + public String getAgeObservaciones() { + return ageObservaciones; + } + + public void setAgeObservaciones(String ageObservaciones) { + this.ageObservaciones = ageObservaciones; + } + + public Short getAgeNotificado() { + return ageNotificado; + } + + public void setAgeNotificado(Short ageNotificado) { + this.ageNotificado = ageNotificado; + } + + public String getAgeEspecialidad() { + return ageEspecialidad; + } + + public void setAgeEspecialidad(String ageEspecialidad) { + this.ageEspecialidad = ageEspecialidad; + } + + public String getAgeMedico() { + return ageMedico; + } + + public void setAgeMedico(String ageMedico) { + this.ageMedico = ageMedico; + } + + public String getAgeDocumentos() { + return ageDocumentos; + } + + public void setAgeDocumentos(String ageDocumentos) { + this.ageDocumentos = ageDocumentos; + } + + public String getAgeAprobacion() { + return ageAprobacion; + } + + public void setAgeAprobacion(String ageAprobacion) { + this.ageAprobacion = ageAprobacion; + } + + public String getAgeExamenes() { + return ageExamenes; + } + + public void setAgeExamenes(String ageExamenes) { + this.ageExamenes = ageExamenes; + } + + public String getAgeDiagnostico() { + return ageDiagnostico; + } + + public void setAgeDiagnostico(String ageDiagnostico) { + this.ageDiagnostico = ageDiagnostico; + } + + public Short getAgePreexistencia() { + return agePreexistencia; + } + + public void setAgePreexistencia(Short agePreexistencia) { + this.agePreexistencia = agePreexistencia; + } + + public String getAgeIndicaciones() { + return ageIndicaciones; + } + + public void setAgeIndicaciones(String ageIndicaciones) { + this.ageIndicaciones = ageIndicaciones; + } + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + + public Integer getPerBeneficiario() { + return perBeneficiario; + } + + public void setPerBeneficiario(Integer perBeneficiario) { + this.perBeneficiario = perBeneficiario; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/AsientoComprobanteDTO.java b/src/main/java/com/qsoft/erp/dto/AsientoComprobanteDTO.java new file mode 100644 index 0000000..608fe4e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/AsientoComprobanteDTO.java @@ -0,0 +1,59 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class AsientoComprobanteDTO implements Serializable { + + private static final long serialVersionUID = 98301763769672L; + + private Integer ascCodigo; + + private java.util.Date asiFecha; + + private Integer asiCodigo; + + private Integer facCodigo; + + private Integer favCodigo; + + public Integer getAscCodigo() { + return ascCodigo; + } + + public void setAscCodigo(Integer ascCodigo) { + this.ascCodigo = ascCodigo; + } + + public java.util.Date getAsiFecha() { + return asiFecha; + } + + public void setAsiFecha(java.util.Date asiFecha) { + this.asiFecha = asiFecha; + } + + public Integer getAsiCodigo() { + return asiCodigo; + } + + public void setAsiCodigo(Integer asiCodigo) { + this.asiCodigo = asiCodigo; + } + + public Integer getFacCodigo() { + return facCodigo; + } + + public void setFacCodigo(Integer facCodigo) { + this.facCodigo = facCodigo; + } + + public Integer getFavCodigo() { + return favCodigo; + } + + public void setFavCodigo(Integer favCodigo) { + this.favCodigo = favCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/AsientoDTO.java b/src/main/java/com/qsoft/erp/dto/AsientoDTO.java new file mode 100644 index 0000000..20931e9 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/AsientoDTO.java @@ -0,0 +1,129 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class AsientoDTO implements Serializable { + + private static final long serialVersionUID = 272463823424971L; + + private Integer asiCodigo; + + private Integer asiCanal; + + private String asiConcepto; + + private String asiDocumento; + + private java.util.Date asiFecha; + + private Double asiImporte; + + private Integer asiNumero; + + private String asiOperacion; + + private Short asiEstado; + + private Integer diaCodigo; + + private String ejeCodigo; + + private Integer empCodigo; + + public Integer getAsiCodigo() { + return asiCodigo; + } + + public void setAsiCodigo(Integer asiCodigo) { + this.asiCodigo = asiCodigo; + } + + public Integer getAsiCanal() { + return asiCanal; + } + + public void setAsiCanal(Integer asiCanal) { + this.asiCanal = asiCanal; + } + + public String getAsiConcepto() { + return asiConcepto; + } + + public void setAsiConcepto(String asiConcepto) { + this.asiConcepto = asiConcepto; + } + + public String getAsiDocumento() { + return asiDocumento; + } + + public void setAsiDocumento(String asiDocumento) { + this.asiDocumento = asiDocumento; + } + + public java.util.Date getAsiFecha() { + return asiFecha; + } + + public void setAsiFecha(java.util.Date asiFecha) { + this.asiFecha = asiFecha; + } + + public Double getAsiImporte() { + return asiImporte; + } + + public void setAsiImporte(Double asiImporte) { + this.asiImporte = asiImporte; + } + + public Integer getAsiNumero() { + return asiNumero; + } + + public void setAsiNumero(Integer asiNumero) { + this.asiNumero = asiNumero; + } + + public String getAsiOperacion() { + return asiOperacion; + } + + public void setAsiOperacion(String asiOperacion) { + this.asiOperacion = asiOperacion; + } + + public Short getAsiEstado() { + return asiEstado; + } + + public void setAsiEstado(Short asiEstado) { + this.asiEstado = asiEstado; + } + + public Integer getDiaCodigo() { + return diaCodigo; + } + + public void setDiaCodigo(Integer diaCodigo) { + this.diaCodigo = diaCodigo; + } + + public String getEjeCodigo() { + return ejeCodigo; + } + + public void setEjeCodigo(String ejeCodigo) { + this.ejeCodigo = ejeCodigo; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/AuditoriaDTO.java b/src/main/java/com/qsoft/erp/dto/AuditoriaDTO.java new file mode 100644 index 0000000..68b5227 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/AuditoriaDTO.java @@ -0,0 +1,212 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class AuditoriaDTO implements Serializable{ + + private static final long serialVersionUID = 260611975539147L; + private static final String UNION = "', '"; + + private Integer audCodigo; + private String audDispositivo; + private String audCanal; + private String audMedio; + private String audAplicacion; + private String audTransaccion; + private String audUsuario; + private String audToken; + private String audFecha; + private String audIdioma; + private String audEmpresa; + private String audGeolocalizacion; + private String audTipoEjecucion; + private String audEntidad; + private String audEndpoint; + private String audServicio; + private String audMetodo; + private String audBackend; + private Integer audTiempoEjecucion; + private String audDinamico; + + public Integer getAudCodigo() { + return audCodigo; + } + + public void setAudCodigo(Integer audCodigo) { + this.audCodigo = audCodigo; + } + + public String getAudDispositivo() { + return audDispositivo; + } + + public void setAudDispositivo(String audDispositivo) { + this.audDispositivo = audDispositivo; + } + + public String getAudCanal() { + return audCanal; + } + + public void setAudCanal(String audCanal) { + this.audCanal = audCanal; + } + + public String getAudMedio() { + return audMedio; + } + + public void setAudMedio(String audMedio) { + this.audMedio = audMedio; + } + + public String getAudAplicacion() { + return audAplicacion; + } + + public void setAudAplicacion(String audAplicacion) { + this.audAplicacion = audAplicacion; + } + + public String getAudTransaccion() { + return audTransaccion; + } + + public void setAudTransaccion(String audTransaccion) { + this.audTransaccion = audTransaccion; + } + + public String getAudUsuario() { + return audUsuario; + } + + public void setAudUsuario(String audUsuario) { + this.audUsuario = audUsuario; + } + + public String getAudToken() { + return audToken; + } + + public void setAudToken(String audToken) { + this.audToken = audToken; + } + + public String getAudFecha() { + return audFecha; + } + + public void setAudFecha(String audFecha) { + this.audFecha = audFecha; + } + + public String getAudIdioma() { + return audIdioma; + } + + public void setAudIdioma(String audIdioma) { + this.audIdioma = audIdioma; + } + + public String getAudEmpresa() { + return audEmpresa; + } + + public void setAudEmpresa(String audEmpresa) { + this.audEmpresa = audEmpresa; + } + + public String getAudGeolocalizacion() { + return audGeolocalizacion; + } + + public void setAudGeolocalizacion(String audGeolocalizacion) { + this.audGeolocalizacion = audGeolocalizacion; + } + + public String getAudTipoEjecucion() { + return audTipoEjecucion; + } + + public void setAudTipoEjecucion(String audTipoEjecucion) { + this.audTipoEjecucion = audTipoEjecucion; + } + + public String getAudEntidad() { + return audEntidad; + } + + public void setAudEntidad(String audEntidad) { + this.audEntidad = audEntidad; + } + + public String getAudEndpoint() { + return audEndpoint; + } + + public void setAudEndpoint(String audEndpoint) { + this.audEndpoint = audEndpoint; + } + + public String getAudServicio() { + return audServicio; + } + + public void setAudServicio(String audServicio) { + this.audServicio = audServicio; + } + + public String getAudMetodo() { + return audMetodo; + } + + public void setAudMetodo(String audMetodo) { + this.audMetodo = audMetodo; + } + + public String getAudBackend() { + return audBackend; + } + + public void setAudBackend(String audBackend) { + this.audBackend = audBackend; + } + + public Integer getAudTiempoEjecucion() { + return audTiempoEjecucion; + } + + public void setAudTiempoEjecucion(Integer audTiempoEjecucion) { + this.audTiempoEjecucion = audTiempoEjecucion; + } + + public String getAudDinamico() { + return audDinamico; + } + + public void setAudDinamico(String audDinamico) { + this.audDinamico = audDinamico; + } + + @Override + public String toString() { + StringBuilder build = new StringBuilder(); + build.append("(null, '").append(audDispositivo).append(UNION).append(audCanal).append(UNION).append(audMedio); + build.append(UNION).append(audAplicacion).append(UNION).append(audTransaccion).append(UNION).append(audUsuario); + build.append(UNION).append(audToken).append(UNION).append(audFecha).append(UNION).append(audIdioma); + build.append(UNION).append(audEmpresa).append(UNION).append(audGeolocalizacion).append(UNION).append(audTipoEjecucion); + build.append(UNION).append(audEntidad).append(UNION).append(audEndpoint).append(UNION).append(audServicio).append(UNION); + build.append(audMetodo).append(UNION).append(audBackend).append("' , ").append(audTiempoEjecucion).append(", '").append(audDinamico).append("')"); + return build.toString(); + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/BodegaDTO.java b/src/main/java/com/qsoft/erp/dto/BodegaDTO.java new file mode 100644 index 0000000..6d9cdd3 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/BodegaDTO.java @@ -0,0 +1,99 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class BodegaDTO implements Serializable { + + private static final long serialVersionUID = 898493877064396L; + + private Integer bodCodigo; + + private String bodNombre; + + private String bodDireccion; + + private String bodCodPostal; + + private Double bodCapacidad; + + private String bodObservacion; + + private Short bodEstado; + + private Integer empCodigo; + + private Integer locCodigo; + + public Integer getBodCodigo() { + return bodCodigo; + } + + public void setBodCodigo(Integer bodCodigo) { + this.bodCodigo = bodCodigo; + } + + public String getBodNombre() { + return bodNombre; + } + + public void setBodNombre(String bodNombre) { + this.bodNombre = bodNombre; + } + + public String getBodDireccion() { + return bodDireccion; + } + + public void setBodDireccion(String bodDireccion) { + this.bodDireccion = bodDireccion; + } + + public String getBodCodPostal() { + return bodCodPostal; + } + + public void setBodCodPostal(String bodCodPostal) { + this.bodCodPostal = bodCodPostal; + } + + public Double getBodCapacidad() { + return bodCapacidad; + } + + public void setBodCapacidad(Double bodCapacidad) { + this.bodCapacidad = bodCapacidad; + } + + public String getBodObservacion() { + return bodObservacion; + } + + public void setBodObservacion(String bodObservacion) { + this.bodObservacion = bodObservacion; + } + + public Short getBodEstado() { + return bodEstado; + } + + public void setBodEstado(Short bodEstado) { + this.bodEstado = bodEstado; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public Integer getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(Integer locCodigo) { + this.locCodigo = locCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/CatalogoDTO.java b/src/main/java/com/qsoft/erp/dto/CatalogoDTO.java new file mode 100644 index 0000000..071ae62 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/CatalogoDTO.java @@ -0,0 +1,118 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class CatalogoDTO implements Serializable { + + private static final long serialVersionUID = 8485542727231L; + + private Integer catCodigo; + private String catNemonico; + private String catGrupo; + private String catNombre; + private String catDescripcion; + private Short catEstado; + private Integer empCodigo; + + public CatalogoDTO() { + } + + public CatalogoDTO(Integer catCodigo) { + this.catCodigo = catCodigo; + } + + public CatalogoDTO(Integer catCodigo, String catNemonico, String catGrupo, String catNombre) { + this.catCodigo = catCodigo; + this.catNemonico = catNemonico; + this.catGrupo = catGrupo; + this.catNombre = catNombre; + } + + public Integer getCatCodigo() { + return catCodigo; + } + + public void setCatCodigo(Integer catCodigo) { + this.catCodigo = catCodigo; + } + + public String getCatNemonico() { + return catNemonico; + } + + public void setCatNemonico(String catNemonico) { + this.catNemonico = catNemonico; + } + + public String getCatGrupo() { + return catGrupo; + } + + public void setCatGrupo(String catGrupo) { + this.catGrupo = catGrupo; + } + + public String getCatNombre() { + return catNombre; + } + + public void setCatNombre(String catNombre) { + this.catNombre = catNombre; + } + + public String getCatDescripcion() { + return catDescripcion; + } + + public void setCatDescripcion(String catDescripcion) { + this.catDescripcion = catDescripcion; + } + + public Short getCatEstado() { + return catEstado; + } + + public void setCatEstado(Short catEstado) { + this.catEstado = catEstado; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public int hashCode() { + int hash = 0; + hash += (catCodigo != null ? catCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CatalogoDTO)) { + return false; + } + CatalogoDTO other = (CatalogoDTO) object; + if ((this.catCodigo == null && other.catCodigo != null) || (this.catCodigo != null && !this.catCodigo.equals(other.catCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.CatalogoDTO[ catCodigo=" + catCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/CoberturasPlanDTO.java b/src/main/java/com/qsoft/erp/dto/CoberturasPlanDTO.java new file mode 100644 index 0000000..6e764ab --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/CoberturasPlanDTO.java @@ -0,0 +1,263 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class CoberturasPlanDTO implements Serializable { + + private static final long serialVersionUID = 6173436637990L; + + private Integer copCodigo; + private Double copCopago; + private Double copTope; + private Short copEstado; + private Integer detPrestacion; + private String prestacionNemonico; + private Integer detTipoModalidad; + private String modalidadNemonico; + private Integer detTipo; + private String tipoNemonico; + private Integer plaCodigo; + private Integer detPais; + private String paisNemonico; + private String modalidadNombre; + private String tipoNombre; + private String prestacionNombre; + private String paisNombre; + private String modalidadDescripcion; + private String tipoDescripcion; + private String prestacionDescripcion; + private String paisDescripcion; + private Short copTipoTarifario; + private Double copValorDeducible; + private Integer detTipoDeducible; + private String tipoDeducibleNemonico; + private String tipoDeducibleNombre; + + public Integer getCopCodigo() { + return copCodigo; + } + + public String getModalidadDescripcion() { + return modalidadDescripcion; + } + + public void setModalidadDescripcion(String modalidadDescripcion) { + this.modalidadDescripcion = modalidadDescripcion; + } + + public String getTipoDescripcion() { + return tipoDescripcion; + } + + public void setTipoDescripcion(String tipoDescripcion) { + this.tipoDescripcion = tipoDescripcion; + } + + public Short getCopTipoTarifario() { + return copTipoTarifario; + } + + public void setCopTipoTarifario(Short copTipoTarifario) { + this.copTipoTarifario = copTipoTarifario; + } + + public String getTipoDeducibleNombre() { + return tipoDeducibleNombre; + } + + public void setTipoDeducibleNombre(String tipoDeducibleNombre) { + this.tipoDeducibleNombre = tipoDeducibleNombre; + } + + public Double getCopValorDeducible() { + return copValorDeducible; + } + + public void setCopValorDeducible(Double copValorDeducible) { + this.copValorDeducible = copValorDeducible; + } + + public Integer getDetTipoDeducible() { + return detTipoDeducible; + } + + public void setDetTipoDeducible(Integer detTipoDeducible) { + this.detTipoDeducible = detTipoDeducible; + } + + public String getTipoDeducibleNemonico() { + return tipoDeducibleNemonico; + } + + public void setTipoDeducibleNemonico(String tipoDeducibleNemonico) { + this.tipoDeducibleNemonico = tipoDeducibleNemonico; + } + + public String getPrestacionDescripcion() { + return prestacionDescripcion; + } + + public void setPrestacionDescripcion(String prestacionDescripcion) { + this.prestacionDescripcion = prestacionDescripcion; + } + + public String getPaisDescripcion() { + return paisDescripcion; + } + + public void setPaisDescripcion(String paisDescripcion) { + this.paisDescripcion = paisDescripcion; + } + + public String getPrestacionNemonico() { + return prestacionNemonico; + } + + public String getModalidadNombre() { + return modalidadNombre; + } + + public void setModalidadNombre(String modalidadNombre) { + this.modalidadNombre = modalidadNombre; + } + + public String getTipoNombre() { + return tipoNombre; + } + + public void setTipoNombre(String tipoNombre) { + this.tipoNombre = tipoNombre; + } + + public String getPrestacionNombre() { + return prestacionNombre; + } + + public void setPrestacionNombre(String prestacionNombre) { + this.prestacionNombre = prestacionNombre; + } + + public String getPaisNombre() { + return paisNombre; + } + + public void setPaisNombre(String paisNombre) { + this.paisNombre = paisNombre; + } + + public void setPrestacionNemonico(String prestacionNemonico) { + this.prestacionNemonico = prestacionNemonico; + } + + public String getModalidadNemonico() { + return modalidadNemonico; + } + + public void setModalidadNemonico(String modalidadNemonico) { + this.modalidadNemonico = modalidadNemonico; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public String getPaisNemonico() { + return paisNemonico; + } + + public void setPaisNemonico(String paisNemonico) { + this.paisNemonico = paisNemonico; + } + + public void setCopCodigo(Integer copCodigo) { + this.copCodigo = copCodigo; + } + + public Double getCopCopago() { + return copCopago; + } + + public void setCopCopago(Double copCopago) { + this.copCopago = copCopago; + } + + public Double getCopTope() { + return copTope; + } + + public void setCopTope(Double copTope) { + this.copTope = copTope; + } + + public Short getCopEstado() { + return copEstado; + } + + public void setCopEstado(Short copEstado) { + this.copEstado = copEstado; + } + + public Integer getDetPrestacion() { + return detPrestacion; + } + + public void setDetPrestacion(Integer detPrestacion) { + this.detPrestacion = detPrestacion; + } + + public Integer getDetTipoModalidad() { + return detTipoModalidad; + } + + public void setDetTipoModalidad(Integer detTipoModalidad) { + this.detTipoModalidad = detTipoModalidad; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getDetPais() { + return detPais; + } + + public void setDetPais(Integer detPais) { + this.detPais = detPais; + } + + public int hashCode() { + int hash = 0; + hash += (copCodigo != null ? copCodigo.hashCode() : 0); + return hash; + } + + public String toString() { + return "com.qsoft.erp.model.CoberturasPlan[ copCodigo=" + copCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/CuentaBancariaDTO.java b/src/main/java/com/qsoft/erp/dto/CuentaBancariaDTO.java new file mode 100644 index 0000000..67f2f22 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/CuentaBancariaDTO.java @@ -0,0 +1,152 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class CuentaBancariaDTO implements Serializable { + + private static final long serialVersionUID = 8502680742813L; + + private Integer cueCodigo; + private String cueCuenta; + private Short cueEstado; + private Short cueDebito; + private Integer detIfi; + private Integer detTipoCuenta; + private Integer perCodigo; + private String detNombreIfi; + private String detNombreTipoCuenta; + private String cueIdentificacion; + private String cueNombreDebito; + + public CuentaBancariaDTO() { + } + + public CuentaBancariaDTO(Integer cueCodigo) { + this.cueCodigo = cueCodigo; + } + + public CuentaBancariaDTO(Integer cueCodigo, String cueCuenta) { + this.cueCodigo = cueCodigo; + this.cueCuenta = cueCuenta; + } + + public Integer getCueCodigo() { + return cueCodigo; + } + + public void setCueCodigo(Integer cueCodigo) { + this.cueCodigo = cueCodigo; + } + + public String getCueIdentificacion() { + return cueIdentificacion; + } + + public void setCueIdentificacion(String cueIdentificacion) { + this.cueIdentificacion = cueIdentificacion; + } + + public String getCueNombreDebito() { + return cueNombreDebito; + } + + public void setCueNombreDebito(String cueNombreDebito) { + this.cueNombreDebito = cueNombreDebito; + } + + public String getCueCuenta() { + return cueCuenta; + } + + public void setCueCuenta(String cueCuenta) { + this.cueCuenta = cueCuenta; + } + + public Short getCueDebito() { + return cueDebito; + } + + public void setCueDebito(Short cueDebito) { + this.cueDebito = cueDebito; + } + + public Short getCueEstado() { + return cueEstado; + } + + public void setCueEstado(Short cueEstado) { + this.cueEstado = cueEstado; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getDetTipoCuenta() { + return detTipoCuenta; + } + + public void setDetTipoCuenta(Integer detTipoCuenta) { + this.detTipoCuenta = detTipoCuenta; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } +/**------------------------------------Nombre de los detalles---------*/ + public String getDetNombreTipoCuenta() { + return detNombreTipoCuenta; + } + public void setDetNombreTipoCuenta(String detNombreTipoCuenta) { + this.detNombreTipoCuenta = detNombreTipoCuenta; + } + + + + public String getDetNombreIfi() { + return detNombreIfi; + } + + public void setDetNombreIfi(String detNombreIfi) { + this.detNombreIfi = detNombreIfi; + } + public int hashCode() { + int hash = 0; + hash += (cueCodigo != null ? cueCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CuentaBancariaDTO)) { + return false; + } + CuentaBancariaDTO other = (CuentaBancariaDTO) object; + if ((this.cueCodigo == null && other.cueCodigo != null) || (this.cueCodigo != null && !this.cueCodigo.equals(other.cueCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.CuentaBancariaDTO[ cueCodigo=" + cueCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/CuentaBancoDTO.java b/src/main/java/com/qsoft/erp/dto/CuentaBancoDTO.java new file mode 100644 index 0000000..ebc6292 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/CuentaBancoDTO.java @@ -0,0 +1,109 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class CuentaBancoDTO implements Serializable { + + private static final long serialVersionUID = 614583681346726L; + + private String cubCodigo; + + private String cubCodSubcuenta; + + private String cubCodsubcuentagasto; + + private String cubDescripcion; + + private String cubIban; + + private String cubSwift; + + private String cubSufijoSepa; + + private Short cubEstado; + + private Integer empCodigo; + + private Integer perCodigo; + + public String getCubCodigo() { + return cubCodigo; + } + + public void setCubCodigo(String cubCodigo) { + this.cubCodigo = cubCodigo; + } + + public String getCubCodSubcuenta() { + return cubCodSubcuenta; + } + + public void setCubCodSubcuenta(String cubCodSubcuenta) { + this.cubCodSubcuenta = cubCodSubcuenta; + } + + public String getCubCodsubcuentagasto() { + return cubCodsubcuentagasto; + } + + public void setCubCodsubcuentagasto(String cubCodsubcuentagasto) { + this.cubCodsubcuentagasto = cubCodsubcuentagasto; + } + + public String getCubDescripcion() { + return cubDescripcion; + } + + public void setCubDescripcion(String cubDescripcion) { + this.cubDescripcion = cubDescripcion; + } + + public String getCubIban() { + return cubIban; + } + + public void setCubIban(String cubIban) { + this.cubIban = cubIban; + } + + public String getCubSwift() { + return cubSwift; + } + + public void setCubSwift(String cubSwift) { + this.cubSwift = cubSwift; + } + + public String getCubSufijoSepa() { + return cubSufijoSepa; + } + + public void setCubSufijoSepa(String cubSufijoSepa) { + this.cubSufijoSepa = cubSufijoSepa; + } + + public Short getCubEstado() { + return cubEstado; + } + + public void setCubEstado(Short cubEstado) { + this.cubEstado = cubEstado; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/DetalleCatalogoDTO.java b/src/main/java/com/qsoft/erp/dto/DetalleCatalogoDTO.java new file mode 100644 index 0000000..c7bd0ed --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/DetalleCatalogoDTO.java @@ -0,0 +1,163 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class DetalleCatalogoDTO implements Serializable { + + private static final long serialVersionUID = 8527851688057L; + private Integer detCodigo; + private String detNemonico; + private String detTipo; + private String detNombre; + private String detOrigen; + private String detDestino; + private String detDescripcion; + private Short detEstado; + private Integer catCodigo; + private String catNemonico; + private String archivo; + private Integer empCodigo; + + public DetalleCatalogoDTO() { + } + + public DetalleCatalogoDTO(Integer detCodigo) { + this.detCodigo = detCodigo; + } + + public DetalleCatalogoDTO(Integer detCodigo, String detNemonico, String detNombre) { + this.detCodigo = detCodigo; + this.detNemonico = detNemonico; + this.detNombre = detNombre; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public String getCatNemonico() { + return catNemonico; + } + + public void setCatNemonico(String catNemonico) { + this.catNemonico = catNemonico; + } + + public Integer getDetCodigo() { + return detCodigo; + } + + public void setDetCodigo(Integer detCodigo) { + this.detCodigo = detCodigo; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetTipo() { + return detTipo; + } + + public void setDetTipo(String detTipo) { + this.detTipo = detTipo; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getDetOrigen() { + return detOrigen; + } + + public void setDetOrigen(String detOrigen) { + this.detOrigen = detOrigen; + } + + public String getDetDestino() { + return detDestino; + } + + public void setDetDestino(String detDestino) { + this.detDestino = detDestino; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public Short getDetEstado() { + return detEstado; + } + + public void setDetEstado(Short detEstado) { + this.detEstado = detEstado; + } + + public Integer getCatCodigo() { + return catCodigo; + } + + public void setCatCodigo(Integer catCodigo) { + this.catCodigo = catCodigo; + } + + public String getArchivo() { + return archivo; + } + + public void setArchivo(String archivo) { + this.archivo = archivo; + } + + + + public int hashCode() { + int hash = 0; + hash += (detCodigo != null ? detCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DetalleCatalogoDTO)) { + return false; + } + DetalleCatalogoDTO other = (DetalleCatalogoDTO) object; + if ((this.detCodigo == null && other.detCodigo != null) || (this.detCodigo != null && !this.detCodigo.equals(other.detCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.DetalleCatalogoDTO[ detCodigo=" + detCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/DetalleLiquidacionDTO.java b/src/main/java/com/qsoft/erp/dto/DetalleLiquidacionDTO.java new file mode 100644 index 0000000..fff9438 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/DetalleLiquidacionDTO.java @@ -0,0 +1,233 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class DetalleLiquidacionDTO implements Serializable { + + private static final long serialVersionUID = 8824628295853L; + + private List detalle; + + private Integer delCodigo; + private String delMedico; + private String delServicio; + private String delDescripcion; + private String delFactura; + private Double delValorRegistrado; + private Double delValorObjetado; + private Double delValorPagado; + private Double delCopago; + private Double delDeduciblePagado; + private Double delCopagoPagado; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date delFecha; + private Integer preCodigo; + private Integer detCie10; + private String cie10Nemonico; + private Integer detTipo; + private String tipoNemonico; + private Integer liqCodigo; + private Integer copCodigo; + private Short delEstado; + private String delFacClaveAcceso; + private String delFacAutorizacion; + + public List getDetalle() { + return detalle; + } + + public void setDetalle(List detalle) { + this.detalle = detalle; + } + + public String getCie10Nemonico() { + return cie10Nemonico; + } + + public void setCie10Nemonico(String cie10Nemonico) { + this.cie10Nemonico = cie10Nemonico; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public Integer getDelCodigo() { + return delCodigo; + } + + public void setDelCodigo(Integer delCodigo) { + this.delCodigo = delCodigo; + } + + public String getDelMedico() { + return delMedico; + } + + public void setDelMedico(String delMedico) { + this.delMedico = delMedico; + } + + public String getDelServicio() { + return delServicio; + } + + public void setDelServicio(String delServicio) { + this.delServicio = delServicio; + } + + public String getDelDescripcion() { + return delDescripcion; + } + + public void setDelDescripcion(String delDescripcion) { + this.delDescripcion = delDescripcion; + } + + public String getDelFactura() { + return delFactura; + } + + public void setDelFactura(String delFactura) { + this.delFactura = delFactura; + } + + public String getDelFacClaveAcceso() { + return delFacClaveAcceso; + } + + public void setDelFacClaveAcceso(String delFacClaveAcceso) { + this.delFacClaveAcceso = delFacClaveAcceso; + } + + public String getDelFacAutorizacion() { + return delFacAutorizacion; + } + + public void setDelFacAutorizacion(String delFacAutorizacion) { + this.delFacAutorizacion = delFacAutorizacion; + } + + + public Double getDelDeduciblePagado() { + return delDeduciblePagado; + } + + public void setDelDeduciblePagado(Double delDeduciblePagado) { + this.delDeduciblePagado = delDeduciblePagado; + } + + public Double getDelCopagoPagado() { + return delCopagoPagado; + } + + public void setDelCopagoPagado(Double delCopagoPagado) { + this.delCopagoPagado = delCopagoPagado; + } + + public Double getDelValorRegistrado() { + return delValorRegistrado; + } + + public void setDelValorRegistrado(Double delValorRegistrado) { + this.delValorRegistrado = delValorRegistrado; + } + + public Double getDelValorObjetado() { + return delValorObjetado; + } + + public void setDelValorObjetado(Double delValorObjetado) { + this.delValorObjetado = delValorObjetado; + } + + public Double getDelValorPagado() { + return delValorPagado; + } + + public void setDelValorPagado(Double delValorPagado) { + this.delValorPagado = delValorPagado; + } + + public Double getDelCopago() { + return delCopago; + } + + public void setDelCopago(Double delCopago) { + this.delCopago = delCopago; + } + + public Date getDelFecha() { + return delFecha; + } + + public void setDelFecha(Date delFecha) { + this.delFecha = delFecha; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public Integer getDetCie10() { + return detCie10; + } + + public void setDetCie10(Integer detCie10) { + this.detCie10 = detCie10; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getCopCodigo() { + return copCodigo; + } + + public void setCopCodigo(Integer copCodigo) { + this.copCodigo = copCodigo; + } + + public Short getDelEstado() { + return delEstado; + } + + public void setDelEstado(Short delEstado) { + this.delEstado = delEstado; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/DocumentoDTO.java b/src/main/java/com/qsoft/erp/dto/DocumentoDTO.java new file mode 100644 index 0000000..3e3b2f9 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/DocumentoDTO.java @@ -0,0 +1,165 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class DocumentoDTO implements Serializable { + + private static final long serialVersionUID = 8572733063343L; + + private Integer docCodigo; + private String docNombre; + private String docUrl; + private Short docEstado; + private Integer detTipo; + private Integer liqCodigo; + private Integer ageCodigo; + private Integer polCodigo; + private String documento; + private String tipoNemonico; + private String docDescripcion; + private String docObservacion; + private byte[] data; + + public DocumentoDTO() { + } + + public DocumentoDTO(Integer docCodigo) { + this.docCodigo = docCodigo; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public Integer getDocCodigo() { + return docCodigo; + } + + public void setDocCodigo(Integer docCodigo) { + this.docCodigo = docCodigo; + } + + public Integer getAgeCodigo() { + return ageCodigo; + } + + public String getDocDescripcion() { + return docDescripcion; + } + + public void setDocDescripcion(String docDescripcion) { + this.docDescripcion = docDescripcion; + } + + public String getDocObservacion() { + return docObservacion; + } + + public void setDocObservacion(String docObservacion) { + this.docObservacion = docObservacion; + } + + public void setAgeCodigo(Integer ageCodigo) { + this.ageCodigo = ageCodigo; + } + + public String getDocNombre() { + return docNombre; + } + + public void setDocNombre(String docNombre) { + this.docNombre = docNombre; + } + + public String getDocUrl() { + return docUrl; + } + + public void setDocUrl(String docUrl) { + this.docUrl = docUrl; + } + + public Short getDocEstado() { + return docEstado; + } + + public void setDocEstado(Short docEstado) { + this.docEstado = docEstado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public String getDocumento() { + return documento; + } + + public void setDocumento(String documento) { + this.documento = documento; + } + + public byte[] getData() { + return data; + } + + public void setData(byte[] data) { + this.data = data; + } + + public int hashCode() { + int hash = 0; + hash += (docCodigo != null ? docCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DocumentoDTO)) { + return false; + } + DocumentoDTO other = (DocumentoDTO) object; + if ((this.docCodigo == null && other.docCodigo != null) || (this.docCodigo != null && !this.docCodigo.equals(other.docCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.DocumentoDTO[ docCodigo=" + docCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/EmailDTO.java b/src/main/java/com/qsoft/erp/dto/EmailDTO.java new file mode 100644 index 0000000..8d338bb --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/EmailDTO.java @@ -0,0 +1,127 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class EmailDTO implements Serializable { + + private static final long serialVersionUID = 175290882980512L; + + private Integer emaCodigo; + private String emaContenido; + private String emaDestinatiario; + private String emaCopia; + private String emaCopiaOculta; + private String emaAsunto; + private String emaAdjunto; + private String emaObservacion; + private Integer parEstado; + private Integer plsmCodigo; + private Short emaIntento; + private String emaSms; + private String emaTelefono; + + public Integer getEmaCodigo() { + return emaCodigo; + } + + public void setEmaCodigo(Integer emaCodigo) { + this.emaCodigo = emaCodigo; + } + + public String getEmaContenido() { + return emaContenido; + } + + public void setEmaContenido(String emaContenido) { + this.emaContenido = emaContenido; + } + + public String getEmaDestinatiario() { + return emaDestinatiario; + } + + public void setEmaDestinatiario(String emaDestinatiario) { + this.emaDestinatiario = emaDestinatiario; + } + + public Short getEmaIntento() { + return emaIntento; + } + + public void setEmaIntento(Short emaIntento) { + this.emaIntento = emaIntento; + } + + public String getEmaSms() { + return emaSms; + } + + public void setEmaSms(String emaSms) { + this.emaSms = emaSms; + } + + public String getEmaTelefono() { + return emaTelefono; + } + + public void setEmaTelefono(String emaTelefono) { + this.emaTelefono = emaTelefono; + } + + public String getEmaCopia() { + return emaCopia; + } + + public void setEmaCopia(String emaCopia) { + this.emaCopia = emaCopia; + } + + public String getEmaCopiaOculta() { + return emaCopiaOculta; + } + + public void setEmaCopiaOculta(String emaCopiaOculta) { + this.emaCopiaOculta = emaCopiaOculta; + } + + public String getEmaAsunto() { + return emaAsunto; + } + + public void setEmaAsunto(String emaAsunto) { + this.emaAsunto = emaAsunto; + } + + public String getEmaAdjunto() { + return emaAdjunto; + } + + public void setEmaAdjunto(String emaAdjunto) { + this.emaAdjunto = emaAdjunto; + } + + public String getEmaObservacion() { + return emaObservacion; + } + + public void setEmaObservacion(String emaObservacion) { + this.emaObservacion = emaObservacion; + } + + public Integer getParEstado() { + return parEstado; + } + + public void setParEstado(Integer parEstado) { + this.parEstado = parEstado; + } + + public Integer getPlsmCodigo() { + return plsmCodigo; + } + + public void setPlsmCodigo(Integer plsmCodigo) { + this.plsmCodigo = plsmCodigo; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/EmpresaDTO.java b/src/main/java/com/qsoft/erp/dto/EmpresaDTO.java new file mode 100644 index 0000000..710d08c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/EmpresaDTO.java @@ -0,0 +1,201 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class EmpresaDTO implements Serializable { + + private static final long serialVersionUID = 8580287055553L; + + private Integer empCodigo; + private String empIdentificacion; + private String empRazonSocial; + private String empNombreComercial; + private String empContacto; + private String empDireccion; + private String empMail; + private String empTelefono; + private String empCodContribuyente; + private String empDescripcion; + private Short empLlevaContabilidad; + private Short empEstado; + private Integer detTipo; + private String tipoNemonico; + private String locCodigo; + private String locNombre; + + public EmpresaDTO() { + } + + public EmpresaDTO(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public EmpresaDTO(Integer empCodigo, String empIdentificacion, String empRazonSocial, String empNombreComercial, String empContacto) { + this.empCodigo = empCodigo; + this.empIdentificacion = empIdentificacion; + this.empRazonSocial = empRazonSocial; + this.empNombreComercial = empNombreComercial; + this.empContacto = empContacto; + } + + public String getLocNombre() { + return locNombre; + } + + public void setLocNombre(String locNombre) { + this.locNombre = locNombre; + } + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public String getEmpIdentificacion() { + return empIdentificacion; + } + + public void setEmpIdentificacion(String empIdentificacion) { + this.empIdentificacion = empIdentificacion; + } + + public String getEmpRazonSocial() { + return empRazonSocial; + } + + public void setEmpRazonSocial(String empRazonSocial) { + this.empRazonSocial = empRazonSocial; + } + + public String getEmpNombreComercial() { + return empNombreComercial; + } + + public void setEmpNombreComercial(String empNombreComercial) { + this.empNombreComercial = empNombreComercial; + } + + public String getEmpContacto() { + return empContacto; + } + + public void setEmpContacto(String empContacto) { + this.empContacto = empContacto; + } + + public String getEmpDireccion() { + return empDireccion; + } + + public void setEmpDireccion(String empDireccion) { + this.empDireccion = empDireccion; + } + + public String getEmpMail() { + return empMail; + } + + public void setEmpMail(String empMail) { + this.empMail = empMail; + } + + public String getEmpTelefono() { + return empTelefono; + } + + public void setEmpTelefono(String empTelefono) { + this.empTelefono = empTelefono; + } + + public String getEmpCodContribuyente() { + return empCodContribuyente; + } + + public void setEmpCodContribuyente(String empCodContribuyente) { + this.empCodContribuyente = empCodContribuyente; + } + + public String getEmpDescripcion() { + return empDescripcion; + } + + public void setEmpDescripcion(String empDescripcion) { + this.empDescripcion = empDescripcion; + } + + public Short getEmpLlevaContabilidad() { + return empLlevaContabilidad; + } + + public void setEmpLlevaContabilidad(Short empLlevaContabilidad) { + this.empLlevaContabilidad = empLlevaContabilidad; + } + + public Short getEmpEstado() { + return empEstado; + } + + public void setEmpEstado(Short empEstado) { + this.empEstado = empEstado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public int hashCode() { + int hash = 0; + hash += (empCodigo != null ? empCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EmpresaDTO)) { + return false; + } + EmpresaDTO other = (EmpresaDTO) object; + if ((this.empCodigo == null && other.empCodigo != null) || (this.empCodigo != null && !this.empCodigo.equals(other.empCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.EmpresaDTO[ empCodigo=" + empCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/EstadoAgendamientoDTO.java b/src/main/java/com/qsoft/erp/dto/EstadoAgendamientoDTO.java new file mode 100644 index 0000000..beaac8b --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/EstadoAgendamientoDTO.java @@ -0,0 +1,123 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class EstadoAgendamientoDTO implements Serializable{ + + private static final long serialVersionUID = 20754184219789L; + + private Integer esaCodigo; + private String esaObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date esaFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date esaFechaFin; + private Short esaEstado; + private Integer ageCodigo; + private Integer detEstado; + private Integer usuCodigo; + private String estadoNombre; + private String usuUsuario; + private String usuNombre; + + public Integer getEsaCodigo() { + return esaCodigo; + } + + public void setEsaCodigo(Integer esaCodigo) { + this.esaCodigo = esaCodigo; + } + + public String getEsaObservacion() { + return esaObservacion; + } + + public void setEsaObservacion(String esaObservacion) { + this.esaObservacion = esaObservacion; + } + + public Date getEsaFechaInicio() { + return esaFechaInicio; + } + + public String getEstadoNombre() { + return estadoNombre; + } + + public void setEstadoNombre(String estadoNombre) { + this.estadoNombre = estadoNombre; + } + + public String getUsuUsuario() { + return usuUsuario; + } + + public void setUsuUsuario(String usuUsuario) { + this.usuUsuario = usuUsuario; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public void setEsaFechaInicio(Date esaFechaInicio) { + this.esaFechaInicio = esaFechaInicio; + } + + public Date getEsaFechaFin() { + return esaFechaFin; + } + + public void setEsaFechaFin(Date esaFechaFin) { + this.esaFechaFin = esaFechaFin; + } + + public Short getEsaEstado() { + return esaEstado; + } + + public void setEsaEstado(Short esaEstado) { + this.esaEstado = esaEstado; + } + + public Integer getAgeCodigo() { + return ageCodigo; + } + + public void setAgeCodigo(Integer ageCodigo) { + this.ageCodigo = ageCodigo; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/EstadoFinancieroDTO.java b/src/main/java/com/qsoft/erp/dto/EstadoFinancieroDTO.java new file mode 100644 index 0000000..f53babd --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/EstadoFinancieroDTO.java @@ -0,0 +1,106 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class EstadoFinancieroDTO implements Serializable { + + private static final long serialVersionUID = 8587579560680L; + + private Integer esfCodigo; + private Double esfSaldo; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date esfFecha; + private Integer detEstado; + private Integer liqCodigo; + private Integer polCodigo; + + public EstadoFinancieroDTO() { + } + + public EstadoFinancieroDTO(Integer esfCodigo) { + this.esfCodigo = esfCodigo; + } + + public Integer getEsfCodigo() { + return esfCodigo; + } + + public void setEsfCodigo(Integer esfCodigo) { + this.esfCodigo = esfCodigo; + } + + public Double getEsfSaldo() { + return esfSaldo; + } + + public void setEsfSaldo(Double esfSaldo) { + this.esfSaldo = esfSaldo; + } + + public Date getEsfFecha() { + return esfFecha; + } + + public void setEsfFecha(Date esfFecha) { + this.esfFecha = esfFecha; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public int hashCode() { + int hash = 0; + hash += (esfCodigo != null ? esfCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EstadoFinancieroDTO)) { + return false; + } + EstadoFinancieroDTO other = (EstadoFinancieroDTO) object; + if ((this.esfCodigo == null && other.esfCodigo != null) || (this.esfCodigo != null && !this.esfCodigo.equals(other.esfCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.EstadoFinancieroDTO[ esfCodigo=" + esfCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/EstadoLiquidacionDTO.java b/src/main/java/com/qsoft/erp/dto/EstadoLiquidacionDTO.java new file mode 100644 index 0000000..4c69213 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/EstadoLiquidacionDTO.java @@ -0,0 +1,161 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class EstadoLiquidacionDTO implements Serializable { + + private static final long serialVersionUID = 8595714579437L; + + private Integer eslCodigo; + private String eslMensaje; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date eslFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date eslFechaFin; + private String eslObservacion; + private Short eslEstado; + private Integer detEstado; + private String estadoNemonico; + private Integer liqCodigo; + private Integer usuCodigo; + private String usuUsuario; + private String usuNombre; + + public EstadoLiquidacionDTO() { + } + + public EstadoLiquidacionDTO(Integer eslCodigo) { + this.eslCodigo = eslCodigo; + } + + public String getEstadoNemonico() { + return estadoNemonico; + } + + public void setEstadoNemonico(String estadoNemonico) { + this.estadoNemonico = estadoNemonico; + } + + public String getUsuUsuario() { + return usuUsuario; + } + + public void setUsuUsuario(String usuUsuario) { + this.usuUsuario = usuUsuario; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public Integer getEslCodigo() { + return eslCodigo; + } + + public void setEslCodigo(Integer eslCodigo) { + this.eslCodigo = eslCodigo; + } + + public String getEslMensaje() { + return eslMensaje; + } + + public void setEslMensaje(String eslMensaje) { + this.eslMensaje = eslMensaje; + } + + public Date getEslFechaInicio() { + return eslFechaInicio; + } + + public void setEslFechaInicio(Date eslFechaInicio) { + this.eslFechaInicio = eslFechaInicio; + } + + public Date getEslFechaFin() { + return eslFechaFin; + } + + public void setEslFechaFin(Date eslFechaFin) { + this.eslFechaFin = eslFechaFin; + } + + public String getEslObservacion() { + return eslObservacion; + } + + public void setEslObservacion(String eslObservacion) { + this.eslObservacion = eslObservacion; + } + + public Short getEslEstado() { + return eslEstado; + } + + public void setEslEstado(Short eslEstado) { + this.eslEstado = eslEstado; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public int hashCode() { + int hash = 0; + hash += (eslCodigo != null ? eslCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EstadoLiquidacionDTO)) { + return false; + } + EstadoLiquidacionDTO other = (EstadoLiquidacionDTO) object; + if ((this.eslCodigo == null && other.eslCodigo != null) || (this.eslCodigo != null && !this.eslCodigo.equals(other.eslCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.EstadoLiquidacionDTO[ eslCodigo=" + eslCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/FormularioDTO.java b/src/main/java/com/qsoft/erp/dto/FormularioDTO.java new file mode 100644 index 0000000..105d294 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/FormularioDTO.java @@ -0,0 +1,187 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class FormularioDTO implements Serializable { + + private static final long serialVersionUID = 5291382681995L; + + private Integer forCodigo; + private Integer empCodigo; + private Integer liqCodigo; + private Integer detTipo; + private String tipoNemonico; + private Integer perTitular; + private Integer perPaciente; + private Integer polCodigo; + private Integer cueCodigo; + private Integer detProcedimiento; + private String procedimientoNemonico; + private Integer detCie10; + private String cie10Nemonico; + private Integer plaCodigo; + private Integer preCodigo; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date forFecha; + private String forDetalle; + + public FormularioDTO() { + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public String getProcedimientoNemonico() { + return procedimientoNemonico; + } + + public void setProcedimientoNemonico(String procedimientoNemonico) { + this.procedimientoNemonico = procedimientoNemonico; + } + + public String getCie10Nemonico() { + return cie10Nemonico; + } + + public void setCie10Nemonico(String cie10Nemonico) { + this.cie10Nemonico = cie10Nemonico; + } + + public Integer getForCodigo() { + return forCodigo; + } + + public void setForCodigo(Integer forCodigo) { + this.forCodigo = forCodigo; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getPerTitular() { + return perTitular; + } + + public void setPerTitular(Integer perTitular) { + this.perTitular = perTitular; + } + + public Integer getPerPaciente() { + return perPaciente; + } + + public void setPerPaciente(Integer perPaciente) { + this.perPaciente = perPaciente; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getCueCodigo() { + return cueCodigo; + } + + public void setCueCodigo(Integer cueCodigo) { + this.cueCodigo = cueCodigo; + } + + public Integer getDetProcedimiento() { + return detProcedimiento; + } + + public void setDetProcedimiento(Integer detProcedimiento) { + this.detProcedimiento = detProcedimiento; + } + + public Integer getDetCie10() { + return detCie10; + } + + public void setDetCie10(Integer detCie10) { + this.detCie10 = detCie10; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public Date getForFecha() { + return forFecha; + } + + public void setForFecha(Date forFecha) { + this.forFecha = forFecha; + } + + public String getForDetalle() { + return forDetalle; + } + + public void setForDetalle(String forDetalle) { + this.forDetalle = forDetalle; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (forCodigo != null ? forCodigo.hashCode() : 0); + return hash; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/HonorarioDTO.java b/src/main/java/com/qsoft/erp/dto/HonorarioDTO.java new file mode 100644 index 0000000..26614c7 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/HonorarioDTO.java @@ -0,0 +1,97 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class HonorarioDTO implements Serializable { + + private static final long serialVersionUID = 6173436637990L; + + private Integer honCodigo; + private String honCodhon; + private String honDescripcion; + private Double honUnidad; + private Double honAnestecia; + private String honObservacion; + private Short honEstado; + private Integer detGrupo; + + public Integer getHonCodigo() { + return honCodigo; + } + + public void setHonCodigo(Integer honCodigo) { + this.honCodigo = honCodigo; + } + + public String getHonCodhon() { + return honCodhon; + } + + public void setHonCodhon(String honCodhon) { + this.honCodhon = honCodhon; + } + + public String getHonDescripcion() { + return honDescripcion; + } + + public void setHonDescripcion(String honDescripcion) { + this.honDescripcion = honDescripcion; + } + + public Double getHonUnidad() { + return honUnidad; + } + + public void setHonUnidad(Double honUnidad) { + this.honUnidad = honUnidad; + } + + public Double getHonAnestecia() { + return honAnestecia; + } + + public void setHonAnestecia(Double honAnestecia) { + this.honAnestecia = honAnestecia; + } + + public String getHonObservacion() { + return honObservacion; + } + + public void setHonObservacion(String honObservacion) { + this.honObservacion = honObservacion; + } + + public Short getHonEstado() { + return honEstado; + } + + public void setHonEstado(Short honEstado) { + this.honEstado = honEstado; + } + + public Integer getDetGrupo() { + return detGrupo; + } + + public void setDetGrupo(Integer detGrupo) { + this.detGrupo = detGrupo; + } + + @Override + public int hashCode() { + return super.hashCode(); //To change body of generated methods, choose Tools | Templates. + } + + +} diff --git a/src/main/java/com/qsoft/erp/dto/HonorarioPlanDTO.java b/src/main/java/com/qsoft/erp/dto/HonorarioPlanDTO.java new file mode 100644 index 0000000..c376530 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/HonorarioPlanDTO.java @@ -0,0 +1,87 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class HonorarioPlanDTO implements Serializable { + + private static final long serialVersionUID = 6173436637990L; + + private Integer hopCodigo; + private Double hopValor; + private Double hopMinimo; + private Double hopMaximo; + private Short hopEstado; + private Integer plaCodigo; + private Integer detAtencion; + + public Integer getHopCodigo() { + return hopCodigo; + } + + public void setHopCodigo(Integer hopCodigo) { + this.hopCodigo = hopCodigo; + } + + public Double getHopValor() { + return hopValor; + } + + public void setHopValor(Double hopValor) { + this.hopValor = hopValor; + } + + public Double getHopMinimo() { + return hopMinimo; + } + + public void setHopMinimo(Double hopMinimo) { + this.hopMinimo = hopMinimo; + } + + public Double getHopMaximo() { + return hopMaximo; + } + + public void setHopMaximo(Double hopMaximo) { + this.hopMaximo = hopMaximo; + } + + public Short getHopEstado() { + return hopEstado; + } + + public void setHopEstado(Short hopEstado) { + this.hopEstado = hopEstado; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getDetAtencion() { + return detAtencion; + } + + public void setDetAtencion(Integer detAtencion) { + this.detAtencion = detAtencion; + } + + @Override + public int hashCode() { + return super.hashCode(); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/LiquidacionDTO.java b/src/main/java/com/qsoft/erp/dto/LiquidacionDTO.java new file mode 100644 index 0000000..3733c09 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/LiquidacionDTO.java @@ -0,0 +1,360 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class LiquidacionDTO implements Serializable { + + private static final long serialVersionUID = 8627160099801L; + + private Integer liqCodigo; + private String liqNemonico; + private String liqObservacionAfiliado; + private String liqObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaFin; + private Double liqCopago; + private Double liqDeducible; + private Double liqTotalLiquidado; + private String liqComprobantePago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaPago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaIncurrencia; + private Short liqCalificacion; + private Integer cueOrigen; + private Integer cueDestino; + private Integer detTipo; + private Integer detIfi; + private Integer detAtencion; + private String atencionNombre; + private Integer polCodigo; + private Integer perBeneficiario; + private String beneficiarioNombre; + private String beneficiarioIdentificacion; + private String beneficiarioApellido; + private String tipoNemonico; + private String ifiNemonico; + private String liqReporte; + private String liqRetencion; + private Double liqObjetado; + private Double liqRegistrado; + private List documentos; + private List estados; + + public LiquidacionDTO() { + } + + public LiquidacionDTO(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public LiquidacionDTO(Integer liqCodigo, String liqNemonico) { + this.liqCodigo = liqCodigo; + this.liqNemonico = liqNemonico; + } + + public String getBeneficiarioNombre() { + return beneficiarioNombre; + } + + public void setBeneficiarioNombre(String beneficiarioNombre) { + this.beneficiarioNombre = beneficiarioNombre; + } + + public String getAtencionNombre() { + return atencionNombre; + } + + public void setAtencionNombre(String atencionNombre) { + this.atencionNombre = atencionNombre; + } + + public String getBeneficiarioIdentificacion() { + return beneficiarioIdentificacion; + } + + public Date getLiqFechaIncurrencia() { + return liqFechaIncurrencia; + } + + public void setLiqFechaIncurrencia(Date liqFechaIncurrencia) { + this.liqFechaIncurrencia = liqFechaIncurrencia; + } + + public void setBeneficiarioIdentificacion(String beneficiarioIdentificacion) { + this.beneficiarioIdentificacion = beneficiarioIdentificacion; + } + + public String getBeneficiarioApellido() { + return beneficiarioApellido; + } + + public void setBeneficiarioApellido(String beneficiarioApellido) { + this.beneficiarioApellido = beneficiarioApellido; + } + + public Integer getDetAtencion() { + return detAtencion; + } + + public void setDetAtencion(Integer detAtencion) { + this.detAtencion = detAtencion; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public String getIfiNemonico() { + return ifiNemonico; + } + + public void setIfiNemonico(String ifiNemonico) { + this.ifiNemonico = ifiNemonico; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public String getLiqNemonico() { + return liqNemonico; + } + + public void setLiqNemonico(String liqNemonico) { + this.liqNemonico = liqNemonico; + } + + public Integer getPerBeneficiario() { + return perBeneficiario; + } + + public void setPerBeneficiario(Integer perBeneficiario) { + this.perBeneficiario = perBeneficiario; + } + + + public String getLiqObservacionAfiliado() { + return liqObservacionAfiliado; + } + + public void setLiqObservacionAfiliado(String liqObservacionAfiliado) { + this.liqObservacionAfiliado = liqObservacionAfiliado; + } + + public String getLiqObservacion() { + return liqObservacion; + } + + public void setLiqObservacion(String liqObservacion) { + this.liqObservacion = liqObservacion; + } + + public Date getLiqFechaInicio() { + return liqFechaInicio; + } + + public void setLiqFechaInicio(Date liqFechaInicio) { + this.liqFechaInicio = liqFechaInicio; + } + + public Date getLiqFechaFin() { + return liqFechaFin; + } + + public void setLiqFechaFin(Date liqFechaFin) { + this.liqFechaFin = liqFechaFin; + } + + public Double getLiqCopago() { + return liqCopago; + } + + public void setLiqCopago(Double liqCopago) { + this.liqCopago = liqCopago; + } + + public Double getLiqDeducible() { + return liqDeducible; + } + + public void setLiqDeducible(Double liqDeducible) { + this.liqDeducible = liqDeducible; + } + + public Double getLiqTotalLiquidado() { + return liqTotalLiquidado; + } + + public void setLiqTotalLiquidado(Double liqTotalLiquidado) { + this.liqTotalLiquidado = liqTotalLiquidado; + } + + public String getLiqComprobantePago() { + return liqComprobantePago; + } + + public void setLiqComprobantePago(String liqComprobantePago) { + this.liqComprobantePago = liqComprobantePago; + } + + public Date getLiqFechaPago() { + return liqFechaPago; + } + + public void setLiqFechaPago(Date liqFechaPago) { + this.liqFechaPago = liqFechaPago; + } + + public Short getLiqCalificacion() { + return liqCalificacion; + } + + public void setLiqCalificacion(Short liqCalificacion) { + this.liqCalificacion = liqCalificacion; + } + + public Date getLiqFechaRegistro() { + return liqFechaRegistro; + } + + public void setLiqFechaRegistro(Date liqFechaRegistro) { + this.liqFechaRegistro = liqFechaRegistro; + } + + public Integer getCueOrigen() { + return cueOrigen; + } + + public void setCueOrigen(Integer cueOrigen) { + this.cueOrigen = cueOrigen; + } + + public Integer getCueDestino() { + return cueDestino; + } + + public void setCueDestino(Integer cueDestino) { + this.cueDestino = cueDestino; + } + + public String getLiqReporte() { + return liqReporte; + } + + public void setLiqReporte(String liqReporte) { + this.liqReporte = liqReporte; + } + + public String getLiqRetencion() { + return liqRetencion; + } + + public void setLiqRetencion(String liqRetencion) { + this.liqRetencion = liqRetencion; + } + + public Double getLiqObjetado() { + return liqObjetado; + } + + public void setLiqObjetado(Double liqObjetado) { + this.liqObjetado = liqObjetado; + } + + public Double getLiqRegistrado() { + return liqRegistrado; + } + + public void setLiqRegistrado(Double liqRegistrado) { + this.liqRegistrado = liqRegistrado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public List getDocumentos() { + return documentos; + } + + public void setDocumentos(List documentos) { + this.documentos = documentos; + } + + public List getEstados() { + return estados; + } + + public void setEstados(List estados) { + this.estados = estados; + } + + public int hashCode() { + int hash = 0; + hash += (liqCodigo != null ? liqCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof LiquidacionDTO)) { + return false; + } + LiquidacionDTO other = (LiquidacionDTO) object; + if ((this.liqCodigo == null && other.liqCodigo != null) || (this.liqCodigo != null && !this.liqCodigo.equals(other.liqCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.LiquidacionDTO[ liqCodigo=" + liqCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/LocalizacionDTO.java b/src/main/java/com/qsoft/erp/dto/LocalizacionDTO.java new file mode 100644 index 0000000..a21ec8a --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/LocalizacionDTO.java @@ -0,0 +1,73 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class LocalizacionDTO implements Serializable { + + private static final long serialVersionUID = 966363095674413L; + + private String locCodigo; + private String locCodigoDpa; + private String locCodigoIso; + private String locNombre; + private String locDescripcion; + private Short locEstado; + private String locPadre; + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + + public String getLocCodigoDpa() { + return locCodigoDpa; + } + + public void setLocCodigoDpa(String locCodigoDpa) { + this.locCodigoDpa = locCodigoDpa; + } + + public String getLocCodigoIso() { + return locCodigoIso; + } + + public void setLocCodigoIso(String locCodigoIso) { + this.locCodigoIso = locCodigoIso; + } + + public String getLocNombre() { + return locNombre; + } + + public void setLocNombre(String locNombre) { + this.locNombre = locNombre; + } + + public String getLocDescripcion() { + return locDescripcion; + } + + public void setLocDescripcion(String locDescripcion) { + this.locDescripcion = locDescripcion; + } + + public Short getLocEstado() { + return locEstado; + } + + public void setLocEstado(Short locEstado) { + this.locEstado = locEstado; + } + + public String getLocPadre() { + return locPadre; + } + + public void setLocPadre(String locPadre) { + this.locPadre = locPadre; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/MensajeDTO.java b/src/main/java/com/qsoft/erp/dto/MensajeDTO.java new file mode 100644 index 0000000..e35721e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/MensajeDTO.java @@ -0,0 +1,109 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class MensajeDTO implements Serializable { + + private static final long serialVersionUID = 58348140055992L; + + private Integer menCodigo; + + private String menNemonico; + + private String menNombre; + + private String menMensaje; + + private Short menEstado; + + private Integer detIdioma; + + private Integer detAplicacion; + + private Integer detServicio; + + private Integer detTipoMensaje; + + private Integer empCodigo; + + public Integer getMenCodigo() { + return menCodigo; + } + + public void setMenCodigo(Integer menCodigo) { + this.menCodigo = menCodigo; + } + + public String getMenNemonico() { + return menNemonico; + } + + public void setMenNemonico(String menNemonico) { + this.menNemonico = menNemonico; + } + + public String getMenNombre() { + return menNombre; + } + + public void setMenNombre(String menNombre) { + this.menNombre = menNombre; + } + + public String getMenMensaje() { + return menMensaje; + } + + public void setMenMensaje(String menMensaje) { + this.menMensaje = menMensaje; + } + + public Short getMenEstado() { + return menEstado; + } + + public void setMenEstado(Short menEstado) { + this.menEstado = menEstado; + } + + public Integer getDetIdioma() { + return detIdioma; + } + + public void setDetIdioma(Integer detIdioma) { + this.detIdioma = detIdioma; + } + + public Integer getDetAplicacion() { + return detAplicacion; + } + + public void setDetAplicacion(Integer detAplicacion) { + this.detAplicacion = detAplicacion; + } + + public Integer getDetServicio() { + return detServicio; + } + + public void setDetServicio(Integer detServicio) { + this.detServicio = detServicio; + } + + public Integer getDetTipoMensaje() { + return detTipoMensaje; + } + + public void setDetTipoMensaje(Integer detTipoMensaje) { + this.detTipoMensaje = detTipoMensaje; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/OpcionDTO.java b/src/main/java/com/qsoft/erp/dto/OpcionDTO.java new file mode 100644 index 0000000..0196888 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/OpcionDTO.java @@ -0,0 +1,165 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.List; + +/** + * + * @author james + */ +public class OpcionDTO implements Serializable { + + private static final long serialVersionUID = 8635484234618L; + + private Integer opcCodigo; + private String opcNemonico; + private String opcNombre; + private String opcDescripcion; + private String opcEjecucion; + private String opcComando; + private String opcIcono; + private Short opcEstado; + private Integer detTipo; + private Integer opcPadre; + private Short opcOrden; + private List items; + + public OpcionDTO() { + } + + public OpcionDTO(Integer opcCodigo) { + this.opcCodigo = opcCodigo; + } + + public OpcionDTO(Integer opcCodigo, String opcNemonico, String opcNombre, String opcEjecucion, String opcComando) { + this.opcCodigo = opcCodigo; + this.opcNemonico = opcNemonico; + this.opcNombre = opcNombre; + this.opcEjecucion = opcEjecucion; + this.opcComando = opcComando; + } + + public Integer getOpcCodigo() { + return opcCodigo; + } + + public void setOpcCodigo(Integer opcCodigo) { + this.opcCodigo = opcCodigo; + } + + public String getOpcNemonico() { + return opcNemonico; + } + + public void setOpcNemonico(String opcNemonico) { + this.opcNemonico = opcNemonico; + } + + public String getOpcNombre() { + return opcNombre; + } + + public void setOpcNombre(String opcNombre) { + this.opcNombre = opcNombre; + } + + public String getOpcDescripcion() { + return opcDescripcion; + } + + public void setOpcDescripcion(String opcDescripcion) { + this.opcDescripcion = opcDescripcion; + } + + public String getOpcEjecucion() { + return opcEjecucion; + } + + public void setOpcEjecucion(String opcEjecucion) { + this.opcEjecucion = opcEjecucion; + } + + public String getOpcComando() { + return opcComando; + } + + public void setOpcComando(String opcComando) { + this.opcComando = opcComando; + } + + public Short getOpcEstado() { + return opcEstado; + } + + public void setOpcEstado(Short opcEstado) { + this.opcEstado = opcEstado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getOpcPadre() { + return opcPadre; + } + + public void setOpcPadre(Integer opcPadre) { + this.opcPadre = opcPadre; + } + + public String getOpcIcono() { + return opcIcono; + } + + public void setOpcIcono(String opcIcono) { + this.opcIcono = opcIcono; + } + + public Short getOpcOrden() { + return opcOrden; + } + + public void setOpcOrden(Short opcOrden) { + this.opcOrden = opcOrden; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public int hashCode() { + int hash = 0; + hash += (opcCodigo != null ? opcCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof OpcionDTO)) { + return false; + } + OpcionDTO other = (OpcionDTO) object; + if ((this.opcCodigo == null && other.opcCodigo != null) || (this.opcCodigo != null && !this.opcCodigo.equals(other.opcCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.OpcionDTO[ opcCodigo=" + opcCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/OtpDTO.java b/src/main/java/com/qsoft/erp/dto/OtpDTO.java new file mode 100644 index 0000000..ac59307 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/OtpDTO.java @@ -0,0 +1,119 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class OtpDTO implements Serializable { + + private static final long serialVersionUID = 983979791259759L; + + private Integer otpCodigo; + + private String optUuid; + + private String optValor; + + private Integer otpTiempoVida; + + private Integer otpIntentos; + + private Integer otpMaxIntentos; + + private java.util.Date otpFechaRegistro; + + private java.util.Date otpFechaNotificacion; + + private java.util.Date otpFechaValidacion; + + private Integer parEstado; + + private Integer parTipo; + + public Integer getOtpCodigo() { + return otpCodigo; + } + + public void setOtpCodigo(Integer otpCodigo) { + this.otpCodigo = otpCodigo; + } + + public String getOptUuid() { + return optUuid; + } + + public void setOptUuid(String optUuid) { + this.optUuid = optUuid; + } + + public String getOptValor() { + return optValor; + } + + public void setOptValor(String optValor) { + this.optValor = optValor; + } + + public Integer getOtpTiempoVida() { + return otpTiempoVida; + } + + public void setOtpTiempoVida(Integer otpTiempoVida) { + this.otpTiempoVida = otpTiempoVida; + } + + public Integer getOtpIntentos() { + return otpIntentos; + } + + public void setOtpIntentos(Integer otpIntentos) { + this.otpIntentos = otpIntentos; + } + + public Integer getOtpMaxIntentos() { + return otpMaxIntentos; + } + + public void setOtpMaxIntentos(Integer otpMaxIntentos) { + this.otpMaxIntentos = otpMaxIntentos; + } + + public java.util.Date getOtpFechaRegistro() { + return otpFechaRegistro; + } + + public void setOtpFechaRegistro(java.util.Date otpFechaRegistro) { + this.otpFechaRegistro = otpFechaRegistro; + } + + public java.util.Date getOtpFechaNotificacion() { + return otpFechaNotificacion; + } + + public void setOtpFechaNotificacion(java.util.Date otpFechaNotificacion) { + this.otpFechaNotificacion = otpFechaNotificacion; + } + + public java.util.Date getOtpFechaValidacion() { + return otpFechaValidacion; + } + + public void setOtpFechaValidacion(java.util.Date otpFechaValidacion) { + this.otpFechaValidacion = otpFechaValidacion; + } + + public Integer getParEstado() { + return parEstado; + } + + public void setParEstado(Integer parEstado) { + this.parEstado = parEstado; + } + + public Integer getParTipo() { + return parTipo; + } + + public void setParTipo(Integer parTipo) { + this.parTipo = parTipo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/PagoDTO.java b/src/main/java/com/qsoft/erp/dto/PagoDTO.java new file mode 100644 index 0000000..6360e6c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PagoDTO.java @@ -0,0 +1,205 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class PagoDTO implements Serializable { + + private static final long serialVersionUID = 8652492283424L; + + private Integer pagCodigo; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date pagFechaPago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date pagFechaVencimiento; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date pagFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date pagNotificacionPago; + + private Double pagMonto; + private Integer detEstado; + private Integer polCodigo; + private Double pagAuxiliar; + private Double pagOffset; + private Integer pagFacOdo; + private String pagObservacion; + private String detNemonico; + private String detNombre; + private String polContrato; + private Short pagNumPago; + + public PagoDTO() { + } + + public Short getPagNumPago() { + return pagNumPago; + } + + public void setPagNumPago(Short pagNumPago) { + this.pagNumPago = pagNumPago; + } + + public PagoDTO(Integer pagCodigo) { + this.pagCodigo = pagCodigo; + } + + public PagoDTO(Integer pagCodigo, Double pagMonto) { + this.pagCodigo = pagCodigo; + this.pagMonto = pagMonto; + } + + public Integer getPagCodigo() { + return pagCodigo; + } + + public void setPagCodigo(Integer pagCodigo) { + this.pagCodigo = pagCodigo; + } + + public Date getPagFechaPago() { + return pagFechaPago; + } + + public void setPagFechaPago(Date pagFechaPago) { + this.pagFechaPago = pagFechaPago; + } + + public Date getPagFechaVencimiento() { + return pagFechaVencimiento; + } + + public void setPagFechaVencimiento(Date pagFechaVencimiento) { + this.pagFechaVencimiento = pagFechaVencimiento; + } + + public Date getPagFechaRegistro() { + return pagFechaRegistro; + } + + public void setPagFechaRegistro(Date pagFechaRegistro) { + this.pagFechaRegistro = pagFechaRegistro; + } + + public Date getPagNotificacionPago() { + return pagNotificacionPago; + } + + public void setPagNotificacionPago(Date pagNotificacionPago) { + this.pagNotificacionPago = pagNotificacionPago; + } + + public Double getPagMonto() { + return pagMonto; + } + + public void setPagMonto(Double pagMonto) { + this.pagMonto = pagMonto; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public Integer getPagFacOdo() { + return pagFacOdo; + } + + public void setPagFacOdo(Integer pagFacOdo) { + this.pagFacOdo = pagFacOdo; + } + + public String getPagObservacion() { + return pagObservacion; + } + + public void setPagObservacion(String pagObservacion) { + this.pagObservacion = pagObservacion; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Double getPagAuxiliar() { + return pagAuxiliar; + } + + public void setPagAuxiliar(Double pagAuxiliar) { + this.pagAuxiliar = pagAuxiliar; + } + + public Double getPagOffset() { + return pagOffset; + } + + public void setPagOffset(Double pagOffset) { + this.pagOffset = pagOffset; + } + + public int hashCode() { + int hash = 0; + hash += (pagCodigo != null ? pagCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PagoDTO)) { + return false; + } + PagoDTO other = (PagoDTO) object; + if ((this.pagCodigo == null && other.pagCodigo != null) || (this.pagCodigo != null && !this.pagCodigo.equals(other.pagCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.PagoDTO[ pagCodigo=" + pagCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PaisCoberturaDTO.java b/src/main/java/com/qsoft/erp/dto/PaisCoberturaDTO.java new file mode 100644 index 0000000..f98a00d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PaisCoberturaDTO.java @@ -0,0 +1,57 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class PaisCoberturaDTO implements Serializable { + + private static final long serialVersionUID = 1L; + private Integer pacCodigo; + private Double pacMontoCobertura; + private Integer detPais; + private Integer plaCodigo; + + public Integer getPacCodigo() { + return pacCodigo; + } + + public void setPacCodigo(Integer pacCodigo) { + this.pacCodigo = pacCodigo; + } + + public Double getPacMontoCobertura() { + return pacMontoCobertura; + } + + public void setPacMontoCobertura(Double pacMontoCobertura) { + this.pacMontoCobertura = pacMontoCobertura; + } + + public Integer getDetPais() { + return detPais; + } + + public void setDetPais(Integer detPais) { + this.detPais = detPais; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + public String toString() { + return "com.qsoft.erp.model.PaisCobertura[ pacCodigo=" + pacCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/ParametroDTO.java b/src/main/java/com/qsoft/erp/dto/ParametroDTO.java new file mode 100644 index 0000000..f8c4f11 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/ParametroDTO.java @@ -0,0 +1,89 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class ParametroDTO implements Serializable { + + private static final long serialVersionUID = 493685414718469L; + + private Integer parCodigo; + + private String parNemonico; + + private String parTipo; + + private String parNombre; + + private String parDescripcion; + + private String parValor; + + private Short parEstado; + + private Integer parCodigoPadre; + + public Integer getParCodigo() { + return parCodigo; + } + + public void setParCodigo(Integer parCodigo) { + this.parCodigo = parCodigo; + } + + public String getParNemonico() { + return parNemonico; + } + + public void setParNemonico(String parNemonico) { + this.parNemonico = parNemonico; + } + + public String getParTipo() { + return parTipo; + } + + public void setParTipo(String parTipo) { + this.parTipo = parTipo; + } + + public String getParNombre() { + return parNombre; + } + + public void setParNombre(String parNombre) { + this.parNombre = parNombre; + } + + public String getParDescripcion() { + return parDescripcion; + } + + public void setParDescripcion(String parDescripcion) { + this.parDescripcion = parDescripcion; + } + + public String getParValor() { + return parValor; + } + + public void setParValor(String parValor) { + this.parValor = parValor; + } + + public Short getParEstado() { + return parEstado; + } + + public void setParEstado(Short parEstado) { + this.parEstado = parEstado; + } + + public Integer getParCodigoPadre() { + return parCodigoPadre; + } + + public void setParCodigoPadre(Integer parCodigoPadre) { + this.parCodigoPadre = parCodigoPadre; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/PersonaDTO.java b/src/main/java/com/qsoft/erp/dto/PersonaDTO.java new file mode 100644 index 0000000..cc0ad09 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PersonaDTO.java @@ -0,0 +1,237 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class PersonaDTO implements Serializable { + + private static final long serialVersionUID = 8663999764160L; + + private Integer perCodigo; + private String perIdentificacion; + private String perNombres; + private String perApellidos; + private String perNacionalidad; + private String perMail; + private Short perEstado; + private Integer detTipoIdentificacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaRegistro; + private String perDireccion; + private Integer detGenero; + private Integer detEstadoPoliza; + + private String locCodigo; + private String locNombre; + private Integer perIdOdo; + private String perDinamico; + private List telefono; + private List cuentasBancarias; + + public PersonaDTO() { + } + + public PersonaDTO(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public PersonaDTO(Integer perCodigo, String perIdentificacion, String perNombres, String perApellidos, String perNacionalidad, String perMail) { + this.perCodigo = perCodigo; + this.perIdentificacion = perIdentificacion; + this.perNombres = perNombres; + this.perApellidos = perApellidos; + this.perNacionalidad = perNacionalidad; + this.perMail = perMail; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public List getTelefono() { + return telefono; + } + + public void setTelefono(List telefono) { + this.telefono = telefono; + } + + public String getPerDinamico() { + return perDinamico; + } + + public void setPerDinamico(String perDinamico) { + this.perDinamico = perDinamico; + } + + public Integer getPerIdOdo() { + return perIdOdo; + } + + public void setPerIdOdo(Integer perIdOdo) { + this.perIdOdo = perIdOdo; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerNacionalidad() { + return perNacionalidad; + } + + public void setPerNacionalidad(String perNacionalidad) { + this.perNacionalidad = perNacionalidad; + } + + public String getPerMail() { + return perMail; + } + + public void setPerMail(String perMail) { + this.perMail = perMail; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public Integer getDetEstadoPoliza() { + return detEstadoPoliza; + } + + public void setDetEstadoPoliza(Integer detEstadoPoliza) { + this.detEstadoPoliza = detEstadoPoliza; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public Date getPerFechaRegistro() { + return perFechaRegistro; + } + + public void setPerFechaRegistro(Date perFechaRegistro) { + this.perFechaRegistro = perFechaRegistro; + } + + public String getPerDireccion() { + return perDireccion; + } + + public void setPerDireccion(String perDireccion) { + this.perDireccion = perDireccion; + } + + public Integer getDetGenero() { + return detGenero; + } + + public void setDetGenero(Integer detGenero) { + this.detGenero = detGenero; + } + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + + public String getLocNombre() { + return locNombre; + } + + public void setLocNombre(String locNombre) { + this.locNombre = locNombre; + } + + public int hashCode() { + int hash = 0; + hash += (perCodigo != null ? perCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PersonaDTO)) { + return false; + } + PersonaDTO other = (PersonaDTO) object; + if ((this.perCodigo == null && other.perCodigo != null) || (this.perCodigo != null && !this.perCodigo.equals(other.perCodigo))) { + return false; + } + return true; + } + + public List getCuentasBancarias() { + return cuentasBancarias; + } + + public void setCuentasBancarias(List cuentasBancarias) { + this.cuentasBancarias = cuentasBancarias; + } + + + + public String toString() { + return "com.qsoft.erp.model.PersonaDTO[ perCodigo=" + perCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PersonaPolizaDTO.java b/src/main/java/com/qsoft/erp/dto/PersonaPolizaDTO.java new file mode 100644 index 0000000..8ccf050 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PersonaPolizaDTO.java @@ -0,0 +1,235 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class PersonaPolizaDTO implements Serializable { + + private static final long serialVersionUID = 8672590293563L; + + private Integer pepCodigo; + private String pepObservacion; + private Short pepEstado; + private Integer detTipoPersona; + private Integer perCodigo; + private Integer polCodigo; + private String polContrato; + private String perIdentificacion; + private String perNombres; + private String perApellidos; + private String perNacionalidad; + private String perMail; + private Short perEstado; + private Integer detTipoIdentificacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + private String perDireccion; + private Integer perGenero; + private Double pepMontoCobertura; + private List dependientes; + private List pagos; + + public PersonaPolizaDTO() { + } + + public PersonaPolizaDTO(Integer pepCodigo) { + this.pepCodigo = pepCodigo; + } + + public Integer getPepCodigo() { + return pepCodigo; + } + + public void setPepCodigo(Integer pepCodigo) { + this.pepCodigo = pepCodigo; + } + + public String getPepObservacion() { + return pepObservacion; + } + + public void setPepObservacion(String pepObservacion) { + this.pepObservacion = pepObservacion; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + + public Short getPepEstado() { + return pepEstado; + } + + public void setPepEstado(Short pepEstado) { + this.pepEstado = pepEstado; + } + + public Integer getDetTipoPersona() { + return detTipoPersona; + } + + public void setDetTipoPersona(Integer detTipoPersona) { + this.detTipoPersona = detTipoPersona; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerNacionalidad() { + return perNacionalidad; + } + + public void setPerNacionalidad(String perNacionalidad) { + this.perNacionalidad = perNacionalidad; + } + + public String getPerMail() { + return perMail; + } + + public void setPerMail(String perMail) { + this.perMail = perMail; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public String getPerDireccion() { + return perDireccion; + } + + public void setPerDireccion(String perDireccion) { + this.perDireccion = perDireccion; + } + + public Integer getPerGenero() { + return perGenero; + } + + public void setPerGenero(Integer perGenero) { + this.perGenero = perGenero; + } + + public int hashCode() { + int hash = 0; + hash += (pepCodigo != null ? pepCodigo.hashCode() : 0); + return hash; + } + + public List getDependientes() { + return dependientes; + } + + public void setDependientes(List dependientes) { + this.dependientes = dependientes; + } + + public List getPagos() { + return pagos; + } + + public void setPagos(List pagos) { + this.pagos = pagos; + } + + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PersonaPolizaDTO)) { + return false; + } + PersonaPolizaDTO other = (PersonaPolizaDTO) object; + if ((this.pepCodigo == null && other.pepCodigo != null) || (this.pepCodigo != null && !this.pepCodigo.equals(other.pepCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.PersonaPolizaDTO[ pepCodigo=" + pepCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PlanBrokerDTO.java b/src/main/java/com/qsoft/erp/dto/PlanBrokerDTO.java new file mode 100644 index 0000000..2eef9c6 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PlanBrokerDTO.java @@ -0,0 +1,158 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class PlanBrokerDTO implements Serializable { + + private static final long serialVersionUID = 31951907067348L; + + private Integer plbCodigo; + private Double plbDescuento; + private Double plbOferta; + private String plbObservacion; + private Short plbEstado; + private Integer empCodigo; + private String empIdentificacion; + private String empRazonSocial; + private Integer plaCodigo; + private String plaNombre; + private String plaProducto; + private Double plaValorAnual; + private Double plaValorMensual; + + public PlanBrokerDTO() { + } + + public Integer getPlbCodigo() { + return plbCodigo; + } + + public void setPlbCodigo(Integer plbCodigo) { + this.plbCodigo = plbCodigo; + } + + public Double getPlbDescuento() { + return plbDescuento; + } + + public void setPlbDescuento(Double plbDescuento) { + this.plbDescuento = plbDescuento; + } + + public Double getPlbOferta() { + return plbOferta; + } + + public void setPlbOferta(Double plbOferta) { + this.plbOferta = plbOferta; + } + + public String getPlbObservacion() { + return plbObservacion; + } + + public void setPlbObservacion(String plbObservacion) { + this.plbObservacion = plbObservacion; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public Short getPlbEstado() { + return plbEstado; + } + + public void setPlbEstado(Short plbEstado) { + this.plbEstado = plbEstado; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public String getEmpIdentificacion() { + return empIdentificacion; + } + + public void setEmpIdentificacion(String empIdentificacion) { + this.empIdentificacion = empIdentificacion; + } + + public String getEmpRazonSocial() { + return empRazonSocial; + } + + public void setEmpRazonSocial(String empRazonSocial) { + this.empRazonSocial = empRazonSocial; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PlanBrokerDTO)) { + return false; + } + PlanBrokerDTO other = (PlanBrokerDTO) object; + if ((this.plbCodigo == null && other.plbCodigo != null) || (this.plbCodigo != null && !this.plbCodigo.equals(other.plbCodigo))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.qsoft.erp.model.PlanBroker[ plbCodigo=" + plbCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PlanDTO.java b/src/main/java/com/qsoft/erp/dto/PlanDTO.java new file mode 100644 index 0000000..18fc591 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PlanDTO.java @@ -0,0 +1,250 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.List; + +/** + * + * @author james + */ +public class PlanDTO implements Serializable { + + private static final long serialVersionUID = 1L; + private Integer plaCodigo; + private String plaNombre; + private String plaTipo; + private String plaCodExt; + private Double plaCoberturaMaxima; + private Double plaValorDeducible; + private String plaRutaContrato; + private Double plaImpuesto; + private Double plaValorAnual; + private Double plaValorMensual; + private Double plaPorDescuento; + private Integer plaEdadHijos; + private Integer plaEdadminTitular; + private Integer plaEdadTitular; + private Integer plaNumBeneficiarios; + private String plaProducto; + private String plaCodAcess; + private Short plaEstado; + private Integer detTipo; + private Integer detModalidad; + private Integer detDeducible; + private Integer detTarifario; + private Integer empCodigo; + private Integer plaBroker; + private List coberturasPlan; + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaTipo() { + return plaTipo; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public void setPlaTipo(String plaTipo) { + this.plaTipo = plaTipo; + } + + public String getPlaCodExt() { + return plaCodExt; + } + + public void setPlaCodExt(String plaCodExt) { + this.plaCodExt = plaCodExt; + } + + + public Double getPlaCoberturaMaxima() { + return plaCoberturaMaxima; + } + + public void setPlaCoberturaMaxima(Double plaCoberturaMaxima) { + this.plaCoberturaMaxima = plaCoberturaMaxima; + } + + public Double getPlaValorDeducible() { + return plaValorDeducible; + } + + public void setPlaValorDeducible(Double plaValorDeducible) { + this.plaValorDeducible = plaValorDeducible; + } + + public String getPlaRutaContrato() { + return plaRutaContrato; + } + + public void setPlaRutaContrato(String plaRutaContrato) { + this.plaRutaContrato = plaRutaContrato; + } + + public Double getPlaImpuesto() { + return plaImpuesto; + } + + public void setPlaImpuesto(Double plaImpuesto) { + this.plaImpuesto = plaImpuesto; + } + + + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaEdadHijos() { + return plaEdadHijos; + } + + public void setPlaEdadHijos(Integer plaEdadHijos) { + this.plaEdadHijos = plaEdadHijos; + } + + + + public Integer getPlaEdadTitular() { + return plaEdadTitular; + } + public Integer getPlaEdadminTitular() { + return plaEdadminTitular; + } + public void setPlaEdadminTitular(Integer plaEdadminTitular) { + this.plaEdadminTitular = plaEdadminTitular; + } + + public void setPlaEdadTitular(Integer plaEdadTitular) { + this.plaEdadTitular = plaEdadTitular; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public String getPlaCodAcess() { + return plaCodAcess; + } + + public void setPlaCodAcess(String plaCodAcess) { + this.plaCodAcess = plaCodAcess; + } + + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public Integer getDetTarifario() { + return detTarifario; + } + + public void setDetTarifario(Integer detTarifario) { + this.detTarifario = detTarifario; + } + + public Integer getPlaBroker() { + return plaBroker; + } + + public void setPlaBroker(Integer plaBroker) { + this.plaBroker = plaBroker; + } + + public void setCoberturasPlan(List coberturasPlan) { + this.coberturasPlan = coberturasPlan; + } + + public List getCoberturasPlan() { + return coberturasPlan; + } + + + +} diff --git a/src/main/java/com/qsoft/erp/dto/PlantillaDTO.java b/src/main/java/com/qsoft/erp/dto/PlantillaDTO.java new file mode 100644 index 0000000..1794e46 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PlantillaDTO.java @@ -0,0 +1,79 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class PlantillaDTO implements Serializable { + + private static final long serialVersionUID = 713616506110191L; + + private Integer plaCodigo; + + private String plaNemonico; + + private String plaNombre; + + private String plaAsunto; + + private String plaParametros; + + private String plaRuta; + + private Short plaEstado; + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public String getPlaNemonico() { + return plaNemonico; + } + + public void setPlaNemonico(String plaNemonico) { + this.plaNemonico = plaNemonico; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaAsunto() { + return plaAsunto; + } + + public void setPlaAsunto(String plaAsunto) { + this.plaAsunto = plaAsunto; + } + + public String getPlaParametros() { + return plaParametros; + } + + public void setPlaParametros(String plaParametros) { + this.plaParametros = plaParametros; + } + + public String getPlaRuta() { + return plaRuta; + } + + public void setPlaRuta(String plaRuta) { + this.plaRuta = plaRuta; + } + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/PlantillaSmtpDTO.java b/src/main/java/com/qsoft/erp/dto/PlantillaSmtpDTO.java new file mode 100644 index 0000000..09012f0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PlantillaSmtpDTO.java @@ -0,0 +1,49 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class PlantillaSmtpDTO implements Serializable { + + private static final long serialVersionUID = 424728409894505L; + + private Integer plsmCodigo; + + private String plsmObservacion; + + private Integer parCodigo; + + private Integer plaCodigo; + + public Integer getPlsmCodigo() { + return plsmCodigo; + } + + public void setPlsmCodigo(Integer plsmCodigo) { + this.plsmCodigo = plsmCodigo; + } + + public String getPlsmObservacion() { + return plsmObservacion; + } + + public void setPlsmObservacion(String plsmObservacion) { + this.plsmObservacion = plsmObservacion; + } + + public Integer getParCodigo() { + return parCodigo; + } + + public void setParCodigo(Integer parCodigo) { + this.parCodigo = parCodigo; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/PolizaDTO.java b/src/main/java/com/qsoft/erp/dto/PolizaDTO.java new file mode 100644 index 0000000..3a466f6 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PolizaDTO.java @@ -0,0 +1,408 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class PolizaDTO implements Serializable { + + private static final long serialVersionUID = 8683413129147L; + + private Integer polCodigo; + private String polObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaFin; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polNotificacionPago; + private String polBroker; + private Integer polDiasCobertura; + private String polContrato; + private String polCertificado; + private String polDebito; + private Integer detModalidad; + private Integer detPeriodicidad; + private Integer detSucursalIfi; + private Integer plaCodigo; + private Integer detFormaPago; + private Integer empCodigo; + private String poliza; + private String polOrigen; + private String polDescripcion; + private Short polEstado; + private String formaPagoNemonico; + private Integer detEstado; + private String estadoNemonico; + private String modalidadNemonico; + private String periodicidadNemonico; + private String perCedulaTitular; + private Integer detTipoIdentificacion; + private Integer detIfi; + private Integer detTipoCuenta; + private Integer detPromocion; + private String cedulaDebito; + private String cuentaDebito; + private String polAceptacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaAcepta; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaCancela; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaCambio; + public PolizaDTO() { + } + + public String getModalidadNemonico() { + return modalidadNemonico; + } + + public Date getPolFechaCancela() { + return polFechaCancela; + } + + public void setPolFechaCancela(Date polFechaCancela) { + this.polFechaCancela = polFechaCancela; + } + + public Date getPolFechaCambio() { + return polFechaCambio; + } + + public void setPolFechaCambio(Date polFechaCambio) { + this.polFechaCambio = polFechaCambio; + } + + public void setModalidadNemonico(String modalidadNemonico) { + this.modalidadNemonico = modalidadNemonico; + } + + public String getPeriodicidadNemonico() { + return periodicidadNemonico; + } + + public String getFormaPagoNemonico() { + return formaPagoNemonico; + } + + public void setFormaPagoNemonico(String formaPagoNemonico) { + this.formaPagoNemonico = formaPagoNemonico; + } + + public Integer getDetSucursalIfi() { + return detSucursalIfi; + } + + public void setDetSucursalIfi(Integer detSucursalIfi) { + this.detSucursalIfi = detSucursalIfi; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public String getPolOrigen() { + return polOrigen; + } + + public void setPolOrigen(String polOrigen) { + this.polOrigen = polOrigen; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetFormaPago() { + return detFormaPago; + } + + public void setDetFormaPago(Integer detFormaPago) { + this.detFormaPago = detFormaPago; + } + + public String getPerCedulaTitular() { + return perCedulaTitular; + } + + public void setPerCedulaTitular(String perCedulaTitular) { + this.perCedulaTitular = perCedulaTitular; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public Integer getDetPromocion() { + return detPromocion; + } + + public void setDetPromocion(Integer detPromocion) { + this.detPromocion = detPromocion; + } + + public String getCedulaDebito() { + return cedulaDebito; + } + + public void setCedulaDebito(String cedulaDebito) { + this.cedulaDebito = cedulaDebito; + } + + public String getCuentaDebito() { + return cuentaDebito; + } + + public void setCuentaDebito(String cuentaDebito) { + this.cuentaDebito = cuentaDebito; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public void setPeriodicidadNemonico(String periodicidadNemonico) { + this.periodicidadNemonico = periodicidadNemonico; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public PolizaDTO(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public String getPolDebito() { + return polDebito; + } + + public void setPolDebito(String polDebito) { + this.polDebito = polDebito; + } + + public String getPolAceptacion() { + return polAceptacion; + } + + public void setPolAceptacion(String polAceptacion) { + this.polAceptacion = polAceptacion; + } + + public Date getPolFechaAcepta() { + return polFechaAcepta; + } + + public void setPolFechaAcepta(Date polFechaAcepta) { + this.polFechaAcepta = polFechaAcepta; + } + + public Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public Date getPolNotificacionPago() { + return polNotificacionPago; + } + + public void setPolNotificacionPago(Date polNotificacionPago) { + this.polNotificacionPago = polNotificacionPago; + } + +// +// public String getEstadoNemonico() { +// return estadoNemonico; +// } +// +// public void setEstadoNemonico(String estadoNemonico) { +// this.estadoNemonico = estadoNemonico; +// } +// +// public Integer getDetEstado() { +// return detEstado; +// } +// +// public void setDetEstado(Integer detEstado) { +// this.detEstado = detEstado; +// } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetPeriodicidad() { + return detPeriodicidad; + } + + public void setDetPeriodicidad(Integer detPeriodicidad) { + this.detPeriodicidad = detPeriodicidad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (polCodigo != null ? polCodigo.hashCode() : 0); + return hash; + } + + public String getPolBroker() { + return polBroker; + } + + public void setPolBroker(String polBroker) { + this.polBroker = polBroker; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public String getPolCertificado() { + return polCertificado; + } + + public void setPolCertificado(String polCertificado) { + this.polCertificado = polCertificado; + } + + public String getPoliza() { + return poliza; + } + + public void setPoliza(String poliza) { + this.poliza = poliza; + } + + public Integer getDetTipoCuenta() { + return detTipoCuenta; + } + + public void setDetTipoCuenta(Integer detTipoCuenta) { + this.detTipoCuenta = detTipoCuenta; + } + + public String getPolDescripcion() { + return polDescripcion; + } + + public void setPolDescripcion(String polDescripcion) { + this.polDescripcion = polDescripcion; + } + + public Short getPolEstado() { + return polEstado; + } + + public void setPolEstado(Short polEstado) { + this.polEstado = polEstado; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public String getEstadoNemonico() { + return estadoNemonico; + } + + public void setEstadoNemonico(String estadoNemonico) { + this.estadoNemonico = estadoNemonico; + } + + + + @Override + public boolean equals(Object object) { + if (!(object instanceof PolizaDTO)) { + return false; + } + PolizaDTO other = (PolizaDTO) object; + return !((this.polCodigo == null && other.polCodigo != null) || (this.polCodigo != null && !this.polCodigo.equals(other.polCodigo))); + } + + @Override + public String toString() { + return "com.qsoft.erp.model.PolizaDTO[ polCodigo=" + polCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PrestadorDTO.java b/src/main/java/com/qsoft/erp/dto/PrestadorDTO.java new file mode 100644 index 0000000..992c9bd --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PrestadorDTO.java @@ -0,0 +1,208 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class PrestadorDTO implements Serializable { + + private static final long serialVersionUID = 13001259622372L; + private Integer preCodigo; + private Integer detTipo; + private String preTipo; + private String preNombre; + private String preRuc; + private String preCuenta; + private String preRazonSocial; + private String locCodigo; + private String locNombre; + private String preDireccion; + private String preDinamico; + private String preObservacion; + private String tipoNemonico; + private Integer detTipoCuenta; + private String tipoCuentaNombre; + private String tipoCuentanemonico; + private Integer detIfi; + private String ifiNombre; + private String ifiNemonico; + + public PrestadorDTO() { + } + + public PrestadorDTO(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public String getPreTipo() { + return preTipo; + } + + public void setPreTipo(String preTipo) { + this.preTipo = preTipo; + } + + public String getPreNombre() { + return preNombre; + } + + public void setPreNombre(String preNombre) { + this.preNombre = preNombre; + } + + public String getPreCuenta() { + return preCuenta; + } + + public void setPreCuenta(String preCuenta) { + this.preCuenta = preCuenta; + } + + public Integer getDetTipoCuenta() { + return detTipoCuenta; + } + + public void setDetTipoCuenta(Integer detTipoCuenta) { + this.detTipoCuenta = detTipoCuenta; + } + + public String getTipoCuentaNombre() { + return tipoCuentaNombre; + } + + public void setTipoCuentaNombre(String tipoCuentaNombre) { + this.tipoCuentaNombre = tipoCuentaNombre; + } + + public String getTipoCuentanemonico() { + return tipoCuentanemonico; + } + + public void setTipoCuentanemonico(String tipoCuentanemonico) { + this.tipoCuentanemonico = tipoCuentanemonico; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public String getIfiNombre() { + return ifiNombre; + } + + public void setIfiNombre(String ifiNombre) { + this.ifiNombre = ifiNombre; + } + + public String getIfiNemonico() { + return ifiNemonico; + } + + public void setIfiNemonico(String ifiNemonico) { + this.ifiNemonico = ifiNemonico; + } + + public String getPreDinamico() { + return preDinamico; + } + + public void setPreDinamico(String preDinamico) { + this.preDinamico = preDinamico; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + + public String getLocNombre() { + return locNombre; + } + + public void setLocNombre(String locNombre) { + this.locNombre = locNombre; + } + + public String getPreDireccion() { + return preDireccion; + } + + public void setPreDireccion(String preDireccion) { + this.preDireccion = preDireccion; + } + + public String getPreObservacion() { + return preObservacion; + } + + public void setPreObservacion(String preObservacion) { + this.preObservacion = preObservacion; + } + + public String getPreRuc() { + return preRuc; + } + + public void setPreRuc(String preRuc) { + this.preRuc = preRuc; + } + + public String getPreRazonSocial() { + return preRazonSocial; + } + + public void setPreRazonSocial(String preRazonSocial) { + this.preRazonSocial = preRazonSocial; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (preCodigo != null ? preCodigo.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.qsoft.erp.model.Prestadores[ preCodigo=" + preCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/PrivilegioDTO.java b/src/main/java/com/qsoft/erp/dto/PrivilegioDTO.java new file mode 100644 index 0000000..b3911b0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/PrivilegioDTO.java @@ -0,0 +1,212 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author james + */ +public class PrivilegioDTO implements Serializable { + + private static final long serialVersionUID = 667874517413151L; + + private Integer priCodigo; + private Integer priLectura; + private Integer priEscritura; + private Integer priCreacion; + private Integer priActualizacion; + private String priDescripcion; + private Boolean priReqConfirmacion; + private Short priEstado; + private Integer opcCodigo; + private Integer opcPadre; + private Integer rolCodigo; + private String opcNemonico; + private String opcNombre; + private String opcDescripcion; + private String opcEjecucion; + private String opcComando; + private String opcIcono; + private List submenu; + + public Integer getPriCodigo() { + return priCodigo; + } + + public void setPriCodigo(Integer priCodigo) { + this.priCodigo = priCodigo; + } + + public Integer getPriLectura() { + return priLectura; + } + + public void setPriLectura(Integer priLectura) { + this.priLectura = priLectura; + } + + public Integer getPriEscritura() { + return priEscritura; + } + + public void setPriEscritura(Integer priEscritura) { + this.priEscritura = priEscritura; + } + + public Integer getPriCreacion() { + return priCreacion; + } + + public void setPriCreacion(Integer priCreacion) { + this.priCreacion = priCreacion; + } + + public Integer getPriActualizacion() { + return priActualizacion; + } + + public void setPriActualizacion(Integer priActualizacion) { + this.priActualizacion = priActualizacion; + } + + public String getPriDescripcion() { + return priDescripcion; + } + + public void setPriDescripcion(String priDescripcion) { + this.priDescripcion = priDescripcion; + } + + public Boolean getPriReqConfirmacion() { + return priReqConfirmacion; + } + + public void setPriReqConfirmacion(Boolean priReqConfirmacion) { + this.priReqConfirmacion = priReqConfirmacion; + } + + public Short getPriEstado() { + return priEstado; + } + + public void setPriEstado(Short priEstado) { + this.priEstado = priEstado; + } + + public Integer getOpcCodigo() { + return opcCodigo; + } + + public void setOpcCodigo(Integer opcCodigo) { + this.opcCodigo = opcCodigo; + } + + public Integer getRolCodigo() { + return rolCodigo; + } + + public void setRolCodigo(Integer rolCodigo) { + this.rolCodigo = rolCodigo; + } + + public String getOpcNemonico() { + return opcNemonico; + } + + public void setOpcNemonico(String opcNemonico) { + this.opcNemonico = opcNemonico; + } + + public String getOpcNombre() { + return opcNombre; + } + + public void setOpcNombre(String opcNombre) { + this.opcNombre = opcNombre; + } + + public String getOpcDescripcion() { + return opcDescripcion; + } + + public void setOpcDescripcion(String opcDescripcion) { + this.opcDescripcion = opcDescripcion; + } + + public String getOpcComando() { + return opcComando; + } + + public void setOpcComando(String opcComando) { + this.opcComando = opcComando; + } + + public String getOpcEjecucion() { + return opcEjecucion; + } + + public void setOpcEjecucion(String opcEjecucion) { + this.opcEjecucion = opcEjecucion; + } + + public Integer getOpcPadre() { + return opcPadre; + } + + public void setOpcPadre(Integer opcPadre) { + this.opcPadre = opcPadre; + } + + public String getOpcIcono() { + return opcIcono; + } + + public void setOpcIcono(String opcIcono) { + this.opcIcono = opcIcono; + } + + public List getSubmenu() { + return submenu; + } + + public void setSubmenu(List submenu) { + this.submenu = submenu; + } + + /** + * + * @return + * @throws CloneNotSupportedException + */ + @Override + public Object clone() throws CloneNotSupportedException { + PrivilegioDTO pvd = new PrivilegioDTO(); + pvd.setOpcCodigo(opcCodigo); + pvd.setOpcComando(opcComando); + pvd.setOpcDescripcion(opcDescripcion); + pvd.setOpcEjecucion(opcEjecucion); + pvd.setOpcIcono(opcIcono); + pvd.setOpcNemonico(opcNemonico); + pvd.setOpcNombre(opcNombre); + pvd.setOpcPadre(opcPadre); + pvd.setPriActualizacion(priActualizacion); + pvd.setPriCodigo(priCodigo); + pvd.setPriCreacion(priCreacion); + pvd.setPriDescripcion(priDescripcion); + pvd.setPriEscritura(priEscritura); + pvd.setPriEstado(priEstado); + pvd.setPriLectura(priLectura); + pvd.setPriReqConfirmacion(priReqConfirmacion); + pvd.setSubmenu(new ArrayList<>()); + return pvd; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/ProveedorDTO.java b/src/main/java/com/qsoft/erp/dto/ProveedorDTO.java new file mode 100644 index 0000000..13624c6 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/ProveedorDTO.java @@ -0,0 +1,148 @@ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; + +public class ProveedorDTO implements Serializable { + + private static final long serialVersionUID = 715457446842463L; + + private Integer proCodigo; + private String proIdentificacion; + private String proRazonSocial; + private String proNombreComercial; + private String proContacto; + private String proDireccion; + private String proMail; + private String proDescripcion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private java.util.Date proFechaRegistro; + private String proDinamico; + private Short proEstado; + private Integer detTipoIdentificacion; + private Integer empCodigo; + private String fopCodigo; + private String locCodigo; + + public Integer getProCodigo() { + return proCodigo; + } + + public void setProCodigo(Integer proCodigo) { + this.proCodigo = proCodigo; + } + + public String getProIdentificacion() { + return proIdentificacion; + } + + public void setProIdentificacion(String proIdentificacion) { + this.proIdentificacion = proIdentificacion; + } + + public String getProRazonSocial() { + return proRazonSocial; + } + + public void setProRazonSocial(String proRazonSocial) { + this.proRazonSocial = proRazonSocial; + } + + public String getProNombreComercial() { + return proNombreComercial; + } + + public void setProNombreComercial(String proNombreComercial) { + this.proNombreComercial = proNombreComercial; + } + + public String getProContacto() { + return proContacto; + } + + public void setProContacto(String proContacto) { + this.proContacto = proContacto; + } + + public String getProDireccion() { + return proDireccion; + } + + public void setProDireccion(String proDireccion) { + this.proDireccion = proDireccion; + } + + public String getProMail() { + return proMail; + } + + public void setProMail(String proMail) { + this.proMail = proMail; + } + + public String getProDescripcion() { + return proDescripcion; + } + + public void setProDescripcion(String proDescripcion) { + this.proDescripcion = proDescripcion; + } + + public java.util.Date getProFechaRegistro() { + return proFechaRegistro; + } + + public void setProFechaRegistro(java.util.Date proFechaRegistro) { + this.proFechaRegistro = proFechaRegistro; + } + + public String getProDinamico() { + return proDinamico; + } + + public void setProDinamico(String proDinamico) { + this.proDinamico = proDinamico; + } + + public Short getProEstado() { + return proEstado; + } + + public void setProEstado(Short proEstado) { + this.proEstado = proEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public String getFopCodigo() { + return fopCodigo; + } + + public void setFopCodigo(String fopCodigo) { + this.fopCodigo = fopCodigo; + } + + public String getLocCodigo() { + return locCodigo; + } + + public void setLocCodigo(String locCodigo) { + this.locCodigo = locCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/RolDTO.java b/src/main/java/com/qsoft/erp/dto/RolDTO.java new file mode 100644 index 0000000..85ef5ab --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/RolDTO.java @@ -0,0 +1,100 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.List; + +/** + * + * @author james + */ +public class RolDTO implements Serializable { + + private static final long serialVersionUID = 8726989555139L; + + private Integer rolCodigo; + private String rolNemonico; + private String rolNombre; + private Short rolEstado; + private List opciones; + + public RolDTO() { + } + + public RolDTO(Integer rolCodigo) { + this.rolCodigo = rolCodigo; + } + + public RolDTO(Integer rolCodigo, String rolNemonico, String rolNombre) { + this.rolCodigo = rolCodigo; + this.rolNemonico = rolNemonico; + this.rolNombre = rolNombre; + } + + public Integer getRolCodigo() { + return rolCodigo; + } + + public void setRolCodigo(Integer rolCodigo) { + this.rolCodigo = rolCodigo; + } + + public String getRolNemonico() { + return rolNemonico; + } + + public void setRolNemonico(String rolNemonico) { + this.rolNemonico = rolNemonico; + } + + public String getRolNombre() { + return rolNombre; + } + + public void setRolNombre(String rolNombre) { + this.rolNombre = rolNombre; + } + + public Short getRolEstado() { + return rolEstado; + } + + public void setRolEstado(Short rolEstado) { + this.rolEstado = rolEstado; + } + + public List getOpciones() { + return opciones; + } + + public void setOpciones(List opciones) { + this.opciones = opciones; + } + + public int hashCode() { + int hash = 0; + hash += (rolCodigo != null ? rolCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RolDTO)) { + return false; + } + RolDTO other = (RolDTO) object; + if ((this.rolCodigo == null && other.rolCodigo != null) || (this.rolCodigo != null && !this.rolCodigo.equals(other.rolCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.RolDTO[ rolCodigo=" + rolCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/RolUsuarioDTO.java b/src/main/java/com/qsoft/erp/dto/RolUsuarioDTO.java new file mode 100644 index 0000000..2315f6a --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/RolUsuarioDTO.java @@ -0,0 +1,79 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class RolUsuarioDTO implements Serializable { + + private static final long serialVersionUID = 16262489024909L; + + private Integer rouCodigo; + private String rouDescripcion; + private Date rouFecha; + private Short rouEstado; + private Integer rolCodigo; + private Integer usuCodigo; + + public Integer getRouCodigo() { + return rouCodigo; + } + + public void setRouCodigo(Integer rouCodigo) { + this.rouCodigo = rouCodigo; + } + + public String getRouDescripcion() { + return rouDescripcion; + } + + public void setRouDescripcion(String rouDescripcion) { + this.rouDescripcion = rouDescripcion; + } + + public Date getRouFecha() { + return rouFecha; + } + + public void setRouFecha(Date rouFecha) { + this.rouFecha = rouFecha; + } + + public Short getRouEstado() { + return rouEstado; + } + + public void setRouEstado(Short rouEstado) { + this.rouEstado = rouEstado; + } + + public Integer getRolCodigo() { + return rolCodigo; + } + + public void setRolCodigo(Integer rolCodigo) { + this.rolCodigo = rolCodigo; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + + public String toString() { + return "com.qsoft.erp.model.RolUsuario[ rouCodigo=" + rouCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/SecuenciaDTO.java b/src/main/java/com/qsoft/erp/dto/SecuenciaDTO.java new file mode 100644 index 0000000..b372a4e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/SecuenciaDTO.java @@ -0,0 +1,59 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class SecuenciaDTO implements Serializable { + + private static final long serialVersionUID = 937950315039621L; + + private Integer secCodigo; + + private String secNemonico; + + private String secNombre; + + private Integer secSecuencia; + + private Short secEstado; + + public Integer getSecCodigo() { + return secCodigo; + } + + public void setSecCodigo(Integer secCodigo) { + this.secCodigo = secCodigo; + } + + public String getSecNemonico() { + return secNemonico; + } + + public void setSecNemonico(String secNemonico) { + this.secNemonico = secNemonico; + } + + public String getSecNombre() { + return secNombre; + } + + public void setSecNombre(String secNombre) { + this.secNombre = secNombre; + } + + public Integer getSecSecuencia() { + return secSecuencia; + } + + public void setSecSecuencia(Integer secSecuencia) { + this.secSecuencia = secSecuencia; + } + + public Short getSecEstado() { + return secEstado; + } + + public void setSecEstado(Short secEstado) { + this.secEstado = secEstado; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/ServiciosDTO.java b/src/main/java/com/qsoft/erp/dto/ServiciosDTO.java new file mode 100644 index 0000000..144869c --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/ServiciosDTO.java @@ -0,0 +1,108 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class ServiciosDTO implements Serializable { + + private static final long serialVersionUID = 8734431095504L; + + private Integer serCodigo; + private Double serValor; + private Date serFechaActivacion; + private String serDescripcion; + private Integer detCodigo; + private Integer polCodigo; + + public ServiciosDTO() { + } + + public ServiciosDTO(Integer serCodigo) { + this.serCodigo = serCodigo; + } + + public ServiciosDTO(Integer serCodigo, String serDescripcion) { + this.serCodigo = serCodigo; + this.serDescripcion = serDescripcion; + } + + public Integer getSerCodigo() { + return serCodigo; + } + + public void setSerCodigo(Integer serCodigo) { + this.serCodigo = serCodigo; + } + + public Double getSerValor() { + return serValor; + } + + public void setSerValor(Double serValor) { + this.serValor = serValor; + } + + public Date getSerFechaActivacion() { + return serFechaActivacion; + } + + public void setSerFechaActivacion(Date serFechaActivacion) { + this.serFechaActivacion = serFechaActivacion; + } + + public String getSerDescripcion() { + return serDescripcion; + } + + public void setSerDescripcion(String serDescripcion) { + this.serDescripcion = serDescripcion; + } + + public Integer getDetCodigo() { + return detCodigo; + } + + public void setDetCodigo(Integer detCodigo) { + this.detCodigo = detCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public int hashCode() { + int hash = 0; + hash += (serCodigo != null ? serCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ServiciosDTO)) { + return false; + } + ServiciosDTO other = (ServiciosDTO) object; + if ((this.serCodigo == null && other.serCodigo != null) || (this.serCodigo != null && !this.serCodigo.equals(other.serCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.ServiciosDTO[ serCodigo=" + serCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/SucursalEmpresaDTO.java b/src/main/java/com/qsoft/erp/dto/SucursalEmpresaDTO.java new file mode 100644 index 0000000..f74e49d --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/SucursalEmpresaDTO.java @@ -0,0 +1,109 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class SucursalEmpresaDTO implements Serializable { + + private static final long serialVersionUID = 621372468721854L; + + private Integer sucCodigo; + + private String sucDireccion; + + private String sucContacto; + + private String sucMail; + + private String sucEstablecimiento; + + private String sucPtoEmision; + + private String sucSecuencial; + + private String sucDescripcion; + + private Short sucEstado; + + private Integer empCodigo; + + public Integer getSucCodigo() { + return sucCodigo; + } + + public void setSucCodigo(Integer sucCodigo) { + this.sucCodigo = sucCodigo; + } + + public String getSucDireccion() { + return sucDireccion; + } + + public void setSucDireccion(String sucDireccion) { + this.sucDireccion = sucDireccion; + } + + public String getSucContacto() { + return sucContacto; + } + + public void setSucContacto(String sucContacto) { + this.sucContacto = sucContacto; + } + + public String getSucMail() { + return sucMail; + } + + public void setSucMail(String sucMail) { + this.sucMail = sucMail; + } + + public String getSucEstablecimiento() { + return sucEstablecimiento; + } + + public void setSucEstablecimiento(String sucEstablecimiento) { + this.sucEstablecimiento = sucEstablecimiento; + } + + public String getSucPtoEmision() { + return sucPtoEmision; + } + + public void setSucPtoEmision(String sucPtoEmision) { + this.sucPtoEmision = sucPtoEmision; + } + + public String getSucSecuencial() { + return sucSecuencial; + } + + public void setSucSecuencial(String sucSecuencial) { + this.sucSecuencial = sucSecuencial; + } + + public String getSucDescripcion() { + return sucDescripcion; + } + + public void setSucDescripcion(String sucDescripcion) { + this.sucDescripcion = sucDescripcion; + } + + public Short getSucEstado() { + return sucEstado; + } + + public void setSucEstado(Short sucEstado) { + this.sucEstado = sucEstado; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/TarifaLiquidacionDTO.java b/src/main/java/com/qsoft/erp/dto/TarifaLiquidacionDTO.java new file mode 100644 index 0000000..8faf4a7 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/TarifaLiquidacionDTO.java @@ -0,0 +1,242 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class TarifaLiquidacionDTO implements Serializable { + + private static final long serialVersionUID = 8743569107502L; + + private Integer talCodigo; + private String talDescripcion; + private String tarObservacion; + private Double talCantidad; + private Double talCantidadAutorizada; + private Double talValorRegistrado; + private Double talValorObjetado; + private Double talValorPagado; + private Short talEstado; + private Integer delCodigo; + private Integer tarCodigo; + private String tarNombre; + private String tarFormaFarma; + private String tarPresentacion; + private String tarConcentracion; + private Double tarAuxiliar; + private Double talValorTarifado; + private Double talValorCopago; + private Double talValorDeducible; + private Integer honCodigo; + private Double talValorHonorarios; + private Double talFcm; + private String talPorcentaje; + private String talDetalleHonorario; + + public TarifaLiquidacionDTO() { + } + + public TarifaLiquidacionDTO(Integer talCodigo) { + this.talCodigo = talCodigo; + } + + public Integer getTalCodigo() { + return talCodigo; + } + + public void setTalCodigo(Integer talCodigo) { + this.talCodigo = talCodigo; + } + + public String getTarNombre() { + return tarNombre; + } + + public void setTarNombre(String tarNombre) { + this.tarNombre = tarNombre; + } + + public String getTarFormaFarma() { + return tarFormaFarma; + } + + public Double getTalCantidadAutorizada() { + return talCantidadAutorizada; + } + + public void setTalCantidadAutorizada(Double talCantidadAutorizada) { + this.talCantidadAutorizada = talCantidadAutorizada; + } + + public void setTarFormaFarma(String tarFormaFarma) { + this.tarFormaFarma = tarFormaFarma; + } + + public Double getTalValorTarifado() { + return talValorTarifado; + } + + public void setTalValorTarifado(Double talValorTarifado) { + this.talValorTarifado = talValorTarifado; + } + + public Double getTarAuxiliar() { + return tarAuxiliar; + } + + public void setTarAuxiliar(Double tarAuxiliar) { + this.tarAuxiliar = tarAuxiliar; + } + + public String getTarPresentacion() { + return tarPresentacion; + } + + public void setTarPresentacion(String tarPresentacion) { + this.tarPresentacion = tarPresentacion; + } + + public String getTarConcentracion() { + return tarConcentracion; + } + + public void setTarConcentracion(String tarConcentracion) { + this.tarConcentracion = tarConcentracion; + } + + public Double getTalCantidad() { + return talCantidad; + } + + public void setTalCantidad(Double talCantidad) { + this.talCantidad = talCantidad; + } + + public String getTalDescripcion() { + return talDescripcion; + } + + public void setTalDescripcion(String talDescripcion) { + this.talDescripcion = talDescripcion; + } + + public Double getTalValorRegistrado() { + return talValorRegistrado; + } + + public String getTarObservacion() { + return tarObservacion; + } + + public void setTarObservacion(String tarObservacion) { + this.tarObservacion = tarObservacion; + } + + public void setTalValorRegistrado(Double talValorRegistrado) { + this.talValorRegistrado = talValorRegistrado; + } + + public Double getTalValorObjetado() { + return talValorObjetado; + } + + public void setTalValorObjetado(Double talValorObjetado) { + this.talValorObjetado = talValorObjetado; + } + + public Double getTalValorPagado() { + return talValorPagado; + } + + public Double getTalValorCopago() { + return talValorCopago; + } + + public void setTalValorCopago(Double talValorCopago) { + this.talValorCopago = talValorCopago; + } + + public Double getTalValorDeducible() { + return talValorDeducible; + } + + public void setTalValorDeducible(Double talValorDeducible) { + this.talValorDeducible = talValorDeducible; + } + + public void setTalValorPagado(Double talValorPagado) { + this.talValorPagado = talValorPagado; + } + + public Short getTalEstado() { + return talEstado; + } + + public void setTalEstado(Short talEstado) { + this.talEstado = talEstado; + } + + public Integer getDelCodigo() { + return delCodigo; + } + + public void setDelCodigo(Integer delCodigo) { + this.delCodigo = delCodigo; + } + + public Integer getTarCodigo() { + return tarCodigo; + } + + public void setTarCodigo(Integer tarCodigo) { + this.tarCodigo = tarCodigo; + } + + public Integer getHonCodigo() { + return honCodigo; + } + + public void setHonCodigo(Integer honCodigo) { + this.honCodigo = honCodigo; + } + + public Double getTalValorHonorarios() { + return talValorHonorarios; + } + + public void setTalValorHonorarios(Double talValorHonorarios) { + this.talValorHonorarios = talValorHonorarios; + } + + public Double getTalFcm() { + return talFcm; + } + + public void setTalFcm(Double talFcm) { + this.talFcm = talFcm; + } + + public String getTalPorcentaje() { + return talPorcentaje; + } + + public void setTalPorcentaje(String talPorcentaje) { + this.talPorcentaje = talPorcentaje; + } + + public String getTalDetalleHonorario() { + return talDetalleHonorario; + } + + public void setTalDetalleHonorario(String talDetalleHonorario) { + this.talDetalleHonorario = talDetalleHonorario; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/TarifarioDTO.java b/src/main/java/com/qsoft/erp/dto/TarifarioDTO.java new file mode 100644 index 0000000..24d6bbd --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/TarifarioDTO.java @@ -0,0 +1,188 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class TarifarioDTO implements Serializable { + + private static final long serialVersionUID = 8802266718973L; + + private Integer tarCodigo; + private String tarNombre; + private String tarDesagregacion; + private String tarFormaFarma; + private String tarConcentracion; + private String tarPresentacion; + private String tarDescripcion; + private Double tarValor; + private Double tarFactor; + private Double tarAuxiliar; + private Double tarTotal; + private Short tarEstado; + private Integer detTipo; + private String tipoNombre; + private String tipoNemonico; + + public TarifarioDTO() { + } + + public TarifarioDTO(Integer tarCodigo) { + this.tarCodigo = tarCodigo; + } + + public TarifarioDTO(Integer tarCodigo, String tarNombre) { + this.tarCodigo = tarCodigo; + this.tarNombre = tarNombre; + } + + public Integer getTarCodigo() { + return tarCodigo; + } + + public void setTarCodigo(Integer tarCodigo) { + this.tarCodigo = tarCodigo; + } + + public String getTarNombre() { + return tarNombre; + } + + public void setTarNombre(String tarNombre) { + this.tarNombre = tarNombre; + } + + public String getTarDescripcion() { + return tarDescripcion; + } + + public void setTarDescripcion(String tarDescripcion) { + this.tarDescripcion = tarDescripcion; + } + + public String getTarDesagregacion() { + return tarDesagregacion; + } + + public void setTarDesagregacion(String tarDesagregacion) { + this.tarDesagregacion = tarDesagregacion; + } + + public String getTarFormaFarma() { + return tarFormaFarma; + } + + public void setTarFormaFarma(String tarFormaFarma) { + this.tarFormaFarma = tarFormaFarma; + } + + public String getTarConcentracion() { + return tarConcentracion; + } + + public void setTarConcentracion(String tarConcentracion) { + this.tarConcentracion = tarConcentracion; + } + + public String getTarPresentacion() { + return tarPresentacion; + } + + public void setTarPresentacion(String tarPresentacion) { + this.tarPresentacion = tarPresentacion; + } + + public Double getTarValor() { + return tarValor; + } + + public void setTarValor(Double tarValor) { + this.tarValor = tarValor; + } + + public Double getTarFactor() { + return tarFactor; + } + + public void setTarFactor(Double tarFactor) { + this.tarFactor = tarFactor; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public String getTipoNombre() { + return tipoNombre; + } + + public void setTipoNombre(String tipoNombre) { + this.tipoNombre = tipoNombre; + } + + public String getTipoNemonico() { + return tipoNemonico; + } + + public void setTipoNemonico(String tipoNemonico) { + this.tipoNemonico = tipoNemonico; + } + + public Double getTarAuxiliar() { + return tarAuxiliar; + } + + public void setTarAuxiliar(Double tarAuxiliar) { + this.tarAuxiliar = tarAuxiliar; + } + + public Double getTarTotal() { + return tarTotal; + } + + public void setTarTotal(Double tarTotal) { + this.tarTotal = tarTotal; + } + + public Short getTarEstado() { + return tarEstado; + } + + public void setTarEstado(Short tarEstado) { + this.tarEstado = tarEstado; + } + + public int hashCode() { + int hash = 0; + hash += (tarCodigo != null ? tarCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifarioDTO)) { + return false; + } + TarifarioDTO other = (TarifarioDTO) object; + if ((this.tarCodigo == null && other.tarCodigo != null) || (this.tarCodigo != null && !this.tarCodigo.equals(other.tarCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.TarifarioDTO[ tarCodigo=" + tarCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/TelefonoDTO.java b/src/main/java/com/qsoft/erp/dto/TelefonoDTO.java new file mode 100644 index 0000000..0305c2e --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/TelefonoDTO.java @@ -0,0 +1,112 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class TelefonoDTO implements Serializable { + + private static final long serialVersionUID = 8817166362075L; + + private Integer telCodigo; + private String telNumero; + private String telObservacion; + private Short telEstado; + private Integer detTipo; + private Integer perCodigo; + private String detNombreTipo; + + public TelefonoDTO() { + } + + public TelefonoDTO(Integer telCodigo) { + this.telCodigo = telCodigo; + } + + public Integer getTelCodigo() { + return telCodigo; + } + + public void setTelCodigo(Integer telCodigo) { + this.telCodigo = telCodigo; + } + + public String getTelNumero() { + return telNumero; + } + + public void setTelNumero(String telNumero) { + this.telNumero = telNumero; + } + + public String getTelObservacion() { + return telObservacion; + } + + public void setTelObservacion(String telObservacion) { + this.telObservacion = telObservacion; + } + + public Short getTelEstado() { + return telEstado; + } + + public void setTelEstado(Short telEstado) { + this.telEstado = telEstado; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public String getDetNombreTipo() { + return detNombreTipo; + } + + public void setDetNombreTipo(String detNombreTipo) { + this.detNombreTipo = detNombreTipo; + } + + + public int hashCode() { + int hash = 0; + hash += (telCodigo != null ? telCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TelefonoDTO)) { + return false; + } + TelefonoDTO other = (TelefonoDTO) object; + if ((this.telCodigo == null && other.telCodigo != null) || (this.telCodigo != null && !this.telCodigo.equals(other.telCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.TelefonoDTO[ telCodigo=" + telCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/UsuarioDTO.java b/src/main/java/com/qsoft/erp/dto/UsuarioDTO.java new file mode 100644 index 0000000..14d65a2 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/UsuarioDTO.java @@ -0,0 +1,278 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * @author james + */ +public class UsuarioDTO implements Serializable { + + private static final long serialVersionUID = 8825153499133L; + + private Integer usuCodigo; + private Integer empCodigo; + private String usuUsuario; + private String usuNombre; + private String usuDescripcion; + private String usuUrlImagen; + private Short usuEstado; + private String usuIdOrigen; + private String usuOrigen; + private String usuEmail; + private Integer rolCodigo; + private String rolNombre; + private String rolNemonico; + private Integer polCodigo; + private String polEstado; + private String token; + private String imagen; + private String perCodigo; + private String perIdentificacion; + private String poliza; + private String aceptacion; + private String usuPassword; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private java.util.Date usuFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private java.util.Date usuFechaToken; + private List rol; + + public UsuarioDTO() { + } + + public UsuarioDTO(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public String getUsuUsuario() { + return usuUsuario; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public void setUsuUsuario(String usuUsuario) { + this.usuUsuario = usuUsuario; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public String getUsuDescripcion() { + return usuDescripcion; + } + + public void setUsuDescripcion(String usuDescripcion) { + this.usuDescripcion = usuDescripcion; + } + + public String getUsuUrlImagen() { + return usuUrlImagen; + } + + public void setUsuUrlImagen(String usuUrlImagen) { + this.usuUrlImagen = usuUrlImagen; + } + + public Short getUsuEstado() { + return usuEstado; + } + + public void setUsuEstado(Short usuEstado) { + this.usuEstado = usuEstado; + } + + public Integer getRolCodigo() { + return rolCodigo; + } + + public void setRolCodigo(Integer rolCodigo) { + this.rolCodigo = rolCodigo; + } + + public Date getUsuFechaRegistro() { + return usuFechaRegistro; + } + + public void setUsuFechaRegistro(Date usuFechaRegistro) { + this.usuFechaRegistro = usuFechaRegistro; + } + + public Date getUsuFechaToken() { + return usuFechaToken; + } + + public void setUsuFechaToken(Date usuFechaToken) { + this.usuFechaToken = usuFechaToken; + } + + public List getRol() { + return rol; + } + + public void setRol(List rol) { + this.rol = rol; + } + + public String getUsuPassword() { + return usuPassword; + } + + public void setUsuPassword(String usuPassword) { + this.usuPassword = usuPassword; + } + + public String getUsuIdOrigen() { + return usuIdOrigen; + } + + public void setUsuIdOrigen(String usuIdOrigen) { + this.usuIdOrigen = usuIdOrigen; + } + + public String getUsuOrigen() { + return usuOrigen; + } + + public void setUsuOrigen(String usuOrigen) { + this.usuOrigen = usuOrigen; + } + + public String getRolNombre() { + return rolNombre; + } + + public void setRolNombre(String rolNombre) { + this.rolNombre = rolNombre; + } + + public String getRolNemonico() { + return rolNemonico; + } + + public void setRolNemonico(String rolNemonico) { + this.rolNemonico = rolNemonico; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getPolEstado() { + return polEstado; + } + + public void setPolEstado(String polEstado) { + this.polEstado = polEstado; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public String getUsuEmail() { + return usuEmail; + } + + public void setUsuEmail(String usuEmail) { + this.usuEmail = usuEmail; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuCodigo != null ? usuCodigo.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioDTO)) { + return false; + } + UsuarioDTO other = (UsuarioDTO) object; + return !((this.usuCodigo == null && other.usuCodigo != null) || (this.usuCodigo != null && !this.usuCodigo.equals(other.usuCodigo))); + } + + public String getImagen() { + return imagen; + } + + public void setImagen(String imagen) { + this.imagen = imagen; + } + + public String getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(String perCodigo) { + this.perCodigo = perCodigo; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPoliza() { + return poliza; + } + + public void setPoliza(String poliza) { + this.poliza = poliza; + } + + public String getAceptacion() { + return aceptacion; + } + + public void setAceptacion(String aceptacion) { + this.aceptacion = aceptacion; + } + + public String toString() { + return "com.qsoft.erp.model.UsuarioDTO[ usuCodigo=" + usuCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/UsuarioPasswordDTO.java b/src/main/java/com/qsoft/erp/dto/UsuarioPasswordDTO.java new file mode 100644 index 0000000..02ff4a7 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/UsuarioPasswordDTO.java @@ -0,0 +1,99 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class UsuarioPasswordDTO implements Serializable { + + private static final long serialVersionUID = 8832238313064L; + + private Integer pasCodigo; + private String pasValor; + private Date pasFecha; + private Short pasEstado; + private Integer usuCodigo; + + public UsuarioPasswordDTO() { + } + + public UsuarioPasswordDTO(Integer pasCodigo) { + this.pasCodigo = pasCodigo; + } + + public UsuarioPasswordDTO(Integer pasCodigo, Date pasFecha) { + this.pasCodigo = pasCodigo; + this.pasFecha = pasFecha; + } + + public Integer getPasCodigo() { + return pasCodigo; + } + + public void setPasCodigo(Integer pasCodigo) { + this.pasCodigo = pasCodigo; + } + + public String getPasValor() { + return pasValor; + } + + public void setPasValor(String pasValor) { + this.pasValor = pasValor; + } + + public Date getPasFecha() { + return pasFecha; + } + + public void setPasFecha(Date pasFecha) { + this.pasFecha = pasFecha; + } + + public Short getPasEstado() { + return pasEstado; + } + + public void setPasEstado(Short pasEstado) { + this.pasEstado = pasEstado; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public int hashCode() { + int hash = 0; + hash += (pasCodigo != null ? pasCodigo.hashCode() : 0); + return hash; + } + + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioPasswordDTO)) { + return false; + } + UsuarioPasswordDTO other = (UsuarioPasswordDTO) object; + if ((this.pasCodigo == null && other.pasCodigo != null) || (this.pasCodigo != null && !this.pasCodigo.equals(other.pasCodigo))) { + return false; + } + return true; + } + + public String toString() { + return "com.qsoft.erp.model.UsuarioPasswordDTO[ pasCodigo=" + pasCodigo + " ]"; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/ValoresLiquidacion.java b/src/main/java/com/qsoft/erp/dto/ValoresLiquidacion.java new file mode 100644 index 0000000..8240ff7 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/ValoresLiquidacion.java @@ -0,0 +1,105 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +/** + * + * @author james + */ +public class ValoresLiquidacion { + + private Double cobertura; + private Double coberturaPagada; + private Double coberturaDisponible; + private Double copago; + private Double copagoPagado; + private Double deducible; + private Double deduciblePagado; + private Double deduciblePendiente; + private Double valorObjetado; + private Double valorPagado; + + public Double getCoberturaPagada() { + return coberturaPagada; + } + + public void setCoberturaPagada(Double coberturaPagada) { + this.coberturaPagada = coberturaPagada; + } + + public Double getCoberturaDisponible() { + return coberturaDisponible; + } + + public void setCoberturaDisponible(Double coberturaDisponible) { + this.coberturaDisponible = coberturaDisponible; + } + + public Double getCobertura() { + return cobertura; + } + + public void setCobertura(Double cobertura) { + this.cobertura = cobertura; + } + + public Double getCopago() { + return copago; + } + + public void setCopago(Double copago) { + this.copago = copago; + } + + public Double getCopagoPagado() { + return copagoPagado; + } + + public void setCopagoPagado(Double copagoPagado) { + this.copagoPagado = copagoPagado; + } + + public Double getDeducible() { + return deducible; + } + + public void setDeducible(Double deducible) { + this.deducible = deducible; + } + + public Double getDeduciblePendiente() { + return deduciblePendiente; + } + + public void setDeduciblePendiente(Double deduciblePendiente) { + this.deduciblePendiente = deduciblePendiente; + } + + public Double getDeduciblePagado() { + return deduciblePagado; + } + + public void setDeduciblePagado(Double deduciblePagado) { + this.deduciblePagado = deduciblePagado; + } + + public Double getValorObjetado() { + return valorObjetado; + } + + public void setValorObjetado(Double valorObjetado) { + this.valorObjetado = valorObjetado; + } + + public Double getValorPagado() { + return valorPagado; + } + + public void setValorPagado(Double valorPagado) { + this.valorPagado = valorPagado; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwLiqperpolDTO.java b/src/main/java/com/qsoft/erp/dto/VwLiqperpolDTO.java new file mode 100644 index 0000000..17b51e0 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwLiqperpolDTO.java @@ -0,0 +1,558 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * + * @author james + */ +public class VwLiqperpolDTO implements Serializable { + + private static final long serialVersionUID = 1491935104764L; + + private Integer liqCodigo; + private Integer detTipo; + private Integer polCodigo; + private Integer perBeneficiario; + private Integer detIfi; + private Integer cueOrigen; + private Integer cueDestino; + private String liqObservacionAfiliado; + private String liqObservacion; + private Integer usuCodigo; + private String eslMensaje; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date eslFechaInicio; + private String eslObservacion; + private Short eslEstado; + private String usuNombre; + private String usuDescripcion; + private String usuUrlImagen; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date usuFechaToken; + private String usuToken; + private Integer usuTiempoToken; + private Short usuEstado; + private Integer detTipoIdentificacion; + private String perIdentificacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + private Short perEstado; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Double pepMontoCobertura; + private Integer ifis; + private Integer detEstado; + private String polContrato; + private String liqNemonico; + private Integer polDiasCobertura; + private String polObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaFin; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaRegistro; + private Integer detModalidad; + private Integer detDeducible; + private String plaNombre; + private Double plaPorDescuento; + private Integer plaNumBeneficiarios; + private Double plaCoberturaMaxima; + private Integer plaCodigo; + private Short plaEstado; + private String nemo; + private String tip; + private String detDestino; + private String detDescripcion; + private String detNemonico; + private String detNemonicoTipo; + private String tips; + private String detNombre; + private String detOrigen; + private String desti; + private String descr; + private Integer esta; + private List> documentos; + + public VwLiqperpolDTO() { + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getPerBeneficiario() { + return perBeneficiario; + } + + public void setPerBeneficiario(Integer perBeneficiario) { + this.perBeneficiario = perBeneficiario; + } + + public String getDetNemonicoTipo() { + return detNemonicoTipo; + } + + public void setDetNemonicoTipo(String detNemonicoTipo) { + this.detNemonicoTipo = detNemonicoTipo; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getCueOrigen() { + return cueOrigen; + } + + public void setCueOrigen(Integer cueOrigen) { + this.cueOrigen = cueOrigen; + } + + public Integer getCueDestino() { + return cueDestino; + } + + public void setCueDestino(Integer cueDestino) { + this.cueDestino = cueDestino; + } + + public String getLiqObservacionAfiliado() { + return liqObservacionAfiliado; + } + + public void setLiqObservacionAfiliado(String liqObservacionAfiliado) { + this.liqObservacionAfiliado = liqObservacionAfiliado; + } + + public String getLiqObservacion() { + return liqObservacion; + } + + public void setLiqObservacion(String liqObservacion) { + this.liqObservacion = liqObservacion; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public String getEslMensaje() { + return eslMensaje; + } + + public void setEslMensaje(String eslMensaje) { + this.eslMensaje = eslMensaje; + } + + public Date getEslFechaInicio() { + return eslFechaInicio; + } + + public void setEslFechaInicio(Date eslFechaInicio) { + this.eslFechaInicio = eslFechaInicio; + } + + public String getEslObservacion() { + return eslObservacion; + } + + public void setEslObservacion(String eslObservacion) { + this.eslObservacion = eslObservacion; + } + + public Short getEslEstado() { + return eslEstado; + } + + public void setEslEstado(Short eslEstado) { + this.eslEstado = eslEstado; + } + + public Date getLiqFechaRegistro() { + return liqFechaRegistro; + } + + public void setLiqFechaRegistro(Date liqFechaRegistro) { + this.liqFechaRegistro = liqFechaRegistro; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public String getUsuDescripcion() { + return usuDescripcion; + } + + public void setUsuDescripcion(String usuDescripcion) { + this.usuDescripcion = usuDescripcion; + } + + public String getUsuUrlImagen() { + return usuUrlImagen; + } + + public void setUsuUrlImagen(String usuUrlImagen) { + this.usuUrlImagen = usuUrlImagen; + } + + public Date getUsuFechaToken() { + return usuFechaToken; + } + + public void setUsuFechaToken(Date usuFechaToken) { + this.usuFechaToken = usuFechaToken; + } + + public String getUsuToken() { + return usuToken; + } + + public void setUsuToken(String usuToken) { + this.usuToken = usuToken; + } + + public Integer getUsuTiempoToken() { + return usuTiempoToken; + } + + public void setUsuTiempoToken(Integer usuTiempoToken) { + this.usuTiempoToken = usuTiempoToken; + } + + public Short getUsuEstado() { + return usuEstado; + } + + public void setUsuEstado(Short usuEstado) { + this.usuEstado = usuEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public Date getPerFechaRegistro() { + return perFechaRegistro; + } + + public void setPerFechaRegistro(Date perFechaRegistro) { + this.perFechaRegistro = perFechaRegistro; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Integer getIfis() { + return ifis; + } + + public void setIfis(Integer ifis) { + this.ifis = ifis; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public Double getPlaCoberturaMaxima() { + return plaCoberturaMaxima; + } + + public void setPlaCoberturaMaxima(Double plaCoberturaMaxima) { + this.plaCoberturaMaxima = plaCoberturaMaxima; + } + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + + public String getNemo() { + return nemo; + } + + public void setNemo(String nemo) { + this.nemo = nemo; + } + + public String getTip() { + return tip; + } + + public void setTip(String tip) { + this.tip = tip; + } + + public String getDetDestino() { + return detDestino; + } + + public void setDetDestino(String detDestino) { + this.detDestino = detDestino; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getDetOrigen() { + return detOrigen; + } + + public void setDetOrigen(String detOrigen) { + this.detOrigen = detOrigen; + } + + public String getDesti() { + return desti; + } + + public void setDesti(String desti) { + this.desti = desti; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public Integer getEsta() { + return esta; + } + + public void setEsta(Integer esta) { + this.esta = esta; + } + + public List> getDocumentos() { + return documentos; + } + + public void setDocumentos(List> documentos) { + this.documentos = documentos; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public String getLiqNemonico() { + return liqNemonico; + } + + public void setLiqNemonico(String liqNemonico) { + this.liqNemonico = liqNemonico; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwLiqtoDTO.java b/src/main/java/com/qsoft/erp/dto/VwLiqtoDTO.java new file mode 100644 index 0000000..a18261a --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwLiqtoDTO.java @@ -0,0 +1,472 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class VwLiqtoDTO implements Serializable { + + private static final long serialVersionUID = 35363858269225L; + + private Integer liqCodigo; + private Integer polCodigo; + private Integer detIfi; + private Integer cueOrigen; + private Integer cueDestino; + private Integer perBeneficiario; + private String liqNemonico; + private String liqObservacionAfiliado; + private String liqObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaFin; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + private Double liqCopago; + private Double liqDeducible; + private Double liqTotalLiquidado; + private String liqComprobantePago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaPago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaRegistro; + private Short liqCalificacion; + private String detNemonico; + private String detDescripcion; + private String nemo1; + private String nombre; + private Integer liqCodigo0; + private Integer detCie10; + private Integer preCodigo; + private Integer copCodigo; + private String delMedico; + private String delServicio; + private String delDescripcion; + private Double delCantidad; + private Double delUnidad; + private Double delValorRegistrado; + private Double delValorObjetado; + private Double delValorPagado; + private Double delCopago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date delFecha; + private String detNemonico0; + private Short estadoCat; + private String descrEs; + private Integer tipoq; + private Integer delCodigo; + private Integer talCodigo; + private Integer delCodigo0; + private Integer tarCodigo; + private String talDescripcion; + private Double talValorRegistrado; + private Double talValorPagado; + private Double talValorObjetado; + private Short talEstado; + + public VwLiqtoDTO() { + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getCueOrigen() { + return cueOrigen; + } + + public void setCueOrigen(Integer cueOrigen) { + this.cueOrigen = cueOrigen; + } + + public Integer getCueDestino() { + return cueDestino; + } + + public void setCueDestino(Integer cueDestino) { + this.cueDestino = cueDestino; + } + + public Integer getPerBeneficiario() { + return perBeneficiario; + } + + public void setPerBeneficiario(Integer perBeneficiario) { + this.perBeneficiario = perBeneficiario; + } + + public String getLiqNemonico() { + return liqNemonico; + } + + public void setLiqNemonico(String liqNemonico) { + this.liqNemonico = liqNemonico; + } + + public String getLiqObservacionAfiliado() { + return liqObservacionAfiliado; + } + + public void setLiqObservacionAfiliado(String liqObservacionAfiliado) { + this.liqObservacionAfiliado = liqObservacionAfiliado; + } + + public String getLiqObservacion() { + return liqObservacion; + } + + public void setLiqObservacion(String liqObservacion) { + this.liqObservacion = liqObservacion; + } + + public Date getLiqFechaInicio() { + return liqFechaInicio; + } + + public void setLiqFechaInicio(Date liqFechaInicio) { + this.liqFechaInicio = liqFechaInicio; + } + + public Date getLiqFechaFin() { + return liqFechaFin; + } + + public void setLiqFechaFin(Date liqFechaFin) { + this.liqFechaFin = liqFechaFin; + } + + public Double getLiqCopago() { + return liqCopago; + } + + public void setLiqCopago(Double liqCopago) { + this.liqCopago = liqCopago; + } + + public Double getLiqDeducible() { + return liqDeducible; + } + + public void setLiqDeducible(Double liqDeducible) { + this.liqDeducible = liqDeducible; + } + + public Double getLiqTotalLiquidado() { + return liqTotalLiquidado; + } + + public void setLiqTotalLiquidado(Double liqTotalLiquidado) { + this.liqTotalLiquidado = liqTotalLiquidado; + } + + public String getLiqComprobantePago() { + return liqComprobantePago; + } + + public void setLiqComprobantePago(String liqComprobantePago) { + this.liqComprobantePago = liqComprobantePago; + } + + public Date getLiqFechaPago() { + return liqFechaPago; + } + + public void setLiqFechaPago(Date liqFechaPago) { + this.liqFechaPago = liqFechaPago; + } + + public Date getLiqFechaRegistro() { + return liqFechaRegistro; + } + + public void setLiqFechaRegistro(Date liqFechaRegistro) { + this.liqFechaRegistro = liqFechaRegistro; + } + + public Short getLiqCalificacion() { + return liqCalificacion; + } + + public void setLiqCalificacion(Short liqCalificacion) { + this.liqCalificacion = liqCalificacion; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public String getNemo1() { + return nemo1; + } + + public void setNemo1(String nemo1) { + this.nemo1 = nemo1; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Integer getLiqCodigo0() { + return liqCodigo0; + } + + public void setLiqCodigo0(Integer liqCodigo0) { + this.liqCodigo0 = liqCodigo0; + } + + public Integer getDetCie10() { + return detCie10; + } + + public void setDetCie10(Integer detCie10) { + this.detCie10 = detCie10; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public Integer getCopCodigo() { + return copCodigo; + } + + public void setCopCodigo(Integer copCodigo) { + this.copCodigo = copCodigo; + } + + public String getDelMedico() { + return delMedico; + } + + public void setDelMedico(String delMedico) { + this.delMedico = delMedico; + } + + public String getDelServicio() { + return delServicio; + } + + public void setDelServicio(String delServicio) { + this.delServicio = delServicio; + } + + public String getDelDescripcion() { + return delDescripcion; + } + + public void setDelDescripcion(String delDescripcion) { + this.delDescripcion = delDescripcion; + } + + public Double getDelCantidad() { + return delCantidad; + } + + public void setDelCantidad(Double delCantidad) { + this.delCantidad = delCantidad; + } + + public Double getDelUnidad() { + return delUnidad; + } + + public void setDelUnidad(Double delUnidad) { + this.delUnidad = delUnidad; + } + + public Double getDelValorRegistrado() { + return delValorRegistrado; + } + + public void setDelValorRegistrado(Double delValorRegistrado) { + this.delValorRegistrado = delValorRegistrado; + } + + public Double getDelValorObjetado() { + return delValorObjetado; + } + + public void setDelValorObjetado(Double delValorObjetado) { + this.delValorObjetado = delValorObjetado; + } + + public Double getDelValorPagado() { + return delValorPagado; + } + + public void setDelValorPagado(Double delValorPagado) { + this.delValorPagado = delValorPagado; + } + + public Double getDelCopago() { + return delCopago; + } + + public void setDelCopago(Double delCopago) { + this.delCopago = delCopago; + } + + public Date getDelFecha() { + return delFecha; + } + + public void setDelFecha(Date delFecha) { + this.delFecha = delFecha; + } + + public String getDetNemonico0() { + return detNemonico0; + } + + public void setDetNemonico0(String detNemonico0) { + this.detNemonico0 = detNemonico0; + } + + public Short getEstadoCat() { + return estadoCat; + } + + public void setEstadoCat(Short estadoCat) { + this.estadoCat = estadoCat; + } + + public String getDescrEs() { + return descrEs; + } + + public void setDescrEs(String descrEs) { + this.descrEs = descrEs; + } + + public Integer getTipoq() { + return tipoq; + } + + public void setTipoq(Integer tipoq) { + this.tipoq = tipoq; + } + + public Integer getDelCodigo() { + return delCodigo; + } + + public void setDelCodigo(Integer delCodigo) { + this.delCodigo = delCodigo; + } + + public Integer getTalCodigo() { + return talCodigo; + } + + public void setTalCodigo(Integer talCodigo) { + this.talCodigo = talCodigo; + } + + public Integer getDelCodigo0() { + return delCodigo0; + } + + public void setDelCodigo0(Integer delCodigo0) { + this.delCodigo0 = delCodigo0; + } + + public Integer getTarCodigo() { + return tarCodigo; + } + + public void setTarCodigo(Integer tarCodigo) { + this.tarCodigo = tarCodigo; + } + + public String getTalDescripcion() { + return talDescripcion; + } + + public void setTalDescripcion(String talDescripcion) { + this.talDescripcion = talDescripcion; + } + + public Double getTalValorRegistrado() { + return talValorRegistrado; + } + + public void setTalValorRegistrado(Double talValorRegistrado) { + this.talValorRegistrado = talValorRegistrado; + } + + public Double getTalValorPagado() { + return talValorPagado; + } + + public void setTalValorPagado(Double talValorPagado) { + this.talValorPagado = talValorPagado; + } + + public Double getTalValorObjetado() { + return talValorObjetado; + } + + public void setTalValorObjetado(Double talValorObjetado) { + this.talValorObjetado = talValorObjetado; + } + + public Short getTalEstado() { + return talEstado; + } + + public void setTalEstado(Short talEstado) { + this.talEstado = talEstado; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwPagosCpnDTO.java b/src/main/java/com/qsoft/erp/dto/VwPagosCpnDTO.java new file mode 100644 index 0000000..1a906de --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwPagosCpnDTO.java @@ -0,0 +1,115 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * //@author james + */ +public class VwPagosCpnDTO implements Serializable { + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date fecha; + private String cedula; + private String nombres; + private String tipocuenta; + private String numerocuenta; + private Double valor; + private String banco; + private String rucCobra; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date pagFechaVencimiento; + private String detNombre; + + public VwPagosCpnDTO() { + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public String getCedula() { + return cedula; + } + + public void setCedula(String cedula) { + this.cedula = cedula; + } + + public String getNombres() { + return nombres; + } + + public void setNombres(String nombres) { + this.nombres = nombres; + } + + public String getTipocuenta() { + return tipocuenta; + } + + public void setTipocuenta(String tipocuenta) { + this.tipocuenta = tipocuenta; + } + + public String getNumerocuenta() { + return numerocuenta; + } + + public void setNumerocuenta(String numerocuenta) { + this.numerocuenta = numerocuenta; + } + + public Double getValor() { + return valor; + } + + public void setValor(Double valor) { + this.valor = valor; + } + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getRucCobra() { + return rucCobra; + } + + public void setRucCobra(String rucCobra) { + this.rucCobra = rucCobra; + } + + public Date getPagFechaVencimiento() { + return pagFechaVencimiento; + } + + public void setPagFechaVencimiento(Date pagFechaVencimiento) { + this.pagFechaVencimiento = pagFechaVencimiento; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwPeliqpreDTO.java b/src/main/java/com/qsoft/erp/dto/VwPeliqpreDTO.java new file mode 100644 index 0000000..6983eec --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwPeliqpreDTO.java @@ -0,0 +1,957 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class VwPeliqpreDTO implements Serializable { + + private static final long serialVersionUID = 31210379501403L; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaRegistro; + private String desti; + private String descr; + private Short esta; + private Integer detTipo; + private Integer polCodigo; + private Integer detIfi; + private Integer cueOrigen; + private Integer cueDestino; + private String liqNemonico; + private String liqObservacionAfiliado; + private String liqObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaFin; + private Double liqCopago; + private Double liqDeducible; + private Double liqTotalLiquidado; + private String liqComprobantePago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaPago; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date liqFechaRegistro; + private Integer eslCodigo; + private Integer detEstado; + private Integer liqCodigo; + private Integer usuCodigo; + private String eslMensaje; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date eslFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date eslFechaFin; + private String eslObservacion; + private Short eslEstado; + private Integer perCodigo; + private String usuNombre; + private String usuDescripcion; + private String usuUrlImagen; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date usuFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date usuFechaToken; + private String usuToken; + private Short usuEstado; + private Integer usuTiempoToken; + private Integer detTipoIdentificacion; + private String perIdentificacion; + private String perNombres; + private String perApellidos; + private String perNacionalidad; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + private Short perEstado; + private Integer detTipoPersona; + private String pepObservacion; + private Double pepMontoCobertura; + private Integer detIfi0; + private Integer detEstado0; + private String polContrato; + private Integer polCodigo0; + private Integer polDiasCobertura; + private String polObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaFin; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + private Integer detModalidad; + private Integer detDeducible; + private Integer detTarifario; + private String plaNombre; + private String plaRutaContrato; + private Double plaValorMensual; + private Double plaPorDescuento; + private Integer plaNumBeneficiarios; + private Double plaCoberturaMaxima; + private Short plaEstado; + private String detNemonico; + private String detTipo0; + private String detNombre; + private String detOrigen; + private String detDestino; + private String detDescripcion; + private Integer detCodigo; + private String detNemonico0; + private Integer catCodigo; + private String detTipo1; + private String detNombre0; + private String detOrigen0; + private Integer delCodigo; + private Integer liqCodigo0; + private Integer detTipo2; + private Integer preCodigo; + private String delMedico; + private String delServicio; + private String delDescripcion; + private Double delCantidad; + private Double delUnidad; + private Double delValor; + private String delDinamico; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date delFecha; + private Integer preCodigo0; + private Integer detTipo3; + private Integer detProvincia; + private Integer detCiudad; + private String preRuc; + private String preRazonSocial; + private String preNombre; + private String preDireccion; + private String preTelefono1; + private String preTelefono2; + private String preObservacion; + + public VwPeliqpreDTO() { + } + + public Date getPerFechaRegistro() { + return perFechaRegistro; + } + + public void setPerFechaRegistro(Date perFechaRegistro) { + this.perFechaRegistro = perFechaRegistro; + } + + public String getDesti() { + return desti; + } + + public void setDesti(String desti) { + this.desti = desti; + } + + public String getDescr() { + return descr; + } + + public void setDescr(String descr) { + this.descr = descr; + } + + public Short getEsta() { + return esta; + } + + public void setEsta(Short esta) { + this.esta = esta; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getCueOrigen() { + return cueOrigen; + } + + public void setCueOrigen(Integer cueOrigen) { + this.cueOrigen = cueOrigen; + } + + public Integer getCueDestino() { + return cueDestino; + } + + public void setCueDestino(Integer cueDestino) { + this.cueDestino = cueDestino; + } + + public String getLiqNemonico() { + return liqNemonico; + } + + public void setLiqNemonico(String liqNemonico) { + this.liqNemonico = liqNemonico; + } + + public String getLiqObservacionAfiliado() { + return liqObservacionAfiliado; + } + + public void setLiqObservacionAfiliado(String liqObservacionAfiliado) { + this.liqObservacionAfiliado = liqObservacionAfiliado; + } + + public String getLiqObservacion() { + return liqObservacion; + } + + public void setLiqObservacion(String liqObservacion) { + this.liqObservacion = liqObservacion; + } + + public Date getLiqFechaInicio() { + return liqFechaInicio; + } + + public void setLiqFechaInicio(Date liqFechaInicio) { + this.liqFechaInicio = liqFechaInicio; + } + + public Date getLiqFechaFin() { + return liqFechaFin; + } + + public void setLiqFechaFin(Date liqFechaFin) { + this.liqFechaFin = liqFechaFin; + } + + public Double getLiqCopago() { + return liqCopago; + } + + public void setLiqCopago(Double liqCopago) { + this.liqCopago = liqCopago; + } + + public Double getLiqDeducible() { + return liqDeducible; + } + + public void setLiqDeducible(Double liqDeducible) { + this.liqDeducible = liqDeducible; + } + + public Double getLiqTotalLiquidado() { + return liqTotalLiquidado; + } + + public void setLiqTotalLiquidado(Double liqTotalLiquidado) { + this.liqTotalLiquidado = liqTotalLiquidado; + } + + public String getLiqComprobantePago() { + return liqComprobantePago; + } + + public void setLiqComprobantePago(String liqComprobantePago) { + this.liqComprobantePago = liqComprobantePago; + } + + public Date getLiqFechaPago() { + return liqFechaPago; + } + + public void setLiqFechaPago(Date liqFechaPago) { + this.liqFechaPago = liqFechaPago; + } + + public Date getLiqFechaRegistro() { + return liqFechaRegistro; + } + + public void setLiqFechaRegistro(Date liqFechaRegistro) { + this.liqFechaRegistro = liqFechaRegistro; + } + + public Integer getEslCodigo() { + return eslCodigo; + } + + public void setEslCodigo(Integer eslCodigo) { + this.eslCodigo = eslCodigo; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public Integer getLiqCodigo() { + return liqCodigo; + } + + public void setLiqCodigo(Integer liqCodigo) { + this.liqCodigo = liqCodigo; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public String getEslMensaje() { + return eslMensaje; + } + + public void setEslMensaje(String eslMensaje) { + this.eslMensaje = eslMensaje; + } + + public Date getEslFechaInicio() { + return eslFechaInicio; + } + + public void setEslFechaInicio(Date eslFechaInicio) { + this.eslFechaInicio = eslFechaInicio; + } + + public Date getEslFechaFin() { + return eslFechaFin; + } + + public void setEslFechaFin(Date eslFechaFin) { + this.eslFechaFin = eslFechaFin; + } + + public String getEslObservacion() { + return eslObservacion; + } + + public void setEslObservacion(String eslObservacion) { + this.eslObservacion = eslObservacion; + } + + public Short getEslEstado() { + return eslEstado; + } + + public void setEslEstado(Short eslEstado) { + this.eslEstado = eslEstado; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public String getUsuDescripcion() { + return usuDescripcion; + } + + public void setUsuDescripcion(String usuDescripcion) { + this.usuDescripcion = usuDescripcion; + } + + public String getUsuUrlImagen() { + return usuUrlImagen; + } + + public void setUsuUrlImagen(String usuUrlImagen) { + this.usuUrlImagen = usuUrlImagen; + } + + public Date getUsuFechaRegistro() { + return usuFechaRegistro; + } + + public void setUsuFechaRegistro(Date usuFechaRegistro) { + this.usuFechaRegistro = usuFechaRegistro; + } + + public Date getUsuFechaToken() { + return usuFechaToken; + } + + public void setUsuFechaToken(Date usuFechaToken) { + this.usuFechaToken = usuFechaToken; + } + + public String getUsuToken() { + return usuToken; + } + + public void setUsuToken(String usuToken) { + this.usuToken = usuToken; + } + + public Short getUsuEstado() { + return usuEstado; + } + + public void setUsuEstado(Short usuEstado) { + this.usuEstado = usuEstado; + } + + public Integer getUsuTiempoToken() { + return usuTiempoToken; + } + + public void setUsuTiempoToken(Integer usuTiempoToken) { + this.usuTiempoToken = usuTiempoToken; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerNacionalidad() { + return perNacionalidad; + } + + public void setPerNacionalidad(String perNacionalidad) { + this.perNacionalidad = perNacionalidad; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Integer getDetTipoPersona() { + return detTipoPersona; + } + + public void setDetTipoPersona(Integer detTipoPersona) { + this.detTipoPersona = detTipoPersona; + } + + public String getPepObservacion() { + return pepObservacion; + } + + public void setPepObservacion(String pepObservacion) { + this.pepObservacion = pepObservacion; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Integer getDetIfi0() { + return detIfi0; + } + + public void setDetIfi0(Integer detIfi0) { + this.detIfi0 = detIfi0; + } + + public Integer getDetEstado0() { + return detEstado0; + } + + public void setDetEstado0(Integer detEstado0) { + this.detEstado0 = detEstado0; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public Integer getPolCodigo0() { + return polCodigo0; + } + + public void setPolCodigo0(Integer polCodigo0) { + this.polCodigo0 = polCodigo0; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public Integer getDetTarifario() { + return detTarifario; + } + + public void setDetTarifario(Integer detTarifario) { + this.detTarifario = detTarifario; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaRutaContrato() { + return plaRutaContrato; + } + + public void setPlaRutaContrato(String plaRutaContrato) { + this.plaRutaContrato = plaRutaContrato; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public Double getPlaCoberturaMaxima() { + return plaCoberturaMaxima; + } + + public void setPlaCoberturaMaxima(Double plaCoberturaMaxima) { + this.plaCoberturaMaxima = plaCoberturaMaxima; + } + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetTipo0() { + return detTipo0; + } + + public void setDetTipo0(String detTipo0) { + this.detTipo0 = detTipo0; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getDetOrigen() { + return detOrigen; + } + + public void setDetOrigen(String detOrigen) { + this.detOrigen = detOrigen; + } + + public String getDetDestino() { + return detDestino; + } + + public void setDetDestino(String detDestino) { + this.detDestino = detDestino; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public Integer getDetCodigo() { + return detCodigo; + } + + public void setDetCodigo(Integer detCodigo) { + this.detCodigo = detCodigo; + } + + public String getDetNemonico0() { + return detNemonico0; + } + + public void setDetNemonico0(String detNemonico0) { + this.detNemonico0 = detNemonico0; + } + + public Integer getCatCodigo() { + return catCodigo; + } + + public void setCatCodigo(Integer catCodigo) { + this.catCodigo = catCodigo; + } + + public String getDetTipo1() { + return detTipo1; + } + + public void setDetTipo1(String detTipo1) { + this.detTipo1 = detTipo1; + } + + public String getDetNombre0() { + return detNombre0; + } + + public void setDetNombre0(String detNombre0) { + this.detNombre0 = detNombre0; + } + + public String getDetOrigen0() { + return detOrigen0; + } + + public void setDetOrigen0(String detOrigen0) { + this.detOrigen0 = detOrigen0; + } + + public Integer getDelCodigo() { + return delCodigo; + } + + public void setDelCodigo(Integer delCodigo) { + this.delCodigo = delCodigo; + } + + public Integer getLiqCodigo0() { + return liqCodigo0; + } + + public void setLiqCodigo0(Integer liqCodigo0) { + this.liqCodigo0 = liqCodigo0; + } + + public Integer getDetTipo2() { + return detTipo2; + } + + public void setDetTipo2(Integer detTipo2) { + this.detTipo2 = detTipo2; + } + + public Integer getPreCodigo() { + return preCodigo; + } + + public void setPreCodigo(Integer preCodigo) { + this.preCodigo = preCodigo; + } + + public String getDelMedico() { + return delMedico; + } + + public void setDelMedico(String delMedico) { + this.delMedico = delMedico; + } + + public String getDelServicio() { + return delServicio; + } + + public void setDelServicio(String delServicio) { + this.delServicio = delServicio; + } + + public String getDelDescripcion() { + return delDescripcion; + } + + public void setDelDescripcion(String delDescripcion) { + this.delDescripcion = delDescripcion; + } + + public Double getDelCantidad() { + return delCantidad; + } + + public void setDelCantidad(Double delCantidad) { + this.delCantidad = delCantidad; + } + + public Double getDelUnidad() { + return delUnidad; + } + + public void setDelUnidad(Double delUnidad) { + this.delUnidad = delUnidad; + } + + public Double getDelValor() { + return delValor; + } + + public void setDelValor(Double delValor) { + this.delValor = delValor; + } + + public String getDelDinamico() { + return delDinamico; + } + + public void setDelDinamico(String delDinamico) { + this.delDinamico = delDinamico; + } + + public Date getDelFecha() { + return delFecha; + } + + public void setDelFecha(Date delFecha) { + this.delFecha = delFecha; + } + + public Integer getPreCodigo0() { + return preCodigo0; + } + + public void setPreCodigo0(Integer preCodigo0) { + this.preCodigo0 = preCodigo0; + } + + public Integer getDetTipo3() { + return detTipo3; + } + + public void setDetTipo3(Integer detTipo3) { + this.detTipo3 = detTipo3; + } + + public Integer getDetProvincia() { + return detProvincia; + } + + public void setDetProvincia(Integer detProvincia) { + this.detProvincia = detProvincia; + } + + public Integer getDetCiudad() { + return detCiudad; + } + + public void setDetCiudad(Integer detCiudad) { + this.detCiudad = detCiudad; + } + + public String getPreRuc() { + return preRuc; + } + + public void setPreRuc(String preRuc) { + this.preRuc = preRuc; + } + + public String getPreRazonSocial() { + return preRazonSocial; + } + + public void setPreRazonSocial(String preRazonSocial) { + this.preRazonSocial = preRazonSocial; + } + + public String getPreNombre() { + return preNombre; + } + + public void setPreNombre(String preNombre) { + this.preNombre = preNombre; + } + + public String getPreDireccion() { + return preDireccion; + } + + public void setPreDireccion(String preDireccion) { + this.preDireccion = preDireccion; + } + + public String getPreTelefono1() { + return preTelefono1; + } + + public void setPreTelefono1(String preTelefono1) { + this.preTelefono1 = preTelefono1; + } + + public String getPreTelefono2() { + return preTelefono2; + } + + public void setPreTelefono2(String preTelefono2) { + this.preTelefono2 = preTelefono2; + } + + public String getPreObservacion() { + return preObservacion; + } + + public void setPreObservacion(String preObservacion) { + this.preObservacion = preObservacion; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/VwPolPerBanDTO.java b/src/main/java/com/qsoft/erp/dto/VwPolPerBanDTO.java new file mode 100644 index 0000000..e5f7223 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwPolPerBanDTO.java @@ -0,0 +1,281 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class VwPolPerBanDTO implements Serializable { + + private static final long serialVersionUID = 32258001667023L; + + private Integer edadActual; + private Integer perCodigo; + private Integer polCodigo; + private Integer plaEdadHijos; + private Integer plaNumBeneficiarios; + private Double pepMontoCobertura; + private Integer detTipoCuenta; + private Integer detIfi; + private Short cueEstado; + private Integer detTipoPersona; + private String plaNombre; + private String detNemonico; + private String detDescripcion; + private String perIdentificacion; + private String perNombres; + private String perApellidos; + private String perDireccion; + private String perMail; + private String pepObservacion; + private String plaProducto; + private String descripcionCuenta; + private String cueCuenta; + private String nemonico2; + private String nombre1; + private String nemonico; + private String tipo; + private String nombre2; + private String polDescripcion; + private Short polEstado; + + public Integer getEdadActual() { + return edadActual; + } + + public void setEdadActual(Integer edadActual) { + this.edadActual = edadActual; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public Integer getPlaEdadHijos() { + return plaEdadHijos; + } + + public void setPlaEdadHijos(Integer plaEdadHijos) { + this.plaEdadHijos = plaEdadHijos; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Integer getDetTipoCuenta() { + return detTipoCuenta; + } + + public void setDetTipoCuenta(Integer detTipoCuenta) { + this.detTipoCuenta = detTipoCuenta; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Short getCueEstado() { + return cueEstado; + } + + public void setCueEstado(Short cueEstado) { + this.cueEstado = cueEstado; + } + + public Integer getDetTipoPersona() { + return detTipoPersona; + } + + public void setDetTipoPersona(Integer detTipoPersona) { + this.detTipoPersona = detTipoPersona; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerDireccion() { + return perDireccion; + } + + public void setPerDireccion(String perDireccion) { + this.perDireccion = perDireccion; + } + + public String getPerMail() { + return perMail; + } + + public void setPerMail(String perMail) { + this.perMail = perMail; + } + + public String getPepObservacion() { + return pepObservacion; + } + + public void setPepObservacion(String pepObservacion) { + this.pepObservacion = pepObservacion; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public String getDescripcionCuenta() { + return descripcionCuenta; + } + + public void setDescripcionCuenta(String descripcionCuenta) { + this.descripcionCuenta = descripcionCuenta; + } + + public String getCueCuenta() { + return cueCuenta; + } + + public void setCueCuenta(String cueCuenta) { + this.cueCuenta = cueCuenta; + } + + public String getNemonico2() { + return nemonico2; + } + + public void setNemonico2(String nemonico2) { + this.nemonico2 = nemonico2; + } + + public String getNombre1() { + return nombre1; + } + + public void setNombre1(String nombre1) { + this.nombre1 = nombre1; + } + + public String getNemonico() { + return nemonico; + } + + public void setNemonico(String nemonico) { + this.nemonico = nemonico; + } + + public String getNombre2() { + return nombre2; + } + + public void setNombre2(String nombre2) { + this.nombre2 = nombre2; + } + + public String getPolDescripcion() { + return polDescripcion; + } + + public void setPolDescripcion(String polDescripcion) { + this.polDescripcion = polDescripcion; + } + + public Short getPolEstado() { + return polEstado; + } + + public void setPolEstado(Short polEstado) { + this.polEstado = polEstado; + } + + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwPrestacionesPlanDTO.java b/src/main/java/com/qsoft/erp/dto/VwPrestacionesPlanDTO.java new file mode 100644 index 0000000..255c246 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwPrestacionesPlanDTO.java @@ -0,0 +1,299 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ + +public class VwPrestacionesPlanDTO implements Serializable { + + private static final long serialVersionUID = 1L; + private Integer polCodigo; + private Integer empCodigo; + private Integer plaCodigo; + private Integer detPeriodicidad; + private Integer detFormaPago; + private Integer detIfi; + private Integer detEstado; + private String polContrato; + private String polCertificado; + private Integer polDiasCobertura; + private String polBroker; + private String polObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaFin; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + private Integer detModalidad; + private Integer detDeducible; + private String plaNombre; + private String plaRutaContrato; + private Double plaValorAnual; + private Double plaValorMensual; + private Double plaPorDescuento; + private Integer plaEdadTitular; + private String plaProducto; + private Double plaValorDeducible; + private Integer copCodigo; + private Integer detTipo; + private Integer detPrestacion; + private Double copCopago; + private Double copTope; + + public VwPrestacionesPlanDTO() { + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getDetPeriodicidad() { + return detPeriodicidad; + } + + public void setDetPeriodicidad(Integer detPeriodicidad) { + this.detPeriodicidad = detPeriodicidad; + } + + public Integer getDetFormaPago() { + return detFormaPago; + } + + public void setDetFormaPago(Integer detFormaPago) { + this.detFormaPago = detFormaPago; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public String getPolCertificado() { + return polCertificado; + } + + public void setPolCertificado(String polCertificado) { + this.polCertificado = polCertificado; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolBroker() { + return polBroker; + } + + public void setPolBroker(String polBroker) { + this.polBroker = polBroker; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaRutaContrato() { + return plaRutaContrato; + } + + public void setPlaRutaContrato(String plaRutaContrato) { + this.plaRutaContrato = plaRutaContrato; + } + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaEdadTitular() { + return plaEdadTitular; + } + + public void setPlaEdadTitular(Integer plaEdadTitular) { + this.plaEdadTitular = plaEdadTitular; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public Double getPlaValorDeducible() { + return plaValorDeducible; + } + + public void setPlaValorDeducible(Double plaValorDeducible) { + this.plaValorDeducible = plaValorDeducible; + } + + public Integer getCopCodigo() { + return copCodigo; + } + + public void setCopCodigo(Integer copCodigo) { + this.copCodigo = copCodigo; + } + + public Integer getDetTipo() { + return detTipo; + } + + public void setDetTipo(Integer detTipo) { + this.detTipo = detTipo; + } + + public Integer getDetPrestacion() { + return detPrestacion; + } + + public void setDetPrestacion(Integer detPrestacion) { + this.detPrestacion = detPrestacion; + } + + public Double getCopCopago() { + return copCopago; + } + + public void setCopCopago(Double copCopago) { + this.copCopago = copCopago; + } + + public Double getCopTope() { + return copTope; + } + + public void setCopTope(Double copTope) { + this.copTope = copTope; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwRepdrDTO.java b/src/main/java/com/qsoft/erp/dto/VwRepdrDTO.java new file mode 100644 index 0000000..4b46cdd --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwRepdrDTO.java @@ -0,0 +1,719 @@ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +public class VwRepdrDTO implements Serializable { + + private static final long serialVersionUID = 638991407934991L; + + private Integer perCodigo; + + private String usuNombre; + + private String usuDescripcion; + + private String usuUrlImagen; + + private java.util.Date usuFechaRegistro; + + private java.util.Date usuFechaToken; + + private String usuToken; + + private Integer usuTiempoToken; + + private Short usuEstado; + + private Integer detTipoIdentificacion; + + private String perIdentificacion; + + private String perNombres; + + private String perApellidos; + + private String perNacionalidad; + + private java.util.Date perFechaRegistro; + + private java.util.Date perFechaNacimiento; + + private Short perEstado; + + private Integer detTipoPersona; + + private String pepObservacion; + + private Double pepMontoCobertura; + + private Integer detIfi; + + private Integer detEstado; + + private String polContrato; + + private Integer polCodigo; + + private Integer polDiasCobertura; + + private String polObservacion; + + private java.util.Date polFechaInicio; + + private java.util.Date polFechaFin; + + private java.util.Date polFechaRegistro; + + private Integer detModalidad; + + private Integer detDeducible; + + private Integer detTarifario; + + private String plaNombre; + + private String plaRutaContrato; + + private Double plaValorMensual; + + private Double plaPorDescuento; + + private Integer plaNumBeneficiarios; + + private Double plaCoberturaMaxima; + + private Short plaEstado; + + private String detNemonico; + + private String detTipo; + + private String detNombre; + + private String detOrigen; + + private String detDestino; + + private String detDescripcion; + + private Integer pepCodigo; + + private Integer perCodigo0; + + private Integer polCodigo0; + + private Integer empCodigo; + + private Integer plaCodigo; + + private Integer detModalidad0; + + private Integer detPeriodicidad; + + private Integer detFormaPago; + + private String polCertificado; + + private String polBroker; + + private Integer detGenero; + + private String perDireccion; + + private String perMail; + + private Integer usuCodigo; + + private String usuUsuario; + + private String detNombre0; + + private Integer catCodigo; + + private Integer detProvincia; + + private Double plaValorDeducible; + + private String plaProducto; + + private Integer plaEdadTitular; + + private Integer plaEdadHijos; + + private Double plaValorAnual; + + private Integer detTipo0; + + private Integer detCodigo; + + private String detNombre1; + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public String getUsuDescripcion() { + return usuDescripcion; + } + + public void setUsuDescripcion(String usuDescripcion) { + this.usuDescripcion = usuDescripcion; + } + + public String getUsuUrlImagen() { + return usuUrlImagen; + } + + public void setUsuUrlImagen(String usuUrlImagen) { + this.usuUrlImagen = usuUrlImagen; + } + + public java.util.Date getUsuFechaRegistro() { + return usuFechaRegistro; + } + + public void setUsuFechaRegistro(java.util.Date usuFechaRegistro) { + this.usuFechaRegistro = usuFechaRegistro; + } + + public java.util.Date getUsuFechaToken() { + return usuFechaToken; + } + + public void setUsuFechaToken(java.util.Date usuFechaToken) { + this.usuFechaToken = usuFechaToken; + } + + public String getUsuToken() { + return usuToken; + } + + public void setUsuToken(String usuToken) { + this.usuToken = usuToken; + } + + public Integer getUsuTiempoToken() { + return usuTiempoToken; + } + + public void setUsuTiempoToken(Integer usuTiempoToken) { + this.usuTiempoToken = usuTiempoToken; + } + + public Short getUsuEstado() { + return usuEstado; + } + + public void setUsuEstado(Short usuEstado) { + this.usuEstado = usuEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerNacionalidad() { + return perNacionalidad; + } + + public void setPerNacionalidad(String perNacionalidad) { + this.perNacionalidad = perNacionalidad; + } + + public java.util.Date getPerFechaRegistro() { + return perFechaRegistro; + } + + public void setPerFechaRegistro(java.util.Date perFechaRegistro) { + this.perFechaRegistro = perFechaRegistro; + } + + public java.util.Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(java.util.Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Integer getDetTipoPersona() { + return detTipoPersona; + } + + public void setDetTipoPersona(Integer detTipoPersona) { + this.detTipoPersona = detTipoPersona; + } + + public String getPepObservacion() { + return pepObservacion; + } + + public void setPepObservacion(String pepObservacion) { + this.pepObservacion = pepObservacion; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public java.util.Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(java.util.Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public java.util.Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(java.util.Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public java.util.Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(java.util.Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public Integer getDetTarifario() { + return detTarifario; + } + + public void setDetTarifario(Integer detTarifario) { + this.detTarifario = detTarifario; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaRutaContrato() { + return plaRutaContrato; + } + + public void setPlaRutaContrato(String plaRutaContrato) { + this.plaRutaContrato = plaRutaContrato; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public Double getPlaCoberturaMaxima() { + return plaCoberturaMaxima; + } + + public void setPlaCoberturaMaxima(Double plaCoberturaMaxima) { + this.plaCoberturaMaxima = plaCoberturaMaxima; + } + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetTipo() { + return detTipo; + } + + public void setDetTipo(String detTipo) { + this.detTipo = detTipo; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getDetOrigen() { + return detOrigen; + } + + public void setDetOrigen(String detOrigen) { + this.detOrigen = detOrigen; + } + + public String getDetDestino() { + return detDestino; + } + + public void setDetDestino(String detDestino) { + this.detDestino = detDestino; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public Integer getPepCodigo() { + return pepCodigo; + } + + public void setPepCodigo(Integer pepCodigo) { + this.pepCodigo = pepCodigo; + } + + public Integer getPerCodigo0() { + return perCodigo0; + } + + public void setPerCodigo0(Integer perCodigo0) { + this.perCodigo0 = perCodigo0; + } + + public Integer getPolCodigo0() { + return polCodigo0; + } + + public void setPolCodigo0(Integer polCodigo0) { + this.polCodigo0 = polCodigo0; + } + + public Integer getEmpCodigo() { + return empCodigo; + } + + public void setEmpCodigo(Integer empCodigo) { + this.empCodigo = empCodigo; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getDetModalidad0() { + return detModalidad0; + } + + public void setDetModalidad0(Integer detModalidad0) { + this.detModalidad0 = detModalidad0; + } + + public Integer getDetPeriodicidad() { + return detPeriodicidad; + } + + public void setDetPeriodicidad(Integer detPeriodicidad) { + this.detPeriodicidad = detPeriodicidad; + } + + public Integer getDetFormaPago() { + return detFormaPago; + } + + public void setDetFormaPago(Integer detFormaPago) { + this.detFormaPago = detFormaPago; + } + + public String getPolCertificado() { + return polCertificado; + } + + public void setPolCertificado(String polCertificado) { + this.polCertificado = polCertificado; + } + + public String getPolBroker() { + return polBroker; + } + + public void setPolBroker(String polBroker) { + this.polBroker = polBroker; + } + + public Integer getDetGenero() { + return detGenero; + } + + public void setDetGenero(Integer detGenero) { + this.detGenero = detGenero; + } + + public String getPerDireccion() { + return perDireccion; + } + + public void setPerDireccion(String perDireccion) { + this.perDireccion = perDireccion; + } + + public String getPerMail() { + return perMail; + } + + public void setPerMail(String perMail) { + this.perMail = perMail; + } + + public Integer getUsuCodigo() { + return usuCodigo; + } + + public void setUsuCodigo(Integer usuCodigo) { + this.usuCodigo = usuCodigo; + } + + public String getUsuUsuario() { + return usuUsuario; + } + + public void setUsuUsuario(String usuUsuario) { + this.usuUsuario = usuUsuario; + } + + public String getDetNombre0() { + return detNombre0; + } + + public void setDetNombre0(String detNombre0) { + this.detNombre0 = detNombre0; + } + + public Integer getCatCodigo() { + return catCodigo; + } + + public void setCatCodigo(Integer catCodigo) { + this.catCodigo = catCodigo; + } + + public Integer getDetProvincia() { + return detProvincia; + } + + public void setDetProvincia(Integer detProvincia) { + this.detProvincia = detProvincia; + } + + public Double getPlaValorDeducible() { + return plaValorDeducible; + } + + public void setPlaValorDeducible(Double plaValorDeducible) { + this.plaValorDeducible = plaValorDeducible; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public Integer getPlaEdadTitular() { + return plaEdadTitular; + } + + public void setPlaEdadTitular(Integer plaEdadTitular) { + this.plaEdadTitular = plaEdadTitular; + } + + public Integer getPlaEdadHijos() { + return plaEdadHijos; + } + + public void setPlaEdadHijos(Integer plaEdadHijos) { + this.plaEdadHijos = plaEdadHijos; + } + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public Integer getDetTipo0() { + return detTipo0; + } + + public void setDetTipo0(Integer detTipo0) { + this.detTipo0 = detTipo0; + } + + public Integer getDetCodigo() { + return detCodigo; + } + + public void setDetCodigo(Integer detCodigo) { + this.detCodigo = detCodigo; + } + + public String getDetNombre1() { + return detNombre1; + } + + public void setDetNombre1(String detNombre1) { + this.detNombre1 = detNombre1; + } + +} \ No newline at end of file diff --git a/src/main/java/com/qsoft/erp/dto/VwReporteProduccionDTO.java b/src/main/java/com/qsoft/erp/dto/VwReporteProduccionDTO.java new file mode 100644 index 0000000..4271353 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwReporteProduccionDTO.java @@ -0,0 +1,153 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author james + */ +public class VwReporteProduccionDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String perNombres; + private String perApellidos; + private String perIdentificacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + private String detNombre0; + private String plaNombre; + private Double plaValorMensual; + private Double plaValorAnual; + private String detNombre1; + private Double pepMontoCobertura; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + private String detNombre; + private String perMail; + private String numerosContacto; + + public VwReporteProduccionDTO() { + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public String getDetNombre0() { + return detNombre0; + } + + public void setDetNombre0(String detNombre0) { + this.detNombre0 = detNombre0; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public String getDetNombre1() { + return detNombre1; + } + + public void setDetNombre1(String detNombre1) { + this.detNombre1 = detNombre1; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getPerMail() { + return perMail; + } + + public void setPerMail(String perMail) { + this.perMail = perMail; + } + + public String getNumerosContacto() { + return numerosContacto; + } + + public void setNumerosContacto(String numerosContacto) { + this.numerosContacto = numerosContacto; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwRepprimaPlanDTO.java b/src/main/java/com/qsoft/erp/dto/VwRepprimaPlanDTO.java new file mode 100644 index 0000000..8784d63 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwRepprimaPlanDTO.java @@ -0,0 +1,100 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import java.io.Serializable; + +/** + * + * @author james + */ +public class VwRepprimaPlanDTO implements Serializable { + + private static final long serialVersionUID = 277836005898046L; + + private Integer plaCodigo; + private String plaNombre; + private String plaProducto; + private Double plaValorAnual; + private Long numeroPolizas; + private Double sumaTotalPolizas; + private Double valorMensualPoliza; + private Double valorMensual; + private String periodicidad; + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaProducto() { + return plaProducto; + } + + public void setPlaProducto(String plaProducto) { + this.plaProducto = plaProducto; + } + + public Long getNumeroPolizas() { + return numeroPolizas; + } + + public void setNumeroPolizas(Long numeroPolizas) { + this.numeroPolizas = numeroPolizas; + } + + public String getPeriodicidad() { + return periodicidad; + } + + public void setPeriodicidad(String periodicidad) { + this.periodicidad = periodicidad; + } + + public Double getPlaValorAnual() { + return plaValorAnual; + } + + public void setPlaValorAnual(Double plaValorAnual) { + this.plaValorAnual = plaValorAnual; + } + + public Double getSumaTotalPolizas() { + return sumaTotalPolizas; + } + + public void setSumaTotalPolizas(Double sumaTotalPolizas) { + this.sumaTotalPolizas = sumaTotalPolizas; + } + + public Double getValorMensualPoliza() { + return valorMensualPoliza; + } + + public void setValorMensualPoliza(Double valorMensualPoliza) { + this.valorMensualPoliza = valorMensualPoliza; + } + + public Double getValorMensual() { + return valorMensual; + } + + public void setValorMensual(Double valorMensual) { + this.valorMensual = valorMensual; + } + +} diff --git a/src/main/java/com/qsoft/erp/dto/VwUsuarioPersonaPolizaPlanDTO.java b/src/main/java/com/qsoft/erp/dto/VwUsuarioPersonaPolizaPlanDTO.java new file mode 100644 index 0000000..3403a77 --- /dev/null +++ b/src/main/java/com/qsoft/erp/dto/VwUsuarioPersonaPolizaPlanDTO.java @@ -0,0 +1,451 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.Serializable; +import java.util.Date; + +public class VwUsuarioPersonaPolizaPlanDTO implements Serializable { + + private static final long serialVersionUID = 23735178262551L; + + private Integer perCodigo; + private String usuNombre; + private String usuDescripcion; + private String usuUrlImagen; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date usuFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date usuFechaToken; + private String usuToken; + private Integer usuTiempoToken; + private Short usuEstado; + private Integer detTipoIdentificacion; + private String perIdentificacion; + private String perNombres; + private String perApellidos; + private String perNacionalidad; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaRegistro; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date perFechaNacimiento; + private Short perEstado; + private Integer detTipoPersona; + private String pepObservacion; + private Double pepMontoCobertura; + private Integer detIfi; + private Integer detEstado; + private String polContrato; + private Integer polDiasCobertura; + private String polObservacion; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaInicio; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaFin; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DominioConstantes.FORMATO_FECHA_FRONT, locale = "es-EC", timezone = "America/Guayaquil") + private Date polFechaRegistro; + private Integer detModalidad; + private Integer detDeducible; + private Integer detTarifario; + private String plaNombre; + private String plaRutaContrato; + private Double plaValorMensual; + private Double plaPorDescuento; + private Integer plaNumBeneficiarios; + private Double plaCoberturaMaxima; + private Short plaEstado; + private String detNemonico; + private String detTipo; + private String detNombre; + private String detOrigen; + private String detDestino; + private String detDescripcion; + private String archivo; + private Integer polCodigo; + private Integer plaCodigo; + + public VwUsuarioPersonaPolizaPlanDTO() { + } + + public Integer getPolCodigo() { + return polCodigo; + } + + public void setPolCodigo(Integer polCodigo) { + this.polCodigo = polCodigo; + } + + public Integer getPlaCodigo() { + return plaCodigo; + } + + public void setPlaCodigo(Integer plaCodigo) { + this.plaCodigo = plaCodigo; + } + + public Integer getPerCodigo() { + return perCodigo; + } + + public void setPerCodigo(Integer perCodigo) { + this.perCodigo = perCodigo; + } + + public String getUsuNombre() { + return usuNombre; + } + + public void setUsuNombre(String usuNombre) { + this.usuNombre = usuNombre; + } + + public String getUsuDescripcion() { + return usuDescripcion; + } + + public void setUsuDescripcion(String usuDescripcion) { + this.usuDescripcion = usuDescripcion; + } + + public String getUsuUrlImagen() { + return usuUrlImagen; + } + + public void setUsuUrlImagen(String usuUrlImagen) { + this.usuUrlImagen = usuUrlImagen; + } + + public Date getUsuFechaRegistro() { + return usuFechaRegistro; + } + + public void setUsuFechaRegistro(Date usuFechaRegistro) { + this.usuFechaRegistro = usuFechaRegistro; + } + + public Date getUsuFechaToken() { + return usuFechaToken; + } + + public void setUsuFechaToken(Date usuFechaToken) { + this.usuFechaToken = usuFechaToken; + } + + public String getUsuToken() { + return usuToken; + } + + public void setUsuToken(String usuToken) { + this.usuToken = usuToken; + } + + public Integer getUsuTiempoToken() { + return usuTiempoToken; + } + + public void setUsuTiempoToken(Integer usuTiempoToken) { + this.usuTiempoToken = usuTiempoToken; + } + + public Short getUsuEstado() { + return usuEstado; + } + + public void setUsuEstado(Short usuEstado) { + this.usuEstado = usuEstado; + } + + public Integer getDetTipoIdentificacion() { + return detTipoIdentificacion; + } + + public void setDetTipoIdentificacion(Integer detTipoIdentificacion) { + this.detTipoIdentificacion = detTipoIdentificacion; + } + + public String getPerIdentificacion() { + return perIdentificacion; + } + + public void setPerIdentificacion(String perIdentificacion) { + this.perIdentificacion = perIdentificacion; + } + + public String getPerNombres() { + return perNombres; + } + + public void setPerNombres(String perNombres) { + this.perNombres = perNombres; + } + + public String getPerApellidos() { + return perApellidos; + } + + public void setPerApellidos(String perApellidos) { + this.perApellidos = perApellidos; + } + + public String getPerNacionalidad() { + return perNacionalidad; + } + + public void setPerNacionalidad(String perNacionalidad) { + this.perNacionalidad = perNacionalidad; + } + + public Date getPerFechaRegistro() { + return perFechaRegistro; + } + + public void setPerFechaRegistro(Date perFechaRegistro) { + this.perFechaRegistro = perFechaRegistro; + } + + public Date getPerFechaNacimiento() { + return perFechaNacimiento; + } + + public void setPerFechaNacimiento(Date perFechaNacimiento) { + this.perFechaNacimiento = perFechaNacimiento; + } + + public Short getPerEstado() { + return perEstado; + } + + public void setPerEstado(Short perEstado) { + this.perEstado = perEstado; + } + + public Integer getDetTipoPersona() { + return detTipoPersona; + } + + public void setDetTipoPersona(Integer detTipoPersona) { + this.detTipoPersona = detTipoPersona; + } + + public String getPepObservacion() { + return pepObservacion; + } + + public void setPepObservacion(String pepObservacion) { + this.pepObservacion = pepObservacion; + } + + public Double getPepMontoCobertura() { + return pepMontoCobertura; + } + + public void setPepMontoCobertura(Double pepMontoCobertura) { + this.pepMontoCobertura = pepMontoCobertura; + } + + public Integer getDetIfi() { + return detIfi; + } + + public void setDetIfi(Integer detIfi) { + this.detIfi = detIfi; + } + + public Integer getDetEstado() { + return detEstado; + } + + public void setDetEstado(Integer detEstado) { + this.detEstado = detEstado; + } + + public String getPolContrato() { + return polContrato; + } + + public void setPolContrato(String polContrato) { + this.polContrato = polContrato; + } + + public Integer getPolDiasCobertura() { + return polDiasCobertura; + } + + public void setPolDiasCobertura(Integer polDiasCobertura) { + this.polDiasCobertura = polDiasCobertura; + } + + public String getPolObservacion() { + return polObservacion; + } + + public void setPolObservacion(String polObservacion) { + this.polObservacion = polObservacion; + } + + public Date getPolFechaInicio() { + return polFechaInicio; + } + + public void setPolFechaInicio(Date polFechaInicio) { + this.polFechaInicio = polFechaInicio; + } + + public Date getPolFechaFin() { + return polFechaFin; + } + + public void setPolFechaFin(Date polFechaFin) { + this.polFechaFin = polFechaFin; + } + + public Date getPolFechaRegistro() { + return polFechaRegistro; + } + + public void setPolFechaRegistro(Date polFechaRegistro) { + this.polFechaRegistro = polFechaRegistro; + } + + public Integer getDetModalidad() { + return detModalidad; + } + + public void setDetModalidad(Integer detModalidad) { + this.detModalidad = detModalidad; + } + + public Integer getDetDeducible() { + return detDeducible; + } + + public void setDetDeducible(Integer detDeducible) { + this.detDeducible = detDeducible; + } + + public Integer getDetTarifario() { + return detTarifario; + } + + public void setDetTarifario(Integer detTarifario) { + this.detTarifario = detTarifario; + } + + public String getPlaNombre() { + return plaNombre; + } + + public void setPlaNombre(String plaNombre) { + this.plaNombre = plaNombre; + } + + public String getPlaRutaContrato() { + return plaRutaContrato; + } + + public void setPlaRutaContrato(String plaRutaContrato) { + this.plaRutaContrato = plaRutaContrato; + } + + public Double getPlaValorMensual() { + return plaValorMensual; + } + + public void setPlaValorMensual(Double plaValorMensual) { + this.plaValorMensual = plaValorMensual; + } + + public Double getPlaPorDescuento() { + return plaPorDescuento; + } + + public void setPlaPorDescuento(Double plaPorDescuento) { + this.plaPorDescuento = plaPorDescuento; + } + + public Integer getPlaNumBeneficiarios() { + return plaNumBeneficiarios; + } + + public void setPlaNumBeneficiarios(Integer plaNumBeneficiarios) { + this.plaNumBeneficiarios = plaNumBeneficiarios; + } + + public Double getPlaCoberturaMaxima() { + return plaCoberturaMaxima; + } + + public void setPlaCoberturaMaxima(Double plaCoberturaMaxima) { + this.plaCoberturaMaxima = plaCoberturaMaxima; + } + + public Short getPlaEstado() { + return plaEstado; + } + + public void setPlaEstado(Short plaEstado) { + this.plaEstado = plaEstado; + } + + public String getDetNemonico() { + return detNemonico; + } + + public void setDetNemonico(String detNemonico) { + this.detNemonico = detNemonico; + } + + public String getDetTipo() { + return detTipo; + } + + public void setDetTipo(String detTipo) { + this.detTipo = detTipo; + } + + public String getDetNombre() { + return detNombre; + } + + public void setDetNombre(String detNombre) { + this.detNombre = detNombre; + } + + public String getDetOrigen() { + return detOrigen; + } + + public void setDetOrigen(String detOrigen) { + this.detOrigen = detOrigen; + } + + public String getDetDestino() { + return detDestino; + } + + public void setDetDestino(String detDestino) { + this.detDestino = detDestino; + } + + public String getDetDescripcion() { + return detDescripcion; + } + + public void setDetDescripcion(String detDescripcion) { + this.detDescripcion = detDescripcion; + } + + public String getArchivo() { + return archivo; + } + + public void setArchivo(String archivo) { + this.archivo = archivo; + } + +} diff --git a/src/main/java/com/qsoft/erp/reportes/Firma.java b/src/main/java/com/qsoft/erp/reportes/Firma.java new file mode 100644 index 0000000..c3ed0bd --- /dev/null +++ b/src/main/java/com/qsoft/erp/reportes/Firma.java @@ -0,0 +1,61 @@ + +package com.qsoft.erp.reportes; + +import com.lowagie.text.pdf.AcroFields; +import com.lowagie.text.pdf.PdfPKCS7; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.cert.Certificate; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Random; + +/** + * @author Imaginanet + */ +public class Firma { + + + public void firmar(){ + try { + Random rnd = new Random(); + KeyStore kall = PdfPKCS7.loadCacertsKeyStore(); + com.lowagie.text.pdf.PdfReader reader = new com.lowagie.text.pdf.PdfReader(" "); + AcroFields af = reader.getAcroFields(); + ArrayList names = af.getSignatureNames(); + for (int k = 0; k < names.size(); ++k) { + String name = (String)names.get(k); + int random = rnd.nextInt(); + FileOutputStream out = new FileOutputStream("revision_" + random + "_" + af.getRevision(name) + ".pdf"); + + byte bb[] = new byte[8192]; + InputStream ip = af.extractRevision(name); + int n = 0; + while ((n = ip.read(bb)) > 0) + out.write(bb, 0, n); + out.close(); + ip.close(); + + PdfPKCS7 pk = af.verifySignature(name); + Calendar cal = pk.getSignDate(); + Certificate pkc[] = pk.getCertificates(); + Object fails[] = PdfPKCS7.verifyCertificates(pkc, kall, null, cal); + if (fails == null) { + System.out.print(pk.getSignName()); + } + else { + System.out.print("Firma no válida"); + } + File f = new File("revision_" + random + "_" + af.getRevision(name) + ".pdf"); + f.delete(); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + +} + diff --git a/src/main/java/com/qsoft/erp/reportes/Firmador.java b/src/main/java/com/qsoft/erp/reportes/Firmador.java new file mode 100644 index 0000000..ee5b594 --- /dev/null +++ b/src/main/java/com/qsoft/erp/reportes/Firmador.java @@ -0,0 +1,86 @@ +package com.qsoft.erp.reportes; +//import io.rubrica.keystore.Alias; +//import io.rubrica.keystore.FileKeyStoreProvider; + +public class Firmador { + + private static final String PDF = "/var/tmp/pdf.pdf"; + private static final String PDF_SIGNED = "/var/tmp/pdf2.pdf"; + private static final String CERTIFICATE = "/home/rarguello/P0000000478.p12"; + private static final char[] PASSWORD = "ricardo".toCharArray(); + + public static void main(String[] args) throws Exception { + +//// System.out.println("Read PDF"); +//// byte[] pdf = Files.readAllBytes(Paths.get(PDF)); +//// FileKeyStoreProvider kp = new FileKeyStoreProvider(CERTIFICATE); +//// KeyStore ks = kp.getKeystore(PASSWORD); +//// List signingAliases = KeyStoreUtilities.getSigningAliases(ks); +//// Alias alias = signingAliases.get(0); +//// PrivateKey pk = (PrivateKey) ks.getKey(alias.getAlias(), PASSWORD); +//// Certificate[] chain = ks.getCertificateChain(alias.getAlias()); +// +// //------------------------------------------------------------- +// System.out.println("Pre Sign"); +// PdfReader reader = new PdfReader(pdf); +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// +// PdfStamper stamper = PdfStamper.createSignature(reader, baos, '\0'); +// PdfSignatureAppearance sap = stamper.getSignatureAppearance(); +// sap.setReason("Test"); +// sap.setLocation("On a server!"); +// sap.setVisibleSignature(new Rectangle(36, 748, 144, 780), 1, "sig"); +// sap.setCertificate(chain[0]); +// +// PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED); +// dic.setReason(sap.getReason()); +// dic.setLocation(sap.getLocation()); +// dic.setContact(sap.getContact()); +// dic.setDate(new PdfDate(sap.getSignDate())); +// sap.setCryptoDictionary(dic); +// +// HashMap exc = new HashMap(); +// exc.put(PdfName.CONTENTS, new Integer(8192 * 2 + 2)); +// sap.preClose(exc); +// +// ExternalDigest externalDigest = new ExternalDigest() { +// public MessageDigest getMessageDigest(String hashAlgorithm) throws GeneralSecurityException { +// return DigestAlgorithms.getMessageDigest(hashAlgorithm, null); +// } +// }; +// +// PdfPKCS7 sgn = new PdfPKCS7(null, chain, "SHA256", null, externalDigest, false); +// InputStream data = sap.getRangeStream(); +// byte hash[] = DigestAlgorithms.digest(data, externalDigest.getMessageDigest("SHA256")); +// byte[] sh = sgn.getAuthenticatedAttributeBytes(hash, null, null, CryptoStandard.CMS); +// +// //------------------------------------------------------------- +// System.out.println("Sign"); +// Signature sig = Signature.getInstance("SHA256withRSA"); +// sig.initSign(pk); +// sig.update(sh); +// byte[] signedHash = sig.sign(); +// +// //------------------------------------------------------------- +// System.out.println("Post Sign"); +// sgn.setExternalDigest(signedHash, null, "RSA"); +// byte[] encodedSig = sgn.getEncodedPKCS7(hash, null, null, null, CryptoStandard.CMS); +// byte[] paddedSig = new byte[8192]; +// System.arraycopy(encodedSig, 0, paddedSig, 0, encodedSig.length); +// +// PdfDictionary dic2 = new PdfDictionary(); +// dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); +// +// try { +// sap.close(dic2); +// } catch (DocumentException e) { +// throw new IOException(e); +// } +// +// System.out.println("Save"); +// byte[] signedPdf = baos.toByteArray(); +// Files.write(Paths.get(PDF_SIGNED), signedPdf); +// +// System.out.println("Done"); + } +} diff --git a/src/main/java/com/qsoft/erp/reportes/PoiExport.java b/src/main/java/com/qsoft/erp/reportes/PoiExport.java new file mode 100644 index 0000000..b3aa192 --- /dev/null +++ b/src/main/java/com/qsoft/erp/reportes/PoiExport.java @@ -0,0 +1,98 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.reportes; + +import com.qsoft.dao.util.Constantes; +import com.qsoft.erp.constantes.DominioConstantes; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import org.apache.commons.codec.binary.Base64; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CreationHelper; + +/** + * + * @author james + */ +public class PoiExport { + + /** + * + * @param data + * @return + * @throws IOException + */ + public static String getCSV(List> data) throws IOException { + StringBuilder build = new StringBuilder(); + for (List fila : data) { + build.append(fila.toString().replace("[", "").replace("]", "")).append(Constantes.SALTO_LINEA); + } + String result = Base64.encodeBase64String(build.toString().getBytes()); + + return result; + } + + /** + * + * @param data + * @param nombre + * @return + * @throws IOException + */ + public static String getExcel(List> data, String nombre) throws IOException { + ByteArrayOutputStream bos; + String result; + try ( HSSFWorkbook workbook = new HSSFWorkbook()) { + HSSFSheet sheet = workbook.createSheet(nombre); + HSSFFont bold = workbook.createFont(); + bold.setBold(true); + + HSSFCellStyle styleBold = workbook.createCellStyle(); + styleBold.setFont(bold); + CellStyle dateStyle = workbook.createCellStyle(); + CreationHelper createHelper = workbook.getCreationHelper(); + dateStyle.setDataFormat(createHelper.createDataFormat().getFormat(DominioConstantes.FORMATO_FECHA_FRONT)); + + Integer rownum = 0; + for (List fila : data) { + HSSFRow row = sheet.createRow(rownum++); + Integer cellnum = 0; + for (Object obj : fila) { + HSSFCell cell = row.createCell(cellnum++); + if (rownum == 1) { + cell.setCellStyle(styleBold); + } + if (obj instanceof Date) { + cell.setCellValue((Date) obj); + cell.setCellStyle(dateStyle); + } else if (obj instanceof Boolean) { + cell.setCellValue((Boolean) obj); + } else if (obj instanceof Double) { + cell.setCellValue((Double) obj); + } else if (obj instanceof Integer) { + cell.setCellValue((Integer) obj); + } else { + cell.setCellValue("" + obj); + } + } + } + bos = new ByteArrayOutputStream(); + workbook.write(bos); + result = Base64.encodeBase64String(bos.toByteArray()); + } + bos.close(); + return result; + } + +} diff --git a/src/main/java/com/qsoft/erp/reportes/UtilitarioReporte.java b/src/main/java/com/qsoft/erp/reportes/UtilitarioReporte.java new file mode 100644 index 0000000..8fb945a --- /dev/null +++ b/src/main/java/com/qsoft/erp/reportes/UtilitarioReporte.java @@ -0,0 +1,411 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.erp.reportes; + +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.PdfContentByte; +import com.itextpdf.text.pdf.PdfImportedPage; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfWriter; +import com.qsoft.erp.constantes.DetalleCatalogoEnum; +import com.qsoft.erp.constantes.DominioConstantes; +import com.qsoft.erp.model.CuentaBancaria; +import com.qsoft.erp.model.DetalleCatalogo; +import com.qsoft.erp.model.DetalleLiquidacion; +import com.qsoft.erp.model.Formulario; +import com.qsoft.erp.model.Liquidacion; +import com.qsoft.erp.model.Persona; +import com.qsoft.erp.model.PersonaPoliza; +import com.qsoft.erp.model.Poliza; +import com.qsoft.erp.model.TarifaLiquidacion; +import com.qsoft.erp.model.Telefono; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; + +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JasperReport; + +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JREmptyDataSource; +import net.sf.jasperreports.engine.util.JRLoader; +import org.apache.commons.codec.binary.Base64; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class UtilitarioReporte { + + static Logger log = LogManager.getLogger(UtilitarioReporte.class); + private DecimalFormat decf = new DecimalFormat("#,##0.00"); + + /** + * + * @param poliza + * @param liquidacion + * @param detalles + * @param titular + * @param beneficiario + * @return + * @throws Exception + */ + public String generarLiquidacion(Poliza poliza, Liquidacion liquidacion, Set detalles, + Persona titular, PersonaPoliza beneficiario) throws Exception { + String reporte = DetalleCatalogoEnum.REPLIQ.getDetalle().getDetOrigen(); + String export = DetalleCatalogoEnum.URLLIQ.getDetalle().getDetOrigen(); + Calendar fecha = Calendar.getInstance(); + fecha.setTime(liquidacion.getLiqFechaRegistro()); + int year = fecha.get(Calendar.YEAR); + export = String.format(export, "" + year, liquidacion.getLiqNemonico()); + + export = String.format(export, "" + year); + File folder = new File(export); + folder.mkdirs(); + export = export.concat(liquidacion.getLiqNemonico() + ".pdf"); + + Map parametros = this.getParametrosLiquidacion(liquidacion, poliza, detalles, titular, beneficiario); + JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File(reporte)); + JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parametros); + JasperExportManager.exportReportToPdfFile(jasperPrint, export); + + return export; + } + + /** + * + * @param poliza + * @param persona + * @return + * @throws Exception + */ + public String generarContrato(Poliza poliza, Persona persona) throws Exception { + String reporte = DetalleCatalogoEnum.URLREP.getDetalle().getDetOrigen(); + int year = Calendar.getInstance().get(Calendar.YEAR); + String urlBase = DetalleCatalogoEnum.URLFIL.getDetalle().getDetOrigen(); + String tmp = urlBase.concat(poliza.getPolContrato() + "_tmp.pdf"); + String export = DetalleCatalogoEnum.URLPOL.getDetalle().getDetOrigen(); + export = String.format(export, "" + year); + File folder = new File(export); + folder.mkdirs(); + export = export.concat(poliza.getPolContrato() + ".pdf"); + Map parametros = this.getParametrosContrato(poliza, persona); + JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File(reporte)); + JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parametros); + JasperExportManager.exportReportToPdfFile(jasperPrint, tmp); + String contrato = poliza.getPlaCodigo().getPlaRutaContrato(); + List list = new ArrayList<>(); + try { + list.add(new FileInputStream(new File(tmp))); + list.add(new FileInputStream(new File(contrato))); + OutputStream out = new FileOutputStream(new File(export)); + this.generarPDF(list, out); + File f = new File(tmp); + f.delete(); + } catch (Exception e) { + e.printStackTrace(System.out); + export = null; + } + System.out.println("OK REPORTE "); + return export; + } + + public String codificarBase64(String reporte) { + File archivoPDF = new File(reporte); + Base64 base64 = new Base64(); + byte[] fileArray = new byte[(int) archivoPDF.length()]; + InputStream inputStream; + String encodedFile = ""; + try { + inputStream = new FileInputStream(archivoPDF); + inputStream.read(fileArray); + encodedFile = base64.encodeToString(fileArray); + } catch (Exception e) { + // Manejar Error + } + return encodedFile; + } + + /** + * + * @param poliza + * @param persona + * @return + * @throws Exception + */ + public String generarAceptacion(Poliza poliza, Persona persona) throws Exception { + String reporte = DetalleCatalogoEnum.URLACE.getDetalle().getDetOrigen(); + int year = Calendar.getInstance().get(Calendar.YEAR); + String export = DetalleCatalogoEnum.URLPOL.getDetalle().getDetOrigen(); + export = String.format(export, "" + year).concat(poliza.getPolContrato() + "_DEBITO.pdf"); + Map parametros = this.getParametrosAceptacion(poliza, persona); + JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File(reporte)); + JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parametros); + JasperExportManager.exportReportToPdfFile(jasperPrint, export); + return export; + } + + /** + * + * @param poliza + * @return + */ + private Map getParametrosLiquidacion(Liquidacion liquidacion, Poliza poliza, Set detalles, + Persona titular, PersonaPoliza beneficiario) { + DateFormat format = new SimpleDateFormat("EEEE, dd MMMM yyyy HH:mm:ss"); + DetalleCatalogo cie10 = null; + List> detalle = new ArrayList(); + String reclamo = ""; + boolean isPrestador = liquidacion.getDetTipo().getDetNemonico().equalsIgnoreCase(DetalleCatalogoEnum.TIPLQPR.name()); + + String banco = isPrestador ? "%s RUC: %s, " : "%s IDENTIFICACION: %s, "; + String titularCta = titular.getPerNombres() + " " + titular.getPerApellidos(); + String idenCta = titular.getPerIdentificacion(); + Formulario formulario = null; + if (isPrestador) { + for (DetalleLiquidacion del : detalles) { + if (del.getPreCodigo() != null) { + if (del.getPreCodigo().getDetIfi() == null || del.getPreCodigo().getDetTipoCuenta() == null) { + banco += DominioConstantes.NO_INFO; + } else { + banco += del.getPreCodigo().getDetIfi().getDetNombre() + " " + del.getPreCodigo().getDetTipoCuenta().getDetNombre() + + " No. " + del.getPreCodigo().getPreCuenta(); + titularCta = del.getPreCodigo().getPreNombre(); + idenCta = del.getPreCodigo().getPreRuc(); + } + break; + } + } + banco = String.format(banco, titularCta, idenCta); + } else { + for (Formulario f : liquidacion.getFormularioCollection()) { + formulario = f; + break; + } + for (CuentaBancaria cb : titular.getCuentaBancariaCollection()) { + if (Objects.equals(DominioConstantes.ACTIVO, cb.getCueEstado())) { + banco += cb.getDetIfi().getDetNombre() + + " " + cb.getDetTipoCuenta().getDetNombre() + " No. " + cb.getCueCuenta(); + titularCta = cb.getCueNombreDebito() != null && !cb.getCueNombreDebito().isBlank() ? cb.getCueNombreDebito() : titularCta; + idenCta = cb.getCueIdentificacion() != null && !cb.getCueIdentificacion().isBlank() ? cb.getCueIdentificacion() : idenCta; + break; + } + } + banco = String.format(banco, titularCta, idenCta); + } + + String telefonos = ""; + for (Telefono tel : titular.getTelefonoCollection()) { + telefonos += tel.getDetTipo().getDetNombre() + ": " + tel.getTelNumero(); + telefonos += " "; + } + Set facturas = new HashSet<>(); + System.out.println("==========> DETALLES => " + detalles.size()); + for (DetalleLiquidacion del : detalles) { + cie10 = del.getDetCie10(); + facturas.add(del.getDelFactura()); + List fila = new ArrayList<>(); + Double cobert = del.getCopCodigo().getCopCopago() < 1 ? ((1.0 - del.getCopCodigo().getCopCopago()) * 100) : 100; + Double porPagar = isPrestador ? (del.getDelValorRegistrado() - del.getDelValorPagado()) : 0.0; + fila.add(del.getDelFactura()); //FACTURA + fila.add(del.getPreCodigo().getPreNombre()); //PRESTADOR + fila.add(del.getDelServicio()); //PRESTACIÓN + fila.add(this.decf.format(del.getDelValorRegistrado())); //VALOR FACTURA + fila.add(this.decf.format(del.getDelValorObjetado())); //TOPE COBERTURA + fila.add(this.decf.format(del.getDelDeduciblePagado())); //VALOR DEDUCIBLE + fila.add(this.decf.format(cobert)); //% COBERTURA + fila.add(this.decf.format(del.getDelValorPagado())); //VALOR CUBIERTO + fila.add(this.decf.format((porPagar))); //POR COBRAR + fila.add(this.decf.format(del.getDelValorPagado())); //VALOR PAGADO + Set obs = new HashSet<>(); + for (TarifaLiquidacion tal : del.getTarifaLiquidacionCollection()) { + if (tal.getTarObservacion() != null && !tal.getTarObservacion().isBlank()) { + obs.add(tal.getTarObservacion().trim()); + } + } + fila.add(obs.toString().replace("[", "").replace("]", "")); //OBSERVACION + detalle.add(fila); + } + DateTimeFormatter fmt = DateTimeFormatter.ofPattern(DominioConstantes.FORMATO_FECHA); + Period periodo = Period.between( + LocalDate.parse(DominioConstantes.getDate(beneficiario.getPerCodigo().getPerFechaNacimiento()), fmt), LocalDate.now()); + + reclamo = liquidacion.getLiqFechaIncurrencia() != null ? DominioConstantes.getDate(liquidacion.getLiqFechaIncurrencia()) : ""; + + Map parametros = new HashMap<>(); + JRDataSource ds = new JREmptyDataSource(); + parametros.put("REPORT_DATA_SOURCE", ds); + parametros.put("LOGO_EMPRESA", DominioConstantes.IMAGE); + parametros.put("fondo", DominioConstantes.FONDOV); + parametros.put("plan", poliza.getPlaCodigo().getPlaNombre()); + parametros.put("titular", titular.getPerNombres() + " " + titular.getPerApellidos()); + parametros.put("paciente", beneficiario.getPerCodigo().getPerNombres() + " " + beneficiario.getPerCodigo().getPerApellidos()); + parametros.put("parentesco", beneficiario.getDetTipoPersona().getDetNombre()); + parametros.put("direccion", titular.getPerDireccion()); + parametros.put("diagnostico", cie10.getDetNombre()); + String atencion = isPrestador ? liquidacion.getDetAtencion().getDetNombre() : formulario.getDetProcedimiento().getDetNombre(); + parametros.put("atencion", atencion); + parametros.put("reclamo", reclamo); + parametros.put("contrato", poliza.getPolContrato()); + parametros.put("cedulaTitular", titular.getPerIdentificacion()); + parametros.put("cedulaPaciente", beneficiario.getPerCodigo().getPerIdentificacion()); + parametros.put("edad", "" + periodo.getYears()); + parametros.put("facturas", "" + facturas.size()); + parametros.put("datosBanco", banco); + double rete = liquidacion.getLiqRetenido() == null ? 0.0 : liquidacion.getLiqRetenido(); + parametros.put("retencion", "" + rete); + double valor = liquidacion.getLiqTotalLiquidado() == null ? 0.0 : liquidacion.getLiqTotalLiquidado(); + parametros.put("valor", "" + this.decf.format(valor)); + parametros.put("Vneto", "" + this.decf.format((valor + rete))); + parametros.put("fecha", format.format(liquidacion.getLiqFechaRegistro())); + parametros.put("sucursal", DominioConstantes.CIUDAD); + parametros.put("liquidacion", liquidacion.getLiqNemonico()); + parametros.put("form", "C-GCT-2020-SC-001"); + parametros.put("telefono", telefonos); + parametros.put("transfer", isPrestador ? "" : "X"); + parametros.put("cheque", ""); + parametros.put("subFactura", "" + this.decf.format(liquidacion.getLiqRegistrado())); + parametros.put("total", "" + this.decf.format(liquidacion.getLiqTotalLiquidado())); + parametros.put("subTope", "" + this.decf.format(liquidacion.getLiqObjetado())); + parametros.put("subCobertura", ""); + parametros.put("identificacionCta", idenCta); + parametros.put("titularCta", titularCta); + parametros.put("subDeducible", "" + this.decf.format(liquidacion.getLiqDeducible())); + parametros.put("subValCub", "" + this.decf.format(liquidacion.getLiqTotalLiquidado())); + double porCob = isPrestador ? (liquidacion.getLiqRegistrado() - liquidacion.getLiqTotalLiquidado()) : 0.0; + parametros.put("subPorCob", "" + this.decf.format(porCob)); + parametros.put("subPagado", "" + this.decf.format(liquidacion.getLiqTotalLiquidado())); + parametros.put("detalle", detalle); + return parametros; + } + + /** + * + * @param poliza + * @return + */ + private Map getParametrosContrato(Poliza poliza, Persona persona) { + DateFormat format = new SimpleDateFormat(DominioConstantes.FORMATO_FECHA_HORA); + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.MONTH, 1); + cal.set(Calendar.DAY_OF_MONTH, 1); + + Map parametros = new HashMap<>(); + parametros.put("LOGO_EMPRESA", DominioConstantes.IMAGE); + parametros.put("fondo", DominioConstantes.FONDO); + parametros.put("contrato", poliza.getPolContrato()); + parametros.put("certificado", poliza.getPolCertificado()); + parametros.put("fechaIni", format.format(poliza.getPolFechaInicio())); + parametros.put("fechaFin", format.format(poliza.getPolFechaFin())); + parametros.put("diasCobertura", "" + poliza.getPolDiasCobertura()); + parametros.put("broker", poliza.getPolBroker()); + String contratante = persona.getPerNombres(); + if (persona.getPerApellidos() != null && !persona.getPerApellidos().trim().isEmpty()) { + contratante = contratante.concat(" ").concat(persona.getPerApellidos()); + } + parametros.put("contratante", contratante); + parametros.put("direccion", persona.getPerDireccion()); + parametros.put("email", persona.getPerMail()); + parametros.put("plan", poliza.getPlaCodigo().getPlaNombre()); + parametros.put("formaPago", DominioConstantes.FORMA_PAGO); + parametros.put("montoMaximo", "" + poliza.getPlaCodigo().getPlaCoberturaMaxima()); + parametros.put("cedula", persona.getPerIdentificacion()); + List telefonos = (List) persona.getTelefonoCollection(); + if (telefonos != null && !telefonos.isEmpty() && telefonos.size() > 0) { + parametros.put("telefono", telefonos.get(0).getTelNumero()); + } else if (telefonos != null && !telefonos.isEmpty() && telefonos.size() > 1) { + parametros.put("celular", telefonos.get(0).getTelNumero()); + } + parametros.put("modalidad", poliza.getDetModalidad().getDetNombre()); + parametros.put("institucion", poliza.getEmpCodigo().getEmpNombreComercial()); + return parametros; + } + + /** + * + * @param poliza + * @return + */ + private Map getParametrosAceptacion(Poliza poliza, Persona persona) { + DateFormat format = new SimpleDateFormat("EEEE, dd MMMM yyyy HH:mm:ss"); + + Map parametros = new HashMap<>(); + parametros.put("LOGO_EMPRESA", DominioConstantes.IMAGE); + parametros.put("fondo", DominioConstantes.FONDO); + parametros.put("contrato", poliza.getPolContrato()); + parametros.put("certificado", poliza.getPolCertificado()); + parametros.put("fechaEmi", format.format(poliza.getPolFechaInicio())); + String contratante = persona.getPerNombres(); + if (persona.getPerApellidos() != null && !persona.getPerApellidos().trim().isEmpty()) { + contratante = contratante.concat(" ").concat(persona.getPerApellidos()); + } + parametros.put("contratante", contratante); + parametros.put("ifi", poliza.getDetIfi().getDetNombre()); + parametros.put("email", persona.getPerMail()); + parametros.put("cuenta", poliza.getPlaCodigo().getPlaNombre()); + parametros.put("formaPago", DominioConstantes.FORMA_PAGO); + if (poliza.getDetPeriodicidad().getDetNemonico().trim().equalsIgnoreCase("ANUA")) { + parametros.put("monto", "" + poliza.getPlaCodigo().getPlaValorAnual()); + } else { + parametros.put("monto", "" + poliza.getPlaCodigo().getPlaValorMensual()); + } + parametros.put("cedula", persona.getPerIdentificacion()); + List telefonos = (List) persona.getTelefonoCollection(); + if (telefonos != null && !telefonos.isEmpty() && telefonos.size() > 0) { + parametros.put("telefono", telefonos.get(0).getTelNumero()); + } else if (telefonos != null && !telefonos.isEmpty() && telefonos.size() > 1) { + parametros.put("celular", telefonos.get(0).getTelNumero()); + } + parametros.put("frecuencia", poliza.getDetModalidad().getDetNombre()); + parametros.put("institucion", poliza.getEmpCodigo().getEmpNombreComercial()); + return parametros; + } + + /** + * Mezclar múltiples archivos PDF en uno + * + * @param list Lista de InputStream de los archivos PDF a unir + * @param outputStream Stream de archivo de salida del PDF que resulta de la unión de los streams de la lista de entrada + * @throws DocumentException + * @throws IOException + */ + private void generarPDF(List list, OutputStream outputStream) throws DocumentException, IOException { + Document document = new Document(); + PdfWriter writer = PdfWriter.getInstance(document, outputStream); + document.open(); + PdfContentByte cb = writer.getDirectContent(); + for (InputStream in : list) { + PdfReader reader = new PdfReader(in); + for (int i = 1; i <= reader.getNumberOfPages(); i++) { + document.newPage(); + PdfImportedPage page = writer.getImportedPage(reader, i); + cb.addTemplate(page, 0, 0); + } + } + outputStream.flush(); + document.close(); + outputStream.close(); + } + +} diff --git a/src/main/java/com/qsoft/notificador/EmailDemo.java b/src/main/java/com/qsoft/notificador/EmailDemo.java new file mode 100644 index 0000000..f1d6a76 --- /dev/null +++ b/src/main/java/com/qsoft/notificador/EmailDemo.java @@ -0,0 +1,76 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.notificador; + +import com.qsoft.erp.model.Email; +import com.sun.mail.smtp.SMTPTransport; +import java.io.File; + +import javax.activation.DataHandler; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.io.IOException; +import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMultipart; + +public class EmailDemo { + + // for example, smtp.mailgun.org + public void sendMail(Email email) { + EmailProperties prop = new EmailProperties(email.getPlsmCodigo().getParCodigo()); + + Session session = Session.getInstance(prop, new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(prop.getUser(), prop.getPassword()); + } + }); + + Message message = new MimeMessage(session); + MimeBodyPart htmlPart = new MimeBodyPart(); + MimeBodyPart adjuntoPart = new MimeBodyPart(); + Multipart multipart = new MimeMultipart(); + + + try { + message.setFrom(new InternetAddress(prop.getFromMail(), prop.getFromName())); + System.out.println("Destinatario " + email.getEmaDestinatiario()); + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email.getEmaDestinatiario(), false)); + if (email.getEmaCopia() != null && !email.getEmaCopia().trim().isEmpty()) { + message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(email.getEmaCopia(), false)); + } + if (email.getEmaCopiaOculta() != null && !email.getEmaCopiaOculta().trim().isEmpty()) { + message.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(email.getEmaCopiaOculta(), false)); + } + if (email.getEmaAdjunto() != null && !email.getEmaAdjunto().trim().isEmpty()) { + //TODO: Imeplementar adjunto + } + message.setSubject(email.getEmaAsunto()); + System.out.println("Cargando plantilla... " + email.getPlsmCodigo().getPlaCodigo().getPlaRuta()); + htmlPart.setDataHandler(new DataHandler(new HtmlEmail.HTMLDataSource( + email.getPlsmCodigo().getPlaCodigo().getPlaRuta(), email.getEmaContenido()))); + + adjuntoPart.attachFile(new File("/store/Trabajo/RCB/Informe001_RCB.pdf")); + + multipart.addBodyPart(htmlPart); + multipart.addBodyPart(adjuntoPart); + message.setContent(multipart); + + SMTPTransport t = (SMTPTransport) session.getTransport("smtp"); + t.connect(prop.getServer(), prop.getUser(), prop.getPassword()); + t.sendMessage(message, message.getAllRecipients()); + t.close(); + System.out.println("OK "); + } catch (IOException | MessagingException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/com/qsoft/notificador/EmailProperties.java b/src/main/java/com/qsoft/notificador/EmailProperties.java new file mode 100644 index 0000000..b760e9d --- /dev/null +++ b/src/main/java/com/qsoft/notificador/EmailProperties.java @@ -0,0 +1,90 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.notificador; + +import com.qsoft.dao.exception.DaoException; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Parametro; +import java.util.Collection; +import java.util.Properties; + +/** + * + * @author james + */ +public class EmailProperties extends Properties { + + private static final String TIPO_PADRE = "SMTP"; + private static final String TIPO_PROPIEDAD = "PROPIEDAD"; + private static final String SMTP_SERVER = "mail.smtp.host"; + private static final String FROM_NAME = "FROMN"; + private static final String FROM_MAIL = "FROMM"; + private static final String USER = "USER"; + private static final String PASSWORD = "PASSWD"; + + public EmailProperties(String idConfig) { + super(); + try { + DaoGenerico dao = new DaoGenerico(Parametro.class); + this.fill(dao.buscarLista(crearPlantilla(idConfig))); + } catch (DaoException ex) { + ex.printStackTrace(System.err); + } + } + + public EmailProperties(Parametro smtp) { + super(); + this.fill(smtp.getParametroCollection()); + } + /** + * + * @param list + */ + private void fill(Collection list){ + for (Parametro p : list) { + if (p.getParTipo().equals(TIPO_PROPIEDAD)) { + this.put(p.getParNombre(), p.getParValor()); + } else { + this.put(p.getParNemonico(), p.getParValor()); + } + } + } + + /** + * + * @param padre + * @return + */ + private Parametro crearPlantilla(String padre) { + Parametro p = new Parametro(); + p.setParNemonico(padre); + p.setParTipo(TIPO_PADRE); + Parametro h = new Parametro(); + h.setParCodigoPadre(p); + return h; + } + + public String getFromMail() { + return this.getProperty(FROM_MAIL); + } + + public String getServer() { + return this.getProperty(SMTP_SERVER); + } + + public String getUser() { + return this.getProperty(USER); + } + + public String getPassword() { + return this.getProperty(PASSWORD); + } + + public String getFromName() { + return this.getProperty(FROM_NAME); + } + +} diff --git a/src/main/java/com/qsoft/notificador/HtmlEmail.java b/src/main/java/com/qsoft/notificador/HtmlEmail.java new file mode 100644 index 0000000..ff14f8c --- /dev/null +++ b/src/main/java/com/qsoft/notificador/HtmlEmail.java @@ -0,0 +1,130 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.notificador; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.erp.model.Email; +import com.sun.mail.smtp.SMTPTransport; +import java.io.ByteArrayInputStream; +import java.io.File; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; +import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMultipart; + +public class HtmlEmail { + + public void sendMail(Email email) { + EmailProperties prop = new EmailProperties(email.getPlsmCodigo().getParCodigo()); + + Session session = Session.getInstance(prop, new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(prop.getUser(), prop.getPassword()); + } + }); + + Message message = new MimeMessage(session); + MimeBodyPart htmlPart = new MimeBodyPart(); + MimeBodyPart adjuntoPart = new MimeBodyPart(); + Multipart multipart = new MimeMultipart(); + + try { + message.setFrom(new InternetAddress(prop.getFromMail(), prop.getFromName())); + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email.getEmaDestinatiario(), false)); + if (email.getEmaCopia() != null && !email.getEmaCopia().trim().isEmpty()) { + message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(email.getEmaCopia(), false)); + } + if (email.getEmaCopiaOculta() != null && !email.getEmaCopiaOculta().trim().isEmpty()) { + message.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(email.getEmaCopiaOculta(), false)); + } + if (email.getEmaAdjunto() != null && !email.getEmaAdjunto().trim().isEmpty()) { + try { + adjuntoPart.attachFile(new File(email.getEmaAdjunto())); + multipart.addBodyPart(adjuntoPart); + } catch (IOException ex) { + System.out.println("ERROR cargando archivo adjunto " + ex); + } + } + if (email.getEmaContenido().startsWith("{")) { + htmlPart.setDataHandler(new DataHandler(new HtmlEmail.HTMLDataSource( + email.getPlsmCodigo().getPlaCodigo().getPlaRuta(), email.getEmaContenido()))); + } else { + htmlPart.setContent(email.getEmaContenido(), "text/html; charset=utf-8"); + } + + multipart.addBodyPart(htmlPart); + message.setContent(multipart); + + message.setSubject(email.getEmaAsunto()); + + SMTPTransport t = (SMTPTransport) session.getTransport("smtp"); + t.connect(prop.getServer(), prop.getUser(), prop.getPassword()); + t.sendMessage(message, message.getAllRecipients()); + t.close(); + System.out.println("================ OK ENVIADO MAIL " + email.getEmaAsunto() + ": " + email.getEmaDestinatiario()); + } catch (IOException | MessagingException e) { + e.printStackTrace(System.err); + } + } + + static class HTMLDataSource implements DataSource { + + private final String htmlPath; + private final String jsonContent; + + public HTMLDataSource(String htmlPath, String jsonContent) { + this.htmlPath = htmlPath; + this.jsonContent = jsonContent; + } + + @Override + public InputStream getInputStream() throws IOException { + if (htmlPath == null || htmlPath.trim().isEmpty()) { + throw new IOException("Ruta de plantilla no puede ser nula"); + } + String data = new String(Files.readAllBytes(Paths.get(htmlPath)), StandardCharsets.UTF_8); + + ObjectMapper obj = new ObjectMapper(); + Map res = obj.readValue(this.jsonContent, Map.class); + for (Map.Entry e : res.entrySet()) { + while (data.contains(e.getKey())) { + data = data.replace(e.getKey(), e.getValue()); + } + } + return new ByteArrayInputStream(data.getBytes()); + } + + @Override + public OutputStream getOutputStream() throws IOException { + throw new IOException("No se puede escribir HTML"); + } + + @Override + public String getContentType() { + return "text/html"; + } + + @Override + public String getName() { + return "HTMLDataSource"; + } + } +} diff --git a/src/test/java/com/qsoft/test/FirmaTest.java b/src/test/java/com/qsoft/test/FirmaTest.java new file mode 100644 index 0000000..eac129c --- /dev/null +++ b/src/test/java/com/qsoft/test/FirmaTest.java @@ -0,0 +1,185 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test; + +//import org.bouncycastle.crypto.tls.Certificate; +//import io.rubrica.certificate.CertUtils; +//import static io.rubrica.certificate.CertUtils.seleccionarAlias; +//import io.rubrica.certificate.Certificado; +//import io.rubrica.core.SignatureVerificationException; +//import java.io.IOException; +//import java.security.KeyStore; +//import java.security.KeyStoreException; +//import java.security.PrivateKey; +//import java.security.cert.Certificate; +//import java.time.format.DateTimeFormatter; +//import java.util.Properties; +//import io.rubrica.exceptions.SignatureVerificationException; +//import io.rubrica.keystore.FileKeyStoreProvider; +//import io.rubrica.keystore.KeyStoreProvider; +// +//import io.rubrica.sign.SignConstants; +//import io.rubrica.sign.Signer; +//import io.rubrica.sign.pdf.PDFSigner; +//import io.rubrica.sign.pdf.PdfUtil; +//import io.rubrica.utils.FileUtils; +//import io.rubrica.utils.TiempoUtils; +//import io.rubrica.utils.Utils; +////import io.rubrica.util.UtilsCrlOcsp; +////import io.rubrica.util.X509CertificateUtils; +//import io.rubrica.validaciones.Documento; +//import java.io.File; +//import java.security.cert.X509Certificate; +//import java.time.Instant; +//import java.time.temporal.TemporalAccessor; +//import java.util.Date; +//import java.util.List; +/** + * + * @author james + */ +public class FirmaTest { + + +// private static final String ARCHIVO = "/store/Trabajo/QSoft/Firma/firma.p12"; +// private static final String PASSWORD = "Sidharta3748"; +// private static final String FILE = "/store/tmp/poliza.pdf"; +// +// public static void main(String args[]) throws KeyStoreException, Exception { +// firmarDocumento(FILE); +// } +// +// private static Properties parametros() throws IOException { +// String llx = "10"; +// String lly = "830"; +// +// Properties params = new Properties(); +// params.setProperty(PDFSigner.SIGNING_LOCATION, "EC"); +// params.setProperty(PDFSigner.SIGNING_REASON, "Firmado digitalmente con RUBRICA"); +// params.setProperty(PDFSigner.SIGN_TIME, DominioConstantes.getDateTime()); +// params.setProperty(PDFSigner.LAST_PAGE, "1"); +// params.setProperty(PDFSigner.TYPE_SIG, "QR"); +// params.setProperty(PDFSigner.INFO_QR, "Firmado digitalmente QSoft TEchnologies"); +// params.setProperty(PDFSigner.TYPE_SIG, "FirmaDigital"); +// params.setProperty(PDFSigner.FONT_SIZE, "7"); +// +// params.setProperty(PdfUtil.positionOnPageLowerLeftX, llx); +// params.setProperty(PdfUtil.positionOnPageLowerLeftY, lly); +// //params.setProperty(PdfUtil.POSITION_ON_PAGE_UPPER_RIGHT_X, urx); +// //params.setProperty(PdfUtil.POSITION_ON_PAGE_UPPER_RIGHT_Y, ury); +// return params; +// } +// +// private static void firmarDocumento(String file) throws KeyStoreException, Exception { +// ////// LEER PDF: +// byte[] docByteArry = Documento.loadFile(file); +// +// // ARCHIVO +// KeyStoreProvider ksp = new FileKeyStoreProvider(ARCHIVO); +// KeyStore keyStore = ksp.getKeystore(PASSWORD.toCharArray()); +// // TOKEN +// //KeyStore keyStore = KeyStoreProviderFactory.getKeyStore(PASSWORD); +// +// byte[] signed = null; +// Signer signer = Utils.documentSigner(new File(file)); +// String alias = seleccionarAlias(keyStore); +// PrivateKey key = (PrivateKey) keyStore.getKey(alias, PASSWORD.toCharArray()); +// +// X509CertificateUtils x509CertificateUtils = new X509CertificateUtils(); +// if (x509CertificateUtils.validarX509Certificate((X509Certificate) keyStore.getCertificate(alias))) {//validación de firmaEC +// Certificate[] certChain = keyStore.getCertificateChain(alias); +// signed = signer.sign(docByteArry, SignConstants.SIGN_ALGORITHM_SHA1WITHRSA, key, certChain, parametros()); +// System.out.println("final firma\n-------"); +// ////// Permite guardar el archivo en el equipo y luego lo abre +// String nombreDocumento = FileUtils.crearNombreFirmado(new File(file), FileUtils.getExtension(signed)); +// java.io.FileOutputStream fos = new java.io.FileOutputStream(nombreDocumento); +// //Abrir documento +// new java.util.Timer().schedule(new java.util.TimerTask() { +// @Override +// public void run() { +// try { +// FileUtils.abrirDocumento(nombreDocumento); +// System.out.println(nombreDocumento); +// verificarDocumento(nombreDocumento); +// } catch (java.lang.Exception ex) { +// ex.printStackTrace(); +// } finally { +// System.exit(0); +// } +// } +// }, 3000); //espera 3 segundos +// fos.write(signed); +// fos.close(); +// //Abrir documento +// } else { +// System.out.println("Entidad Certificadora no reconocida"); +// } +// } +// +// private static void validarCertificado() throws IOException, KeyStoreException, Exception { +// // ARCHIVO +// KeyStoreProvider ksp = new FileKeyStoreProvider(ARCHIVO); +// KeyStore keyStore = ksp.getKeystore(PASSWORD.toCharArray()); +// // TOKEN +// //KeyStore keyStore = KeyStoreProviderFactory.getKeyStore(PASSWORD); +// +// String alias = seleccionarAlias(keyStore); +// X509Certificate x509Certificate = (X509Certificate) keyStore.getCertificate(alias); +// System.out.println("UID: " + Utils.getUID(x509Certificate)); +// System.out.println("CN: " + Utils.getCN(x509Certificate)); +// System.out.println("emisión: " + CertEcUtils.getNombreCA(x509Certificate)); +// System.out.println("fecha emisión: " + x509Certificate.getNotBefore()); +// System.out.println("fecha expiración: " + x509Certificate.getNotAfter()); +// System.out.println("ISSUER: " + x509Certificate.getIssuerX500Principal().getName()); +// +// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; +// TemporalAccessor accessor = dateTimeFormatter.parse(TiempoUtils.getFechaHoraServidor()); +// Date fechaHoraISO = Date.from(Instant.from(accessor)); +// +// //Validad certificado revocado +// Date fechaRevocado = UtilsCrlOcsp.validarFechaRevocado(x509Certificate); +// if (fechaRevocado != null && fechaRevocado.compareTo(fechaHoraISO) <= 0) { +// System.out.println("Certificado revocado: " + fechaRevocado); +// } +// if (fechaHoraISO.compareTo(x509Certificate.getNotBefore()) <= 0 || fechaHoraISO.compareTo(x509Certificate.getNotAfter()) >= 0) { +// System.out.println("Certificado caducado"); +// } +// System.out.println("Certificado emitido por entidad certificadora acreditada? " + Utils.verifySignature(x509Certificate)); +// } +// +// private static void verificarDocumento(String file) throws IOException, SignatureVerificationException, Exception { +// File documento = new File(file); +// List certificados = Utils.verificarDocumento(documento); +// certificados.forEach((certificado) -> { +// System.out.println(certificado.toString()); +// }); +// } +// +// //pruebas de fecha-hora +// private static void fechaHora(int segundos) throws KeyStoreException, Exception { +// tiempo(segundos);//espera en segundos +// do { +// try { +// System.out.println("getFechaHora() " + TiempoUtils.getFechaHora()); +// System.out.println("getFechaHoraServidor() " + TiempoUtils.getFechaHoraServidor()); +// } catch (IOException ioe) { +// ioe.printStackTrace(); +// } +// } while (tiempo); +// System.exit(0); +// } +// +// private static boolean tiempo = true; +// +// private static void tiempo(int segundos) { +// new java.util.Timer().schedule(new java.util.TimerTask() { +// @Override +// public void run() { +// tiempo = false; +// } +// }, segundos * 1000); //espera 3 segundos +// } +} diff --git a/src/test/java/com/qsoft/test/GeneradorCodigo.java b/src/test/java/com/qsoft/test/GeneradorCodigo.java new file mode 100644 index 0000000..2891e56 --- /dev/null +++ b/src/test/java/com/qsoft/test/GeneradorCodigo.java @@ -0,0 +1,163 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.math3.random.RandomDataGenerator; +import org.reflections.Reflections; + +/** + * + * @author james + */ +public class GeneradorCodigo { + + private static final String TAB = " "; + + private static final String GETTER = TAB + + TAB + "public %s get%s() {\n" + TAB + "return %s;\n" + TAB + "}"; + + private static final String SETTER = TAB + + TAB + "public void set%s(%s %s) {\n" + TAB + "this.%s = %s;\n" + TAB + "}"; + + public static void main(String[] args) { + String packOrigen = "com.qsoft.erp.model"; + String packDestino = "com.qsoft.erp."; + String destino = "/store/Trabajo/QSoft/WeMedicalPro/Fuentes/werp-domain/src/main/java/com/qsoft/erp/dto/"; +// generarCodigo(packOrigen, packDestino, destino, false); + System.out.println("" + generarEntidadEnum(packOrigen)); + } + + public static String generarEntidadEnum(String packOrigen){ + Reflections reflections = new Reflections(packOrigen); + Set> clases = reflections.getSubTypesOf(Serializable.class); + System.out.println("ENTIDAD ENUM"); + String salto = System.getProperty("line.separator"); + StringBuilder buil = new StringBuilder(); + for (Class t : clases) { + //Catalogo(Catalogo.class, CatalogoDTO.class, CatalogoMapper.class), + buil.append(TAB).append(t.getSimpleName()).append("(").append(t.getSimpleName()).append(".class, "). + append(t.getSimpleName()).append("DTO.class, ").append(t.getSimpleName()).append("Mapper.class),").append(salto); + } + return buil.toString(); + } + + /** + * + * @param packOrigen + * @param packDestino + * @param urlDestino + * @param override + */ + public static void generarCodigo(String packOrigen, String packDestino, String urlDestino, boolean override) { + + Reflections reflections = new Reflections(packOrigen); + Set> clases = reflections.getSubTypesOf(Serializable.class); + System.out.println("BUSCAR CLASES "); + for (Class t : clases) { + String data = crearMapper(t, packDestino); + String name = urlDestino.replace("/dto/", "/dominio/mapper/") + t.getSimpleName().replace(".java", "") + "Mapper.java"; + escribirData(name, data, false); + + data = crearDTO(t, packDestino); + name = urlDestino + t.getSimpleName().replace(".java", "") + "DTO.java"; + escribirData(name, data, false); + + } + } + + /** + * + * @param clase + * @param paquete + * @return + */ + public static String crearMapper(Class clase, String paquete) { + StringBuilder build = new StringBuilder(); + String nombre = clase.getSimpleName().concat("Mapper"); + String salto = System.getProperty("line.separator"); + build.append("package ").append(paquete).append("dominio.mapper").append(";").append(salto).append(salto); + build.append("import ").append(clase.getName()).append(";").append(salto); + build.append("import ").append(clase.getName().replace(".model", ".dto")).append("DTO;").append(salto); + build.append("import org.mapstruct.Mapper;").append(salto); + build.append("import org.mapstruct.factory.Mappers;").append(salto); + build.append(salto).append("@Mapper").append(salto); + build.append("public interface ").append(nombre).append(" {").append(salto).append(salto); + + build.append(TAB).append(nombre).append(" INSTANCE = Mappers.getMapper(").append(nombre).append(".class);").append(salto).append(salto); + + build.append(TAB).append(clase.getSimpleName()).append(" getEntidad(").append(clase.getSimpleName()). + append("DTO ").append(StringUtils.uncapitalize(clase.getSimpleName())).append(");").append(salto).append(salto); + + build.append(TAB).append(clase.getSimpleName()).append("DTO getDto(").append(clase.getSimpleName()).append(" "). + append(StringUtils.uncapitalize(clase.getSimpleName())).append(");").append(salto).append(salto); + + build.append("}"); + return build.toString(); + } + + /** + * + * @param clase + * @param paquete + * @return + */ + public static String crearDTO(Class clase, String paquete) { + StringBuilder build = new StringBuilder(); + String salto = System.getProperty("line.separator"); + build.append("package ").append(paquete).append("dto").append(";").append(salto); + build.append(salto).append("import java.io.Serializable;").append(salto); + build.append(salto).append("public class ").append(clase.getSimpleName()).append("DTO implements Serializable {").append(salto); + Long serial = new RandomDataGenerator().nextLong(1000000000L, 999999999999999L); + build.append(salto).append(TAB).append("private static final long serialVersionUID = "). + append(serial).append("L;").append(salto).append(salto); + Map variables = new LinkedHashMap<>(); + for (Field f : clase.getDeclaredFields()) { + String tipo = f.getType().getName(); + if (!f.getName().equalsIgnoreCase("serialVersionUID") && !tipo.equals("java.util.Collection")) { + + if (tipo.contains("java.lang") || tipo.contains("java.util")) { + tipo = tipo.replace("java.lang.", ""); + } else { + tipo = "Integer"; + } + build.append(TAB).append("private ").append(tipo).append(" ").append(f.getName()).append(";").append(salto).append(salto); + variables.put(f.getName(), tipo); + } + } + for (Map.Entry entry : variables.entrySet()) { + String tipo = entry.getValue(); + String val = entry.getKey(); + String valC = StringUtils.capitalize(val); + build.append(String.format(GETTER, tipo, valC, val)).append(salto).append(salto); + build.append(String.format(SETTER, valC, tipo, val, val, val)).append(salto).append(salto); + } + build.append("}"); + return build.toString(); + } + + private static void escribirData(String file, String data, boolean override) { + File salida = new File(file); + if (!override && salida.exists()) { + return; + } + try ( FileOutputStream os = new FileOutputStream(salida)) { + os.write(data.getBytes()); + } catch (IOException ex) { + ex.printStackTrace(System.out); + } + + } + +} diff --git a/src/test/java/com/qsoft/test/TesMail.java b/src/test/java/com/qsoft/test/TesMail.java new file mode 100644 index 0000000..700f843 --- /dev/null +++ b/src/test/java/com/qsoft/test/TesMail.java @@ -0,0 +1,121 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.qsoft.dao.exception.DaoException; +import com.qsoft.notificador.EmailProperties; +import com.qsoft.notificador.HtmlEmail; +import com.qsoft.erp.dao.DaoGenerico; +import com.qsoft.erp.model.Email; + +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * + * @author james + */ +public class TesMail { + + public static void main(String[] args) throws DaoException { + SortedMap a; +// System.out.println("Vamos ahi..."); + testMail(); +//// generaMap(); +// Collection col = null; +// for(String s: col){ +// System.out.println("QUE PASA "); +// } + } + + public static void add(int[] a){ + a[a.length - 1]++; + } + + public static void testProps() throws DaoException { + System.out.println("TESTING ...."); + EmailProperties p = new EmailProperties("QSOFT"); + System.out.println("OK POR ID \n" + p); + System.out.println("==========================================="); + + DaoGenerico dao = new DaoGenerico<>(Email.class); + Email reg = (Email) dao.cargar(1); + p = new EmailProperties(reg.getPlsmCodigo().getParCodigo()); + System.out.println("OK por PADRE\n" + p); + System.out.println("OK SE CONSULTO LA HUE..."); + } + + public static void testMail() throws DaoException { + System.out.println("Iniciando prueba mail...."); + HtmlEmail mail = new HtmlEmail(); + DaoGenerico dao = new DaoGenerico<>(Email.class); + Email reg = (Email) dao.cargar(57943); + mail.sendMail(reg); + +// List des = new ArrayList(); +// des.add("jruales@qsoftec.com"); +// des.add("earmijos@fepp.org.ec"); +// des.add("wlascano@fepp.org.ec"); +// des.add("jennyquishpe.jq@gmail.com"); +// des.add("oswaldo.farinando1@gmail.com"); +// des.add("jquishpe@cartonerapichincha.com.ec"); +// des.add("gguano@cartonerapichincha.com.ec"); +// des.add("mguano@egtransportes.com.ec"); +// des.add("contabilidad@ecuadepot.com"); +// des.add("andyescobar@gmail.com"); +// des.add("aescobar@cartonerapichincha.com.ec"); +// des.add("akescobar@cartonerapichincha.com.ec"); +// des.add("hcardenas@cartonerapichincha.com.ec"); +// des.add("jlsuarez@raulcoka.com"); +// des.add("secheverria@raulcoka.com"); +// des.add("oswaldo.farinango@kuehne-nagel.com"); +// for (String s : des) { +// System.out.println("ENVIAR A... " + s); +// reg.setEmaDestinatiario(s); +// } + } + + public static Map generaMap() { + Map data = new TreeMap<>(); + data.put("[ASUNTO]", ""); + data.put("[FECHA]", ""); + data.put("[NUMOTP]", ""); + data.put("[IDENTIFICACION]", ""); + data.put("[CLIENTE]", ""); + data.put("[EMAIL]", ""); + data.put("[EMISOR_WEB] ", ""); + data.put("[EMISOR]", ""); + data.put("[EMISOR_MAIL]", ""); + + ObjectMapper obj = new ObjectMapper(); + + try { + // get Oraganisation object as a json string + String jsonStr = obj.writeValueAsString(data); + // Displaying JSON String + System.out.println(jsonStr); + + String dataS = "{\"[ASUNTO]\":\"\",\"[CLIENTE]\":\"\",\"[COBERTURA]\":\"\",\"[COMPROBANTE]\":\"\",\"[EMAIL]\":\"\",\"[EMISOR]\":\"\",\"[EMISOR_MAIL]\":\"\",\"[EMISOR_WEB] \":\"\",\"[FECHAEMI]\":\"\",\"[IDENTIFICACION]\":\"\",\"[MONTO]\":\"\",\"[NUMDOC]\":\"\",\"[PLAN]\":\"\"}"; + + Map res = obj.readValue(dataS, TreeMap.class); + for (Map.Entry e : res.entrySet()) { + System.out.println(e.getKey() + " => " + e.getValue()); + e.setValue("VALOR EJEMPLO " + e.getKey()); + } + for (Map.Entry e : res.entrySet()) { + System.out.println(e.getKey() + " => " + e.getValue()); + } + } catch (JsonProcessingException e) { + e.printStackTrace(System.err); + } + + return data; + } + +} diff --git a/src/test/java/com/qsoft/test/TestPostmark.java b/src/test/java/com/qsoft/test/TestPostmark.java new file mode 100644 index 0000000..fc2d8ba --- /dev/null +++ b/src/test/java/com/qsoft/test/TestPostmark.java @@ -0,0 +1,80 @@ +package com.qsoft.test; + +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +import java.io.UnsupportedEncodingException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author james + */ +public class TestPostmark { + + private static final String USER = "apikey"; + private static final String PASS = "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"; + + public static void main(String[] args) { + TestPostmark tp = new TestPostmark(); + + tp.send("sppatnotificaciones@segurosmedi.com", "Notificaciones SPPAT Test", "james.programs@gmail.com", "Jaime Ruales", + "Pruebas Sendgrid", "Este es un correo de prueba estamos verificando funcionalidad a dominio externo"); + } + + public void send(String from, String fromName, String to, String toName, + String subject, String text) { + try { + Properties props = new Properties(); + props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.host", "smtp.sendgrid.net"); + props.put("mail.smtp.port", 465); + props.put("mail.smtp.auth", "true"); + + props.put("mail.smtp.starttls.enable", false); + props.put("mail.smtp.timeout", 2000); + props.put("mail.smtp.connectiontimeout", 2000); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + + System.out.println("Enviar con " + props); + Session mailSession = Session.getInstance(props, new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(USER, PASS); + } + }); + Transport transport = mailSession.getTransport(); + MimeMessage message = new MimeMessage(mailSession); + + Multipart multipart = new MimeMultipart("alternative"); + + if (text != null) { + BodyPart part1 = new MimeBodyPart(); + part1.setText(text); + multipart.addBodyPart(part1); + } + + message.setContent(multipart); + message.setFrom(new InternetAddress(from, fromName)); + message.setSubject(subject); + message.addRecipient(Message.RecipientType.TO, new InternetAddress(to, toName)); + + transport.connect(); + transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO)); + transport.close(); + } catch (MessagingException | UnsupportedEncodingException e) { + Logger.getLogger(TestPostmark.class.getName()).log(Level.SEVERE, null, e); + } + } + +} diff --git a/src/test/java/com/qsoft/test/Tester.java b/src/test/java/com/qsoft/test/Tester.java new file mode 100644 index 0000000..7efb619 --- /dev/null +++ b/src/test/java/com/qsoft/test/Tester.java @@ -0,0 +1,140 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTCreationException; +import com.auth0.jwt.exceptions.JWTVerificationException; +import com.auth0.jwt.interfaces.DecodedJWT; +import com.qsoft.util.ms.pojo.HeaderMS; +import com.qsoft.erp.dominio.exception.DominioExcepcion; +import com.qsoft.erp.dominio.util.DominioUtil; +import com.qsoft.erp.model.DetalleCatalogo; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import org.apache.commons.codec.digest.DigestUtils; + +/** + * + * @author james + */ +public class Tester { + + public static void main(String[] args) throws Exception { + DateFormat format = new SimpleDateFormat("EEEE, dd MMMM yyyy HH:mm:ss"); + System.out.println("=======> CREANDO ARCHIVO ZIP "); + String folder = "/data/wmp/usuarios/"; + String file = "archivo.zip"; + System.out.println(">> " + DigestUtils.sha512Hex("3c976a5e-e2be-44d9-b278-1ac622e46d51")); + + } + + public static void crearUsuario(String user, String pass) throws DominioExcepcion { + DominioUtil du = new DominioUtil(); + String ha = du.getSHAUsuario(user, pass); + System.out.println("<" + ha + ">"); + } + + public static void testToken() { + System.out.println("Test Token"); + HeaderMS hms = new HeaderMS(); + hms.setUsuario("David"); + hms.setAplicacion("WeMedicalPro"); + hms.setDispositivo("WeDevice"); + String tk = getToken(hms, "WePassword"); + System.out.println("TEST " + tk); + verificarToken(hms, tk); + } + + /** + * + * @param header + * @param password + * @return + */ + public static String getToken(HeaderMS header, String password) { + String token = null; + try { + if (header.getAplicacion() != null && header.getUsuario() != null && header.getDispositivo() != null) { + String user = header.getUsuario().concat(":").concat(header.getAplicacion()).concat(":"). + concat(header.getDispositivo()); + Algorithm algorithm = Algorithm.HMAC256("QSoft2020&EnigmaBuilWeMedicalProKey"); + token = JWT.create().withIssuer(user).sign(algorithm); + } + } catch (JWTCreationException e) { + e.printStackTrace(); + } + return token; + } + + public static boolean verificarToken(HeaderMS header, String token) { + boolean estado = false; + try { + if (header.getAplicacion() != null && header.getUsuario() != null && header.getDispositivo() != null) { + String user = header.getUsuario().concat(":").concat(header.getAplicacion()).concat(":"). + concat(header.getDispositivo()); + Algorithm algorithm = Algorithm.HMAC256("QSoft2020&EnigmaBuilWeMedicalProKey"); + JWTVerifier verifier = JWT.require(algorithm) + .withIssuer(user) + .build(); + DecodedJWT jwt = verifier.verify(token); + System.out.println("> " + jwt.getPayload()); + System.out.println("> " + jwt.getHeader()); + System.out.println("> " + jwt.getSignature()); + } + } catch (JWTVerificationException ex) { + ex.printStackTrace(); + } + return estado; + } + + /** + * + */ + public static void testFuncion() { + DetalleCatalogo dt = new DetalleCatalogo(); + dt.setDetOrigen("20001001"); + dt.setDetDestino("ConsultaGenerica::consultar"); + List> funciones = new ArrayList<>(); + funciones.add(getFuncion("ConsultaGenerica::consultar")); + + } + + public static Function getFuncion(String funcion) { + Function func = null; + + return func; + } + + public static void testConsulta() throws DominioExcepcion { +// System.out.println("TEST CONSULTA GENERICA "); +// ConsultaGenerica consulta = new ConsultaGenerica(); +// Map par = new HashMap<>(); +// par.put("DetCodigo", "1"); +// List data = consulta.consultaGenerica(null, EntidadEnum.DetalleCatalogo, par); +// System.out.println("Lo logro??? " + data); + } + + public static void testInsert() throws DominioExcepcion { +// System.out.println("TEST CONSULTA GENERICA "); +// AccionGenerica accion = new AccionGenerica(); +// List> list = new ArrayList<>(); +// Map par = new HashMap<>(); +//// par.put("parNemonico", "TEST"); +//// par.put("parNombre", "PARAMESTRO DE PRUEBA"); +//// par.put("parValor", "EJEMPLO DE PARAMETRO"); +//// par.put("parEstado", "1"); +// list.add(par); +// Map data = accion.accionGenerica(null, EntidadEnum.Catalogo, list, AccionGenerica.GUARDA); +// System.out.println("Lo logro??? " + data); + } + +} diff --git a/src/test/java/com/qsoft/test/stripe/ObjetoPago.java b/src/test/java/com/qsoft/test/stripe/ObjetoPago.java new file mode 100644 index 0000000..311773c --- /dev/null +++ b/src/test/java/com/qsoft/test/stripe/ObjetoPago.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test.stripe; + +import com.google.gson.annotations.SerializedName; + +/** + * + * @author james + */ +public class ObjetoPago { + + @SerializedName("items") + Object[] items; + + public Object[] getItems() { + return items; + } +} diff --git a/src/test/java/com/qsoft/test/stripe/PagoRoute.java b/src/test/java/com/qsoft/test/stripe/PagoRoute.java new file mode 100644 index 0000000..c5e5a3d --- /dev/null +++ b/src/test/java/com/qsoft/test/stripe/PagoRoute.java @@ -0,0 +1,59 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test.stripe; + +import com.google.gson.Gson; +import com.stripe.model.PaymentIntent; +import com.stripe.param.PaymentIntentCreateParams; +import spark.Request; +import spark.Response; +import spark.Route; + +/** + * + * @author james + */ +public class PagoRoute implements Route { + + private static Gson gson = new Gson(); + private String moneda; + + /** + * Tipo de moneda + * + * @param moneda usd + */ + public PagoRoute(String moneda) { + this.moneda = moneda; + } + + @Override + public Object handle(Request request, Response response) throws Exception { + response.type("application/json"); + ObjetoPago post = gson.fromJson(request.body(), ObjetoPago.class); + PaymentIntentCreateParams params = new PaymentIntentCreateParams.Builder() + .setCurrency(this.moneda) + .setAmount(this.calcularMonto(post.getItems())) + .build(); + PaymentIntent intento = PaymentIntent.create(params); + + RespuestaPago paymentResponse = new RespuestaPago(intento.getClientSecret()); + return gson.toJson(paymentResponse); + } + + /** + * + * @param items + * @return + */ + private long calcularMonto(Object[] items) { + // Replace this constant with a calculation of the order's amount + // Calculate the order total on the server to prevent + // users from directly manipulating the amount on the client + return 1400; + } + +} diff --git a/src/test/java/com/qsoft/test/stripe/RespuestaPago.java b/src/test/java/com/qsoft/test/stripe/RespuestaPago.java new file mode 100644 index 0000000..ea7025e --- /dev/null +++ b/src/test/java/com/qsoft/test/stripe/RespuestaPago.java @@ -0,0 +1,19 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test.stripe; + +/** + * + * @author james + */ +public class RespuestaPago { + + private String clientSecret; + + public RespuestaPago(String clientSecret) { + this.clientSecret = clientSecret; + } +} diff --git a/src/test/java/com/qsoft/test/stripe/StripeTest.java b/src/test/java/com/qsoft/test/stripe/StripeTest.java new file mode 100644 index 0000000..3230352 --- /dev/null +++ b/src/test/java/com/qsoft/test/stripe/StripeTest.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.qsoft.test.stripe; + +import com.google.gson.Gson; +import com.stripe.Stripe; +import com.stripe.exception.StripeException; +import java.nio.file.Paths; +import spark.Spark; + +/** + * + * @author james + */ +public class StripeTest { + + private final static String MONEDA = "usd"; + private static Gson gson = new Gson(); + + public static void main(String[] args) throws StripeException { + + } + + public boolean pagar() throws StripeException { + Spark.port(4242); + Spark.staticFiles.externalLocation(Paths.get("").toAbsolutePath().toString()); + // This is your real test secret API key. + Stripe.apiKey = "sk_test_51HRpHhJSiwKtwzlBGIMZWp5xHo2ywzD8d9Nq8cBP79wZKZA8XdEOcg9bU16xyxTiA5fO0w2XDGkd3yCfcHv5X2qF00fAwHG3ou"; + + Spark.post("/create-payment-intent", new PagoRoute(MONEDA)); + + return true; + } + +}