From 3523011cc8442fb7fa57e07d76156466d2f10e2e Mon Sep 17 00:00:00 2001 From: AlisaLinUwU Date: Sun, 26 Jan 2025 11:38:17 +0500 Subject: Initialize --- dependency-reduced-pom.xml | 43 +++++++ pom.xml | 59 +++++++++ .../com/mavlushechka/notaryautomation/App.java | 136 +++++++++++++++++++++ .../mavlushechka/notaryautomation/Passport.java | 6 + .../com/mavlushechka/notaryautomation/Person.java | 4 + ...the heir to renounce the inheritance share.docx | Bin 0 -> 17239 bytes ...the heir to renounce the inheritance share.docx | Bin 0 -> 17239 bytes ...0\320\270\320\267\320\260\321\201\320\270.docx" | Bin 0 -> 15862 bytes ...the heir to renounce the inheritance share.docx | Bin 0 -> 17239 bytes .../com/mavlushechka/notaryautomation/App.class | Bin 0 -> 9881 bytes .../mavlushechka/notaryautomation/Passport.class | Bin 0 -> 2499 bytes .../com/mavlushechka/notaryautomation/Person.class | Bin 0 -> 2026 bytes target/maven-archiver/pom.properties | 4 + .../compile/default-compile/createdFiles.lst | 3 + .../compile/default-compile/inputFiles.lst | 3 + target/notary-automation-1.0-SNAPSHOT.jar | Bin 0 -> 19963486 bytes target/original-notary-automation-1.0-SNAPSHOT.jar | Bin 0 -> 24471 bytes 17 files changed, 258 insertions(+) create mode 100644 dependency-reduced-pom.xml create mode 100644 pom.xml create mode 100644 src/main/java/com/mavlushechka/notaryautomation/App.java create mode 100644 src/main/java/com/mavlushechka/notaryautomation/Passport.java create mode 100644 src/main/java/com/mavlushechka/notaryautomation/Person.java create mode 100644 src/main/resources/Application of the heir to renounce the inheritance share.docx create mode 100644 target/Application of the heir to renounce the inheritance share.docx create mode 100644 "target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, \320\234\320\265\321\200\320\276\321\201\321\205\321\236\321\200\320\275\320\270\320\275\320\263 \320\274\320\265\321\200\320\276\321\201 \321\203\320\273\321\203\321\210\320\270\320\264\320\260\320\275 \320\262\320\276\320\267 \320\272\320\265\321\207\320\270\321\210 \322\263\320\260\322\233\320\270\320\264\320\260\320\263\320\270 \320\260\321\200\320\270\320\267\320\260\321\201\320\270.docx" create mode 100644 target/classes/Application of the heir to renounce the inheritance share.docx create mode 100644 target/classes/com/mavlushechka/notaryautomation/App.class create mode 100644 target/classes/com/mavlushechka/notaryautomation/Passport.class create mode 100644 target/classes/com/mavlushechka/notaryautomation/Person.class create mode 100644 target/maven-archiver/pom.properties create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 target/notary-automation-1.0-SNAPSHOT.jar create mode 100644 target/original-notary-automation-1.0-SNAPSHOT.jar 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 @@ + + + 4.0.0 + com.mavlushechka.notaryautomation + notary-automation + Notary Automation + 1.0-SNAPSHOT + http://maven.apache.org + + + + maven-shade-plugin + 3.2.0 + + + package + + shade + + + + + + maven-jar-plugin + 3.1.0 + + + + true + lib/ + com.mavlushechka.notaryautomation.App + + + + + + + + 21 + 21 + UTF-8 + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7be3721 --- /dev/null +++ b/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + com.mavlushechka.notaryautomation + notary-automation + jar + 1.0-SNAPSHOT + Notary Automation + http://maven.apache.org + + UTF-8 + 21 + 21 + + + + org.apache.poi + poi-ooxml + 5.2.2 + + + org.apache.logging.log4j + log4j-core + 2.17.2 + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.0 + + + package + + shade + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + true + lib/ + com.mavlushechka.notaryautomation.App + + + + + + + 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 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 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 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 new file mode 100644 index 0000000..8375b14 Binary files /dev/null and b/src/main/resources/Application of the heir to renounce the inheritance share.docx differ 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 new file mode 100644 index 0000000..8375b14 Binary files /dev/null and b/target/Application of the heir to renounce the inheritance share.docx differ diff --git "a/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, \320\234\320\265\321\200\320\276\321\201\321\205\321\236\321\200\320\275\320\270\320\275\320\263 \320\274\320\265\321\200\320\276\321\201 \321\203\320\273\321\203\321\210\320\270\320\264\320\260\320\275 \320\262\320\276\320\267 \320\272\320\265\321\207\320\270\321\210 \322\263\320\260\322\233\320\270\320\264\320\260\320\263\320\270 \320\260\321\200\320\270\320\267\320\260\321\201\320\270.docx" "b/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, \320\234\320\265\321\200\320\276\321\201\321\205\321\236\321\200\320\275\320\270\320\275\320\263 \320\274\320\265\321\200\320\276\321\201 \321\203\320\273\321\203\321\210\320\270\320\264\320\260\320\275 \320\262\320\276\320\267 \320\272\320\265\321\207\320\270\321\210 \322\263\320\260\322\233\320\270\320\264\320\260\320\263\320\270 \320\260\321\200\320\270\320\267\320\260\321\201\320\270.docx" new file mode 100644 index 0000000..659b29b Binary files /dev/null and "b/target/MAVLONBEK ERKINBOYEV MUHIDDIN O'G'LI, \320\234\320\265\321\200\320\276\321\201\321\205\321\236\321\200\320\275\320\270\320\275\320\263 \320\274\320\265\321\200\320\276\321\201 \321\203\320\273\321\203\321\210\320\270\320\264\320\260\320\275 \320\262\320\276\320\267 \320\272\320\265\321\207\320\270\321\210 \322\263\320\260\322\233\320\270\320\264\320\260\320\263\320\270 \320\260\321\200\320\270\320\267\320\260\321\201\320\270.docx" differ 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 new file mode 100644 index 0000000..8375b14 Binary files /dev/null and b/target/classes/Application of the heir to renounce the inheritance share.docx differ diff --git a/target/classes/com/mavlushechka/notaryautomation/App.class b/target/classes/com/mavlushechka/notaryautomation/App.class new file mode 100644 index 0000000..4959efc Binary files /dev/null and b/target/classes/com/mavlushechka/notaryautomation/App.class differ diff --git a/target/classes/com/mavlushechka/notaryautomation/Passport.class b/target/classes/com/mavlushechka/notaryautomation/Passport.class new file mode 100644 index 0000000..c4124ed Binary files /dev/null and b/target/classes/com/mavlushechka/notaryautomation/Passport.class differ diff --git a/target/classes/com/mavlushechka/notaryautomation/Person.class b/target/classes/com/mavlushechka/notaryautomation/Person.class new file mode 100644 index 0000000..c9f4c8f Binary files /dev/null and b/target/classes/com/mavlushechka/notaryautomation/Person.class differ 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 new file mode 100644 index 0000000..299949a Binary files /dev/null and b/target/notary-automation-1.0-SNAPSHOT.jar differ diff --git a/target/original-notary-automation-1.0-SNAPSHOT.jar b/target/original-notary-automation-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..bb905cd Binary files /dev/null and b/target/original-notary-automation-1.0-SNAPSHOT.jar differ -- cgit v1.2.3