fix - kalender woche
This commit is contained in:
parent
3973e1ae91
commit
ff8cfb44bd
1 changed files with 15 additions and 12 deletions
|
|
@ -4,6 +4,9 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.temporal.IsoFields;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -553,7 +556,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
/**
|
/**
|
||||||
* Diese Methode gruppiert eine Rechnungsliste nach Kalenderwoche
|
* Diese Methode gruppiert eine Rechnungsliste nach Kalenderwoche
|
||||||
*
|
*
|
||||||
* @param spaceID - Space Ref to select a list of invoices assoicated with a
|
* @param spaceID - Space Ref to select a list of invoices associated with a
|
||||||
* space
|
* space
|
||||||
* @param cache - a local cache storing all invoices by week
|
* @param cache - a local cache storing all invoices by week
|
||||||
*
|
*
|
||||||
|
|
@ -562,7 +565,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
private void groupInvoicesByWeek(String spaceID, String spaceName,
|
private void groupInvoicesByWeek(String spaceID, String spaceName,
|
||||||
Map<String, WeekInvoiceData> cache, String currency1) {
|
Map<String, WeekInvoiceData> cache, String currency1) {
|
||||||
|
|
||||||
logger.info("...group invoices for " + spaceName + "/" + spaceID);
|
logger.info("...group invoices (DEBUG) for " + spaceName + "/" + spaceID);
|
||||||
try {
|
try {
|
||||||
List<ItemCollection> invoices = documentService.find(
|
List<ItemCollection> invoices = documentService.find(
|
||||||
"$modelversion:rechnungsausgang-* AND type:workitem AND $uniqueidref:" + spaceID, 9999, 0,
|
"$modelversion:rechnungsausgang-* AND type:workitem AND $uniqueidref:" + spaceID, 9999, 0,
|
||||||
|
|
@ -572,17 +575,17 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
for (ItemCollection invoice : invoices) {
|
for (ItemCollection invoice : invoices) {
|
||||||
// compute Week
|
// compute Week
|
||||||
Date dueDate = invoice.getItemValueDate("invoice.duedate");
|
Date dueDate = invoice.getItemValueDate("invoice.duedate");
|
||||||
Calendar calendar = new GregorianCalendar();
|
|
||||||
calendar.setTime(dueDate);
|
LocalDate localDate = dueDate.toInstant()
|
||||||
int weekNumber = calendar.get(Calendar.WEEK_OF_YEAR);
|
.atZone(ZoneId.systemDefault())
|
||||||
int year = calendar.get(Calendar.YEAR);
|
.toLocalDate();
|
||||||
String weekCategory = year + "/";
|
int weekNumber = localDate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
||||||
if (weekNumber < 10) {
|
int weekBasedYear = localDate.get(IsoFields.WEEK_BASED_YEAR);
|
||||||
weekCategory = weekCategory + "0" + weekNumber;
|
String weekCategory = weekBasedYear + "/" + String.format("%02d", weekNumber);
|
||||||
} else {
|
if ("2024/01".equals(weekCategory)) {
|
||||||
weekCategory = weekCategory + weekNumber;
|
logger.warning("--> Invoice found with 2024/01: " + invoice.getUniqueID());
|
||||||
}
|
}
|
||||||
// haben wir shon ein listchen?
|
// haben wir schon ein listchen?
|
||||||
|
|
||||||
String key = spaceName + "/" + weekCategory;
|
String key = spaceName + "/" + weekCategory;
|
||||||
logger.fine(" ....building weekInvoiceData object for " + key);
|
logger.fine(" ....building weekInvoiceData object for " + key);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue