- 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>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<profiles>
|
<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>
|
<profile>
|
||||||
<id>AWS-EC2</id>
|
<id>AWS-EC2</id>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Arrebol Consultancy copyright.
|
* Arrebol Consultancy copyright.
|
||||||
*
|
*
|
||||||
* This code belongs to Arrebol Consultancy
|
* 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.
|
* without written authorization from Arrebol Consultancy.
|
||||||
*/
|
*/
|
||||||
package com.arrebol.apc.model.admin;
|
package com.arrebol.apc.model.admin;
|
||||||
@ -13,6 +13,7 @@ import java.io.Serializable;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -39,218 +40,222 @@ import org.hibernate.annotations.GenericGenerator;
|
|||||||
@Entity
|
@Entity
|
||||||
public class OtherExpense implements Serializable {
|
public class OtherExpense implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6233701552847217683L;
|
private static final long serialVersionUID = 6233701552847217683L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(generator = "uuid")
|
@GeneratedValue(generator = "uuid")
|
||||||
@GenericGenerator(name = "uuid", strategy = "uuid2")
|
@GenericGenerator(name = "uuid", strategy = "uuid2")
|
||||||
@Column(name = "id", length = 36)
|
@Column(name = "id", length = 36)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(
|
@JoinColumn(
|
||||||
name = "id_user",
|
name = "id_user",
|
||||||
referencedColumnName = "id",
|
referencedColumnName = "id",
|
||||||
nullable = false
|
nullable = false
|
||||||
)
|
)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
@JoinColumn(
|
@JoinColumn(
|
||||||
name = "id_office",
|
name = "id_office",
|
||||||
referencedColumnName = "id",
|
referencedColumnName = "id",
|
||||||
nullable = false
|
nullable = false
|
||||||
)
|
)
|
||||||
private Office office;
|
private Office office;
|
||||||
|
|
||||||
@Column(name = "expense", nullable = false)
|
@Column(name = "expense", nullable = false)
|
||||||
private BigDecimal expense;
|
private BigDecimal expense;
|
||||||
|
|
||||||
@Column(name = "description", length = 200, nullable = false)
|
@Column(name = "description", length = 200, nullable = false)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "created_by", nullable = false, length = 36)
|
@Column(name = "created_by", nullable = false, length = 36)
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
|
||||||
@JoinColumn(
|
|
||||||
name = "created_by",
|
|
||||||
referencedColumnName = "id",
|
|
||||||
nullable = false,
|
|
||||||
insertable = false,
|
|
||||||
updatable = false
|
|
||||||
|
|
||||||
)
|
|
||||||
private User userCreatedBy;
|
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@Column(name = "created_on", length = 19)
|
@JoinColumn(
|
||||||
private Date createdOn;
|
name = "created_by",
|
||||||
|
referencedColumnName = "id",
|
||||||
|
nullable = false,
|
||||||
|
insertable = false,
|
||||||
|
updatable = false
|
||||||
|
)
|
||||||
|
private User userCreatedBy;
|
||||||
|
|
||||||
@Column(name = "last_updated_by", length = 36)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private String lastUpdatedBy;
|
@Column(name = "created_on", length = 19)
|
||||||
|
private Date createdOn;
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Column(name = "last_updated_by", length = 36)
|
||||||
@Column(name = "last_updated_on", length = 19)
|
private String lastUpdatedBy;
|
||||||
private Date lastUpdatedOn;
|
|
||||||
|
|
||||||
public OtherExpense() {
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
}
|
@Column(name = "last_updated_on", length = 19)
|
||||||
|
private Date lastUpdatedOn;
|
||||||
|
|
||||||
/**
|
public OtherExpense() {
|
||||||
*
|
}
|
||||||
* @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 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) {
|
public String getId() {
|
||||||
this.id = id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
public void setId(String id) {
|
||||||
return user;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(User user) {
|
public User getUser() {
|
||||||
this.user = user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Office getOffice() {
|
public void setUser(User user) {
|
||||||
return office;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOffice(Office office) {
|
public Office getOffice() {
|
||||||
this.office = office;
|
return office;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getExpense() {
|
public void setOffice(Office office) {
|
||||||
return expense;
|
this.office = office;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpense(BigDecimal expense) {
|
public BigDecimal getExpense() {
|
||||||
this.expense = expense;
|
return expense;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public void setExpense(BigDecimal expense) {
|
||||||
return description;
|
this.expense = expense;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public String getDescription() {
|
||||||
this.description = description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreatedBy() {
|
public void setDescription(String description) {
|
||||||
return createdBy;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
public String getCreatedBy() {
|
||||||
this.createdBy = createdBy;
|
return createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreatedOn() {
|
public void setCreatedBy(String createdBy) {
|
||||||
return createdOn;
|
this.createdBy = createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedOn(Date createdOn) {
|
public Date getCreatedOn() {
|
||||||
this.createdOn = createdOn;
|
return createdOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastUpdatedBy() {
|
public void setCreatedOn(Date createdOn) {
|
||||||
return lastUpdatedBy;
|
this.createdOn = createdOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastUpdatedBy(String lastUpdatedBy) {
|
public String getLastUpdatedBy() {
|
||||||
this.lastUpdatedBy = lastUpdatedBy;
|
return lastUpdatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLastUpdatedOn() {
|
public void setLastUpdatedBy(String lastUpdatedBy) {
|
||||||
return lastUpdatedOn;
|
this.lastUpdatedBy = lastUpdatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastUpdatedOn(Date lastUpdatedOn) {
|
public Date getLastUpdatedOn() {
|
||||||
this.lastUpdatedOn = lastUpdatedOn;
|
return lastUpdatedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserRoutes() {
|
public void setLastUpdatedOn(Date lastUpdatedOn) {
|
||||||
String routes = "";
|
this.lastUpdatedOn = lastUpdatedOn;
|
||||||
routes = user.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
}
|
||||||
|
|
||||||
return routes;
|
public String getUserRoutes() {
|
||||||
}
|
String routes = "";
|
||||||
|
routes = user.getHumanResource().getHumanResourceHasRoutes().stream().map((py) -> py.getRouteCtlg().getRoute()).collect(Collectors.joining(", "));
|
||||||
public User getUserCreatedBy() {
|
|
||||||
return userCreatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserCreatedBy(User userCreatedBy) {
|
return routes;
|
||||||
this.userCreatedBy = userCreatedBy;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedByName() {
|
|
||||||
String name = getUserCreatedBy().getHumanResource().getFirstName() + " " + getUserCreatedBy().getHumanResource().getLastName();
|
|
||||||
|
|
||||||
return name;
|
public User getUserCreatedBy() {
|
||||||
}
|
return userCreatedBy;
|
||||||
|
}
|
||||||
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);
|
public void setUserCreatedBy(User userCreatedBy) {
|
||||||
date = dt1.parse(dateStr);
|
this.userCreatedBy = userCreatedBy;
|
||||||
|
}
|
||||||
|
|
||||||
action = date.after(lastStableSmallBox);
|
public String getCreatedByName() {
|
||||||
|
String name = getUserCreatedBy().getHumanResource().getFirstName() + " " + getUserCreatedBy().getHumanResource().getLastName();
|
||||||
// Busca el corte del día de este usuario
|
|
||||||
if (closingDayToday != null) {
|
return name;
|
||||||
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;
|
public boolean getAction(Date lastStableSmallBox, List<ClosingDay> closingDayToday) {
|
||||||
|
Date date = createdOn;
|
||||||
String dateStrCD;
|
String closingDayUser = null;
|
||||||
Date dateCD;
|
boolean action = true;
|
||||||
for(ClosingDay dato : closingDayToday){
|
try {
|
||||||
dateStrCD = dt1.format(dato.getCreatedOn());
|
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
dateCD = dt1.parse(dateStrCD);
|
|
||||||
|
String dateStr = dt1.format(date);
|
||||||
if(dato.getUser().getId().equalsIgnoreCase(getUser().getId()) && dateCD.equals(date)){
|
date = dt1.parse(dateStr);
|
||||||
closingDayUser = dato.getUser().getId();
|
|
||||||
}
|
action = date.after(lastStableSmallBox);
|
||||||
}
|
|
||||||
}
|
// Busca el corte del día de este usuario
|
||||||
|
if (closingDayToday != null) {
|
||||||
if(action){
|
Optional<ClosingDay> optUser = closingDayToday.stream().filter(p -> p.getUser().getId().equalsIgnoreCase(user.getId())
|
||||||
if(closingDayUser != null){
|
&& p.getCreatedOn().equals(createdOn)).findFirst();
|
||||||
action = false;
|
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) {
|
if (action) {
|
||||||
Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex);
|
if (closingDayUser != null) {
|
||||||
}
|
action = false;
|
||||||
return action;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
} catch (ParseException ex) {
|
||||||
public String toString() {
|
Logger.getLogger(ExpenseCompany.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
return "OtherExpense{" + "description=" + description + ", createdOn=" + createdOn + '}';
|
}
|
||||||
}
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OtherExpense{" + "description=" + description + ", createdOn=" + createdOn + '}';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,16 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<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>
|
<profile>
|
||||||
<id>AWS-EC2</id>
|
<id>AWS-EC2</id>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -189,6 +189,14 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<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>
|
<profile>
|
||||||
<id>AWS-EC2</id>
|
<id>AWS-EC2</id>
|
||||||
<properties>
|
<properties>
|
||||||
|
16
ace/pom.xml
16
ace/pom.xml
@ -11,6 +11,22 @@
|
|||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
<profiles>
|
<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>
|
<profile>
|
||||||
<id>AWS-EC2</id>
|
<id>AWS-EC2</id>
|
||||||
<activation>
|
<activation>
|
||||||
|
Loading…
Reference in New Issue
Block a user