arreglo problemas querys en postgres
This commit is contained in:
parent
2bf1117b97
commit
1ccba14eb3
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:00 ECT 2022
|
||||
#Mon Oct 31 16:00:16 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.bpm
|
||||
artifactId=bpmlib
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:54 ECT 2022
|
||||
#Mon Oct 31 16:00:10 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.bpm
|
||||
artifactId=simple
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -19,6 +19,7 @@ import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail;
|
|||
import com.fp.persistence.pgeneral.gene.TgeneCity;
|
||||
import com.fp.persistence.pgeneral.gene.TgeneCityKey;
|
||||
import com.fp.persistence.pgeneral.gene.TgeneParameters;
|
||||
import com.fp.persistence.pgeneral.gene.TgeneParametersKey;
|
||||
import com.fp.persistence.pgeneral.gene.TgeneSolicitude;
|
||||
import com.fp.sessionbeans.helper.Sequence;
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -34,6 +35,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Schedule;
|
||||
import javax.ejb.Singleton;
|
||||
|
|
@ -63,9 +65,9 @@ import org.w3c.dom.Element;
|
|||
public class ScheduleXMLSolicitud {
|
||||
|
||||
private final Logger LOG = Logger.getLogger(ScheduleNotificacionCliente.class.getName());
|
||||
|
||||
private EntityManagerFactory emf;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
private final void crearManager() {
|
||||
try {
|
||||
|
|
@ -140,12 +142,10 @@ public class ScheduleXMLSolicitud {
|
|||
String serie = facturaObj[25] != null ? facturaObj[25].toString().replace("-", "") : noDisponible;
|
||||
|
||||
crearAgregarHijo(doc, factura, "serie", serie);
|
||||
|
||||
//Fecha de emision
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
|
||||
String fechaEmision = sdf.format(Calendar.getInstance().getTime());
|
||||
crearAgregarHijo(doc, factura, "fecha", fechaEmision);
|
||||
|
||||
/**
|
||||
* ============================= DATOS DE PERSONA
|
||||
*/
|
||||
|
|
@ -155,7 +155,6 @@ public class ScheduleXMLSolicitud {
|
|||
crearAgregarHijo(doc, factura, "tipoIdComprador", tipoDocumento);
|
||||
crearAgregarHijo(doc, factura, "razonSocialComprador", nombre);
|
||||
crearAgregarHijo(doc, factura, "identificacionComprador", identificacion);
|
||||
|
||||
/**
|
||||
* Direccion
|
||||
*/
|
||||
|
|
@ -194,8 +193,6 @@ public class ScheduleXMLSolicitud {
|
|||
/**
|
||||
* ========================= Detalles ================================
|
||||
*/
|
||||
|
||||
// aun no estoy seguro de esos datos
|
||||
String []servicio = facturaObj[23] != null ? facturaObj[23].toString().split("-"): null;
|
||||
String codigoPrincipal = servicio != null ? servicio[0].toString() : ""; /**===> IMPORTANTE REVISAR*/
|
||||
String descripcion = servicio != null ? servicio[1].toString() : "";/**===> IMPORTANTE REVISAR*/
|
||||
|
|
@ -323,23 +320,31 @@ public class ScheduleXMLSolicitud {
|
|||
.getResultList();
|
||||
return lstPath.get(0);
|
||||
}
|
||||
@Schedule(second = "1", minute = "1,10,20,30,40,50", hour = "*", persistent = false)
|
||||
public TgeneParameters obtenerParametro(String code, EntityManager entityManager) throws Exception{
|
||||
return TgeneParameters.find(entityManager, new TgeneParametersKey(code, 1));
|
||||
}
|
||||
@Schedule( hour = "*",second = "0", minute = "1,10,20,30,40,50", persistent = false)
|
||||
public void generarXMLs() {
|
||||
try {
|
||||
StringBuilder comandoParametro = new StringBuilder("select t from TgeneParameters t WHERE t.pk.code = :code AND t.pk.companycode = :companycode ");
|
||||
EntityManager entityManager = emf.createEntityManager();
|
||||
|
||||
|
||||
TgeneParameters tParameter = obtenerParametroSQL("PATHFACTURASXML", comandoParametro, entityManager);
|
||||
EntityManager entityManager = emf.createEntityManager();
|
||||
|
||||
TgeneParameters ejecucion = obtenerParametro("PATHFACTURASXML", entityManager);
|
||||
|
||||
if(ejecucion.getNumbervalue().compareTo(BigDecimal.ZERO) == 0){
|
||||
throw new Exception(new Date().toString().concat(": Ejecucion de la facturacion desactivada"));
|
||||
}
|
||||
|
||||
TgeneParameters tParameter = obtenerParametro("PATHFACTURASXML", entityManager);
|
||||
|
||||
String folderPath = tParameter.getTextvalue();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HHmmss");
|
||||
String fechaActual = sdf.format(Calendar.getInstance().getTime()).replace(" ", "_");
|
||||
folderPath = folderPath.concat(fechaActual).concat("/");
|
||||
|
||||
//TgeneParameters sequence = obtenerParametroSQL("SECUENCIAFACTURA", comandoParametro, entityManager);
|
||||
TgeneParameters rucComaco = obtenerParametroSQL("RUCCOMACO", comandoParametro, entityManager);
|
||||
TgeneParameters custodio = obtenerParametroSQL("CUSTODIOSFACTURA", comandoParametro, entityManager);
|
||||
TgeneParameters rucComaco = obtenerParametro("RUCCOMACO", entityManager);
|
||||
TgeneParameters custodio = obtenerParametro("CUSTODIOSFACTURA",entityManager);
|
||||
StringBuilder strSolicitud = new StringBuilder(
|
||||
"SELECT t.CSOLICITUD, t.NUMEROSOLICITUD, p.PERSONCODE FROM TARMSOLICITUD t\n"
|
||||
+ "LEFT JOIN TARMSOLICITUDTRAMITE t2 \n"
|
||||
|
|
@ -385,11 +390,10 @@ public class ScheduleXMLSolicitud {
|
|||
carpetaBase.mkdirs();
|
||||
Query q = null;
|
||||
StringBuilder insertAuditoria = new StringBuilder("INSERT INTO TARMINVOICEHISTORY\n" +
|
||||
"(ID, USERCODE, REGISTRATIONDATE, CSOLICITUD, SOLICITUDNUMBER, TRAMITENUMBER, PATHFILE, CONTENTFILE)\n" +
|
||||
"VALUES(:id, :usercode, (select now()), :csolicitud, :solicitudnumber, :tramitenumber, :pathfile, :content)"
|
||||
"(USERCODE, REGISTRATIONDATE, CSOLICITUD, SOLICITUDNUMBER, TRAMITENUMBER, PATHFILE, CONTENTFILE)\n" +
|
||||
"VALUES (:usercode, now(), :csolicitud, :solicitudnumber, :tramitenumber, :pathfile, :content)"
|
||||
);
|
||||
|
||||
int id = 0;
|
||||
List<Object[]> lstFilaId = new ArrayList<>();
|
||||
String pathFactura = null;
|
||||
for (Object[] solicitudesPers : lstSolicitudesPersona) {
|
||||
|
|
@ -486,8 +490,7 @@ public class ScheduleXMLSolicitud {
|
|||
.setParameter("ccentro", codigoCentro);
|
||||
q.executeUpdate();
|
||||
try {
|
||||
id = obtenerIdAuditoria(entityManager, lstFilaId, id);
|
||||
guardarAuditoriaXML(q, entityManager, insertAuditoria.toString(), id, "BATCH", cSolicitud,
|
||||
guardarAuditoriaXML(q, entityManager, insertAuditoria.toString(), "BATCH", cSolicitud,
|
||||
factura[1]!= null ? factura[1].toString() : null,
|
||||
null, pathFactura, obtenerContenidoArchivo(pathFactura));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -501,7 +504,7 @@ public class ScheduleXMLSolicitud {
|
|||
|
||||
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Error al guardar el parametro >>>> " + ex.toString());
|
||||
System.out.println("Error de ejecucion de facturacion automatica >>>> " + ex.toString());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
|
|
@ -518,10 +521,9 @@ public class ScheduleXMLSolicitud {
|
|||
}
|
||||
|
||||
public void guardarAuditoriaXML(Query q, EntityManager entityManager, String sUpdate,
|
||||
int id, String usercode, String csolicitud, String solicitudnumber, String tramitenumber, String pathfile,
|
||||
String usercode, String csolicitud, String solicitudnumber, String tramitenumber, String pathfile,
|
||||
String content){
|
||||
q = entityManager.createNativeQuery(sUpdate)
|
||||
.setParameter("id", id)
|
||||
.setParameter("usercode", usercode)
|
||||
.setParameter("csolicitud", csolicitud)
|
||||
.setParameter("solicitudnumber", solicitudnumber)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:21 ECT 2022
|
||||
#Mon Oct 31 16:00:43 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=armas
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:15 ECT 2022
|
||||
#Mon Oct 31 16:00:35 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=general
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:17 ECT 2022
|
||||
#Mon Oct 31 16:00:38 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=log
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:12 ECT 2022
|
||||
#Mon Oct 31 16:00:30 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=person
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:16 ECT 2022
|
||||
#Mon Oct 31 16:00:36 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=report
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:18 ECT 2022
|
||||
#Mon Oct 31 16:00:40 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.business
|
||||
artifactId=viaticos
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:09 ECT 2022
|
||||
#Mon Oct 31 16:00:26 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.core
|
||||
artifactId=alfresco-client
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:56 ECT 2022
|
||||
#Mon Oct 31 16:00:11 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.core
|
||||
artifactId=bpm
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:08 ECT 2022
|
||||
#Mon Oct 31 16:00:25 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.core
|
||||
artifactId=firmas
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:39 ECT 2022
|
||||
#Mon Oct 31 15:59:54 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.dto
|
||||
artifactId=common
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:37 ECT 2022
|
||||
#Mon Oct 31 15:59:51 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.dto
|
||||
artifactId=dto
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:23 ECT 2022
|
||||
#Mon Oct 31 16:00:45 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base
|
||||
artifactId=facade
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:22 ECT 2022
|
||||
#Mon Oct 31 16:00:44 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base
|
||||
artifactId=facadeclient
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:49 ECT 2022
|
||||
#Mon Oct 31 16:00:04 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=commondb
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:06 ECT 2022
|
||||
#Mon Oct 31 16:00:23 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=parmas
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:41 ECT 2022
|
||||
#Mon Oct 31 15:59:56 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=pbpm
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:52 ECT 2022
|
||||
#Mon Oct 31 16:00:07 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=pcustomer
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:03 ECT 2022
|
||||
#Mon Oct 31 16:00:20 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=pfirmas
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:47 ECT 2022
|
||||
#Mon Oct 31 16:00:02 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=pgeneral
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:01 ECT 2022
|
||||
#Mon Oct 31 16:00:17 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=plog
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:03 ECT 2022
|
||||
#Mon Oct 31 16:00:19 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=pviaticos
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:52:53 ECT 2022
|
||||
#Mon Oct 31 16:00:09 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base.persistence
|
||||
artifactId=util
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:10 ECT 2022
|
||||
#Mon Oct 31 16:00:28 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.base
|
||||
artifactId=sessionbeans
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:23 ECT 2022
|
||||
#Mon Oct 31 16:00:46 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.clients.maia
|
||||
artifactId=maiaear
|
||||
|
|
|
|||
|
|
@ -58,10 +58,8 @@
|
|||
where
|
||||
t.archived = 0 and
|
||||
excludedOwners.id = :userId and
|
||||
excludedOwners in elements ( t.peopleAssignments.excludedOwners )
|
||||
|
||||
|
||||
order by t.id DESC
|
||||
excludedOwners in elements ( t.peopleAssignments.excludedOwners )
|
||||
order by t.id DESC
|
||||
</query>
|
||||
<!-- hint name="org.hibernate.timeout" value="200"/ -->
|
||||
</named-query>
|
||||
|
|
|
|||
|
|
@ -58,10 +58,8 @@
|
|||
where
|
||||
t.archived = 0 and
|
||||
excludedOwners.id = :userId and
|
||||
excludedOwners in elements ( t.peopleAssignments.excludedOwners )
|
||||
|
||||
|
||||
order by t.id DESC
|
||||
excludedOwners in elements ( t.peopleAssignments.excludedOwners )
|
||||
order by t.id DESC
|
||||
</query>
|
||||
<!-- hint name="org.hibernate.timeout" value="200"/ -->
|
||||
</named-query>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Thu Oct 27 16:53:23 ECT 2022
|
||||
#Mon Oct 31 16:00:45 ECT 2022
|
||||
version=2.1
|
||||
groupId=com.fp.clients.maia
|
||||
artifactId=environment-eap6
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package com.fp.frontend.controller.armas.solicitud;
|
|||
import com.fp.dto.Request;
|
||||
import com.fp.dto.Response;
|
||||
import com.fp.dto.query.DtoQuery;
|
||||
import com.fp.dto.save.DtoSave;
|
||||
import com.fp.frontend.controller.AbstractController;
|
||||
import com.fp.frontend.helper.MessageHelper;
|
||||
import com.fp.persistence.parmas.soli.TarmInvoiceHistory;
|
||||
|
|
@ -42,7 +43,7 @@ public class InvoiceHistoryController extends AbstractController<TarmInvoiceHist
|
|||
try {
|
||||
this.recperpage = 10; // Cambiar al # reg a mirar.
|
||||
this.lrecord = new ArrayList<>();
|
||||
this.beanalias = "INVOICEHISTORYS";
|
||||
this.beanalias = "TARMINVOICEHISTORY";
|
||||
} catch (Exception e) {
|
||||
MessageHelper.setMessageError(e);
|
||||
}
|
||||
|
|
@ -58,6 +59,37 @@ public class InvoiceHistoryController extends AbstractController<TarmInvoiceHist
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
try {
|
||||
Request request = this.callerhelper.getRequest();
|
||||
DtoSave dtosave = super.getDtoSave();
|
||||
dtosave.setReturnpk(true);
|
||||
if (!dtosave.pendingProcess()) {
|
||||
return;
|
||||
}
|
||||
HashMap<String, DtoSave> msave = new HashMap<String, DtoSave>();
|
||||
msave.put(this.beanalias, dtosave);
|
||||
|
||||
request.setSaveTables(msave);
|
||||
Response resp = this.callerhelper.executeSave(request);
|
||||
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) {
|
||||
this.postCommit(resp);
|
||||
//MessageHelper.setMessageInfo(resp);
|
||||
} else {
|
||||
System.out.println("Error al guardar");
|
||||
// MessageHelper.setMessageError(resp);
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
MessageHelper.setMessageError(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void postCommit(Response response) throws Exception {
|
||||
super.postCommitGeneric(response, this.beanalias);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void querydatabase() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -355,6 +355,10 @@ public class ReporteConsultaSolicitudController extends
|
|||
MessageHelper.setMessageError(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*Accion para generar xml desde el boton
|
||||
*/
|
||||
|
||||
public void crearXML(){
|
||||
try {
|
||||
this.parametersController.generarFacturas(this.solicitud.getRecord().getPk());
|
||||
|
|
|
|||
|
|
@ -251,22 +251,16 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
|
||||
public File sacarFactura(String codigoSolicitud, File carpetaBase, TsafeUserDetail tsafeUserDetail) throws Exception {
|
||||
CentroControlArmasController cac = new CentroControlArmasController();
|
||||
/**
|
||||
* ============================ NO ESTATICAS ===============0
|
||||
*/
|
||||
TgeneParameters tCustodio = find("CUSTODIOSFACTURA", "1");
|
||||
|
||||
String noDisponible = "";
|
||||
String noDisponible = ""; /**SE SUELE UTILIZAR SI ES QUE SE REQUIERE UN MENSAJE EN DATOS VACIOS*/
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
|
||||
//Elemento raíz
|
||||
Document doc = docBuilder.newDocument();
|
||||
Element factura = doc.createElement("factura");
|
||||
doc.appendChild(factura);
|
||||
|
||||
PersonAddressController pac = new PersonAddressController();
|
||||
|
||||
TarmSolicitudTramite solicitudTramite = SolicitudTramiteController.findByCSolicitud(codigoSolicitud);
|
||||
TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(codigoSolicitud);
|
||||
Integer personCode = solicitud.getPersoncode();
|
||||
|
|
@ -274,9 +268,7 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
TgeneParameters parametroRUC = find("RUCCOMACO", "1");
|
||||
TarmTramite tTramite = TarmTramiteController.findSimple(solicitud.getCtramite().toString());
|
||||
String rucComaco = parametroRUC.getTextvalue();
|
||||
|
||||
crearAgregarHijo(doc, factura, "ruc", rucComaco);
|
||||
|
||||
|
||||
String ccentro = solicitud.getCcentrocontrol();
|
||||
TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(ccentro);
|
||||
|
|
@ -284,9 +276,9 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
centroControl.getPuntofacturacion().replace("-", "") : "";
|
||||
|
||||
crearAgregarHijo(doc, factura, "secuencia",String.format("%09d", centroControl.getSecuenciafacturacion()));
|
||||
|
||||
//String claveNombreInstitucion = centroControl.getNombreinstitucion();
|
||||
//String puntoFact= tciudad != null ? tciudad.getPuntofacturacion() : null;
|
||||
/**
|
||||
* ACTUALIZAR LA SECUENCIA DEL CENTRO DE CONTROL
|
||||
*/
|
||||
centroControl.setSecuenciafacturacion(centroControl.getSecuenciafacturacion()+1);
|
||||
cac.update(centroControl);
|
||||
cac.save();
|
||||
|
|
@ -364,7 +356,6 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
String impuesto = "IVA";
|
||||
int porcentajeDescuento = 0;
|
||||
|
||||
Double descuento = 0.00;
|
||||
Element impuestoTotal = crearElementoSinTexto(doc, "impuestoTotal");
|
||||
Element totalImpuesto1 = crearElementoSinTexto(doc, "totalImpuesto");
|
||||
Element totalImpuesto2 = crearElementoSinTexto(doc, "totalImpuesto");
|
||||
|
|
@ -385,14 +376,11 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
* ========================= Detalles ================================
|
||||
*/
|
||||
|
||||
// aun no estoy seguro de esos datos
|
||||
TgeneCatalogDetail tTipoAutorizacion = CatalogDetailController.findCatalogo(tTramite.getTipoautorizacion(), tTramite.getTipoautorizacioncodigo());
|
||||
String []servicios = tTramite.getServicio() != null ? tTramite.getServicio().split("-"):null;
|
||||
|
||||
String codigoPrincipal = servicios != null ? servicios[0]: ""; /**IMPORTANTE REVISAR*/
|
||||
String descripcion = servicios != null ? servicios[1]: "";
|
||||
//tTipoAutorizacion != null ? tTipoAutorizacion.getDescription() : "";
|
||||
int cantidad = 1;
|
||||
int cantidad = 1; /**Cantidad de productos en solicitud*/
|
||||
Double precioUnitario = solicitudTramite.getValortramitearmas().doubleValue();
|
||||
Double precioTotalSinImpuestos = precioUnitario * cantidad;
|
||||
Element detalles = crearElementoSinTexto(doc, "detalles");
|
||||
|
|
@ -413,8 +401,7 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
agregarHijoPadre(doc, impuestoItem, impueste);
|
||||
agregarHijoPadre(doc, detalle1, impuestoItem);
|
||||
agregarHijoPadre(doc, detalles, detalle1);
|
||||
String porcentaje = "0";
|
||||
Double baseImponible = precioTotalSinImpuestos;
|
||||
|
||||
/**
|
||||
* **** custodios
|
||||
*/
|
||||
|
|
@ -423,9 +410,7 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
String codigoPrincipal2 = tCustodio.getNumbervalue().toString().contains(".")
|
||||
? tCustodio.getNumbervalue().toString().split("\\.")[0] : tCustodio.getNumbervalue().toString() ; int numeroDias = solicitud != null && solicitud.getNumerodiascustodios() != null ? solicitud.getNumerodiascustodios() : null;
|
||||
int numeroCustodios=solicitud != null ? solicitud.getNumerocustodios() : null;
|
||||
/**
|
||||
* ======================= no tengo la menor idea
|
||||
*/
|
||||
|
||||
String descripcion2 = String.format(tCustodio.getTextvalue(), numeroDias);
|
||||
Double precioUnitario2 = solicitudTramite.getValorcustodios().doubleValue()/ numeroCustodios;
|
||||
Double precioTotalSinImpuestos2 = solicitudTramite.getValorcustodios().doubleValue() ;
|
||||
|
|
@ -456,10 +441,11 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
Element pagos = crearElementoSinTexto(doc, "pagos");
|
||||
|
||||
Element pago = crearElementoSinTexto(doc, "pago");
|
||||
String formaPago = "EF";
|
||||
/**
|
||||
* de momento, tocaria ver los nemonicos a futuro para pago con tarjeta
|
||||
* formaPago: de momento, tocaria ver los nemonicos a futuro para pago con tarjeta
|
||||
*/
|
||||
String formaPago = "EF";
|
||||
|
||||
Double totalPagar = valorAPagar;
|
||||
crearAgregarHijo(doc, pago, "formaPago", formaPago);
|
||||
crearAgregarHijo(doc, pago, "total", totalPagar.toString());
|
||||
|
|
@ -491,24 +477,18 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
DOMSource source = new DOMSource(doc);
|
||||
/**
|
||||
* String path = carpetaBase.getAbsolutePath(); if(!path.endsWith("/")){
|
||||
* path = path.concat("/");
|
||||
}
|
||||
*/
|
||||
//path=path.concat(String.format("Factura-%s.xml", solicitud.getNumerosolicitud()));
|
||||
|
||||
File archivo = new File(carpetaBase, String.format("%s.xml", solicitud.getNumerosolicitud()));
|
||||
StreamResult result = new StreamResult(archivo);
|
||||
transformer.transform(source, result);
|
||||
|
||||
try {
|
||||
crearAuditoria(1201, solicitud.getPk(), tsafeUserDetail.getPk().getUsercode(),
|
||||
crearAuditoria(solicitud.getPk(), tsafeUserDetail.getPk().getUsercode(),
|
||||
solicitud.getNumerosolicitud(), solicitudTramite.getNumerotramite(),
|
||||
archivo.getAbsolutePath());
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error al generar auditoria desde el front>>< "+ e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return archivo;
|
||||
}
|
||||
|
|
@ -523,10 +503,9 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
b.close();
|
||||
return sb.toString();
|
||||
}
|
||||
public void crearAuditoria(Integer id, String csoli,String user, String solicitudNumber, String tramiteNumber,String path) throws Exception{
|
||||
public void crearAuditoria( String csoli,String user, String solicitudNumber, String tramiteNumber,String path) throws Exception{
|
||||
InvoiceHistoryController iv = new InvoiceHistoryController(); /**========> NO OPTIMO, USADO PARA PRUEBAS*/
|
||||
TarmInvoiceHistory tih = new TarmInvoiceHistory();
|
||||
tih.setPk(id);
|
||||
tih.setCsolicitud(csoli);
|
||||
tih.setUsercode(user);
|
||||
tih.setRegistrationdate(new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis()));
|
||||
|
|
@ -534,7 +513,7 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
tih.setTramitenumber(tramiteNumber);
|
||||
tih.setPathfile(path);
|
||||
tih.setContentfile(obtenerContenidoArchivo(path));
|
||||
iv.update(tih);
|
||||
iv.setRecord(tih);
|
||||
iv.save();
|
||||
}
|
||||
|
||||
|
|
@ -543,33 +522,13 @@ public class ParametersController extends AbstractController<TgeneParameters> {
|
|||
TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL");
|
||||
|
||||
String folderPath = find("PATHFACTURASXML", "1").getTextvalue();
|
||||
//String fechaActual = new Date().toString().replace("/", "-").replace(" ", "_").replace(":", "");
|
||||
folderPath = folderPath.concat("FRONTEND").concat("/");
|
||||
File carpetaBase = new File(folderPath);
|
||||
carpetaBase.mkdirs();
|
||||
File arch = sacarFactura(csolicitud, carpetaBase, tsafeUserDetail );
|
||||
//factSq = factSq + acum;
|
||||
|
||||
|
||||
byte[] fileContent = Files.readAllBytes(Paths.get(arch.getAbsolutePath()));
|
||||
downloadFile(fileContent, "application/xml", arch.getName());
|
||||
/** ================== DEBERIA HABERSE ECHO POR CONTROLLER PERO POR ERRORES SE MANTIENE CON QUERY */
|
||||
// Query qu = entityManager.createNativeQuery(sUpdate.toString())
|
||||
// .setParameter("numero", factSq);
|
||||
// qu.executeUpdate();
|
||||
//sequence.setNumbervalue(new BigDecimal(factSq));
|
||||
//TgeneCatalogDetail sequencia = CatalogDetailController.findCatalogo( "QUERY", "SEQ");
|
||||
//sequencia.setRecordversion(factSq);
|
||||
//CatalogDetailController dc = new CatalogDetailController();
|
||||
///dc.setRecord(sequencia);
|
||||
//dc.update();
|
||||
//dc.save();
|
||||
|
||||
//sequence.setIsnew(false);
|
||||
//setRecord(sequence);
|
||||
//update();
|
||||
//save();
|
||||
//updateParametro(sequence);
|
||||
File arch = sacarFactura(csolicitud, carpetaBase, tsafeUserDetail );
|
||||
byte[] fileContent = Files.readAllBytes(Paths.get(arch.getAbsolutePath()));
|
||||
downloadFile(fileContent, "application/xml", arch.getName());
|
||||
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
|
|
|||
|
|
@ -109,10 +109,11 @@
|
|||
</h:panelGrid>
|
||||
<h:panelGrid columns="2" id="pnlGridTramite">
|
||||
<!-- tipo de pago para cuando se desarrolle el BOTON DE PAGO -->
|
||||
<!--
|
||||
<p:outputLabel for="selTipoPago" value="#{msg_armas['lbl_tipoPago']}:" style="width:150px;"/>
|
||||
<p:selectOneMenu id="selTipoPago" value="#{tramiteArmasController.solicitud.record.tipopago}" var="p" required="true" style="width:290px;" disabled="#{tramiteArmasController.deshabilitarPantalla}">
|
||||
<f:selectItems value="#{tramiteArmasController.ltipopago}" var="tipopago" itemLabel="#{tipopago.description}" itemValue="#{tipopago.pk.catalog}"/>
|
||||
</p:selectOneMenu>
|
||||
</p:selectOneMenu>-->
|
||||
<p:outputLabel for="txtLovTramite" value="#{msg_armas['lbl_tramite']}:" style="width:150px;display:block;"/>
|
||||
<p:inputText id="txtLovTramite" value="#{tramiteArmasController.solicitud.mfilelds['tipoAutorizacion']}" disabled="true" required="true" style="width:500px;"/>
|
||||
<p:outputLabel for="txtLovCategoria" value="#{msg_armas['lbl_categoria']}:" style="width:150px;display:block;"/>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue