fix: 修复获取最新数据的异常
This commit is contained in:
@@ -52,7 +52,7 @@ public class PricePublishController {
|
||||
if (month < 0 || year < 0) {
|
||||
var date = pricePublishService.getLatestDate();
|
||||
year = date.getYear();
|
||||
month = date.getMonth();
|
||||
month = date.getMonthValue();
|
||||
}
|
||||
|
||||
var query = pricePublishService.getQuery(year, month, materialId, name, spec, type);
|
||||
|
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import mjkf.xinke.main.model.vo.BudgetCreateRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -58,12 +58,12 @@ public class PricePublishService extends ServiceImpl<BaseMapper<PricePublish>, P
|
||||
return result;
|
||||
}
|
||||
|
||||
public Date getLatestDate() {
|
||||
public LocalDate getLatestDate() {
|
||||
var query = new LambdaQueryWrapper<PricePublish>();
|
||||
query.orderByDesc(PricePublish::getYear);
|
||||
query.orderByDesc(PricePublish::getMonth);
|
||||
var data = this.getOne(query, false);
|
||||
var result = new Date(data.getYear(), data.getMonth(), 1);
|
||||
var result = LocalDate.of(data.getYear(), data.getMonth(), 1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user