Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
8514352
Ignore .tomcat folders
Nov 30, 2021
a6fe4ac
Join Success and Error message columns in table with Upload results t…
Nov 30, 2021
9c0b8de
Clean pom - global java version and project encoding
Nov 30, 2021
77769f5
Fix Idea warnings
Nov 30, 2021
d2a131f
chore: typo, warnings
Nov 30, 2021
d0d1d4b
start to add button
Nov 30, 2021
c8093cb
AddToBasket - use enums with state, change button name on state chang…
Dec 1, 2021
0e128ec
Add dummy BasketBar to Top navigation
Dec 1, 2021
064306b
Change visibility of BasketBar depending on number of items in Basket…
Dec 1, 2021
fa8c873
Use external class BasketData to manage basket state and reference it…
Dec 1, 2021
f38ed4b
One loading product, show correct basket status; move ProductBasketSt…
Dec 1, 2021
b67255c
Add basket page with product ids and quantities
Dec 1, 2021
467664b
Rename ProductListHeader to PageHeader, add support for nested action…
Dec 1, 2021
d8bf553
Fix small screen basket icon position
Dec 1, 2021
8aec031
Hide internal implementation of BasketData - add getOrderLineList() m…
Dec 1, 2021
47dedac
Add plus/minus controls on basket page per product
Dec 1, 2021
dca57a4
Load products details on basket page
Dec 1, 2021
a4b3a1a
Funny automatic extraction of component OrderLineList by IntelliJ Ide…
Dec 1, 2021
33254ec
fix: Warning: Failed prop type: Invalid prop `cellHeight` supplied to…
Dec 1, 2021
ec37147
fix: js error "Warning: Each child in a list should have a unique "ke…
Dec 1, 2021
bbcc476
fix: tried to fix "Line 159:39: React Hook React.useEffect has a mis…
Dec 1, 2021
ef8747f
chore: move OrderLineList to a separate file from BasketPage before a…
Dec 1, 2021
36b528d
chore: 400ms imtation looks too slow now, reduce to 300ms :)
Dec 1, 2021
134d9e1
chore: start to add order header
Dec 1, 2021
2d9ff73
chore: utility function to test loading layout - delay
Dec 1, 2021
e829f11
feature: add dummy OrderHeader with buyer company info and contact info
Dec 1, 2021
0bf4e52
feature: add OrderData class and use in orderheader to post on sending
Dec 2, 2021
05144c1
feature: add basket sending controller and data, lock controls on sen…
Dec 2, 2021
20f4a02
Move Order data to a separate js file
Dec 4, 2021
fafd131
Move Order data to a separate js file as global variable, do not use …
Dec 4, 2021
44f9af1
chore: some cleanup in maven plugins and dependencies definitions to …
Dec 4, 2021
27f70a9
chore: exclude lombok from cm-xml-syntax - used only in unit test for…
Dec 5, 2021
7863f40
chore: add order only example
Dec 5, 2021
edb2ff2
Add dependency on Philip Helger's library with UBL2.1 XML stubs for s…
Dec 5, 2021
6082416
Unit test to learn com.helger.ubl.ph-ubl21 library - read and generat…
Dec 5, 2021
831d17f
chore: idea warnings...
Dec 6, 2021
71ecb25
Add some not finished info about ordering to About
Dec 6, 2021
b26ff8a
feature: clear basket on productId null
Dec 6, 2021
9e215a0
Changed unit test to use UUID as order id
Dec 7, 2021
16f72a2
feature: show dummy basket send result with a table of generated orde…
Dec 8, 2021
e7cd993
feature: rename BasketPage to SendPage, as BasketPage component will …
Dec 8, 2021
29a8659
feature: implement persistence of basket and orders, initial order ge…
Dec 11, 2021
0a6b7fa
chore: test logging
Dec 11, 2021
fdaf0da
chore: move logic from OrderController to BasketService
Dec 11, 2021
e618ecb
feature: add to basket also from top panel of product details for con…
Dec 11, 2021
9e0657f
feature: show error messages after send, redirect to real basket id, …
Dec 11, 2021
689861e
fix: Warning: Failed prop type: Invalid prop `color` of value `XXX` s…
Dec 11, 2021
d3e0730
feature: struggled with storing XMLOffsetDate and XMLOffsetTime from …
Dec 11, 2021
6962581
fix: show real count on success message after sending
Dec 12, 2021
f1ecfae
fix: use Axios to load ProductDetails too, show errors, move API URL …
Dec 12, 2021
5e331fa
feature: show order details with link from basket and link back to ba…
Dec 12, 2021
061cfa9
fix: set in Order XML /OrderLine/LineItem/ID to product.id so it is e…
Dec 12, 2021
0146bb4
chore: import Order
Dec 12, 2021
f2e04ed
chore: add cross icon to Success alert on basket sent in addition to …
Dec 12, 2021
ac291e8
chore: order details
Dec 12, 2021
be669ed
feature: show json model of Order
Dec 12, 2021
e5d0bb8
feature: hide empty fields when serializing to JSON by setting spring…
Dec 12, 2021
21065a4
feature: implement copy link and copy basket link on basket and order…
Dec 12, 2021
a4c436d
feature: add config for endpointID and default note in order
Dec 12, 2021
30727ef
chore: move xsd files for JAXB generation inside the project to solve…
Dec 13, 2021
a7181bb
chore: add more details about absolute path of code list
Dec 13, 2021
ac05fba
fix: wrong case of parameters in code list definitions
Dec 13, 2021
80a20e4
Finally, solved the problem with JSON serialization of OrderType from…
Apr 30, 2022
b4af904
Fix multiple warnings and one bug, found by Idea
Apr 30, 2022
2959fd4
Migrate to the latest Spring Boot version and opencsv
Apr 30, 2022
f3a0bd9
Increase default timeout for response from API to 30 secs
Apr 30, 2022
4a53e5a
Do not fill UUID of order - it is forbidden by schematron
May 1, 2022
dcfaf1c
First implementation of jobs to load catalogue and future order response
May 7, 2022
b8a926f
Implement download basket zip and order xml
May 7, 2022
70f242f
Use selected product quantity in XML
May 7, 2022
4b91fb7
Missed link to order xml on order list in basket
May 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ dist/
log/

