fix: 更新地材处理
This commit is contained in:
@@ -102,6 +102,10 @@ public class LocalMaterial extends Model<LocalMaterial> {
|
||||
public LocalMaterial (Row row, MaterialTask task) {
|
||||
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
|
||||
row.getCell(0).setCellType(CellType.STRING);
|
||||
row.getCell(6).setCellType(CellType.NUMERIC);
|
||||
row.getCell(7).setCellType(CellType.NUMERIC);
|
||||
row.getCell(8).setCellType(CellType.STRING);
|
||||
row.getCell(9).setCellType(CellType.STRING);
|
||||
this.setMaterialId(row.getCell(0, policy).getStringCellValue());
|
||||
this.setCity(row.getCell(1, policy).getStringCellValue());
|
||||
this.setCounty(row.getCell(2, policy).getStringCellValue());
|
||||
@@ -109,13 +113,16 @@ public class LocalMaterial extends Model<LocalMaterial> {
|
||||
this.setSpec(row.getCell(4, policy).getStringCellValue().replace(" ", ""));
|
||||
this.setUnit(row.getCell(5, policy).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(6, policy).getNumericCellValue()));
|
||||
this.setPriceWithoutTax(BigDecimal.valueOf(row.getCell(7, policy).getNumericCellValue()));
|
||||
this.setPriceWithoutTax(BigDecimal.valueOf(row.getCell(7, policy).getNumericCellValue()));
|
||||
this.setPosition(row.getCell(8, policy).getStringCellValue());
|
||||
this.setRemark(row.getCell(9, policy).getStringCellValue());
|
||||
this.setRemark(row.getCell(9, policy).getStringCellValue());
|
||||
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
|
||||
if (this.getMaterialId().isEmpty()) {
|
||||
throw new IllegalArgumentException("材料编码为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(this.getCounty())) {
|
||||
throw new IllegalArgumentException("缺少区县");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(this.getPrice())) {
|
||||
throw new IllegalArgumentException("缺少价格");
|
||||
}
|
||||
|
@@ -35,8 +35,7 @@ public class LocalMaterialService extends DataService<BaseMapper<LocalMaterial>,
|
||||
|
||||
public LambdaQueryWrapper<LocalMaterial> indexQuery(LocalMaterial data) {
|
||||
LambdaQueryWrapper<LocalMaterial> query = new LambdaQueryWrapper<>();
|
||||
query.eq(LocalMaterial::getName, data.getName());
|
||||
query.eq(LocalMaterial::getSpec, data.getSpec());
|
||||
query.eq(LocalMaterial::getMaterialId, data.getMaterialId());
|
||||
query.eq(LocalMaterial::getCity, data.getCity());
|
||||
query.eq(LocalMaterial::getCounty, data.getCounty());
|
||||
query.eq(LocalMaterial::getDate, data.getDate());
|
||||
@@ -46,8 +45,7 @@ public class LocalMaterialService extends DataService<BaseMapper<LocalMaterial>,
|
||||
public LambdaQueryWrapper<LocalMaterial> trendQuery(Object obj, Integer year, Integer month) {
|
||||
var data = (LocalMaterial) obj;
|
||||
LambdaQueryWrapper<LocalMaterial> query = new LambdaQueryWrapper<>();
|
||||
query.eq(LocalMaterial::getName, data.getName());
|
||||
query.eq(LocalMaterial::getSpec, data.getSpec());
|
||||
query.eq(LocalMaterial::getMaterialId, data.getMaterialId());
|
||||
query.eq(LocalMaterial::getCounty, data.getCounty());
|
||||
var date = LocalDate.of(year, month, 1);
|
||||
query.between(LocalMaterial::getDate, date.minusYears(1), date.plusMonths(1));
|
||||
|
Reference in New Issue
Block a user