diff options
17 files changed, 258 insertions, 0 deletions
diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml new file mode 100644 index 0000000..4cb1ef2 --- /dev/null +++ b/dependency-reduced-pom.xml @@ -0,0 +1,43 @@ +<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.mavlushechka.notaryautomation</groupId>
+ <artifactId>notary-automation</artifactId>
+ <name>Notary Automation</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.2.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.1.0</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>lib/</classpathPrefix>
+ <mainClass>com.mavlushechka.notaryautomation.App</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <maven.compiler.target>21</maven.compiler.target>
+ <maven.compiler.source>21</maven.compiler.source>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
@@ -0,0 +1,59 @@ +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.mavlushechka.notaryautomation</groupId> + <artifactId>notary-automation</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>Notary Automation</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>21</maven.compiler.source> + <maven.compiler.target>21</maven.compiler.target> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>5.2.2</version> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.17.2</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.2.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <!-- Build an executable JAR --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>lib/</classpathPrefix> + <mainClass>com.mavlushechka.notaryautomation.App</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/src/main/java/com/mavlushechka/notaryautomation/App.java b/src/main/java/com/mavlushechka/notaryautomation/App.java new file mode 100644 index 0000000..0849da6 --- /dev/null +++ b/src/main/java/com/mavlushechka/notaryautomation/App.java @@ -0,0 +1,136 @@ +package com.mavlushechka.notaryautomation; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.xwpf.usermodel.*; + +public class App { + private static final Scanner SCANNER = new Scanner(System.in); + + public static void main(String[] args) throws Exception { + Person deadPerson; + LocalDate dateOfDeath; + String roleOfDeadPerson; + ArrayList<Person> heirs = new ArrayList<>(); + Person finalHeir; + String roleOfFinalHeir; + + System.out.println("Погибший человек:\n"); + deadPerson = createPerson(); + System.out.print("Дата смерти (1990-12-31): "); + dateOfDeath = LocalDate.parse(SCANNER.next()); + System.out.print("Роль в семье (Мать, Отец и т.д.): "); + roleOfDeadPerson = SCANNER.next().toLowerCase(); + + boolean isThereAnotherHeir; + System.out.println("\nНаследникики:"); + do { + System.out.println(); + heirs.add(createPerson()); + System.out.print("\nЕсть ещё наследники? (Да/Нет) "); + isThereAnotherHeir = "Да".equalsIgnoreCase(SCANNER.next()); + } while (isThereAnotherHeir); + + System.out.println("\nВсе наследники:"); + for (int i = 0; i < heirs.size(); i++) { + System.out.println(i+1 + ". " + heirs.get(i).firstName() + " " + heirs.get(i).secondName() + " " + heirs.get(i).middleName()); + } + System.out.print("Окончательный наследник (введите число): "); + finalHeir = heirs.get(SCANNER.nextInt() - 1); + + System.out.print("Роль в семье (Сын, Дочь и т.д.): "); + roleOfFinalHeir = SCANNER.next().toLowerCase(); + + updateApplicationOfTheHeirToRenounceTheInheritanceShareDocument(deadPerson, dateOfDeath, roleOfDeadPerson, heirs, finalHeir, roleOfFinalHeir); + } + + private static Person createPerson() { + System.out.print("Введите имя: "); + String firstName = SCANNER.next().toUpperCase(); + System.out.print("Введите фамилию: "); + String secondName = SCANNER.next().toUpperCase(); + System.out.print("Введите отчество: "); + SCANNER.nextLine(); + String middleName = SCANNER.nextLine().toUpperCase(); + System.out.print("Введите серию паспорта (AA): "); + String serial = SCANNER.next().toUpperCase(); + if (" ".equals(serial)) { + serial = "AA"; + } + System.out.print("Введите номер паспорта (1234567): "); + int number = SCANNER.nextInt(); + System.out.print("Введите гражданство человека (Uzbekistan): "); + String citizenship = SCANNER.next(); + if (" ".equals(citizenship)) { + citizenship = "Uzbekistan"; + } + System.out.print("Введите место выдачи паспорта (XORAZM VILOYATI URGANCH TUMANI IIB): "); + SCANNER.nextLine(); + String placeOfIssue = SCANNER.nextLine().toUpperCase(); + if (" ".equals(placeOfIssue)) { + placeOfIssue = "XORAZM VILOYATI URGANCH TUMANI IIB"; + } + System.out.print("Введите дату выдачи паспорта (1990-12-31): "); + LocalDate dateOfIssue = LocalDate.parse(SCANNER.next()); + System.out.print("Введите ЖШШИР (12345678901234): "); + String personalIdentificationNumberOfThePhysicalPerson = SCANNER.next(); + System.out.print("Введите место проживания: "); + SCANNER.nextLine(); + String placeOfResidence = SCANNER.nextLine(); + + return new Person(firstName, secondName, middleName, new Passport(serial, number, citizenship, placeOfIssue, dateOfIssue, personalIdentificationNumberOfThePhysicalPerson, placeOfResidence)); + } + + private static void updateApplicationOfTheHeirToRenounceTheInheritanceShareDocument(Person deadPerson, LocalDate dateOfDeath, String roleOfDeadPerson, ArrayList<Person> heirs, Person finalHeir, String roleOfFinalHeir) throws Exception { + FileInputStream fileInputStream = new FileInputStream("Application of the heir to renounce the inheritance share.docx"); + + try (XWPFDocument xwpfDocument = new XWPFDocument(OPCPackage.open(fileInputStream))) { + List<XWPFParagraph> xwpfParagraphList = xwpfDocument.getParagraphs(); + + for (XWPFParagraph xwpfParagraph : xwpfParagraphList) { + for (XWPFRun xwpfRun : xwpfParagraph.getRuns()) { + String oldText = xwpfRun.getText(0); + if (oldText == null) continue; + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); + String text = oldText + .replace("${dateOfDeath}", dateOfDeath.format(dateTimeFormatter)) + .replace("${currentDate}", LocalDate.now().format(dateTimeFormatter) + .replace("${relationship1}", roleOfDeadPerson) + .replace("${relationship2}", roleOfFinalHeir) + .replace("${deadPerson.firstName}", deadPerson.firstName()) + .replace("${deadPerson.secondName}", deadPerson.secondName()) + .replace("${finalHeir.firstName}", finalHeir.firstName()) + .replace("${finalHeir.secondName}", finalHeir.secondName()) + .replace("${numberOfArticle}", "Отец".equalsIgnoreCase(roleOfDeadPerson) && "Мать".equalsIgnoreCase(roleOfFinalHeir) ? "1135" : "?")); + + for (int i = 1; i < heirs.size(); i++) { + String personsFullInfo = "${personsFullInfo" + i + "}"; + String personsLine = "${personsLine" + (i + 1) + "}"; + Person person = heirs.get(i - 1); + + text = text + .replace(personsFullInfo,person.passport().placeOfResidence() + "да\n" + + "рўйхатда турувчи " + person.firstName() + " " + person.secondName() + " " + person.middleName() + "\n" + + "(" + person.passport().citizenship() + " фуқаросининг биометрик паспорти " + person.passport().serial() + " " + person.passport().number() + ",\n" + + person.passport().placeOfIssue() + " томонидан\n" + + person.passport().dateOfIssue().format(dateTimeFormatter) + " йилда берилган, ЖШШИР " + person.passport().personalIdentificationNumberOfThePhysicalPerson() + ")\n" + + (heirs.size() > i + 1 ? "${personsFullInfo" + (i + 1) + "}" : "")) + .replace(personsLine,(i + 1) + "._______________________________________________________________________\n" + + (heirs.size() > i + 1 ? "${personsLine" + (i + 2) + "}" : "")); + } + xwpfRun.setText(text, 0); + } + } + try (FileOutputStream out = new FileOutputStream(finalHeir.firstName() + " " + finalHeir.secondName() + " " + finalHeir.middleName() + ", Меросхўрнинг мерос улушидан воз кечиш ҳақидаги аризаси.docx")) { + xwpfDocument.write(out); + } + } + } +} diff --git a/src/main/java/com/mavlushechka/notaryautomation/Passport.java b/src/main/java/com/mavlushechka/notaryautomation/Passport.java new file mode 100644 index 0000000..86b75ca --- /dev/null +++ b/src/main/java/com/mavlushechka/notaryautomation/Passport.java @@ -0,0 +1,6 @@ +package com.mavlushechka.notaryautomation; + +import java.time.LocalDate; + +public record Passport(String serial, int number, String citizenship, String placeOfIssue, LocalDate dateOfIssue, String personalIdentificationNumberOfThePhysicalPerson, String placeOfResidence) { +} diff --git a/src/main/java/com/mavlushechka/notaryautomation/Person.java b/src/main/java/com/mavlushechka/notaryautomation/Person.java new file mode 100644 index 0000000..45f70b9 --- /dev/null +++ b/src/main/java/com/mavlushechka/notaryautomation/Person.java @@ -0,0 +1,4 @@ +package com.mavlushechka.notaryautomation; + +public record Person(String firstName, String secondName, String middleName, Passport passport) { +} diff --git a/src/main/resources/Application of the heir to renounce the inheritance share.docx b/src/main/resources/Application of the heir to renounce the inheritance share.docx Binary files differnew file mode 100644 index 0000000..8375b14 --- /dev/null +++ b/src/main/resources/Application of the heir to renounce the inheritance share.docx diff --git a/target/Application of the heir to renounce the inheritance share.docx b/target/Application of the heir to renounce the inheritance share.docx Binary files differnew file mode 100644 index 0000000..8375b14 --- /dev/null +++ b/target/Application of the heir to renounce the inheritance share.docx diff --git a/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, Меросхўрнинг мерос улушидан воз кечиш ҳақидаги аризаси.docx b/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, Меросхўрнинг мерос улушидан воз кечиш ҳақидаги аризаси.docx Binary files differnew file mode 100644 index 0000000..659b29b --- /dev/null +++ b/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, Меросхўрнинг мерос улушидан воз кечиш ҳақидаги аризаси.docx diff --git a/target/classes/Application of the heir to renounce the inheritance share.docx b/target/classes/Application of the heir to renounce the inheritance share.docx Binary files differnew file mode 100644 index 0000000..8375b14 --- /dev/null +++ b/target/classes/Application of the heir to renounce the inheritance share.docx diff --git a/target/classes/com/mavlushechka/notaryautomation/App.class b/target/classes/com/mavlushechka/notaryautomation/App.class Binary files differnew file mode 100644 index 0000000..4959efc --- /dev/null +++ b/target/classes/com/mavlushechka/notaryautomation/App.class diff --git a/target/classes/com/mavlushechka/notaryautomation/Passport.class b/target/classes/com/mavlushechka/notaryautomation/Passport.class Binary files differnew file mode 100644 index 0000000..c4124ed --- /dev/null +++ b/target/classes/com/mavlushechka/notaryautomation/Passport.class diff --git a/target/classes/com/mavlushechka/notaryautomation/Person.class b/target/classes/com/mavlushechka/notaryautomation/Person.class Binary files differnew file mode 100644 index 0000000..c9f4c8f --- /dev/null +++ b/target/classes/com/mavlushechka/notaryautomation/Person.class diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..c89078f --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,4 @@ +#Created by Apache Maven 3.8.7 +artifactId=notary-automation +groupId=com.mavlushechka.notaryautomation +version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..e88a358 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,3 @@ +com/mavlushechka/notaryautomation/Person.class +com/mavlushechka/notaryautomation/App.class +com/mavlushechka/notaryautomation/Passport.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..78dc1ab --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,3 @@ +/mnt/Programming/Projects/notary-automation/src/main/java/com/mavlushechka/notaryautomation/Passport.java +/mnt/Programming/Projects/notary-automation/src/main/java/com/mavlushechka/notaryautomation/App.java +/mnt/Programming/Projects/notary-automation/src/main/java/com/mavlushechka/notaryautomation/Person.java diff --git a/target/notary-automation-1.0-SNAPSHOT.jar b/target/notary-automation-1.0-SNAPSHOT.jar Binary files differnew file mode 100644 index 0000000..299949a --- /dev/null +++ b/target/notary-automation-1.0-SNAPSHOT.jar diff --git a/target/original-notary-automation-1.0-SNAPSHOT.jar b/target/original-notary-automation-1.0-SNAPSHOT.jar Binary files differnew file mode 100644 index 0000000..bb905cd --- /dev/null +++ b/target/original-notary-automation-1.0-SNAPSHOT.jar |