# Skip VisualStudio Code folders
.vscode/
.vscode/

.tomcat/
.integration/
11 changes: 10 additions & 1 deletion cm-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<artifactId>cm-all</artifactId>
<version>1.0.0</version>

<name>Catalog Manager :: Web API and Frontent together</name>
<name>Catalog Manager :: Web API and Frontend together</name>
<properties>
<java.version>1.8</java.version>
<cm.version>1.0.0</cm.version>
Expand Down Expand Up @@ -79,7 +79,13 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<inherited>false</inherited>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>position-react-build</id>
Expand All @@ -101,7 +107,9 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skip>true</skip>
</configuration>
Expand All @@ -110,6 +118,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<mainClass>dk.erst.cm.CatalogApiApplication</mainClass>
</configuration>
Expand Down
13 changes: 10 additions & 3 deletions cm-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<java.version>1.8</java.version>
<cm.version>1.0.0</cm.version>
<spring.boot.version>2.4.0</spring.boot.version>
<spring.boot.version>2.6.7</spring.boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand All @@ -24,6 +24,13 @@
<artifactId>cm-ubl</artifactId>
<version>${cm.version}</version>
</dependency>

<dependency>
<groupId>com.helger.ubl</groupId>
<artifactId>ph-ubl21</artifactId>
<version>6.6.3</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
Expand All @@ -33,7 +40,7 @@
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.4</version>
<version>5.6</version>
</dependency>

<!-- Commons -->
Expand Down Expand Up @@ -84,4 +91,4 @@
</dependency>
</dependencies>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dk.erst.cm.api.dao.mongo;

import dk.erst.cm.api.data.Basket;
import org.springframework.data.mongodb.repository.MongoRepository;

public interface BasketRepository extends MongoRepository<Basket, String> {

}
13 changes: 13 additions & 0 deletions cm-api/src/main/java/dk/erst/cm/api/dao/mongo/OrderRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dk.erst.cm.api.dao.mongo;

import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;

import dk.erst.cm.api.data.Order;

