From 45f0b2ebbfab79e52273b94883c6323685e0b37c Mon Sep 17 00:00:00 2001 From: han0 Date: Mon, 25 Dec 2023 15:10:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(local-material):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=9C=B0=E6=9D=90=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xinke/main/constant/MaterialTaskType.java | 43 ++++++++++++------- .../xinke/main/model/db/LocalMaterial.java | 35 ++++++++++++--- .../main/service/MaterialResultService.java | 14 +----- 3 files changed, 57 insertions(+), 35 deletions(-) diff --git a/src/main/java/mjkf/xinke/main/constant/MaterialTaskType.java b/src/main/java/mjkf/xinke/main/constant/MaterialTaskType.java index e2b96da..26f6253 100644 --- a/src/main/java/mjkf/xinke/main/constant/MaterialTaskType.java +++ b/src/main/java/mjkf/xinke/main/constant/MaterialTaskType.java @@ -27,7 +27,7 @@ public class MaterialTaskType { public static final Integer FUJIAN_DEPARTMENT = 701; // 发改委 public static final Integer OIL = 801; // 汽柴油 - // 地材 + // 地材(废弃) public static final Integer LOCAL_MEDIUM_COARSE_SAND = 901; // 中粗砂 public static final Integer LOCAL_MECHANISM_SAND = 902; // 机制砂 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 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 list = List.of( MY_STEEL_REBAR, MY_STEEL_SECTION, @@ -55,13 +65,15 @@ public class MaterialTaskType { OTHER_YUNNAN, FUJIAN_DEPARTMENT, OIL, - LOCAL_MEDIUM_COARSE_SAND, - LOCAL_MECHANISM_SAND, - LOCAL_GRAVEL, - LOCAL_MAOTIAO_STONE, - LOCAL_FINE_AGGREGATE, - LOCAL_COARSE_AGGREGATE, - LOCAL_CLAY + + LOCAL_FUZHOU, + LOCAL_LONGYAN, + LOCAL_NANPING, + LOCAL_NINGDE, + LOCAL_PUTIAN, + LOCAL_QUANZHOU, + LOCAL_SANMING, + LOCAL_ZHANGZHOU ); public static boolean isFromSpider(Integer type) { @@ -77,13 +89,14 @@ public class MaterialTaskType { public static boolean isLocalMaterial(Integer type) { var dataFromSpiderTypes = List.of( - LOCAL_MEDIUM_COARSE_SAND, - LOCAL_MECHANISM_SAND, - LOCAL_GRAVEL, - LOCAL_MAOTIAO_STONE, - LOCAL_FINE_AGGREGATE, - LOCAL_COARSE_AGGREGATE, - LOCAL_CLAY + LOCAL_FUZHOU, + LOCAL_LONGYAN, + LOCAL_NANPING, + LOCAL_NINGDE, + LOCAL_PUTIAN, + LOCAL_QUANZHOU, + LOCAL_SANMING, + LOCAL_ZHANGZHOU ); return dataFromSpiderTypes.contains(type); } diff --git a/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java b/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java index 17141b2..d3a25e5 100644 --- a/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java +++ b/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java @@ -1,5 +1,6 @@ package mjkf.xinke.main.model.db; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -68,6 +69,14 @@ public class LocalMaterial extends Model { @TableField("`DATE`") private LocalDate date; + @ApiModelProperty("位置") + @TableField("`POSITION`") + private String position; + + @ApiModelProperty("备注") + @TableField("`REMARK`") + private String remark; + @Override public Serializable pkVal() { return this.id; @@ -76,13 +85,23 @@ public class LocalMaterial extends Model { public LocalMaterial() {} public LocalMaterial (Row row) { - this.setName(row.getCell(0).getStringCellValue()); - this.setCity(row.getCell(1).getStringCellValue()); - this.setCounty(row.getCell(2).getStringCellValue()); - this.setPrice(BigDecimal.valueOf(row.getCell(3).getNumericCellValue())); - this.setDate(row.getCell(4).getLocalDateTimeCellValue().toLocalDate()); - this.setSpec(row.getCell(5).getStringCellValue()); - this.setUnit(row.getCell(6).getStringCellValue()); + 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.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) { @@ -93,6 +112,8 @@ public class LocalMaterial extends Model { this.setDate(item.getDate()); this.setSpec(item.getSpec()); this.setUnit(item.getUnit()); + this.setPosition(item.getPosition()); + this.setRemark(item.getRemark()); return this; } } diff --git a/src/main/java/mjkf/xinke/main/service/MaterialResultService.java b/src/main/java/mjkf/xinke/main/service/MaterialResultService.java index b42caf0..e955a49 100644 --- a/src/main/java/mjkf/xinke/main/service/MaterialResultService.java +++ b/src/main/java/mjkf/xinke/main/service/MaterialResultService.java @@ -158,19 +158,7 @@ public class MaterialResultService { // service = fujianDepartmentService; } else if (type.equals(MaterialTaskType.OIL)) { service = oilService; - } else if (type.equals(MaterialTaskType.LOCAL_MEDIUM_COARSE_SAND)) { - 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)) { + } else if (MaterialTaskType.isLocalMaterial(type)) { service = localMaterialService; } else {