archivos
This commit is contained in:
parent
3892c40ce7
commit
d614edf933
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/ace-controller/target/
|
||||
/ace-layout/target/
|
||||
/ace-web/target/
|
||||
/ace-security/target/
|
||||
/ace-controller-mobile/target/
|
||||
/ace-model/target/
|
||||
/ace-ws-rest/target/
|
18
ace-controller-mobile/nb-configuration.xml
Normal file
18
ace-controller-mobile/nb-configuration.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
81
ace-controller-mobile/pom.xml
Normal file
81
ace-controller-mobile/pom.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-controller-mobile</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<log4j.version>2.17.0</log4j.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!--
|
||||
MySQL Connector/J 8.0 is highly recommended for use with
|
||||
MySQL Server 8.0, 5.7, 5.6, and 5.5.
|
||||
|
||||
Please upgrade to MySQL Connector/J 8.0.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.12</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Log4j 2 is broken up in an API and an implementation (core),
|
||||
where the API provides the interface that applications should code to.
|
||||
|
||||
Strictly speaking Log4j core is only needed at runtime
|
||||
and not at compile time.
|
||||
|
||||
However, below we list Log4j core as a compile time dependency
|
||||
to improve the startup time for custom plugins as it provides
|
||||
an annotation processor that generates a metadata file to cache plugin
|
||||
information as well as the necessary code to compile against
|
||||
to create custom plugins.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<!-- "Apoyo a Proyectos Comerciales (APC)" Application Dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<name>ace-controller-mobile</name>
|
||||
</project>
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.ClosingDayRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ClosingDayController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idEmployee
|
||||
* @param idOffice
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findIdClosingDayByEmployee(String idEmployee, String idOffice) throws Exception {
|
||||
try {
|
||||
ClosingDayRepository repository = new ClosingDayRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_USER, new User(idEmployee)));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return repository.findIdEntity(ClosingDayCfg.QUERY_FIND_ID_BY_EMPLOYEE_AND_OFFICE_EQUALS_CURRDATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdClosingDayByEmployee", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param updatedBy
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean disableClosingDayById(String id, String updatedBy) throws Exception {
|
||||
try {
|
||||
ClosingDayRepository repository = new ClosingDayRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_ID, id));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_ACTIVE_STATUS, ActiveStatus.DISABLED));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_LAST_UPDATED_BY, updatedBy));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
|
||||
return repository.updateClosingDay(ClosingDayCfg.QUERY_UPDATE_CLOSING_DAY_BY_STATUS, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("disableClosingDayById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public Long countIdClosingDayByEmployee(String idEmployee, String idOffice) throws Exception {
|
||||
try {
|
||||
ClosingDayRepository repository = new ClosingDayRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_USER, new User(idEmployee)));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return repository.countIdClosingDayByEmployee(ClosingDayCfg.QUERY_FIND_ID_BY_EMPLOYEE_AND_OFFICE_EQUALS_CURRDATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdClosingDayByEmployee", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.StableGeneralBoxRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.StableGeneralBoxCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class StableGeneralBoxController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idOffice
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean existStableGeneralBoxByCreatedOn(String idOffice) throws Exception {
|
||||
try {
|
||||
StableGeneralBoxRepository repository = new StableGeneralBoxRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableGeneralBoxCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return new Long(1).compareTo(repository.countStableGeneralBoxByOfficeEqualsToCurrentDate(StableGeneralBoxCfg.QUERY_COUNT_STABLE_GENERAL_BOX_BY_OFFICE_EQUALS_TO_CURRENT_DATE, parameters)) == 0;
|
||||
} catch (Exception e) {
|
||||
logger.error("existStableSmallBoxByCreatedOn", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.ClosingDayRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.StableSmallBoxRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.StableSmallBoxCfg;
|
||||
import com.arrebol.apc.model.admin.constance.StableSmallBoxCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class StableSmallBoxController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param updatedBy
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean disableIdSmallBoxById(String id, String updatedBy) throws Exception {
|
||||
try {
|
||||
ClosingDayRepository repository = new ClosingDayRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_ID, id));
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_ACTIVE_STATUS, ActiveStatus.DISABLED));
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_LAST_UPDATED_BY, updatedBy));
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
|
||||
return repository.updateClosingDay(StableSmallBoxCfg.QUERY_UPDATE_STABLE_SMALL_BOX_BY_STATUS, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("disableIdSmallBoxById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idOffice
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean existStableSmallBoxByCreatedOn(String idOffice) throws Exception {
|
||||
try {
|
||||
StableSmallBoxRepository repository = new StableSmallBoxRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return new Long(1).compareTo(repository.countStableSmallBoxByOfficeEqualsToCurrentDate(StableSmallBoxCfg.QUERY_COUNT_STABLE_SMALL_BOX_BY_OFFICE_EQUALS_TO_CURDATE, parameters)) == 0;
|
||||
} catch (Exception e) {
|
||||
logger.error("existStableSmallBoxByCreatedOn", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idOffice
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findIdStableSmallBoxByOfficeInCurrentDate(String idOffice) throws Exception {
|
||||
try {
|
||||
ClosingDayRepository repository = new ClosingDayRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableSmallBoxCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return repository.findIdEntity(StableSmallBoxCfg.QUERY_FIND_STABLE_SMALL_BOX_BY_OFFICE_EQUALS_TO_CURRENT_DATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdStableSmallBoxByOfficeInCurrentDate", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.bitacora;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.bitacora.BitacoraRepository;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.system.logs.Bitacora;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class BitacoraController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param action
|
||||
* @param userName
|
||||
* @param comments
|
||||
* @param createdBy
|
||||
* @param office
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
public boolean insertBitacoraRecord(String action, String userName, String comments, String createdBy, String office, String description) {
|
||||
boolean success;
|
||||
try {
|
||||
BitacoraRepository repository = new BitacoraRepository();
|
||||
Bitacora bitacora = new Bitacora();
|
||||
|
||||
bitacora.setId(UUID.randomUUID().toString());
|
||||
bitacora.setNameUser(userName);
|
||||
bitacora.setAction(action);
|
||||
bitacora.setCommentsUser(comments);
|
||||
bitacora.setCreatedBy(createdBy);
|
||||
bitacora.setCreatedOn(new Date());
|
||||
bitacora.setOffice(new Office(office));
|
||||
bitacora.setDescription(description);
|
||||
|
||||
success = repository.saveBitacora(bitacora);
|
||||
} catch (Exception e) {
|
||||
success = false;
|
||||
logger.error("insertBitacoraRecord", e);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.cash;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.views.CashRegisterCurdateByUserViewRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.views.TotalCashByCurdateViewRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.constance.CashRegisterCurdateByUserViewCfg;
|
||||
import com.arrebol.apc.model.views.CashRegisterCurdateByUserView;
|
||||
import com.arrebol.apc.model.views.TotalCashByCurdateView;
|
||||
import com.arrebol.apc.model.ws.parsed.AmountJaxb;
|
||||
import com.arrebol.apc.model.ws.parsed.CashRegisterJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class CashRegisterCurdateByUserController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CashRegisterJaxb findAllCashRegisterCurdateByUserId(String userId) throws Exception {
|
||||
logger.debug("findAllCashRegisterCurdateByUserId");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
CashRegisterCurdateByUserViewCfg.FIELD_USER_ID,
|
||||
userId
|
||||
)
|
||||
);
|
||||
|
||||
Double totalCash = 0d;
|
||||
List<AmountJaxb> amounts = new ArrayList<>();
|
||||
|
||||
List<CashRegisterCurdateByUserView> results = cashRegisterCurdateByUserViewRepository.findAllCashRegisterCurdateByUserId(
|
||||
CashRegisterCurdateByUserView.class,
|
||||
CashRegisterCurdateByUserViewCfg.QUERY_FIND_CASH_REGISTER,
|
||||
parameters);
|
||||
|
||||
for (CashRegisterCurdateByUserView result : results) {
|
||||
totalCash += result.getPayment().doubleValue();
|
||||
|
||||
amounts.add(
|
||||
new AmountJaxb(
|
||||
result.getCustomerName(),
|
||||
result.getPayment().doubleValue()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return new CashRegisterJaxb(totalCash, amounts);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllCashRegisterCurdateByUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public TotalCashByCurdateView findDailyTotalsByUserId(String userId) throws Exception {
|
||||
logger.debug("findById");
|
||||
try {
|
||||
TotalCashByCurdateView result = totalCashByCurdateViewRepository.findById(userId);
|
||||
|
||||
if (null == result) {
|
||||
throw new NullPointerException("userId: " + userId + " NOT found");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("findById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -3434981661467291172L;
|
||||
final Logger logger = LogManager.getLogger(CashRegisterCurdateByUserController.class);
|
||||
|
||||
private final CashRegisterCurdateByUserViewRepository cashRegisterCurdateByUserViewRepository;
|
||||
private final TotalCashByCurdateViewRepository totalCashByCurdateViewRepository;
|
||||
|
||||
public CashRegisterCurdateByUserController() {
|
||||
this.cashRegisterCurdateByUserViewRepository = new CashRegisterCurdateByUserViewRepository();
|
||||
this.totalCashByCurdateViewRepository = new TotalCashByCurdateViewRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.customer;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.views.LoanByUserViewRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserViewCfg;
|
||||
import com.arrebol.apc.model.enums.PreferenceValue;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class CustomerController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param orderList
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanByUserView> findAllLoansByUserId(String orderList, String userId) throws Exception {
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
boolean isByOrderInList = PreferenceValue.ORDER_IN_LIST.toString().equals(orderList);
|
||||
|
||||
parameters.add(new ModelParameter(LoanByUserViewCfg.FIELD_USER_ID, userId));
|
||||
|
||||
return loanByUserViewRepository
|
||||
.findAllLoansByUserId(
|
||||
isByOrderInList
|
||||
? LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_ORDER_LIST
|
||||
: LoanByUserViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ID_BY_CUSTOMER_NAME,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoansByUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -6689182942800786108L;
|
||||
final Logger logger = LogManager.getLogger(CustomerController.class);
|
||||
|
||||
private final LoanByUserViewRepository loanByUserViewRepository;
|
||||
|
||||
public CustomerController() {
|
||||
this.loanByUserViewRepository = new LoanByUserViewRepository();
|
||||
}
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.exchange;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.TransferRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.views.ExchangeEnebledUsersViewRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.Transfer;
|
||||
import com.arrebol.apc.model.admin.constance.TransferCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.ExchangeEnebledUsersViewCfg;
|
||||
import com.arrebol.apc.model.enums.ActionStatus;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.views.ExchangeEnebledUsersView;
|
||||
import com.arrebol.apc.model.ws.parsed.Exchange;
|
||||
import com.arrebol.apc.model.ws.parsed.ExchangeJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ExchangeEnebledUsersController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param officeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<ExchangeEnebledUsersView> findEnebledUsersToUserId(String userId, String officeId) throws Exception {
|
||||
logger.debug("exchangeEnebledUsersViewRepository");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.PARAM_OFFICE_ID,
|
||||
officeId
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
ExchangeEnebledUsersViewCfg.FIELD_VIEW_ID,
|
||||
userId
|
||||
)
|
||||
);
|
||||
|
||||
return exchangeEnebledUsersViewRepository.findEnebledUsersToUserId(
|
||||
ExchangeEnebledUsersViewCfg.QUERY_FIND_ENEBLED_USERS_TO_USER_ID,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findEnebledUsersToUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jaxb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean newExchange(ExchangeJaxb jaxb) throws Exception {
|
||||
logger.debug("newExchange");
|
||||
try {
|
||||
Transfer transfer = new Transfer(
|
||||
new User(jaxb.getSenderId()),
|
||||
new User(jaxb.getReceiverId()),
|
||||
ActiveStatus.ENEBLED,
|
||||
ActionStatus.PENDING,
|
||||
jaxb.getAmount(),
|
||||
new Office(jaxb.getOfficeId()),
|
||||
jaxb.getSenderId());
|
||||
|
||||
return transferRepository.addTransfer(transfer);
|
||||
} catch (Exception e) {
|
||||
logger.error("newExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param transerId
|
||||
* @param userId
|
||||
* @param isApproved
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateExchange(String transerId, String userId, boolean isApproved) throws Exception {
|
||||
logger.debug("updateExchange");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ACTION_STATUS, isApproved ? ActionStatus.APPROVED : ActionStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(TransferCfg.FIELD_ID, transerId));
|
||||
|
||||
return transferRepository.updateTransfer(TransferCfg.QUERY_UPDATE_TRANSFER_BY_ACTION, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateExchange", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Exchange> exchangesByUsers(String userId) throws Exception {
|
||||
logger.debug("exchangesByUsers");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_TRANSMITTER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
TransferCfg.FIELD_USER_RECEIVER,
|
||||
new User(userId)
|
||||
)
|
||||
);
|
||||
|
||||
return transferRepository.findAllTransferByUserIdAndCurdate(TransferCfg.QUERY_FIND_ALL_TRANSFER_BY_USER_ID_AND_CURDATE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("exchangesByUsers", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 2625775904919860613L;
|
||||
final Logger logger = LogManager.getLogger(ExchangeEnebledUsersController.class);
|
||||
|
||||
private final ExchangeEnebledUsersViewRepository exchangeEnebledUsersViewRepository;
|
||||
private final TransferRepository transferRepository;
|
||||
|
||||
public ExchangeEnebledUsersController() {
|
||||
this.exchangeEnebledUsersViewRepository = new ExchangeEnebledUsersViewRepository();
|
||||
this.transferRepository = new TransferRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.gasoline;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.gasoline.GasolineRepository;
|
||||
import com.arrebol.apc.model.gasoline.Gasoline;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class GasolineController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gasoline
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveNewGasolinePayment(Gasoline gasoline) throws Exception {
|
||||
try {
|
||||
GasolineRepository gasolineRepository = new GasolineRepository();
|
||||
|
||||
return gasolineRepository.saveNewGasolinePayment(gasoline);
|
||||
} catch (Exception e) {
|
||||
logger.error("addNewGasolineEntry", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5280895557294295000L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.login;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.login.UserMxy;
|
||||
import com.arrebol.apc.controller.mobile.moxy.login.UserPreferenceMxy;
|
||||
import com.arrebol.apc.controller.mobile.repository.jaas.AuthenticationRepository;
|
||||
import com.arrebol.apc.model.mobile.access.MobileUser;
|
||||
import com.arrebol.apc.model.mobile.preference.UserMobilePreference;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoginWSController implements Serializable {
|
||||
|
||||
public UserMxy login(String userName, String password) throws Exception {
|
||||
logger.debug("login");
|
||||
|
||||
UserMxy userMxy;
|
||||
List<UserPreferenceMxy> preferenceLst;
|
||||
try {
|
||||
MobileUser mobileUser = getAuthenticationRepository().findUser(userName, password);
|
||||
|
||||
if (null == mobileUser) {
|
||||
throw new Exception("Access denied");
|
||||
} else {
|
||||
userMxy = new UserMxy(
|
||||
mobileUser.getId(),
|
||||
mobileUser.getUserName(),
|
||||
mobileUser.getAvatar(),
|
||||
mobileUser.getOfficeId(),
|
||||
mobileUser.getRouteId(),
|
||||
mobileUser.getCertifier(),
|
||||
mobileUser.getManagement().toString()
|
||||
);
|
||||
}
|
||||
|
||||
List<UserMobilePreference> userMobilePreferences = getAuthenticationRepository().findAllMobilePreferenceByUser(userMxy.getId());
|
||||
|
||||
if (!userMobilePreferences.isEmpty()) {
|
||||
preferenceLst = new ArrayList<>();
|
||||
|
||||
userMobilePreferences.forEach((preference) -> {
|
||||
preferenceLst.add(new UserPreferenceMxy(preference.getPreferenceName(), preference.getPreferenceValue()));
|
||||
});
|
||||
|
||||
userMxy.setPreferences(preferenceLst);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("login", e);
|
||||
throw e;
|
||||
}
|
||||
return userMxy;
|
||||
}
|
||||
|
||||
public LoginWSController() {
|
||||
this.authenticationRepository = new AuthenticationRepository();
|
||||
}
|
||||
|
||||
public AuthenticationRepository getAuthenticationRepository() {
|
||||
return authenticationRepository;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 2795964728722199660L;
|
||||
final Logger logger = LogManager.getLogger(LoginWSController.class);
|
||||
|
||||
private final AuthenticationRepository authenticationRepository;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.otherexpense;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.admin.OtherExpenseRepository;
|
||||
import com.arrebol.apc.model.admin.OtherExpense;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class OtherExpenseController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param officeId
|
||||
* @param userId
|
||||
* @param expense
|
||||
* @param description
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean addOtherExpense(
|
||||
String officeId,
|
||||
String userId,
|
||||
Double expense,
|
||||
String description) throws Exception {
|
||||
logger.debug("addOtherExpense");
|
||||
try {
|
||||
OtherExpense otherExpense = new OtherExpense(officeId, userId, new BigDecimal(expense), description);
|
||||
|
||||
return otherExpenseRepository.saveOtherExpense(otherExpense);
|
||||
} catch (Exception e) {
|
||||
logger.error("addOtherExpense", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -1748077572747436181L;
|
||||
|
||||
final Logger logger = LogManager.getLogger(OtherExpenseController.class);
|
||||
|
||||
private final OtherExpenseRepository otherExpenseRepository;
|
||||
|
||||
public OtherExpenseController() {
|
||||
this.otherExpenseRepository = new OtherExpenseRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.person;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.people.PeopleRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.constance.PeopleCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PersonController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanId
|
||||
* @param lastUpdatedBy
|
||||
* @param phoneNumber
|
||||
* @param isCustomer
|
||||
* @return
|
||||
*/
|
||||
public boolean changeContactNumber(String loanId, String lastUpdatedBy, String phoneNumber, boolean isCustomer) {
|
||||
boolean success = false;
|
||||
try {
|
||||
PeopleRepository repository = new PeopleRepository();
|
||||
String personId = repository.findPeopleIdByIdLoad(loanId, isCustomer);
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_PHONE_HOME, phoneNumber));
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy));
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_ID, personId));
|
||||
|
||||
return repository.changeContactNumber(PeopleCfg.QUERY_UPDATE_PHONE_HOME_BY_PEOPLE_ID, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("changeContactNumber", e);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.preference;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.LoanByUserOrderPreferenceViewJaxb;
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.LoanByUserOrderPreferenceViewListJaxb;
|
||||
import com.arrebol.apc.controller.mobile.repository.preference.UserMobilePreferenceRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.views.LoanByUserOrderPreferenceViewRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserOrderPreferenceViewCfg;
|
||||
import com.arrebol.apc.model.core.constance.UserMobilePreferenceCfg;
|
||||
import com.arrebol.apc.model.enums.PreferenceName;
|
||||
import com.arrebol.apc.model.enums.PreferenceValue;
|
||||
import com.arrebol.apc.model.loan.LoanByUserId;
|
||||
import com.arrebol.apc.model.mobile.preference.UserMobilePreference;
|
||||
import com.arrebol.apc.model.views.LoanByUserOrderPreferenceView;
|
||||
import com.arrebol.apc.model.ws.parsed.ConfigurationJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class SystemPreferenceController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanByUserOrderPreferenceView> findAllLoanByUserOrderPreference(String userId) throws Exception {
|
||||
logger.debug("findAllLoanByUserOrderPreference");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanByUserOrderPreferenceViewCfg.FIELD_ORDER_USER_ID, userId));
|
||||
|
||||
return loanByUserOrderPreferenceViewRepository
|
||||
.findAllLoanByUserOrderPreference(
|
||||
LoanByUserOrderPreferenceViewCfg.QUERY_FIND_ALL_LOAN_BY_USER_ORDER_PREFERENCE,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoanByUserOrderPreference", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param updateOrderListPreference
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateOrderInList(LoanByUserOrderPreferenceViewListJaxb updateOrderListPreference) throws Exception {
|
||||
logger.debug("updateOrderInList");
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
if (updateLoanByUser(updateOrderListPreference)) {
|
||||
success = updateUserMobilePreference(
|
||||
new User(updateOrderListPreference.getLoanByUserOrderPreferences().get(0).getUserId()),
|
||||
PreferenceName.ORDER_LIST.toString(),
|
||||
PreferenceValue.ORDER_IN_LIST.toString()
|
||||
);
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
logger.error("updateOrderInList", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param UserId
|
||||
* @param preferenceName
|
||||
* @param preferenceValue
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateUserMobilePreference(String UserId, String preferenceName, String preferenceValue) throws Exception {
|
||||
logger.debug("updateUserMobilePreference");
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
success = updateUserMobilePreference(
|
||||
new User(UserId),
|
||||
preferenceName,
|
||||
preferenceValue
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("updateUserMobilePreference", e);
|
||||
throw e;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param updateOrderListPreference
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean updateLoanByUser(LoanByUserOrderPreferenceViewListJaxb updateOrderListPreference) throws Exception {
|
||||
logger.debug("updateLoanByUser");
|
||||
try {
|
||||
for (int i = 0; i < updateOrderListPreference.getLoanByUserOrderPreferences().size(); i++) {
|
||||
LoanByUserOrderPreferenceViewJaxb preference = updateOrderListPreference.getLoanByUserOrderPreferences().get(i);
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
LoanByUserCfg.FIELD_ORDER_IN_LIST,
|
||||
preference.getOrderInList()
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
LoanByUserCfg.FIELD_ID,
|
||||
new LoanByUserId(
|
||||
preference.getId(),
|
||||
preference.getUserId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
loanByUserOrderPreferenceViewRepository.updateQuery(
|
||||
LoanByUserCfg.QUERY_UPDATE_ORDER_IN_LIST,
|
||||
parameters
|
||||
);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error("updateLoanByUser", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param preferenceName
|
||||
* @param preferenceValue
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean updateUserMobilePreference(User user, String preferenceName, String preferenceValue) throws Exception {
|
||||
logger.debug("updateUserMobilePreference");
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_USER, user));
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_PREFERENCE_NAME, preferenceName));
|
||||
|
||||
UserMobilePreference userMobilePreference = userMobilePreferenceRepository.findUserMobilePreference(
|
||||
UserMobilePreference.class,
|
||||
UserMobilePreferenceCfg.QUERY_FIND_MOBILE_PREFERENCE_BY_USER_AND_PREFERENCE_NAME,
|
||||
parameters);
|
||||
|
||||
if (null != userMobilePreference) {
|
||||
parameters.clear();
|
||||
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_PREFERENCE_VALUE, preferenceValue));
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_LAST_UPDATED_BY, user.getId()));
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_ID, userMobilePreference.getId()));
|
||||
|
||||
success = userMobilePreferenceRepository.updateQueryUserMobilePreference(
|
||||
UserMobilePreferenceCfg.QUERY_UPDATE_PREFERENCE_VALUE,
|
||||
parameters
|
||||
);
|
||||
} else {
|
||||
userMobilePreference = new UserMobilePreference(
|
||||
user,
|
||||
preferenceName,
|
||||
preferenceValue,
|
||||
user.getId());
|
||||
success = userMobilePreferenceRepository.insertUserMobilePreference(userMobilePreference);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("updateUserMobilePreference", e);
|
||||
throw e;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param officeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public ConfigurationJaxb findConfigurationButton(String userId, String officeId) throws Exception {
|
||||
logger.debug("findConfigurationButton");
|
||||
ConfigurationJaxb configuration;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_USER, new User(userId)));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
|
||||
Long result = userMobilePreferenceRepository.count(ClosingDayCfg.QUERY_COUNT_CLOSING_DATE_BY_USER_AND_OFFICE, parameters);
|
||||
configuration = new ConfigurationJaxb(result.compareTo(new Long(0)) == 0);
|
||||
} catch (Exception e) {
|
||||
logger.error("findConfigurationButton", e);
|
||||
configuration = new ConfigurationJaxb(false);
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 6329489276545356862L;
|
||||
final Logger logger = LogManager.getLogger(SystemPreferenceController.class);
|
||||
|
||||
private final LoanByUserOrderPreferenceViewRepository loanByUserOrderPreferenceViewRepository;
|
||||
private final UserMobilePreferenceRepository userMobilePreferenceRepository;
|
||||
|
||||
public SystemPreferenceController() {
|
||||
this.loanByUserOrderPreferenceViewRepository = new LoanByUserOrderPreferenceViewRepository();
|
||||
this.userMobilePreferenceRepository = new UserMobilePreferenceRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.reports;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.reports.ReportsRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.reports.UserWeekReport;
|
||||
import com.arrebol.apc.model.reports.constance.UserWeekReportCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ReportsController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public UserWeekReport findUserWeekReportDetailsByUser(String id) throws Exception {
|
||||
try {
|
||||
ReportsRepository reportsRepository = new ReportsRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(UserWeekReportCfg.FIELD_ID, id)
|
||||
);
|
||||
|
||||
return reportsRepository.findUserWeekReportDetailsByUser(UserWeekReport.class, UserWeekReportCfg.QUERY_FIND_USER_WEEK_REPORT_BY_USER, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findUserWeekReportDetailsByUser", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5280895557294295916L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public ReportsController() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.route;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.ContainerRoutes;
|
||||
import com.arrebol.apc.controller.mobile.repository.route.RouteRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.constance.RouteCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class RouteController implements Serializable {
|
||||
|
||||
public ContainerRoutes findAllRoutesAvailables(String officeId) throws Exception {
|
||||
try {
|
||||
RouteRepository repository = new RouteRepository();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(RouteCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
parameters.add(new ModelParameter(RouteCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
|
||||
return repository.findAllRoutesAvailables(RouteCfg.QUERY_FIND_ALL_AVAILABLES_ROUTES, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllRoutesAvailables", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.search;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.views.PersonSearchHistoricalDetailsViewRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.views.PersonSearchViewRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanCfg;
|
||||
import com.arrebol.apc.model.core.constance.PersonSearchHistoricalDetailsViewCfg;
|
||||
import com.arrebol.apc.model.core.constance.PersonSearchViewCfg;
|
||||
import com.arrebol.apc.model.core.constance.UserCfg;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import com.arrebol.apc.model.views.PersonSearchDetailView;
|
||||
import com.arrebol.apc.model.views.PersonSearchHistoricalDetailsView;
|
||||
import com.arrebol.apc.model.views.PersonSearchView;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PersonSearchController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param nameToSearch
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PersonSearchView fullNameEqualsToPersonSearch(String nameToSearch) throws Exception {
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
PersonSearchViewCfg.FIELD_PERSON_SEARCH,
|
||||
nameToSearch
|
||||
)
|
||||
);
|
||||
|
||||
PersonSearchView result = (PersonSearchView) personSearchViewRepository.findResultXML(
|
||||
PersonSearchView.class,
|
||||
PersonSearchViewCfg.QUERY_FULL_NAME_EQUALS_TO_PERSON_SEARCH,
|
||||
parameters
|
||||
);
|
||||
|
||||
if (null == result) {
|
||||
result = new PersonSearchView("N/A", "N/A");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllCoincidences", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param search
|
||||
* @return If any return list of coincidences otherwise return empty list.
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PersonSearchView> findAllCoincidences(String search) throws Exception {
|
||||
logger.debug("findAllCoincidences");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
PersonSearchViewCfg.FIELD_PERSON_SEARCH,
|
||||
search
|
||||
)
|
||||
);
|
||||
|
||||
return personSearchViewRepository.findResultList(
|
||||
PersonSearchView.class,
|
||||
PersonSearchViewCfg.QUERY_LIKE_BY_PERSON_SEARCH,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllCoincidences", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param personSearchId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PersonSearchDetailView findPersonSearchDetail(String personSearchId) throws Exception {
|
||||
logger.debug("findPersonSearchDetail");
|
||||
try {
|
||||
return personSearchViewRepository.findResult(PersonSearchDetailView.class, personSearchId);
|
||||
} catch (Exception e) {
|
||||
logger.error("findPersonSearchDetail", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param personSearchId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PersonSearchHistoricalDetailsView> findPersonHistoricalDetailsByPersonId(String personSearchId) throws Exception {
|
||||
logger.debug("findPersonHistoricalDetailsByPersonId");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(PersonSearchHistoricalDetailsViewCfg.FIELD_PERSON_SEARCH_ID, personSearchId));
|
||||
|
||||
return personSearchHistoricalDetailsViewRepository.findAllByPersonId(
|
||||
PersonSearchHistoricalDetailsView.class,
|
||||
PersonSearchHistoricalDetailsViewCfg.QUERY_FIND_PERSON_SEARCH_HISTORICAL_DETAILS_BY_PERSON_ID,
|
||||
parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findPersonHistoricalDetailsByPersonId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
//Necesito utilizar tuple
|
||||
/**
|
||||
*
|
||||
* @param idUser
|
||||
* @param personSearch
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanByUserView searchPaymentDetails(String idUser, String personSearch) throws Exception {
|
||||
logger.debug("searchPaymentDetails");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_CUSTOMER, new People(personSearch)));
|
||||
parameters.add(new ModelParameter(LoanByUserCfg.FIELD_USER, new User(idUser)));
|
||||
parameters.add(new ModelParameter(UserCfg.FIELD_ID, idUser));
|
||||
|
||||
return (LoanByUserView) personSearchViewRepository.findResultTupleXML(
|
||||
LoanCfg.QUERY_SEARCH_PAYMENT_DETAILS,
|
||||
parameters);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("searchPaymentDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -3224360462532091921L;
|
||||
final Logger logger = LogManager.getLogger(PersonSearchController.class);
|
||||
|
||||
final private PersonSearchViewRepository personSearchViewRepository;
|
||||
final private PersonSearchHistoricalDetailsViewRepository personSearchHistoricalDetailsViewRepository;
|
||||
|
||||
public PersonSearchController() {
|
||||
this.personSearchViewRepository = new PersonSearchViewRepository();
|
||||
this.personSearchHistoricalDetailsViewRepository = new PersonSearchHistoricalDetailsViewRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.tracking;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.PaymentTrackingViewJaxb;
|
||||
import com.arrebol.apc.controller.mobile.repository.tracking.PaymentTrackingRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.views.AdvanceUserDailyView;
|
||||
import com.arrebol.apc.model.views.constance.AdvanceUserDailyViewCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PaymentTrackingController implements Serializable {
|
||||
|
||||
public PaymentTrackingViewJaxb paymentTrakingByUserDetails(String idUser, String idOffice) {
|
||||
PaymentTrackingViewJaxb paymentTracking = new PaymentTrackingViewJaxb();
|
||||
logger.debug("paymentTrakingByUserDetails");
|
||||
try {
|
||||
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
AdvanceUserDailyViewCfg.FIELD_VIEW_USER,
|
||||
new User(idUser)
|
||||
)
|
||||
);
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
AdvanceUserDailyViewCfg.FIELD_VIEW_OFFICE,
|
||||
new Office(idOffice)
|
||||
)
|
||||
);
|
||||
|
||||
PaymentTrackingRepository repository = new PaymentTrackingRepository();
|
||||
|
||||
AdvanceUserDailyView result = repository.paymentTrakingByUserDetails(
|
||||
AdvanceUserDailyView.class,
|
||||
AdvanceUserDailyViewCfg.QUERY_PAYMENT_TRACKING_BY_IDS,
|
||||
parameters);
|
||||
|
||||
if (null != result) {
|
||||
paymentTracking.setTotalExpected(result.getTotalExpected());
|
||||
paymentTracking.setTotalNow(result.getTotalNow());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("paymentTrakingByUserDetails");
|
||||
}
|
||||
|
||||
return paymentTracking;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -3224360462532091920L;
|
||||
final Logger logger = LogManager.getLogger(PaymentTrackingController.class);
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.user;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.user.UserRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.UserCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean isUserEnebled(String userId) throws Exception {
|
||||
logger.info("isUserEnebled");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserCfg.FIELD_ID, userId));
|
||||
|
||||
return userId.equals(userRepository.findUserStatusById(UserCfg.QUERY_VERIFY_USER_STATUS_BY_ID, parameters));
|
||||
} catch (Exception e) {
|
||||
logger.error("isUserEnebled", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean containtsUserManagementProperty(String userId) throws Exception {
|
||||
logger.info("containtsUserManagementProperty");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserCfg.FIELD_ID, userId));
|
||||
|
||||
return userRepository.containtsUserManagementProperty(UserCfg.QUERY_IS_USER_MANAGMENT, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("containtsUserManagementProperty", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idOffice
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<User> listOfUsersByOffice(String idOffice) throws Exception {
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
return userRepository.listOfUsersByOffice(UserCfg.QUERY_LIST_OF_USERS_BY_OFFICE, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("listOfUsersByOffice", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -2705701746315543593L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
public UserController() {
|
||||
this.userRepository = new UserRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "authorizeTransferList")
|
||||
public class AuthorizeTransferList {
|
||||
|
||||
private String idUpdateUser;
|
||||
private String comments;
|
||||
private List<TransferListToUpdateStatus> transferListToUpdateStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AuthorizeTransferList() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idUpdateUser
|
||||
* @param comments
|
||||
* @param transferListToUpdateStatus
|
||||
*/
|
||||
public AuthorizeTransferList(String idUpdateUser, String comments, List<TransferListToUpdateStatus> transferListToUpdateStatus) {
|
||||
this.idUpdateUser = idUpdateUser;
|
||||
this.comments = comments;
|
||||
this.transferListToUpdateStatus = transferListToUpdateStatus;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idUpdateUser")
|
||||
public String getIdUpdateUser() {
|
||||
return idUpdateUser;
|
||||
}
|
||||
|
||||
public void setIdUpdateUser(String idUpdateUser) {
|
||||
this.idUpdateUser = idUpdateUser;
|
||||
}
|
||||
|
||||
@XmlElement(name = "comments")
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@XmlElement(name = "transferListToUpdateStatus")
|
||||
public List<TransferListToUpdateStatus> getTransferListToUpdateStatus() {
|
||||
return transferListToUpdateStatus;
|
||||
}
|
||||
|
||||
public void setTransferListToUpdateStatus(List<TransferListToUpdateStatus> transferListToUpdateStatus) {
|
||||
this.transferListToUpdateStatus = transferListToUpdateStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 31 * hash + Objects.hashCode(this.idUpdateUser);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AuthorizeTransferList other = (AuthorizeTransferList) obj;
|
||||
if (!Objects.equals(this.idUpdateUser, other.idUpdateUser)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "authorizeTransferPaymentsDto")
|
||||
public class AuthorizeTransferPaymentsDto {
|
||||
|
||||
private String idLoan;
|
||||
private String strDate;
|
||||
private String customerName;
|
||||
private String endorsementName;
|
||||
private String userName;
|
||||
private Double amount;
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AuthorizeTransferPaymentsDto() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idLoan
|
||||
* @param strDate
|
||||
* @param customerName
|
||||
* @param endorsementName
|
||||
* @param userName
|
||||
* @param amount
|
||||
* @param comments
|
||||
*/
|
||||
public AuthorizeTransferPaymentsDto(String idLoan, String strDate, String customerName, String endorsementName, String userName, Double amount, String comments) {
|
||||
this.idLoan = idLoan;
|
||||
this.strDate = strDate;
|
||||
this.customerName = customerName;
|
||||
this.endorsementName = endorsementName;
|
||||
this.userName = userName;
|
||||
this.amount = amount;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idLoan")
|
||||
public String getIdLoan() {
|
||||
return idLoan;
|
||||
}
|
||||
|
||||
public void setIdLoan(String idLoan) {
|
||||
this.idLoan = idLoan;
|
||||
}
|
||||
|
||||
@XmlElement(name = "strDate")
|
||||
public String getStrDate() {
|
||||
return strDate;
|
||||
}
|
||||
|
||||
public void setStrDate(String strDate) {
|
||||
this.strDate = strDate;
|
||||
}
|
||||
|
||||
@XmlElement(name = "customerName")
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "endorsementName")
|
||||
public String getEndorsementName() {
|
||||
return endorsementName;
|
||||
}
|
||||
|
||||
public void setEndorsementName(String endorsementName) {
|
||||
this.endorsementName = endorsementName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "userName")
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "amount")
|
||||
public Double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@XmlElement(name = "comments")
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "deleteLoanDetailsJaxb")
|
||||
public class DeleteLoanDetailsJaxb {
|
||||
|
||||
private Boolean approvedOrPendingRenovation;
|
||||
private Boolean todayPayment;
|
||||
private Boolean todayFee;
|
||||
private String loanId;
|
||||
|
||||
public DeleteLoanDetailsJaxb() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param approvedOrPendingRenovation
|
||||
* @param todayPayment
|
||||
* @param todayFee
|
||||
*/
|
||||
public DeleteLoanDetailsJaxb(Boolean approvedOrPendingRenovation, Boolean todayPayment, Boolean todayFee) {
|
||||
this.approvedOrPendingRenovation = approvedOrPendingRenovation;
|
||||
this.todayPayment = todayPayment;
|
||||
this.todayFee = todayFee;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param approvedOrPendingRenovation
|
||||
* @param todayPayment
|
||||
* @param todayFee
|
||||
* @param loanId
|
||||
*/
|
||||
public DeleteLoanDetailsJaxb(Boolean approvedOrPendingRenovation, Boolean todayPayment, Boolean todayFee, String loanId) {
|
||||
this.approvedOrPendingRenovation = approvedOrPendingRenovation;
|
||||
this.todayPayment = todayPayment;
|
||||
this.todayFee = todayFee;
|
||||
this.loanId = loanId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param todayPayment
|
||||
* @param todayFee
|
||||
*/
|
||||
public DeleteLoanDetailsJaxb(Boolean todayPayment, Boolean todayFee) {
|
||||
this.todayPayment = todayPayment;
|
||||
this.todayFee = todayFee;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param todayPayment
|
||||
* @param todayFee
|
||||
* @param loanId
|
||||
*/
|
||||
public DeleteLoanDetailsJaxb(Boolean todayPayment, Boolean todayFee, String loanId) {
|
||||
this.todayPayment = todayPayment;
|
||||
this.todayFee = todayFee;
|
||||
this.loanId = loanId;
|
||||
}
|
||||
|
||||
@XmlElement(name = "approvedOrPendingRenovation")
|
||||
public Boolean getApprovedOrPendingRenovation() {
|
||||
return approvedOrPendingRenovation;
|
||||
}
|
||||
|
||||
public void setApprovedOrPendingRenovation(Boolean approvedOrPendingRenovation) {
|
||||
this.approvedOrPendingRenovation = approvedOrPendingRenovation;
|
||||
}
|
||||
|
||||
@XmlElement(name = "todayPayment")
|
||||
public Boolean getTodayPayment() {
|
||||
return todayPayment;
|
||||
}
|
||||
|
||||
public void setTodayPayment(Boolean todayPayment) {
|
||||
this.todayPayment = todayPayment;
|
||||
}
|
||||
|
||||
@XmlElement(name = "todayFee")
|
||||
public Boolean getTodayFee() {
|
||||
return todayFee;
|
||||
}
|
||||
|
||||
public void setTodayFee(Boolean todayFee) {
|
||||
this.todayFee = todayFee;
|
||||
}
|
||||
|
||||
@XmlElement(name = "loanId")
|
||||
public String getLoanId() {
|
||||
return loanId;
|
||||
}
|
||||
|
||||
public void setLoanId(String loanId) {
|
||||
this.loanId = loanId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeleteLoanDetailsJaxb{" + "approvedOrPendingRenovation=" + approvedOrPendingRenovation + ", todayPayment=" + todayPayment + ", todayFee=" + todayFee + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "apcResponse")
|
||||
public class GenericAPCResponserJaxb {
|
||||
|
||||
private Boolean successful;
|
||||
private String message;
|
||||
private String idClosingDay;
|
||||
private String idSmallBox;
|
||||
private String idGeneralBox;
|
||||
private Boolean enabledSubmit;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GenericAPCResponserJaxb() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param successful
|
||||
* @param message
|
||||
*/
|
||||
public GenericAPCResponserJaxb(Boolean successful, String message) {
|
||||
this.successful = successful;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@XmlElement(name = "successful")
|
||||
public Boolean getSuccessful() {
|
||||
return null == successful ? Boolean.FALSE : successful;
|
||||
}
|
||||
|
||||
public void setSuccessful(Boolean successful) {
|
||||
this.successful = successful;
|
||||
}
|
||||
|
||||
@XmlElement(name = "message")
|
||||
public String getMessage() {
|
||||
return null == message ? "" : message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idClosingDay")
|
||||
public String getIdClosingDay() {
|
||||
return idClosingDay;
|
||||
}
|
||||
|
||||
public void setIdClosingDay(String idClosingDay) {
|
||||
this.idClosingDay = idClosingDay;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idSmallBox")
|
||||
public String getIdSmallBox() {
|
||||
return idSmallBox;
|
||||
}
|
||||
|
||||
public void setIdSmallBox(String idSmallBox) {
|
||||
this.idSmallBox = idSmallBox;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idGeneralBox")
|
||||
public String getIdGeneralBox() {
|
||||
return idGeneralBox;
|
||||
}
|
||||
|
||||
public void setIdGeneralBox(String idGeneralBox) {
|
||||
this.idGeneralBox = idGeneralBox;
|
||||
}
|
||||
|
||||
@XmlElement(name = "enabledSubmit")
|
||||
public Boolean getEnabledSubmit() {
|
||||
return null == enabledSubmit ? Boolean.FALSE : enabledSubmit;
|
||||
}
|
||||
|
||||
public void setEnabledSubmit(Boolean enabledSubmit) {
|
||||
this.enabledSubmit = enabledSubmit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "loan")
|
||||
public class LoanTypeJaxb {
|
||||
|
||||
private String id;
|
||||
private BigDecimal payment;
|
||||
private String description;
|
||||
|
||||
public LoanTypeJaxb() {
|
||||
}
|
||||
|
||||
public LoanTypeJaxb(String id, BigDecimal payment) {
|
||||
this.id = id;
|
||||
this.payment = payment;
|
||||
}
|
||||
|
||||
public LoanTypeJaxb(String id, BigDecimal payment, String description) {
|
||||
this.id = id;
|
||||
this.payment = payment;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@XmlElement(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlElement(name = "payment")
|
||||
public BigDecimal getPayment() {
|
||||
return payment;
|
||||
}
|
||||
|
||||
public void setPayment(BigDecimal payment) {
|
||||
this.payment = payment;
|
||||
}
|
||||
|
||||
@XmlElement(name = "description")
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoanTypeJaxb{" + "payment=" + payment + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "availableLoans")
|
||||
public class LoanTypeListJaxb {
|
||||
|
||||
private List<LoanTypeJaxb> loans;
|
||||
|
||||
public LoanTypeListJaxb() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loans
|
||||
*/
|
||||
public LoanTypeListJaxb(List<LoanTypeJaxb> loans) {
|
||||
this.loans = loans;
|
||||
}
|
||||
|
||||
@XmlElement(name = "loans")
|
||||
public List<LoanTypeJaxb> getLoans() {
|
||||
return loans;
|
||||
}
|
||||
|
||||
public void setLoans(List<LoanTypeJaxb> loans) {
|
||||
this.loans = loans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoanTypeListJaxb{" + "loans=" + loans + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "transferListToUpdateStatus")
|
||||
public class TransferListToUpdateStatus {
|
||||
|
||||
private String idLoan;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public TransferListToUpdateStatus() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idLoan
|
||||
*/
|
||||
public TransferListToUpdateStatus(String idLoan) {
|
||||
this.idLoan = idLoan;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idLoan")
|
||||
public String getIdLoan() {
|
||||
return idLoan;
|
||||
}
|
||||
|
||||
public void setIdLoan(String idLoan) {
|
||||
this.idLoan = idLoan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 79 * hash + Objects.hashCode(this.idLoan);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final TransferListToUpdateStatus other = (TransferListToUpdateStatus) obj;
|
||||
if (!Objects.equals(this.idLoan, other.idLoan)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "updateLoanToDeliveryStatusDTO")
|
||||
public class UpdateLoanToDeliveryStatusDTO {
|
||||
|
||||
private String idLoan;
|
||||
private String strDate;
|
||||
private String customerName;
|
||||
private String endorsementName;
|
||||
private String userName;
|
||||
private Double amount;
|
||||
|
||||
public UpdateLoanToDeliveryStatusDTO() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idLoan
|
||||
* @param strDate
|
||||
* @param customerName
|
||||
* @param endorsementName
|
||||
* @param userName
|
||||
* @param amount
|
||||
*/
|
||||
public UpdateLoanToDeliveryStatusDTO(String idLoan, String strDate, String customerName, String endorsementName, String userName, Double amount) {
|
||||
this.idLoan = idLoan;
|
||||
this.strDate = strDate;
|
||||
this.customerName = customerName;
|
||||
this.endorsementName = endorsementName;
|
||||
this.userName = userName;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idLoan")
|
||||
public String getIdLoan() {
|
||||
return idLoan;
|
||||
}
|
||||
|
||||
public void setIdLoan(String idLoan) {
|
||||
this.idLoan = idLoan;
|
||||
}
|
||||
|
||||
@XmlElement(name = "strDate")
|
||||
public String getStrDate() {
|
||||
return strDate;
|
||||
}
|
||||
|
||||
public void setStrDate(String strDate) {
|
||||
this.strDate = strDate;
|
||||
}
|
||||
|
||||
@XmlElement(name = "customerName")
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "endorsementName")
|
||||
public String getEndorsementName() {
|
||||
return endorsementName;
|
||||
}
|
||||
|
||||
public void setEndorsementName(String endorsementName) {
|
||||
this.endorsementName = endorsementName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "userName")
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "amount")
|
||||
public Double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.json.loan;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "updateLoanToDeliveryStatusList")
|
||||
public class UpdateLoanToDeliveryStatusList {
|
||||
|
||||
private String idUpdateUser;
|
||||
private String comments;
|
||||
private List<UpdateLoanToDeliveryStatusDTO> loanToDeliveryList;
|
||||
|
||||
public UpdateLoanToDeliveryStatusList() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idUpdateUser
|
||||
* @param comments
|
||||
* @param loanToDeliveryList
|
||||
*/
|
||||
public UpdateLoanToDeliveryStatusList(String idUpdateUser, String comments, List<UpdateLoanToDeliveryStatusDTO> loanToDeliveryList) {
|
||||
this.idUpdateUser = idUpdateUser;
|
||||
this.comments = comments;
|
||||
this.loanToDeliveryList = loanToDeliveryList;
|
||||
}
|
||||
|
||||
@XmlElement(name = "idUpdateUser")
|
||||
public String getIdUpdateUser() {
|
||||
return idUpdateUser;
|
||||
}
|
||||
|
||||
public void setIdUpdateUser(String idUpdateUser) {
|
||||
this.idUpdateUser = idUpdateUser;
|
||||
}
|
||||
|
||||
@XmlElement(name = "comments")
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@XmlElement(name = "loanToDeliveryList")
|
||||
public List<UpdateLoanToDeliveryStatusDTO> getLoanToDeliveryList() {
|
||||
return loanToDeliveryList;
|
||||
}
|
||||
|
||||
public void setLoanToDeliveryList(List<UpdateLoanToDeliveryStatusDTO> loanToDeliveryList) {
|
||||
this.loanToDeliveryList = loanToDeliveryList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public abstract class PersonMxy {
|
||||
|
||||
protected String id;
|
||||
protected String firstName;
|
||||
protected String secondName;
|
||||
protected String lastName;
|
||||
protected String middleName;
|
||||
protected String addressHome;
|
||||
protected String addressWork;
|
||||
protected String phoneHome;
|
||||
protected String phoneWork;
|
||||
protected String thumbnail;
|
||||
|
||||
public PersonMxy() {
|
||||
}
|
||||
|
||||
public PersonMxy(String id, String firstName, String lastName, String thumbnail) {
|
||||
this.id = id;
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getSecondName() {
|
||||
return secondName;
|
||||
}
|
||||
|
||||
public void setSecondName(String secondName) {
|
||||
this.secondName = secondName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
return middleName;
|
||||
}
|
||||
|
||||
public void setMiddleName(String middleName) {
|
||||
this.middleName = middleName;
|
||||
}
|
||||
|
||||
public String getAddressHome() {
|
||||
return addressHome;
|
||||
}
|
||||
|
||||
public void setAddressHome(String addressHome) {
|
||||
this.addressHome = addressHome;
|
||||
}
|
||||
|
||||
public String getAddressWork() {
|
||||
return addressWork;
|
||||
}
|
||||
|
||||
public void setAddressWork(String addressWork) {
|
||||
this.addressWork = addressWork;
|
||||
}
|
||||
|
||||
public String getPhoneHome() {
|
||||
return phoneHome;
|
||||
}
|
||||
|
||||
public void setPhoneHome(String phoneHome) {
|
||||
this.phoneHome = phoneHome;
|
||||
}
|
||||
|
||||
public String getPhoneWork() {
|
||||
return phoneWork;
|
||||
}
|
||||
|
||||
public void setPhoneWork(String phoneWork) {
|
||||
this.phoneWork = phoneWork;
|
||||
}
|
||||
|
||||
public String getThumbnail() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public void setThumbnail(String thumbnail) {
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PersonMxy{" + "firstName=" + firstName + ", lastName=" + lastName + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.login;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.PersonMxy;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserMxy extends PersonMxy {
|
||||
|
||||
private String userName;
|
||||
private String officeId;
|
||||
private String routeId;
|
||||
private String certifier;
|
||||
private String management;
|
||||
|
||||
private List<UserPreferenceMxy> preferences;
|
||||
|
||||
public UserMxy() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param userName
|
||||
* @param thumbnail
|
||||
* @param officeId
|
||||
* @param routeId
|
||||
* @param certifier
|
||||
*/
|
||||
public UserMxy(String id, String userName, String thumbnail, String officeId, String routeId, String certifier) {
|
||||
this.id = id;
|
||||
this.userName = userName;
|
||||
this.thumbnail = thumbnail;
|
||||
this.officeId = officeId;
|
||||
this.routeId = routeId;
|
||||
this.certifier = certifier;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param userName
|
||||
* @param thumbnail
|
||||
* @param officeId
|
||||
* @param routeId
|
||||
* @param certifier
|
||||
* @param management
|
||||
*/
|
||||
public UserMxy(String id, String userName, String thumbnail, String officeId, String routeId, String certifier, String management) {
|
||||
this.id = id;
|
||||
this.userName = userName;
|
||||
this.thumbnail = thumbnail;
|
||||
this.officeId = officeId;
|
||||
this.routeId = routeId;
|
||||
this.certifier = certifier;
|
||||
this.management = management;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getOfficeId() {
|
||||
return officeId;
|
||||
}
|
||||
|
||||
public void setOfficeId(String officeId) {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public void setPreferences(List<UserPreferenceMxy> preferences) {
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
||||
public List<UserPreferenceMxy> getPreferences() {
|
||||
return preferences;
|
||||
}
|
||||
|
||||
public String getRouteId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
public void setRouteId(String routeId) {
|
||||
this.routeId = routeId;
|
||||
}
|
||||
|
||||
public String getCertifier() {
|
||||
return certifier;
|
||||
}
|
||||
|
||||
public void setCertifier(String certifier) {
|
||||
this.certifier = certifier;
|
||||
}
|
||||
|
||||
public String getManagement() {
|
||||
return management;
|
||||
}
|
||||
|
||||
public void setManagement(String management) {
|
||||
this.management = management;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserMxy{" + "userName=" + userName + ", preferences=" + preferences + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.login;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserPreferenceMxy {
|
||||
|
||||
private String preferenceName;
|
||||
private String preferenceValue;
|
||||
|
||||
public UserPreferenceMxy() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param preferenceName
|
||||
* @param preferenceValue
|
||||
*/
|
||||
public UserPreferenceMxy(String preferenceName, String preferenceValue) {
|
||||
this.preferenceName = preferenceName;
|
||||
this.preferenceValue = preferenceValue;
|
||||
}
|
||||
|
||||
public String getPreferenceName() {
|
||||
return preferenceName;
|
||||
}
|
||||
|
||||
public void setPreferenceName(String preferenceName) {
|
||||
this.preferenceName = preferenceName;
|
||||
}
|
||||
|
||||
public String getPreferenceValue() {
|
||||
return preferenceValue;
|
||||
}
|
||||
|
||||
public void setPreferenceValue(String preferenceValue) {
|
||||
this.preferenceValue = preferenceValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserPreferenceMxy{" + "preferenceName=" + preferenceName + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.views;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "containerRoutes")
|
||||
public class ContainerRoutes {
|
||||
|
||||
private List<RouteJaxb> routes;
|
||||
|
||||
public ContainerRoutes() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param routes
|
||||
*/
|
||||
public ContainerRoutes(List<RouteJaxb> routes) {
|
||||
this.routes = routes;
|
||||
}
|
||||
|
||||
@XmlElement(name = "routes")
|
||||
public List<RouteJaxb> getRoutes() {
|
||||
return routes;
|
||||
}
|
||||
|
||||
public void setRoutes(List<RouteJaxb> routes) {
|
||||
this.routes = routes;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.views;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "loanByUserOrderPreference")
|
||||
public class LoanByUserOrderPreferenceViewJaxb {
|
||||
|
||||
private String id;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String customerName;
|
||||
|
||||
private String customerAddressHome;
|
||||
|
||||
private String customerAddressBusiness;
|
||||
|
||||
private Integer orderInList;
|
||||
|
||||
public LoanByUserOrderPreferenceViewJaxb() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @param orderInList
|
||||
*/
|
||||
public LoanByUserOrderPreferenceViewJaxb(String id, String userId, Integer orderInList) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.orderInList = orderInList;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param customerName
|
||||
* @param orderInList
|
||||
*/
|
||||
public LoanByUserOrderPreferenceViewJaxb(String customerName, Integer orderInList) {
|
||||
this.customerName = customerName;
|
||||
this.orderInList = orderInList;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "userId")
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "customerName")
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "customerAddressHome")
|
||||
public String getCustomerAddressHome() {
|
||||
return customerAddressHome;
|
||||
}
|
||||
|
||||
public void setCustomerAddressHome(String customerAddressHome) {
|
||||
this.customerAddressHome = customerAddressHome;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "customerAddressBusiness")
|
||||
public String getCustomerAddressBusiness() {
|
||||
return customerAddressBusiness;
|
||||
}
|
||||
|
||||
public void setCustomerAddressBusiness(String customerAddressBusiness) {
|
||||
this.customerAddressBusiness = customerAddressBusiness;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "orderInList")
|
||||
public Integer getOrderInList() {
|
||||
return orderInList;
|
||||
}
|
||||
|
||||
public void setOrderInList(Integer orderInList) {
|
||||
this.orderInList = orderInList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoanByUserOrderPreferenceViewJaxb{" + "customerName=" + customerName + ", orderInList=" + orderInList + '}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.views;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "systemPreferences")
|
||||
public class LoanByUserOrderPreferenceViewListJaxb {
|
||||
|
||||
List<LoanByUserOrderPreferenceViewJaxb> loanByUserOrderPreferences;
|
||||
|
||||
public LoanByUserOrderPreferenceViewListJaxb() {
|
||||
}
|
||||
|
||||
public LoanByUserOrderPreferenceViewListJaxb(List<LoanByUserOrderPreferenceViewJaxb> loanByUserOrderPreferences) {
|
||||
this.loanByUserOrderPreferences = loanByUserOrderPreferences;
|
||||
}
|
||||
|
||||
@XmlElement(name = "loanByUserOrderPreferences")
|
||||
public List<LoanByUserOrderPreferenceViewJaxb> getLoanByUserOrderPreferences() {
|
||||
return loanByUserOrderPreferences;
|
||||
}
|
||||
|
||||
public void setLoanByUserOrderPreferences(List<LoanByUserOrderPreferenceViewJaxb> loanByUserOrderPreferences) {
|
||||
this.loanByUserOrderPreferences = loanByUserOrderPreferences;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.views;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "paymentTracking")
|
||||
public class PaymentTrackingViewJaxb {
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer totalExpected;
|
||||
|
||||
private Integer totalNow;
|
||||
|
||||
@XmlElement(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlElement(name = "totalExpected")
|
||||
public Integer getTotalExpected() {
|
||||
if (null == totalExpected) {
|
||||
totalExpected = 0;
|
||||
}
|
||||
return totalExpected;
|
||||
}
|
||||
|
||||
public void setTotalExpected(Integer totalExpected) {
|
||||
this.totalExpected = totalExpected;
|
||||
}
|
||||
|
||||
@XmlElement(name = "totalNow")
|
||||
public Integer getTotalNow() {
|
||||
if (null == totalNow) {
|
||||
totalNow = 0;
|
||||
}
|
||||
|
||||
return totalNow;
|
||||
}
|
||||
|
||||
public void setTotalNow(Integer totalNow) {
|
||||
this.totalNow = totalNow;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.moxy.views;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
@XmlRootElement(name = "route")
|
||||
public class RouteJaxb {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
|
||||
public RouteJaxb() {
|
||||
}
|
||||
|
||||
public RouteJaxb(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlElement(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository;
|
||||
|
||||
import com.arrebol.apc.test.ArrebolTest;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ArrebolTestRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param arrebolTest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveArrebolTest(ArrebolTest arrebolTest) throws Exception {
|
||||
logger.info("saveArrebolTest");
|
||||
try {
|
||||
return save(arrebolTest);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveArrebolTest", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -6564619785642944612L;
|
||||
final Logger logger = LogManager.getLogger(ArrebolTestRepository.class);
|
||||
}
|
@ -0,0 +1,671 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public abstract class GenericRepository {
|
||||
|
||||
private Session sessionOld;
|
||||
private Transaction transactionOld;
|
||||
|
||||
/**
|
||||
* Save an APC entity.
|
||||
*
|
||||
* @param entity APC entity in DB.
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected boolean save(Object entity) throws Exception {
|
||||
logger.debug("Save");
|
||||
boolean success = false;
|
||||
|
||||
Session session = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
session.save(entity);
|
||||
|
||||
transaction.commit();
|
||||
logger.debug("Entity saved: " + entity);
|
||||
|
||||
success = true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Save Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method save() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
if (null != session) {
|
||||
session.close();
|
||||
}
|
||||
}*/
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entities
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected boolean saveMany(List entities) throws Exception {
|
||||
logger.debug("saveMany");
|
||||
boolean success = false;
|
||||
|
||||
Session session = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
for (Object entity : entities) {
|
||||
session.save(entity);
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("Entities saveMany: ");
|
||||
|
||||
success = true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("saveMany Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method saveMany() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
if (null != session) {
|
||||
session.close();
|
||||
}
|
||||
}*/
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an APC entity.
|
||||
*
|
||||
* @param entity APC entity in DB.
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected boolean update(Object entity) throws Exception {
|
||||
logger.debug("update");
|
||||
|
||||
boolean success = false;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
session.update(entity);
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("Entity updated: " + entity);
|
||||
|
||||
success = true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("update Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("update save() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected boolean updateCreateNamedQuery(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("updateCreateNamedQuery");
|
||||
boolean success = false;
|
||||
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query.executeUpdate();
|
||||
logger.debug("Query update executed");
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("Entity updateCreateNamedQuery");
|
||||
|
||||
success = true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("updateCreateNamedQuery Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updateCreateNamedQuery() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an APC entity.
|
||||
*
|
||||
* @param entity APC entity in DB.
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected boolean delete(Object entity) throws Exception {
|
||||
logger.debug("delete");
|
||||
boolean success = false;
|
||||
|
||||
Session session = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
session.delete(entity);
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("Entity deleted: " + entity);
|
||||
|
||||
success = true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("delete Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method delete() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
if (null != session) {
|
||||
session.close();
|
||||
}
|
||||
}*/
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a APC entity.
|
||||
*
|
||||
* @param clazz APC entity class name to find in DB.
|
||||
* @param id
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected Object findAPCEntity(Class clazz, String id) throws Exception {
|
||||
logger.debug("findAPCEntity");
|
||||
|
||||
Object apcEntity = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
apcEntity = session.get(clazz, id);
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("APC entity found: " + apcEntity);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("findAPCEntity Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method findAPCEntity() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return apcEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a query from XML mapping file.
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected Object createNamedQueryUniqueResult(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("createNamedQueryUniqueResult");
|
||||
|
||||
Object entity = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery, clazz);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
entity = query.uniqueResult();
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
logger.debug("APC entity from xml query: " + entity);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("createNamedQueryUniqueResult Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method createNamedQueryUniqueResult() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected List createNamedQueryResultList(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("createNamedQueryResultList");
|
||||
|
||||
List<Object> entities = new ArrayList<>();
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery, clazz);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
entities = query.getResultList();
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
logger.debug("Total of APC entities from xml query: " + entities.size());
|
||||
} catch (HibernateException e) {
|
||||
logger.error("createNamedQueryResultList Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method createNamedQueryResultList() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected List findEntityList(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findEntityList");
|
||||
|
||||
List<Object> entities = new ArrayList<>();
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
Query query = session.createNamedQuery(xmlQuery, clazz);
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
entities = query.getResultList();
|
||||
|
||||
transaction.commit();
|
||||
logger.debug("Total of APC entities from xml query: " + entities.size());
|
||||
} catch (HibernateException e) {
|
||||
logger.error("findEntityList Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method findEntityList() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param max
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected List createNamedQueryResultList(Class clazz, String xmlQuery, List<ModelParameter> parameters, int max) throws Exception {
|
||||
logger.debug("createNamedQueryResultList");
|
||||
|
||||
List<Object> entities = new ArrayList<>();
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery, clazz);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query.setMaxResults(max);
|
||||
|
||||
entities = query.getResultList();
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
logger.debug("Total of APC entities from xml query: " + entities.size());
|
||||
} catch (HibernateException e) {
|
||||
logger.error("createNamedQueryResultList Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method createNamedQueryResultList() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
protected List<Tuple> xmlQueryTuple(String xmlQuery, List<ModelParameter> parameters) {
|
||||
logger.debug("xmlQueryTuple");
|
||||
|
||||
List<Tuple> entityList = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(xmlQuery, Tuple.class);
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
entityList = query.getResultList();
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
} catch (HibernateException e) {
|
||||
logger.error("xmlQueryTuple Hibernate", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method xmlQueryTuple() ", e);
|
||||
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return entityList;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlUpdateOrDeleteQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
protected boolean xmlUpdateOrDelete(String xmlUpdateOrDeleteQuery, List<ModelParameter> parameters) {
|
||||
boolean success = false;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query updateOrDeleteQuery = session.createNamedQuery(xmlUpdateOrDeleteQuery);
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
parameters.forEach((parameter) -> {
|
||||
updateOrDeleteQuery.setParameter(parameter.getParameter(), parameter.getValue());
|
||||
});
|
||||
|
||||
int total = updateOrDeleteQuery.executeUpdate();
|
||||
|
||||
if (total > 0) {
|
||||
transaction.commit();
|
||||
success = true;
|
||||
} else {
|
||||
transaction.rollback();
|
||||
}
|
||||
} else {
|
||||
transaction.rollback();
|
||||
}
|
||||
} catch (HibernateException e) {
|
||||
logger.error("xmlUpdateOrDelete Hibernate", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method xmlUpdateOrDelete() ", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public Object genericObjectFromEntity(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("genericObjectFromEntity");
|
||||
|
||||
Object entity = null;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(xmlQuery, clazz);
|
||||
|
||||
if (null != parameters) {
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
entity = query.uniqueResult();
|
||||
transaction.commit();
|
||||
|
||||
logger.debug("APC generic entity from xml query: " + entity);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("genericObjectFromEntity Hibernate", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method genericObjectFromEntity() ", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
protected Session getSession() {
|
||||
return sessionOld;
|
||||
}
|
||||
|
||||
protected void openConnection() {
|
||||
try {
|
||||
sessionOld = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transactionOld = getSession().beginTransaction();
|
||||
} catch (Exception e) {
|
||||
logger.error("openConnection", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeConnection() {
|
||||
try {
|
||||
transactionOld.commit();
|
||||
} catch (Exception e) {
|
||||
logger.error("closeConnection", e);
|
||||
rollback();
|
||||
}
|
||||
}
|
||||
|
||||
protected void rollback() {
|
||||
if (null != transactionOld) {
|
||||
transactionOld.rollback();
|
||||
}
|
||||
}
|
||||
|
||||
protected void flushAndClear() {
|
||||
if (null != sessionOld) {
|
||||
getSession().flush();
|
||||
getSession().clear();
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(GenericRepository.class);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ClosingDayRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findIdEntity(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
for (Tuple tuple : xmlQueryTuple(xmlQuery, parameters)) {
|
||||
return tuple.get(ClosingDayCfg.FIELD_ID, String.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdEntity", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateClosingDay(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return xmlUpdateOrDelete(hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateClosingDay", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Long countIdClosingDayByEmployee(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return (Long) genericObjectFromEntity(Long.class, hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("countIdClosingDayByEmployee", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.admin.OtherExpense;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class OtherExpenseRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param otherExpense
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveOtherExpense(OtherExpense otherExpense) throws Exception {
|
||||
logger.debug("addOtherExpense");
|
||||
try {
|
||||
return save(otherExpense);
|
||||
} catch (Exception e) {
|
||||
logger.error("addOtherExpense", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -8510072805726896888L;
|
||||
final Logger logger = LogManager.getLogger(OtherExpenseRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class StableGeneralBoxRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Long countStableGeneralBoxByOfficeEqualsToCurrentDate(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return (Long) genericObjectFromEntity(Long.class, hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("countStableGeneralBoxByOfficeEqualsToCurrentDate", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.StableSmallBoxCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class StableSmallBoxRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findIdEntity(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
for (Tuple tuple : xmlQueryTuple(xmlQuery, parameters)) {
|
||||
return tuple.get(StableSmallBoxCfg.FIELD_ID, String.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdEntity", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateStableSmallBox(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return xmlUpdateOrDelete(hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateStableSmallBox", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Long countStableSmallBoxByOfficeEqualsToCurrentDate(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return (Long) genericObjectFromEntity(Long.class, hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("countStableSmallBoxByOfficeEqualsToCurrentDate", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.admin;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.Transfer;
|
||||
import com.arrebol.apc.model.ws.parsed.Exchange;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class TransferRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param transfer
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean addTransfer(Transfer transfer) throws Exception {
|
||||
logger.debug("addTransfer");
|
||||
try {
|
||||
return save(transfer);
|
||||
} catch (Exception e) {
|
||||
logger.error("addTransfer", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateTransfer(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("updateTransfer");
|
||||
try {
|
||||
return updateCreateNamedQuery(xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateTransfer", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Exchange> findAllTransferByUserIdAndCurdate(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllTransferByUserIdAndCurdate");
|
||||
List<Exchange> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(
|
||||
new Exchange(
|
||||
tuple.get("id").toString(),
|
||||
tuple.get("userTransmitter").toString().equals("SENDER"),
|
||||
(BigDecimal) tuple.get("amountToTransfer"),
|
||||
tuple.get("actionStatus").toString()
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return results;
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllTransferByUserIdAndCurdate", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1787207383193052932L;
|
||||
final Logger logger = LogManager.getLogger(TransferRepository.class);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.bitacora;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.system.logs.Bitacora;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class BitacoraRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bitacora
|
||||
* @return
|
||||
*/
|
||||
public boolean saveBitacora(Bitacora bitacora) {
|
||||
boolean success;
|
||||
try {
|
||||
success = save(bitacora);
|
||||
} catch (Exception e) {
|
||||
success = false;
|
||||
logger.error("saveBitacora", e);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.gasoline;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.gasoline.Gasoline;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class GasolineRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gasoline
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveNewGasolinePayment(Gasoline gasoline) throws Exception {
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
save(gasoline);
|
||||
|
||||
logger.info("New gasoline payment saved");
|
||||
|
||||
success = true;
|
||||
} catch (Exception e) {
|
||||
logger.error("addNewGasolineEntry", e);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5280895557294295010L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.jaas;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.MobileUserCfg;
|
||||
import com.arrebol.apc.model.core.constance.UserMobilePreferenceCfg;
|
||||
import com.arrebol.apc.model.mobile.access.MobileUser;
|
||||
import com.arrebol.apc.model.mobile.preference.UserMobilePreference;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class AuthenticationRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userName
|
||||
* @param password
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public MobileUser findUser(String userName, String password) throws Exception {
|
||||
logger.debug("findUser");
|
||||
|
||||
MobileUser mobileUser = null;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(MobileUserCfg.FIELD_USER_NAME, userName));
|
||||
parameters.add(new ModelParameter(MobileUserCfg.FIELD_PASSWORD, password));
|
||||
|
||||
mobileUser = (MobileUser) createNamedQueryUniqueResult(
|
||||
MobileUser.class,
|
||||
MobileUserCfg.QUERY_FIND_MOBILE_USER_FROM_LOGIN,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findUser", e);
|
||||
throw e;
|
||||
}
|
||||
return mobileUser;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<UserMobilePreference> findAllMobilePreferenceByUser(String userId) throws Exception {
|
||||
logger.debug("findAllMobilePreferenceByUser");
|
||||
|
||||
List<UserMobilePreference> userMobilePreferences = new ArrayList<>();
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserMobilePreferenceCfg.FIELD_USER, new User(userId)));
|
||||
|
||||
userMobilePreferences = createNamedQueryResultList(
|
||||
UserMobilePreference.class,
|
||||
UserMobilePreferenceCfg.QUERY_FIND_ALL_MOBILE_PREFERENCES_BY_USER,
|
||||
parameters
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllMobilePreferenceByUser", e);
|
||||
throw e;
|
||||
}
|
||||
return userMobilePreferences;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 4218734911509288001L;
|
||||
final Logger logger = LogManager.getLogger(AuthenticationRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.loan.LoanDetails;
|
||||
import com.arrebol.apc.model.loan.LoanFeeNotification;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class AddAmountRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param notification
|
||||
* @param loanDetails
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveNewAmount(
|
||||
LoanFeeNotification notification,
|
||||
LoanDetails loanDetails,
|
||||
String xmlQuery,
|
||||
List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("saveNewAmount");
|
||||
|
||||
boolean success = false;
|
||||
int total = 0;
|
||||
|
||||
try {
|
||||
openConnection();
|
||||
|
||||
if (null != notification) {
|
||||
getSession().save(notification);
|
||||
logger.info("Notification saved: " + notification);
|
||||
}
|
||||
|
||||
getSession().save(loanDetails);
|
||||
logger.info("Loan details saved: " + loanDetails);
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = getSession().createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
total = query.executeUpdate();
|
||||
logger.info("Query update executed");
|
||||
}
|
||||
|
||||
if (total > 0) {
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
success = true;
|
||||
|
||||
logger.info("Loan successfuly saved");
|
||||
} else {
|
||||
logger.error("Loan could not be added: " + loanDetails);
|
||||
rollback();
|
||||
}
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Save Hibernate", e);
|
||||
rollback();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method save() ", e);
|
||||
rollback();
|
||||
throw e;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 6466918195145358594L;
|
||||
final Logger logger = LogManager.getLogger(AddAmountRepository.class);
|
||||
}
|
@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.LoanByRenovationCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanCfg;
|
||||
import com.arrebol.apc.model.enums.ComissionType;
|
||||
import com.arrebol.apc.model.enums.LoanRenovationStatus;
|
||||
import com.arrebol.apc.model.enums.LoanStatus;
|
||||
import com.arrebol.apc.model.loan.Delivery;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.loan.LoanByRenovation;
|
||||
import com.arrebol.apc.model.loan.LoanDetails;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanByRenovationRepository extends GenericRepository implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1357519239619447184L;
|
||||
final Logger logger = LogManager.getLogger(LoanByRenovationRepository.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newLoanId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanByRenovation findLoanRenovationByNewLoanId(String newLoanId) throws Exception {
|
||||
logger.debug("findLoanRenovationByNewLoanId");
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_NEW, new Loan(newLoanId))
|
||||
);
|
||||
|
||||
return (LoanByRenovation) createNamedQueryUniqueResult(
|
||||
LoanByRenovation.class,
|
||||
LoanByRenovationCfg.QUERY_FIND_LOAN_RENOVATION_BY_NEW_LOAN_ID,
|
||||
parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanRenovationByNewLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanByRenovation
|
||||
* @param userId
|
||||
* @param comments
|
||||
* @param action
|
||||
* @param amount
|
||||
* @param discount
|
||||
* @param loanDetails
|
||||
* @param totalAmountPaid
|
||||
* @param newLastReferenceNumber
|
||||
* @param comission
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanRenovationFromCerfierView(
|
||||
LoanByRenovation loanByRenovation,
|
||||
String userId,
|
||||
String comments,
|
||||
boolean action,
|
||||
BigDecimal amount,
|
||||
BigDecimal discount,
|
||||
LoanDetails loanDetails,
|
||||
BigDecimal totalAmountPaid,
|
||||
Integer newLastReferenceNumber,
|
||||
ComissionType comission) throws Exception {
|
||||
logger.debug("updateLoanRenovationFromCerfierView");
|
||||
boolean success = false;
|
||||
try {
|
||||
openConnection();
|
||||
|
||||
Date lastUpdatedOn = new Date();
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
// Update loanByRenovation details in Renovation table
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LOAN_RENOVATION_STATUS, action ? LoanRenovationStatus.APPROVED : LoanRenovationStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanByRenovationCfg.FIELD_ID, loanByRenovation.getId()));
|
||||
|
||||
if (0 < executeQuery(LoanByRenovationCfg.QUERY_UPDATE_LOAN_RENOVATION, parameters)) {
|
||||
|
||||
parameters.clear();
|
||||
|
||||
// Update NEW loan details in Loan table
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, comments));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_CREATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanNew().getId()));
|
||||
|
||||
if (0 < executeQuery(LoanCfg.QUERY_UPDATE_LOAN_WITH_CREATED_ON_BY_ID_FROM_CERTIFIER_VIEW, parameters)) {
|
||||
parameters.clear();
|
||||
|
||||
// Update OLD loan details in Loan table
|
||||
String commentsOldLoan = action ? "Crédito renovado" : "El certificador rechazo la renovación de este crédito";
|
||||
String strQuery = LoanCfg.QUERY_UPDATE_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
|
||||
if (action && null != loanDetails && null != totalAmountPaid && null != newLastReferenceNumber) {
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_AMOUNT_PAID, totalAmountPaid));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_REFERENCE_NUMBER, newLastReferenceNumber));
|
||||
|
||||
strQuery = LoanCfg.QUERY_UPDATE_DISCOUNT_AND_LOAN_BY_ID_FROM_CERTIFIER_VIEW;
|
||||
}
|
||||
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, commentsOldLoan));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, userId));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, lastUpdatedOn));
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ID, loanByRenovation.getLoanOld().getId()));
|
||||
|
||||
if (0 < executeQuery(strQuery, parameters)) {
|
||||
|
||||
// Update OLD loanByUser details in Loan By User Table
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanOld().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.FINISH : LoanStatus.APPROVED));
|
||||
|
||||
Query query1 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query1.executeUpdate();
|
||||
|
||||
// Update NEW loanByUser details in Loan By User Table
|
||||
params.clear();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanByRenovation.getLoanNew().getId())));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, action ? LoanStatus.APPROVED : LoanStatus.REJECTED));
|
||||
|
||||
Query query2 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query2.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query2.executeUpdate();
|
||||
|
||||
if (action) {
|
||||
// Insert new loanDetails (discount) in Loan Details table
|
||||
if (null != loanDetails) {
|
||||
getSession().save(loanDetails);
|
||||
}
|
||||
|
||||
// Insert delivery details (To know cash that certifier deliveried) in Delivery Table
|
||||
Delivery delivery = new Delivery(
|
||||
new User(userId),
|
||||
new Loan(loanByRenovation.getLoanNew().getId()),
|
||||
amount,
|
||||
userId,
|
||||
new Date(),
|
||||
comission
|
||||
);
|
||||
|
||||
getSession().save(delivery);
|
||||
}
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
logger.info("Certifier delivery the loan details: " + loanByRenovation);
|
||||
success = true;
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
} else {
|
||||
rollback();
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
rollback();
|
||||
logger.error("updateLoanRenovationFromCerfierView", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private int executeQuery(String xmlQuery, List<ModelParameter> parameters) {
|
||||
Query query = getSession().createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
return query.executeUpdate();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.loan.LoanByUser;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanByUserRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanByUser
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveLoanByUser(LoanByUser loanByUser) throws Exception {
|
||||
logger.debug("saveLoanByUser");
|
||||
try {
|
||||
return save(loanByUser);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoanByUser", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 7523456759588286540L;
|
||||
final Logger logger = LogManager.getLogger(LoanByUserRepository.class);
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.controller.mobile.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.enums.FeeStatus;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.loan.LoanDetails;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanDetailsRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param details
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveLoanDetails(LoanDetails details) throws Exception {
|
||||
logger.debug("saveLoanDetails");
|
||||
try {
|
||||
return save(details);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public List<LoanDetails> findFeesToPayByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findFeesToPayByLoanId");
|
||||
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(new LoanDetails(tuple.get("id", String.class), tuple.get("createdOn", Date.class), tuple.get("feeStatus", FeeStatus.class)));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("findFeesToPayByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanDetails> findLoanDetailsByLoanId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoanDetailsByLoanId");
|
||||
|
||||
List<LoanDetails> results = new ArrayList<>();
|
||||
try {
|
||||
results = createNamedQueryResultList(LoanDetails.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanDetailsByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param loanDetails
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updatePaidFeesStatusInLoanDetailIds(String xmlQuery, List<ModelParameter> parameters, LoanDetails loanDetails) throws Exception {
|
||||
boolean success = false;
|
||||
|
||||
Session sssn = null;
|
||||
Transaction trnsctn = null;
|
||||
try {
|
||||
sssn = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
trnsctn = sssn.beginTransaction();
|
||||
|
||||
Loan loan = sssn.get(Loan.class, loanDetails.getLoan().getId());
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = sssn.createNamedQuery(xmlQuery);
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
query.executeUpdate();
|
||||
logger.debug("Query update executed");
|
||||
}
|
||||
BigDecimal totalFees = loan.getAmountPaid().add(loanDetails.getPaymentAmount());
|
||||
|
||||
loanDetails.setReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
|
||||
sssn.save(loanDetails);
|
||||
|
||||
loan.setAmountPaid(totalFees);
|
||||
loan.setLastReferenceNumber(loan.getLastReferenceNumber() + 1);
|
||||
loan.setLastUpdatedBy(loanDetails.getCreatedBy());
|
||||
loan.setLastUpdatedOn(new Date());
|
||||
|
||||
sssn.update(loan);
|
||||
|
||||
trnsctn.commit();
|
||||
|
||||
logger.info("Entity updated");
|
||||
success = true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updatePaidFeesStatusInLoanDetailIds() ", e);
|
||||
if (null != trnsctn) {
|
||||
trnsctn.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
/* finally {
|
||||
if (null != sssn) {
|
||||
sssn.close();
|
||||
}
|
||||
}*/
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Long countLoandDetails(String hbmQuery, List<ModelParameter> params) {
|
||||
Long count;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
count = (Long) query.getSingleResult();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
logger.error("countLoandDetails", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoanDetails(String hbmQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return updateCreateNamedQuery(hbmQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method updateLoanDetails", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -6088464996350747643L;
|
||||
final Logger logger = LogManager.getLogger(LoanDetailsRepository.class);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.loan.LoanFeeNotification;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanFeeNotificationRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param notification
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean saveLoanFeeNotification(LoanFeeNotification notification) throws Exception {
|
||||
logger.debug("saveLoanFeeNotification");
|
||||
|
||||
try {
|
||||
return save(notification);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoanFeeNotification", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Long countNotificationByLoanId(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("countNotificationByLoanId");
|
||||
|
||||
try {
|
||||
return (Long) createNamedQueryUniqueResult(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("countNotificationByLoanId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7172367255017070335L;
|
||||
final Logger logger = LogManager.getLogger(LoanFeeNotificationRepository.class);
|
||||
}
|
@ -0,0 +1,630 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.controller.mobile.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanCfg;
|
||||
import com.arrebol.apc.model.enums.LoanRenovationStatus;
|
||||
import com.arrebol.apc.model.enums.LoanStatus;
|
||||
import com.arrebol.apc.model.loan.Delivery;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.loan.LoanByRenovation;
|
||||
import com.arrebol.apc.model.loan.LoanByRenovationId;
|
||||
import com.arrebol.apc.model.loan.LoanByUser;
|
||||
import com.arrebol.apc.model.loan.LoanDetails;
|
||||
import com.arrebol.apc.model.ws.parsed.LoanRequestedJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loan
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String saveLoan(Loan loan) throws Exception {
|
||||
logger.debug("saveLoan");
|
||||
try {
|
||||
if (save(loan)) {
|
||||
return loan.getId();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoan", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateLoan(Loan loan) throws Exception {
|
||||
logger.debug("saveLoan");
|
||||
try {
|
||||
return update(loan);
|
||||
} catch (Exception e) {
|
||||
logger.error("saveLoan", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Loan findLoanById(String loanId) throws Exception {
|
||||
logger.debug("findLoanById");
|
||||
try {
|
||||
return (Loan) findAPCEntity(Loan.class, loanId);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanId
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param status
|
||||
* @param delivery
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateLoan(String loanId, String xmlQuery, List<ModelParameter> parameters, LoanStatus status, Delivery delivery) throws Exception {
|
||||
logger.debug("updateLoan");
|
||||
boolean success = false;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanId)));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, status));
|
||||
|
||||
Query query1 = session.createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query1.executeUpdate();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
if (0 < query.executeUpdate()) {
|
||||
|
||||
if (null != delivery) {
|
||||
session.save(delivery);
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
success = true;
|
||||
logger.info("updateLoan suucess");
|
||||
} else {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
logger.error("updateLoan", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateLoanWithComission(String loanId, String xmlQuery, List<ModelParameter> parameters, LoanStatus status, Delivery delivery) throws Exception {
|
||||
logger.debug("updateLoan");
|
||||
boolean success = false;
|
||||
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(loanId)));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, status));
|
||||
|
||||
Query query1 = session.createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query1.executeUpdate();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = session.createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
if (0 < query.executeUpdate()) {
|
||||
|
||||
if (null != delivery) {
|
||||
session.save(delivery);
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
success = true;
|
||||
logger.info("updateLoan suucess");
|
||||
} else {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
logger.error("updateLoan", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loan
|
||||
* @param loanByUser
|
||||
* @param jaxb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean createLoan(Loan loan, LoanByUser loanByUser, LoanRequestedJaxb jaxb) throws Exception {
|
||||
logger.debug("createLoan");
|
||||
try {
|
||||
People customer = jaxb.getCustomer().isCreatePerson()
|
||||
? null
|
||||
: new People(jaxb.getCustomer().getId());
|
||||
|
||||
People endorsement = jaxb.getEndorsement().isCreatePerson()
|
||||
? null
|
||||
: new People(jaxb.getEndorsement().getId());
|
||||
|
||||
openConnection();
|
||||
|
||||
if (null == customer) {
|
||||
customer = new People(
|
||||
jaxb.getCustomer(),
|
||||
true,
|
||||
jaxb.getOfficeId(),
|
||||
jaxb.getUserId(),
|
||||
//jaxb.getRouteId()
|
||||
jaxb.chooseRouteId()
|
||||
);
|
||||
|
||||
getSession().save(customer);
|
||||
}
|
||||
|
||||
if (null == endorsement) {
|
||||
endorsement = new People(
|
||||
jaxb.getEndorsement(),
|
||||
false,
|
||||
jaxb.getOfficeId(),
|
||||
jaxb.getUserId(),
|
||||
jaxb.getRouteId()
|
||||
);
|
||||
|
||||
getSession().save(endorsement);
|
||||
}
|
||||
|
||||
loan.setCustomer(customer);
|
||||
loan.setEndorsement(endorsement);
|
||||
|
||||
getSession().save(loan);
|
||||
|
||||
loanByUser.getId().setIdLoan(loan.getId());
|
||||
|
||||
getSession().save(loanByUser);
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
return true;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("createLoan", e);
|
||||
rollback();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method createLoan() ", e);
|
||||
rollback();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oldLoanId
|
||||
* @param loan
|
||||
* @param loanByUser
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @param loanDetails
|
||||
* @param endorsement
|
||||
* @param isNewEndorsement
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean renovationLoan(String oldLoanId,
|
||||
Loan loan,
|
||||
LoanByUser loanByUser,
|
||||
String xmlQuery,
|
||||
List<ModelParameter> parameters,
|
||||
LoanDetails loanDetails,
|
||||
People endorsement,
|
||||
boolean isNewEndorsement) throws Exception {
|
||||
logger.debug("renovationLoan");
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
openConnection();
|
||||
int total = 0;
|
||||
|
||||
// Crea Aval y lo asigna al nuevo prestamo
|
||||
if (isNewEndorsement) {
|
||||
getSession().save(endorsement);
|
||||
loan.setEndorsement(endorsement);
|
||||
}
|
||||
|
||||
// falta actualizar el status de la tabla APC_LOAN_BY_USER
|
||||
// del loan (oldLoanId) a PENDING_RENOVATION
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(oldLoanId)));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, LoanStatus.PENDING_RENOVATION));
|
||||
|
||||
Query query1 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query1.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
query1.executeUpdate();
|
||||
|
||||
if (null != parameters && !parameters.isEmpty()) {
|
||||
Query query = getSession().createNamedQuery(xmlQuery);
|
||||
|
||||
parameters.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
total = query.executeUpdate();
|
||||
logger.info("Query update executed");
|
||||
}
|
||||
if (total > 0) {
|
||||
getSession().save(loan);
|
||||
|
||||
loanByUser.getId().setIdLoan(loan.getId());
|
||||
|
||||
getSession().save(loanByUser);
|
||||
|
||||
LoanByRenovation renovation = new LoanByRenovation(
|
||||
new LoanByRenovationId(
|
||||
oldLoanId,
|
||||
loan.getId()
|
||||
)
|
||||
);
|
||||
|
||||
renovation.setLoanRenovationStatus(LoanRenovationStatus.PENDING);
|
||||
renovation.setCreatedBy(loan.getCreatedBy());
|
||||
renovation.setCreatedOn(loan.getCreatedOn());
|
||||
|
||||
getSession().save(renovation);
|
||||
|
||||
getSession().save(loanDetails);
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
logger.info("Renovation was created");
|
||||
success = true;
|
||||
} else {
|
||||
logger.error("Renovation was not updated");
|
||||
rollback();
|
||||
}
|
||||
|
||||
return success;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("renovationLoan", e);
|
||||
rollback();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method renovationLoan() ", e);
|
||||
rollback();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oldLoanId
|
||||
* @param loan
|
||||
* @param loanByUser
|
||||
* @param endorsement
|
||||
* @param isNewEndorsement
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean renovationHasPaymentToday(String oldLoanId,
|
||||
Loan loan,
|
||||
LoanByUser loanByUser,
|
||||
People endorsement,
|
||||
boolean isNewEndorsement) throws Exception {
|
||||
logger.debug("renovationHasPaymentToday");
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
openConnection();
|
||||
int total;
|
||||
|
||||
// Crea Aval y lo asigna al nuevo prestamo
|
||||
if (isNewEndorsement) {
|
||||
getSession().save(endorsement);
|
||||
loan.setEndorsement(endorsement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actualiza el loan original a PENDING RENOVATION
|
||||
*/
|
||||
List<ModelParameter> params = new ArrayList<>();
|
||||
|
||||
params.add(new ModelParameter(LoanCfg.FIELD_LOAN_STATUS, LoanStatus.PENDING_RENOVATION));
|
||||
params.add(new ModelParameter(LoanCfg.FIELD_COMMENTS, "El cliente previamente abono su pago diario, solo me contactode nuevo para renovar su crédito"));
|
||||
params.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_BY, loanByUser.getCreatedBy()));
|
||||
params.add(new ModelParameter(LoanCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
params.add(new ModelParameter(LoanCfg.FIELD_ID, oldLoanId));
|
||||
|
||||
Query query = getSession().createNamedQuery(LoanCfg.QUERY_UPDATE_LOAN_BY_ID_FROM_CERTIFIER_VIEW);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
total = query.executeUpdate();
|
||||
|
||||
if (total > 0) {
|
||||
/**
|
||||
* Actualiza el loan by user a PENDING RENOVATION
|
||||
*/
|
||||
params.clear();
|
||||
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN, new Loan(oldLoanId)));
|
||||
params.add(new ModelParameter(LoanByUserCfg.FIELD_LOAN_BY_USER_STATUS, LoanStatus.PENDING_RENOVATION));
|
||||
|
||||
Query query2 = getSession().createNamedQuery(LoanByUserCfg.QUERY_UPDATE_LOAN_BY_USER_BY_LOAND_ID);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query2.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
total = query.executeUpdate();
|
||||
|
||||
if (total > 0) {
|
||||
// Crea el nuevo prestamo
|
||||
getSession().save(loan);
|
||||
|
||||
loanByUser.getId().setIdLoan(loan.getId());
|
||||
|
||||
// guarda elprestamo por usuario
|
||||
getSession().save(loanByUser);
|
||||
|
||||
// crea historico para saber de donde proviene en nuevo prestamo
|
||||
LoanByRenovation renovation = new LoanByRenovation(
|
||||
new LoanByRenovationId(
|
||||
oldLoanId,
|
||||
loan.getId()
|
||||
)
|
||||
);
|
||||
|
||||
renovation.setLoanRenovationStatus(LoanRenovationStatus.PENDING);
|
||||
renovation.setCreatedBy(loan.getCreatedBy());
|
||||
renovation.setCreatedOn(loan.getCreatedOn());
|
||||
|
||||
getSession().save(renovation);
|
||||
|
||||
flushAndClear();
|
||||
closeConnection();
|
||||
|
||||
logger.info("renovationHasPaymentToday was created");
|
||||
success = true;
|
||||
} else {
|
||||
logger.error("renovationHasPaymentToday was not updated");
|
||||
rollback();
|
||||
}
|
||||
} else {
|
||||
logger.error("renovationHasPaymentToday was not updated");
|
||||
rollback();
|
||||
}
|
||||
return success;
|
||||
} catch (HibernateException e) {
|
||||
logger.error("renovationHasPaymentToday", e);
|
||||
rollback();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Method renovationHasPaymentToday() ", e);
|
||||
rollback();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Long countLoan(String hbmQuery, List<ModelParameter> params) {
|
||||
Long count;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
count = (Long) query.getSingleResult();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
logger.error("countLoan", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public String findLoanId(String hbmQuery, List<ModelParameter> params) {
|
||||
String loanId;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
loanId = (String) query.getSingleResult();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
return loanId;
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanId", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlUpdateOrDeleteQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteLoanDetailsByLoanCurdate(String xmlUpdateOrDeleteQuery, List<ModelParameter> parameters) {
|
||||
logger.debug("updateLoandByUserByUserId");
|
||||
|
||||
return xmlUpdateOrDelete(xmlUpdateOrDeleteQuery, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param updateLoanStatusQuery
|
||||
* @param updateLoanByUserStatusQuery
|
||||
* @param loanParams
|
||||
* @param loanByUserParams
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean loanPendingStatusToDelivery(String updateLoanStatusQuery, String updateLoanByUserStatusQuery, List<ModelParameter> loanParams, List<ModelParameter> loanByUserParams) throws Exception {
|
||||
boolean success = false;
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
// Update loan status WHERE id IN
|
||||
Query query = session.createNamedQuery(updateLoanStatusQuery);
|
||||
|
||||
for (ModelParameter parameters : loanParams) {
|
||||
query.setParameter(parameters.getParameter(), parameters.getValue());
|
||||
}
|
||||
|
||||
query.executeUpdate();
|
||||
query.getParameters().clear();
|
||||
|
||||
// Update loan by user status WHERE loan IN
|
||||
query = session.createNamedQuery(updateLoanByUserStatusQuery);
|
||||
|
||||
for (ModelParameter parameters : loanByUserParams) {
|
||||
query.setParameter(parameters.getParameter(), parameters.getValue());
|
||||
}
|
||||
|
||||
query.executeUpdate();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
success = true;
|
||||
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
logger.error("loanPendingStatusToDelivery", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -9216757241090613435L;
|
||||
final Logger logger = LogManager.getLogger(LoanRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.LoanToDeliveryByCertifierView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanToDeliveryByCertifierRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanToDeliveryByCertifierView> findLoansByCertifier(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoansByCertifier");
|
||||
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoansByCertifier", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1692607159278862158L;
|
||||
final Logger logger = LogManager.getLogger(LoanToDeliveryByCertifierRepository.class);
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.loan.LoanType;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanTypeRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanType> findAllLoanTypeByOffice(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllLoanTypeByOffice");
|
||||
|
||||
List<LoanType> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(new LoanType((String) tuple.get("id"), (BigDecimal) tuple.get("payment"), (String) tuple.get("loanTypeName")));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoanTypeByOffice", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find loan type by id.
|
||||
*
|
||||
* @param id Identifycation number
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanType findLoanType(String id) throws Exception {
|
||||
logger.debug("findLoanType");
|
||||
try {
|
||||
return (LoanType) findAPCEntity(LoanType.class, id);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanType", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanType> findLoanTypes(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoanTypes");
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanTypes", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanType> findIdAndPaymentLoans(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findIdAndPaymentLoans");
|
||||
|
||||
List<LoanType> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(new LoanType((String) tuple.get("id"), (BigDecimal) tuple.get("payment"), (String) tuple.get("loanTypeName")));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("findIdAndPaymentLoans", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5815645336646530766L;
|
||||
final Logger logger = LogManager.getLogger(LoanTypeRepository.class);
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.people;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PeopleRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param people
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String createPeople(People people) throws Exception {
|
||||
logger.debug("createPeople");
|
||||
try {
|
||||
save(people);
|
||||
|
||||
return people.getId();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("createPeople", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param people
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean removePeople(People people) throws Exception {
|
||||
logger.debug("removePeople");
|
||||
try {
|
||||
people = (People) findAPCEntity(People.class, people.getId());
|
||||
|
||||
return delete(people);
|
||||
} catch (Exception e) {
|
||||
logger.error("removePeople", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loanId
|
||||
* @param isCustomer
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findPeopleIdByIdLoad(String loanId, boolean isCustomer) throws Exception {
|
||||
try {
|
||||
Loan loan = (Loan) findAPCEntity(Loan.class, loanId);
|
||||
|
||||
return isCustomer ? loan.getCustomer().getId() : loan.getEndorsement().getId();
|
||||
} catch (Exception e) {
|
||||
logger.error("findPeopleByIdLoad", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean changeContactNumber(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("changeContactNumber");
|
||||
try {
|
||||
return updateCreateNamedQuery(xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("changeContactNumber", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 6168828614367099322L;
|
||||
final Logger logger = LogManager.getLogger(PeopleRepository.class);
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.preference;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.mobile.preference.UserMobilePreference;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserMobilePreferenceRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public UserMobilePreference findUserMobilePreference(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findUserMobilePreference");
|
||||
|
||||
try {
|
||||
return (UserMobilePreference) createNamedQueryUniqueResult(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findUserMobilePreference", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean updateQueryUserMobilePreference(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("updateQueryUserMobilePreference");
|
||||
|
||||
try {
|
||||
return updateCreateNamedQuery(xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateQueryUserMobilePreference", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userMobilePreference
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean insertUserMobilePreference(UserMobilePreference userMobilePreference) throws Exception {
|
||||
logger.debug("insertUserMobilePreference");
|
||||
|
||||
try {
|
||||
return save(userMobilePreference);
|
||||
} catch (Exception e) {
|
||||
logger.error("insertUserMobilePreference", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Long count(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("count");
|
||||
try {
|
||||
return (Long) createNamedQueryUniqueResult(Long.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("count", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 4667354927801455153L;
|
||||
final Logger logger = LogManager.getLogger(UserMobilePreferenceRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.reports;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.reports.UserWeekReport;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ReportsRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public UserWeekReport findUserWeekReportDetailsByUser(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return (UserWeekReport) createNamedQueryUniqueResult(
|
||||
clazz,
|
||||
xmlQuery,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findUserWeekReportDetailsByUser", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 5669198954766725576L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.route;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.ContainerRoutes;
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.RouteJaxb;
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.controller.mobile.repository.people.PeopleRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.constance.RouteCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class RouteRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public ContainerRoutes findAllRoutesAvailables(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
if (!tuples.isEmpty()) {
|
||||
List<RouteJaxb> results = new ArrayList<>();
|
||||
tuples.forEach(tuple -> {
|
||||
results.add(new RouteJaxb(tuple.get(RouteCfg.FIELD_ID, String.class), tuple.get(RouteCfg.FIELD_NAME, String.class)));
|
||||
});
|
||||
return new ContainerRoutes(results);
|
||||
} else {
|
||||
throw new Exception("Error loading route, size equals to ZERO");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllRoutesAvailables", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(PeopleRepository.class);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.tracking;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.views.PaymentTrackingViewJaxb;
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.reports.UserWeekReport;
|
||||
import com.arrebol.apc.model.views.AdvanceUserDailyView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PaymentTrackingRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public AdvanceUserDailyView paymentTrakingByUserDetails(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return (AdvanceUserDailyView) createNamedQueryUniqueResult(
|
||||
clazz,
|
||||
xmlQuery,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("PaymentTrackingViewJaxb", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 5669198954766725577L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.user;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.controller.mobile.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.UserCfg;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findUserStatusById(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
for (Tuple tuple : xmlQueryTuple(xmlQuery, parameters)) {
|
||||
return tuple.get(UserCfg.FIELD_ID, String.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.error("findUserStatusById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param hbmQuery
|
||||
* @param params
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean containtsUserManagementProperty(String hbmQuery, List<ModelParameter> params) throws Exception {
|
||||
Transaction transaction = null;
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createNamedQuery(hbmQuery);
|
||||
|
||||
params.forEach((param) -> {
|
||||
query.setParameter(param.getParameter(), param.getValue());
|
||||
});
|
||||
|
||||
Long total = (Long) query.getSingleResult();
|
||||
Long one = 1l;
|
||||
transaction.commit();
|
||||
|
||||
return one.equals(total);
|
||||
} catch (Exception e) {
|
||||
logger.error("containtsUserManagementProperty", e);
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<User> listOfUsersByOffice(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
List<User> users = new ArrayList<>();
|
||||
|
||||
xmlQueryTuple(xmlQuery, parameters).forEach(_item -> {
|
||||
users.add(
|
||||
new User(
|
||||
_item.get(UserCfg.FIELD_ID, String.class),
|
||||
_item.get(UserCfg.FIELD_USER_NAME, String.class)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return users;
|
||||
} catch (Exception e) {
|
||||
logger.error("listOfUsersByOffice", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7339139534291674077L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.CashRegisterCurdateByUserView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class CashRegisterCurdateByUserViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CashRegisterCurdateByUserView> findAllCashRegisterCurdateByUserId(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllCashRegisterCurdateByUserId");
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllCashRegisterCurdateByUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -9108098827445980249L;
|
||||
final Logger logger = LogManager.getLogger(CashRegisterCurdateByUserViewRepository.class);
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.ExchangeEnebledUsersView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ExchangeEnebledUsersViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<ExchangeEnebledUsersView> findEnebledUsersToUserId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("exchangeEnebledUsersViewRepository");
|
||||
try {
|
||||
return createNamedQueryResultList(ExchangeEnebledUsersView.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findEnebledUsersToUserId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 3811795552537797634L;
|
||||
final Logger logger = LogManager.getLogger(ExchangeEnebledUsersViewRepository.class);
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.enums.LoanDetailsType;
|
||||
import com.arrebol.apc.model.views.LoanApprovedDetailView;
|
||||
import com.arrebol.apc.model.ws.parsed.LoanDetailJaxb;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanApprovedDetailViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/*
|
||||
public List<Exchange> findAllTransferByUserIdAndCurdate(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllTransferByUserIdAndCurdate");
|
||||
List<Exchange> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
tuples.forEach((tuple) -> {
|
||||
results.add(
|
||||
new Exchange(
|
||||
tuple.get("id").toString(),
|
||||
tuple.get("userTransmitter").toString().equals("SENDER"),
|
||||
(BigDecimal) tuple.get("amountToTransfer"),
|
||||
tuple.get("actionStatus").toString()
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return results;
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllTransferByUserIdAndCurdate", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanDetailJaxb> findLoanDetailsByLoan(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findLoanDetailsByLoan");
|
||||
List<LoanDetailJaxb> results = new ArrayList<>();
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
double total = 0d;
|
||||
|
||||
for (Tuple tuple : tuples) {
|
||||
if (results.isEmpty()) {
|
||||
total = ((BigDecimal) tuple.get("amountToPay")).doubleValue();
|
||||
}
|
||||
LoanDetailsType type = tuple.get("loanDetailsType", LoanDetailsType.class);
|
||||
|
||||
switch (type) {
|
||||
case PAYMENT:
|
||||
total = total - ((BigDecimal) tuple.get("paymentAmount")).doubleValue();
|
||||
break;
|
||||
case FEE:
|
||||
total = total + ((BigDecimal) tuple.get("paymentAmount")).doubleValue();
|
||||
break;
|
||||
case TRANSFER:
|
||||
total = total - (tuple.get("paymentAmount", BigDecimal.class)).doubleValue();
|
||||
break;
|
||||
}
|
||||
|
||||
LoanDetailJaxb detail = new LoanDetailJaxb(
|
||||
tuple.get("createdOn", String.class),
|
||||
((BigDecimal) tuple.get("paymentAmount")).doubleValue(),
|
||||
total,
|
||||
tuple.get("comments", String.class),
|
||||
type.toString()
|
||||
);
|
||||
|
||||
results.add(detail);
|
||||
}
|
||||
|
||||
return results;
|
||||
} catch (Exception e) {
|
||||
logger.error("findLoanDetailsByLoan", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idLoan
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public LoanApprovedDetailView approvedDetailsByIdLoan(String idLoan) throws Exception {
|
||||
logger.debug("approvedDetailsByIdLoan");
|
||||
try {
|
||||
return (LoanApprovedDetailView) findAPCEntity(LoanApprovedDetailView.class, idLoan);
|
||||
} catch (Exception e) {
|
||||
logger.error("approvedDetailsByIdLoan", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7364653160752676339L;
|
||||
final Logger logger = LogManager.getLogger(LoanApprovedDetailViewRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.LoanByUserOrderPreferenceView;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanByUserOrderPreferenceViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanByUserOrderPreferenceView> findAllLoanByUserOrderPreference(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllLoanByUserOrderPreference");
|
||||
List<LoanByUserOrderPreferenceView> results = new ArrayList<>();
|
||||
|
||||
try {
|
||||
results = createNamedQueryResultList(
|
||||
LoanByUserOrderPreferenceView.class,
|
||||
xmlQuery,
|
||||
parameters
|
||||
);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoanByUserOrderPreference", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public boolean updateQuery(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("updateQuery");
|
||||
try {
|
||||
return updateCreateNamedQuery(xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("updateQuery", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5747654537116880219L;
|
||||
final Logger logger = LogManager.getLogger(LoanByUserOrderPreferenceViewRepository.class);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanByUserViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanByUserView> findAllLoansByUserId(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllLoansByUserId");
|
||||
List<LoanByUserView> results = new ArrayList<>();
|
||||
|
||||
try {
|
||||
results = createNamedQueryResultList(
|
||||
LoanByUserView.class,
|
||||
xmlQuery,
|
||||
parameters
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoansByUserId", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 5669198954766725476L;
|
||||
final Logger logger = LogManager.getLogger(LoanByUserViewRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.LoanInPendingStatusToDeliveryView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanInPendingStatusToDeliveryViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<LoanInPendingStatusToDeliveryView> findAllLoanInPendingStatusToDeliveryViewFromHQL(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return findEntityList(LoanInPendingStatusToDeliveryView.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoanInPendingStatusToDeliveryViewFromHQL", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 6824052895894178526L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.PersonSearchHistoricalDetailsView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PersonSearchHistoricalDetailsViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PersonSearchHistoricalDetailsView> findAllByPersonId(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAllByPersonId");
|
||||
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllByPersonId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 3507366187310617715L;
|
||||
final Logger logger = LogManager.getLogger(PersonSearchHistoricalDetailsViewRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import com.arrebol.apc.model.views.PersonSearchDetailView;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import javax.persistence.Tuple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PersonSearchViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List findResultList(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("likePersonSearchViewByPersonSearch");
|
||||
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters, 10);
|
||||
} catch (Exception e) {
|
||||
logger.error("likePersonSearchViewByPersonSearch", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Object findResultXML(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findResultXML");
|
||||
try {
|
||||
return createNamedQueryUniqueResult(clazz, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findResultXML", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public Object findResultTupleXML(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findResultXML");
|
||||
try {
|
||||
List<Tuple> tuples = xmlQueryTuple(xmlQuery, parameters);
|
||||
|
||||
LoanByUserView result = new LoanByUserView();
|
||||
|
||||
for (Tuple tuple : tuples) {
|
||||
|
||||
result = new LoanByUserView(
|
||||
tuple.get("customerName", String.class),
|
||||
tuple.get("customerAddressHome", String.class),
|
||||
tuple.get("customerAddressBusiness", String.class),
|
||||
tuple.get("companyName", String.class),
|
||||
tuple.get("customerThumbnail", String.class),
|
||||
tuple.get("endorsementName", String.class),
|
||||
tuple.get("endorsementAddressHome", String.class),
|
||||
tuple.get("endorsementThumbnail", String.class),
|
||||
tuple.get("endorsementPhoneHome", String.class),
|
||||
tuple.get("paymentDaily", BigDecimal.class),
|
||||
tuple.get("fee", BigDecimal.class),
|
||||
tuple.get("notificationNumber", Long.class).intValue(),
|
||||
tuple.get("renovation", String.class),
|
||||
tuple.get("maxAmountToPay", BigDecimal.class),
|
||||
1 == tuple.get("hasPaymentToday", Integer.class),
|
||||
tuple.get("loanId", String.class),
|
||||
tuple.get("currentOwner", String.class)
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
logger.error("findResultXML", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PersonSearchDetailView findResult(Class clazz, String id) throws Exception {
|
||||
logger.debug("findResult");
|
||||
try {
|
||||
return (PersonSearchDetailView) findAPCEntity(clazz, id);
|
||||
} catch (Exception e) {
|
||||
logger.error("findResult", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5127034542019248849L;
|
||||
final Logger logger = LogManager.getLogger(PersonSearchViewRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Views: AvailableCustomersView or AvailableEndorsementsView
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class SearchPersonAvailableRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Object findAvailablePersonByPersonId(Class clazz, String id) throws Exception {
|
||||
logger.debug("findAvailablePersonByPersonId");
|
||||
try {
|
||||
return findAPCEntity(clazz, id);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAvailablePersonByPersonId", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find customers or endorsemenent using hibernate like clause.
|
||||
*
|
||||
* @param clazz AvailableCustomersView and AvailableEndorsementsView
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List findAvailablePersonLike(Class clazz, String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
logger.debug("findAvailablePersonLike");
|
||||
try {
|
||||
return createNamedQueryResultList(clazz, xmlQuery, parameters,10);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAvailablePersonLike", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1734430028791204289L;
|
||||
final Logger logger = LogManager.getLogger(SearchPersonAvailableRepository.class);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.views.TotalCashByCurdateView;
|
||||
import java.io.Serializable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class TotalCashByCurdateViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public TotalCashByCurdateView findById(String id) throws Exception {
|
||||
logger.debug("findById");
|
||||
try {
|
||||
return (TotalCashByCurdateView) findAPCEntity(TotalCashByCurdateView.class, id);
|
||||
} catch (Exception e) {
|
||||
logger.error("findById", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 7691052895894112231L;
|
||||
final Logger logger = LogManager.getLogger(TotalCashByCurdateViewRepository.class);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.views;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.GenericRepository;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.views.TransferInPendingStatusView;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class TransferInPendingStatusViewRepository extends GenericRepository implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xmlQuery
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<TransferInPendingStatusView> findAllTransferFromHQL(String xmlQuery, List<ModelParameter> parameters) throws Exception {
|
||||
try {
|
||||
return findEntityList(TransferInPendingStatusView.class, xmlQuery, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllTransferFromHQL", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 5391052895894173231L;
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.util;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class HibernateUtil {
|
||||
|
||||
private static final String HIBERNATE_CFG_XML = "apc.cfg.xml";
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
private HibernateUtil() {
|
||||
}
|
||||
|
||||
// Hibernate 5:
|
||||
private static SessionFactory buildSessionFactory() {
|
||||
try {
|
||||
// Create the ServiceRegistry from hibernate.cfg.xml
|
||||
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure(HIBERNATE_CFG_XML).build();
|
||||
|
||||
// Create a metadata sources using the specified service registry.
|
||||
Metadata metadata = new MetadataSources(serviceRegistry).getMetadataBuilder().build();
|
||||
|
||||
return metadata.getSessionFactoryBuilder().build();
|
||||
} catch (Throwable ex) {
|
||||
System.err.println("Initial SessionFactory creation failed." + ex);
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration object is used to create a SessionFactory object which in
|
||||
* turn configures Hibernate for the application using the supplied
|
||||
* configuration file and allows for a Session object to be instantiated.
|
||||
*
|
||||
* The SessionFactory is a thread safe object and used by all the threads of
|
||||
* an application.
|
||||
*
|
||||
* The SessionFactory is a heavyweight object; it is usually created during
|
||||
* application start up and kept for later use.
|
||||
*
|
||||
* You would need one SessionFactory object per database using a separate
|
||||
* configuration file.
|
||||
*
|
||||
* So, if you are using multiple databases, then you would have to create
|
||||
* multiple SessionFactory objects.
|
||||
*
|
||||
* @return SessionFactory.
|
||||
*/
|
||||
public final static SessionFactory getSessionFactory() {
|
||||
if (null == sessionFactory) {
|
||||
sessionFactory = buildSessionFactory();
|
||||
}
|
||||
return sessionFactory;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.cash;
|
||||
|
||||
import com.arrebol.apc.model.views.TotalCashByCurdateView;
|
||||
import org.junit.Assert;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class CashRegisterCurdateByUserControllerTest {
|
||||
|
||||
public CashRegisterCurdateByUserController controller;
|
||||
public static final String USER_ID = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
|
||||
public CashRegisterCurdateByUserControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new CashRegisterCurdateByUserController();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllLoansByUserId() {
|
||||
try {
|
||||
TotalCashByCurdateView result = controller.findDailyTotalsByUserId(USER_ID);
|
||||
|
||||
System.out.println("Total: " + result.getTotal());
|
||||
|
||||
Assert.assertNotNull(result);
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.arrebol.apc.controller.mobile.controller.customer;
|
||||
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
|
||||
|
||||
import com.arrebol.apc.model.enums.PreferenceValue;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class CustomerControllerTest {
|
||||
|
||||
public CustomerController controller;
|
||||
public static final String USER_ID = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
|
||||
public CustomerControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new CustomerController();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllLoansByUserId() {
|
||||
try {
|
||||
List<LoanByUserView> results = controller.findAllLoansByUserId(PreferenceValue.ORDER_IN_LIST.toString(),USER_ID);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.exchange;
|
||||
|
||||
import com.arrebol.apc.model.views.ExchangeEnebledUsersView;
|
||||
import com.arrebol.apc.model.ws.parsed.Exchange;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ExchangeEnebledUsersControllerTest {
|
||||
|
||||
public ExchangeEnebledUsersController controller;
|
||||
public static final String USER_ID_AVATAR_TWO = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
public static final String AVATAR= "22fb81e2-8bc9-11ea-b45c-c7b846343364";
|
||||
public static final String OFFICE_ID_GDL = "e0f1a2fc-7d1f-11ea-af3e-28f659da398e";
|
||||
public static final String OFFICE_ID_TPC = "caef3a64-7d1f-11ea-af3e-28f659da398e";
|
||||
|
||||
public ExchangeEnebledUsersControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new ExchangeEnebledUsersController();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findEnebledUsersToUserId() {
|
||||
try {
|
||||
List<ExchangeEnebledUsersView> results = controller.findEnebledUsersToUserId(USER_ID_AVATAR_TWO, OFFICE_ID_TPC);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exchangesByUsers() {
|
||||
try {
|
||||
List<Exchange> results = controller.exchangesByUsers(AVATAR);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.loan;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.json.loan.DeleteLoanDetailsJaxb;
|
||||
import com.arrebol.apc.controller.mobile.json.loan.LoanTypeListJaxb;
|
||||
import com.arrebol.apc.model.views.AvailableCustomersView;
|
||||
import com.arrebol.apc.model.views.AvailableEndorsementsView;
|
||||
import com.arrebol.apc.model.views.LoanToDeliveryByCertifierView;
|
||||
import com.arrebol.apc.model.ws.parsed.LoanDetailJaxb;
|
||||
import com.arrebol.apc.model.ws.parsed.LoanRequestedJaxb;
|
||||
import com.arrebol.apc.model.ws.parsed.PersonJaxb;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanControllerTest {
|
||||
|
||||
/**
|
||||
* $3,000.00
|
||||
*/
|
||||
public final static String LOAN_TYPE_ID = "8d91bc36-8e00-11ea-8745-07889553dd5f";
|
||||
/**
|
||||
* GDL
|
||||
*/
|
||||
public static final String OFFICE_ID = "e0f1a2fc-7d1f-11ea-af3e-28f659da398e";
|
||||
/**
|
||||
* TEPIC
|
||||
*/
|
||||
public static final String TEPIC_OFFICE_ID = "caef3a64-7d1f-11ea-af3e-28f659da398e";
|
||||
/**
|
||||
* LOANS
|
||||
*/
|
||||
public static final String LOAND_ID = "606e42f4-8e1b-11ea-b65e-4e1376171215";
|
||||
/**
|
||||
* Avatar 2
|
||||
*/
|
||||
public final static String MOBILE_USER_ID = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String ROUTE_ID = "55baf3ae-8e19-11ea-b65e-4e1376171215";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String DUMMY_DATA = "DUMMY";
|
||||
private LoanController controller;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new LoanController();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findAllLoanTypeByOffice() {
|
||||
try {
|
||||
LoanTypeListJaxb result = controller.findAllLoanTypeByOffice(OFFICE_ID);
|
||||
|
||||
System.out.println(result);
|
||||
|
||||
assertFalse(result.getLoans().isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enebleToDeleteTodayDetails(){
|
||||
try {
|
||||
DeleteLoanDetailsJaxb result = controller.enebleToDeleteTodayDetails(LOAND_ID,"");
|
||||
|
||||
System.out.println(result);
|
||||
|
||||
assertFalse(result.getApprovedOrPendingRenovation());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findAvailableCustomersByOffice() {
|
||||
try {
|
||||
List<AvailableCustomersView> results = controller.findAllAvailableCustomersByType("%SeGuNDo%");
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findAvailableEndorsementByOffice() {
|
||||
try {
|
||||
List<AvailableEndorsementsView> results = controller.findAllAvailableEndorsementsByType("%AvAl%");
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findNewCreditLimit() {
|
||||
try {
|
||||
LoanTypeListJaxb result = controller.findNewCreditLimit(OFFICE_ID, LOAND_ID);
|
||||
|
||||
System.out.println(result);
|
||||
|
||||
assertFalse(result.getLoans().isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void createLoan() {
|
||||
try {
|
||||
LoanRequestedJaxb jaxb = new LoanRequestedJaxb();
|
||||
|
||||
PersonJaxb customer = buildPerson(false, true);
|
||||
PersonJaxb endorsement = buildPerson(false, false);
|
||||
|
||||
jaxb.setLoanTypeId(LOAN_TYPE_ID);
|
||||
jaxb.setOfficeId(OFFICE_ID);
|
||||
jaxb.setUserId(MOBILE_USER_ID);
|
||||
jaxb.setRouteId(ROUTE_ID);
|
||||
jaxb.setCustomer(customer);
|
||||
jaxb.setEndorsement(endorsement);
|
||||
jaxb.setStrDate("2020-28-05 16:04:62");
|
||||
|
||||
//assertTrue(controller.createLoan(jaxb));
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findLoansByCertifier() {
|
||||
try {
|
||||
List<LoanToDeliveryByCertifierView> results = controller.findLoansByCertifier(MOBILE_USER_ID);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void approvedDetailsByIdLoan() {
|
||||
try {
|
||||
//LoanJaxb result = controller.approvedDetailsByIdLoan(LOAND_ID);
|
||||
List<LoanDetailJaxb> result = controller.approvedDetailsByIdLoan(LOAND_ID);
|
||||
System.out.println(result);
|
||||
|
||||
assertNotNull(result);
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
private PersonJaxb buildPerson(boolean isNewPerson, boolean isCustomer) {
|
||||
PersonJaxb person = new PersonJaxb();
|
||||
|
||||
if (!isNewPerson) {
|
||||
if (isCustomer) {
|
||||
person.setId("e61db008-8e1e-11ea-b65e-4e1376171215");
|
||||
} else {
|
||||
person.setId("2b502d50-8e1e-11ea-b65e-4e1376171215");
|
||||
}
|
||||
} else {
|
||||
person.setFirstName(DUMMY_DATA);
|
||||
person.setSecondName(DUMMY_DATA);
|
||||
person.setLastName(DUMMY_DATA);
|
||||
person.setMiddleName(DUMMY_DATA);
|
||||
person.setAddressHome(DUMMY_DATA);
|
||||
person.setPhoneHome(DUMMY_DATA);
|
||||
person.setCreatePerson(true);
|
||||
person.setThumbnail("https://f0.pngfuel.com/png/980/304/man-profile-illustration-computer-icons-user-profile-avatar-png-clip-art.png");
|
||||
|
||||
if (isCustomer) {
|
||||
person.setAddressWork(DUMMY_DATA);
|
||||
person.setPhoneWork(DUMMY_DATA);
|
||||
person.setCompanyName(DUMMY_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
return person;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.login;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.moxy.login.UserMxy;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoginWSControllerTest {
|
||||
|
||||
private LoginWSController controller;
|
||||
private final static String USER_NAME = "avatar1";
|
||||
private final static String PASSWORD = "8478A4A2819E9C06AB738123C5D04B4FA1AA67548EBA64EAD40B635EA8AA8D5B";
|
||||
|
||||
public LoginWSControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new LoginWSController();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void login() {
|
||||
try {
|
||||
UserMxy userMxy = controller.login(USER_NAME, PASSWORD);
|
||||
|
||||
System.out.println(userMxy);
|
||||
|
||||
assertFalse(userMxy.getPreferences().isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.arrebol.apc.controller.mobile.controller.preference;
|
||||
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
import com.arrebol.apc.model.views.LoanByUserOrderPreferenceView;
|
||||
import com.arrebol.apc.model.ws.parsed.ConfigurationJaxb;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class SystemPreferenceControllerTest {
|
||||
|
||||
private SystemPreferenceController controller;
|
||||
public static final String USER_ID = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
|
||||
public SystemPreferenceControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new SystemPreferenceController();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllLoanByUserOrderPreference() {
|
||||
try {
|
||||
List<LoanByUserOrderPreferenceView> results = controller.findAllLoanByUserOrderPreference(USER_ID);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findConfigurationButton() {
|
||||
try {
|
||||
ConfigurationJaxb result = controller.findConfigurationButton(USER_ID, USER_ID);
|
||||
|
||||
assertTrue(result.isActiveButton());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.search;
|
||||
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.views.LoanByUserView;
|
||||
import com.arrebol.apc.model.views.PersonSearchDetailView;
|
||||
import com.arrebol.apc.model.views.PersonSearchView;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PersonSearchControllerTest {
|
||||
|
||||
private PersonSearchController controller;
|
||||
public static final String PERSON_SEARCH_ID = "83d2cd30-8e1d-11ea-b65e-4e1376171215";
|
||||
public static final String USER_ID = "67b3081e-8bc9-11ea-b45c-c7b846343364";
|
||||
|
||||
public PersonSearchControllerTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new PersonSearchController();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findAllLoanByUserOrderPreference() {
|
||||
try {
|
||||
List<PersonSearchView> results = controller.findAllCoincidences("%janitzio%");
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void findPersonSearchDetail() {
|
||||
try {
|
||||
PersonSearchDetailView personSearchDetailView = controller.findPersonSearchDetail(PERSON_SEARCH_ID);
|
||||
|
||||
System.out.println(personSearchDetailView);
|
||||
assertNotNull(personSearchDetailView);
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchPaymentDetails() {
|
||||
try {
|
||||
LoanByUserView personSearchDetailView = controller.searchPaymentDetails(USER_ID, PERSON_SEARCH_ID);
|
||||
|
||||
System.out.println(personSearchDetailView);
|
||||
assertNotNull(personSearchDetailView);
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.controller.user;
|
||||
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class UserControllerTest {
|
||||
|
||||
/**
|
||||
* Avatar 2
|
||||
*/
|
||||
public final static String USER_MOBILE_AVATAR_2_ID = "52cbc85a-8bc9-11ea-b45c-c7b846343364";
|
||||
public final static String TEPIC_OFFICE = "caef3a64-7d1f-11ea-af3e-28f659da398e";
|
||||
|
||||
private UserController controller;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
controller = new UserController();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void isUserEnebled() {
|
||||
try {
|
||||
assertTrue(controller.isUserEnebled(USER_MOBILE_AVATAR_2_ID));
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void containtsUserManagementProperty() {
|
||||
try {
|
||||
assertTrue(controller.containtsUserManagementProperty(USER_MOBILE_AVATAR_2_ID));
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listOfUsersByOffice() {
|
||||
try {
|
||||
List<User> results = controller.listOfUsersByOffice(TEPIC_OFFICE);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository;
|
||||
|
||||
import com.arrebol.apc.test.ArrebolTest;
|
||||
import java.util.Date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ArrebolTestRepositoryTest {
|
||||
|
||||
private ArrebolTestRepository repository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
repository = new ArrebolTestRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save() {
|
||||
try {
|
||||
ArrebolTest arrebolTest = new ArrebolTest(new Date(), new Date());
|
||||
|
||||
Assert.assertTrue(repository.saveArrebolTest(arrebolTest));
|
||||
} catch (Exception e) {
|
||||
Assert.assertFalse(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.loan;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.constance.LoanTypeCfg;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.loan.LoanType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class LoanTypeRepositoryTest {
|
||||
|
||||
public static final String OFFICE_ID = "caef3a64-7d1f-11ea-af3e-28f659da398e";
|
||||
public static final String LOAND_ID = "acccdfac-8e1b-11ea-b65e-4e1376171215";
|
||||
|
||||
private LoanTypeRepository repository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
repository = new LoanTypeRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findLoanTypes() {
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
LoanTypeCfg.FIELD_OFFICE,
|
||||
new Office(OFFICE_ID)
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
LoanTypeCfg.PARAM_LOAN,
|
||||
new Loan(LOAND_ID)
|
||||
)
|
||||
);
|
||||
|
||||
parameters.add(
|
||||
new ModelParameter(
|
||||
LoanTypeCfg.PARAM_LOAN_ID,
|
||||
LOAND_ID
|
||||
)
|
||||
);
|
||||
|
||||
List<LoanType> results = repository.findLoanTypes(
|
||||
LoanType.class,
|
||||
LoanTypeCfg.QUERY_FIND_NEW_CREDIT_LINE_BY_LOAN_ID,
|
||||
parameters);
|
||||
|
||||
results.forEach(System.out::println);
|
||||
assertFalse(results.isEmpty());
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.mobile.repository.people;
|
||||
|
||||
import com.arrebol.apc.controller.mobile.repository.people.PeopleRepository;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.catalog.RouteCtlg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.enums.PeopleType;
|
||||
import java.util.Date;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class PeopleRepositoryTest {
|
||||
|
||||
private PeopleRepository repository;
|
||||
public static final String OFFICE_ID = "e0f1a2fc-7d1f-11ea-af3e-28f659da398e";
|
||||
public static final String ROUTE_ID = "5e9a24e0-8e19-11ea-b65e-4e1376171215";
|
||||
public static final String TEXT_VALUE = "Testing";
|
||||
|
||||
public PeopleRepositoryTest() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
repository = new PeopleRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createPeople() {
|
||||
try {
|
||||
People people = new People();
|
||||
|
||||
people.setFirstName(TEXT_VALUE);
|
||||
people.setLastName(TEXT_VALUE);
|
||||
people.setMiddleName(TEXT_VALUE);
|
||||
people.setAddressHome(TEXT_VALUE);
|
||||
people.setPhoneHome(TEXT_VALUE);
|
||||
people.setThumbnail(TEXT_VALUE);
|
||||
people.setPeopleType(PeopleType.BOTH);
|
||||
people.setActiveStatus(ActiveStatus.DISABLED);
|
||||
people.setOffice(new Office(OFFICE_ID));
|
||||
people.setRouteCtlg(new RouteCtlg(ROUTE_ID));
|
||||
people.setCreatedBy(TEXT_VALUE);
|
||||
people.setCreatedOn(new Date());
|
||||
|
||||
String id = null;//repository.createPeople(people);
|
||||
|
||||
System.out.println(id);
|
||||
|
||||
assertNotNull(id);
|
||||
} catch (Exception e) {
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
228
ace-controller-mobile/src/test/resources/apc.cfg.xml
Normal file
228
ace-controller-mobile/src/test/resources/apc.cfg.xml
Normal file
@ -0,0 +1,228 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE hibernate-configuration PUBLIC
|
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
|
||||
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
|
||||
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/apo_pro_com_april_ten?serverTimezone=GMT-5</property>
|
||||
<property name="hibernate.connection.username">apoprocommobilelocalhost</property>
|
||||
<property name="hibernate.connection.password">0Ps$6%q8</property>
|
||||
<property name="hibernate.c3p0.min_size">1</property>
|
||||
<property name="hibernate.c3p0.max_size">2</property>
|
||||
<property name="hibernate.c3p0.timeout">300</property>
|
||||
<property name="hibernate.c3p0.max_statements">50</property>
|
||||
<property name="hibernate.c3p0.idle_test_period">3000</property>
|
||||
<property name="hibernate.show_sql">false</property>
|
||||
<property name="hibernate.format_sql">false</property>
|
||||
<property name="hibernate.enable_lazy_load_no_trans">true</property>
|
||||
<property name="hibernate.current_session_context_class">thread</property>
|
||||
<property name="hibernate.connection.noAccessToProcedureBodies">${hibernate.connection.noAccessToProcedureBodies}</property>
|
||||
<property name="hibernate.connection.useSSL">false</property>
|
||||
<!-- ERROR PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.system.logs.ErrorAppLog"/>
|
||||
<mapping class="com.arrebol.apc.model.system.logs.Bitacora"/>
|
||||
<!-- CORE PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.core.HumanResource"/>
|
||||
<mapping class="com.arrebol.apc.model.core.HumanResourceByOffice"/>
|
||||
<mapping class="com.arrebol.apc.model.core.Office"/>
|
||||
<mapping class="com.arrebol.apc.model.core.User"/>
|
||||
<mapping class="com.arrebol.apc.model.core.UserByOffice"/>
|
||||
<mapping class="com.arrebol.apc.model.core.Permission"/>
|
||||
<mapping class="com.arrebol.apc.model.core.UserByOfficeHasPermission"/>
|
||||
<!-- CATALOG PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.catalog.RoleCtlg"/>
|
||||
<mapping class="com.arrebol.apc.model.catalog.RouteCtlg"/>
|
||||
<mapping class="com.arrebol.apc.model.catalog.People"/>
|
||||
<mapping class="com.arrebol.apc.model.catalog.HumanResourceHasRoute"/>
|
||||
<!-- LOAN PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.loan.LoanType"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.Loan"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.LoanDetails"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.LoanByUser"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.LoanFeeNotification"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.LoanByRenovation"/>
|
||||
<mapping class="com.arrebol.apc.model.loan.Delivery"/>
|
||||
<!-- MOBILE PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.mobile.preference.UserMobilePreference"/>
|
||||
<mapping class="com.arrebol.apc.model.mobile.access.MobileUser"/>
|
||||
<!-- ADMIN PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.admin.Transfer"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.MoneyDaily"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.ClosingDay"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.OtherExpense"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.Goal"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.Advance"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.Bonus"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.ExpenseCompany"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.StableGeneralBox"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.StableSmallBox"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.ClosingDayDetail"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.LoanEmployee"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.LoanEmployeeDetails"/>
|
||||
<mapping class="com.arrebol.apc.model.admin.EmployeeSaving"/>
|
||||
<!-- PAYROLL PACKAGE -->
|
||||
<mapping class="com.arrebol.apc.model.payroll.TotalExpectedPaymentDailyByUser"/>
|
||||
<mapping class="com.arrebol.apc.model.payroll.Payroll"/>
|
||||
<!-- VIEWS -->
|
||||
<mapping class="com.arrebol.apc.model.views.AdministrationPersonSerchView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanByUserOrderPreferenceView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.PersonSearchView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.PersonSearchDetailView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.AvailableCustomersView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.AvailableEndorsementsView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CashRegisterCurdateByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanToDeliveryByCertifierView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ExchangeEnebledUsersView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TotalCashByCurdateView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.PersonSearchHistoricalDetailsView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TotalClosingDayByCurdateView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TotalLoansByOfficeView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.PaymentDetailFromUserByCurdateView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ClosingDailyDetailFromUserByCurdateView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanApprovedDetailView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.GeneralBoxView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanByUserPaymentZeroView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.AdvanceUserDailyView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CustomerWithoutRenovationView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.AdvanceUserDailyDetail"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TotalLoansApprovedByOfficeView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TotalCashByCurdateDashboardView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.MoneyDailyByUserCertifier"/>
|
||||
<mapping class="com.arrebol.apc.model.views.InformationLoanWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanDiferencesByUserLastWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.InformationLoanLastWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ColocationWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ColocationLastWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.SubtotalLastWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.SubtotalWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumenInOutWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumenInOutLastWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CurrentCustomerByLoanView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.AvailablesOwnersView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CobranzaLastWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CobranzaWeekByUserView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumenTotalLastWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumenTotalWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumeNewCustomerLastWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.ResumeNewCustomerWeekView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.HistoryLoanView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.FeesView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsClosingDayView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsOpeningFeesView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsPaymentView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsPaymentRouteView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsPaymentRenovationView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsPayrollView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsDepositsView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsZeroPaymentsView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsEmployeeSavingView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsAdvancesView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsGasolineView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.StatsSummaryView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanDetailZeroView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanFinishedView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanEmployeeView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanEmployeeAllDataView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanEmployeeDetailAllDataView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.CustomerView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TransferView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.EnabledUserDetailsView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.TransferInPendingStatusView"/>
|
||||
<mapping class="com.arrebol.apc.model.views.LoanInPendingStatusToDeliveryView"/>
|
||||
<mapping class="com.arrebol.apc.model.catalog.Vehicle"/>
|
||||
<!-- REPORTS -->
|
||||
<mapping class="com.arrebol.apc.model.reports.UserWeekReport"/>
|
||||
<!-- GASOLINE -->
|
||||
<mapping class="com.arrebol.apc.model.gasoline.Gasoline"/>
|
||||
<!-- QUERIES -->
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/user.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/user.by.office.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/office.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/user.by.office.has.permission.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/human.resource.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/permission.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/core/mobile.user.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.by.user.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.type.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.by.renovation.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/delivery.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.details.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/catalog/queries/people.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/catalog/queries/roles.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/catalog/queries/routes.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.fee.notification.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/preference/user.mobile.preference.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.by.user.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.by.user.order.preference.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/person.search.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/person.search.detail.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/available.customers.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/available.endorsements.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/cash.register.curdate.by.user.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.to.delivery.by.ciertifier.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/exchange.enebled.users.view.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/total.cash.by.curdate.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/person.search.historical.details.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.approved.detail.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/transfer.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/money.daily.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/closing_day.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/closing.day.detail.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/other.expense.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/goal.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/advance.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/bonus.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/expense.company.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/stable.general.box.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/stable.small.box.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/admin/bitacora.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/payroll/payroll.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/payroll/total.expected.payment.daily.by.user.queries.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/administration.person.serch.view.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/total.loans.by.office.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/total.closing.day.by.curdate.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/payment.detail.from.user.by.curdate.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/total.closing.daily.detail.from.user.by.curdate.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/general.box.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/loan.by.user.payment.zero.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/advance.user.daily.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/customer.without.renovation.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/advance.user.daily.detail.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/total.loans.approved.by.office.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/money.daily.by.user.certifier.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/information.loan.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/information.loan.last.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/resumen.total.last.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/resumen.new.customer.last.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/resumen.new.customer.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/resumen.total.week.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.fees.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.closing.day.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.opening.fees.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.payment.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.payment.route.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.payment.renovation.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.payroll.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.vehicle.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.deposits.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.zero.payments.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.employee.saving.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.advances.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/stats.gasoline.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/loan.employee.view.hbm.xml"/>
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/loan.employee.detail.all.data.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/enabled.user.details.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/view/transfer.in.pending.status.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/loan.in.pending.status.to.delivery.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/loan/loan.employee.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/current.customer.by.loan.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/views/availables.owners.view.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/reports/user.week.report.hbm.xml" />
|
||||
<mapping resource="com/arrebol/apc/model/queries/mobile/gasoline/gasoline.hbm.xml" />
|
||||
<mapping class="com.arrebol.apc.test.ArrebolTest"/>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
20
ace-controller-mobile/src/test/resources/log4j2.xml
Normal file
20
ace-controller-mobile/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{yyyy-MMM-dd hh:mm:ss a } %level %c - %m %n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<Logger name="com.arrebol.apc" level="DEBUG"
|
||||
additivity="false">
|
||||
<AppenderRef ref="Console" />
|
||||
</Logger>
|
||||
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
|
||||
</Configuration>
|
18
ace-controller/nb-configuration.xml
Normal file
18
ace-controller/nb-configuration.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
92
ace-controller/pom.xml
Normal file
92
ace-controller/pom.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-controller</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<log4j.version>2.17.0</log4j.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!--
|
||||
MySQL Connector/J 8.0 is highly recommended for use with
|
||||
MySQL Server 8.0, 5.7, 5.6, and 5.5.
|
||||
|
||||
Please upgrade to MySQL Connector/J 8.0.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.12</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Log4j 2 is broken up in an API and an implementation (core),
|
||||
where the API provides the interface that applications should code to.
|
||||
|
||||
Strictly speaking Log4j core is only needed at runtime
|
||||
and not at compile time.
|
||||
|
||||
However, below we list Log4j core as a compile time dependency
|
||||
to improve the startup time for custom plugins as it provides
|
||||
an annotation processor that generates a metadata file to cache plugin
|
||||
information as well as the necessary code to compile against
|
||||
to create custom plugins.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
<!-- "Apoyo a Proyectos Comerciales (APC)" Application Dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-layout</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<name>ace-controller</name>
|
||||
</project>
|
92
ace-controller/pom.xml.bak
Normal file
92
ace-controller/pom.xml.bak
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>ace-controller</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<log4j.version>2.17.0</log4j.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!--
|
||||
MySQL Connector/J 8.0 is highly recommended for use with
|
||||
MySQL Server 8.0, 5.7, 5.6, and 5.5.
|
||||
|
||||
Please upgrade to MySQL Connector/J 8.0.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.12</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Log4j 2 is broken up in an API and an implementation (core),
|
||||
where the API provides the interface that applications should code to.
|
||||
|
||||
Strictly speaking Log4j core is only needed at runtime
|
||||
and not at compile time.
|
||||
|
||||
However, below we list Log4j core as a compile time dependency
|
||||
to improve the startup time for custom plugins as it provides
|
||||
an annotation processor that generates a metadata file to cache plugin
|
||||
information as well as the necessary code to compile against
|
||||
to create custom plugins.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
<!-- "Apoyo a Proyectos Comerciales (APC)" Application Dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>apc-layout</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.arrebol</groupId>
|
||||
<artifactId>apc-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<name>ace-controller</name>
|
||||
</project>
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.BitacoraCfg;
|
||||
import com.arrebol.apc.model.admin.constance.GoalCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.system.logs.Bitacora;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class BitacoraController implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all bitacora by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<Bitacora> fillBitacoraDatatable(String officeId) {
|
||||
logger.debug("fillBitacoraDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(BitacoraCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Bitacora.class, BitacoraCfg.QUERY_FIND_ALL_BITACORA_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
public List<Bitacora> fillBitacoraDatatableByDate(String officeId, Date startDate, Date endDate) {
|
||||
logger.debug("fillBitacoraDatatableByDate");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(BitacoraCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
parameters.add(new ModelParameter(GoalCfg.PARAM_START_DATE, startDate));
|
||||
parameters.add(new ModelParameter(GoalCfg.PARAM_END_DATE, endDate));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Bitacora.class, BitacoraCfg.QUERY_FIND_ALL_BITACORA_BY_OFFICE_DATE, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bitacora
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean saveBitacora(Bitacora bitacora) {
|
||||
logger.debug("saveBitacora");
|
||||
boolean success = genericEntityRepository.insertAPCEntity(bitacora);
|
||||
|
||||
return success;
|
||||
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(BitacoraController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public BitacoraController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller;
|
||||
|
||||
import com.arrebol.apc.controller.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import com.arrebol.apc.model.admin.constance.StableGeneralBoxCfg;
|
||||
import com.arrebol.apc.model.core.HumanResource;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.HumanResourceCfg;
|
||||
import com.arrebol.apc.model.core.constance.UserCfg;
|
||||
import com.arrebol.apc.model.enums.HumanResourceStatus;
|
||||
import com.arrebol.apc.model.views.GeneralBoxView;
|
||||
import com.arrebol.apc.model.views.constance.GeneralBoxViewCfg;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class GenericController implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all user actives by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<User> getAllUsersByOffice(String officeId) {
|
||||
logger.debug("getAllUsersByOffice");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(UserCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(User.class, UserCfg.QUERY_FIND_ALL_USERS_COMPLETE, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all human resources actives by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<HumanResource> getAllHRByOffice(String officeId) {
|
||||
logger.debug("getAllHRByOffice");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(HumanResourceCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
parameters.add(new ModelParameter(HumanResourceCfg.FIELD_HR_STATUS, HumanResourceStatus.ENEBLED));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(HumanResource.class, HumanResourceCfg.QUERY_FIND_ALL_HR_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all details by general box by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal findAllGeneralBox(String officeId) {
|
||||
logger.debug("findAllGeneralBox");
|
||||
List<GeneralBoxView> generalBox = null;
|
||||
BigDecimal totalBox;
|
||||
totalBox = BigDecimal.ZERO;
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(GeneralBoxViewCfg.FIELD_OFFICE, officeId));
|
||||
|
||||
generalBox = genericEntityRepository.xmlQueryAPCEntities(GeneralBoxView.class, GeneralBoxViewCfg.QUERY_FIND_ALL_DETAILS, parameters);
|
||||
|
||||
if(generalBox != null && !generalBox.isEmpty())
|
||||
{
|
||||
for(GeneralBoxView total : generalBox)
|
||||
{
|
||||
if(total.getType().equalsIgnoreCase("Inicio"))
|
||||
totalBox = totalBox.subtract(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Corte del día"))
|
||||
totalBox = totalBox.add(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Entrada"))
|
||||
totalBox = totalBox.add(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Salida"))
|
||||
totalBox = totalBox.subtract(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Adelanto"))
|
||||
totalBox = totalBox.subtract(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Nomina"))
|
||||
totalBox = totalBox.subtract(total.getAmount());
|
||||
if(total.getType().equalsIgnoreCase("Préstamo Empleado"))
|
||||
totalBox = totalBox.subtract(total.getAmount());
|
||||
}
|
||||
}
|
||||
|
||||
return totalBox;
|
||||
}
|
||||
|
||||
public BigDecimal findAllSmallBox(String officeId) {
|
||||
logger.debug("findAllSmallBox");
|
||||
BigDecimal totalBox;
|
||||
totalBox = BigDecimal.ZERO;
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
|
||||
totalBox = (BigDecimal)genericEntityRepository.xmlQueryAPCEntityUniqueResult(BigDecimal.class,
|
||||
ClosingDayCfg.QUERY_SUM_CLOSING_DAY_BY_CURDATE_AND_OFFICE, parameters);
|
||||
|
||||
return totalBox;
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal findAllSmallBoxByLastSmallBox(String officeId, Date lastSmallBox) {
|
||||
logger.debug("findAllSmallBoxByLastSmalBox");
|
||||
BigDecimal totalBox;
|
||||
totalBox = BigDecimal.ZERO;
|
||||
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
Query query = session.createQuery("SELECT SUM(amountPaid) FROM ClosingDay WHERE office.id = :idOffice AND createdOn > :lastBox AND activeStatus = 'ENEBLED'");
|
||||
query.setParameter("idOffice", officeId);
|
||||
query.setParameter("lastBox", lastSmallBox);
|
||||
query.setMaxResults(1);
|
||||
totalBox = (BigDecimal) query.uniqueResult();
|
||||
|
||||
|
||||
|
||||
transaction.commit();
|
||||
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Driver", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
|
||||
return totalBox;
|
||||
}
|
||||
|
||||
public Date getMaxDateStableGeneralBoxByOffice(String officeid) {
|
||||
logger.debug("getMaxDateStableGeneralBoxByOffice");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableGeneralBoxCfg.FIELD_OFFICE, new Office(officeid)));
|
||||
|
||||
return (Date) genericEntityRepository.xmlQueryAPCEntityUniqueResult(Date.class, StableGeneralBoxCfg.QUERY_MAX_STABLE_GENERAL_BOX_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
public Date getMaxDateClosingDayByOffice(String officeid) {
|
||||
logger.debug("getMaxDateClosingDayByOffice");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(StableGeneralBoxCfg.FIELD_OFFICE, new Office(officeid)));
|
||||
|
||||
return (Date) genericEntityRepository.xmlQueryAPCEntityUniqueResult(Date.class, StableGeneralBoxCfg.QUERY_MAX_CLOSING_DAY_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
public boolean verifyStableGeneralBoxVsClosingDay(String officeid)
|
||||
{
|
||||
if(getMaxDateStableGeneralBoxByOffice(officeid) == null || getMaxDateClosingDayByOffice(officeid) == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(getMaxDateStableGeneralBoxByOffice(officeid).compareTo(getMaxDateClosingDayByOffice(officeid)) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean existStableSmallBoxByCreatedOn(Date date) {
|
||||
logger.info("existStableSmallBoxByCreatedOn");
|
||||
|
||||
String query = "SELECT ssb.id "
|
||||
+ "FROM APC_STABLE_SMALL_BOX ssb "
|
||||
+ "WHERE DATE(ssb.created_on) = DATE(:date) "
|
||||
+ "AND ssb.active_status = 'ENEBLED'";
|
||||
|
||||
return genericEntityRepository.existRecordsUsingSQLQueryFindByCreatedOnField(date, query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public boolean existStableGeneralBoxByCreatedOn(Date date) {
|
||||
logger.info("existStableGeneralBoxByCreatedOn");
|
||||
|
||||
String query = "SELECT sgb.id "
|
||||
+ "FROM APC_STABLE_GENERAL_BOX sgb "
|
||||
+ "WHERE DATE(sgb.created_on) = DATE(:date) "
|
||||
+ "AND sgb.active_status = 'ENEBLED'";
|
||||
|
||||
return genericEntityRepository.existRecordsUsingSQLQueryFindByCreatedOnField(date, query);
|
||||
}
|
||||
|
||||
protected void rollback(Transaction transaction) {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(GenericController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public GenericController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller;
|
||||
|
||||
import com.arrebol.apc.controller.util.ConnectionManager;
|
||||
import com.arrebol.apc.controller.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.admin.ClosingDay;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class GenericValidationController extends ConnectionManager implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public boolean existClosingDayByCreatedOn(Date date, User user) {
|
||||
logger.info("existClosingDayByCreatedOn");
|
||||
|
||||
boolean success = true;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
String query = "SELECT COUNT(ssb.id) "
|
||||
+ "FROM ClosingDay ssb "
|
||||
+ "WHERE DATE(ssb.createdOn) = DATE(:date) "
|
||||
+ "AND ssb.activeStatus = 'ENEBLED' "
|
||||
+ "AND ssb.user = :user";
|
||||
|
||||
Long count = (Long) session.createQuery(query)
|
||||
.setParameter("date", date)
|
||||
.setParameter("user", user).uniqueResult();
|
||||
|
||||
if (null != count && count == 0) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Total of closing day found: " + count);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find stable small box by created on", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method existStableSmallBoxByCreatedOn()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public boolean existStableGeneralBoxByCurdate(User user) {
|
||||
logger.info("existStableGeneralBoxByCurdate");
|
||||
|
||||
boolean success = true;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
String query = "SELECT COUNT(ssb.id) "
|
||||
+ "FROM StableGeneralBox ssb "
|
||||
+ "WHERE DATE(ssb.createdOn) = CURDATE() "
|
||||
+ "AND ssb.activeStatus = 'ENEBLED'";
|
||||
|
||||
Long count = (Long) session.createQuery(query).uniqueResult();
|
||||
|
||||
if (null != count && count == 0) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Total of StableGeneralBox found: " + count);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find StableGeneralBox by created on", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method existStableGeneralBoxByCurdate()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public Date lastStableGeneralBoxByDate(User user) {
|
||||
logger.info("lastStableGeneralBoxByDate");
|
||||
|
||||
Date success = null;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
String query = "SELECT cd.createdOn FROM StableGeneralBox cd "
|
||||
+ "WHERE DATE(cd.createdOn) <= CURDATE() AND cd.activeStatus = 'ENEBLED' "
|
||||
+ "order by cd.createdOn DESC";
|
||||
|
||||
success = (Date) session.createQuery(query).setMaxResults(1)
|
||||
.uniqueResult();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Total of closing day found: ");
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find stable small box by created on", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method lastStableGeneralBoxByDate()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public Date lastStableSmallBoxByDate(User user) {
|
||||
logger.info("lastStableSmallBoxByDate");
|
||||
|
||||
Date success = null;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
String query = "SELECT cd.createdOn FROM StableSmallBox cd "
|
||||
+ "WHERE DATE(cd.createdOn) <= CURDATE() AND cd.activeStatus = 'ENEBLED' "
|
||||
+ "order by cd.createdOn DESC";
|
||||
|
||||
success = (Date) session.createQuery(query).setMaxResults(1)
|
||||
.uniqueResult();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Total of closing day found: ");
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find stable small box by created on", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method lastStableSmallBoxByDate()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public List<ClosingDay> allClosingDayByDate( ) {
|
||||
logger.info("allClosingDayByDate");
|
||||
|
||||
List<ClosingDay> success = null;
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
String query = "SELECT cd FROM ClosingDay cd "
|
||||
+ "WHERE DATE(cd.createdOn) = CURDATE() AND cd.activeStatus = 'ENEBLED'";
|
||||
|
||||
success = session.createQuery(query).getResultList();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Total of closing day found: ");
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find stable small box by created on", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method lastStableSmallBoxByDate()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(GenericValidationController.class);
|
||||
private static final long serialVersionUID = -6732331411572526429L;
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.RouteCtlg;
|
||||
import com.arrebol.apc.model.catalog.constance.RouteCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.enums.PeopleType;
|
||||
import com.arrebol.apc.model.views.AdministrationPersonSerchView;
|
||||
import com.arrebol.apc.model.views.constance.AdministrationPersonSerchViewCfg;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class AdministrationPersonSearchViewController implements Serializable {
|
||||
|
||||
public List<RouteCtlg> findAllActiveRoutesByOfficce(String idOffice) {
|
||||
List<RouteCtlg> routes;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(RouteCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
parameters.add(new ModelParameter(RouteCfg.FIELD_OFFICE, new Office(idOffice)));
|
||||
|
||||
routes = genericEntityRepository.xmlQueryAPCEntities(RouteCtlg.class, RouteCfg.QUERY_FIND_ALL_ROUTES, parameters);
|
||||
} catch (Exception e) {
|
||||
routes = new ArrayList<>();
|
||||
|
||||
logger.error("findPersonByTypeAndRouteAndOffice", e);
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param idRoute
|
||||
* @param idOffice
|
||||
* @return
|
||||
*/
|
||||
public List<AdministrationPersonSerchView> findPersonByTypeAndRouteAndOffice(PeopleType type, String idRoute, String idOffice) {
|
||||
List<AdministrationPersonSerchView> persons;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_PEOPLE_TYPE, type));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_ID_ROUTE, idRoute));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_ID_OFFICE, idOffice));
|
||||
|
||||
persons = genericEntityRepository.xmlQueryAPCEntities(AdministrationPersonSerchView.class, AdministrationPersonSerchViewCfg.QUERY_FIND_PERSON_BY_TYPE_ROUTE_OFFICE, parameters);
|
||||
} catch (Exception e) {
|
||||
persons = new ArrayList<>();
|
||||
|
||||
logger.error("findPersonByTypeAndRouteAndOffice", e);
|
||||
}
|
||||
return persons;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param personSearch
|
||||
* @param type
|
||||
* @param routes
|
||||
* @param idOffice
|
||||
* @return
|
||||
*/
|
||||
public List<AdministrationPersonSerchView> likePersonNameInPersonTypeInRoutesAndOffice(String personSearch, PeopleType type, List<String> routes, String idOffice) {
|
||||
List<AdministrationPersonSerchView> persons;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_PERSON_SEARCH, personSearch));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_PEOPLE_TYPE, type));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_ID_ROUTE, routes));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_ID_OFFICE, idOffice));
|
||||
|
||||
persons = genericEntityRepository.xmlQueryAPCEntities(AdministrationPersonSerchView.class, AdministrationPersonSerchViewCfg.QUERY_LIKE_PERSON_NAME_IN_PERSON_TYPE_IN_ROUTES_AND_OFFICE, parameters);
|
||||
} catch (Exception e) {
|
||||
persons = new ArrayList<>();
|
||||
|
||||
logger.error("likePersonNameInPersonTypeInRoutesAndOffice", e);
|
||||
}
|
||||
return persons;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param personSearch
|
||||
* @param type
|
||||
* @param idOffice
|
||||
* @return
|
||||
*/
|
||||
public List<AdministrationPersonSerchView> likePersonNameInPersonTypeAllRoutesByOffice(String personSearch, PeopleType type, String idOffice) {
|
||||
List<AdministrationPersonSerchView> persons;
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_PERSON_SEARCH, personSearch));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_PEOPLE_TYPE, type));
|
||||
parameters.add(new ModelParameter(AdministrationPersonSerchViewCfg.FIELD_ID_OFFICE, idOffice));
|
||||
|
||||
persons = genericEntityRepository.xmlQueryAPCEntities(AdministrationPersonSerchView.class, AdministrationPersonSerchViewCfg.QUERY_LIKE_PERSON_NAME_IN_PERSON_TYPE_ALL_ROUTES_BY_OFFICE, parameters);
|
||||
} catch (Exception e) {
|
||||
persons = new ArrayList<>();
|
||||
|
||||
logger.error("likePersonNameInPersonTypeAllRoutesByOffice", e);
|
||||
}
|
||||
return persons;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public AdministrationPersonSerchView administrationPersonSerchViewById(String id) {
|
||||
AdministrationPersonSerchView person;
|
||||
try {
|
||||
person = (AdministrationPersonSerchView) genericEntityRepository.selectAPCEntityById(AdministrationPersonSerchView.class, id);
|
||||
} catch (Exception e) {
|
||||
person = new AdministrationPersonSerchView();
|
||||
|
||||
logger.error("administrationPersonSerchViewById", e);
|
||||
}
|
||||
return person;
|
||||
}
|
||||
|
||||
public AdministrationPersonSearchViewController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(getClass());
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.Advance;
|
||||
import com.arrebol.apc.model.admin.constance.AdvanceCfg;
|
||||
import com.arrebol.apc.model.admin.constance.BonusCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class AdvanceController implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all advances by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<Advance> fillAdvanceDatatable(String officeId, Date startDate, Date endDate) {
|
||||
logger.debug("fillAdvanceDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AdvanceCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
//parameters.add(new ModelParameter(AdvanceCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
parameters.add(new ModelParameter(BonusCfg.PARAM_START_DATE, startDate));
|
||||
parameters.add(new ModelParameter(BonusCfg.PARAM_END_DATE, endDate));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Advance.class, AdvanceCfg.QUERY_FIND_ALL_ADVANCE_BY_OFFICE_BETWEEN_DATES, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param advance
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean saveAdvance(Advance advance) {
|
||||
logger.debug("saveAdvance");
|
||||
boolean success = genericEntityRepository.insertAPCEntity(advance);
|
||||
|
||||
return success;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param status
|
||||
* @param advanceIdToUpdate
|
||||
* @param lastUpdatedBy
|
||||
* @return
|
||||
*/
|
||||
public boolean updateAdvanceByStatus(ActiveStatus status, String advanceIdToUpdate, String lastUpdatedBy) {
|
||||
logger.debug("updateAdvanceByStatus");
|
||||
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AdvanceCfg.FIELD_ACTIVE_STATUS, status));
|
||||
parameters.add(new ModelParameter(AdvanceCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy));
|
||||
parameters.add(new ModelParameter(AdvanceCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(AdvanceCfg.FIELD_ID, advanceIdToUpdate));
|
||||
|
||||
return genericEntityRepository.xmlUpdateOrDeleteAPCEntity(AdvanceCfg.QUERY_UPDATE_ADVANCE_BY_STATUS, parameters);
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(AdvanceController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public AdvanceController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.Bonus;
|
||||
import com.arrebol.apc.model.admin.constance.BonusCfg;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class BonusController implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 4204730064288408417L;
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all advances by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<Bonus> fillBonusDatatable(String officeId, Date startDate, Date endDate) {
|
||||
logger.debug("fillBonusDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
parameters.add(new ModelParameter(BonusCfg.PARAM_START_DATE, startDate));
|
||||
parameters.add(new ModelParameter(BonusCfg.PARAM_END_DATE, endDate));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Bonus.class, BonusCfg.QUERY_FIND_ALL_BONUS_BETWEEN_DATES, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bonus
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean updateByBonusId(Bonus bonus) {
|
||||
logger.debug("updateByBonusId");
|
||||
|
||||
return genericEntityRepository.updateAPCEntity(bonus);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bonus
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean saveBonus(Bonus bonus) {
|
||||
logger.debug("saveBonus");
|
||||
boolean success = genericEntityRepository.insertAPCEntity(bonus);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param status
|
||||
* @param bonusIdToUpdate
|
||||
* @param lastUpdatedBy
|
||||
* @return
|
||||
*/
|
||||
public boolean updateBonusByStatus(ActiveStatus status, String bonusIdToUpdate, String lastUpdatedBy) {
|
||||
logger.debug("updateBonusByStatus");
|
||||
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_ACTIVE_STATUS, status));
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy));
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(BonusCfg.FIELD_ID, bonusIdToUpdate));
|
||||
|
||||
return genericEntityRepository.xmlUpdateOrDeleteAPCEntity(BonusCfg.QUERY_UPDATE_BONUS_BY_STATUS, parameters);
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(BonusController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public BonusController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.LoanByUserCfg;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.views.AvailablesOwnersView;
|
||||
import com.arrebol.apc.model.views.CurrentCustomerByLoanView;
|
||||
import com.arrebol.apc.model.views.constance.AvailablesOwnersViewCfg;
|
||||
import com.arrebol.apc.model.views.constance.CurrentCustomerByLoanViewCfg;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
|
||||
*/
|
||||
public class ChangeOwnerController implements Serializable {
|
||||
|
||||
/**
|
||||
* Find all users that have loans by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<AvailablesOwnersView> findAllCurrentOwners(String officeId) throws Exception {
|
||||
logger.info("findAllCurrentOwners");
|
||||
|
||||
List<AvailablesOwnersView> results = new ArrayList();
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AvailablesOwnersViewCfg.PARAM_OFFICE_ID, officeId));
|
||||
|
||||
results = genericEntityRepository.xmlQueryAPCEntities(AvailablesOwnersView.class, AvailablesOwnersViewCfg.QUERY_FIND_ALL_CURRENT_OWNERS, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllCurrentOwners", e);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all users in office execluding user id (currentOwnerId).
|
||||
*
|
||||
* @param officeId
|
||||
* @param currentOwnerId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<AvailablesOwnersView> findAllNewOwners(String officeId, String currentOwnerId) throws Exception {
|
||||
logger.info("findAllNewOwners");
|
||||
|
||||
List<AvailablesOwnersView> results = new ArrayList();
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(AvailablesOwnersViewCfg.PARAM_OFFICE_ID, officeId));
|
||||
parameters.add(new ModelParameter(AvailablesOwnersViewCfg.USER_ID, currentOwnerId));
|
||||
|
||||
results = genericEntityRepository.xmlQueryAPCEntities(AvailablesOwnersView.class, AvailablesOwnersViewCfg.QUERY_FIND_ALL_NEW_OWNERS, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllNewOwners", e);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all loans that current owner has in status PENDING, TO_DELIVERY,
|
||||
* PENDING_RENOVATION and APPROVED.
|
||||
*
|
||||
* @param officeId
|
||||
* @param currentOwnerId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CurrentCustomerByLoanView> findAllLoansByCurrentOwner(String officeId, String currentOwnerId) throws Exception {
|
||||
logger.info("findAllLoansByCurrentOwner");
|
||||
|
||||
List<CurrentCustomerByLoanView> results = new ArrayList();
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(CurrentCustomerByLoanViewCfg.PARAM_OFFICE_ID, officeId));
|
||||
parameters.add(new ModelParameter(CurrentCustomerByLoanViewCfg.USER_ID, currentOwnerId));
|
||||
|
||||
results = genericEntityRepository.xmlQueryAPCEntities(CurrentCustomerByLoanView.class, CurrentCustomerByLoanViewCfg.QUERY_FIND_ALL_LOANS_BY_CURRENT_OWNER, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("findAllLoansByCurrentOwner", e);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newOwner
|
||||
* @param loans
|
||||
* @return
|
||||
*/
|
||||
public boolean changeLoansBetweenUsers(String newOwner, List<Loan> loans) {
|
||||
logger.info("changeLoansBetweenUsers");
|
||||
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanByUserCfg.FIELD_USER, new User(newOwner)));
|
||||
parameters.add(new ModelParameter(LoanByUserCfg.PARAMS_LOAN, loans));
|
||||
|
||||
success = genericEntityRepository.xmlUpdateOrDeleteAPCEntity(LoanByUserCfg.QUERY_CHANGE_LOANS_BETWEEN_USERS_IN_LOAN_IDS, parameters);
|
||||
} catch (Exception e) {
|
||||
logger.error("changeLoansBetweenUsers", e);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 2051770456409752434L;
|
||||
final Logger logger = LogManager.getLogger(getClass().getName());
|
||||
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public ChangeOwnerController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
}
|
@ -0,0 +1,439 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.controller.util.ConnectionManager;
|
||||
import com.arrebol.apc.controller.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.admin.ClosingDay;
|
||||
import com.arrebol.apc.model.admin.ClosingDayDetail;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayCfg;
|
||||
import com.arrebol.apc.model.admin.constance.ClosingDayDetailCfg;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.core.Office;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.views.ClosingDailyDetailFromUserByCurdateView;
|
||||
import com.arrebol.apc.model.views.LoanByUserPaymentZeroView;
|
||||
import com.arrebol.apc.model.views.TotalCashByCurdateDashboardView;
|
||||
import com.arrebol.apc.model.views.TotalCashByCurdateView;
|
||||
import com.arrebol.apc.model.views.TotalClosingDayByCurdateView;
|
||||
import com.arrebol.apc.model.views.constance.ClosingDailyDetailFromUserByCurdateCfg;
|
||||
import com.arrebol.apc.model.views.constance.LoanByUserPaymentZeroViewCfg;
|
||||
import com.arrebol.apc.model.views.constance.TotalLoansByOfficeViewCfg;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class ClosingDayController extends ConnectionManager implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all closing day by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<ClosingDay> fillClosingDayDatatable(String officeId, Date startDate, Date endDate) {
|
||||
logger.debug("fillClosingDayDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
startDate = calendar.getTime();
|
||||
|
||||
Calendar calendarF = Calendar.getInstance();
|
||||
calendarF.setTime(endDate);
|
||||
calendarF.add(Calendar.DAY_OF_YEAR, 1);
|
||||
endDate = calendarF.getTime();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(officeId)));
|
||||
//parameters.add(new ModelParameter(ClosingDayCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.PARAM_START_DATE, startDate));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.PARAM_END_DATE, endDate));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(ClosingDay.class, ClosingDayCfg.QUERY_FIND_ALL_CLOSING_DAY_BY_OFFICE_BETWEEN_DATES, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param status
|
||||
* @param closingDayIdToUpdate
|
||||
* @param lastUpdatedBy
|
||||
* @return
|
||||
*/
|
||||
public boolean updateClosingDayByStatus(ActiveStatus status, String closingDayIdToUpdate, String lastUpdatedBy) {
|
||||
logger.debug("updateClosingDayByStatus");
|
||||
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_ACTIVE_STATUS, status));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_LAST_UPDATED_BY, lastUpdatedBy));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_LAST_UPDATED_ON, new Date()));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_ID, closingDayIdToUpdate));
|
||||
|
||||
return genericEntityRepository.xmlUpdateOrDeleteAPCEntity(ClosingDayCfg.QUERY_UPDATE_CLOSING_DAY_BY_STATUS, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param closingDay
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean saveClosingDay(ClosingDay closingDay) {
|
||||
logger.debug("saveClosingDay");
|
||||
boolean success = genericEntityRepository.insertAPCEntity(closingDay);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching TotalCashByCurdateView by id.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public TotalCashByCurdateView getTotalCashByCurdateViewById(String id) {
|
||||
logger.debug("getTotalCashByCurdateViewById");
|
||||
|
||||
return (TotalCashByCurdateView) genericEntityRepository.selectAPCEntityById(TotalCashByCurdateView.class, id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all total money day by office.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<TotalCashByCurdateView> getAllTotalCashByCurdateView(String officeId) {
|
||||
logger.debug("getAllTotalCashByCurdateView");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_VIEW_OFFICE, officeId));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(TotalCashByCurdateView.class, ClosingDayCfg.QUERY_FIND_TOTAL_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
public List<TotalCashByCurdateDashboardView> getAllTotalCashByCurdateDashboardView(String officeId) {
|
||||
logger.debug("getAllTotalCashByCurdateDashboardView");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_VIEW_OFFICE, officeId));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(TotalCashByCurdateDashboardView.class, ClosingDayCfg.QUERY_FIND_TOTAL_DASHBOARD_BY_OFFICE, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all TotalClosingDayByCurdateView by curdate.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<TotalClosingDayByCurdateView> findAllClosingDayByCurdate(String officeId) {
|
||||
logger.debug("findAllClosingDayByCurdate");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_VIEW_OFFICE, officeId));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(TotalClosingDayByCurdateView.class, ClosingDayCfg.QUERY_FIND_ALL_CLOSING_DAY_BY_CURDATE, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all ClosingDailyDetailFromUserByCurdateView by curdate.
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<ClosingDailyDetailFromUserByCurdateView> findAllClosingDailyDetailFromUserByCurdateView(String userId) {
|
||||
logger.debug("findAllClosingDailyDetailFromUserByCurdateView");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDailyDetailFromUserByCurdateCfg.FIELD_VIEW_USER, userId));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(ClosingDailyDetailFromUserByCurdateView.class, ClosingDailyDetailFromUserByCurdateCfg.QUERY_FIND_ALL_DETAILS, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all ClosingDailyDetailFromUserByCurdateView by curdate.
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<ClosingDailyDetailFromUserByCurdateView> findAllClosingDailyDetailFromUserCertifierByCurdateView(String userId) {
|
||||
logger.debug("findAllClosingDailyDetailFromUserCertifierByCurdateView");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDailyDetailFromUserByCurdateCfg.FIELD_VIEW_USER, userId));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(ClosingDailyDetailFromUserByCurdateView.class, ClosingDailyDetailFromUserByCurdateCfg.QUERY_FIND_ALL_DETAILS_CERTIFIER, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching the num by closing day
|
||||
*
|
||||
* @param num for closing day
|
||||
* @return
|
||||
*/
|
||||
public Long getClosingDayCurdateByUserId(String userId, String officeid) {
|
||||
logger.debug("getClosingDayCurdateByUserId");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_USER, new User(userId)));
|
||||
parameters.add(new ModelParameter(ClosingDayCfg.FIELD_OFFICE, new Office(officeid)));
|
||||
|
||||
return (Long) genericEntityRepository.xmlQueryAPCEntityUniqueResult(Long.class, ClosingDayCfg.QUERY_COUNT_CLOSING_DATE_BY_USER_AND_OFFICE, parameters);
|
||||
}
|
||||
|
||||
public Long getLoansCountDailyByUser(String userId) {
|
||||
logger.debug("getLoansCountDailyByUser");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(TotalLoansByOfficeViewCfg.FIELD_VIEW_USER, userId));
|
||||
|
||||
return (Long) genericEntityRepository.xmlQueryAPCEntityUniqueResult(Long.class, TotalLoansByOfficeViewCfg.QUERY_COUNT_ALL_LOANS_BY_USER, parameters);
|
||||
}
|
||||
|
||||
public List<LoanByUserPaymentZeroView> getLoansPaymentZeroByUser(String userId) {
|
||||
logger.debug("getLoansPaymentZeroByUser");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanByUserPaymentZeroViewCfg.FIELD_VIEW_USER, new User(userId)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(LoanByUserPaymentZeroView.class, LoanByUserPaymentZeroViewCfg.QUERY_FIND_ALL_LOANS_PAYMENT_ZERO_BY_USER, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param details
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean saveClosingDayDetail(List<ClosingDayDetail> details) {
|
||||
logger.debug("saveClosingDayDetail");
|
||||
boolean success = genericEntityRepository.insertManyAPCEntity(details);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching closing day by id.
|
||||
*
|
||||
* @param closingDayId
|
||||
* @return
|
||||
*/
|
||||
public ClosingDay getClosingDayById(String closingDayId) {
|
||||
logger.debug("getClosingDayById");
|
||||
|
||||
return (ClosingDay) genericEntityRepository.selectAPCEntityById(ClosingDay.class, closingDayId);
|
||||
}
|
||||
|
||||
public List<ClosingDayDetail> getClosingDayDetailByIdClosingDay(String closingDay) {
|
||||
logger.debug("getClosingDayDetailByIdClosingDay");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(ClosingDayDetailCfg.FIELD_CLOSING_DAY, new ClosingDay(closingDay)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(ClosingDayDetail.class, ClosingDayDetailCfg.QUERY_FIND_ALL_CLOSING_DAY_DETAIL_BY_ID, parameters);
|
||||
}
|
||||
|
||||
public User getUserById(String userId) {
|
||||
logger.debug("getUserById");
|
||||
|
||||
return (User) genericEntityRepository.selectAPCEntityById(User.class, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public boolean existNextPaidClosingDayByCreatedOn(Date date) {
|
||||
logger.info("existNextPaidClosingDayByCreatedOn");
|
||||
|
||||
String query = "SELECT cd.id "
|
||||
+ "FROM APC_CLOSING_DAY cd "
|
||||
+ "WHERE DATE(cd.created_on) >= DATE_ADD(DATE(:date), INTERVAL 1 DAY) "
|
||||
+ "AND cd.active_status = 'ENEBLED'";
|
||||
|
||||
return genericEntityRepository.existRecordsUsingSQLQueryFindByCreatedOnField(date, query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public boolean existStableSmallBoxByCreatedOn(Date date) {
|
||||
logger.info("existStableSmallBoxByCreatedOn");
|
||||
|
||||
String query = "SELECT ssb.id "
|
||||
+ "FROM APC_STABLE_SMALL_BOX ssb "
|
||||
+ "WHERE DATE(ssb.created_on) = DATE(:date) "
|
||||
+ "AND ssb.active_status = 'ENEBLED'";
|
||||
|
||||
return genericEntityRepository.existRecordsUsingSQLQueryFindByCreatedOnField(date, query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<Object> findDetailsFromClosingDayCurDate(String userId){
|
||||
logger.debug("findDetailsFromClosingDayCurDate");
|
||||
|
||||
List<Object> rows = new ArrayList<>();
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
rows = session.createNativeQuery(queryClosingDayReport).setParameter("userId", userId).getResultList();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Driver", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method findDetailsFromClosingDayCurDate(" + userId + " " + ") ", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
public List<Object> findDetailsFromClosingDayHisotry(String idClosingDay){
|
||||
logger.debug("findDetailsFromClosingDayCurDate");
|
||||
|
||||
List<Object> rows = new ArrayList<>();
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
rows = session.createNativeQuery(queryClosingDayReportHistory).setParameter("idClosingDay", idClosingDay).getResultList();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Driver", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method findDetailsFromClosingDayHistory(" + idClosingDay + " " + ") ", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching people.
|
||||
*
|
||||
* @param peopleId
|
||||
* @return
|
||||
*/
|
||||
public People findPeopleById(String peopleId) {
|
||||
logger.debug("findPeopleById");
|
||||
|
||||
return (People) genericEntityRepository.selectAPCEntityById(User.class, peopleId);
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(ClosingDayController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public ClosingDayController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
|
||||
private final String queryClosingDayReport =
|
||||
"SELECT " +
|
||||
"cldd.comments, " +
|
||||
"cldd.amount, " +
|
||||
"cldd.type, " +
|
||||
"cldd.saldo, " +
|
||||
"cldd.created_on, " +
|
||||
"cldd.comisionApertura, " +
|
||||
"cldd.prestamoAnterior, " +
|
||||
"cldd.route, " +
|
||||
"CONCAT(hr.first_name,' ',IF(ISNULL(hr.second_name) ,'', CONCAT(hr.second_name, ' ')),hr.last_name,' ', hr.middle_name) AS username, " +
|
||||
"(SELECT sum(tc.total_amount_payment) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as total_amount_payment, " +
|
||||
"(SELECT sum(tc.total_amount_deposit) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as total_amount_deposit, " +
|
||||
"(SELECT sum(tc.transfer_sender) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as transfer_sender, " +
|
||||
"(SELECT sum(tc.transfer_receiver) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as transfer_receiver, " +
|
||||
"(SELECT sum(tc.money_daily) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as money_daily, " +
|
||||
"(SELECT sum(tc.other_expense) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as other_expense, " +
|
||||
"(SELECT sum(tc.delivery) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as delivery, " +
|
||||
"(SELECT sum(tc.transfer_pending) FROM APC_TOTAL_CASH_BY_CURDATE_VIEW tc where id = :userId) as transfer_pending " +
|
||||
"FROM " +
|
||||
" APC_CLOSING_DAILY_DETAIL_FROM_USER_BY_CURDATE_VIEW_REPORT cldd " +
|
||||
"INNER JOIN " +
|
||||
" APC_USER u ON u.id = cldd.id_user " +
|
||||
"INNER JOIN " +
|
||||
" APC_HUMAN_RESOURCE hr ON hr.id = u.id_human_resource " +
|
||||
"WHERE " +
|
||||
" cldd.id_user = :userId " +
|
||||
"ORDER BY " +
|
||||
" cldd.created_on ASC";
|
||||
|
||||
|
||||
private final String queryClosingDayReportHistory =
|
||||
" SELECT " +
|
||||
" cldd.comments, " +
|
||||
" cldd.amount, " +
|
||||
" cldd.type, " +
|
||||
" cldd.created_on, " +
|
||||
" cd.amount_expected, " +
|
||||
" cd.amount_paid, " +
|
||||
" CONCAT(hr.first_name,' ',IF(ISNULL(hr.second_name) ,'', CONCAT(hr.second_name, ' ')),hr.last_name,' ', hr.middle_name) AS username, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Abono' AND cld.id_closing_day = :idClosingDay) as total_amount_payment, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Depósito' AND cld.id_closing_day = :idClosingDay) as total_amount_deposit, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Transferencia enviada' AND cld.id_closing_day = :idClosingDay) as transfer_sender, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Transferencia recibida' AND cld.id_closing_day = :idClosingDay) as transfer_receiver, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Inicio' AND cld.id_closing_day = :idClosingDay) as money_daily, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Gasto' AND cld.id_closing_day = :idClosingDay) as other_expense, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Entrega de préstamo' AND cld.id_closing_day = :idClosingDay) as delivery, " +
|
||||
" (SELECT IFNULL(SUM(cld.amount),0) FROM APC_CLOSING_DAY_DETAIL cld WHERE cld.type='Multa' AND cld.id_closing_day = :idClosingDay) as total_amount_fee, " +
|
||||
" cldd.dateDetail "+
|
||||
" FROM " +
|
||||
" APC_CLOSING_DAY_DETAIL cldd " +
|
||||
" INNER JOIN " +
|
||||
" APC_CLOSING_DAY cd on cldd.id_closing_day = cd.id" +
|
||||
" INNER JOIN" +
|
||||
" APC_USER u ON u.id = cd.id_user " +
|
||||
" INNER JOIN " +
|
||||
" APC_HUMAN_RESOURCE hr ON hr.id = u.id_human_resource " +
|
||||
" WHERE " +
|
||||
" cldd.id_closing_day = :idClosingDay" +
|
||||
" ORDER BY" +
|
||||
" cldd.created_on ASC; ";
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.controller.util.HibernateUtil;
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.catalog.constance.PeopleCfg;
|
||||
import com.arrebol.apc.model.core.User;
|
||||
import com.arrebol.apc.model.core.constance.LoanCfg;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.model.views.LoanDetailZeroView;
|
||||
import com.arrebol.apc.model.views.LoanFinishedView;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class CustomerController extends PeopleController implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all customers.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<People> fillCustomersDatatable(String officeId) {
|
||||
logger.debug("fillCustomersDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(People.class, PeopleCfg.QUERY_FIND_ALL_CUSTOMER, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all loan by customer.
|
||||
*
|
||||
* @param peopleId
|
||||
* @return
|
||||
*/
|
||||
public List<Loan> findLoanByCustomer(String peopleId) {
|
||||
logger.debug("findLoanByCustomer");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_CUSTOMER, new People(peopleId)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Loan.class, LoanCfg.QUERY_FIND_LOAN_BY_CUSTOMER, parameters);
|
||||
}
|
||||
|
||||
public List<Loan> findLoanByCustomerLimit(String peopleId) {
|
||||
logger.debug("findLoanByCustomer");
|
||||
List<Loan> results = new ArrayList<>();
|
||||
|
||||
Transaction transaction = null;
|
||||
|
||||
try {
|
||||
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
|
||||
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
|
||||
|
||||
results = session.createQuery("SELECT l FROM Loan l WHERE customer = :customer AND loanStatus != 'DELETED' ORDER BY createdOn DESC")
|
||||
.setParameter("customer", peopleId)
|
||||
.setMaxResults(2)
|
||||
.getResultList();
|
||||
|
||||
transaction.commit();
|
||||
|
||||
logger.info("Closing daily detail's list " + results.size());
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Can not find closing daily details list", e);
|
||||
rollback(transaction);
|
||||
} catch (Exception e) {
|
||||
logger.error("Method findDetailsFromClosingDayID()", e);
|
||||
rollback(transaction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all loan for juridical.
|
||||
*
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
public List<Loan> findLoanJuridical(String idUser) {
|
||||
logger.debug("findLoanJuridical");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_USER, new User(idUser)));
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Loan.class, LoanCfg.QUERY_FIND_LOAN_JURIDICAL, parameters);
|
||||
}
|
||||
|
||||
public List<LoanDetailZeroView> findLoanZero( ) {
|
||||
logger.debug("findLoanZero");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
return genericEntityRepository.xmlQueryAPCEntities(LoanDetailZeroView.class, LoanCfg.QUERY_FIND_LOAN_ZERO, parameters);
|
||||
}
|
||||
|
||||
public List<LoanFinishedView> findLoanFinished( ) {
|
||||
logger.debug("findLoanFinished");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
return genericEntityRepository.xmlQueryAPCEntities(LoanFinishedView.class, LoanCfg.QUERY_FIND_LOAN_FINISHED, parameters);
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(CustomerController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public CustomerController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
|
||||
protected void rollback(Transaction transaction) {
|
||||
if (null != transaction) {
|
||||
transaction.rollback();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Arrebol Consultancy copyright.
|
||||
*
|
||||
* This code belongs to Arrebol Consultancy
|
||||
* its use, redistribution or modification are prohibited
|
||||
* without written authorization from Arrebol Consultancy.
|
||||
*/
|
||||
package com.arrebol.apc.controller.admin;
|
||||
|
||||
import com.arrebol.apc.model.ModelParameter;
|
||||
import com.arrebol.apc.model.catalog.People;
|
||||
import com.arrebol.apc.model.catalog.constance.PeopleCfg;
|
||||
import com.arrebol.apc.model.core.constance.LoanCfg;
|
||||
import com.arrebol.apc.model.enums.ActiveStatus;
|
||||
import com.arrebol.apc.model.loan.Loan;
|
||||
import com.arrebol.apc.repository.GenericEntityRepository;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
|
||||
*/
|
||||
public class EndorsementController extends PeopleController implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all endorsement.
|
||||
*
|
||||
* @param officeId
|
||||
* @return
|
||||
*/
|
||||
public List<People> fillEndorsementsDatatable(String officeId) {
|
||||
logger.debug("fillEndorsementsDatatable");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(PeopleCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(People.class, PeopleCfg.QUERY_FIND_ALL_ENDORSEMENT, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Searching all loan by endorsement.
|
||||
*
|
||||
* @param peopleId
|
||||
* @return
|
||||
*/
|
||||
public List<Loan> findLoanByEndorsement(String peopleId) {
|
||||
logger.debug("findLoanByEndorsement");
|
||||
List<ModelParameter> parameters = new ArrayList<>();
|
||||
|
||||
parameters.add(new ModelParameter(LoanCfg.FIELD_ENDORSEMENT, new People(peopleId)));
|
||||
|
||||
return genericEntityRepository.xmlQueryAPCEntities(Loan.class, LoanCfg.QUERY_FIND_LOAN_BY_ENDORSEMENT, parameters);
|
||||
}
|
||||
|
||||
final Logger logger = LogManager.getLogger(EndorsementController.class);
|
||||
private final GenericEntityRepository genericEntityRepository;
|
||||
|
||||
public EndorsementController() {
|
||||
this.genericEntityRepository = new GenericEntityRepository();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user