public interface OrderRepository extends MongoRepository<Order, String> {

List<Order> findByBasketId(String basketId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

public interface ProductCatalogUpdateRepository extends MongoRepository<ProductCatalogUpdate, String> {

ProductCatalogUpdate findTop1ByProductCatalogIdOrderByCreateTimeDesc(String productCatalogId);

}
23 changes: 23 additions & 0 deletions cm-api/src/main/java/dk/erst/cm/api/data/Basket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package dk.erst.cm.api.data;

import java.time.Instant;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import lombok.Data;
import lombok.NoArgsConstructor;

@Document
@Data
@NoArgsConstructor
public class Basket {

@Id
private String id;
private Instant createTime;
private int version;
private int orderCount;
private int lineCount;

}
41 changes: 41 additions & 0 deletions cm-api/src/main/java/dk/erst/cm/api/data/Order.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package dk.erst.cm.api.data;

import java.time.Instant;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import lombok.Data;
import lombok.NoArgsConstructor;

@Document
@Data
@NoArgsConstructor
public class Order {

@Id
private String id;
private Instant createTime;
private int version;

@Indexed
private String basketId;

private OrderStatus status;
private int orderIndex;

private String supplierName;

@Indexed
private String orderNumber;
private int lineCount;

private Object document;

private String resultFileName;

private Instant downloadDate;
private Instant deliveredDate;

}
7 changes: 7 additions & 0 deletions cm-api/src/main/java/dk/erst/cm/api/data/OrderStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dk.erst.cm.api.data;

public enum OrderStatus {

GENERATED, DELIVERED, DELIVERY_FAILED, ORDER_CONFIRMED, ORDER_REJECTED

}
38 changes: 38 additions & 0 deletions cm-api/src/main/java/dk/erst/cm/api/item/CatalogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import dk.erst.cm.api.data.ProductCatalog;
import dk.erst.cm.api.data.ProductCatalogUpdate;
import dk.erst.cm.xml.ubl21.model.Catalogue;
import dk.erst.cm.xml.ubl21.model.NestedParty;
import dk.erst.cm.xml.ubl21.model.Party;
import dk.erst.cm.xml.ubl21.model.SchemeID;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -72,6 +73,43 @@ public ProductCatalogUpdate saveCatalogue(Catalogue catalogue) {
return c;
}

public Party loadLastSellerParty(String productCatalogId) {

log.debug("Requested to load last seller party for productCatalog " + productCatalogId);

long start = System.currentTimeMillis();
ProductCatalogUpdate catalogUpdate = productCatalogUpdateRepository.findTop1ByProductCatalogIdOrderByCreateTimeDesc(productCatalogId);
long duration = System.currentTimeMillis() - start;
if (duration > 50) {
log.warn("LastSellerParty Mongo lookup by " + productCatalogId + " took more than 50ms: " + 50);
}

if (catalogUpdate != null && catalogUpdate.getDocument() != null) {
if (catalogUpdate.getDocument() instanceof Catalogue) {
Catalogue document = (Catalogue) catalogUpdate.getDocument();

if (document.getSellerSupplierParty() != null) {
NestedParty sellerSupplierParty = document.getSellerSupplierParty();
if (sellerSupplierParty != null && sellerSupplierParty.getParty() != null) {
log.debug("LastSellerParty found by document.sellerSupplierParty.party for productCatalog " + productCatalogId);
return sellerSupplierParty.getParty();
}
}
if (document.getProviderParty() != null) {
log.debug("LastSellerParty found by document.providerParty for productCatalog " + productCatalogId);
return document.getProviderParty();
}
log.warn("Neither sellerSupplierParty, nor providerParty are defined by last catalogUpdate by id " + productCatalogId + ": " + document);
} else {
log.warn("Found catalogUpdate by lastCatalog with id" + productCatalogId + " has unexpected type: " + catalogUpdate.getDocument().getClass());
}
} else {
log.warn("No catalogUpdate found by lastCatalog with id" + productCatalogId);
}

return null;
}

private String buildSellerLocalId(Catalogue catalogue) {
String sellerLogicalId = null;
if (catalogue.getSellerSupplierParty() != null) {
Expand Down
Loading