feat: 新增十一地市表格上传与结果查看

This commit is contained in:
han0
2024-07-09 09:53:43 +08:00
parent 46e648fc8c
commit 2b08e7337c
24 changed files with 144 additions and 150 deletions

View File

@@ -21,7 +21,7 @@ public class DataDbMpGenerator {
private static String password = "Xxs123456";
private static String schema = "material_manage";
private static String[] tableList = {
"ASPHALT_MODIFIER",
"DATA_NETWORK",
};

View File

@@ -19,41 +19,41 @@ public class MaterialTaskType {
// 三明钢铁
public static final Integer SANMING_STEEL = 301;
// 交通局
public static final Integer FUZHOU_TRANSPORTATION_BUREAU = 40101; // todo-1 福州交通局
public static final Integer LONGYAN_TRANSPORTATION_BUREAU = 40102; // todo-1 龙岩交通局
public static final Integer NANPING_TRANSPORTATION_BUREAU = 40103; // todo-1 南平交通局
public static final Integer NINGDE_TRANSPORTATION_BUREAU = 40104; // todo-1 宁德交通局
public static final Integer PINTAN_TRANSPORTATION_BUREAU = 40105; // todo-1 平潭交通局
public static final Integer PUTIAN_TRANSPORTATION_BUREAU = 40106; // todo-1 莆田交通局
public static final Integer QUANZHOU_TRANSPORTATION_BUREAU = 40107; // todo-1 泉州交通局
public static final Integer SANMING_TRANSPORTATION_BUREAU = 40108; // todo-1 三明交通局
public static final Integer XIAMEN_TRANSPORTATION_BUREAU = 40109; // todo-1 厦门交通局
public static final Integer ZHANGZHOU_TRANSPORTATION_BUREAU = 40110; // todo-1 漳州交通局
public static final Integer ZHANGZHOUKFQ_TRANSPORTATION_BUREAU = 40111; // todo-1 漳州开发区交通局
public static final Integer FUZHOU_TRANSPORTATION_BUREAU = 40101; // 福州交通局
public static final Integer LONGYAN_TRANSPORTATION_BUREAU = 40102; // 龙岩交通局
public static final Integer NANPING_TRANSPORTATION_BUREAU = 40103; // 南平交通局
public static final Integer NINGDE_TRANSPORTATION_BUREAU = 40104; // 宁德交通局
public static final Integer PINTAN_TRANSPORTATION_BUREAU = 40105; // 平潭交通局
public static final Integer PUTIAN_TRANSPORTATION_BUREAU = 40106; // 莆田交通局
public static final Integer QUANZHOU_TRANSPORTATION_BUREAU = 40107; // 泉州交通局
public static final Integer SANMING_TRANSPORTATION_BUREAU = 40108; // 三明交通局
public static final Integer XIAMEN_TRANSPORTATION_BUREAU = 40109; // 厦门交通局
public static final Integer ZHANGZHOU_TRANSPORTATION_BUREAU = 40110; // 漳州交通局
public static final Integer ZHANGZHOUKFQ_TRANSPORTATION_BUREAU = 40111; // 漳州开发区交通局
// 公路局
public static final Integer FUZHOU_HIGHWAY_BUREAU = 40201; // todo-1 福州公路局
public static final Integer LONGYAN_HIGHWAY_BUREAU = 40202; // todo-1 龙岩公路局
public static final Integer NANPING_HIGHWAY_BUREAU = 40203; // todo-1 南平公路局
public static final Integer NINGDE_HIGHWAY_BUREAU = 40204; // todo-1 宁德公路局
public static final Integer PINTAN_HIGHWAY_BUREAU = 40205; // todo-1 平潭公路局
public static final Integer PUTIAN_HIGHWAY_BUREAU = 40206; // todo-1 莆田公路局
public static final Integer QUANZHOU_HIGHWAY_BUREAU = 40207; // todo-1 泉州公路局
public static final Integer SANMING_HIGHWAY_BUREAU = 40208; // todo-1 三明公路局
public static final Integer XIAMEN_HIGHWAY_BUREAU = 40209; // todo-1 厦门公路局
public static final Integer ZHANGZHOU_HIGHWAY_BUREAU = 40210; // todo-1 漳州公路局
public static final Integer ZHANGZHOUKFQ_HIGHWAY_BUREAU = 40211; // todo-1 漳州开发区公路局
public static final Integer FUZHOU_HIGHWAY_BUREAU = 40201; // 福州公路局
public static final Integer LONGYAN_HIGHWAY_BUREAU = 40202; // 龙岩公路局
public static final Integer NANPING_HIGHWAY_BUREAU = 40203; // 南平公路局
public static final Integer NINGDE_HIGHWAY_BUREAU = 40204; // 宁德公路局
public static final Integer PINTAN_HIGHWAY_BUREAU = 40205; // 平潭公路局
public static final Integer PUTIAN_HIGHWAY_BUREAU = 40206; // 莆田公路局
public static final Integer QUANZHOU_HIGHWAY_BUREAU = 40207; // 泉州公路局
public static final Integer SANMING_HIGHWAY_BUREAU = 40208; // 三明公路局
public static final Integer XIAMEN_HIGHWAY_BUREAU = 40209; // 厦门公路局
public static final Integer ZHANGZHOU_HIGHWAY_BUREAU = 40210; // 漳州公路局
public static final Integer ZHANGZHOUKFQ_HIGHWAY_BUREAU = 40211; // 漳州开发区公路局
// 地市调查表
public static final Integer FUZHOU_SURVEY = 501; // todo-1 福州调查表
public static final Integer LONGYAN_SURVEY = 502; // todo-1 龙岩调查表
public static final Integer NANPING_SURVEY = 503; // todo-1 南平调查表
public static final Integer NINGDE_SURVEY = 504; // todo-1 宁德调查表
public static final Integer PINTAN_SURVEY = 505; // todo-1 平潭调查表
public static final Integer PUTIAN_SURVEY = 506; // todo-1 莆田调查表
public static final Integer QUANZHOU_SURVEY = 507; // todo-1 泉州调查表
public static final Integer SANMING_SURVEY = 508; // todo-1 三明调查表
public static final Integer XIAMEN_SURVEY = 509; // todo-1 厦门调查表
public static final Integer ZHANGZHOU_SURVEY = 510; // todo-1 漳州调查表
public static final Integer ZHANGZHOUKFQ_SURVEY = 511; // todo-1 漳州开发区调查表
public static final Integer FUZHOU_SURVEY = 501; // 福州调查表
public static final Integer LONGYAN_SURVEY = 502; // 龙岩调查表
public static final Integer NANPING_SURVEY = 503; // 南平调查表
public static final Integer NINGDE_SURVEY = 504; // 宁德调查表
public static final Integer PINTAN_SURVEY = 505; // 平潭调查表
public static final Integer PUTIAN_SURVEY = 506; // 莆田调查表
public static final Integer QUANZHOU_SURVEY = 507; // 泉州调查表
public static final Integer SANMING_SURVEY = 508; // 三明调查表
public static final Integer XIAMEN_SURVEY = 509; // 厦门调查表
public static final Integer ZHANGZHOU_SURVEY = 510; // 漳州调查表
public static final Integer ZHANGZHOUKFQ_SURVEY = 511; // 漳州开发区调查表
// 其他省份
public static final Integer OTHER_ZHEJIANG = 601; // 浙江
public static final Integer OTHER_GIANLZHOU = 602; // 广州
@@ -290,9 +290,6 @@ public class MaterialTaskType {
/**
* todo-1 数据展示模块 地市暂不切换
* todo-1 十一个地市接口
* todo-1 采集结果“产地”改成“品牌产商”
* todo-0 传采集数据网络价格计算
* todo-1 趋势图一年每月打点
* todo-1 项目材料价格预算“最高(低)总金额”携带上价格的月份
* todo-1 项目材料价格预算计算数值没有小数点

View File

@@ -56,7 +56,7 @@ public class AsphaltDomestic extends Model<AsphaltDomestic> {
public AsphaltDomestic () {}
public AsphaltDomestic (Row row) {
public AsphaltDomestic (Row row, MaterialTask data) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
this.setName(row.getCell(0, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(1, policy).getNumericCellValue()));

View File

@@ -52,7 +52,7 @@ public class AsphaltImported extends Model<AsphaltImported> {
public AsphaltImported () {}
public AsphaltImported (Row row) {
public AsphaltImported (Row row, MaterialTask data) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
this.setName(row.getCell(0, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(1, policy).getNumericCellValue()));

View File

@@ -56,7 +56,7 @@ public class AsphaltModifier extends Model<AsphaltModifier> {
public AsphaltModifier() {}
public AsphaltModifier (Row row) {
public AsphaltModifier (Row row, MaterialTask data) {
this.setName(row.getCell(0).getStringCellValue());
this.setSpec("");
this.setPrice(BigDecimal.valueOf(row.getCell(1).getNumericCellValue()));

View File

@@ -68,7 +68,7 @@ public class Cement extends Model<Cement> {
public Cement () {}
public Cement (Row row) {
public Cement (Row row, MaterialTask data) {
this.setName(row.getCell(0).getStringCellValue());
this.setSpec(row.getCell(1).getStringCellValue());
this.setPack(row.getCell(2).getStringCellValue());

View File

@@ -94,8 +94,14 @@ public class DataNetwork extends Model<DataNetwork> {
this.setPrice(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue()));
this.setSource(row.getCell(6, policy).getStringCellValue());
this.setRemark(row.getCell(7, policy).getStringCellValue());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 日期从任务获取
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
this.setRegion(MaterialTaskType.getRegion(task.getType()));
if (this.getName().isEmpty()) {
throw new IllegalArgumentException("名称为空");
}
if (ObjectUtil.isEmpty(this.getPrice())) {
throw new IllegalArgumentException("缺少价格");
}
}
public DataNetwork update(DataNetwork item) {

View File

@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import mjkf.xinke.main.constant.MaterialTaskType;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
@@ -67,6 +68,10 @@ public class FujianSurvey extends Model<FujianSurvey> {
@TableField("`TAX`")
private Integer tax;
@ApiModelProperty("地区")
@TableField("`REGION`")
private String region;
@Override
public Serializable pkVal() {
return this.id;
@@ -74,17 +79,18 @@ public class FujianSurvey extends Model<FujianSurvey> {
public FujianSurvey () {}
public FujianSurvey (Row row) {
public FujianSurvey (Row row, MaterialTask task) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
row.getCell(0).setCellType(CellType.STRING);
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.setName(row.getCell(1, policy).getStringCellValue().replace(" ", ""));
this.setSpec(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
this.setUnit(row.getCell(3, policy).getStringCellValue());
this.setBrand(row.getCell(4, policy).getStringCellValue());
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());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
this.setRegion(MaterialTaskType.getRegion(task.getType()));
if (this.getName().isEmpty()) {
throw new IllegalArgumentException("名称为空");
}

View File

@@ -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;
@@ -12,6 +13,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import mjkf.xinke.main.constant.MaterialTaskType;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
@@ -62,6 +64,10 @@ public class FuzhouHighwayBureau extends Model<FuzhouHighwayBureau> {
@TableField("`BRAND`")
private String brand;
@ApiModelProperty("地区")
@TableField("`REGION`")
private String region;
@Override
public Serializable pkVal() {
return this.id;
@@ -69,20 +75,21 @@ public class FuzhouHighwayBureau extends Model<FuzhouHighwayBureau> {
public FuzhouHighwayBureau () {}
public FuzhouHighwayBureau (Row row) {
public FuzhouHighwayBureau (Row row, MaterialTask task) {
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.setName(row.getCell(1, policy).getStringCellValue().replace(" ", ""));
this.setSpec(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
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());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
this.setRegion(MaterialTaskType.getRegion(task.getType()));
if (this.getName().isEmpty()) {
throw new IllegalArgumentException("名称为空");
}
if (((Integer) this.getPrice().intValue()).equals(0)) {
if (ObjectUtil.isEmpty(this.getPrice())) {
throw new IllegalArgumentException("缺少价格");
}
}

View File

@@ -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;
@@ -12,6 +13,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import mjkf.xinke.main.constant.MaterialTaskType;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
@@ -62,6 +64,10 @@ public class FuzhouTransportationBureau extends Model<FuzhouTransportationBureau
@TableField("`BRAND`")
private String brand;
@ApiModelProperty("地区")
@TableField("`REGION`")
private String region;
@Override
public Serializable pkVal() {
return this.id;
@@ -69,20 +75,21 @@ public class FuzhouTransportationBureau extends Model<FuzhouTransportationBureau
public FuzhouTransportationBureau () {}
public FuzhouTransportationBureau (Row row) {
public FuzhouTransportationBureau (Row row, MaterialTask task) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
row.getCell(0).setCellType(CellType.STRING);
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.setName(row.getCell(1, policy).getStringCellValue().replace(" ", ""));
this.setSpec(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
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());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
this.setRegion(MaterialTaskType.getRegion(task.getType()));
if (this.getName().isEmpty()) {
throw new IllegalArgumentException("名称为空");
}
if (((Integer) this.getPrice().intValue()).equals(0)) {
if (ObjectUtil.isEmpty(this.getPrice())) {
throw new IllegalArgumentException("缺少价格");
}
}

View File

@@ -91,7 +91,7 @@ public class LocalMaterial extends Model<LocalMaterial> {
public LocalMaterial() {}
public LocalMaterial (Row row) {
public LocalMaterial (Row row, MaterialTask data) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
this.setDate(row.getCell(0, policy).getLocalDateTimeCellValue().toLocalDate());
this.setCity(row.getCell(1, policy).getStringCellValue());

View File

@@ -65,7 +65,7 @@ public class SanmingSteel extends Model<SanmingSteel> {
public SanmingSteel () {}
public SanmingSteel (Row row) {
public SanmingSteel (Row row, MaterialTask data) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
row.getCell(1).setCellType(CellType.STRING);
this.setName(row.getCell(0, policy).getStringCellValue());

View File

@@ -44,7 +44,7 @@ public class SteelEntity<T extends Model<?>> extends Model<T> {
public SteelEntity() {}
public SteelEntity(Row row) {
public SteelEntity(Row row, MaterialTask data) {
this.fromRow(row);
}
}

View File

@@ -68,7 +68,7 @@ public class SteelPlate extends SteelEntity<SteelPlate> {
public SteelPlate() {}
public SteelPlate(Row row) {
public SteelPlate(Row row, MaterialTask data) {
this.fromRow(row);
}

View File

@@ -65,7 +65,7 @@ public class SteelRebar extends SteelEntity<SteelRebar> {
public SteelRebar() {}
public SteelRebar(Row row) {
public SteelRebar(Row row, MaterialTask data) {
this.fromRow(row);
}

View File

@@ -67,7 +67,7 @@ public class SteelSection extends SteelEntity<SteelSection>{
public SteelSection() {}
public SteelSection(Row row) {
public SteelSection(Row row, MaterialTask data) {
this.fromRow(row);
}

View File

@@ -68,7 +68,7 @@ public class SteelStrand extends SteelEntity<SteelStrand> {
public SteelStrand() {}
public SteelStrand(Row row) {
public SteelStrand(Row row, MaterialTask data) {
this.fromRow(row);
}

View File

@@ -1,6 +1,8 @@
package mjkf.xinke.main.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import mjkf.xinke.main.constant.MaterialTaskType;
import mjkf.xinke.main.model.db.DataNetwork;
import mjkf.xinke.main.model.db.FujianSurvey;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Service;
@@ -15,6 +17,7 @@ public class FujianSurveyService extends DataService<BaseMapper<FujianSurvey>, F
query.eq(FujianSurvey::getName, data.getName());
query.eq(FujianSurvey::getSpec, data.getSpec());
query.eq(FujianSurvey::getDate, data.getDate());
query.eq(FujianSurvey::getRegion, data.getRegion());
return query;
}
@@ -50,8 +53,10 @@ public class FujianSurveyService extends DataService<BaseMapper<FujianSurvey>, F
query.like(FujianSurvey::getName, name);
}
if (materialId != null) {
// todo
// query.eq(SteelSection::getMaterialId, materialId);
query.eq(FujianSurvey::getMaterialId, materialId);
}
if (type != null) {
query.eq(FujianSurvey::getRegion, MaterialTaskType.getRegion(type));
}
return query;
}

View File

@@ -1,6 +1,8 @@
package mjkf.xinke.main.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import mjkf.xinke.main.constant.MaterialTaskType;
import mjkf.xinke.main.model.db.FujianSurvey;
import mjkf.xinke.main.model.db.FuzhouHighwayBureau;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Service;
@@ -16,6 +18,7 @@ public class FuzhouHighwayBureauService extends DataService<BaseMapper<FuzhouHig
query.eq(FuzhouHighwayBureau::getName, data.getName());
query.eq(FuzhouHighwayBureau::getSpec, data.getSpec());
query.eq(FuzhouHighwayBureau::getDate, data.getDate());
query.eq(FuzhouHighwayBureau::getRegion, data.getRegion());
return query;
}
@@ -51,8 +54,10 @@ public class FuzhouHighwayBureauService extends DataService<BaseMapper<FuzhouHig
query.like(FuzhouHighwayBureau::getName, name);
}
if (materialId != null) {
// todo
// query.eq(SteelSection::getMaterialId, materialId);
query.eq(FuzhouHighwayBureau::getMaterialId, materialId);
}
if (type != null) {
query.eq(FuzhouHighwayBureau::getRegion, MaterialTaskType.getRegion(type));
}
return query;
}

View File

@@ -1,6 +1,8 @@
package mjkf.xinke.main.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import mjkf.xinke.main.constant.MaterialTaskType;
import mjkf.xinke.main.model.db.FuzhouHighwayBureau;
import mjkf.xinke.main.model.db.FuzhouTransportationBureau;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Service;
@@ -17,6 +19,7 @@ public class FuzhouTransportationBureauService extends DataService<BaseMapper<Fu
query.eq(FuzhouTransportationBureau::getName, data.getName());
query.eq(FuzhouTransportationBureau::getSpec, data.getSpec());
query.eq(FuzhouTransportationBureau::getDate, data.getDate());
query.eq(FuzhouTransportationBureau::getRegion, data.getRegion());
return query;
}
@@ -52,8 +55,10 @@ public class FuzhouTransportationBureauService extends DataService<BaseMapper<Fu
query.like(FuzhouTransportationBureau::getName, name);
}
if (materialId != null) {
// todo
// query.eq(SteelSection::getMaterialId, materialId);
query.eq(FuzhouTransportationBureau::getMaterialId, materialId);
}
if (type != null) {
query.eq(FuzhouTransportationBureau::getRegion, MaterialTaskType.getRegion(type));
}
return query;
}

View File

@@ -13,20 +13,6 @@ import java.util.Map;
@Service
public class MaterialResultService {
@Resource
SteelRebarService steelRebarService;
@Resource
SteelSectionService steelSectionService;
@Resource
SteelStrandService steelStrandService;
@Resource
SteelPlateService steelPlateService;
@Resource
AsphaltDomesticService asphaltDomesticService;
@Resource
AsphaltImportedService asphaltImportedService;
@Resource
CementService cementService;
@Resource
SanmingSteelService sanmingSteelService;
@Resource
@@ -36,8 +22,6 @@ public class MaterialResultService {
@Resource
FujianSurveyService fujianSurveyService;
@Resource
OilService oilService;
@Resource
LocalMaterialService localMaterialService;
@Resource
DataZhejiangService dataZhejiangService;
@@ -138,28 +122,8 @@ public class MaterialResultService {
*/
public IService getService(Integer type) {
IService service = null;
if (type.equals(MaterialTaskType.MY_STEEL_REBAR)) {
service = steelRebarService;
} else if (type.equals(MaterialTaskType.MY_STEEL_SECTION)) {
service = steelSectionService;
} else if (type.equals(MaterialTaskType.MY_STEEL_STRAND)) {
service = steelStrandService;
} else if (type.equals(MaterialTaskType.MY_STEEL_PLATE)) {
service = steelPlateService;
} else if (type.equals(MaterialTaskType.BAIINFO_ASPHALT_DOMESTIC)) {
service = asphaltDomesticService;
} else if (type.equals(MaterialTaskType.BAIINFO_ASPHALT_IMPORTED)) {
service = asphaltImportedService;
} else if (type.equals(MaterialTaskType.BAIINFO_CEMENT)) {
service = cementService;
} else if (type.equals(MaterialTaskType.SANMING_STEEL)) {
if (type.equals(MaterialTaskType.SANMING_STEEL)) {
service = sanmingSteelService;
} else if (type.equals(MaterialTaskType.FUZHOU_TRANSPORTATION_BUREAU)) {
service = fuzhouTransportationBureauService;
} else if (type.equals(MaterialTaskType.FUZHOU_HIGHWAY_BUREAU)) {
service = fuzhouHighwayBureauService;
} else if (type.equals(MaterialTaskType.FUZHOU_SURVEY)) {
service = fujianSurveyService;
} else if (type.equals(MaterialTaskType.OTHER_ZHEJIANG)) {
service = dataZhejiangService;
} else if (type.equals(MaterialTaskType.OTHER_GIANLZHOU)) {
@@ -168,12 +132,16 @@ public class MaterialResultService {
// service = dataYunnanService;
} else if (type.equals(MaterialTaskType.FUJIAN_DEPARTMENT)) {
service = dataFujianService;
} else if (type.equals(MaterialTaskType.OIL)) {
service = oilService;
} else if (MaterialTaskType.isLocalMaterial(type)) {
service = localMaterialService;
} else if (MaterialTaskType.isNetworkPrice(type)) {
service = dataNetworkService;
} else if (MaterialTaskType.isHighwayBureau(type)) {
service = fuzhouHighwayBureauService;
} else if (MaterialTaskType.isSurvey(type)) {
service = fujianSurveyService;
} else if (MaterialTaskType.isTransportationBureau(type)) {
service = fuzhouTransportationBureauService;
} else {
System.out.println("MaterialResultService.getService | 未找到对应的数据处理 Service | type: " + type);
}

View File

@@ -27,20 +27,6 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
@Resource
DevFileService devFileService;
@Resource
SteelRebarService steelRebarService;
@Resource
SteelSectionService steelSectionService;
@Resource
SteelStrandService steelStrandService;
@Resource
SteelPlateService steelPlateService;
@Resource
AsphaltDomesticService asphaltDomesticService;
@Resource
AsphaltImportedService asphaltImportedService;
@Resource
CementService cementService;
@Resource
SanmingSteelService sanmingSteelService;
@Resource
FuzhouTransportationBureauService fuzhouTransportationBureauService;
@@ -89,34 +75,20 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
List<Row> rows = this.getTableRows(file);
// 导入
List list;
if (data.getType().equals(MaterialTaskType.MY_STEEL_REBAR)) {
list = steelRebarService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_SECTION)) {
list = steelSectionService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_STRAND)) {
list = steelStrandService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_PLATE)) {
list = steelPlateService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.BAIINFO_ASPHALT_DOMESTIC)) {
list = asphaltDomesticService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.BAIINFO_ASPHALT_IMPORTED)) {
list = asphaltImportedService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.BAIINFO_CEMENT)) {
list = cementService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.SANMING_STEEL)) {
if (data.getType().equals(MaterialTaskType.SANMING_STEEL)) {
list = sanmingSteelService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.FUZHOU_TRANSPORTATION_BUREAU)) {
list = fuzhouTransportationBureauService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.FUZHOU_HIGHWAY_BUREAU)) {
list = fuzhouHighwayBureauService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.FUZHOU_SURVEY)) {
list = fujianSurveyService.saveOrUpdateByIndexBatch(rows, data);
} else if (MaterialTaskType.isLocalMaterial(data.getType())) {
}else if (MaterialTaskType.isLocalMaterial(data.getType())) {
list = localMaterialService.saveOrUpdateByIndexBatch(rows, data);
} else if (data.getType().equals(MaterialTaskType.ASPHALT_MODIFIER)) {
list = asphaltModifierService.saveOrUpdateByIndexBatch(rows, data);
} else if (MaterialTaskType.isNetworkPrice(data.getType())) {
list = dataNetworkService.saveOrUpdateByIndexBatch(rows, data);
} else if (MaterialTaskType.isSurvey(data.getType())) {
list = fujianSurveyService.saveOrUpdateByIndexBatch(rows, data);
} else if (MaterialTaskType.isTransportationBureau(data.getType())) {
list = fuzhouTransportationBureauService.saveOrUpdateByIndexBatch(rows, data);
} else if (MaterialTaskType.isHighwayBureau(data.getType())) {
list = fuzhouHighwayBureauService.saveOrUpdateByIndexBatch(rows, data);
} else {
System.out.println("MaterialTaskService.importData | 未识别的任务类型");
// todo-3 异常处理:未识别的类型

View File

@@ -16,3 +16,14 @@ create table DATA_NETWORK (
) comment '网络价格';
ALTER TABLE DATA_NETWORK ADD REGION varchar(64) NULL COMMENT '地区';
ALTER TABLE FUJIAN_SURVEY ADD REGION varchar(64) NULL COMMENT '地区';
ALTER TABLE FUZHOU_HIGHWAY_BUREAU ADD REGION varchar(64) NULL COMMENT '地区';
ALTER TABLE FUZHOU_TRANSPORTATION_BUREAU ADD REGION varchar(64) NULL COMMENT '地区';
DROP INDEX Idx_key ON FUJIAN_SURVEY;
CREATE UNIQUE INDEX Idx_key ON FUJIAN_SURVEY (NAME, SPEC, DATE, REGION);
DROP INDEX Idx_key ON FUZHOU_HIGHWAY_BUREAU;
CREATE UNIQUE INDEX Idx_key ON FUZHOU_HIGHWAY_BUREAU (NAME, SPEC, DATE, REGION);
DROP INDEX Idx_key ON FUZHOU_TRANSPORTATION_BUREAU;
CREATE UNIQUE INDEX Idx_key ON FUZHOU_TRANSPORTATION_BUREAU (NAME, SPEC, DATE, REGION);

View File

@@ -1,6 +1,5 @@
package mjkf.xinke;
import cn.hutool.core.util.ZipUtil;
import mjkf.xinke.dev.modular.file.enums.DevFileEngineTypeEnum;
import mjkf.xinke.dev.modular.file.service.DevFileService;
import org.junit.Test;
@@ -14,7 +13,6 @@ import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.MessageFormat;
@SpringBootTest(classes = Application.class)
@RunWith(SpringJUnit4ClassRunner.class)
@@ -24,13 +22,20 @@ public class UploadFileTest {
@Test
public void test() throws Exception {
var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\主材\\网络价格.xlsx";
var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\主材\\交通局.xlsx";
var file = new File(filePath);
var multipartFile = this.mockMultipartFile(file, "网络价格.xlsx", "application/x-zip-compressed");
var fileId = devFileService.uploadReturnId(DevFileEngineTypeEnum.LOCAL.getValue(), multipartFile);
System.out.println("UploadFileTest.test | fileId " + fileId);
}
/**
* 1810213380969066497 网络价格.xlsx 1201
* 1810481654990442497 调查表.xlsx 501
* 1810481965629005826 公路局.xlsx 40201
* 1810482216079302658 交通局.xlsx 40101
*/
private MultipartFile mockMultipartFile(File file, String fileName, String contentType) {
try {
// 使用文件内容和文件名创建MockMultipartFile