This commit is contained in:
parent
2c219e2fa5
commit
7de61ab179
|
|
@ -24,6 +24,7 @@ Any value defined here will override the pom.xml file value but is only applicab
|
|||
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
|
||||
<org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings>
|
||||
<org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>js/libs</org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>
|
||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv3ee6</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@ import com.qsoft.erp.constantes.EntidadEnum;
|
|||
import com.qsoft.erp.dominio.MultipartService;
|
||||
import com.qsoft.erp.dominio.exception.DominioExcepcion;
|
||||
import com.qsoft.erp.dominio.util.AuditoriaUtil;
|
||||
import com.qsoft.erp.dominio.util.DominioUtil;
|
||||
import com.qsoft.erp.dto.AuditoriaDTO;
|
||||
import com.qsoft.erp.dto.DocumentoDTO;
|
||||
import com.qsoft.erp.dto.LiquidacionDTO;
|
||||
import com.qsoft.wmp.services.util.ServiceUtil;
|
||||
import com.qsoft.wmp.services.xsd.EntradaAccion;
|
||||
import com.qsoft.wmp.services.xsd.EntradaLiquidacion;
|
||||
import com.qsoft.wmp.services.xsd.SalidaConsulta;
|
||||
import java.io.IOException;
|
||||
|
|
@ -59,6 +61,9 @@ public class MultipartResource {
|
|||
@Inject
|
||||
private AuditoriaUtil auditoria;
|
||||
|
||||
@Inject
|
||||
private DominioUtil dominioUtil;
|
||||
|
||||
@Context
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
|
@ -130,7 +135,7 @@ public class MultipartResource {
|
|||
"Uno o mas documentos enviados son nulos por favor verifique la informacion");
|
||||
}
|
||||
EntidadEnum entidad = Enum.valueOf(EntidadEnum.class, entrada.getBodyIn().getEntidad());
|
||||
data = this.multipart.multipartGenerico(entrada.getHeaderIn(), entidad,
|
||||
data = this.multipart.multipartLiquidacion(entrada.getHeaderIn(), entidad,
|
||||
entrada.getBodyIn().getParametros(), entrada.getBodyIn().getTipoConsulta());
|
||||
HeaderMS header = entrada.getHeaderIn();
|
||||
header.setFechaHora(DominioConstantes.getDateTime());
|
||||
|
|
@ -156,6 +161,100 @@ public class MultipartResource {
|
|||
return salida;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("documento")
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public SalidaConsulta postDocumento(FormDataMultiPart input) {
|
||||
SalidaConsulta salida = null;
|
||||
EntradaAccion entrada = null;
|
||||
Long time = System.currentTimeMillis();
|
||||
if (input != null) {
|
||||
List<Object> data = new ArrayList<>();
|
||||
Map<String, List<FormDataBodyPart>> parts = input.getFields();
|
||||
int i = 0;
|
||||
try {
|
||||
List<DocumentoDTO> documentoDTOs = new ArrayList<>();
|
||||
for (List<FormDataBodyPart> p : parts.values()) {
|
||||
System.out.println("FormDataBodyPart p.get(0) =>: " + p.get(0));
|
||||
FormDataBodyPart bodyPart = p.get(0);
|
||||
if (i == 0) {
|
||||
entrada = getEntradaAccion(bodyPart);
|
||||
if (entrada != null && entrada.getBodyIn() != null) {
|
||||
AuditoriaDTO dto = ServiceUtil.crearAuditoria(entrada.getHeaderIn(), entrada.getBodyIn().getEntidad(),
|
||||
super.getClass().getName() + ".posFile", request.getRequestURL().toString(),
|
||||
MultipartService.class.getName() + ".multipartGenerico", ServiceUtil.REQUEST,
|
||||
"" + entrada.getBodyIn().getTipoAccion(), 0, ServiceUtil.getJson(entrada));
|
||||
this.auditoria.AddAuditoria(dto);
|
||||
}
|
||||
} else {
|
||||
InputStream in = bodyPart.getValueAs(InputStream.class);
|
||||
try {
|
||||
if (in != null && entrada != null && entrada.getBodyIn().getEntidades() != null) {
|
||||
System.out.println("===== Entro a la condicion =====");
|
||||
DocumentoDTO doc = (DocumentoDTO) this.dominioUtil.crearObjeto(DocumentoDTO.class, entrada.getBodyIn().getEntidades().get(i - 1));
|
||||
doc.setData(in.readAllBytes());
|
||||
documentoDTOs.add(doc);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
System.out.println("ERROR CARGANDO ARCHIVO " + ex);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!validarEntrada(entrada, documentoDTOs)) {
|
||||
throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO,
|
||||
"Uno o mas documentos enviados son nulos por favor verifique la informacion");
|
||||
}
|
||||
EntidadEnum entidad = Enum.valueOf(EntidadEnum.class, entrada.getBodyIn().getEntidad());
|
||||
data = this.multipart.multipartGenerico(entrada.getHeaderIn(), entidad,
|
||||
entrada.getBodyIn().getEntidades(), entrada.getBodyIn().getTipoAccion(), documentoDTOs);
|
||||
HeaderMS header = entrada.getHeaderIn();
|
||||
header.setFechaHora(DominioConstantes.getDateTime());
|
||||
salida = ServiceUtil.crearSalidaConsultaOk(header, entrada.getBodyIn().getEntidad(), data);
|
||||
} catch (DominioExcepcion ex) {
|
||||
salida = ServiceUtil.crearSalidaConsultaError(ex.getCodigo(), ex.getMensaje());
|
||||
ex.printStackTrace();
|
||||
} catch (Exception ex) {
|
||||
salida = ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_ERROR_GENERICO, ex.toString());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_VALOR_NULO, "ERROR. La entrada no puede ser nula");
|
||||
}
|
||||
time = System.currentTimeMillis() - time;
|
||||
AuditoriaDTO dto = ServiceUtil.crearAuditoria(salida.getHeaderOut(), salida.getBodyOut().getEntidad(),
|
||||
super.getClass().getName() + ".posFile", request.getRequestURL().toString(),
|
||||
MultipartService.class.getName() + ".multipartGenerico", ServiceUtil.RESPONSE,
|
||||
"", time.intValue(), ServiceUtil.getJson(salida.getError()));
|
||||
this.auditoria.AddAuditoria(dto);
|
||||
|
||||
return salida;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entrada
|
||||
* @return
|
||||
*/
|
||||
private boolean validarEntrada(EntradaAccion entrada, List<DocumentoDTO> docs) {
|
||||
boolean estado = true;
|
||||
if (entrada == null || entrada.getBodyIn() == null || entrada.getBodyIn().getEntidades() == null) {
|
||||
return false;
|
||||
}
|
||||
if (entrada.getBodyIn() != null && entrada.getBodyIn().getEntidades() != null) {
|
||||
for (DocumentoDTO docMap : docs) {
|
||||
System.out.println("Docmap => " + docMap.toString());
|
||||
if (docMap == null || docMap.getData() == null) {
|
||||
estado = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return estado;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entrada
|
||||
|
|
@ -181,6 +280,31 @@ public class MultipartResource {
|
|||
return estado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea la entrada a partir de la consulta del servicio
|
||||
*
|
||||
* @param bp
|
||||
* @return
|
||||
*/
|
||||
public EntradaAccion getEntradaAccion(FormDataBodyPart bp) throws DominioExcepcion {
|
||||
EntradaAccion entrada = null;
|
||||
System.out.println("=====> entrada");
|
||||
InputStream in = bp.getValueAs(InputStream.class);
|
||||
if (in != null) {
|
||||
System.out.println("======> in: " + in.toString());
|
||||
try {
|
||||
String json = new String(in.readAllBytes());
|
||||
ObjectMapper maper = new ObjectMapper();
|
||||
maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
|
||||
entrada = maper.readValue(json, EntradaAccion.class);
|
||||
} catch (IOException ex) {
|
||||
throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No es posible convertir el JSON " + ex.toString());
|
||||
}
|
||||
}
|
||||
System.out.println("CREO ENTRADA... " + entrada);
|
||||
return entrada;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea la entrada a partir de la consulta del servicio
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,38 +1,10 @@
|
|||
|
||||
{
|
||||
"headerIn": {
|
||||
"dispositivo": "WeLaptop",
|
||||
"canal": null,
|
||||
"medio": null,
|
||||
"aplicacion": "WeMedicalProV1.0",
|
||||
"tipoTransaccion": "0101112",
|
||||
"usuario": "james",
|
||||
"uuid": "be00033837a8ebec86c9f17e1df8f4527815684c7f45b8214d2f3839ef678a71",
|
||||
"fechaHora": null,
|
||||
"idioma": null,
|
||||
"empresa": null,
|
||||
"geolocalizacion": null
|
||||
},
|
||||
"bodyIn": {
|
||||
"tipoAccion": 1,
|
||||
"entidad": "Poliza",
|
||||
"entidades": [
|
||||
{
|
||||
"polBroker": "PANDILLA",
|
||||
"detModalidad": 26,
|
||||
"detPeriodicidad": 17202,
|
||||
"detSucursalIfi": 23484,
|
||||
"plaCodigo": 71,
|
||||
"detFormaPago": 23516,
|
||||
"empCodigo": 3,
|
||||
"perCedulaTitular": "1103969430",
|
||||
"detTipoIdentificacion": 3,
|
||||
"detIfi": 23610,
|
||||
"detTipoCuenta": 17187,
|
||||
"polDebito": "MIguel triana",
|
||||
"detPromocion": -1,
|
||||
"cedulaDebito": "0920752326",
|
||||
"cuentaDebito": "45454545"
|
||||
}
|
||||
]
|
||||
}
|
||||
"contacto": ["Sr don daviik"],
|
||||
"contactoContable": ["Contador demo"],
|
||||
"emailContable": ["facturas@test.com"],
|
||||
"teléfonoContable": [],
|
||||
"telefono": ["02365487", "03569748", "0996852147"],
|
||||
"telefonoContacto": ["0965479965"],
|
||||
"email": ["email1@test.com", "email2@test.com"]
|
||||
}
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
"canal": null,
|
||||
"medio": null,
|
||||
"aplicacion": "WeMedicalProV1.0",
|
||||
"tipoTransaccion": "0101115",
|
||||
"tipoTransaccion": "0101116",
|
||||
"usuario": "1715060073",
|
||||
"uuid": "32c039d54d17cdb903c400e636379625aff689effbf08617b653bae17af76629",
|
||||
"uuid": "sak8743892ur89w37493q3ure213098r320",
|
||||
"fechaHora": null,
|
||||
"idioma": null,
|
||||
"empresa": null,
|
||||
|
|
@ -14,40 +14,18 @@
|
|||
},
|
||||
"bodyIn": {
|
||||
"tipoAccion": 1,
|
||||
"entidad": "Plan",
|
||||
"entidades": [{
|
||||
"empCodigo": 3,
|
||||
"detTipo": 23888,
|
||||
"detModalidad": 27,
|
||||
"detDeducible": 30,
|
||||
"detTarifario": 32,
|
||||
"plaNombre": "aaa",
|
||||
"plaRutaContrato": "/data/wmp/plan/aaa",
|
||||
"plaValorAnual": 22,
|
||||
"plaValorMensual": 1231,
|
||||
"plaImpuesto": 12,
|
||||
"plaPorDescuento": 12,
|
||||
"plaEdadHijos": 12,
|
||||
"plaEdadminTitular": 12,
|
||||
"plaEdadTitular": 22,
|
||||
"plaNumBeneficiarios": 22,
|
||||
"plaProducto": "22",
|
||||
"plaCoberturaMaxima": 22,
|
||||
"plaValorDeducible": 22,
|
||||
"plaCodAcess": "12",
|
||||
"plaEstado": 1,
|
||||
"plaTipo": "21",
|
||||
"plaCodExt": "22aa",
|
||||
"coberturasPlan": [{
|
||||
"detTipo": 23900,
|
||||
"detPrestacion": 15044,
|
||||
"detTipoModalidad": 25,
|
||||
"detPais": 24,
|
||||
"copCopago": 0.11,
|
||||
"copTope": 222,
|
||||
"copTipoTarifario": 2,
|
||||
"copEstado": 1
|
||||
}]
|
||||
}]
|
||||
"entidad": "Usuario",
|
||||
"entidades": [
|
||||
{
|
||||
"usuUsuario": "1722779285",
|
||||
"usuNombre": "Diego Alejandro Panchi Ponce",
|
||||
"usuDescripcion": "Usuario Diego Panchi suscripciones",
|
||||
"usuEmail": "suscripcion@segurosmedi.com",
|
||||
"usuPassword": "Diego@2020*",
|
||||
"usuEstado": 1,
|
||||
"usuIdOrigen": "20423",
|
||||
"usuOrigen": "PERSONA"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ function toggleAllBoxes() {
|
|||
<tr>
|
||||
<td>Tests passed/Failed/Skipped:</td><td>0/0/0</td>
|
||||
</tr><tr>
|
||||
<td>Started on:</td><td>Fri Dec 11 19:39:26 ECT 2020</td>
|
||||
<td>Started on:</td><td>Mon Jun 28 10:44:08 ECT 2021</td>
|
||||
</tr>
|
||||
<tr><td>Total time:</td><td>0 seconds (5 ms)</td>
|
||||
</tr><tr>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated by org.testng.reporters.JUnitXMLReporter -->
|
||||
<testsuite ignored="0" hostname="laptop001" failures="0" tests="0" time="0.005" errors="0" timestamp="12 dic. 2020 00:39:26 GMT">
|
||||
<testsuite ignored="0" hostname="james-laptop001" failures="0" tests="0" time="0.005" errors="0" timestamp="28 jun. 2021 15:44:08 GMT">
|
||||
</testsuite>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
<testng-results ignored="0" total="0" passed="0" failed="0" skipped="0">
|
||||
<reporter-output>
|
||||
</reporter-output>
|
||||
<suite started-at="2020-12-12T00:39:26Z" name="com.qsoft.test.Tester" finished-at="2020-12-12T00:39:26Z" duration-ms="5">
|
||||
<suite started-at="2021-06-28T15:44:08Z" name="com.qsoft.test.Tester" finished-at="2021-06-28T15:44:08Z" duration-ms="5">
|
||||
<groups>
|
||||
</groups>
|
||||
<test started-at="2020-12-12T00:39:26Z" name="Command line test" finished-at="2020-12-12T00:39:26Z" duration-ms="5">
|
||||
<test started-at="2021-06-28T15:44:08Z" name="Command line test" finished-at="2021-06-28T15:44:08Z" duration-ms="5">
|
||||
</test> <!-- Command line test -->
|
||||
</suite> <!-- com.qsoft.test.Tester -->
|
||||
</testng-results>
|
||||
|
|
|
|||
Loading…
Reference in New Issue