feat: store detail ok
parent
1020d4ad1e
commit
66f98461e5
|
|
@ -186,11 +186,16 @@ public class StoreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/sequence")
|
@Path("/{storeId}/sequence")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getSequence(
|
public Response getSequence(
|
||||||
|
@PathParam("storeId") Integer storeId,
|
||||||
@QueryParam("dbHost") String dbHost) {
|
@QueryParam("dbHost") String dbHost) {
|
||||||
|
|
||||||
|
if(storeId == null) {
|
||||||
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"storeId parameter is required\"}").build();
|
||||||
|
}
|
||||||
|
|
||||||
if (dbHost == null) {
|
if (dbHost == null) {
|
||||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||||
}
|
}
|
||||||
|
|
@ -233,11 +238,16 @@ public class StoreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/signature")
|
@Path("/{storeId}/signature")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getSignature(
|
public Response getSignature(
|
||||||
|
@PathParam("storeId") Integer storeId,
|
||||||
@QueryParam("dbHost") String dbHost) {
|
@QueryParam("dbHost") String dbHost) {
|
||||||
|
|
||||||
|
if(storeId == null) {
|
||||||
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"storeId parameter is required\"}").build();
|
||||||
|
}
|
||||||
|
|
||||||
if (dbHost == null) {
|
if (dbHost == null) {
|
||||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||||
}
|
}
|
||||||
|
|
@ -279,11 +289,16 @@ public class StoreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/version")
|
@Path("/{storeId}/version")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getVersion(
|
public Response getVersion(
|
||||||
|
@PathParam("storeId") Integer storeId,
|
||||||
@QueryParam("dbHost") String dbHost) {
|
@QueryParam("dbHost") String dbHost) {
|
||||||
|
|
||||||
|
if(storeId == null) {
|
||||||
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"storeId parameter is required\"}").build();
|
||||||
|
}
|
||||||
|
|
||||||
if (dbHost == null) {
|
if (dbHost == null) {
|
||||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||||
}
|
}
|
||||||
|
|
@ -352,7 +367,8 @@ public class StoreService {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getStoreDetails(
|
public Response getStoreDetails(
|
||||||
@PathParam("storeId") Integer storeId,
|
@PathParam("storeId") Integer storeId,
|
||||||
@QueryParam("dbHost") String dbHost) {
|
@QueryParam("dbHost") String dbHost,
|
||||||
|
@QueryParam("workstationId") Integer workstationId) {
|
||||||
|
|
||||||
if (dbHost == null) {
|
if (dbHost == null) {
|
||||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||||
|
|
@ -363,7 +379,7 @@ public class StoreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StoreDetails storeDetails = retrieveStoreDetails(dbHost,storeId);
|
StoreDetails storeDetails = retrieveStoreDetails(dbHost,storeId,workstationId);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
|
|
@ -385,15 +401,159 @@ public class StoreService {
|
||||||
/**
|
/**
|
||||||
* Retrieves storeDetails from the database.
|
* Retrieves storeDetails from the database.
|
||||||
*
|
*
|
||||||
* @return a list of stores retrieved from the database
|
* @param dbHost the host of the database
|
||||||
*/
|
* @param storeId the ID of the store
|
||||||
private StoreDetails retrieveStoreDetails(String dbHost, Integer storeId) {
|
* @param workstationId the ID of the workstation
|
||||||
|
* @return storeDetails
|
||||||
|
*/
|
||||||
|
private StoreDetails retrieveStoreDetails(String dbHost, Integer storeId, Integer workstationId) {
|
||||||
DriverManager.setLoginTimeout(5);
|
DriverManager.setLoginTimeout(5);
|
||||||
|
|
||||||
StoreDetails storeDetails = new StoreDetails(); // Declare object outside try blocks
|
StoreDetails storeDetails = new StoreDetails(); // Declare object outside try blocks
|
||||||
|
|
||||||
|
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
||||||
|
// Replication section
|
||||||
|
String replicationQuery = "SELECT COUNT(*) AS pendingReplications, " +
|
||||||
|
"MIN(crq.CREATE_DATE) AS minPendingReplicationDate, " +
|
||||||
|
"MAX(crq.CREATE_DATE) AS maxPendingReplicationDate " +
|
||||||
|
"FROM repqueue.CTL_REPLICATION_QUEUE crq";
|
||||||
|
|
||||||
|
logger.info(replicationQuery);
|
||||||
|
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(replicationQuery);
|
||||||
|
ResultSet storeReplicationResultSet = storeStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (storeReplicationResultSet.next()) {
|
||||||
|
StoreReplication storeReplication = mapResultSetToStoreReplication(storeReplicationResultSet);
|
||||||
|
storeDetails.setReplication(storeReplication);
|
||||||
|
} else {
|
||||||
|
// Adjust to the desired behavior if no results are found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// opening transation section
|
||||||
|
String openingTransactionQuery = "SELECT"+
|
||||||
|
" COUNT(*) AS counter,"+
|
||||||
|
" MIN(tt.END_DATETIME) AS minDate,"+
|
||||||
|
" MAX(tt.END_DATETIME) AS maxDate"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt.BUSINESS_DATE = ("+
|
||||||
|
" SELECT"+
|
||||||
|
" MAX(tt_bdate.BUSINESS_DATE) as bd"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt_bdate"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt_bdate.trans_TYPCODE = 'WORKSTATION_OPEN'"+
|
||||||
|
" AND tt_bdate.TRANS_STATCODE = 'COMPLETE'"+
|
||||||
|
" )"+
|
||||||
|
" AND tt.trans_TYPCODE = 'WORKSTATION_OPEN'"+
|
||||||
|
" AND tt.TRANS_STATCODE = 'COMPLETE'" ;
|
||||||
|
|
||||||
|
logger.info(openingTransactionQuery);
|
||||||
|
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(openingTransactionQuery);
|
||||||
|
ResultSet openingTransactionResultSet = storeStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (openingTransactionResultSet.next()) {
|
||||||
|
XstoreTransaction openingTransaction = mapResultSetToXstoreOpeningTransaction(openingTransactionResultSet);
|
||||||
|
storeDetails.setOpeningTransaction(openingTransaction);
|
||||||
|
} else {
|
||||||
|
// Adjust to the desired behavior if no results are found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Closing transation section
|
||||||
|
String closingTransactionQuery = "SELECT"+
|
||||||
|
" COUNT(*) AS counter,"+
|
||||||
|
" MIN(tt.END_DATETIME) AS minDate,"+
|
||||||
|
" MAX(tt.END_DATETIME) AS maxDate"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt.BUSINESS_DATE = ("+
|
||||||
|
" SELECT"+
|
||||||
|
" MAX(tt_bdate.BUSINESS_DATE)"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt_bdate"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt_bdate.trans_TYPCODE = 'WORKSTATION_OPEN'"+
|
||||||
|
" AND tt_bdate.TRANS_STATCODE = 'COMPLETE'"+
|
||||||
|
" )"+
|
||||||
|
" AND tt.trans_TYPCODE = 'WORKSTATION_CLOSE'"+
|
||||||
|
" AND tt.TRANS_STATCODE = 'COMPLETE'";
|
||||||
|
|
||||||
|
logger.info(closingTransactionQuery);
|
||||||
|
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(closingTransactionQuery);
|
||||||
|
ResultSet closingTransactionResultSet = storeStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (closingTransactionResultSet.next()) {
|
||||||
|
XstoreTransaction closingTransaction = mapResultSetToXstoreClosingTransaction(closingTransactionResultSet);
|
||||||
|
storeDetails.setClosingTransaction(closingTransaction);
|
||||||
|
} else {
|
||||||
|
// Adjust to the desired behavior if no results are found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sale transation section
|
||||||
|
String saleTransactionQuery = "SELECT"+
|
||||||
|
" COUNT(*) AS counter,"+
|
||||||
|
" MIN(tt.END_DATETIME) AS minDate,"+
|
||||||
|
" MAX(tt.END_DATETIME) AS maxDate"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt.BUSINESS_DATE = ("+
|
||||||
|
" SELECT"+
|
||||||
|
" MAX(tt_bdate.BUSINESS_DATE)"+
|
||||||
|
" FROM"+
|
||||||
|
" trn_trans tt_bdate"+
|
||||||
|
" WHERE"+
|
||||||
|
" tt_bdate.trans_TYPCODE = 'WORKSTATION_OPEN'"+
|
||||||
|
" AND tt_bdate.TRANS_STATCODE = 'COMPLETE'"+
|
||||||
|
" )"+
|
||||||
|
" AND tt.trans_TYPCODE = 'RETAIL_SALE'"+
|
||||||
|
" AND tt.TRANS_STATCODE = 'COMPLETE'";
|
||||||
|
|
||||||
|
logger.info(saleTransactionQuery);
|
||||||
|
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(saleTransactionQuery);
|
||||||
|
ResultSet saleTransactionResultSet = storeStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (saleTransactionResultSet.next()) {
|
||||||
|
XstoreTransaction saleTransaction = mapResultSetToXstoreSaleTransaction(saleTransactionResultSet);
|
||||||
|
storeDetails.setSaleTransaction(saleTransaction);
|
||||||
|
} else {
|
||||||
|
// Adjust to the desired behavior if no results are found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// version section
|
||||||
|
String versionQuery = "SELECT * FROM ( " +
|
||||||
|
" SELECT CUSTOMER,CUSTOMER_SCHEMA_VERSION,CUSTOMER_SCHEMA_DATE" +
|
||||||
|
" FROM dtv.CTL_VERSION_HISTORY" +
|
||||||
|
" WHERE organization_id = 1 AND customer IS NOT NULL" +
|
||||||
|
" ORDER BY seq DESC" +
|
||||||
|
" ) " +
|
||||||
|
" WHERE ROWNUM = 1";
|
||||||
|
|
||||||
|
logger.info(versionQuery);
|
||||||
|
try (PreparedStatement versionStatement = databaseConnection.getConnection().prepareStatement(versionQuery)) {
|
||||||
|
try (ResultSet versionResultSet = versionStatement.executeQuery()) {
|
||||||
|
if (versionResultSet.next()) {
|
||||||
|
storeDetails.setXstoreVersion(versionResultSet.getString("CUSTOMER_SCHEMA_VERSION"));
|
||||||
|
storeDetails.setXstoreVersionDate(versionResultSet.getDate("CUSTOMER_SCHEMA_DATE"));
|
||||||
|
storeDetails.setXstoreVersionCustomer(versionResultSet.getString("CUSTOMER"));
|
||||||
|
} else {
|
||||||
|
// Adjust to the desired behavior if no results are found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// Handle exceptions correctly in a production environment
|
||||||
|
}
|
||||||
|
|
||||||
try (DatabaseConnectDOTSOFT databaseConnection = new DatabaseConnectDOTSOFT("com02")) {
|
try (DatabaseConnectDOTSOFT databaseConnection = new DatabaseConnectDOTSOFT("com02")) {
|
||||||
// Store section FRED
|
// Store section
|
||||||
String storeQuery = "SELECT st.id_structure," +
|
String storeQuery = "SELECT st.id_structure," +
|
||||||
" TRIM(st.nom) as nom," +
|
" TRIM(st.nom) as nom," +
|
||||||
" st.tel1 as telephone," +
|
" st.tel1 as telephone," +
|
||||||
|
|
@ -424,7 +584,7 @@ public class StoreService {
|
||||||
Store store = mapResultSetToStore(storeResultSet);
|
Store store = mapResultSetToStore(storeResultSet);
|
||||||
storeDetails.setStore(store);
|
storeDetails.setStore(store);
|
||||||
} else {
|
} else {
|
||||||
// Adjust to the desired behavior if no results are found for the Store part.
|
// Adjust to the desired behavior if no results are found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -433,8 +593,7 @@ public class StoreService {
|
||||||
String transactionQuery = "SELECT COUNT(*) as backOfficeTransactions, " +
|
String transactionQuery = "SELECT COUNT(*) as backOfficeTransactions, " +
|
||||||
" MIN(cf.fdate_integration) AS minBackOfficeTransactionDate, " +
|
" MIN(cf.fdate_integration) AS minBackOfficeTransactionDate, " +
|
||||||
" MAX(cf.fdate_integration) AS maxBackOfficeTransactionDate, " +
|
" MAX(cf.fdate_integration) AS maxBackOfficeTransactionDate, " +
|
||||||
" TRUNC(MAX(cf.fdate)) AS backOfficeBusinessDate, " +
|
" TRUNC(MAX(cf.fdate)) AS backOfficeBusinessDate " +
|
||||||
" CASE WHEN TRUNC(MAX(cf.fdate)) = TRUNC(SYSDATE )THEN 1 ELSE 0 END AS backOfficeTransactionOk "+
|
|
||||||
"FROM com02.client_facture cf " +
|
"FROM com02.client_facture cf " +
|
||||||
"WHERE cf.id_structure = ? " +
|
"WHERE cf.id_structure = ? " +
|
||||||
"AND TRUNC(cf.fdate_integration) = TRUNC(SYSDATE) " + //TODO : changer la date
|
"AND TRUNC(cf.fdate_integration) = TRUNC(SYSDATE) " + //TODO : changer la date
|
||||||
|
|
@ -449,7 +608,7 @@ public class StoreService {
|
||||||
BackOfficeTransaction storetransaction = mapResultSetToBackOfficetransaction(transactionResultSet);
|
BackOfficeTransaction storetransaction = mapResultSetToBackOfficetransaction(transactionResultSet);
|
||||||
storeDetails.setTransaction(storetransaction);
|
storeDetails.setTransaction(storetransaction);
|
||||||
} else {
|
} else {
|
||||||
// Adjust to the desired behavior if no results are found for the transaction section.
|
// Adjust to the desired behavior if no results are found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -458,30 +617,6 @@ public class StoreService {
|
||||||
// Handle exceptions correctly in a production environment
|
// Handle exceptions correctly in a production environment
|
||||||
}
|
}
|
||||||
|
|
||||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
|
||||||
// Replication section
|
|
||||||
String replicationQuery = "SELECT COUNT(*) AS pendingReplications, " +
|
|
||||||
"MIN(crq.CREATE_DATE) AS minPendingReplicationDate, " +
|
|
||||||
"MAX(crq.CREATE_DATE) AS maxPendingReplicationDate, " +
|
|
||||||
"CASE WHEN MIN(crq.CREATE_DATE) IS NULL OR MIN(crq.CREATE_DATE) > SYSDATE - INTERVAL '5' MINUTE THEN 1 ELSE 0 END AS pendingReplicationOk "+
|
|
||||||
"FROM repqueue.CTL_REPLICATION_QUEUE crq";
|
|
||||||
|
|
||||||
logger.info(replicationQuery);
|
|
||||||
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(replicationQuery);
|
|
||||||
ResultSet storeReplicationResultSet = storeStatement.executeQuery()) {
|
|
||||||
|
|
||||||
if (storeReplicationResultSet.next()) {
|
|
||||||
StoreReplication storeReplication = mapResultSetToStoreReplication(storeReplicationResultSet);
|
|
||||||
storeDetails.setReplication(storeReplication);
|
|
||||||
} else {
|
|
||||||
// Adjust to the desired behavior if no results are found for the Replication section.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
// Handle exceptions correctly in a production environment
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the complete StoreDetails object
|
// Return the complete StoreDetails object
|
||||||
return storeDetails;
|
return storeDetails;
|
||||||
}
|
}
|
||||||
|
|
@ -500,22 +635,44 @@ public class StoreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private StoreReplication mapResultSetToStoreReplication(ResultSet resultSet) throws SQLException {
|
private StoreReplication mapResultSetToStoreReplication(ResultSet resultSet) throws SQLException {
|
||||||
boolean pendingReplicationOk = resultSet.getBoolean("pendingReplicationOk");
|
|
||||||
int pendingReplications = resultSet.getInt("pendingReplications");
|
int pendingReplications = resultSet.getInt("pendingReplications");
|
||||||
Date minPendingReplicationDate = resultSet.getDate("minPendingReplicationDate");
|
Date minPendingReplicationDate = resultSet.getDate("minPendingReplicationDate");
|
||||||
Date maxPendingReplicationDate = resultSet.getDate("maxPendingReplicationDate");
|
Date maxPendingReplicationDate = resultSet.getDate("maxPendingReplicationDate");
|
||||||
|
|
||||||
return new StoreReplication(pendingReplicationOk, pendingReplications, minPendingReplicationDate, maxPendingReplicationDate);
|
return new StoreReplication(pendingReplications, minPendingReplicationDate, maxPendingReplicationDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XstoreTransaction mapResultSetToXstoreOpeningTransaction(ResultSet resultSet) throws SQLException {
|
||||||
|
int count = resultSet.getInt("counter");
|
||||||
|
Date minDate = resultSet.getDate("minDate");
|
||||||
|
Date maxDate = resultSet.getDate("maxDate");
|
||||||
|
|
||||||
|
return new XstoreTransaction(count, minDate, maxDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XstoreTransaction mapResultSetToXstoreClosingTransaction(ResultSet resultSet) throws SQLException {
|
||||||
|
int count = resultSet.getInt("counter");
|
||||||
|
Date minDate = resultSet.getDate("minDate");
|
||||||
|
Date maxDate = resultSet.getDate("maxDate");
|
||||||
|
|
||||||
|
return new XstoreTransaction(count, minDate, maxDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XstoreTransaction mapResultSetToXstoreSaleTransaction(ResultSet resultSet) throws SQLException {
|
||||||
|
int count = resultSet.getInt("counter");
|
||||||
|
Date minDate = resultSet.getDate("minDate");
|
||||||
|
Date maxDate = resultSet.getDate("maxDate");
|
||||||
|
|
||||||
|
return new XstoreTransaction(count, minDate, maxDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BackOfficeTransaction mapResultSetToBackOfficetransaction(ResultSet resultSet) throws SQLException {
|
private BackOfficeTransaction mapResultSetToBackOfficetransaction(ResultSet resultSet) throws SQLException {
|
||||||
boolean backOfficeTransactionOk = resultSet.getBoolean("backOfficeTransactionOk");
|
|
||||||
int backofficeTransactions = resultSet.getInt("backOfficeTransactions");
|
int backofficeTransactions = resultSet.getInt("backOfficeTransactions");
|
||||||
Date minBackofficeTransactionDate = resultSet.getDate("minBackOfficeTransactionDate");
|
Date minBackofficeTransactionDate = resultSet.getDate("minBackOfficeTransactionDate");
|
||||||
Date maxBackofficeTransactionDate = resultSet.getDate("maxBackOfficeTransactionDate");
|
Date maxBackofficeTransactionDate = resultSet.getDate("maxBackOfficeTransactionDate");
|
||||||
Date backOfficeBusinessDate = resultSet.getDate("backOfficeBusinessDate");
|
Date backOfficeBusinessDate = resultSet.getDate("backOfficeBusinessDate");
|
||||||
|
|
||||||
return new BackOfficeTransaction(backOfficeTransactionOk, backofficeTransactions, minBackofficeTransactionDate, maxBackofficeTransactionDate, backOfficeBusinessDate);
|
return new BackOfficeTransaction(backofficeTransactions, minBackofficeTransactionDate, maxBackofficeTransactionDate, backOfficeBusinessDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private StoreVersion mapResultSetToStoreVersion(ResultSet resultSet) throws SQLException {
|
private StoreVersion mapResultSetToStoreVersion(ResultSet resultSet) throws SQLException {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import java.sql.Date;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
public class BackOfficeTransaction {
|
public class BackOfficeTransaction {
|
||||||
private boolean backOfficeTransactionOk;
|
|
||||||
private int backOfficeTransactions;
|
private int backOfficeTransactions;
|
||||||
private Date minBackOfficeTransactionDate;
|
private Date minBackOfficeTransactionDate;
|
||||||
private Date maxBackOfficeTransactionDate;
|
private Date maxBackOfficeTransactionDate;
|
||||||
|
|
@ -17,8 +16,7 @@ public class BackOfficeTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor with parameters
|
// Constructor with parameters
|
||||||
public BackOfficeTransaction(boolean backOfficeTransactionOk, int backOfficeTransactions, Date minbackOfficeTransactionDate, Date maxbackOfficeTransactionDate, Date backOfficeBusinessDate) {
|
public BackOfficeTransaction(int backOfficeTransactions, Date minbackOfficeTransactionDate, Date maxbackOfficeTransactionDate, Date backOfficeBusinessDate) {
|
||||||
this.backOfficeTransactionOk = backOfficeTransactionOk;
|
|
||||||
this.backOfficeTransactions = backOfficeTransactions;
|
this.backOfficeTransactions = backOfficeTransactions;
|
||||||
this.minBackOfficeTransactionDate = minbackOfficeTransactionDate;
|
this.minBackOfficeTransactionDate = minbackOfficeTransactionDate;
|
||||||
this.maxBackOfficeTransactionDate = maxbackOfficeTransactionDate;
|
this.maxBackOfficeTransactionDate = maxbackOfficeTransactionDate;
|
||||||
|
|
@ -26,15 +24,6 @@ public class BackOfficeTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters et setters
|
// Getters et setters
|
||||||
|
|
||||||
public boolean isBackOfficeTransactionOk() {
|
|
||||||
return backOfficeTransactionOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackOfficeTransactionOk(boolean backOfficeTransactionOk) {
|
|
||||||
this.backOfficeTransactionOk = backOfficeTransactionOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBackOfficeTransactions() {
|
public int getBackOfficeTransactions() {
|
||||||
return backOfficeTransactions;
|
return backOfficeTransactions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,34 @@
|
||||||
package com.example.services.store;
|
package com.example.services.store;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
public class StoreDetails {
|
public class StoreDetails {
|
||||||
private Store store;
|
private Store store;
|
||||||
private StoreReplication replication;
|
private StoreReplication replication;
|
||||||
private BackOfficeTransaction transaction;
|
private BackOfficeTransaction transaction;
|
||||||
|
private XstoreTransaction openingTransaction;
|
||||||
|
private XstoreTransaction closingTransaction;
|
||||||
|
private XstoreTransaction saleTransaction;
|
||||||
|
private String xstoreVersion;
|
||||||
|
private Date xstoreVersionDate;
|
||||||
|
private String xstoreVersionCustomer;
|
||||||
|
|
||||||
|
|
||||||
public StoreDetails() {
|
public StoreDetails() {
|
||||||
// Constructeur par défaut nécessaire pour la désérialisation JSON
|
// Constructeur par défaut nécessaire pour la désérialisation JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoreDetails(Store store, StoreReplication replication, BackOfficeTransaction transaction) {
|
public StoreDetails(Store store, StoreReplication replication, BackOfficeTransaction transaction, XstoreTransaction openingTransaction, XstoreTransaction closingTransaction, XstoreTransaction saleTransaction, String xstoreVersion, Date xstoreVersionDate, String xstoreVersionCustomer) {
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.replication = replication;
|
this.replication = replication;
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
|
this.openingTransaction = openingTransaction;
|
||||||
|
this.closingTransaction = closingTransaction;
|
||||||
|
this.saleTransaction = saleTransaction;
|
||||||
|
this.xstoreVersion = xstoreVersion;
|
||||||
|
this.xstoreVersionDate = xstoreVersionDate;
|
||||||
|
this.xstoreVersionCustomer = xstoreVersionCustomer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Store getStore() {
|
public Store getStore() {
|
||||||
|
|
@ -38,5 +54,58 @@ public class StoreDetails {
|
||||||
public void setTransaction(BackOfficeTransaction transaction) {
|
public void setTransaction(BackOfficeTransaction transaction) {
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XstoreTransaction getOpeningTransaction() {
|
||||||
|
return openingTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpeningTransaction(XstoreTransaction openingTransaction) {
|
||||||
|
this.openingTransaction = openingTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XstoreTransaction getClosingTransaction() {
|
||||||
|
return closingTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClosingTransaction(XstoreTransaction closingTransaction) {
|
||||||
|
this.closingTransaction = closingTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XstoreTransaction getSaleTransaction() {
|
||||||
|
return saleTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleTransaction(XstoreTransaction saleTransaction) {
|
||||||
|
this.saleTransaction = saleTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXstoreVersion() {
|
||||||
|
return xstoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXstoreVersion(String xstoreVersion) {
|
||||||
|
this.xstoreVersion = xstoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXstoreVersionDate() {
|
||||||
|
if (xstoreVersionDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
return dateFormat.format(xstoreVersionDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXstoreVersionDate(Date xstoreVersionDate) {
|
||||||
|
this.xstoreVersionDate = xstoreVersionDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXstoreVersionCustomer() {
|
||||||
|
return xstoreVersionCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXstoreVersionCustomer(String xstoreVersionCustomer) {
|
||||||
|
this.xstoreVersionCustomer = xstoreVersionCustomer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import java.sql.Date;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
public class StoreReplication {
|
public class StoreReplication {
|
||||||
private boolean pendingReplicationOk;
|
|
||||||
private int pendingReplications;
|
private int pendingReplications;
|
||||||
private Date minPendingReplicationDate;
|
private Date minPendingReplicationDate;
|
||||||
private Date maxPendingReplicationDate;
|
private Date maxPendingReplicationDate;
|
||||||
|
|
@ -15,23 +14,13 @@ public class StoreReplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructeur avec paramètres
|
// Constructeur avec paramètres
|
||||||
public StoreReplication(boolean pendingReplicationOk, int pendingReplications, Date minPendingReplicationDate, Date maxPendingReplicationDate) {
|
public StoreReplication(int pendingReplications, Date minPendingReplicationDate, Date maxPendingReplicationDate) {
|
||||||
this.pendingReplicationOk = pendingReplicationOk;
|
|
||||||
this.pendingReplications = pendingReplications;
|
this.pendingReplications = pendingReplications;
|
||||||
this.minPendingReplicationDate = minPendingReplicationDate;
|
this.minPendingReplicationDate = minPendingReplicationDate;
|
||||||
this.maxPendingReplicationDate = maxPendingReplicationDate;
|
this.maxPendingReplicationDate = maxPendingReplicationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters et setters
|
// Getters et setters
|
||||||
|
|
||||||
public boolean isPendingReplicationOk() {
|
|
||||||
return pendingReplicationOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPendingReplicationOk(boolean replicationOk) {
|
|
||||||
this.pendingReplicationOk = replicationOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPendingReplications() {
|
public int getPendingReplications() {
|
||||||
return pendingReplications;
|
return pendingReplications;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.example.services.store;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
public class XstoreTransaction {
|
||||||
|
private int count;
|
||||||
|
private Date minDate;
|
||||||
|
private Date maxDate;
|
||||||
|
private String minDateT;
|
||||||
|
private String minDateH;
|
||||||
|
private String maxDateT;
|
||||||
|
private String maxDateH;
|
||||||
|
|
||||||
|
// Default constructor
|
||||||
|
public XstoreTransaction() {
|
||||||
|
// Default constructor required for JSON deserialization
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor with parameters
|
||||||
|
public XstoreTransaction(int count, Date minDate, Date maxDate) {
|
||||||
|
this.count = count;
|
||||||
|
this.minDate = minDate;
|
||||||
|
this.maxDate = maxDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters et setters
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(int count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMinDate() {
|
||||||
|
if (minDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
return dateFormat.format(minDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinDate(Date minDate) {
|
||||||
|
this.minDate = minDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxDate() {
|
||||||
|
if (maxDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
return dateFormat.format(maxDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxDate(Date maxDate) {
|
||||||
|
this.maxDate = maxDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMinDateT() {
|
||||||
|
if (minDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
return dateFormat.format(minDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMinDateH() {
|
||||||
|
if (minDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
return dateFormat.format(minDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxDateT() {
|
||||||
|
if (maxDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
return dateFormat.format(maxDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxDateH() {
|
||||||
|
if (maxDate != null) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
return dateFormat.format(maxDate);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue