feat: 上传地材历史数据
This commit is contained in:
@@ -91,24 +91,23 @@ public class LocalMaterial extends Model<LocalMaterial> {
|
||||
|
||||
public LocalMaterial() {}
|
||||
|
||||
public LocalMaterial (Row row, MaterialTask data) {
|
||||
public LocalMaterial (Row row, MaterialTask task) {
|
||||
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
|
||||
this.setDate(row.getCell(0, policy).getLocalDateTimeCellValue().toLocalDate());
|
||||
this.setCity(row.getCell(1, policy).getStringCellValue());
|
||||
this.setCounty(row.getCell(2, policy).getStringCellValue());
|
||||
this.setName(row.getCell(3, policy).getStringCellValue());
|
||||
this.setSpec(row.getCell(4, policy).getStringCellValue());
|
||||
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.setPosition(row.getCell(8, policy).getStringCellValue());
|
||||
this.setRemark(row.getCell(9, policy).getStringCellValue());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(this.name)) {
|
||||
this.name = this.name.replace(" ", "");
|
||||
this.setCity(row.getCell(0, policy).getStringCellValue());
|
||||
this.setCounty(row.getCell(1, policy).getStringCellValue());
|
||||
this.setName(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
|
||||
this.setSpec(row.getCell(3, policy).getStringCellValue().replace(" ", ""));
|
||||
this.setUnit(row.getCell(4, policy).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue()));
|
||||
this.setPriceWithoutTax(BigDecimal.valueOf(row.getCell(6, policy).getNumericCellValue()));
|
||||
this.setPosition(row.getCell(7, policy).getStringCellValue());
|
||||
this.setRemark(row.getCell(8, policy).getStringCellValue());
|
||||
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
|
||||
if (this.getName().isEmpty()) {
|
||||
throw new IllegalArgumentException("名称为空");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(this.spec)) {
|
||||
this.spec = this.spec.replace(" ", "");
|
||||
if (ObjectUtil.isEmpty(this.getPrice())) {
|
||||
throw new IllegalArgumentException("缺少价格");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user