fix: 修复发布期数异常的问题

This commit is contained in:
han0
2024-10-24 09:37:32 +08:00
parent 52f2f29b64
commit 8c69f4808b
2 changed files with 3 additions and 3 deletions

View File

@@ -104,9 +104,9 @@ public class PricePublishController {
var query = pricePublishService.getQuery(year, month, null, null, null, null);
List<PricePublish> items = pricePublishService.list(query);
PublicController.PublicUpdateInfo result;
if (items.size() == 0) {
if (items.size() == 0) { // 无发布数据
result = new PublicController.PublicUpdateInfo(year, month);
} else {
} else { // 有发布数据
var data = items.get(0);
result = new PublicController.PublicUpdateInfo(data);
}

View File

@@ -209,7 +209,7 @@ public class PublicController {
}
public PublicUpdateInfo (PricePublish lastData) {
this.date = lastData.getCreateTime().toLocalDate();
this.date = LocalDate.of(lastData.getYear(), lastData.getMonth(), 1);
this.period = getPeriod(this.date.getYear(), this.date.getMonth().getValue());
this.year = date.getYear();
this.month = date.getMonth().getValue();