完成报表中心

This commit is contained in:
Zzzz
2026-04-27 22:07:20 +08:00
parent d503036aeb
commit f9a9c630c2
26 changed files with 1127 additions and 4 deletions
@@ -0,0 +1,31 @@
package com.mzh.library.entity;
public class BorrowingSummary {
private int activeLoans;
private int returnedLoans;
private int overdueLoans;
public int getActiveLoans() {
return activeLoans;
}
public void setActiveLoans(int activeLoans) {
this.activeLoans = activeLoans;
}
public int getReturnedLoans() {
return returnedLoans;
}
public void setReturnedLoans(int returnedLoans) {
this.returnedLoans = returnedLoans;
}
public int getOverdueLoans() {
return overdueLoans;
}
public void setOverdueLoans(int overdueLoans) {
this.overdueLoans = overdueLoans;
}
}
@@ -0,0 +1,40 @@
package com.mzh.library.entity;
public class InventorySummary {
private int totalTitles;
private int totalCopies;
private int availableCopies;
private int unavailableOrEmptyTitles;
public int getTotalTitles() {
return totalTitles;
}
public void setTotalTitles(int totalTitles) {
this.totalTitles = totalTitles;
}
public int getTotalCopies() {
return totalCopies;
}
public void setTotalCopies(int totalCopies) {
this.totalCopies = totalCopies;
}
public int getAvailableCopies() {
return availableCopies;
}
public void setAvailableCopies(int availableCopies) {
this.availableCopies = availableCopies;
}
public int getUnavailableOrEmptyTitles() {
return unavailableOrEmptyTitles;
}
public void setUnavailableOrEmptyTitles(int unavailableOrEmptyTitles) {
this.unavailableOrEmptyTitles = unavailableOrEmptyTitles;
}
}
@@ -0,0 +1,67 @@
package com.mzh.library.entity;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class OverdueReportRow {
private static final DateTimeFormatter DISPLAY_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
private String readerIdentifier;
private String readerName;
private String bookIdentifier;
private String bookTitle;
private LocalDateTime dueAt;
private long overdueDays;
public String getReaderIdentifier() {
return readerIdentifier;
}
public void setReaderIdentifier(String readerIdentifier) {
this.readerIdentifier = readerIdentifier;
}
public String getReaderName() {
return readerName;
}
public void setReaderName(String readerName) {
this.readerName = readerName;
}
public String getBookIdentifier() {
return bookIdentifier;
}
public void setBookIdentifier(String bookIdentifier) {
this.bookIdentifier = bookIdentifier;
}
public String getBookTitle() {
return bookTitle;
}
public void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}
public LocalDateTime getDueAt() {
return dueAt;
}
public void setDueAt(LocalDateTime dueAt) {
this.dueAt = dueAt;
}
public long getOverdueDays() {
return overdueDays;
}
public void setOverdueDays(long overdueDays) {
this.overdueDays = overdueDays;
}
public String getDueAtText() {
return dueAt == null ? "" : DISPLAY_FORMAT.format(dueAt);
}
}
@@ -0,0 +1,40 @@
package com.mzh.library.entity;
public class PopularBookReportRow {
private String bookIdentifier;
private String title;
private String author;
private int borrowCount;
public String getBookIdentifier() {
return bookIdentifier;
}
public void setBookIdentifier(String bookIdentifier) {
this.bookIdentifier = bookIdentifier;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getBorrowCount() {
return borrowCount;
}
public void setBorrowCount(int borrowCount) {
this.borrowCount = borrowCount;
}
}
@@ -0,0 +1,51 @@
package com.mzh.library.entity;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ReportCenter {
private InventorySummary inventorySummary;
private BorrowingSummary borrowingSummary;
private List<OverdueReportRow> overdueRows = Collections.emptyList();
private List<PopularBookReportRow> popularBooks = Collections.emptyList();
public InventorySummary getInventorySummary() {
return inventorySummary;
}
public void setInventorySummary(InventorySummary inventorySummary) {
this.inventorySummary = inventorySummary;
}
public BorrowingSummary getBorrowingSummary() {
return borrowingSummary;
}
public void setBorrowingSummary(BorrowingSummary borrowingSummary) {
this.borrowingSummary = borrowingSummary;
}
public List<OverdueReportRow> getOverdueRows() {
return overdueRows;
}
public void setOverdueRows(List<OverdueReportRow> overdueRows) {
this.overdueRows = immutableCopy(overdueRows);
}
public List<PopularBookReportRow> getPopularBooks() {
return popularBooks;
}
public void setPopularBooks(List<PopularBookReportRow> popularBooks) {
this.popularBooks = immutableCopy(popularBooks);
}
private static <T> List<T> immutableCopy(List<T> source) {
if (source == null || source.isEmpty()) {
return Collections.emptyList();
}
return Collections.unmodifiableList(new ArrayList<>(source));
}
}