Merge pull request 'feature/issue-7/obi' (#8) from feature/issue-7/obi into dev
Reviewed-on: #8pull/11/head
commit
ea70d8281c
16
pom.xml
16
pom.xml
|
|
@ -19,7 +19,14 @@
|
|||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>18.3.0.0</version> <!-- Assurez-vous d'utiliser la version compatible avec votre Oracle Database -->
|
||||
<version>18.3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JDBC Driver for postgresql Database https://github.com/pgjdbc/pgjdbc -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jersey for JAX-RS (Java API for RESTful Web Services) -->
|
||||
|
|
@ -57,13 +64,18 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>2.13.0</version> <!-- Use the latest version here -->
|
||||
<version>2.13.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>2.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20231013</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LOG dependencies -->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ public class DatabaseConnectDOTSOFT implements AutoCloseable {
|
|||
try {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty(environment + ".db.url");
|
||||
String userpassword = dbProperties.getProperty(environment + ".db." + username + ".password");
|
||||
String url = dbProperties.getProperty(environment + ".dotsoft.db.url");
|
||||
String userpassword = dbProperties.getProperty(environment + ".dotsoft.db." + username + ".password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.example.services;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DatabaseConnectOBI implements AutoCloseable {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DatabaseConnectOBI.class);
|
||||
|
||||
private Connection connection;
|
||||
|
||||
public DatabaseConnectOBI() throws SQLException {
|
||||
String environment = loadEnvironment();
|
||||
|
||||
try {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty(environment + ".obi.db.url");
|
||||
String username = dbProperties.getProperty(environment + ".obi.db.username");
|
||||
String userpassword = dbProperties.getProperty(environment + ".obi.db.password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("OBI Connection OK for user " + username + " on environment " + environment);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Failed to connect to OBI database on environment " + environment, e);
|
||||
throw e; // re-throw the exception
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
connection.close();
|
||||
logger.info("OBI Connection closed");
|
||||
}
|
||||
}
|
||||
|
||||
private String loadEnvironment() {
|
||||
Properties envProperties = loadProperties("env.properties");
|
||||
return envProperties.getProperty("environment");
|
||||
}
|
||||
|
||||
private Properties loadDatabaseProperties() {
|
||||
Properties dbProperties = loadProperties("db.properties");
|
||||
return dbProperties;
|
||||
}
|
||||
|
||||
private Properties loadProperties(String fileName) {
|
||||
Properties properties = new Properties();
|
||||
try (InputStream input = getClass().getClassLoader().getResourceAsStream(fileName)) {
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Handle the exception correctly for your application
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,17 +16,19 @@ public class DatabaseConnectXADMIN implements AutoCloseable {
|
|||
private Connection connection;
|
||||
|
||||
public DatabaseConnectXADMIN(String username) throws SQLException {
|
||||
String environment = loadEnvironment();
|
||||
|
||||
try {
|
||||
Properties dbProperties = loadDatabaseProperties();
|
||||
|
||||
String url = dbProperties.getProperty("xadmin.db.url");
|
||||
String userpassword = dbProperties.getProperty("xadmin.db." + username + ".password");
|
||||
String url = dbProperties.getProperty(environment + ".xadmin.db.url");
|
||||
String userpassword = dbProperties.getProperty(environment + ".xadmin.db." + username + ".password");
|
||||
|
||||
connection = DriverManager.getConnection(url, username, userpassword);
|
||||
|
||||
logger.info("XADMIN Connection OK for user " + username);
|
||||
logger.info("XADMIN Connection OK for user " + username + " on environment " + environment);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Failed to connect to XADMIN database for user " + username, e);
|
||||
logger.error("Failed to connect to XADMIN database for user " + username + " on environment " + environment, e);
|
||||
throw e; // re-throw the exception
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +45,11 @@ public class DatabaseConnectXADMIN implements AutoCloseable {
|
|||
}
|
||||
}
|
||||
|
||||
private String loadEnvironment() {
|
||||
Properties envProperties = loadProperties("env.properties");
|
||||
return envProperties.getProperty("environment");
|
||||
}
|
||||
|
||||
private Properties loadDatabaseProperties() {
|
||||
Properties dbProperties = loadProperties("db.properties");
|
||||
return dbProperties;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public class ItemService {
|
|||
try (DatabaseConnectXSTORE databaseConnection = new DatabaseConnectXSTORE(dbHost, "dtv")) {
|
||||
String query = "SELECT * FROM dtv.ITM_ITEM WHERE ORGANIZATION_ID = 1 AND ITEM_ID LIKE ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
|
@ -105,6 +107,8 @@ public class ItemService {
|
|||
"FROM dtv.ITM_ITEM_OPTIONS " +
|
||||
"WHERE ORGANIZATION_ID = 1 AND ITEM_ID LIKE ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
|
@ -157,6 +161,8 @@ public class ItemService {
|
|||
"FROM dtv.itm_item_prices " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
|
@ -209,6 +215,8 @@ public class ItemService {
|
|||
"FROM dtv.inv_stock_ledger_acct " +
|
||||
"WHERE organization_id = 1 AND item_id LIKE ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
// Concatenate % to parameter itemId
|
||||
statement.setString(1, itemId + "%");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,696 @@
|
|||
package com.example.services;
|
||||
|
||||
import com.example.services.order.Order;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.XML;
|
||||
|
||||
@Path("/obi")
|
||||
public class OrderService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderService.class);
|
||||
|
||||
@GET
|
||||
@Path("/order")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getAllOrders(@QueryParam("q") String q,
|
||||
@QueryParam("page") int page,
|
||||
@QueryParam("itemsPerPage") int itemsPerPage,
|
||||
@QueryParam("sortBy") String sortBy,
|
||||
@QueryParam("orderBy") String orderBy,
|
||||
@QueryParam("status") String status,
|
||||
@QueryParam("type") String type,
|
||||
@QueryParam("minDate") String minDate,
|
||||
@QueryParam("maxDate") String maxDate) {
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectOBI databaseConnection = new DatabaseConnectOBI()) {
|
||||
String countQuery = "SELECT COUNT(*), "
|
||||
+ "SUM (CASE WHEN oo.status = 'new_order' THEN 1 ELSE 0 END) AS stat_status1, "
|
||||
+ "SUM (CASE WHEN oo.status = 'polled' THEN 1 ELSE 0 END) AS stat_status2, "
|
||||
+ "SUM (CASE WHEN oo.status = 'fulfilled' THEN 1 ELSE 0 END) AS stat_status3, "
|
||||
+ "SUM (CASE WHEN oo.status = 'received' THEN 1 ELSE 0 END) AS stat_status4, "
|
||||
+ "SUM (CASE WHEN oo.status = 'unfulfillable' THEN 1 ELSE 0 END) AS stat_status5, "
|
||||
+ "SUM (CASE WHEN oo.status = 'canceled' THEN 1 ELSE 0 END) AS stat_status6 "
|
||||
+ "FROM obi_order oo "
|
||||
+ "JOIN obi_transaction_type ott on ott.transaction_type_id = oo.transaction_type_id";
|
||||
|
||||
String query =
|
||||
"SELECT oo.request_id, "
|
||||
+ "oo.order_id, "
|
||||
+ "oo.transaction_date, "
|
||||
+ "oo.status as status, "
|
||||
+ "ott.transaction_type_description "
|
||||
+ "FROM obi_order oo "
|
||||
+ "JOIN obi_transaction_type ott on ott.transaction_type_id = oo.transaction_type_id";
|
||||
|
||||
List<String> conditions = new ArrayList<>();
|
||||
if (q != null && !q.isEmpty()) {
|
||||
conditions.add(" oo.order_id LIKE ? ");
|
||||
}
|
||||
|
||||
if (status != null && !status.isEmpty()) {
|
||||
conditions.add(" oo.status = ? ");
|
||||
}
|
||||
|
||||
if (type != null && !type.isEmpty()) {
|
||||
conditions.add(" ott.transaction_type_code = ? ");
|
||||
}
|
||||
|
||||
if (minDate != null && !minDate.isEmpty()) {
|
||||
conditions.add(" oo.transaction_date >= ? ");
|
||||
}
|
||||
|
||||
if (maxDate != null && !maxDate.isEmpty()) {
|
||||
conditions.add(" oo.transaction_date <= ? ");
|
||||
}
|
||||
|
||||
if (!conditions.isEmpty()) {
|
||||
countQuery += " WHERE " + String.join(" AND ", conditions);
|
||||
query += " WHERE " + String.join(" AND ", conditions);
|
||||
}
|
||||
|
||||
if (sortBy != null && !sortBy.isEmpty()) {
|
||||
query += " ORDER BY " + sortBy;
|
||||
if (orderBy != null && !orderBy.isEmpty()) {
|
||||
query += " " + orderBy;
|
||||
}
|
||||
}
|
||||
if (page > 0 && itemsPerPage > 0) {
|
||||
query += " LIMIT " + itemsPerPage + " OFFSET " + (page - 1) * itemsPerPage;
|
||||
}
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement countStatement = databaseConnection.getConnection().prepareStatement(countQuery);
|
||||
PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
int index = 1;
|
||||
|
||||
if (q != null && !q.isEmpty()) {
|
||||
countStatement.setString(index, "%" + q + "%");
|
||||
statement.setString(index++, "%" + q + "%");
|
||||
}
|
||||
|
||||
if(status != null && !status.isEmpty()) {
|
||||
countStatement.setString(index, status );
|
||||
statement.setString(index++, status );
|
||||
}
|
||||
|
||||
if (type != null && !type.isEmpty()) {
|
||||
countStatement.setString(index, type);
|
||||
statement.setString(index++, type);
|
||||
}
|
||||
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
|
||||
if (minDate != null && !minDate.isEmpty()) {
|
||||
logger.info("minDate: " + minDate);
|
||||
try {
|
||||
java.util.Date parsedMinDate = dateFormat.parse(minDate);
|
||||
java.sql.Date sqlMinDate = new java.sql.Date(parsedMinDate.getTime());
|
||||
|
||||
countStatement.setDate(index, sqlMinDate);
|
||||
statement.setDate(index++, sqlMinDate);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDate != null && !maxDate.isEmpty()) {
|
||||
logger.info("maxDate: " + maxDate);
|
||||
try {
|
||||
java.util.Date parsedMaxDate = dateFormat.parse(maxDate);
|
||||
java.sql.Date sqlMaxDate = new java.sql.Date(parsedMaxDate.getTime());
|
||||
|
||||
countStatement.setDate(index, sqlMaxDate);
|
||||
statement.setDate(index++, sqlMaxDate);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
ResultSet countResultSet = countStatement.executeQuery();
|
||||
countResultSet.next();
|
||||
int total = countResultSet.getInt(1);
|
||||
int statStatus1 = countResultSet.getInt(2);
|
||||
int statStatus2 = countResultSet.getInt(3);
|
||||
int statStatus3 = countResultSet.getInt(4);
|
||||
int statStatus4 = countResultSet.getInt(5);
|
||||
int statStatus5 = countResultSet.getInt(6);
|
||||
int statStatus6 = countResultSet.getInt(7);
|
||||
|
||||
ResultSet resultSet = statement.executeQuery(); {
|
||||
List<Order> orderList = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
Order order = mapResultSetToOrderList(resultSet);
|
||||
orderList.add(order);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ObjectNode responseNode = objectMapper.createObjectNode();
|
||||
responseNode.put("total", total);
|
||||
|
||||
ArrayNode statisticsArray = objectMapper.createArrayNode();
|
||||
String[] titles = {"new_order", "polled", "fulfilled", "received","unfulfillable","canceled"};
|
||||
String[] icons = {"tabler-calendar-stats", "tabler-progress-check", "tabler-checks", "tabler-checks","tabler-wallet","tabler-circle-x"};
|
||||
int[] counts = {statStatus1, statStatus2, statStatus3, statStatus4, statStatus5, statStatus6};
|
||||
|
||||
for (int i = 0; i < titles.length; i++) {
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("title", titles[i]);
|
||||
node.put("value", counts[i]);
|
||||
node.put("icon", icons[i]);
|
||||
statisticsArray.add(node);
|
||||
}
|
||||
responseNode.set("statistics", statisticsArray);
|
||||
|
||||
responseNode.set("orders", objectMapper.valueToTree(orderList));
|
||||
|
||||
String jsonResponse;
|
||||
|
||||
try {
|
||||
jsonResponse = objectMapper.writeValueAsString(responseNode);
|
||||
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("/order/{requestId}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getOrderById( @PathParam("requestId") Long requestId) throws SQLException {
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectOBI databaseConnection = new DatabaseConnectOBI()) {
|
||||
// ORDER SECTION ---------------------------------
|
||||
String orderQuery = "SELECT oo.request_id, oo.order_id, oo.requesting_location_cd, oo.requesting_system_cd, "
|
||||
+ "oo.customer_id, oo.transaction_no, oo.transaction_type_id, oo.transaction_date, oo.status, "
|
||||
+ "oo.fdate_creation, oo.consumed, oo.shipforpickup_location_cd, oo.shipforpickup_system_cd, "
|
||||
+ "ott.transaction_type_description "
|
||||
+ "FROM obi_order oo "
|
||||
+ "JOIN obi_transaction_type ott on ott.transaction_type_id = oo.transaction_type_id "
|
||||
+ "WHERE oo.request_id = ?";
|
||||
|
||||
logger.info(orderQuery);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(orderQuery)) {
|
||||
statement.setLong(1, requestId);
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
if (resultSet.next()) {
|
||||
Order order = mapResultSetToOrder(resultSet);
|
||||
|
||||
// ORDER LINES SECTION ---------------------------------
|
||||
String orderLinesQuery = "SELECT olo.line_order_id, olo.line_item_no, olo.order_id, olo.request_id, olo.line_item_oms, "
|
||||
+ "olo.item_id, olo.ordered_line_qty, olo.status, olo.transaction_date, olo.shipping_agent, "
|
||||
+ "olo.tracking_number, olo.fulfillment_id, olo.carton_number, olo.fdate_creation, olo.consumed "
|
||||
+ "FROM obi.obi_ln_order olo "
|
||||
+ "WHERE olo.request_id = ? "
|
||||
+ "ORDER BY olo.line_item_no";
|
||||
|
||||
logger.info(orderLinesQuery);
|
||||
|
||||
try (PreparedStatement linesStatement = databaseConnection.getConnection().prepareStatement(orderLinesQuery)) {
|
||||
linesStatement.setLong(1, requestId);
|
||||
|
||||
try (ResultSet linesResultSet = linesStatement.executeQuery()) {
|
||||
List<Order.Lines> orderLinesList = new ArrayList<>();
|
||||
|
||||
while (linesResultSet.next()) {
|
||||
orderLinesList.add(mapResultSetToOrderLine(linesResultSet));
|
||||
|
||||
String orderLinesHistoryQuery = "SELECT ohlo.status_id, ohlo.line_order_id, ohlo.status, ohlo.transaction_date, ohlo.fdate_creation "
|
||||
+ "FROM obi.obi_h_ln_order ohlo "
|
||||
+ "WHERE ohlo.line_order_id = ? "
|
||||
+ "ORDER BY ohlo.status_id DESC";
|
||||
|
||||
logger.info(orderLinesHistoryQuery);
|
||||
|
||||
try (PreparedStatement orderLinesHistoryStatement = databaseConnection.getConnection().prepareStatement(orderLinesHistoryQuery)) {
|
||||
orderLinesHistoryStatement.setLong(1, orderLinesList.get(orderLinesList.size() - 1).getLineOrderId());
|
||||
|
||||
try (ResultSet orderLinesHistoryResultSet = orderLinesHistoryStatement.executeQuery()) {
|
||||
List<Order.History> orderLinesHistoryList = new ArrayList<>();
|
||||
|
||||
while (orderLinesHistoryResultSet.next()) {
|
||||
orderLinesHistoryList.add(mapResultSetToOrderLinesHistory(orderLinesHistoryResultSet));
|
||||
}
|
||||
|
||||
orderLinesList.get(orderLinesList.size() - 1).setHistory(orderLinesHistoryList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
order.setLines(orderLinesList);
|
||||
}
|
||||
}
|
||||
|
||||
// ORDER HISTORY SECTION ---------------------------------
|
||||
String orderHistoryQuery = "SELECT oho.status_id, oho.request_id, oho.status, oho.transaction_date, oho.fdate_creation "
|
||||
+ "FROM obi.obi_h_order oho "
|
||||
+ "WHERE oho.request_id = ? "
|
||||
+ "ORDER BY oho.status_id DESC";
|
||||
|
||||
logger.info(orderHistoryQuery);
|
||||
|
||||
try (PreparedStatement orderHistoryStatement = databaseConnection.getConnection().prepareStatement(orderHistoryQuery)) {
|
||||
orderHistoryStatement.setLong(1, requestId);
|
||||
|
||||
try (ResultSet orderHistoryResultSet = orderHistoryStatement.executeQuery()) {
|
||||
List<Order.History> orderHistoryList = new ArrayList<>();
|
||||
|
||||
while (orderHistoryResultSet.next()) {
|
||||
orderHistoryList.add(mapResultSetToOrderHistory(orderHistoryResultSet));
|
||||
}
|
||||
|
||||
order.setHistory(orderHistoryList);
|
||||
}
|
||||
}
|
||||
|
||||
// PREPARATION SECTION ---------------------------------
|
||||
String preparationQuery = "SELECT oop.prep_int_id, oop.prep_id, oop.order_id, oop.request_id, oop.transaction_date, oop.fulfillment_system_cd, "
|
||||
+ "oop.fulfillment_location_cd, oop.status, oop.date_prepartion, oop.fdate_creation "
|
||||
+ "FROM obi.obi_order_prep oop "
|
||||
+ "WHERE oop.request_id = ? "
|
||||
+ "ORDER BY oop.prep_int_id DESC";
|
||||
|
||||
logger.info(preparationQuery);
|
||||
|
||||
try(PreparedStatement preparationStatement = databaseConnection.getConnection().prepareStatement(preparationQuery)) {
|
||||
preparationStatement.setLong(1, requestId);
|
||||
|
||||
try(ResultSet preparationResultSet = preparationStatement.executeQuery()) {
|
||||
List<Order.Preparation> preparationList = new ArrayList<>();
|
||||
|
||||
while(preparationResultSet.next()) {
|
||||
preparationList.add(mapResultSetToPreparation(preparationResultSet));
|
||||
|
||||
// PREPARATION LINES SECTION ---------------------------------
|
||||
String preparationLinesQuery =
|
||||
"SELECT "
|
||||
+ "olop.line_fulfill_id, "
|
||||
+ "olop.line_order_id, "
|
||||
+ "olop.prep_int_id, "
|
||||
+ "olop.order_id, "
|
||||
+ "olop.request_id, "
|
||||
+ "olop.transaction_date, "
|
||||
+ "olop.line_item_no, "
|
||||
+ "olop.item_id, "
|
||||
+ "olop.line_item_oms, "
|
||||
+ "olop.fulfill_qty, "
|
||||
+ "olop.validated_fulfill_qty, "
|
||||
+ "olop.fulfillment_system_cd, "
|
||||
+ "olop.fulfillment_location_cd, "
|
||||
+ "olop.status, "
|
||||
+ "olop.numero_expedition, "
|
||||
+ "olop.season_code, "
|
||||
+ "olop.finition_speciale, "
|
||||
+ "olop.carrier, "
|
||||
+ "olop.tracking_code, "
|
||||
+ "olop.tracking_url, "
|
||||
+ "olop.fdate_creation, "
|
||||
+ "olop.fdate_modification, "
|
||||
+ "olop.to_orlix_consumed, "
|
||||
+ "null as restocking_code " //"olop.restocking_code "
|
||||
+ "FROM obi.obi_ln_order_prep olop "
|
||||
+ "WHERE olop.prep_int_id = ? "
|
||||
+ "ORDER BY olop.line_item_oms";
|
||||
|
||||
logger.info(preparationLinesQuery);
|
||||
|
||||
try(PreparedStatement preparationLinesStatement = databaseConnection.getConnection().prepareStatement(preparationLinesQuery)) {
|
||||
preparationLinesStatement.setLong(1, preparationList.get(preparationList.size() - 1).getPrepIntId());
|
||||
|
||||
try(ResultSet preparationLinesResultSet = preparationLinesStatement.executeQuery()) {
|
||||
List<Order.Preparation.PreparationLines> preparationLinesList = new ArrayList<>();
|
||||
|
||||
while(preparationLinesResultSet.next()) {
|
||||
preparationLinesList.add(mapResultSetToPreparationLines(preparationLinesResultSet));
|
||||
}
|
||||
|
||||
preparationList.get(preparationList.size() - 1).setLines(preparationLinesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
order.setPreparations(preparationList);
|
||||
}
|
||||
}
|
||||
|
||||
// RECEPTION SECTION ---------------------------------
|
||||
String receptionQuery = "SELECT ocr.intransit_int_id, ocr.intransit_id, ocr.prep_int_id, "
|
||||
+ "ocr.order_id, ocr.request_id, ocr.status, ocr.transaction_date, "
|
||||
+ "ocr.intransit_system_cd, ocr.intransit_location_cd, ocr.fdate_receipt, "
|
||||
+ "ocr.fdate_creation "
|
||||
+ "FROM obi.obi_cr_receipt ocr "
|
||||
+ "WHERE ocr.request_id = ? "
|
||||
+ "ORDER BY ocr.intransit_id DESC";
|
||||
|
||||
logger.info(receptionQuery);
|
||||
|
||||
try(PreparedStatement receptionStatement = databaseConnection.getConnection().prepareStatement(receptionQuery)) {
|
||||
receptionStatement.setLong(1, requestId);
|
||||
|
||||
try(ResultSet receptionResultSet = receptionStatement.executeQuery()) {
|
||||
List<Order.Reception> receptionList = new ArrayList<>();
|
||||
|
||||
while(receptionResultSet.next()) {
|
||||
receptionList.add(mapResultSetToReception(receptionResultSet));
|
||||
|
||||
// RECEPTION LINES SECTION ---------------------------------
|
||||
String receptionLinesQuery = "SELECT "
|
||||
+ "olcr.line_intransit_id AS line_intransit_id, "
|
||||
+ "olcr.intransit_int_id AS intransit_int_id, "
|
||||
+ "olcr.line_fulfill_id AS line_fulfill_id, "
|
||||
+ "olcr.transaction_date AS transaction_date, "
|
||||
+ "olcr.line_item_no AS line_item_no, "
|
||||
+ "olcr.item_id AS item_id, "
|
||||
+ "olcr.intransit_qty AS intransit_qty, "
|
||||
+ "olcr.validated_intransit_qty AS validated_intransit_qty, "
|
||||
+ "olcr.intransit_system_cd AS intransit_system_cd, "
|
||||
+ "olcr.intransit_location_cd AS intransit_location_cd, "
|
||||
+ "olcr.status AS status, "
|
||||
+ "olcr.colis_id AS colis_id, "
|
||||
+ "olcr.fdate_creation AS fdate_creation, "
|
||||
+ "olcr.fdate_receipt AS fdate_receipt, "
|
||||
+ "olcr.order_line_ship_weight AS order_line_ship_weight, "
|
||||
+ "olcr.tracking_number AS tracking_number "
|
||||
+ "FROM obi.obi_ln_cr_receipt olcr "
|
||||
+ "WHERE olcr.intransit_int_id = ? "
|
||||
+ "ORDER BY olcr.line_item_no";
|
||||
|
||||
logger.info(receptionLinesQuery);
|
||||
|
||||
try(PreparedStatement receptionLinesStatement = databaseConnection.getConnection().prepareStatement(receptionLinesQuery)) {
|
||||
receptionLinesStatement.setLong(1, receptionList.get(receptionList.size() - 1).getIntransitIntId());
|
||||
|
||||
try(ResultSet receptionLinesResultSet = receptionLinesStatement.executeQuery()) {
|
||||
List<Order.Reception.ReceptionLines> receptionLinesList = new ArrayList<>();
|
||||
|
||||
while(receptionLinesResultSet.next()) {
|
||||
receptionLinesList.add(mapResultSetToReceptionLines(receptionLinesResultSet));
|
||||
}
|
||||
|
||||
receptionList.get(receptionList.size() - 1).setLines(receptionLinesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
order.setReceptions(receptionList);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResponse = objectMapper.writeValueAsString(order);
|
||||
|
||||
return Response.ok(jsonResponse).build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"No order found\"}").build();
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace(); // Handle exceptions correctly in a production environment
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"" + e.getMessage() + "\"}").build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/order/{requestId}/orderMessage")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getOrderMessage(@PathParam("requestId") Long requestId) throws SQLException {
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectOBI databaseConnection = new DatabaseConnectOBI()) {
|
||||
String orderXmlQuery = "SELECT oo.submit_ord_msg "
|
||||
+ "FROM obi_order oo "
|
||||
+ "WHERE oo.request_id = ?";
|
||||
|
||||
logger.info(orderXmlQuery);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(orderXmlQuery)) {
|
||||
statement.setLong(1, requestId);
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
if (resultSet.next()) {
|
||||
String xmlString = resultSet.getString("SUBMIT_ORD_MSG");
|
||||
JSONObject jsonObject = XML.toJSONObject(xmlString);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonObject.toString());
|
||||
|
||||
return Response.ok(jsonNode).build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"No transaction found with the provided ID\"}").build();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"" + e.getMessage() + "\"}").build();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"" + e.getMessage() + "\"}").build();
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace(); // Handle exceptions correctly in a production environment
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("{\"error\":\"Error processing JSON\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
private Order.Preparation.PreparationLines mapResultSetToPreparationLines(ResultSet resultSet) throws SQLException {
|
||||
Order.Preparation.PreparationLines preparationLines = new Order().new Preparation().new PreparationLines();
|
||||
|
||||
preparationLines.setLineFulfillId(resultSet.getInt("LINE_FULFILL_ID"));
|
||||
preparationLines.setLineOrderId(resultSet.getInt("LINE_ORDER_ID"));
|
||||
preparationLines.setPrepIntId(resultSet.getInt("PREP_INT_ID"));
|
||||
preparationLines.setOrderId(resultSet.getString("ORDER_ID"));
|
||||
preparationLines.setRequestId(resultSet.getLong("REQUEST_ID"));
|
||||
preparationLines.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
preparationLines.setLineItemNo(resultSet.getInt("LINE_ITEM_NO"));
|
||||
preparationLines.setItemId(resultSet.getString("ITEM_ID"));
|
||||
preparationLines.setLineItemOms(resultSet.getString("LINE_ITEM_OMS"));
|
||||
preparationLines.setFulfillQty(resultSet.getInt("FULFILL_QTY"));
|
||||
preparationLines.setValidatedFulfillQty(resultSet.getInt("VALIDATED_FULFILL_QTY"));
|
||||
preparationLines.setFulfillmentSystemCd(resultSet.getString("FULFILLMENT_SYSTEM_CD"));
|
||||
preparationLines.setFulfillmentLocationCd(resultSet.getString("FULFILLMENT_LOCATION_CD"));
|
||||
preparationLines.setStatus(resultSet.getString("STATUS"));
|
||||
preparationLines.setNumeroExpedition(resultSet.getString("NUMERO_EXPEDITION"));
|
||||
preparationLines.setSeasonCode(resultSet.getString("SEASON_CODE"));
|
||||
preparationLines.setFinitionSpeciale(resultSet.getString("FINITION_SPECIALE"));
|
||||
preparationLines.setCarrier(resultSet.getString("CARRIER"));
|
||||
preparationLines.setTrackingCode(resultSet.getString("TRACKING_CODE"));
|
||||
preparationLines.setTrackingUrl(resultSet.getString("TRACKING_URL"));
|
||||
preparationLines.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
preparationLines.setFdateModification(resultSet.getTimestamp("FDATE_MODIFICATION"));
|
||||
preparationLines.setToOrlixConsumed(resultSet.getBoolean("TO_ORLIX_CONSUMED"));
|
||||
preparationLines.setRestockingCode(resultSet.getString("RESTOCKING_CODE"));
|
||||
|
||||
return preparationLines;
|
||||
}
|
||||
|
||||
private Order.Preparation mapResultSetToPreparation(ResultSet resultSet) throws SQLException {
|
||||
Order.Preparation preparation = new Order().new Preparation();
|
||||
|
||||
preparation.setPrepIntId(resultSet.getInt("PREP_INT_ID"));
|
||||
preparation.setPrepId(resultSet.getInt("PREP_ID"));
|
||||
preparation.setOrderId(resultSet.getString("ORDER_ID"));
|
||||
preparation.setRequestId(resultSet.getLong("REQUEST_ID"));
|
||||
preparation.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
preparation.setFulfillmentSystemCd(resultSet.getString("FULFILLMENT_SYSTEM_CD"));
|
||||
preparation.setFulfillmentLocationCd(resultSet.getString("FULFILLMENT_LOCATION_CD"));
|
||||
preparation.setStatus(resultSet.getString("STATUS"));
|
||||
preparation.setDatePreparation(resultSet.getTimestamp("DATE_PREPARTION"));
|
||||
preparation.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
|
||||
return preparation;
|
||||
}
|
||||
|
||||
private Order.Reception.ReceptionLines mapResultSetToReceptionLines(ResultSet resultSet) throws SQLException {
|
||||
Order.Reception.ReceptionLines receptionLines = new Order().new Reception().new ReceptionLines();
|
||||
|
||||
receptionLines.setLineIntransitId(resultSet.getInt("LINE_INTRANSIT_ID"));
|
||||
receptionLines.setIntransitIntId(resultSet.getInt("INTRANSIT_INT_ID"));
|
||||
receptionLines.setLineFulfillId(resultSet.getInt("LINE_FULFILL_ID"));
|
||||
receptionLines.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
receptionLines.setLineItemNo(resultSet.getInt("LINE_ITEM_NO"));
|
||||
receptionLines.setItemId(resultSet.getString("ITEM_ID"));
|
||||
receptionLines.setIntransitQty(resultSet.getInt("INTRANSIT_QTY"));
|
||||
receptionLines.setValidatedIntransitQty(resultSet.getInt("VALIDATED_INTRANSIT_QTY"));
|
||||
receptionLines.setIntransitSystemCd(resultSet.getString("INTRANSIT_SYSTEM_CD"));
|
||||
receptionLines.setIntransitLocationCd(resultSet.getString("INTRANSIT_LOCATION_CD"));
|
||||
receptionLines.setStatus(resultSet.getString("STATUS"));
|
||||
receptionLines.setColisId(resultSet.getString("COLIS_ID"));
|
||||
receptionLines.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
receptionLines.setFdateReceipt(resultSet.getTimestamp("FDATE_RECEIPT"));
|
||||
receptionLines.setOrderLineShipWeight(resultSet.getDouble("ORDER_LINE_SHIP_WEIGHT"));
|
||||
receptionLines.setTrackingNumber(resultSet.getString("TRACKING_NUMBER"));
|
||||
|
||||
return receptionLines;
|
||||
}
|
||||
|
||||
private Order.Reception mapResultSetToReception(ResultSet resultSet) throws SQLException {
|
||||
Order.Reception reception = new Order().new Reception();
|
||||
|
||||
reception.setIntransitIntId(resultSet.getInt("INTRANSIT_INT_ID"));
|
||||
reception.setIntransitId(resultSet.getString("INTRANSIT_ID"));
|
||||
reception.setPrepIntId(resultSet.getInt("PREP_INT_ID"));
|
||||
reception.setOrderId(resultSet.getString("ORDER_ID"));
|
||||
reception.setRequestId(resultSet.getLong("REQUEST_ID"));
|
||||
reception.setStatus(resultSet.getString("STATUS"));
|
||||
reception.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
reception.setIntransitSystemCd(resultSet.getString("INTRANSIT_SYSTEM_CD"));
|
||||
reception.setIntransitLocationCd(resultSet.getString("INTRANSIT_LOCATION_CD"));
|
||||
reception.setFdateReceipt(resultSet.getTimestamp("FDATE_RECEIPT"));
|
||||
reception.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
|
||||
return reception;
|
||||
}
|
||||
|
||||
private Order.History mapResultSetToOrderLinesHistory(ResultSet resultSet) throws SQLException {
|
||||
Order.History orderLinesHistory = new Order().new History();
|
||||
|
||||
orderLinesHistory.setStatusId(resultSet.getInt("STATUS_ID"));
|
||||
orderLinesHistory.setId(resultSet.getLong("LINE_ORDER_ID"));
|
||||
orderLinesHistory.setStatus(resultSet.getString("STATUS"));
|
||||
orderLinesHistory.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
orderLinesHistory.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
|
||||
return orderLinesHistory;
|
||||
}
|
||||
|
||||
private Order.History mapResultSetToOrderHistory(ResultSet resultSet) throws SQLException {
|
||||
Order.History orderHistory = new Order().new History();
|
||||
|
||||
orderHistory.setStatusId(resultSet.getInt("STATUS_ID"));
|
||||
orderHistory.setId(resultSet.getLong("REQUEST_ID"));
|
||||
orderHistory.setStatus(resultSet.getString("STATUS"));
|
||||
orderHistory.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
orderHistory.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
|
||||
return orderHistory;
|
||||
}
|
||||
|
||||
private Order.Lines mapResultSetToOrderLine(ResultSet resultSet) throws SQLException {
|
||||
Order.Lines orderLine = new Order().new Lines();
|
||||
|
||||
orderLine.setLineOrderId(resultSet.getLong("LINE_ORDER_ID"));
|
||||
orderLine.setLineItemNo(resultSet.getInt("LINE_ITEM_NO"));
|
||||
orderLine.setLineItemOms(resultSet.getString("LINE_ITEM_OMS"));
|
||||
orderLine.setItemId(resultSet.getString("ITEM_ID"));
|
||||
orderLine.setOrderedLineQty(resultSet.getInt("ORDERED_LINE_QTY"));
|
||||
orderLine.setStatus(resultSet.getString("STATUS"));
|
||||
orderLine.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
orderLine.setShippingAgent(resultSet.getString("SHIPPING_AGENT"));
|
||||
orderLine.setTrackingNumber(resultSet.getString("TRACKING_NUMBER"));
|
||||
orderLine.setFulfillmentId(resultSet.getString("FULFILLMENT_ID"));
|
||||
orderLine.setCartonNumber(resultSet.getString("CARTON_NUMBER"));
|
||||
orderLine.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
orderLine.setConsumed(resultSet.getBoolean("CONSUMED"));
|
||||
|
||||
return orderLine;
|
||||
}
|
||||
|
||||
private Order mapResultSetToOrderList(ResultSet resultSet) throws SQLException {
|
||||
Order order = new Order();
|
||||
Order.Meta meta = new Order.Meta();
|
||||
Order.Common common = order.new Common();
|
||||
Order.Common.StatusData statusData = common.new StatusData();
|
||||
Order.Common.Transaction transaction = common.new Transaction();
|
||||
|
||||
meta.setId(resultSet.getLong("REQUEST_ID"));
|
||||
order.setMeta(meta);
|
||||
|
||||
statusData.setCode(resultSet.getString("STATUS"));
|
||||
statusData.setTitle("TEST"); // TODO A VOIR
|
||||
|
||||
common.setOrderId(resultSet.getString("ORDER_ID"));
|
||||
|
||||
transaction.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
transaction.setTransactionTypeDescription(resultSet.getString("TRANSACTION_TYPE_DESCRIPTION"));
|
||||
|
||||
common.setStatusData(statusData);
|
||||
common.setTransaction(transaction);
|
||||
|
||||
order.setMeta(meta);
|
||||
order.setCommon(common);
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
private Order mapResultSetToOrder(ResultSet resultSet) throws SQLException {
|
||||
Order order = new Order();
|
||||
Order.Meta meta = new Order.Meta();
|
||||
Order.Common common = order.new Common();
|
||||
Order.Common.StatusData statusData = common.new StatusData();
|
||||
Order.Common.Transaction transaction = common.new Transaction();
|
||||
|
||||
meta.setId(resultSet.getLong("REQUEST_ID"));
|
||||
order.setMeta(meta);
|
||||
|
||||
statusData.setCode(resultSet.getString("STATUS"));
|
||||
statusData.setTitle("TEST"); // TODO A VOIR
|
||||
|
||||
common.setOrderId(resultSet.getString("ORDER_ID"));
|
||||
common.setRequestingLocationCd(resultSet.getString("REQUESTING_LOCATION_CD"));
|
||||
common.setRequestingSystemCd(resultSet.getString("REQUESTING_SYSTEM_CD"));
|
||||
common.setCustomerId(resultSet.getString("CUSTOMER_ID"));
|
||||
common.setFdateCreation(resultSet.getTimestamp("FDATE_CREATION"));
|
||||
common.setConsumed(resultSet.getBoolean("CONSUMED"));
|
||||
common.setShipforpickupLocationCd(resultSet.getString("SHIPFORPICKUP_LOCATION_CD"));
|
||||
common.setShipforpickupSystemCd(resultSet.getString("SHIPFORPICKUP_SYSTEM_CD"));
|
||||
|
||||
transaction.setTransactionNo(resultSet.getString("TRANSACTION_NO"));
|
||||
transaction.setTransactionTypeId(resultSet.getInt("TRANSACTION_TYPE_ID"));
|
||||
transaction.setTransactionDate(resultSet.getTimestamp("TRANSACTION_DATE"));
|
||||
transaction.setTransactionTypeDescription(resultSet.getString("TRANSACTION_TYPE_DESCRIPTION"));
|
||||
|
||||
common.setStatusData(statusData);
|
||||
common.setTransaction(transaction);
|
||||
|
||||
order.setMeta(meta);
|
||||
order.setCommon(common);
|
||||
|
||||
return order;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.example.services;
|
||||
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Path("/proximis")
|
||||
public class ProximisService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProximisService.class);
|
||||
|
||||
@GET
|
||||
@Path("/project/fulfillment/{orderCode}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getOrderDetail(@PathParam("orderCode") String orderCode) {
|
||||
if (orderCode == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"orderCode is required\"}").build();
|
||||
}
|
||||
|
||||
String environment = loadEnvironment();
|
||||
|
||||
try {
|
||||
Properties apiProperties = loadApiProperties();
|
||||
String url = apiProperties.getProperty(environment + ".proximis.api.url");
|
||||
String urlApp = apiProperties.getProperty(environment + ".proximis.app.url");
|
||||
String bearerToken = "";
|
||||
|
||||
DriverManager.setLoginTimeout(5); // Définir le timeout à 5 secondes
|
||||
|
||||
try (DatabaseConnectOBI databaseConnection = new DatabaseConnectOBI()) {
|
||||
String query = "SELECT authorization_value FROM obi.obi_param_access_token WHERE authorization_header = ?"
|
||||
+ " and cloud_type = 'PROXIMIS' AND application = 'OBI_ACCESS_TOKEN' AND version = 'V2'";
|
||||
PreparedStatement stmt = databaseConnection.getConnection().prepareStatement(query);
|
||||
|
||||
stmt.setString(1, "Authorization");
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
bearerToken = rs.getString(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (bearerToken == null || bearerToken.isEmpty()) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"Empty bearer token\"}").build();
|
||||
} else {
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url + "/project/fulfillment/" + orderCode))
|
||||
.header("Authorization", bearerToken)
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
if (response.statusCode() == 200) {
|
||||
JSONObject commonObject = new JSONObject();
|
||||
commonObject.put("urlApp", urlApp);
|
||||
|
||||
JSONObject jsonResponse = new JSONObject();
|
||||
jsonResponse.put("common", commonObject);
|
||||
jsonResponse.put("oms", new JSONObject(response.body()));
|
||||
|
||||
return Response.ok(jsonResponse.toString()).build();
|
||||
} else if (response.statusCode() == 401) {
|
||||
return Response.status(Response.Status.UNAUTHORIZED).entity("{\"error\":\"Invalid token\"}").build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("{\"error\":\"Failed to get order detail\"}").build();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"error\":\"Unexpected error\"}").build();
|
||||
}
|
||||
}
|
||||
|
||||
private String loadEnvironment() {
|
||||
Properties envProperties = loadProperties("env.properties");
|
||||
return envProperties.getProperty("environment");
|
||||
}
|
||||
|
||||
private Properties loadApiProperties() {
|
||||
Properties apiProperties = loadProperties("api.properties");
|
||||
return apiProperties;
|
||||
}
|
||||
private Properties loadProperties(String fileName) {
|
||||
Properties properties = new Properties();
|
||||
try (InputStream input = getClass().getClassLoader().getResourceAsStream(fileName)) {
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Handle the exception correctly for your application
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,7 @@ public class StoreService {
|
|||
" WHERE st.id_structure = ?";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
statement.setString(1, storeId);
|
||||
|
||||
|
|
@ -186,7 +187,8 @@ public class StoreService {
|
|||
" WHERE axs.date_stock is not null AND st.ID_NIVEAU=4 AND st.STATUT=2 AND st.id_canal_distribution = 1 and st.magasin_demo = 0" +
|
||||
" ORDER BY st.id_structure";
|
||||
|
||||
logger.info(query);
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query);
|
||||
ResultSet resultSet = statement.executeQuery()) {
|
||||
|
||||
|
|
@ -230,6 +232,7 @@ public class StoreService {
|
|||
"ORDER BY WKSTN_ID, SEQUENCE_ID";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
|
|
@ -282,6 +285,7 @@ public class StoreService {
|
|||
"ORDER BY WKSTN_ID";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
|
|
@ -335,7 +339,8 @@ public class StoreService {
|
|||
"WHERE organization_id = 1 AND customer IS NOT NULL " +
|
||||
"ORDER BY seq DESC";
|
||||
|
||||
logger.info(query);
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
|
||||
|
|
@ -449,6 +454,7 @@ public class StoreService {
|
|||
"ORDER BY cel.CREATE_DATE DESC";
|
||||
|
||||
logger.info(query);
|
||||
|
||||
try (PreparedStatement statement = databaseConnection.getConnection().prepareStatement(query)) {
|
||||
statement.setString(1, logDate + " 00:00:00");
|
||||
statement.setString(2, logDate + " 23:59:59");
|
||||
|
|
@ -659,6 +665,7 @@ public class StoreService {
|
|||
" WHERE st.id_structure = ?";
|
||||
|
||||
logger.info(storeQuery);
|
||||
|
||||
try (PreparedStatement storeStatement = databaseConnectionDS.getConnection().prepareStatement(storeQuery)) {
|
||||
storeStatement.setInt(1, storeId); // Set the value of the parameter
|
||||
|
||||
|
|
@ -685,6 +692,7 @@ public class StoreService {
|
|||
|
||||
for (StorePos pos : storeDetails.getPos()) {
|
||||
logger.info(boTransactionQuery);
|
||||
|
||||
try (PreparedStatement boTransactionStatement = databaseConnectionDS.getConnection().prepareStatement(boTransactionQuery)) {
|
||||
boTransactionStatement.setInt(1, storeId);
|
||||
boTransactionStatement.setInt(2, pos.getWorkstationId());
|
||||
|
|
@ -720,6 +728,7 @@ public class StoreService {
|
|||
"WHERE crq.organization_id = 1 AND crq.RTL_LOC_ID = ? and crq.WKSTN_ID = ?";
|
||||
|
||||
logger.info(replicationQuery);
|
||||
|
||||
try (PreparedStatement replicationStatement = databaseConnection.getConnection().prepareStatement(replicationQuery)) {
|
||||
replicationStatement.setInt(1, storeId);
|
||||
replicationStatement.setInt(2, workstationId);
|
||||
|
|
@ -746,7 +755,8 @@ public class StoreService {
|
|||
"AND lsj.STRING_VALUE = 'OPEN'";
|
||||
|
||||
logger.info(openingQuery);
|
||||
try (PreparedStatement openingStatement = databaseConnection.getConnection().prepareStatement(openingQuery)) {
|
||||
|
||||
try (PreparedStatement openingStatement = databaseConnection.getConnection().prepareStatement(openingQuery)) {
|
||||
openingStatement.setInt(1, storeId);
|
||||
openingStatement.setInt(2, workstationId);
|
||||
|
||||
|
|
@ -771,7 +781,8 @@ public class StoreService {
|
|||
"AND lsj.STRING_VALUE = 'CLOSED'";
|
||||
|
||||
logger.info(closingQuery);
|
||||
try (PreparedStatement closingStatement = databaseConnection.getConnection().prepareStatement(closingQuery)) {
|
||||
|
||||
try (PreparedStatement closingStatement = databaseConnection.getConnection().prepareStatement(closingQuery)) {
|
||||
closingStatement.setInt(1, storeId);
|
||||
closingStatement.setInt(2, workstationId);
|
||||
|
||||
|
|
@ -797,7 +808,8 @@ public class StoreService {
|
|||
"AND tt.trans_TYPCODE = 'RETAIL_SALE' " +
|
||||
"AND tt.TRANS_STATCODE = 'COMPLETE'";
|
||||
|
||||
logger.info(saleTransactionQuery);
|
||||
logger.info(saleTransactionQuery);
|
||||
|
||||
try (PreparedStatement saleTransactionStatement = databaseConnection.getConnection().prepareStatement(saleTransactionQuery)) {
|
||||
saleTransactionStatement.setInt(1, storeId);
|
||||
saleTransactionStatement.setDate(2, pos.getBusinessDate());
|
||||
|
|
@ -823,6 +835,7 @@ public class StoreService {
|
|||
"AND cel.LOG_LEVEL = 'FATAL'";
|
||||
|
||||
logger.info(logQuery);
|
||||
|
||||
try (PreparedStatement logStatement = databaseConnection.getConnection().prepareStatement(logQuery)) {
|
||||
logStatement.setInt(1, storeId);
|
||||
logStatement.setInt(2, workstationId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,502 @@
|
|||
package com.example.services.order;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.sql.Timestamp;
|
||||
public class Order {
|
||||
private Meta meta;
|
||||
private Common common;
|
||||
private List<Lines> lines = new ArrayList<>();
|
||||
private List<History> history = new ArrayList<>();
|
||||
private List<Preparation> preparations = new ArrayList<>();
|
||||
private List<Reception> receptions = new ArrayList<>();
|
||||
|
||||
// getters and setters for Order
|
||||
public Meta getMeta() { return meta; }
|
||||
public void setMeta(Meta meta) { this.meta = meta; }
|
||||
public Common getCommon() { return common; }
|
||||
public void setCommon(Common common) { this.common = common; }
|
||||
public List<Lines> getLines() { return lines; }
|
||||
public void setLines(List<Lines> lines) { this.lines = lines; }
|
||||
public List<History> getHistory() { return history; }
|
||||
public void setHistory(List<History> history) { this.history = history; }
|
||||
public List<Preparation> getPreparations() { return preparations; }
|
||||
public void setPreparations(List<Preparation> preparation) { this.preparations = preparation; }
|
||||
public List<Reception> getReceptions() { return receptions; }
|
||||
public void setReceptions(List<Reception> reception) { this.receptions = reception; }
|
||||
|
||||
public static class Meta {
|
||||
private long id;
|
||||
|
||||
// getters and setters
|
||||
|
||||
public String getModel() {
|
||||
return "Order";
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Common {
|
||||
private String orderId;
|
||||
private String requestingLocationCd;
|
||||
private String requestingSystemCd;
|
||||
private String customerId;
|
||||
private String submitOrdMsg;
|
||||
private Timestamp fdateCreation;
|
||||
private boolean consumed;
|
||||
private String shipforpickupLocationCd;
|
||||
private String shipforpickupSystemCd;
|
||||
private StatusData statusData;
|
||||
private Transaction transaction;
|
||||
|
||||
// getters for Common
|
||||
public String getOrderId() { return orderId; }
|
||||
public String getRequestingLocationCd() { return requestingLocationCd; }
|
||||
public String getRequestingSystemCd() { return requestingSystemCd; }
|
||||
public String getCustomerId() { return customerId; }
|
||||
public String getSubmitOrdMsg() { return submitOrdMsg; }
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
public boolean isConsumed() { return consumed; }
|
||||
public String getShipforpickupLocationCd() { return shipforpickupLocationCd; }
|
||||
public String getShipforpickupSystemCd() { return shipforpickupSystemCd; }
|
||||
|
||||
// setters for Common
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public void setRequestingLocationCd(String requestingLocationCd) { this.requestingLocationCd = requestingLocationCd; }
|
||||
public void setRequestingSystemCd(String requestingSystemCd) { this.requestingSystemCd = requestingSystemCd; }
|
||||
public void setCustomerId(String customerId) { this.customerId = customerId; }
|
||||
public void setSubmitOrdMsg(String submitOrdMsg) { this.submitOrdMsg = submitOrdMsg; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
public void setConsumed(boolean consumed) { this.consumed = consumed; }
|
||||
public void setShipforpickupLocationCd(String shipforpickupLocationCd) { this.shipforpickupLocationCd = shipforpickupLocationCd; }
|
||||
public void setShipforpickupSystemCd(String shipforpickupSystemCd) { this.shipforpickupSystemCd = shipforpickupSystemCd; }
|
||||
|
||||
public class StatusData {
|
||||
private String code;
|
||||
private String title;
|
||||
|
||||
// getters for StatusData
|
||||
public String getCode() { return code; }
|
||||
public String getTitle() { return title; }
|
||||
|
||||
// setters for StatusData
|
||||
public void setCode(String code) { this.code = code; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
}
|
||||
|
||||
// getters for order/statusdata
|
||||
public StatusData getStatusData() { return statusData; }
|
||||
|
||||
// setters for order/statusdata
|
||||
public void setStatusData(StatusData statusData) { this.statusData = statusData; }
|
||||
|
||||
public class Transaction {
|
||||
private Integer transactionTypeId;
|
||||
private Timestamp transactionDate;
|
||||
private String transactionNo;
|
||||
private String transactionTypeDescription;
|
||||
|
||||
// getters for Transaction
|
||||
public Integer getTransactionTypeId() { return transactionTypeId; }
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return transactionDate != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
public String getTransactionNo() { return transactionNo; }
|
||||
public String getTransactionTypeDescription() { return transactionTypeDescription; }
|
||||
|
||||
// setters for Transaction
|
||||
public void setTransactionTypeId(Integer transactionTypeId) { this.transactionTypeId = transactionTypeId; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setTransactionNo(String transactionNo) { this.transactionNo = transactionNo; }
|
||||
public void setTransactionTypeDescription(String transactionTypeDescription) { this.transactionTypeDescription = transactionTypeDescription; }
|
||||
}
|
||||
|
||||
// getters for order/transaction
|
||||
public Transaction getTransaction() { return transaction; }
|
||||
|
||||
// setters for order/transaction
|
||||
public void setTransaction(Transaction transaction) { this.transaction = transaction; }
|
||||
}
|
||||
|
||||
public class Lines {
|
||||
private Long lineOrderId;
|
||||
private Integer lineItemNo;
|
||||
private String orderId;
|
||||
private Long requestId;
|
||||
private String lineItemOms;
|
||||
private String itemId;
|
||||
private Integer orderedLineQty;
|
||||
private String status;
|
||||
private Timestamp transactionDate;
|
||||
private String shippingAgent;
|
||||
private String trackingNumber;
|
||||
private String fulfillmentId;
|
||||
private String cartonNumber;
|
||||
private Timestamp fdateCreation;
|
||||
private Boolean consumed;
|
||||
private List<History> history = new ArrayList<>();
|
||||
|
||||
// getters
|
||||
public Long getLineOrderId() { return lineOrderId; }
|
||||
public Integer getLineItemNo() { return lineItemNo; }
|
||||
public String getOrderId() { return orderId; }
|
||||
public Long getRequestId() { return requestId; }
|
||||
public String getLineItemOms() { return lineItemOms; }
|
||||
public String getItemId() { return itemId; }
|
||||
public Integer getOrderedLineQty() { return orderedLineQty; }
|
||||
public String getStatus() { return status; }
|
||||
public Timestamp getTransactionDate() { return transactionDate; }
|
||||
public String getShippingAgent() { return shippingAgent; }
|
||||
public String getTrackingNumber() { return trackingNumber; }
|
||||
public String getFulfillmentId() { return fulfillmentId; }
|
||||
public String getCartonNumber() { return cartonNumber; }
|
||||
public Timestamp getFdateCreation() { return fdateCreation; }
|
||||
public Boolean isConsumed() { return consumed; }
|
||||
public List<History> getHistory() { return history; }
|
||||
|
||||
// setters
|
||||
public void setLineOrderId(Long lineOrderId) { this.lineOrderId = lineOrderId; }
|
||||
public void setLineItemNo(Integer lineItemNo) { this.lineItemNo = lineItemNo; }
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public void setRequestId(Long requestId) { this.requestId = requestId; }
|
||||
public void setLineItemOms(String lineItemOms) { this.lineItemOms = lineItemOms; }
|
||||
public void setItemId(String itemId) { this.itemId = itemId; }
|
||||
public void setOrderedLineQty(Integer orderedLineQty) { this.orderedLineQty = orderedLineQty; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setShippingAgent(String shippingAgent) { this.shippingAgent = shippingAgent; }
|
||||
public void setTrackingNumber(String trackingNumber) { this.trackingNumber = trackingNumber; }
|
||||
public void setFulfillmentId(String fulfillmentId) { this.fulfillmentId = fulfillmentId; }
|
||||
public void setCartonNumber(String cartonNumber) { this.cartonNumber = cartonNumber; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
public void setConsumed(Boolean consumed) { this.consumed = consumed; }
|
||||
public void setHistory(List<History> history) { this.history = history; }
|
||||
}
|
||||
|
||||
public class History {
|
||||
private Integer statusId;
|
||||
private Long Id;
|
||||
private String status;
|
||||
private Timestamp transactionDate;
|
||||
private Timestamp fdateCreation;
|
||||
|
||||
// Getters
|
||||
public Integer getStatusId() { return statusId; }
|
||||
public Long getId() { return Id; }
|
||||
public String getStatus() { return status; }
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setStatusId(Integer statusId) { this.statusId = statusId; }
|
||||
public void setId(Long Id) { this.Id = Id; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
}
|
||||
|
||||
public class Preparation {
|
||||
private Integer prepIntId;
|
||||
private Integer prepId;
|
||||
private String orderId;
|
||||
private Long requestId;
|
||||
private Timestamp transactionDate;
|
||||
private String fulfillmentSystemCd;
|
||||
private String fulfillmentLocationCd;
|
||||
private String status;
|
||||
private Timestamp datePreparation;
|
||||
private Timestamp fdateCreation;
|
||||
private List<PreparationLines> lines = new ArrayList<>();
|
||||
|
||||
public List<PreparationLines> getLines() { return lines; }
|
||||
public void setLines(List<PreparationLines> lines) { this.lines = lines; }
|
||||
|
||||
// Getters
|
||||
public Integer getPrepIntId() { return prepIntId; }
|
||||
public Integer getPrepId() { return prepId; }
|
||||
public String getOrderId() { return orderId; }
|
||||
public Long getRequestId() { return requestId; }
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return transactionDate != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
public String getFulfillmentSystemCd() { return fulfillmentSystemCd; }
|
||||
public String getFulfillmentLocationCd() { return fulfillmentLocationCd; }
|
||||
public String getStatus() { return status; }
|
||||
public String getDatePreparation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return datePreparation != null ? formatter.format(datePreparation.toInstant()) : "";
|
||||
}
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setPrepIntId(Integer prepIntId) { this.prepIntId = prepIntId; }
|
||||
public void setPrepId(Integer prepId) { this.prepId = prepId; }
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public void setRequestId(Long requestId) { this.requestId = requestId; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setFulfillmentSystemCd(String fulfillmentSystemCd) { this.fulfillmentSystemCd = fulfillmentSystemCd; }
|
||||
public void setFulfillmentLocationCd(String fulfillmentLocationCd) { this.fulfillmentLocationCd = fulfillmentLocationCd; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setDatePreparation(Timestamp datePreparation) { this.datePreparation = datePreparation; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
|
||||
public class PreparationLines {
|
||||
private Integer lineFulfillId;
|
||||
private Integer lineOrderId;
|
||||
private Integer prepIntId;
|
||||
private String orderId;
|
||||
private Long requestId;
|
||||
private Timestamp transactionDate;
|
||||
private Integer lineItemNo;
|
||||
private String itemId;
|
||||
private String lineItemOms;
|
||||
private Integer fulfillQty;
|
||||
private Integer validatedFulfillQty;
|
||||
private String fulfillmentSystemCd;
|
||||
private String fulfillmentLocationCd;
|
||||
private String status;
|
||||
private String numeroExpedition;
|
||||
private String seasonCode;
|
||||
private String finitionSpeciale;
|
||||
private String carrier;
|
||||
private String trackingCode;
|
||||
private String trackingUrl;
|
||||
private Timestamp fdateCreation;
|
||||
private Timestamp fdateModification;
|
||||
private Boolean toOrlixConsumed;
|
||||
private String restockingCode;
|
||||
|
||||
// Getters
|
||||
public Integer getLineFulfillId() { return lineFulfillId; }
|
||||
public Integer getLineOrderId() { return lineOrderId; }
|
||||
public Integer getPrepIntId() { return prepIntId; }
|
||||
public String getOrderId() { return orderId; }
|
||||
public Long getRequestId() { return requestId; }
|
||||
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return transactionDate != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
|
||||
public Integer getLineItemNo() { return lineItemNo; }
|
||||
public String getItemId() { return itemId; }
|
||||
public String getLineItemOms() { return lineItemOms; }
|
||||
public Integer getFulfillQty() { return fulfillQty; }
|
||||
public Integer getValidatedFulfillQty() { return validatedFulfillQty; }
|
||||
public String getFulfillmentSystemCd() { return fulfillmentSystemCd; }
|
||||
public String getFulfillmentLocationCd() { return fulfillmentLocationCd; }
|
||||
public String getStatus() { return status; }
|
||||
public String getNumeroExpedition() { return numeroExpedition; }
|
||||
public String getSeasonCode() { return seasonCode; }
|
||||
public String getFinitionSpeciale() { return finitionSpeciale; }
|
||||
public String getCarrier() { return carrier; }
|
||||
public String getTrackingCode() { return trackingCode; }
|
||||
public String getTrackingUrl() { return trackingUrl; }
|
||||
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
|
||||
public String getFdateModification() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return fdateModification != null ? formatter.format(fdateModification.toInstant()) : "";
|
||||
}
|
||||
|
||||
public Boolean getToOrlixConsumed() { return toOrlixConsumed; }
|
||||
public String getRestockingCode() { return restockingCode; }
|
||||
|
||||
// Setters
|
||||
public void setLineFulfillId(Integer lineFulfillId) { this.lineFulfillId = lineFulfillId; }
|
||||
public void setLineOrderId(Integer lineOrderId) { this.lineOrderId = lineOrderId; }
|
||||
public void setPrepIntId(Integer prepIntId) { this.prepIntId = prepIntId; }
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public void setRequestId(Long requestId) { this.requestId = requestId; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setLineItemNo(Integer lineItemNo) { this.lineItemNo = lineItemNo; }
|
||||
public void setItemId(String itemId) { this.itemId = itemId; }
|
||||
public void setLineItemOms(String lineItemOms) { this.lineItemOms = lineItemOms; }
|
||||
public void setFulfillQty(Integer fulfillQty) { this.fulfillQty = fulfillQty; }
|
||||
public void setValidatedFulfillQty(Integer validatedFulfillQty) { this.validatedFulfillQty = validatedFulfillQty; }
|
||||
public void setFulfillmentSystemCd(String fulfillmentSystemCd) { this.fulfillmentSystemCd = fulfillmentSystemCd; }
|
||||
public void setFulfillmentLocationCd(String fulfillmentLocationCd) { this.fulfillmentLocationCd = fulfillmentLocationCd; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setNumeroExpedition(String numeroExpedition) { this.numeroExpedition = numeroExpedition; }
|
||||
public void setSeasonCode(String seasonCode) { this.seasonCode = seasonCode; }
|
||||
public void setFinitionSpeciale(String finitionSpeciale) { this.finitionSpeciale = finitionSpeciale; }
|
||||
public void setCarrier(String carrier) { this.carrier = carrier; }
|
||||
public void setTrackingCode(String trackingCode) { this.trackingCode = trackingCode; }
|
||||
public void setTrackingUrl(String trackingUrl) { this.trackingUrl = trackingUrl; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
public void setFdateModification(Timestamp fdateModification) { this.fdateModification = fdateModification; }
|
||||
public void setToOrlixConsumed(Boolean toOrlixConsumed) { this.toOrlixConsumed = toOrlixConsumed; }
|
||||
public void setRestockingCode(String restockingCode) { this.restockingCode = restockingCode; }
|
||||
}
|
||||
}
|
||||
|
||||
public class Reception {
|
||||
private int intransitIntId;
|
||||
private String intransitId;
|
||||
private int prepIntId;
|
||||
private String orderId;
|
||||
private long requestId;
|
||||
private String status;
|
||||
private Timestamp transactionDate;
|
||||
private String intransitSystemCd;
|
||||
private String intransitLocationCd;
|
||||
private Timestamp fdateReceipt;
|
||||
private Timestamp fdateCreation;
|
||||
private List<ReceptionLines> lines = new ArrayList<>();
|
||||
|
||||
public List<ReceptionLines> getLines() { return lines; }
|
||||
public void setLines(List<ReceptionLines> lines) { this.lines = lines; }
|
||||
|
||||
// Getters
|
||||
public int getIntransitIntId() { return intransitIntId; }
|
||||
public String getIntransitId() { return intransitId; }
|
||||
public int getPrepIntId() { return prepIntId; }
|
||||
public String getOrderId() { return orderId; }
|
||||
public long getRequestId() { return requestId; }
|
||||
public String getStatus() { return status; }
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
public String getIntransitSystemCd() { return intransitSystemCd; }
|
||||
public String getIntransitLocationCd() { return intransitLocationCd; }
|
||||
public String getFdateReceipt() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateReceipt != null ? formatter.format(fdateReceipt.toInstant()) : "";
|
||||
}
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setIntransitIntId(int intransitIntId) { this.intransitIntId = intransitIntId; }
|
||||
public void setIntransitId(String intransitId) { this.intransitId = intransitId; }
|
||||
public void setPrepIntId(int prepIntId) { this.prepIntId = prepIntId; }
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public void setRequestId(long requestId) { this.requestId = requestId; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setIntransitSystemCd(String intransitSystemCd) { this.intransitSystemCd = intransitSystemCd; }
|
||||
public void setIntransitLocationCd(String intransitLocationCd) { this.intransitLocationCd = intransitLocationCd; }
|
||||
public void setFdateReceipt(Timestamp fdateReceipt) { this.fdateReceipt = fdateReceipt; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
|
||||
public class ReceptionLines {
|
||||
private int lineIntransitId;
|
||||
private int intransitIntId;
|
||||
private int lineFulfillId;
|
||||
private Timestamp transactionDate;
|
||||
private int lineItemNo;
|
||||
private String itemId;
|
||||
private int intransitQty;
|
||||
private int validatedIntransitQty;
|
||||
private String intransitSystemCd;
|
||||
private String intransitLocationCd;
|
||||
private String status;
|
||||
private String colisId;
|
||||
private Timestamp fdateCreation;
|
||||
private Timestamp fdateReceipt;
|
||||
private Double orderLineShipWeight;
|
||||
private String trackingNumber;
|
||||
|
||||
// Getters
|
||||
public int getLineIntransitId() { return lineIntransitId; }
|
||||
public int getIntransitIntId() { return intransitIntId; }
|
||||
public int getLineFulfillId() { return lineFulfillId; }
|
||||
public String getTransactionDate() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return transactionDate != null ? formatter.format(transactionDate.toInstant()) : "";
|
||||
}
|
||||
public int getLineItemNo() { return lineItemNo; }
|
||||
public String getItemId() { return itemId; }
|
||||
public int getIntransitQty() { return intransitQty; }
|
||||
public int getValidatedIntransitQty() { return validatedIntransitQty; }
|
||||
public String getIntransitSystemCd() { return intransitSystemCd; }
|
||||
public String getIntransitLocationCd() { return intransitLocationCd; }
|
||||
public String getStatus() { return status; }
|
||||
public String getColisId() { return colisId; }
|
||||
public String getFdateCreation() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return fdateCreation != null ? formatter.format(fdateCreation.toInstant()) : "";
|
||||
}
|
||||
public String getFdateReceipt() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.withZone(ZoneId.of("Europe/Paris"));
|
||||
return fdateReceipt != null ? formatter.format(fdateReceipt.toInstant()) : "";
|
||||
}
|
||||
public Double getOrderLineShipWeight() { return orderLineShipWeight; }
|
||||
public String getTrackingNumber() { return trackingNumber; }
|
||||
|
||||
// Setters
|
||||
public void setLineIntransitId(int lineIntransitId) { this.lineIntransitId = lineIntransitId; }
|
||||
public void setIntransitIntId(int intransitIntId) { this.intransitIntId = intransitIntId; }
|
||||
public void setLineFulfillId(int lineFulfillId) { this.lineFulfillId = lineFulfillId; }
|
||||
public void setTransactionDate(Timestamp transactionDate) { this.transactionDate = transactionDate; }
|
||||
public void setLineItemNo(int lineItemNo) { this.lineItemNo = lineItemNo; }
|
||||
public void setItemId(String itemId) { this.itemId = itemId; }
|
||||
public void setIntransitQty(int intransitQty) { this.intransitQty = intransitQty; }
|
||||
public void setValidatedIntransitQty(int validatedIntransitQty) { this.validatedIntransitQty = validatedIntransitQty; }
|
||||
public void setIntransitSystemCd(String intransitSystemCd) { this.intransitSystemCd = intransitSystemCd; }
|
||||
public void setIntransitLocationCd(String intransitLocationCd) { this.intransitLocationCd = intransitLocationCd; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public void setColisId(String colisId) { this.colisId = colisId; }
|
||||
public void setFdateCreation(Timestamp fdateCreation) { this.fdateCreation = fdateCreation; }
|
||||
public void setFdateReceipt(Timestamp fdateReceipt) { this.fdateReceipt = fdateReceipt; }
|
||||
public void setOrderLineShipWeight(Double orderLineShipWeight) { this.orderLineShipWeight = orderLineShipWeight; }
|
||||
public void setTrackingNumber(String trackingNumber) { this.trackingNumber = trackingNumber; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Pre-production API Proximis
|
||||
preprod.proximis.api.url=https://proximis-ikks-recette.stg.proximis.com/publicAPI.php/V2
|
||||
preprod.proximis.app.url=https://proximis-ikks-recette.stg.proximis.com
|
||||
|
||||
# production API Proximis
|
||||
prod.proximis.api.url=https://ikks.omn.proximis.com/publicAPI.php/V2
|
||||
prod.proximis.app.url=https://ikks.omn.proximis.com
|
||||
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
# Development environment settings (dev)
|
||||
dev.db.url=jdbc:oracle:thin:@v-aspd-b01-irdc.adic.lan:1521/MASPDI
|
||||
dev.db.oai.password=base
|
||||
dev.db.com02.password=B1Xto9pAbtBCOxuecG7W
|
||||
# Development DOTSOFT environment settings
|
||||
dev.dotsoft.db.url=jdbc:oracle:thin:@v-aspd-b01-irdc.adic.lan:1521/MASPDI
|
||||
dev.dotsoft.db.oai.password=base
|
||||
dev.dotsoft.db.com02.password=B1Xto9pAbtBCOxuecG7W
|
||||
|
||||
# Pre-production environment settings (preprod)
|
||||
preprod.db.url=jdbc:oracle:thin:@v-aspd-b01-ii-d.adic.lan:1521/IASPDI
|
||||
preprod.db.oai.password=base
|
||||
preprod.db.com02.password=B1Xto9pAbtBCOxuecG7W
|
||||
# Pre-production DOTSOFT environment settings
|
||||
preprod.dotsoft.db.url=jdbc:oracle:thin:@v-aspd-b01-ii-d.adic.lan:1521/IASPDI
|
||||
preprod.dotsoft.db.oai.password=base
|
||||
preprod.dotsoft.db.com02.password=B1Xto9pAbtBCOxuecG7W
|
||||
|
||||
# Production environment settings (prod)
|
||||
prod.db.url=jdbc:oracle:thin:@v-aspd-b03-ip-d.adic.lan:1521/PASPDI
|
||||
prod.db.oai.password=base
|
||||
prod.db.com02.password=com20
|
||||
# Production DOTSOFT environment settings
|
||||
prod.dotsoft.db.url=jdbc:oracle:thin:@v-aspd-b03-ip-d.adic.lan:1521/PASPDI
|
||||
prod.dotsoft.db.oai.password=base
|
||||
prod.dotsoft.db.com02.password=com20
|
||||
|
||||
# XSTORE environment settings
|
||||
xstore.db.url=jdbc:oracle:thin:@HOST:1521/XSTORE
|
||||
|
|
@ -19,5 +19,18 @@ xstore.db.dtv.password=dtv
|
|||
xstore.db.repqueue.password=repqueue
|
||||
|
||||
# XADMIN environment settings
|
||||
xadmin.db.url=jdbc:oracle:thin:@p-ODBG-b01-ipDC.tech.ikks.lan:1522/PXSTOREI
|
||||
xadmin.db.dtv.password=oY3poRSprOuqasO
|
||||
preprod.xadmin.db.url=jdbc:oracle:thin:@v-xsto-b01-irdc.adic.lan:1521/RXSTOI
|
||||
preprod.xadmin.db.dtv.password=Dtv.x#33
|
||||
prod.xadmin.db.url=jdbc:oracle:thin:@p-ODBG-b01-ipDC.tech.ikks.lan:1522/PXSTOREI
|
||||
prod.xadmin.db.dtv.password=oY3poRSprOuqasO
|
||||
|
||||
# Pre-production OBI environment settings
|
||||
preprod.obi.db.url=jdbc:postgresql://v-tlnd-b01-iidc.tech.ikks.lan:5432/mirobi
|
||||
preprod.obi.db.username=mobi
|
||||
preprod.obi.db.password=obi
|
||||
|
||||
# production OBI environment settings
|
||||
prod.obi.db.url=jdbc:postgresql://v-tlnd-b01-ipdc.tech.ikks.lan:5432/pirobi
|
||||
prod.obi.db.username=pobi
|
||||
prod.obi.db.password=y!h`AGZjGVa.ae;(N
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue