From d44659160b6370ff4973937ebb4d3109405af8e1 Mon Sep 17 00:00:00 2001 From: "Brayan.Gonzalez" Date: Wed, 12 Feb 2025 09:54:24 -0700 Subject: [PATCH] =?UTF-8?q?-=20Conexi=C3=B3n=20para=20el=20ws=20de=20SISVE?= =?UTF-8?q?COM=20-=20Correcci=C3=B3n=20de=20error=20en=20la=20fecha=20al?= =?UTF-8?q?=20guardar=20gastos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ace-model/pom.xml | 20 + .../arrebol/apc/model/admin/OtherExpense.java | 361 +++++++++--------- ace-web/pom.xml | 10 + ace-ws-rest/pom.xml | 8 + ace/pom.xml | 16 + 5 files changed, 237 insertions(+), 178 deletions(-) diff --git a/ace-model/pom.xml b/ace-model/pom.xml index c4e09fd..c5c5c99 100644 --- a/ace-model/pom.xml +++ b/ace-model/pom.xml @@ -36,6 +36,26 @@ + + AWS-EC2-2 + + jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC + root + root + 10 + 40 + 1800 + 300 + + + + + src/main/resources + true + + + + AWS-EC2 diff --git a/ace-model/src/main/java/com/arrebol/apc/model/admin/OtherExpense.java b/ace-model/src/main/java/com/arrebol/apc/model/admin/OtherExpense.java index 3698e7e..4c99c8a 100644 --- a/ace-model/src/main/java/com/arrebol/apc/model/admin/OtherExpense.java +++ b/ace-model/src/main/java/com/arrebol/apc/model/admin/OtherExpense.java @@ -1,8 +1,8 @@ /* * Arrebol Consultancy copyright. - * + * * This code belongs to Arrebol Consultancy - * its use, redistribution or modification are prohibited + * its use, redistribution or modification are prohibited * without written authorization from Arrebol Consultancy. */ package com.arrebol.apc.model.admin; @@ -13,6 +13,7 @@ import java.io.Serializable; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Optional; @@ -39,218 +40,222 @@ import org.hibernate.annotations.GenericGenerator; @Entity public class OtherExpense implements Serializable { - private static final long serialVersionUID = 6233701552847217683L; + private static final long serialVersionUID = 6233701552847217683L; - @Id - @GeneratedValue(generator = "uuid") - @GenericGenerator(name = "uuid", strategy = "uuid2") - @Column(name = "id", length = 36) - private String id; + @Id + @GeneratedValue(generator = "uuid") + @GenericGenerator(name = "uuid", strategy = "uuid2") + @Column(name = "id", length = 36) + private String id; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn( - name = "id_user", - referencedColumnName = "id", - nullable = false - ) - private User user; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "id_user", + referencedColumnName = "id", + nullable = false + ) + private User user; - @ManyToOne(fetch = FetchType.LAZY, optional = false) - @JoinColumn( - name = "id_office", - referencedColumnName = "id", - nullable = false - ) - private Office office; + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn( + name = "id_office", + referencedColumnName = "id", + nullable = false + ) + private Office office; - @Column(name = "expense", nullable = false) - private BigDecimal expense; + @Column(name = "expense", nullable = false) + private BigDecimal expense; - @Column(name = "description", length = 200, nullable = false) - private String description; + @Column(name = "description", length = 200, nullable = false) + private String description; - @Column(name = "created_by", nullable = false, length = 36) - private String createdBy; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn( - name = "created_by", - referencedColumnName = "id", - nullable = false, - insertable = false, - updatable = false - - ) - private User userCreatedBy; + @Column(name = "created_by", nullable = false, length = 36) + private String createdBy; - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "created_on", length = 19) - private Date createdOn; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "created_by", + referencedColumnName = "id", + nullable = false, + insertable = false, + updatable = false + ) + private User userCreatedBy; - @Column(name = "last_updated_by", length = 36) - private String lastUpdatedBy; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "created_on", length = 19) + private Date createdOn; - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "last_updated_on", length = 19) - private Date lastUpdatedOn; + @Column(name = "last_updated_by", length = 36) + private String lastUpdatedBy; - public OtherExpense() { - } + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "last_updated_on", length = 19) + private Date lastUpdatedOn; - /** - * - * @param officeId - * @param userId - * @param expense - * @param description - */ - public OtherExpense(String officeId, String userId, BigDecimal expense, String description) { - this.office = new Office(officeId); - this.user = new User(userId); - this.expense = expense; - this.description = description; - this.createdBy = userId; - this.createdOn = new Date(); - } + public OtherExpense() { + } - public String getId() { - return id; - } + /** + * + * @param officeId + * @param userId + * @param expense + * @param description + */ + public OtherExpense(String officeId, String userId, BigDecimal expense, String description) { + this.office = new Office(officeId); + this.user = new User(userId); + this.expense = expense; + this.description = description; + this.createdBy = userId; + Date date = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_YEAR, -1); + date = calendar.getTime(); + this.createdOn = date; + } - public void setId(String id) { - this.id = id; - } + public String getId() { + return id; + } - public User getUser() { - return user; - } + public void setId(String id) { + this.id = id; + } - public void setUser(User user) { - this.user = user; - } + public User getUser() { + return user; + } - public Office getOffice() { - return office; - } + public void setUser(User user) { + this.user = user; + } - public void setOffice(Office office) { - this.office = office; - } + public Office getOffice() { + return office; + } - public BigDecimal getExpense() { - return expense; - } + public void setOffice(Office office) { + this.office = office; + } - public void setExpense(BigDecimal expense) { - this.expense = expense; - } + public BigDecimal getExpense() { + return expense; + } - public String getDescription() { - return description; - } + public void setExpense(BigDecimal expense) { + this.expense = expense; + } - public void setDescription(String description) { - this.description = description; - } + public String getDescription() { + return description; + } - public String getCreatedBy() { - return createdBy; - } + public void setDescription(String description) { + this.description = description; + } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } + public String getCreatedBy() { + return createdBy; + } - public Date getCreatedOn() { - return createdOn; - } + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } - public void setCreatedOn(Date createdOn) { - this.createdOn = createdOn; - } + public Date getCreatedOn() { + return createdOn; + } - public String getLastUpdatedBy() { - return lastUpdatedBy; - } + public void setCreatedOn(Date createdOn) { + this.createdOn = createdOn; + } - public void setLastUpdatedBy(String lastUpdatedBy) { - this.lastUpdatedBy = lastUpdatedBy; - } + public String getLastUpdatedBy() { + return lastUpdatedBy; + } - public Date getLastUpdatedOn() { - return lastUpdatedOn; - } + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } - public void setLastUpdatedOn(Date lastUpdatedOn) { - this.lastUpdatedOn = lastUpdatedOn; - } + public Date getLastUpdatedOn() { + return lastUpdatedOn; + } - public String getUserRoutes() { - String routes = ""; - routes = user.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", ")); + public void setLastUpdatedOn(Date lastUpdatedOn) { + this.lastUpdatedOn = lastUpdatedOn; + } - return routes; - } - - public User getUserCreatedBy() { - return userCreatedBy; - } + public String getUserRoutes() { + String routes = ""; + routes = user.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", ")); - public void setUserCreatedBy(User userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public String getCreatedByName() { - String name = getUserCreatedBy().getHumanResource().getFirstName() + " " + getUserCreatedBy().getHumanResource().getLastName(); + return routes; + } - return name; - } - - public boolean getAction(Date lastStableSmallBox, List closingDayToday) { - Date date = createdOn; - String closingDayUser = null; - boolean action = true; - try { - SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd"); + public User getUserCreatedBy() { + return userCreatedBy; + } - String dateStr = dt1.format(date); - date = dt1.parse(dateStr); + public void setUserCreatedBy(User userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } - action = date.after(lastStableSmallBox); - - // Busca el corte del día de este usuario - if (closingDayToday != null) { - Optional optUser = closingDayToday.stream().filter(p -> p.getUser().getId().equalsIgnoreCase(user.getId()) - && p.getCreatedOn().equals(createdOn)).findFirst(); - closingDayUser = optUser.isPresent() ? optUser.get().getId(): null; - - String dateStrCD; - Date dateCD; - for(ClosingDay dato : closingDayToday){ - dateStrCD = dt1.format(dato.getCreatedOn()); - dateCD = dt1.parse(dateStrCD); - - if(dato.getUser().getId().equalsIgnoreCase(getUser().getId()) && dateCD.equals(date)){ - closingDayUser = dato.getUser().getId(); - } - } - } - - if(action){ - if(closingDayUser != null){ - action = false; - } + public String getCreatedByName() { + String name = getUserCreatedBy().getHumanResource().getFirstName() + " " + getUserCreatedBy().getHumanResource().getLastName(); + + return name; + } + + public boolean getAction(Date lastStableSmallBox, List closingDayToday) { + Date date = createdOn; + String closingDayUser = null; + boolean action = true; + try { + SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd"); + + String dateStr = dt1.format(date); + date = dt1.parse(dateStr); + + action = date.after(lastStableSmallBox); + + // Busca el corte del día de este usuario + if (closingDayToday != null) { + Optional optUser = closingDayToday.stream().filter(p -> p.getUser().getId().equalsIgnoreCase(user.getId()) + && p.getCreatedOn().equals(createdOn)).findFirst(); + closingDayUser = optUser.isPresent() ? optUser.get().getId() : null; + + String dateStrCD; + Date dateCD; + for (ClosingDay dato : closingDayToday) { + dateStrCD = dt1.format(dato.getCreatedOn()); + dateCD = dt1.parse(dateStrCD); + + if (dato.getUser().getId().equalsIgnoreCase(getUser().getId()) && dateCD.equals(date)) { + closingDayUser = dato.getUser().getId(); + } } + } - } catch (ParseException ex) { - Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex); - } - return action; - } - - @Override - public String toString() { - return "OtherExpense{" + "description=" + description + ", createdOn=" + createdOn + '}'; - } + if (action) { + if (closingDayUser != null) { + action = false; + } + } + + } catch (ParseException ex) { + Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex); + } + return action; + } + + @Override + public String toString() { + return "OtherExpense{" + "description=" + description + ", createdOn=" + createdOn + '}'; + } } diff --git a/ace-web/pom.xml b/ace-web/pom.xml index 7a485f4..56674d8 100644 --- a/ace-web/pom.xml +++ b/ace-web/pom.xml @@ -116,6 +116,16 @@ + + AWS-EC2-2 + + jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC + root + root + false + /var/log/tomcat/cardriver.log + + AWS-EC2 diff --git a/ace-ws-rest/pom.xml b/ace-ws-rest/pom.xml index e8a8ed3..a09c4b5 100644 --- a/ace-ws-rest/pom.xml +++ b/ace-ws-rest/pom.xml @@ -189,6 +189,14 @@ + + AWS-EC2-2 + + jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC + root + root + + AWS-EC2 diff --git a/ace/pom.xml b/ace/pom.xml index 50601e2..4df01c7 100644 --- a/ace/pom.xml +++ b/ace/pom.xml @@ -11,6 +11,22 @@ 1.8 + + AWS-EC2-2 + + + AWS-EC2 + true + + + + ../ace-security + ../ace-layout + ../ace-model + ../ace-controller + ../ace-web + + AWS-EC2