feat(material-task): 确认福州交通局数据导入
This commit is contained in:
@@ -84,9 +84,16 @@ public class FujianSurvey extends Model<FujianSurvey> {
|
||||
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());
|
||||
|
@@ -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<FuzhouHighwayBureau> {
|
||||
@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<FuzhouHighwayBureau> {
|
||||
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;
|
||||
}
|
||||
|
@@ -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<FuzhouTransportationBureau
|
||||
@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 FuzhouTransportationBureau extends Model<FuzhouTransportationBureau
|
||||
public FuzhouTransportationBureau () {}
|
||||
|
||||
public FuzhouTransportationBureau (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).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 FuzhouTransportationBureau update(FuzhouTransportationBureau 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user