fix(local-material): 修改地材上传

This commit is contained in:
han0
2023-12-25 15:10:59 +08:00
parent ecf7ad188d
commit 45f0b2ebbf
3 changed files with 57 additions and 35 deletions

View File

@@ -27,7 +27,7 @@ public class MaterialTaskType {
public static final Integer FUJIAN_DEPARTMENT = 701; public static final Integer FUJIAN_DEPARTMENT = 701;
// 发改委 // 发改委
public static final Integer OIL = 801; // 汽柴油 public static final Integer OIL = 801; // 汽柴油
// 地材 // 地材(废弃)
public static final Integer LOCAL_MEDIUM_COARSE_SAND = 901; // 中粗砂 public static final Integer LOCAL_MEDIUM_COARSE_SAND = 901; // 中粗砂
public static final Integer LOCAL_MECHANISM_SAND = 902; // 机制砂 public static final Integer LOCAL_MECHANISM_SAND = 902; // 机制砂
public static final Integer LOCAL_GRAVEL = 903; // 碎石 public static final Integer LOCAL_GRAVEL = 903; // 碎石
@@ -38,6 +38,16 @@ public class MaterialTaskType {
// 辅材 // 辅材
public static final Integer ASPHALT_MODIFIER = 1001; // 改性剂 public static final Integer ASPHALT_MODIFIER = 1001; // 改性剂
// 新地材
public static final Integer LOCAL_FUZHOU = 1101; // 福州
public static final Integer LOCAL_LONGYAN = 1102; // 龙岩
public static final Integer LOCAL_NANPING = 1103; // 南平
public static final Integer LOCAL_NINGDE = 1104; // 宁德
public static final Integer LOCAL_PUTIAN = 1105; // 莆田
public static final Integer LOCAL_QUANZHOU = 1106; // 泉州
public static final Integer LOCAL_SANMING = 1107; // 三明
public static final Integer LOCAL_ZHANGZHOU = 1108; // 漳州
public static final List<Integer> list = List.of( public static final List<Integer> list = List.of(
MY_STEEL_REBAR, MY_STEEL_REBAR,
MY_STEEL_SECTION, MY_STEEL_SECTION,
@@ -55,13 +65,15 @@ public class MaterialTaskType {
OTHER_YUNNAN, OTHER_YUNNAN,
FUJIAN_DEPARTMENT, FUJIAN_DEPARTMENT,
OIL, OIL,
LOCAL_MEDIUM_COARSE_SAND,
LOCAL_MECHANISM_SAND, LOCAL_FUZHOU,
LOCAL_GRAVEL, LOCAL_LONGYAN,
LOCAL_MAOTIAO_STONE, LOCAL_NANPING,
LOCAL_FINE_AGGREGATE, LOCAL_NINGDE,
LOCAL_COARSE_AGGREGATE, LOCAL_PUTIAN,
LOCAL_CLAY LOCAL_QUANZHOU,
LOCAL_SANMING,
LOCAL_ZHANGZHOU
); );
public static boolean isFromSpider(Integer type) { public static boolean isFromSpider(Integer type) {
@@ -77,13 +89,14 @@ public class MaterialTaskType {
public static boolean isLocalMaterial(Integer type) { public static boolean isLocalMaterial(Integer type) {
var dataFromSpiderTypes = List.of( var dataFromSpiderTypes = List.of(
LOCAL_MEDIUM_COARSE_SAND, LOCAL_FUZHOU,
LOCAL_MECHANISM_SAND, LOCAL_LONGYAN,
LOCAL_GRAVEL, LOCAL_NANPING,
LOCAL_MAOTIAO_STONE, LOCAL_NINGDE,
LOCAL_FINE_AGGREGATE, LOCAL_PUTIAN,
LOCAL_COARSE_AGGREGATE, LOCAL_QUANZHOU,
LOCAL_CLAY LOCAL_SANMING,
LOCAL_ZHANGZHOU
); );
return dataFromSpiderTypes.contains(type); return dataFromSpiderTypes.contains(type);
} }

View File

@@ -1,5 +1,6 @@
package mjkf.xinke.main.model.db; package mjkf.xinke.main.model.db;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@@ -68,6 +69,14 @@ public class LocalMaterial extends Model<LocalMaterial> {
@TableField("`DATE`") @TableField("`DATE`")
private LocalDate date; private LocalDate date;
@ApiModelProperty("位置")
@TableField("`POSITION`")
private String position;
@ApiModelProperty("备注")
@TableField("`REMARK`")
private String remark;
@Override @Override
public Serializable pkVal() { public Serializable pkVal() {
return this.id; return this.id;
@@ -76,13 +85,23 @@ public class LocalMaterial extends Model<LocalMaterial> {
public LocalMaterial() {} public LocalMaterial() {}
public LocalMaterial (Row row) { public LocalMaterial (Row row) {
this.setName(row.getCell(0).getStringCellValue()); var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
this.setCity(row.getCell(1).getStringCellValue()); this.setDate(row.getCell(0, policy).getLocalDateTimeCellValue().toLocalDate());
this.setCounty(row.getCell(2).getStringCellValue()); this.setCity(row.getCell(1, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(3).getNumericCellValue())); this.setCounty(row.getCell(2, policy).getStringCellValue());
this.setDate(row.getCell(4).getLocalDateTimeCellValue().toLocalDate()); this.setName(row.getCell(3, policy).getStringCellValue());
this.setSpec(row.getCell(5).getStringCellValue()); this.setSpec(row.getCell(4, policy).getStringCellValue());
this.setUnit(row.getCell(6).getStringCellValue()); this.setUnit(row.getCell(5, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(6, 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(" ", "");
}
if (ObjectUtil.isNotEmpty(this.spec)) {
this.spec = this.spec.replace(" ", "");
}
} }
public LocalMaterial update(LocalMaterial item) { public LocalMaterial update(LocalMaterial item) {
@@ -93,6 +112,8 @@ public class LocalMaterial extends Model<LocalMaterial> {
this.setDate(item.getDate()); this.setDate(item.getDate());
this.setSpec(item.getSpec()); this.setSpec(item.getSpec());
this.setUnit(item.getUnit()); this.setUnit(item.getUnit());
this.setPosition(item.getPosition());
this.setRemark(item.getRemark());
return this; return this;
} }
} }

View File

@@ -158,19 +158,7 @@ public class MaterialResultService {
// service = fujianDepartmentService; // service = fujianDepartmentService;
} else if (type.equals(MaterialTaskType.OIL)) { } else if (type.equals(MaterialTaskType.OIL)) {
service = oilService; service = oilService;
} else if (type.equals(MaterialTaskType.LOCAL_MEDIUM_COARSE_SAND)) { } else if (MaterialTaskType.isLocalMaterial(type)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_MECHANISM_SAND)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_GRAVEL)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_MAOTIAO_STONE)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_FINE_AGGREGATE)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_COARSE_AGGREGATE)) {
service = localMaterialService;
} else if (type.equals(MaterialTaskType.LOCAL_CLAY)) {
service = localMaterialService; service = localMaterialService;
} else { } else {