fix: 修复导入机型技术参数时,如果参数值为数字时报错的问题
This commit is contained in:
parent
d96de4b914
commit
8689bc6ef1
|
|
@ -624,6 +624,7 @@ public class ProductModelController extends ControllerBase{
|
||||||
VUtils.trueThrowBusinessError(!StrUtil.equals(model.getNo(),no)).throwMessage("产品型号不一致");
|
VUtils.trueThrowBusinessError(!StrUtil.equals(model.getNo(),no)).throwMessage("产品型号不一致");
|
||||||
List<ProductModelParamsExcelDTO> datas = new ArrayList<>();
|
List<ProductModelParamsExcelDTO> datas = new ArrayList<>();
|
||||||
String indexName = null;
|
String indexName = null;
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
for (int index = 3, count = sheet.getLastRowNum(); index <= count; index++) {
|
for (int index = 3, count = sheet.getLastRowNum(); index <= count; index++) {
|
||||||
// log.info("处理第{}行", index);
|
// log.info("处理第{}行", index);
|
||||||
Row row = sheet.getRow(index);
|
Row row = sheet.getRow(index);
|
||||||
|
|
@ -642,7 +643,7 @@ public class ProductModelController extends ControllerBase{
|
||||||
Cell cell1=row.getCell(1);
|
Cell cell1=row.getCell(1);
|
||||||
dto.setName(StrUtil.trim(cell1.getStringCellValue()));
|
dto.setName(StrUtil.trim(cell1.getStringCellValue()));
|
||||||
Cell cell2=row.getCell(2);
|
Cell cell2=row.getCell(2);
|
||||||
dto.setValue(StrUtil.trim(cell2.getStringCellValue()));
|
dto.setValue(StrUtil.trim(dataFormatter.formatCellValue(cell2)));
|
||||||
Cell cell3=row.getCell(3);
|
Cell cell3=row.getCell(3);
|
||||||
dto.setMain(StrUtil.equals(cell3.getStringCellValue(),"是"));
|
dto.setMain(StrUtil.equals(cell3.getStringCellValue(),"是"));
|
||||||
Cell cell4=row.getCell(4);
|
Cell cell4=row.getCell(4);
|
||||||
|
|
@ -737,32 +738,6 @@ public class ProductModelController extends ControllerBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ApiResult.success(resultId);
|
return ApiResult.success(resultId);
|
||||||
|
|
||||||
// List<ProductModelParamsExcelDTO> datas = EecExcelUtil.getExcelContext(file.getInputStream(), ProductModelParamsExcelDTO.class);
|
|
||||||
// VUtils.trueThrowBusinessError(CollUtil.isEmpty(datas)).throwMessage("导入文件内容为空");
|
|
||||||
// Set<String> seen = new HashSet<>();
|
|
||||||
// StringBuilder sb=new StringBuilder();
|
|
||||||
// datas.forEach(dto->{
|
|
||||||
// if(!seen.add(StrUtil.format("{}|{}|{}", dto.getLanguageCode(),dto.getIndexName(),dto.getName()))){
|
|
||||||
// sb.append(StrUtil.format("语言编码:{},指标名称:{},参数名称:{}\r\n", dto.getLanguageCode(),dto.getIndexName(),dto.getName()));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// int resultId;
|
|
||||||
// VUtils.trueThrowBusinessError(StrUtil.isNotBlank(sb.toString()))
|
|
||||||
// .throwMessage("以下数据存在重复项:\r\n" + sb);
|
|
||||||
// if (Objects.isNull(modelParamsId)) {
|
|
||||||
// resultId = productModelParamsService.add(modelId, IdUtil.getSnowflakeNextIdStr());
|
|
||||||
// } else {
|
|
||||||
// ProductModelParams info = productModelParamsService.getById(modelParamsId);
|
|
||||||
// VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
|
||||||
// resultId = modelParamsId;
|
|
||||||
// if (Objects.equals(info.getState(), PublishState.Published.getState())) {
|
|
||||||
// resultId = productModelParamsService.add(modelId, info.getBatchNumber());
|
|
||||||
// productModelParamsService.copyItems(modelParamsId, resultId);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// productModelParamsItemService.importModelParamsItem(resultId, datas);
|
|
||||||
// return ApiResult.success(resultId);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new NflgException(STATE.BusinessError, "导入失败:" + e.getMessage());
|
throw new NflgException(STATE.BusinessError, "导入失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue