feat: store_retail
parent
05e5b334f7
commit
99d6e8d5e0
|
|
@ -15,16 +15,21 @@ public class DatabaseConnectDOTSOFT implements AutoCloseable {
|
|||
|
||||
private Connection connection;
|
||||
|
||||
public DatabaseConnectDOTSOFT(String username) throws SQLException {
|
||||
public DatabaseConnectDOTSOFT(String username) {
|
||||
String environment = loadEnvironment();
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty(environment + ".db.url");
|
||||
String userpassword = dbProperties.getProperty(environment + ".db." + username + ".password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("DOTSOFT Connection OK for user " + username + " on environment " + environment);
|
||||
try {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty(environment + ".db.url");
|
||||
String userpassword = dbProperties.getProperty(environment + ".db." + username + ".password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("DOTSOFT Connection OK for user " + username + " on environment " + environment);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Failed to connect to DOTSOFT database for user " + username + " on environment " + environment, e);
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection() {
|
||||
|
|
|
|||
|
|
@ -15,16 +15,19 @@ public class DatabaseConnectXSTORE implements AutoCloseable {
|
|||
|
||||
private Connection connection;
|
||||
|
||||
public DatabaseConnectXSTORE(String dbHost, String username) throws SQLException {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty("xstore.db.url").replace("HOST", dbHost);
|
||||
String userpassword = dbProperties.getProperty("xstore.db." + username + ".password");
|
||||
|
||||
// Initialiser votre connexion à la base de données ici
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("XSTORE Connection OK for user " + username + " on host " + dbHost);
|
||||
public DatabaseConnectXSTORE(String dbHost, String username) {
|
||||
try {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty("xstore.db.url").replace("HOST", dbHost);
|
||||
String userpassword = dbProperties.getProperty("xstore.db." + username + ".password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("XSTORE Connection OK for user " + username + " on host " + dbHost);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Failed to connect to XSTORE database for user " + username + " on host " + dbHost, e);
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection() {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package com.example.services;
|
||||
|
||||
import com.example.services.item.Item;
|
||||
import com.example.services.item.ItemDetails;
|
||||
import com.example.services.item.ItemOption;
|
||||
import com.example.services.item.ItemPrices;
|
||||
import com.example.services.item.ItemPrice;
|
||||
import com.example.services.item.ItemStock;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
|
@ -32,20 +32,22 @@ public class ItemService {
|
|||
private static final Logger logger = LoggerFactory.getLogger(DatabaseConnectDOTSOFT.class);
|
||||
|
||||
@GET
|
||||
@Path("/get")
|
||||
@Path("/{itemId}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getItemById(
|
||||
@QueryParam("dbHost") String dbHost,
|
||||
@QueryParam("itemId") String itemId) {
|
||||
@PathParam("itemId") String itemId,
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
} else if (itemId.length() < 6) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"Length of itemId must be greater than or equal to 6\"}").build();
|
||||
}
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost, "dtv")) {
|
||||
|
|
@ -63,13 +65,166 @@ public class ItemService {
|
|||
itemList.add(item);
|
||||
}
|
||||
|
||||
if (!itemList.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"No items found\"}").build();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemList);
|
||||
|
||||
return Response.ok(jsonResponse).build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace(); // Gérer les exceptions correctement dans un environnement de production
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{itemId}/options")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getItemOptionsById(
|
||||
@PathParam("itemId") String itemId,
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
} else if (itemId.length() < 6) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"Length of itemId must be greater than or equal to 6\"}").build();
|
||||
}
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost, "dtv")) {
|
||||
String query = "SELECT item_id,level_code,level_value,item_availability_code,tax_group_id,Vendor,season_code,create_date,create_user_id,update_date,update_user_id " +
|
||||
"FROM dtv.ITM_ITEM_OPTIONS " +
|
||||
"WHERE ORGANIZATION_ID = 1 AND ITEM_ID LIKE ?";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
List<ItemOption> itemOptionList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
ItemOption itemOption = mapResultSetToItemOptionDetails(resultSet);
|
||||
itemOptionList.add(itemOption);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemOptionList);
|
||||
|
||||
return Response.ok(jsonResponse).build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace(); // Gérer les exceptions correctement dans un environnement de production
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{itemId}/price")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getItemPricesById(
|
||||
@PathParam("itemId") String itemId,
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
} else if (itemId.length() < 6) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"Length of itemId must be greater than or equal to 6\"}").build();
|
||||
}
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost, "dtv")) {
|
||||
String query = "SELECT item_id, level_code, level_value, itm_price_property_code, effective_date, expiration_date, price, price_qty, external_id, external_system, create_date, create_user_id, update_date, update_user_id " +
|
||||
"FROM dtv.itm_item_prices " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
List<ItemPrice> itemPriceList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
ItemPrice itemPrice = mapResultSetToItemPriceDetails(resultSet);
|
||||
itemPriceList.add(itemPrice);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemPriceList);
|
||||
|
||||
return Response.ok(jsonResponse).build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace(); // Gérer les exceptions correctement dans un environnement de production
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{itemId}/stock")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getItemStocksById(
|
||||
@PathParam("itemId") String itemId,
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
} else if (itemId.length() < 6) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"Length of itemId must be greater than or equal to 6\"}").build();
|
||||
}
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost, "dtv")) {
|
||||
String query = "SELECT organization_id,rtl_loc_id,inv_location_id,bucket_id,item_id, unitcount,inventory_value,create_date, create_user_id,update_date , update_user_id " +
|
||||
"FROM dtv.inv_stock_ledger_acct " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
List<ItemStock> itemStockList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
ItemStock itemStock = mapResultSetToItemStockDetails(resultSet);
|
||||
itemStockList.add(itemStock);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemStockList);
|
||||
|
||||
return Response.ok(jsonResponse).build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
|
@ -117,165 +272,6 @@ public class ItemService {
|
|||
return item;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getItemDetails")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getItemDetails(
|
||||
@QueryParam("dbHost") String dbHost,
|
||||
@QueryParam("itemId") String itemId) {
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
if (itemId == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"itemId parameter is required\"}").build();
|
||||
}
|
||||
|
||||
try {
|
||||
ItemDetails itemDetails = retrieveItemDetails(dbHost,itemId);
|
||||
|
||||
if (itemDetails != null) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
String jsonResponse = objectMapper.writeValueAsString(itemDetails);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity("{\"error\":\"Error converting ItemDetails to JSON\"}")
|
||||
.build();
|
||||
}
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"Item details not found\"}").build();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// Capture the RuntimeException to manage SQL errors
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"" + e.getMessage() + "\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves itemDetails from the database.
|
||||
*
|
||||
* @return a list of items retrieved from the database
|
||||
*/
|
||||
private ItemDetails retrieveItemDetails(String dbHost, String itemId) {
|
||||
DriverManager.setLoginTimeout(5);
|
||||
|
||||
ItemDetails itemDetails = new ItemDetails(); // Declare object outside try blocks
|
||||
|
||||
List<Item> itemList = new ArrayList<>();
|
||||
List<ItemOption> itemOptionList = new ArrayList<>();
|
||||
List<ItemPrices> itemPricesList = new ArrayList<>();
|
||||
List<ItemStock> itemStockList = new ArrayList<>();
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
||||
// Item section
|
||||
String itemQuery = "SELECT item_id,item_lvlcode,parent_item_id,item_typcode,create_date,create_user_id,update_date,update_user_id " +
|
||||
"FROM dtv.itm_item " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(itemQuery);
|
||||
try (PreparedStatement itemStatement = databaseConnection.getConnection().prepareStatement(itemQuery)) {
|
||||
// Concatenate % to parameter itemId
|
||||
itemStatement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet itemResultSet = itemStatement.executeQuery()) {
|
||||
while (itemResultSet.next()) {
|
||||
Item item = mapResultSetToItemDetails(itemResultSet);
|
||||
itemList.add(item);
|
||||
}
|
||||
|
||||
itemDetails.setItems(itemList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// item option section
|
||||
String itemOptionQuery = "SELECT item_id,level_code,level_value,item_availability_code,tax_group_id,Vendor,season_code,create_date,create_user_id,update_date,update_user_id " +
|
||||
"FROM dtv.itm_item_options " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(itemOptionQuery);
|
||||
try (PreparedStatement itemOptionStatement = databaseConnection.getConnection().prepareStatement(itemOptionQuery)) {
|
||||
// Concatenate % to parameter itemId
|
||||
itemOptionStatement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet itemOptionResultSet = itemOptionStatement.executeQuery()) {
|
||||
while (itemOptionResultSet.next()) {
|
||||
ItemOption itemOption = mapResultSetToItemOptionDetails(itemOptionResultSet);
|
||||
itemOptionList.add(itemOption);
|
||||
}
|
||||
|
||||
itemDetails.setItemOptions(itemOptionList);
|
||||
}
|
||||
}
|
||||
|
||||
// item option price
|
||||
String itemPricesQuery = "SELECT item_id, level_code, level_value, itm_price_property_code, effective_date, expiration_date, price, price_qty, external_id, external_system, create_date, create_user_id, update_date, update_user_id " +
|
||||
"FROM dtv.itm_item_prices " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(itemPricesQuery);
|
||||
try (PreparedStatement itemPricesStatement = databaseConnection.getConnection().prepareStatement(itemPricesQuery)) {
|
||||
// Concatenate % to parameter itemId
|
||||
itemPricesStatement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet itemPricesResultSet = itemPricesStatement.executeQuery()) {
|
||||
while (itemPricesResultSet.next()) {
|
||||
ItemPrices itemPrices = mapResultSetToItemPricesDetails(itemPricesResultSet);
|
||||
itemPricesList.add(itemPrices);
|
||||
}
|
||||
|
||||
itemDetails.setItemPrices(itemPricesList);
|
||||
}
|
||||
}
|
||||
|
||||
// item stock section
|
||||
String ItemStockQuery = "SELECT organization_id,rtl_loc_id,inv_location_id,bucket_id,item_id, unitcount,inventory_value,create_date, create_user_id,update_date , update_user_id " +
|
||||
"FROM dtv.inv_stock_ledger_acct " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(ItemStockQuery);
|
||||
try (PreparedStatement itemStockStatement = databaseConnection.getConnection().prepareStatement(ItemStockQuery)) {
|
||||
// Concatenate % to parameter itemId
|
||||
itemStockStatement.setString(1, itemId + "%");
|
||||
|
||||
try (ResultSet itemStockResultSet = itemStockStatement.executeQuery()) {
|
||||
while (itemStockResultSet.next()) {
|
||||
ItemStock itemStock = mapResultSetToItemStockDetails(itemStockResultSet);
|
||||
itemStockList.add(itemStock);
|
||||
}
|
||||
|
||||
itemDetails.setItemStock(itemStockList);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
// Handle exceptions correctly in a production environment
|
||||
}
|
||||
|
||||
// Return the complete ItemDetails object
|
||||
return itemDetails;
|
||||
}
|
||||
|
||||
private Item mapResultSetToItemDetails(ResultSet resultSet) throws SQLException {
|
||||
Item item = new Item();
|
||||
|
||||
item.setItemId(resultSet.getString("ITEM_ID"));
|
||||
item.setItemLevelCode(resultSet.getString("ITEM_LVLCODE"));
|
||||
item.setParentItemId(resultSet.getString("PARENT_ITEM_ID"));
|
||||
item.setItemTypeCode(resultSet.getString("ITEM_TYPCODE"));
|
||||
item.setCreateDate(resultSet.getDate("CREATE_DATE"));
|
||||
item.setCreateUserId(resultSet.getString("CREATE_USER_ID"));
|
||||
item.setUpdateDate(resultSet.getDate("UPDATE_DATE"));
|
||||
item.setUpdateUserId(resultSet.getString("UPDATE_USER_ID"));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemOption mapResultSetToItemOptionDetails(ResultSet resultSet) throws SQLException {
|
||||
ItemOption itemOption = new ItemOption();
|
||||
|
||||
|
|
@ -294,9 +290,8 @@ public class ItemService {
|
|||
return itemOption;
|
||||
}
|
||||
|
||||
private ItemPrices mapResultSetToItemPricesDetails(ResultSet resultSet) throws SQLException {
|
||||
|
||||
ItemPrices itemPrices = new ItemPrices();
|
||||
private ItemPrice mapResultSetToItemPriceDetails(ResultSet resultSet) throws SQLException {
|
||||
ItemPrice itemPrices = new ItemPrice();
|
||||
|
||||
itemPrices.setItemId(resultSet.getString("ITEM_ID"));
|
||||
itemPrices.setLevelCode(resultSet.getString("LEVEL_CODE"));
|
||||
|
|
@ -317,7 +312,6 @@ public class ItemService {
|
|||
}
|
||||
|
||||
private ItemStock mapResultSetToItemStockDetails(ResultSet resultSet) throws SQLException {
|
||||
|
||||
ItemStock itemStock = new ItemStock();
|
||||
|
||||
itemStock.setOrganizationId(resultSet.getString("ORGANIZATION_ID"));
|
||||
|
|
|
|||
|
|
@ -50,7 +50,15 @@ public class StoreService {
|
|||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectDOTSOFT databaseConnection = new DatabaseConnectDOTSOFT("com02")) {
|
||||
String query = "SELECT id_structure,nom,'10.100.0.18' AS ip, tel1 AS telephone FROM structure WHERE id_structure = ?" ;
|
||||
String query = "SELECT st.id_structure,TRIM(st.nom) as nom,'xxx.xxx.xxx.xxx' AS ip, st.tel1 as telephone, st.enseigne, " +
|
||||
"'https://mp4.ikksgroup.com/photos/' || CASE WHEN metabp.id_photo_principale IS NOT NULL THEN mpprinc.url || TO_CHAR (metabp.id_photo_principale) " +
|
||||
"ELSE '0/0' END || '-small.JPG' as photoLink " +
|
||||
"FROM COM02.structure st " +
|
||||
"LEFT OUTER JOIN mobretail.mp_etab_param metabp ON metabp.id_etab = st.id_structure " +
|
||||
"LEFT OUTER JOIN mobretail.mr_photo mpprinc ON mpprinc.id_photo = metabp.id_photo_principale " +
|
||||
"WHERE st.id_structure = ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
statement.setString(1, storeId);
|
||||
|
|
@ -58,7 +66,7 @@ public class StoreService {
|
|||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
if (resultSet.next()) {
|
||||
Store store = mapResultSetTostore(resultSet);
|
||||
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(store);
|
||||
return Response.ok(jsonResponse).build();
|
||||
|
|
@ -100,18 +108,14 @@ public class StoreService {
|
|||
}
|
||||
}
|
||||
|
||||
if (!cachedStoreList.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse;
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(cachedStoreList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"No stores found\"}").build();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse;
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(cachedStoreList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,13 +129,15 @@ public class StoreService {
|
|||
|
||||
try (DatabaseConnectDOTSOFT databaseConnection = new DatabaseConnectDOTSOFT("com02")) {
|
||||
String query = "SELECT st.id_structure, TRIM(st.nom) as nom, hsc.ip, " +
|
||||
"st.tel1 AS telephone " +
|
||||
"st.tel1 AS telephone, st.enseigne, null AS photoLink " +
|
||||
"FROM COM02.STRUCTURE st " +
|
||||
"LEFT OUTER JOIN omni.ASPD_XSTO_STRUCTURE axs ON st.ID_STRUCTURE = axs.ID_STRUCTURE " +
|
||||
"JOIN COM02.hotline_structure_caisse hsc ON hsc.id_structure = st.id_structure AND hsc.id_caisse = 1 " +
|
||||
"WHERE st.id_structure < 9999 AND hsc.ip IS NOT NULL AND st.ID_NIVEAU=4 AND st.STATUT=2 " +
|
||||
"WHERE axs.date_stock is not null and st.id_structure < 9999 AND hsc.ip IS NOT NULL AND st.ID_NIVEAU=4 AND st.STATUT=2 " +
|
||||
"ORDER BY st.id_structure";
|
||||
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query);
|
||||
ResultSet resultSet = statement.executeQuery()) {
|
||||
|
||||
|
|
@ -150,6 +156,146 @@ public class StoreService {
|
|||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/sequence")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getSequence(
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
||||
|
||||
String query = "SELECT ORGANIZATION_ID, RTL_LOC_ID, WKSTN_ID, SEQUENCE_ID, SEQUENCE_MODE, SEQUENCE_NBR, CREATE_DATE, CREATE_USER_ID, UPDATE_DATE, UPDATE_USER_ID, RECORD_STATE " +
|
||||
"FROM DTV.COM_SEQUENCE " +
|
||||
"WHERE organization_id = 1 " +
|
||||
"ORDER BY WKSTN_ID, SEQUENCE_ID";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
List<StoreSequence> sequenceList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
StoreSequence sequence = mapResultSetToStoreSequence(resultSet);
|
||||
sequenceList.add(sequence);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse;
|
||||
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(sequenceList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/signature")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getSignature(
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
||||
String query = "SELECT ORGANIZATION_ID, RTL_LOC_ID, WKSTN_ID, SIGNATURE_ID, SIGNATURE_MODE, SIGNATURE_STRING, SIGNATURE_SOURCE, CREATE_DATE, CREATE_USER_ID, UPDATE_DATE, UPDATE_USER_ID, RECORD_STATE " +
|
||||
"FROM DTV.COM_SIGNATURE " +
|
||||
"WHERE organization_id = 1 " +
|
||||
"ORDER BY WKSTN_ID";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
List<StoreSignature> signatureList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
StoreSignature signature = mapResultSetToStoreSignature(resultSet);
|
||||
signatureList.add(signature);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse;
|
||||
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(signatureList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/version")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getVersion(
|
||||
@QueryParam("dbHost") String dbHost) {
|
||||
|
||||
if (dbHost == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"dbHost parameter is required\"}").build();
|
||||
}
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost,"dtv")) {
|
||||
|
||||
String query = "SELECT ORGANIZATION_ID,SEQ,BASE_SCHEMA_VERSION,CUSTOMER_SCHEMA_VERSION,CUSTOMER,BASE_SCHEMA_DATE,CUSTOMER_SCHEMA_DATE, " +
|
||||
"CREATE_DATE,CREATE_USER_ID,UPDATE_DATE,UPDATE_USER_ID " +
|
||||
"FROM dtv.CTL_VERSION_HISTORY " +
|
||||
"WHERE organization_id = 1 AND customer IS NOT NULL " +
|
||||
"ORDER BY seq DESC";
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
List<StoreVersion> versionList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
StoreVersion version = mapResultSetToStoreVersion(resultSet);
|
||||
versionList.add(version);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse;
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(versionList);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
String errorResponse = "{\"error\":\"" + e.getMessage() + "\"}";
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a ResultSet to a store object.
|
||||
*
|
||||
|
|
@ -164,6 +310,8 @@ public class StoreService {
|
|||
store.setNom(resultSet.getString("NOM"));
|
||||
store.setIp(resultSet.getString("IP"));
|
||||
store.setTelephone(resultSet.getString("TELEPHONE"));
|
||||
store.setEnseigne(resultSet.getString("ENSEIGNE"));
|
||||
store.setPhotoLink(resultSet.getString("PHOTOLINK"));
|
||||
|
||||
return store;
|
||||
}
|
||||
|
|
@ -186,19 +334,15 @@ public class StoreService {
|
|||
try {
|
||||
StoreDetails storeDetails = retrieveStoreDetails(dbHost,storeId);
|
||||
|
||||
if (storeDetails != null) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
String jsonResponse = objectMapper.writeValueAsString(storeDetails);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity("{\"error\":\"Error converting StoreDetails to JSON\"}")
|
||||
.build();
|
||||
}
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"Store details not found\"}").build();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
String jsonResponse = objectMapper.writeValueAsString(storeDetails);
|
||||
return Response.ok(jsonResponse).build();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity("{\"error\":\"Error converting StoreDetails to JSON\"}")
|
||||
.build();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// Capture the RuntimeException to manage SQL errors
|
||||
|
|
@ -216,13 +360,16 @@ public class StoreService {
|
|||
DriverManager.setLoginTimeout(5);
|
||||
|
||||
StoreDetails storeDetails = new StoreDetails(); // Déclarer l'objet en dehors des blocs try
|
||||
|
||||
|
||||
try (DatabaseConnectDOTSOFT databaseConnection = new DatabaseConnectDOTSOFT("com02")) {
|
||||
// Store section
|
||||
String storeQuery = "SELECT st.id_structure, TRIM(st.nom) as nom, '10.100.0.18' AS ip, " +
|
||||
"st.tel1 AS telephone, 'https://mp4.ikksgroup.com/photos/1/6/5/7/3/16573-large.JPG' as photoLink " +
|
||||
"FROM COM02.STRUCTURE st " +
|
||||
"WHERE st.id_structure = ?";
|
||||
String storeQuery = "SELECT st.id_structure,TRIM(st.nom) as nom,'xxx.xxx.xxx.xxx' AS ip, st.tel1 as telephone, st.enseigne, " +
|
||||
"'https://mp4.ikksgroup.com/photos/' || CASE WHEN metabp.id_photo_principale IS NOT NULL THEN mpprinc.url || TO_CHAR (metabp.id_photo_principale) " +
|
||||
"ELSE '0/0' END || '-small.JPG' as photoLink " +
|
||||
"FROM COM02.structure st " +
|
||||
"LEFT OUTER JOIN mobretail.mp_etab_param metabp ON metabp.id_etab = st.id_structure " +
|
||||
"LEFT OUTER JOIN mobretail.mr_photo mpprinc ON mpprinc.id_photo = metabp.id_photo_principale " +
|
||||
"WHERE st.id_structure = ?";
|
||||
|
||||
logger.info(storeQuery);
|
||||
try (PreparedStatement storeStatement = databaseConnection.getConnection().prepareStatement(storeQuery)) {
|
||||
|
|
@ -301,8 +448,9 @@ public class StoreService {
|
|||
String ip = resultSet.getString("ip");
|
||||
String telephone = resultSet.getString("telephone");
|
||||
String photoLink = resultSet.getString("photoLink");
|
||||
String enseigne = resultSet.getString("enseigne");
|
||||
|
||||
return new Store(id_structure, nom, ip, telephone, photoLink);
|
||||
return new Store(id_structure, nom, ip, telephone, photoLink, enseigne);
|
||||
}
|
||||
|
||||
private StoreReplication mapResultSetToStoreReplication(ResultSet resultSet) throws SQLException {
|
||||
|
|
@ -323,4 +471,53 @@ public class StoreService {
|
|||
|
||||
return new BackOfficeTransaction(backOfficeTransactionOk, backofficeTransactions, minBackofficeTransactionDate, maxBackofficeTransactionDate, backOfficeBusinessDate);
|
||||
}
|
||||
|
||||
private StoreVersion mapResultSetToStoreVersion(ResultSet resultSet) throws SQLException {
|
||||
long organizationId = resultSet.getLong("ORGANIZATION_ID");
|
||||
long seq = resultSet.getLong("SEQ");
|
||||
String baseSchemaVersion = resultSet.getString("BASE_SCHEMA_VERSION");
|
||||
String customerSchemaVersion = resultSet.getString("CUSTOMER_SCHEMA_VERSION");
|
||||
String customer = resultSet.getString("CUSTOMER");
|
||||
Date baseSchemaDate = resultSet.getDate("BASE_SCHEMA_DATE");
|
||||
Date customerSchemaDate = resultSet.getDate("CUSTOMER_SCHEMA_DATE");
|
||||
Date createDate= (resultSet.getDate("CREATE_DATE"));
|
||||
String createUserId = resultSet.getString("CREATE_USER_ID");
|
||||
Date updateDate = (resultSet.getDate("UPDATE_DATE"));
|
||||
String updateUserId =(resultSet.getString("UPDATE_USER_ID"));
|
||||
|
||||
return new StoreVersion( organizationId, seq, baseSchemaVersion, customerSchemaVersion, customer, baseSchemaDate, customerSchemaDate, createDate, createUserId, updateDate, updateUserId);
|
||||
}
|
||||
|
||||
private StoreSequence mapResultSetToStoreSequence(ResultSet resultSet) throws SQLException {
|
||||
long organizationId = resultSet.getLong("ORGANIZATION_ID");
|
||||
long rtl_loc_id = resultSet.getLong("RTL_LOC_ID");
|
||||
long wkstnId = resultSet.getLong("WKSTN_ID");
|
||||
String sequenceId = resultSet.getString("SEQUENCE_ID");
|
||||
String sequenceMode = resultSet.getString("SEQUENCE_MODE");
|
||||
Long sequenceNbr = resultSet.getLong("SEQUENCE_NBR");
|
||||
Date createDate = resultSet.getDate("CREATE_DATE");
|
||||
String createUserId = resultSet.getString("CREATE_USER_ID");
|
||||
Date updateDate = resultSet.getDate("UPDATE_DATE");
|
||||
String updateUserId = resultSet.getString("UPDATE_USER_ID");
|
||||
String recordState = resultSet.getString("RECORD_STATE");
|
||||
|
||||
return new StoreSequence(organizationId, rtl_loc_id, wkstnId, sequenceId, sequenceMode, sequenceNbr, createDate, createUserId, updateDate, updateUserId, recordState);
|
||||
}
|
||||
|
||||
private StoreSignature mapResultSetToStoreSignature(ResultSet resultSet) throws SQLException {
|
||||
Long organizationId = resultSet.getLong("ORGANIZATION_ID");
|
||||
Long rtlLocId = resultSet.getLong("RTL_LOC_ID");
|
||||
Long wkstnId = resultSet.getLong("WKSTN_ID");
|
||||
String signatureId = resultSet.getString("SIGNATURE_ID");
|
||||
String signatureMode = resultSet.getString("SIGNATURE_MODE");
|
||||
String signatureString = resultSet.getString("SIGNATURE_STRING");
|
||||
String signatureSource = resultSet.getString("SIGNATURE_SOURCE");
|
||||
Date createDate = resultSet.getDate("CREATE_DATE");
|
||||
String createUserId = resultSet.getString("CREATE_USER_ID");
|
||||
Date updateDate = resultSet.getDate("UPDATE_DATE");
|
||||
String updateUserId = resultSet.getString("UPDATE_USER_ID");
|
||||
String recordState = resultSet.getString("RECORD_STATE");
|
||||
|
||||
return new StoreSignature(organizationId, rtlLocId, wkstnId, signatureId, signatureMode, signatureString, signatureSource, createDate, createUserId, updateDate, updateUserId, recordState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
package com.example.services.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDetails {
|
||||
private List<Item> items;
|
||||
private List<ItemOption> itemOptions;
|
||||
private List<ItemPrices> itemPrices;
|
||||
private List<ItemStock> itemStock;
|
||||
|
||||
public ItemDetails() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
public ItemDetails(List<Item> items, List<ItemOption> itemOptions, List<ItemPrices> itemPrices, List<ItemStock> itemStocks) {
|
||||
this.items = items;
|
||||
this.itemOptions = itemOptions;
|
||||
this.itemPrices = itemPrices;
|
||||
this.itemStock = itemStocks;
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public List<ItemOption> getItemOptions() {
|
||||
return itemOptions;
|
||||
}
|
||||
|
||||
public void setItemOptions(List<ItemOption> itemOptions) {
|
||||
this.itemOptions = itemOptions;
|
||||
}
|
||||
|
||||
public List<ItemPrices> getItemPrices() {
|
||||
return itemPrices;
|
||||
}
|
||||
|
||||
public void setItemPrices(List<ItemPrices> itemPrices) {
|
||||
this.itemPrices = itemPrices;
|
||||
}
|
||||
|
||||
public List<ItemStock> getItemStock() {
|
||||
return itemStock;
|
||||
}
|
||||
|
||||
public void setItemStock(List<ItemStock> itemStocks) {
|
||||
this.itemStock = itemStocks;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ package com.example.services.item;
|
|||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class ItemPrices {
|
||||
public class ItemPrice {
|
||||
private String itemId;
|
||||
private String levelCode;
|
||||
private String levelValue;
|
||||
|
|
@ -19,7 +19,7 @@ public class ItemPrices {
|
|||
private Date updateDate;
|
||||
private String updateUserId;
|
||||
|
||||
public ItemPrices() {
|
||||
public ItemPrice() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
|
|
@ -11,12 +11,12 @@ public class BackOfficeTransaction {
|
|||
private Date backOfficeBusinessDate;
|
||||
|
||||
|
||||
// Constructeur par défaut
|
||||
// Default constructor
|
||||
public BackOfficeTransaction() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
// Constructeur avec paramètres
|
||||
// Constructor with parameters
|
||||
public BackOfficeTransaction(boolean backOfficeTransactionOk, int backOfficeTransactions, Date minbackOfficeTransactionDate, Date maxbackOfficeTransactionDate, Date backOfficeBusinessDate) {
|
||||
this.backOfficeTransactionOk = backOfficeTransactionOk;
|
||||
this.backOfficeTransactions = backOfficeTransactions;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class Store {
|
|||
private String ip;
|
||||
private String telephone;
|
||||
private String photoLink;
|
||||
private String enseigne;
|
||||
|
||||
|
||||
// Default constructor
|
||||
|
|
@ -14,12 +15,13 @@ public class Store {
|
|||
}
|
||||
|
||||
// Constructor with parameters
|
||||
public Store(Integer id_structure, String nom, String ip, String telephone, String photoLink) {
|
||||
public Store(Integer id_structure, String nom, String ip, String telephone, String photoLink, String enseigne) {
|
||||
this.id_structure = id_structure;
|
||||
this.nom = nom;
|
||||
this.ip = ip;
|
||||
this.telephone = telephone;
|
||||
this.photoLink = photoLink;
|
||||
this.enseigne = enseigne;
|
||||
}
|
||||
|
||||
public Integer getId_structure() {
|
||||
|
|
@ -61,4 +63,12 @@ public class Store {
|
|||
public void setPhotoLink(String photoLink) {
|
||||
this.photoLink = photoLink;
|
||||
}
|
||||
|
||||
public String getEnseigne() {
|
||||
return enseigne;
|
||||
}
|
||||
|
||||
public void setEnseigne(String enseigne) {
|
||||
this.enseigne = enseigne;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ public class StoreDetails {
|
|||
private Store store;
|
||||
private StoreReplication replication;
|
||||
private BackOfficeTransaction transaction;
|
||||
|
||||
|
||||
public StoreDetails() {
|
||||
// Constructeur par défaut nécessaire pour la désérialisation JSON
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
package com.example.services.store;
|
||||
|
||||
import java.util.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class StoreSequence {
|
||||
private Long organizationId;
|
||||
private Long rtlLocId;
|
||||
private Long wkstnId;
|
||||
private String sequenceId;
|
||||
private String sequenceMode;
|
||||
private Long sequenceNbr;
|
||||
private Date createDate;
|
||||
private String createUserId;
|
||||
private Date updateDate;
|
||||
private String updateUserId;
|
||||
private String recordState;
|
||||
|
||||
// Default constructor
|
||||
public StoreSequence() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
public StoreSequence(Long organizationId, Long rtlLocId, Long wkstnId, String sequenceId, String sequenceMode, Long sequenceNbr, Date createDate, String createUserId, Date updateDate, String updateUserId, String recordState) {
|
||||
this.organizationId = organizationId;
|
||||
this.rtlLocId = rtlLocId;
|
||||
this.wkstnId = wkstnId;
|
||||
this.sequenceId = sequenceId;
|
||||
this.sequenceMode = sequenceMode;
|
||||
this.sequenceNbr = sequenceNbr;
|
||||
this.createDate = createDate;
|
||||
this.createUserId = createUserId;
|
||||
this.updateDate = updateDate;
|
||||
this.updateUserId = updateUserId;
|
||||
this.recordState = recordState;
|
||||
}
|
||||
|
||||
// Getters and Setters for all fields
|
||||
|
||||
public Long getOrganizationId() {
|
||||
return organizationId;
|
||||
}
|
||||
|
||||
public void setOrganizationId(Long organizationId) {
|
||||
this.organizationId = organizationId;
|
||||
}
|
||||
|
||||
public Long getRtlLocId() {
|
||||
return rtlLocId;
|
||||
}
|
||||
|
||||
public void setRtlLocId(Long rtlLocId) {
|
||||
this.rtlLocId = rtlLocId;
|
||||
}
|
||||
|
||||
public Long getWkstnId() {
|
||||
return wkstnId;
|
||||
}
|
||||
|
||||
public void setWkstnId(Long wkstnId) {
|
||||
this.wkstnId = wkstnId;
|
||||
}
|
||||
|
||||
public String getSequenceId() {
|
||||
return sequenceId;
|
||||
}
|
||||
|
||||
public void setSequenceId(String sequenceId) {
|
||||
this.sequenceId = sequenceId;
|
||||
}
|
||||
|
||||
public String getSequenceMode() {
|
||||
return sequenceMode;
|
||||
}
|
||||
|
||||
public void setSequenceMode(String sequenceMode) {
|
||||
this.sequenceMode = sequenceMode;
|
||||
}
|
||||
|
||||
public Long getSequenceNbr() {
|
||||
return sequenceNbr;
|
||||
}
|
||||
|
||||
public void setSequenceNbr(Long sequenceNbr) {
|
||||
this.sequenceNbr = sequenceNbr;
|
||||
}
|
||||
|
||||
public String getCreateDate() {
|
||||
if (createDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(createDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public String getCreateUserId() {
|
||||
return createUserId == null ? "" : createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(String createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public String getUpdateDate() {
|
||||
if (updateDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(updateDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public String getUpdateUserId() {
|
||||
return updateUserId == null ? "" : updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(String updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
|
||||
public String getRecordState() {
|
||||
return recordState;
|
||||
}
|
||||
|
||||
public void setRecordState(String recordState) {
|
||||
this.recordState = recordState;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
package com.example.services.store;
|
||||
|
||||
import java.util.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class StoreSignature {
|
||||
private Long organizationId;
|
||||
private Long rtlLocId;
|
||||
private Long wkstnId;
|
||||
private String signatureId;
|
||||
private String signatureMode;
|
||||
private String signatureString;
|
||||
private String signatureSource;
|
||||
private Date createDate;
|
||||
private String createUserId;
|
||||
private Date updateDate;
|
||||
private String updateUserId;
|
||||
private String recordState;
|
||||
|
||||
// Default constructor
|
||||
public StoreSignature() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
public StoreSignature(Long organizationId, Long rtlLocId, Long wkstnId, String signatureId, String signatureMode, String signatureString, String signatureSource, Date createDate, String createUserId, Date updateDate, String updateUserId, String recordState) {
|
||||
this.organizationId = organizationId;
|
||||
this.rtlLocId = rtlLocId;
|
||||
this.wkstnId = wkstnId;
|
||||
this.signatureId = signatureId;
|
||||
this.signatureMode = signatureMode;
|
||||
this.signatureString = signatureString;
|
||||
this.signatureSource = signatureSource;
|
||||
this.createDate = createDate;
|
||||
this.createUserId = createUserId;
|
||||
this.updateDate = updateDate;
|
||||
this.updateUserId = updateUserId;
|
||||
this.recordState = recordState;
|
||||
}
|
||||
|
||||
// Getters and Setters for all fields
|
||||
|
||||
public Long getOrganizationId() {
|
||||
return organizationId;
|
||||
}
|
||||
|
||||
public void setOrganizationId(Long organizationId) {
|
||||
this.organizationId = organizationId;
|
||||
}
|
||||
|
||||
public Long getRtlLocId() {
|
||||
return rtlLocId;
|
||||
}
|
||||
|
||||
public void setRtlLocId(Long rtlLocId) {
|
||||
this.rtlLocId = rtlLocId;
|
||||
}
|
||||
|
||||
public Long getWkstnId() {
|
||||
return wkstnId;
|
||||
}
|
||||
|
||||
public void setWkstnId(Long wkstnId) {
|
||||
this.wkstnId = wkstnId;
|
||||
}
|
||||
|
||||
public String getSignatureId() {
|
||||
return signatureId;
|
||||
}
|
||||
|
||||
public void setSignatureId(String signatureId) {
|
||||
this.signatureId = signatureId;
|
||||
}
|
||||
|
||||
public String getSignatureMode() {
|
||||
return signatureMode;
|
||||
}
|
||||
|
||||
public void setSignatureMode(String signatureMode) {
|
||||
this.signatureMode = signatureMode;
|
||||
}
|
||||
|
||||
public String getSignatureString() {
|
||||
if (signatureString != null) {
|
||||
return signatureString;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setSignatureString(String signatureString) {
|
||||
this.signatureString = signatureString;
|
||||
}
|
||||
|
||||
public String getSignatureSource() {
|
||||
if (signatureSource != null) {
|
||||
return signatureSource;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setSignatureSource(String signatureSource) {
|
||||
this.signatureSource = signatureSource;
|
||||
}
|
||||
|
||||
public String getCreateDate() {
|
||||
if (createDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(createDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public String getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(String createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public String getUpdateDate() {
|
||||
if (updateDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(updateDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public String getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(String updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
|
||||
public String getRecordState() {
|
||||
return recordState;
|
||||
}
|
||||
|
||||
public void setRecordState(String recordState) {
|
||||
this.recordState = recordState;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package com.example.services.store;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class StoreVersion {
|
||||
private Long organizationId;
|
||||
private Long seq;
|
||||
private String baseSchemaVersion;
|
||||
private String customerSchemaVersion;
|
||||
private String customer;
|
||||
private Date baseSchemaDate;
|
||||
private Date customerSchemaDate;
|
||||
private Date createDate;
|
||||
private String createUserId;
|
||||
private Date updateDate;
|
||||
private String updateUserId;
|
||||
|
||||
// Default constructor
|
||||
public StoreVersion() {
|
||||
// Default constructor required for JSON deserialization
|
||||
}
|
||||
|
||||
public StoreVersion(Long organisation_id, Long seq, String base_schema_version, String customer_schema_version, String customer, Date base_schema_date, Date customer_schema_date, Date createDate, String create_user_id, Date update_date, String update_user_id) {
|
||||
this.organizationId = organisation_id;
|
||||
this.seq = seq;
|
||||
this.baseSchemaVersion = base_schema_version;
|
||||
this.customerSchemaVersion = customer_schema_version;
|
||||
this.customer = customer;
|
||||
this.baseSchemaDate = base_schema_date;
|
||||
this.customerSchemaDate = customer_schema_date;
|
||||
this.createDate = createDate;
|
||||
this.createUserId = create_user_id;
|
||||
this.updateDate = update_date;
|
||||
this.updateUserId = update_user_id;
|
||||
};
|
||||
|
||||
// Getters and Setters for all fields
|
||||
|
||||
public Long getOrganizationId() {
|
||||
return organizationId;
|
||||
}
|
||||
|
||||
public void setOrganizationId(Long organizationId) {
|
||||
this.organizationId = organizationId;
|
||||
}
|
||||
|
||||
public Long getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public void setSeq(Long seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public String getBaseSchemaVersion() {
|
||||
return baseSchemaVersion;
|
||||
}
|
||||
|
||||
public void setBaseSchemaVersion(String baseSchemaVersion) {
|
||||
this.baseSchemaVersion = baseSchemaVersion;
|
||||
}
|
||||
|
||||
public String getCustomerSchemaVersion() {
|
||||
return customerSchemaVersion;
|
||||
}
|
||||
|
||||
public void setCustomerSchemaVersion(String customerSchemaVersion) {
|
||||
this.customerSchemaVersion = customerSchemaVersion;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public String getBaseSchemaDate() {
|
||||
if (baseSchemaDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(baseSchemaDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setBaseSchemaDate(Date baseSchemaDate) {
|
||||
this.baseSchemaDate = baseSchemaDate;
|
||||
}
|
||||
|
||||
public String getCustomerSchemaDate() {
|
||||
if (customerSchemaDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(customerSchemaDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setCustomerSchemaDate(Date customerSchemaDate) {
|
||||
this.customerSchemaDate = customerSchemaDate;
|
||||
}
|
||||
|
||||
public String getCreateDate() {
|
||||
if (createDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(createDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public String getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(String createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public String getUpdateDate() {
|
||||
if (updateDate != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return dateFormat.format(updateDate);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public String getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(String updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue