fix: 修复三明钢铁数据无法正常上传的问题

This commit is contained in:
han0
2025-02-13 09:47:47 +08:00
parent ea6a973b09
commit 0c870c22e4
4 changed files with 11 additions and 5 deletions

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;
@@ -70,13 +71,17 @@ public class SanmingSteel extends Model<SanmingSteel> {
row.getCell(0).setCellType(CellType.STRING); row.getCell(0).setCellType(CellType.STRING);
row.getCell(1).setCellType(CellType.STRING); row.getCell(1).setCellType(CellType.STRING);
row.getCell(2).setCellType(CellType.STRING); row.getCell(2).setCellType(CellType.STRING);
row.getCell(3).setCellType(CellType.NUMERIC);
this.setName(row.getCell(1, policy).getStringCellValue()); this.setName(row.getCell(1, policy).getStringCellValue());
this.setSpec(row.getCell(2, policy).getStringCellValue()); this.setSpec(row.getCell(2, policy).getStringCellValue());
this.setMaterial(row.getCell(0, policy).getStringCellValue()); this.setMaterial(row.getCell(0, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(3, policy).getNumericCellValue())); this.setPrice(BigDecimal.valueOf(row.getCell(3, policy).getNumericCellValue()));
this.setFluctuating(BigDecimal.valueOf(row.getCell(4, policy).getNumericCellValue())); //this.setFluctuating(BigDecimal.valueOf(row.getCell(4, policy).getNumericCellValue()));
// this.setDate(row.getCell(5, policy).getLocalDateTimeCellValue().toLocalDate()); // this.setDate(row.getCell(5, policy).getLocalDateTimeCellValue().toLocalDate());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期 this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
if (ObjectUtil.isEmpty(this.getMaterial())) {
throw new IllegalArgumentException("材料编码为空");
}
} }
public SanmingSteel update(SanmingSteel item) { public SanmingSteel update(SanmingSteel item) {

View File

@@ -12,8 +12,6 @@ import java.util.Map;
public class SanmingSteelService extends DataService<BaseMapper<SanmingSteel>, SanmingSteel> { public class SanmingSteelService extends DataService<BaseMapper<SanmingSteel>, SanmingSteel> {
public LambdaQueryWrapper<SanmingSteel> indexQuery(SanmingSteel data) { public LambdaQueryWrapper<SanmingSteel> indexQuery(SanmingSteel data) {
LambdaQueryWrapper<SanmingSteel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SanmingSteel> query = new LambdaQueryWrapper<>();
query.eq(SanmingSteel::getName, data.getName());
query.eq(SanmingSteel::getSpec, data.getSpec());
query.eq(SanmingSteel::getMaterial, data.getMaterial()); query.eq(SanmingSteel::getMaterial, data.getMaterial());
query.eq(SanmingSteel::getDate, data.getDate()); query.eq(SanmingSteel::getDate, data.getDate());
return query; return query;

View File

@@ -1,2 +1,4 @@
ALTER TABLE PRICE_RESULT ADD DISPLAY_DIGIT int default 1 comment '显示小数位数'; ALTER TABLE PRICE_RESULT ADD DISPLAY_DIGIT int default 1 comment '显示小数位数';
ALTER TABLE PRICE_PUBLISH ADD DISPLAY_DIGIT int default 1 comment '显示小数位数'; ALTER TABLE PRICE_PUBLISH ADD DISPLAY_DIGIT int default 1 comment '显示小数位数';
DROP INDEX Idx_key ON sanming_steel;

View File

@@ -27,8 +27,8 @@ public class UploadFileTest {
@Test @Test
public void test() throws Exception { 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 filePath = "C:\\Users\\Administrator\\Documents\\对比材料精简9月.xlsx";
// var filePath = "C:\\Users\\Administrator\\Documents\\三明钢铁.xlsx"; var filePath = "D:\\defaultUploadFolder\\defaultBucketName\\2025\\2\\12\\1889631594115809281.xls";
var file = new File(filePath); 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 multipartFile = this.mockMultipartFile(file); var multipartFile = this.mockMultipartFile(file);
@@ -45,6 +45,7 @@ public class UploadFileTest {
* 1810506191866003457 地材-202405.xlsx 1101 * 1810506191866003457 地材-202405.xlsx 1101
* 1871732061747179521 相邻城市.xlsx 600 * 1871732061747179521 相邻城市.xlsx 600
* 1866412571689631746 三明钢铁.xlsx 301 * 1866412571689631746 三明钢铁.xlsx 301
* 1889850932131737602 三明钢铁.xlsx 301
*/ */
private MultipartFile mockMultipartFile(File file) throws IOException { private MultipartFile mockMultipartFile(File file) throws IOException {