xiongchao 3 年之前
父节点
当前提交
952d8e9f6c

+ 9 - 8
platform-dao/src/main/java/com/platform/dao/util/CustomExcelImportUtil.java

@@ -459,15 +459,16 @@ 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\\cyz\\Desktop\\新建文件夹\\2021.7.15设备基础信息 更新自定义设备类型和部分第一维修人 (1) - 副本.xls"};
+        String[] files = {"C:\\Users\\cyz\\\\Downloads\\2021.8.3设备基础导入 修改设备等级 设备类型 自定义类型.xls"};
         for(String fileStr:files){
             System.out.println(fileStr);
             InputStream inputstream = new FileInputStream(fileStr);
             LocalDateTime now = LocalDateTime.now();
-            List<SbInfoVO> list = importSbInfoList(inputstream);
-           /* list.forEach(item -> {
+            //List<SbInfoVO> list = importSbInfoList(inputstream);
+            List<SbInfoVO> list = importListByUpdateALl(inputstream);
+           list.forEach(item -> {
                 System.out.println(item.toString());
-            });*/
+            });
             System.out.println("处理数量:" + list.size());
         }
     }
@@ -607,11 +608,11 @@ public class CustomExcelImportUtil {
     }
 
     private static Integer getLevel(String stringCellValue) {
-        if ("A级".equals(stringCellValue)) {
+        if ("A".equals(stringCellValue) || "A级".equals(stringCellValue)) {
             return 1;
-        } else if ("B级".equals(stringCellValue)) {
+        } else if ("B".equals(stringCellValue) || "B级".equals(stringCellValue)) {
             return 2;
-        } else if ("C级".equals(stringCellValue)) {
+        } else if ("C".equals(stringCellValue) || "C级".equals(stringCellValue)) {
             return 3;
         } else {
             return 1;
@@ -1273,7 +1274,7 @@ public class CustomExcelImportUtil {
                 }
                 record.setStatus(getSbInfoStatus(row.getCell(18).getStringCellValue()));
                 record.setRemark(row.getCell(19).getStringCellValue().trim());
-                System.out.println("row.getPhysicalNumberOfCells(): " + row.getPhysicalNumberOfCells());
+                //System.out.println("row.getPhysicalNumberOfCells(): " + row.getPhysicalNumberOfCells());
                 // 主子设备和是否大屏显示
                 if(row.getPhysicalNumberOfCells()>20){
                     record.setIsChild(getChild(row.getCell(20).getStringCellValue().trim()));

+ 1 - 1
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java

@@ -404,7 +404,7 @@ public class SbInfoController {
     }
 
     public static void main(String[] args) throws FileNotFoundException {
-        String[] files = {"C:\\Users\\cyz\\Desktop\\设备型号20210210213928562-0210导入后再导出文件.xls"};
+        String[] files = {"C:\\Users\\cyz\\Downloads\\2021.8.3设备基础导入 修改设备等级 设备类型 自定义类型.xls"};
         List<ExportSbInfoVO> list = ExcelImportUtil.importExcel(new FileInputStream(files[0]), ExportSbInfoVO.class,new ImportParams());
         list.forEach(item -> {
             System.out.println(item.toString());

+ 4 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -54,6 +54,8 @@ import com.platform.dao.vo.sb.SbInfoScreenDetailVO;
 import com.platform.dao.vo.sb.SbInfoScreenVO;
 import com.platform.dao.vo.sb.SbInfoVO;
 import com.platform.dao.vo.sb.SbModelVO;
+import com.platform.office.poi.excel.ExcelImportUtil;
+import com.platform.office.poi.excel.entity.ImportParams;
 import com.platform.service.base.impl.BaseServiceImpl;
 import com.platform.service.business.ActivitiBusinessService;
 import com.platform.service.check.CheckStandardService;
@@ -79,6 +81,7 @@ import org.springframework.web.multipart.MultipartFile;
 import tk.mybatis.mapper.weekend.Weekend;
 import tk.mybatis.mapper.weekend.WeekendCriteria;
 
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
@@ -1323,6 +1326,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         List<SbInfo> updateList = new ArrayList<SbInfo>();
         try {
             List<SbInfoVO> items = CustomExcelImportUtil.importListByUpdateALl(file.getInputStream());
+            //List<ExportSbInfoVO> items = ExcelImportUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class,new ImportParams());
             if (!CollectionUtils.isEmpty(items)) {
                 if (!CollectionUtils.isEmpty(items)) {
                     List<SbInfoVO> addItems = new ArrayList<SbInfoVO>();