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.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.IsoFields;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
|
|
@ -553,7 +556,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
|||
/**
|
||||
* 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
|
||||
* @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,
|
||||
Map<String, WeekInvoiceData> cache, String currency1) {
|
||||
|
||||
logger.info("...group invoices for " + spaceName + "/" + spaceID);
|
||||
logger.info("...group invoices (DEBUG) for " + spaceName + "/" + spaceID);
|
||||
try {
|
||||
List<ItemCollection> invoices = documentService.find(
|
||||
"$modelversion:rechnungsausgang-* AND type:workitem AND $uniqueidref:" + spaceID, 9999, 0,
|
||||
|
|
@ -572,17 +575,17 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
|||
for (ItemCollection invoice : invoices) {
|
||||
// compute Week
|
||||
Date dueDate = invoice.getItemValueDate("invoice.duedate");
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(dueDate);
|
||||
int weekNumber = calendar.get(Calendar.WEEK_OF_YEAR);
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
String weekCategory = year + "/";
|
||||
if (weekNumber < 10) {
|
||||
weekCategory = weekCategory + "0" + weekNumber;
|
||||
} else {
|
||||
weekCategory = weekCategory + weekNumber;
|
||||
|
||||
LocalDate localDate = dueDate.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
int weekNumber = localDate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
||||
int weekBasedYear = localDate.get(IsoFields.WEEK_BASED_YEAR);
|
||||
String weekCategory = weekBasedYear + "/" + String.format("%02d", weekNumber);
|
||||
if ("2024/01".equals(weekCategory)) {
|
||||
logger.warning("--> Invoice found with 2024/01: " + invoice.getUniqueID());
|
||||
}
|
||||
// haben wir shon ein listchen?
|
||||
// haben wir schon ein listchen?
|
||||
|
||||
String key = spaceName + "/" + weekCategory;
|
||||
logger.fine(" ....building weekInvoiceData object for " + key);
|
||||
|
|
|
|||
Loading…
Reference in a new issue