feat: 新增接壤城市数据上传
This commit is contained in:
@@ -54,6 +54,7 @@ public class MaterialTaskType {
|
||||
public static final Integer ZHANGZHOU_SURVEY = 510; // 漳州调查表
|
||||
public static final Integer ZHANGZHOUKFQ_SURVEY = 511; // 漳州开发区调查表
|
||||
// 其他省份
|
||||
public static final Integer OTHER = 600;
|
||||
public static final Integer OTHER_ZHEJIANG = 601; // 浙江
|
||||
public static final Integer OTHER_GIANLZHOU = 602; // 广州
|
||||
public static final Integer OTHER_YUNNAN = 603; // 云南
|
||||
@@ -146,6 +147,7 @@ public class MaterialTaskType {
|
||||
ZHANGZHOU_SURVEY,
|
||||
ZHANGZHOUKFQ_SURVEY,
|
||||
|
||||
OTHER,
|
||||
OTHER_ZHEJIANG,
|
||||
OTHER_GIANLZHOU,
|
||||
OTHER_YUNNAN,
|
||||
|
16
src/main/java/mjkf/xinke/main/dao/DataAdjacentMapper.java
Normal file
16
src/main/java/mjkf/xinke/main/dao/DataAdjacentMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package mjkf.xinke.main.dao;
|
||||
|
||||
import mjkf.xinke.main.model.db.DataAdjacent;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 相邻城市价格 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2024-09-25
|
||||
*/
|
||||
public interface DataAdjacentMapper extends BaseMapper<DataAdjacent> {
|
||||
|
||||
}
|
177
src/main/java/mjkf/xinke/main/model/db/DataAdjacent.java
Normal file
177
src/main/java/mjkf/xinke/main/model/db/DataAdjacent.java
Normal file
@@ -0,0 +1,177 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 相邻城市价格
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2024-09-25
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("DATA_ADJACENT")
|
||||
@ApiModel(value = "DataAdjacent对象", description = "相邻城市价格")
|
||||
public class DataAdjacent extends Model<DataAdjacent> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("材料id")
|
||||
@TableField("MATERIAL_ID")
|
||||
private String materialId;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("广州价格")
|
||||
@TableField("PRICE_GUANGZHOU")
|
||||
private BigDecimal priceGuangzhou;
|
||||
|
||||
@ApiModelProperty("梅州价格")
|
||||
@TableField("PRICE_MEIZHOU")
|
||||
private BigDecimal priceMeizhou;
|
||||
|
||||
@ApiModelProperty("潮州价格")
|
||||
@TableField("PRICE_CHAOZHOU")
|
||||
private BigDecimal priceChaozhou;
|
||||
|
||||
@ApiModelProperty("南昌价格")
|
||||
@TableField("PRICE_NANCHANG")
|
||||
private BigDecimal priceNanchang;
|
||||
|
||||
@ApiModelProperty("抚州价格")
|
||||
@TableField("PRICE_FUZHOU")
|
||||
private BigDecimal priceFuzhou;
|
||||
|
||||
@ApiModelProperty("赣州价格")
|
||||
@TableField("PRICE_GANZHOU")
|
||||
private BigDecimal priceGanzhou;
|
||||
|
||||
@ApiModelProperty("上饶价格")
|
||||
@TableField("PRICE_SHANGRAO")
|
||||
private BigDecimal priceShangrao;
|
||||
|
||||
@ApiModelProperty("鹰潭价格")
|
||||
@TableField("PRICE_YINGTAN")
|
||||
private BigDecimal priceYingtan;
|
||||
|
||||
@ApiModelProperty("杭州价格")
|
||||
@TableField("PRICE_HANGZHOU")
|
||||
private BigDecimal priceHangzhou;
|
||||
|
||||
@ApiModelProperty("丽水价格")
|
||||
@TableField("PRICE_LISHUI")
|
||||
private BigDecimal priceLishui;
|
||||
|
||||
@ApiModelProperty("衢州价格")
|
||||
@TableField("PRICE_QUZHOU")
|
||||
private BigDecimal priceQuzhou;
|
||||
|
||||
@ApiModelProperty("温州价格")
|
||||
@TableField("PRICE_WENZHOU")
|
||||
private BigDecimal priceWenzhou;
|
||||
|
||||
@ApiModelProperty("昆明价格")
|
||||
@TableField("PRICE_KUNMING")
|
||||
private BigDecimal priceKunming;
|
||||
|
||||
@ApiModelProperty("统计年份")
|
||||
@TableField("`YEAR`")
|
||||
private Integer year;
|
||||
|
||||
@ApiModelProperty("统计月份")
|
||||
@TableField("`MONTH`")
|
||||
private Integer month;
|
||||
|
||||
@ApiModelProperty("扩展信息")
|
||||
@TableField("EXT_JSON")
|
||||
private String extJson;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
@TableField("TENANT_ID")
|
||||
private String tenantId;
|
||||
|
||||
@ApiModelProperty("删除标志")
|
||||
@TableField("DELETE_FLAG")
|
||||
private String deleteFlag;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField("CREATE_TIME")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("创建用户")
|
||||
@TableField("CREATE_USER")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
@TableField("UPDATE_TIME")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("更新人")
|
||||
@TableField("UPDATE_USER")
|
||||
private String updateUser;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public DataAdjacent () {}
|
||||
|
||||
public DataAdjacent (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().replace(" ", ""));
|
||||
this.setSpec(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
|
||||
this.setYear(task.getYear());
|
||||
this.setMonth(task.getMonth());
|
||||
|
||||
this.setPriceGuangzhou(BigDecimal.valueOf(row.getCell(3, policy).getNumericCellValue()));
|
||||
this.setPriceMeizhou(BigDecimal.valueOf(row.getCell(4, policy).getNumericCellValue()));
|
||||
this.setPriceChaozhou(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue()));
|
||||
this.setPriceNanchang(BigDecimal.valueOf(row.getCell(6, policy).getNumericCellValue()));
|
||||
this.setPriceFuzhou(BigDecimal.valueOf(row.getCell(7, policy).getNumericCellValue()));
|
||||
this.setPriceGanzhou(BigDecimal.valueOf(row.getCell(8, policy).getNumericCellValue()));
|
||||
this.setPriceShangrao(BigDecimal.valueOf(row.getCell(9, policy).getNumericCellValue()));
|
||||
this.setPriceYingtan(BigDecimal.valueOf(row.getCell(10, policy).getNumericCellValue()));
|
||||
this.setPriceHangzhou(BigDecimal.valueOf(row.getCell(11, policy).getNumericCellValue()));
|
||||
this.setPriceLishui(BigDecimal.valueOf(row.getCell(12, policy).getNumericCellValue()));
|
||||
this.setPriceQuzhou(BigDecimal.valueOf(row.getCell(13, policy).getNumericCellValue()));
|
||||
this.setPriceWenzhou(BigDecimal.valueOf(row.getCell(14, policy).getNumericCellValue()));
|
||||
this.setPriceKunming(BigDecimal.valueOf(row.getCell(15, policy).getNumericCellValue()));
|
||||
|
||||
if (this.getMaterialId().isEmpty()) {
|
||||
throw new IllegalArgumentException("材料编码为空");
|
||||
}
|
||||
}
|
||||
|
||||
public DataAdjacent update(DataAdjacent item) {
|
||||
BeanUtil.copyProperties(item, this);
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.DataAdjacent;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class DataAdjacentService extends DataService<BaseMapper<DataAdjacent>, DataAdjacent> {
|
||||
|
||||
public LambdaQueryWrapper<DataAdjacent> indexQuery(DataAdjacent data) {
|
||||
LambdaQueryWrapper<DataAdjacent> query = new LambdaQueryWrapper<>();
|
||||
query.eq(DataAdjacent::getMaterialId, data.getMaterialId());
|
||||
query.eq(DataAdjacent::getYear, data.getYear());
|
||||
query.eq(DataAdjacent::getMonth, data.getMonth());
|
||||
return query;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<DataAdjacent> filterQuery(LambdaQueryWrapper<DataAdjacent> query) {
|
||||
return query;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<DataAdjacent> getQuery(String keyWord, Integer year, Integer month, String materialId, String name, Integer type) {
|
||||
LambdaQueryWrapper<DataAdjacent> query = new LambdaQueryWrapper<>();
|
||||
if (keyWord != null) {
|
||||
query.and(e -> e.like(DataAdjacent::getName, keyWord));
|
||||
}
|
||||
if (month != null) {
|
||||
query.eq(DataAdjacent::getMonth, month);
|
||||
}
|
||||
if (year != null) {
|
||||
query.eq(DataAdjacent::getYear, year);
|
||||
}
|
||||
if (name != null) {
|
||||
query.like(DataAdjacent::getName, name);
|
||||
}
|
||||
if (materialId != null) {
|
||||
query.eq(DataAdjacent::getMaterialId, materialId);
|
||||
}
|
||||
if (type != null) {
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
public DataAdjacent getMapGroupingBy(Map item) {
|
||||
var o = new DataAdjacent();
|
||||
o.setMaterialId(item.get("material_id").toString());
|
||||
return o;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<DataAdjacent> trendQuery(Object obj, Integer year, Integer month) {
|
||||
var data = (DataAdjacent) obj;
|
||||
LambdaQueryWrapper<DataAdjacent> query = new LambdaQueryWrapper<>();
|
||||
query.eq(DataAdjacent::getMaterialId, data.getMaterialId());
|
||||
query.eq(DataAdjacent::getYear, year);
|
||||
query.eq(DataAdjacent::getMonth, month);
|
||||
query.orderByAsc(DataAdjacent::getYear, DataAdjacent::getMonth);
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,8 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
|
||||
AsphaltModifierService asphaltModifierService;
|
||||
@Resource
|
||||
DataNetworkService dataNetworkService;
|
||||
@Resource
|
||||
DataAdjacentService dataAdjacentService;
|
||||
|
||||
@Override
|
||||
public boolean save(MaterialTask data) {
|
||||
@@ -77,7 +79,7 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
|
||||
List list;
|
||||
if (data.getType().equals(MaterialTaskType.SANMING_STEEL)) {
|
||||
list = sanmingSteelService.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);
|
||||
@@ -89,6 +91,8 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
|
||||
list = fuzhouTransportationBureauService.saveOrUpdateByIndexBatch(rows, data);
|
||||
} else if (MaterialTaskType.isHighwayBureau(data.getType())) {
|
||||
list = fuzhouHighwayBureauService.saveOrUpdateByIndexBatch(rows, data);
|
||||
} else if (data.getType().equals(MaterialTaskType.OTHER)) {
|
||||
list = dataAdjacentService.saveOrUpdateByIndexBatch(rows, data);
|
||||
} else {
|
||||
System.out.println("MaterialTaskService.importData | 未识别的任务类型");
|
||||
return false;
|
||||
|
@@ -17,3 +17,58 @@ ALTER TABLE PRICE_RESULT ADD WEIGHT_SS decimal(16,4) default 1 comment '三明
|
||||
ALTER TABLE PRICE_RESULT ADD WEIGHT_FHB decimal(16,4) default 1 comment '福州公路局权重';
|
||||
ALTER TABLE PRICE_RESULT ADD WEIGHT_NETWORK decimal(16,4) default 1 comment '网络权重';
|
||||
ALTER TABLE PRICE_RESULT ADD WEIGHT_SURVEY decimal(16,4) default 1 comment '调查权重';
|
||||
|
||||
create table DATA_ADJACENT (
|
||||
ID int auto_increment primary key,
|
||||
MATERIAL_ID varchar(128) null comment '材料id',
|
||||
SPEC varchar(128) null comment '规格',
|
||||
NAME varchar(128) null comment '名称',
|
||||
PRICE_GUANGZHOU decimal(16, 4) null comment '广州价格',
|
||||
PRICE_MEIZHOU decimal(16, 4) null comment '梅州价格',
|
||||
PRICE_CHAOZHOU decimal(16, 4) null comment '潮州价格',
|
||||
PRICE_NANCHANG decimal(16, 4) null comment '南昌价格',
|
||||
PRICE_FUZHOU decimal(16, 4) null comment '抚州价格',
|
||||
PRICE_GANZHOU decimal(16, 4) null comment '赣州价格',
|
||||
PRICE_SHANGRAO decimal(16, 4) null comment '上饶价格',
|
||||
PRICE_YINGTAN decimal(16, 4) null comment '鹰潭价格',
|
||||
PRICE_HANGZHOU decimal(16, 4) null comment '杭州价格',
|
||||
PRICE_LISHUI decimal(16, 4) null comment '丽水价格',
|
||||
PRICE_QUZHOU decimal(16, 4) null comment '衢州价格',
|
||||
PRICE_WENZHOU decimal(16, 4) null comment '温州价格',
|
||||
PRICE_KUNMING decimal(16, 4) null comment '昆明价格',
|
||||
YEAR int null comment '统计年份',
|
||||
MONTH int null comment '统计月份',
|
||||
EXT_JSON longtext null comment '扩展信息',
|
||||
TENANT_ID varchar(20) null comment '租户id',
|
||||
DELETE_FLAG varchar(255) null comment '删除标志',
|
||||
CREATE_TIME datetime null comment '创建时间',
|
||||
CREATE_USER varchar(20) null comment '创建用户',
|
||||
UPDATE_TIME datetime null comment '更新时间',
|
||||
UPDATE_USER varchar(20) null comment '更新人'
|
||||
) comment '相邻城市价格';
|
||||
|
||||
|
||||
|
||||
Guangzhou
|
||||
Meizhou
|
||||
Chaozhou
|
||||
Nanchang
|
||||
Fuzhou
|
||||
Ganzhou
|
||||
Shangrao
|
||||
Yingtan
|
||||
Hangzhou
|
||||
Lishui
|
||||
Quzhou
|
||||
Wenzhou
|
||||
Kunming
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -22,9 +22,10 @@ public class UploadFileTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\历史数据\\地材-202405.xlsx";
|
||||
// var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\历史数据\\地材-202405.xlsx";
|
||||
var filePath = "C:\\Users\\Administrator\\Documents\\工作表 在 9月完成功能.xlsx";
|
||||
var file = new File(filePath);
|
||||
var multipartFile = this.mockMultipartFile(file, "网络价格.xlsx", "application/x-zip-compressed");
|
||||
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);
|
||||
}
|
||||
@@ -36,6 +37,7 @@ public class UploadFileTest {
|
||||
* 1810482216079302658 交通局.xlsx 40101
|
||||
* 1810497092512178177 地材.xlsx 1101
|
||||
* 1810506191866003457 地材-202405.xlsx 1101
|
||||
* 1838851336371163138 相邻城市.xlsx 600
|
||||
*/
|
||||
|
||||
private MultipartFile mockMultipartFile(File file, String fileName, String contentType) {
|
||||
|
Reference in New Issue
Block a user