diff --git a/src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java b/src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java index d04866d..c9e2c0a 100644 --- a/src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java +++ b/src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java @@ -84,9 +84,16 @@ public class FujianSurvey extends Model { this.setPrice(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue())); this.setTax(((Double) row.getCell(6, policy).getNumericCellValue()).intValue()); this.setDate(row.getCell(7, policy).getLocalDateTimeCellValue().toLocalDate()); + if (this.getName().isEmpty()) { + throw new IllegalArgumentException("名称为空"); + } + if (((Integer) this.getPrice().intValue()).equals(0)) { + throw new IllegalArgumentException("缺少价格"); + } } public FujianSurvey update(FujianSurvey item) { + this.setMaterialId(item.getMaterialId()); this.setName(item.getName()); this.setSpec(item.getSpec()); this.setPrice(item.getPrice()); diff --git a/src/main/java/mjkf/xinke/main/model/db/FuzhouHighwayBureau.java b/src/main/java/mjkf/xinke/main/model/db/FuzhouHighwayBureau.java index 670c87f..be98992 100644 --- a/src/main/java/mjkf/xinke/main/model/db/FuzhouHighwayBureau.java +++ b/src/main/java/mjkf/xinke/main/model/db/FuzhouHighwayBureau.java @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; +import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; /** @@ -49,6 +50,18 @@ public class FuzhouHighwayBureau extends Model { @TableField("`DATE`") private LocalDate date; + @ApiModelProperty("材料id") + @TableField("`MATERIAL_ID`") + private String materialId; + + @ApiModelProperty("单位") + @TableField("`UNIT`") + private String unit; + + @ApiModelProperty("品牌") + @TableField("`BRAND`") + private String brand; + @Override public Serializable pkVal() { return this.id; @@ -57,16 +70,30 @@ public class FuzhouHighwayBureau extends Model { public FuzhouHighwayBureau () {} public FuzhouHighwayBureau (Row row) { - this.setName(row.getCell(0).getStringCellValue()); - this.setSpec(row.getCell(1).getStringCellValue()); - this.setPrice(BigDecimal.valueOf(row.getCell(2).getNumericCellValue())); - this.setDate(row.getCell(3).getLocalDateTimeCellValue().toLocalDate()); + var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK; + row.getCell(0, policy).setCellType(CellType.STRING); + this.setMaterialId(row.getCell(0, policy).getStringCellValue()); + this.setName(row.getCell(1, policy).getStringCellValue()); + this.setSpec(row.getCell(2, policy).getStringCellValue()); + this.setUnit(row.getCell(3, policy).getStringCellValue()); + this.setBrand(row.getCell(4, policy).getStringCellValue()); + this.setPrice(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue())); + this.setDate(row.getCell(6, policy).getLocalDateTimeCellValue().toLocalDate()); + if (this.getName().isEmpty()) { + throw new IllegalArgumentException("名称为空"); + } + if (((Integer) this.getPrice().intValue()).equals(0)) { + throw new IllegalArgumentException("缺少价格"); + } } public FuzhouHighwayBureau update(FuzhouHighwayBureau item) { + this.setMaterialId(item.getMaterialId()); this.setName(item.getName()); this.setSpec(item.getSpec()); this.setPrice(item.getPrice()); + this.setUnit(item.getUnit()); + this.setBrand(item.getBrand()); this.setDate(item.getDate()); return this; } diff --git a/src/main/java/mjkf/xinke/main/model/db/FuzhouTransportationBureau.java b/src/main/java/mjkf/xinke/main/model/db/FuzhouTransportationBureau.java index 0dc8563..8133752 100644 --- a/src/main/java/mjkf/xinke/main/model/db/FuzhouTransportationBureau.java +++ b/src/main/java/mjkf/xinke/main/model/db/FuzhouTransportationBureau.java @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; +import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; /** @@ -49,6 +50,18 @@ public class FuzhouTransportationBureau extends Model