Bug fixing: corrected Number Update in List behavior; corrected Number conversion
This commit is contained in:
59
plugins/demo/pom.xml
Normal file
59
plugins/demo/pom.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<groupId>das.tools.np</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<jackson.version>2.17.0</jackson.version>
|
||||
<lombok.version>1.18.32</lombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- Following class name need to be changed according to plugin class name -->
|
||||
<finalName>DemoPlugin</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>18</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,48 @@
|
||||
package das.tools.np.entity.db;
|
||||
|
||||
import das.tools.np.entity.response.ResponseData;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public class CargoNumber {
|
||||
@Builder.Default
|
||||
private long id = -1;
|
||||
private String number;
|
||||
private Group group;
|
||||
private String groupName;
|
||||
private String descr;
|
||||
private CargoStatus appStatus;
|
||||
@Builder.Default
|
||||
private NumberType numberType = NumberType.UNDEF;
|
||||
private String comment;
|
||||
private String dateCreated;
|
||||
private float weight;
|
||||
private float cost;
|
||||
private float seatsAmount;
|
||||
private String description;
|
||||
private String cargoType;
|
||||
private int statusCode;
|
||||
private String announcedPrice;
|
||||
private String scheduledDeliveryDate;
|
||||
private String recipientFullName;
|
||||
private String cityRecipient;
|
||||
private String warehouseRecipient;
|
||||
private String warehouseRecipientNumber;
|
||||
private String phoneRecipient;
|
||||
private String recipientAddress;
|
||||
private String citySender;
|
||||
private String phoneSender;
|
||||
private String warehouseSender;
|
||||
private String senderAddress;
|
||||
private ResponseData fullData;
|
||||
private Date created;
|
||||
private Date updated;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package das.tools.np.entity.db;
|
||||
|
||||
public enum CargoStatus {
|
||||
NEW, ERROR, PROCESSING, WAITING, COMPLETED;
|
||||
|
||||
public static CargoStatus valueOf(int value) {
|
||||
return CargoStatus.values()[value];
|
||||
}
|
||||
}
|
||||
15
plugins/demo/src/main/java/das/tools/np/entity/db/Group.java
Normal file
15
plugins/demo/src/main/java/das/tools/np/entity/db/Group.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package das.tools.np.entity.db;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public class Group {
|
||||
private long id;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package das.tools.np.entity.db;
|
||||
|
||||
public enum NumberType {
|
||||
UNDEF, IN, OUT;
|
||||
public static NumberType valueOf(int value) {
|
||||
return NumberType.values()[value];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package das.tools.np.entity.plugin;
|
||||
|
||||
import das.tools.np.entity.db.CargoNumber;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class DemoPlugin implements PluginInterface{
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Demo Plugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "The demo NP plugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameUK() {
|
||||
return "Демонстрація";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionUK() {
|
||||
return "Демонстраційний плагін NP";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doProcess(List<CargoNumber> list) {
|
||||
System.out.println("<--- Demo plugin started --->");
|
||||
System.out.println(" All numbers list as is:");
|
||||
String[] array = new String[list.size()];
|
||||
int i = 0;
|
||||
for (CargoNumber number : list) {
|
||||
System.out.printf("Current number is: %s%n", number.getNumber());
|
||||
array[i] = list.get(i).getNumber();
|
||||
i++;
|
||||
}
|
||||
System.out.println(" All numbers sorted by number:");
|
||||
Arrays.sort(array);
|
||||
for (String n : array) {
|
||||
System.out.printf("Current number is: %s%n", n);
|
||||
}
|
||||
System.out.println("---> Demo plugin finished <---");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package das.tools.np.entity.plugin;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public class PluginInfo {
|
||||
private String absolutePath;
|
||||
private String relativePath;
|
||||
private String name;
|
||||
private String description;
|
||||
private String className;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package das.tools.np.entity.plugin;
|
||||
|
||||
import das.tools.np.entity.db.CargoNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PluginInterface {
|
||||
String getName();
|
||||
String getDescription();
|
||||
String getNameUK();
|
||||
String getDescriptionUK();
|
||||
void doProcess(List<CargoNumber> list);
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package das.tools.np.entity.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ResponseData {
|
||||
@JsonProperty("Number")
|
||||
private String number;
|
||||
@JsonProperty("DateCreated")
|
||||
private String dateCreated;
|
||||
@JsonProperty("DocumentWeight")
|
||||
private float weight;
|
||||
@JsonProperty("DocumentCost")
|
||||
private float cost;
|
||||
@JsonProperty("PayerType")
|
||||
private String payerType;
|
||||
@JsonProperty("CargoDescriptionString")
|
||||
private String description;
|
||||
@JsonProperty("CargoType")
|
||||
private String cargoType;
|
||||
@JsonProperty("ScheduledDeliveryDate")
|
||||
private String scheduledDeliveryDate; // calculated delivery date
|
||||
@JsonProperty("Status")
|
||||
private String status;
|
||||
@JsonProperty("StatusCode")
|
||||
private String statusCode;
|
||||
@JsonProperty("ServiceType")
|
||||
private String serviceType;
|
||||
@JsonProperty("InternationalDeliveryType")
|
||||
private String internationalDeliveryType;
|
||||
@JsonProperty("SeatsAmount")
|
||||
private int seatsAmount;
|
||||
@JsonProperty("TrackingUpdateDate")
|
||||
private String trackingUpdateDate;
|
||||
@JsonProperty("DateFirstDayStorage")
|
||||
private String dateFirstDayStorage;
|
||||
@JsonProperty("AnnouncedPrice")
|
||||
private String announcedPrice;
|
||||
@JsonProperty("ActualDeliveryDate")
|
||||
private String actualDeliveryDate;
|
||||
@JsonProperty("DeliveryTimeframe")
|
||||
private String deliveryTimeframe;
|
||||
@JsonProperty("StorageAmount")
|
||||
private String storageAmount;
|
||||
@JsonProperty("StoragePrice")
|
||||
private float storagePrice;
|
||||
@JsonProperty("FreeShipping")
|
||||
private String freeShipping;
|
||||
@JsonProperty("LoyaltyCardRecipient")
|
||||
private String loyaltyCardRecipient;
|
||||
@JsonProperty("AviaDelivery")
|
||||
private String aviaDelivery;
|
||||
@JsonProperty("DaysStorageCargo")
|
||||
private int daysStorageCargo;
|
||||
// RECIPIENT
|
||||
@JsonProperty("RecipientFullName")
|
||||
private String recipientFullName;
|
||||
@JsonProperty("CityRecipient")
|
||||
private String cityRecipient;
|
||||
@JsonProperty("WarehouseRecipient")
|
||||
private String warehouseRecipient;
|
||||
@JsonProperty("WarehouseRecipientNumber")
|
||||
private String warehouseRecipientNumber;
|
||||
@JsonProperty("PhoneRecipient")
|
||||
private String phoneRecipient;
|
||||
@JsonProperty("RecipientFullNameEW")
|
||||
private String recipientFullNameEW;
|
||||
@JsonProperty("RecipientAddress")
|
||||
private String recipientAddress;
|
||||
@JsonProperty("RecipientDateTime")
|
||||
private String recipientDateTime; // when parcel was taken
|
||||
// SENDER
|
||||
@JsonProperty("CitySender")
|
||||
private String citySender;
|
||||
@JsonProperty("PhoneSender")
|
||||
private String phoneSender;
|
||||
@JsonProperty("WarehouseSender")
|
||||
private String warehouseSender;
|
||||
@JsonProperty("SenderAddress")
|
||||
private String senderAddress;
|
||||
@JsonProperty("SenderFullNameEW")
|
||||
private String senderFullNameEW;
|
||||
// WEIGHT
|
||||
@JsonProperty("FactualWeight")
|
||||
private float factWeight;
|
||||
@JsonProperty("VolumeWeight")
|
||||
private float volumeWeight;
|
||||
@JsonProperty("CheckWeight")
|
||||
private float checkWeight;
|
||||
@JsonProperty("CalculatedWeight")
|
||||
private float calculatedWeight;
|
||||
@JsonProperty("CheckWeightMethod")
|
||||
private String checkWeightMethod;
|
||||
// PAYMENT
|
||||
@JsonProperty("PaymentMethod")
|
||||
private String paymentMethod;
|
||||
@JsonProperty("PaymentStatus")
|
||||
private String paymentStatus;
|
||||
@JsonProperty("PaymentStatusDate")
|
||||
private String paymentStatusDate;
|
||||
@JsonProperty("AmountToPay")
|
||||
private String amountToPay;
|
||||
@JsonProperty("AmountPaid")
|
||||
private String amountPaid;
|
||||
// Additional
|
||||
@JsonProperty("UndeliveryReasonsSubtypeDescription")
|
||||
private String undeliveryReasonsSubtypeDescription;
|
||||
@JsonProperty("LastCreatedOnTheBasisNumber")
|
||||
private String lastCreatedOnTheBasisNumber;
|
||||
@JsonProperty("WarehouseRecipientInternetAddressRef")
|
||||
private String warehouseRecipientInternetAddressRef;
|
||||
@JsonProperty("MarketplacePartnerToken")
|
||||
private String marketplacePartnerToken;
|
||||
@JsonProperty("ClientBarcode")
|
||||
private String clientBarcode;
|
||||
@JsonProperty("CounterpartyRecipientDescription")
|
||||
private String counterpartyRecipientDescription;
|
||||
@JsonProperty("DateScan")
|
||||
private String dateScan;
|
||||
//@JsonProperty("UndeliveryReasons")
|
||||
//private String undeliveryReasons;
|
||||
@JsonProperty("DatePayedKeeping")
|
||||
private String datePayedKeeping;
|
||||
@JsonProperty("CardMaskedNumber")
|
||||
private String cardMaskedNumber;
|
||||
@JsonProperty("ExpressWaybillPaymentStatus")
|
||||
private String expressWaybillPaymentStatus;
|
||||
@JsonProperty("ExpressWaybillAmountToPay")
|
||||
private float expressWaybillAmountToPay;
|
||||
@JsonProperty("DateReturnCargo")
|
||||
private String dateReturnCargo;
|
||||
@JsonProperty("DateMoving")
|
||||
private String dateMoving;
|
||||
@JsonProperty("AdditionalInformationEW")
|
||||
private String additionalInformationEW;
|
||||
@JsonProperty("PostomatV3CellReservationNumber")
|
||||
private String postomatV3CellReservationNumber;
|
||||
@JsonProperty("OwnerDocumentNumber")
|
||||
private String ownerDocumentNumber;
|
||||
@JsonProperty("LastAmountReceivedCommissionGM")
|
||||
private float lastAmountReceivedCommissionGM;
|
||||
@JsonProperty("CreatedOnTheBasis")
|
||||
private String createdOnTheBasis;
|
||||
@JsonProperty("UndeliveryReasonsDate")
|
||||
private String undeliveryReasonsDate;
|
||||
@JsonProperty("CategoryOfWarehouse")
|
||||
private String categoryOfWarehouse;
|
||||
@JsonProperty("WarehouseRecipientAddress")
|
||||
private String warehouseRecipientAddress;
|
||||
@JsonProperty("WarehouseSenderAddress")
|
||||
private String warehouseSenderAddress;
|
||||
@JsonProperty("CounterpartySenderType")
|
||||
private String counterpartySenderType;
|
||||
@JsonProperty("CargoReturnRefusal")
|
||||
private String cargoReturnRefusal;
|
||||
//@JsonProperty("Packaging")
|
||||
//private String packaging;
|
||||
//@JsonProperty("PartialReturnGoods")
|
||||
//private String partialReturnGoods;
|
||||
@JsonProperty("SecurePayment")
|
||||
private boolean securePayment;
|
||||
@JsonProperty("PossibilityChangeCash2Card")
|
||||
private boolean possibilityChangeCash2Card;
|
||||
@JsonProperty("PossibilityChangeDeliveryIntervals")
|
||||
private boolean possibilityChangeDeliveryIntervals;
|
||||
@JsonProperty("PossibilityTermExtensio")
|
||||
private boolean possibilityTermExtensio;
|
||||
}
|
||||
BIN
plugins/demo/target/DemoPlugin.jar
Normal file
BIN
plugins/demo/target/DemoPlugin.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
plugins/demo/target/classes/das/tools/np/entity/db/Group.class
Normal file
BIN
plugins/demo/target/classes/das/tools/np/entity/db/Group.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
plugins/demo/target/maven-archiver/pom.properties
Normal file
3
plugins/demo/target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
artifactId=demo
|
||||
groupId=das.tools.np
|
||||
version=1.0-SNAPSHOT
|
||||
@@ -0,0 +1,12 @@
|
||||
das\tools\np\entity\plugin\PluginInfo.class
|
||||
das\tools\np\entity\plugin\PluginInfo$PluginInfoBuilder.class
|
||||
das\tools\np\entity\db\CargoNumber$CargoNumberBuilder.class
|
||||
das\tools\np\entity\db\CargoNumber.class
|
||||
das\tools\np\entity\db\Group$GroupBuilder.class
|
||||
das\tools\np\entity\db\Group.class
|
||||
das\tools\np\entity\response\ResponseData.class
|
||||
das\tools\np\entity\db\NumberType.class
|
||||
das\tools\np\entity\response\ResponseData$ResponseDataBuilder.class
|
||||
das\tools\np\entity\db\CargoStatus.class
|
||||
das\tools\np\entity\plugin\DemoPlugin.class
|
||||
das\tools\np\entity\plugin\PluginInterface.class
|
||||
@@ -0,0 +1,8 @@
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\db\CargoNumber.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\db\CargoStatus.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\plugin\PluginInfo.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\plugin\DemoPlugin.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\response\ResponseData.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\db\Group.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\db\NumberType.java
|
||||
C:\Users\ande1214\Dev\DevApp\projects\NovaPoshta\plugins\demo\src\main\java\das\tools\np\entity\plugin\PluginInterface.java
|
||||
Reference in New Issue
Block a user