|
@@ -466,21 +466,19 @@ public class CustomExcelImportUtil {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws IOException, InvalidFormatException {
|
|
|
- //String path = "C:\\Users\\cyz\\Downloads\\老版维保计划\\noperson";
|
|
|
- //File dirFile = new File("C:\\Users\\cyz\\Downloads\\老版维保计划\\noperson");
|
|
|
- String[] files = {"C:\\Users\\LTKJ\\Downloads\\2022.1.28保养任务 终版 导入.xls"};
|
|
|
+ String[] files = {"E:\\项目\\龙岩思康\\设备管理\\信息表-时代思康电量数据上送项目-电度.xlsx"};
|
|
|
DateUtils.strToLocalDate("2022-09-23", DateUtils.PATTERN_YMD);
|
|
|
- /*for(String fileStr:files){
|
|
|
+ for(String fileStr:files){
|
|
|
System.out.println(fileStr);
|
|
|
InputStream inputstream = new FileInputStream(fileStr);
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
//List<SbInfoVO> list = importSbInfoList(inputstream);
|
|
|
- List<CheckJob> list = importCheckJobList(inputstream);
|
|
|
+ List<RemoteDegree> list = importRemoteDegreeList(inputstream, null);
|
|
|
list.forEach(item -> {
|
|
|
System.out.println(item.toString());
|
|
|
});
|
|
|
System.out.println("处理数量:" + list.size());
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static List<SbModel> importModelList(InputStream inputstream) throws IOException, InvalidFormatException {
|
|
@@ -994,27 +992,28 @@ public class CustomExcelImportUtil {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- String index = row.getCell(0).getStringCellValue() + "";
|
|
|
+ String index = getCellValue(row.getCell(0)) + "";
|
|
|
try {
|
|
|
//i,j i:行 j:列
|
|
|
+ record.setId(IdGeneratorUtils.getObjectId());
|
|
|
record.setPositionNum(Integer.valueOf(getCellValue(row.getCell(0))));
|
|
|
record.setSbName(getCellValue(row.getCell(1)));
|
|
|
- record.setDesc(StringUtils.getExcelString(row.getCell(2)));
|
|
|
- String type = getCellValue(row.getCell(3)).trim();
|
|
|
- if(StringUtils.isNotEmpty(type)){
|
|
|
+ String desc = getCellValue(row.getCell(2)).trim();
|
|
|
+ record.setDesc(desc);
|
|
|
+ if(StringUtils.isNotEmpty(desc)){
|
|
|
boolean find = false;
|
|
|
for(SysDict sysDict: sysDictList){
|
|
|
- if(sysDict.getLabel().equals(type)){
|
|
|
+ if(sysDict.getLabel().equals(desc)){
|
|
|
record.setType(Integer.valueOf(sysDict.getValue()));
|
|
|
find = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if(!find){
|
|
|
- throw new BusinessException("点位类型未配置,请配置数据字典:" + type );
|
|
|
+ throw new BusinessException("点位类型未配置,请配置电度数据字典:" + desc );
|
|
|
}
|
|
|
}
|
|
|
- record.setUnit(getCellValue(row.getCell(4)).trim());
|
|
|
+ record.setUnit(getCellValue(row.getCell(3)).trim());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
error.append(index).append("错误地址:第"+i+"行");
|
|
@@ -1066,24 +1065,25 @@ public class CustomExcelImportUtil {
|
|
|
String index = row.getCell(0).getStringCellValue() + "";
|
|
|
try {
|
|
|
//i,j i:行 j:列
|
|
|
+ record.setId(IdGeneratorUtils.getObjectId());
|
|
|
record.setPositionNum(Integer.valueOf(getCellValue(row.getCell(0))));
|
|
|
record.setSbName(getCellValue(row.getCell(1)));
|
|
|
- String desc = getCellValue(row.getCell(2)).trim();
|
|
|
- record.setDesc(desc);
|
|
|
- if(StringUtils.isNotEmpty(desc)){
|
|
|
+ record.setDesc(StringUtils.getExcelString(row.getCell(2)));
|
|
|
+ String type = getCellValue(row.getCell(3)).trim();
|
|
|
+ if(StringUtils.isNotEmpty(type)){
|
|
|
boolean find = false;
|
|
|
for(SysDict sysDict: sysDictList){
|
|
|
- if(sysDict.getLabel().equals(desc)){
|
|
|
+ if(sysDict.getLabel().equals(type)){
|
|
|
record.setType(Integer.valueOf(sysDict.getValue()));
|
|
|
find = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if(!find){
|
|
|
- throw new BusinessException("点位类型未配置,请配置电度数据字典:" + desc );
|
|
|
+ throw new BusinessException("点位类型未配置,请配置数据字典:" + type );
|
|
|
}
|
|
|
}
|
|
|
- record.setUnit(getCellValue(row.getCell(3)).trim());
|
|
|
+ record.setUnit(getCellValue(row.getCell(4)).trim());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
error.append(index).append("错误地址:第"+i+"行");
|