- Conexión para el ws de SISVECOM
- Corrección de error en la fecha al guardar gastos
This commit is contained in:
parent
c269ac5570
commit
d44659160b
@ -36,6 +36,26 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>AWS-EC2-2</id>
|
||||
<properties>
|
||||
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC</hibernate.connection.url>
|
||||
<hibernate.connection.username>root</hibernate.connection.username>
|
||||
<hibernate.connection.password>root</hibernate.connection.password>
|
||||
<hibernate.connection.min_size>10</hibernate.connection.min_size>
|
||||
<hibernate.connection.max_size>40</hibernate.connection.max_size>
|
||||
<hibernate.connection.timeout>1800</hibernate.connection.timeout>
|
||||
<hibernate.connection.max_statements>300</hibernate.connection.max_statements>
|
||||
</properties>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>AWS-EC2</id>
|
||||
<properties>
|
||||
|
@ -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<ClosingDay> 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<ClosingDay> 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<ClosingDay> 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<ClosingDay> 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 + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -116,6 +116,16 @@
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>AWS-EC2-2</id>
|
||||
<properties>
|
||||
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC</hibernate.connection.url>
|
||||
<hibernate.connection.username>root</hibernate.connection.username>
|
||||
<hibernate.connection.password>root</hibernate.connection.password>
|
||||
<hibernate.connection.useSSL>false</hibernate.connection.useSSL>
|
||||
<log4j2.path>/var/log/tomcat/cardriver.log</log4j2.path>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>AWS-EC2</id>
|
||||
<properties>
|
||||
|
@ -189,6 +189,14 @@
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>AWS-EC2-2</id>
|
||||
<properties>
|
||||
<hibernate.connection.url>jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=UTC</hibernate.connection.url>
|
||||
<hibernate.connection.username>root</hibernate.connection.username>
|
||||
<hibernate.connection.password>root</hibernate.connection.password>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>AWS-EC2</id>
|
||||
<properties>
|
||||
|
16
ace/pom.xml
16
ace/pom.xml
@ -11,6 +11,22 @@
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>AWS-EC2-2</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>AWS-EC2</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>../ace-security</module>
|
||||
<module>../ace-layout</module>
|
||||
<module>../ace-model</module>
|
||||
<module>../ace-controller</module>
|
||||
<module>../ace-web</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>AWS-EC2</id>
|
||||
<activation>
|
||||
|
Loading…
Reference in New Issue
Block a user