Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Релиз 2024.1 #589

Merged
merged 14 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Investbook в сравнении с [Intelinvest](https://intelinvest.ru) и [Sn
что токены популярного брокера позволяют совершать сделки без вашего участия.
1. Открытый код - дополнительная гарантия безопасности и уверенности в доступности данных только вам.
1. Понятный, широко распространенный формат отчёта - Excel таблицы
с [детальным описанием](src/main/asciidoc/index.adoc#описание-отчета-investbook) каждой колонки.
с [детальным описанием](src/main/asciidoc/investbook-report.adoc) каждой колонки.
1. Единый формат представления данных "[Portfolio Open Format](https://github.com/spacious-team/portfolio-open-format)"
при необходимости позволит безболезненно перенести накопленные данные в другое приложение учета инвестиций.

Expand Down Expand Up @@ -131,7 +131,7 @@ Investbook также может быть запущен в [docker](docs/run-by
периодов будут перекрываться.
1. Допустимо загружать отчеты по нескольким брокерским/инвестиционным счетам, в том числе от разных брокерских домов.

После загрузки отчета становится доступным аналитическая выгрузка в формате [excel файла](src/main/asciidoc/index.adoc).
После загрузки отчета становится доступным аналитическая выгрузка в формате [excel файла](src/main/asciidoc/investbook-report.adoc).

### Обновление приложения
Процесс обновления на Windows не отличается от процесса первоначальной установки. Воспользуйтесь инструкцией
Expand Down
2 changes: 1 addition & 1 deletion docs/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
или его сообщество.

О случаях оскорбительного поведения, домогательства или иного неприемлемого поведения в можно сообщить,
связавшись с куратором через [telegram](https://t.me/investbook_support).
связавшись с куратором через [telegram](https://t.me/investbook_support_bot).
6 changes: 6 additions & 0 deletions docs/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ git clone https://github.com/spacious-team/investbook.git
Скачайте java под свою ОС, например с сайта [OpenJDK](https://openjdk.org/install/), и установите переменные
окружения `JAVA_HOME` и `PATH`, например для Windows 10 по этой [инструкции](https://csharpcoderr.com/5351/).

### Установка Wix
Для сборки пакета для установки Investbook требуется Wix 3.
Скачать Wix 3 можно по ссылке с официального сайта [Wix](https://wixtoolset.org/docs/wix3/)
(пакет для установки расположен на [GitHub](https://github.com/wixtoolset/wix3/releases)).
Wix в свою очередь потребует установки [.NET](https://dotnet.microsoft.com/en-us/download/dotnet).

### Компиляция
Компиляция запускается командой:
```
Expand Down
7 changes: 7 additions & 0 deletions docs/install-on-linux.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Оглавление
- [Установка на Windows x64](install-on-windows.md)
- [Установка на Windows x86](install-on-windows-by-zip.md)
- [Установка на Mac](#установка-и-работа-на-mac-и-linux)
- [Установка на Linux](#установка-и-работа-на-mac-и-linux)
- [Запуск в Docker](run-by-docker.md)

### Установка и работа на Mac и Linux

Поддерживаетcя любая версия Mac и Linux.
Expand Down
7 changes: 7 additions & 0 deletions docs/install-on-windows-by-zip.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Оглавление
- [Установка на Windows x64](install-on-windows.md)
- [Установка на Windows x86](#установка-и-работа-на-windows-из-zip-архива)
- [Установка на Mac](install-on-linux.md)
- [Установка на Linux](install-on-linux.md)
- [Запуск в Docker](run-by-docker.md)

### Установка и работа на Windows из zip архива

Данная инструкция поддерживает все версии Windows. Если у вас 64 битная Windows, рекомендуем устанавливать по
Expand Down
7 changes: 7 additions & 0 deletions docs/install-on-windows.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Оглавление
- [Установка на Windows x64](#установка-и-работа-на-windows)
- [Установка на Windows x86](install-on-windows-by-zip.md)
- [Установка на Mac](install-on-linux.md)
- [Установка на Linux](install-on-linux.md)
- [Запуск в Docker](run-by-docker.md)

### Установка и работа на Windows

Данная инструкция поддерживает версию Windows x64. Если у вас 32 битная Windows, рекомендуем устанавливать по
Expand Down
13 changes: 13 additions & 0 deletions docs/run-by-docker.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Оглавление
- [Установка на Windows x64](install-on-windows.md)
- [Установка на Windows x86](install-on-windows-by-zip.md)
- [Установка на Mac](install-on-linux.md)
- [Установка на Linux](install-on-linux.md)
- [Запуск в Docker](#запуск-investbook)

### Запуск в Docker контейнере

Способ является альтернативой установке Investbook на [windows](install-on-windows.md), [mac](install-on-linux.md)
Expand All @@ -13,6 +20,12 @@
1. Скачайте пакет "Docker Desktop" с официального [сайта](https://docs.docker.com/desktop/windows/install/).
2. Установите пакет и запустите "Docker Desktop" из списка приложений.
3. Если "Docker Desktop" предложит обновление по ссылке https://aka.ms/wsl2kernel, можете также скачать и установить его.
4. Если вы работаете не под администратором, то для работы с "Docker Desktop" под текущим пользователем запустите
командную строку под администратором и выполните
```shell
net localgroup "docker-users" "{User}" /add
```
где вместо "{User}" нужно подставить имя своего пользователя.

##### Установка на MacOS
Требуется версия MacOS 10.15 или новее.
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ InvestBook
~ Copyright (C) 2021 Vitalii Ananev <spacious-team@ya.ru>
~ Copyright (C) 2021 Spacious Team <spacious-team@ya.ru>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
Expand All @@ -28,7 +28,7 @@
</parent>
<groupId>ru.investbook</groupId>
<artifactId>investbook</artifactId>
<version>2023.4</version>
<version>2024.1</version>

<name>investbook</name>
<description>Investor Accounting Book</description>
Expand Down Expand Up @@ -62,7 +62,7 @@

<properties>
<!-- Valid version is (0-255).(0-255).(0-65535) -->
<win.msi.version>23.4</win.msi.version>
<win.msi.version>24.1</win.msi.version>
<java.version>21</java.version>
</properties>

Expand Down Expand Up @@ -174,8 +174,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -352,7 +352,7 @@
</executions>
</plugin>
<plugin>
<!-- jpackage requires https://wixtoolset.org/releases/ (only Wix, Toolset not required) -->
<!-- jpackage requires Wix 3: https://wixtoolset.org/docs/wix3/ (only Wix, Toolset not required) -->
<groupId>org.panteleyev</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
<version>1.2.1</version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/assembly/jpackage/dir.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
~ InvestBook
~ Copyright (C) 2020 Vitalii Ananev <spacious-team@ya.ru>
~ Copyright (C) 2020 Spacious Team <spacious-team@ya.ru>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/main/assembly/zip/zip.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
~ InvestBook
~ Copyright (C) 2020 Vitalii Ananev <spacious-team@ya.ru>
~ Copyright (C) 2020 Spacious Team <spacious-team@ya.ru>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/ru/investbook/api/AbstractRestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import jakarta.persistence.GeneratedValue;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -30,10 +32,8 @@

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

import static java.nio.charset.StandardCharsets.UTF_8;

Expand All @@ -42,11 +42,10 @@ public abstract class AbstractRestController<ID, Pojo, Entity> {
protected final JpaRepository<Entity, ID> repository;
protected final EntityConverter<Entity, Pojo> converter;

protected List<Pojo> get() {
return repository.findAll()
.stream()
.map(converter::fromEntity)
.collect(Collectors.toList());

protected Page<Pojo> get(Pageable pageable) {
return repository.findAll(pageable)
.map(converter::fromEntity);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Iterable<CashFlowType> getCashFlowType() {
@Operation(summary = "Отобразить по идентификатору")
public ResponseEntity<CashFlowType> getCashFlowType(@PathVariable("id")
@Parameter(description = "Идентификатор типа")
Integer id) {
Integer id) {
Optional<CashFlowType> result = cashFlowTypeRepository.findById(id)
.map(cashFlowTypeConverter::fromEntity);
return result
Expand Down
20 changes: 13 additions & 7 deletions src/main/java/ru/investbook/api/EventCashFlowRestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.spacious_team.broker.pojo.EventCashFlow;
import org.springdoc.core.converters.models.PageableAsQueryParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -36,7 +39,6 @@
import ru.investbook.converter.EntityConverter;
import ru.investbook.entity.EventCashFlowEntity;

import java.util.List;
import java.util.Optional;

@RestController
Expand All @@ -53,17 +55,19 @@ public EventCashFlowRestController(JpaRepository<EventCashFlowEntity, Integer> r

@Override
@GetMapping
@PageableAsQueryParam
@Operation(summary = "Отобразить все", description = "Отображает все выплаты по всем счетам")
public List<EventCashFlow> get() {
return super.get();
public Page<EventCashFlow> get(@Parameter(hidden = true)
Pageable pageable) {
return super.get(pageable);
}

@Override
@GetMapping("{id}")
@Operation(summary = "Отобразить одну", description = "Отобразить выплату по ее номеру")
public ResponseEntity<EventCashFlow> get(@PathVariable("id")
@Parameter(description = "Номер события")
Integer id) {
Integer id) {
return super.get(id);
}

Expand All @@ -79,8 +83,10 @@ public ResponseEntity<Void> post(@Valid @RequestBody EventCashFlow event) {
@Operation(summary = "Изменить", description = "Модифицировать информацию в БД")
public ResponseEntity<Void> put(@PathVariable("id")
@Parameter(description = "Номер события")
Integer id,
@Valid @RequestBody EventCashFlow event) {
Integer id,
@Valid
@RequestBody
EventCashFlow event) {
return super.put(id, event);
}

Expand All @@ -89,7 +95,7 @@ public ResponseEntity<Void> put(@PathVariable("id")
@Operation(summary = "Удалить", description = "Удалить информацию из БД")
public void delete(@PathVariable("id")
@Parameter(description = "Номер события")
Integer id) {
Integer id) {
super.delete(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.spacious_team.broker.pojo.ForeignExchangeRate;
import org.springdoc.core.converters.models.PageableAsQueryParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand Down Expand Up @@ -62,17 +66,19 @@ public ForeignExchangeRateRestController(ForeignExchangeRateRepository repositor

@Override
@GetMapping
@PageableAsQueryParam
@Operation(summary = "Отобразить все", description = "Отображает все загруженные в БД информацию по обменным курсам")
protected List<ForeignExchangeRate> get() {
return super.get();
protected Page<ForeignExchangeRate> get(@Parameter(hidden = true)
Pageable pageable) {
return super.get(pageable);
}

@GetMapping("/currency-pairs/{currency-pair}")
@Operation(summary = "Отобразить по валюте",
description = "Отображает всю загруженные в БД информацию по обменному курсу одной валюте")
protected List<ForeignExchangeRate> get(@PathVariable("currency-pair")
@Parameter(description = "Валютная пара")
String currencyPair) {
String currencyPair) {
return foreignExchangeRateRepository.findByPkCurrencyPairOrderByPkDateDesc(currencyPair)
.stream()
.map(converter::fromEntity)
Expand All @@ -86,18 +92,18 @@ protected List<ForeignExchangeRate> get(@PathVariable("currency-pair")
@Operation(summary = "Отобразить по валюте и дате")
protected ResponseEntity<ForeignExchangeRate> get(@PathVariable("currency-pair")
@Parameter(description = "Валютная пара", example = "USDRUB")
String currencyPair,
String currencyPair,
@PathVariable("date")
@Parameter(description = "Дата", example = "2021-01-23")
@DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate date) {
LocalDate date) {
return super.get(getId(currencyPair, date));
}

@Override
@PostMapping
@Operation(summary = "Добавить")
public ResponseEntity<Void> post(@RequestBody ForeignExchangeRate object) {
public ResponseEntity<Void> post(@Valid @RequestBody ForeignExchangeRate object) {
foreignExchangeRateService.invalidateCache();
return super.post(object);
}
Expand All @@ -109,12 +115,14 @@ public ResponseEntity<Void> post(@RequestBody ForeignExchangeRate object) {
@Operation(summary = "Обновить", description = "Обновляет информацию о курсе валюты за заданную дату")
public ResponseEntity<Void> put(@PathVariable("currency-pair")
@Parameter(description = "Валютная пара", example = "USDRUB")
String currencyPair,
String currencyPair,
@PathVariable("date")
@Parameter(description = "Дата", example = "2021-01-23")
@DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate date,
@RequestBody ForeignExchangeRate object) {
LocalDate date,
@Valid
@RequestBody
ForeignExchangeRate object) {
foreignExchangeRateService.invalidateCache();
return super.put(getId(currencyPair, date), object);
}
Expand All @@ -126,11 +134,11 @@ public ResponseEntity<Void> put(@PathVariable("currency-pair")
@Operation(summary = "Удалить", description = "Удаляет информацию о курсе из БД")
public void delete(@PathVariable("currency-pair")
@Parameter(description = "Валютная пара", example = "USDRUB")
String currencyPair,
String currencyPair,
@PathVariable("date")
@Parameter(description = "Дата", example = "2021-01-23")
@DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate date) {
LocalDate date) {
foreignExchangeRateService.invalidateCache();
super.delete(getId(currencyPair, date));
}
Expand Down