Ver código fonte

【CHG】修改导入规则

zhaomn 2 anos atrás
pai
commit
5fd2222577

+ 1 - 1
railway-business/src/main/java/com/railway/business/bi/domain/ShowBdyc.java

@@ -87,7 +87,7 @@ public class ShowBdyc extends BaseEntity {
   @ApiModelProperty(value = "计划处理时间(每周倒排计划)")
   @JsonFormat(pattern = "yyyy-MM-dd")
   @DateTimeFormat(pattern = "yyyy-MM-dd")
-  @Excel(name = "计划处理时间\n(每周倒排计划)", dateFormat = "yyyy/MM/dd")
+  @Excel(name = "计划处理时间(每周倒排计划)", dateFormat = "yyyy/MM/dd")
   private LocalDate planDate;
 
   @ApiModelProperty(value = "del_flag")

+ 4 - 4
railway-business/src/main/java/com/railway/business/bi/service/impl/ShowFileServiceImpl.java

@@ -180,7 +180,7 @@ public class ShowFileServiceImpl implements IShowFileService {
           ExcelUtil<ShowYdts> bdUtil = new ExcelUtil<>(ShowYdts.class);
           List<ShowYdts> bdList;
           try {
-            bdList = bdUtil.importExcel(sheetName, wb);
+            bdList = bdUtil.importExcel(sheetName, wb, 1, 3);
           } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error("文件读取失败");
@@ -194,7 +194,7 @@ public class ShowFileServiceImpl implements IShowFileService {
           ExcelUtil<ShowGsd> dlUtil = new ExcelUtil<>(ShowGsd.class);
           List<ShowGsd> dlList;
           try {
-            dlList = dlUtil.importExcel(sheetName, wb);
+            dlList = dlUtil.importExcel(sheetName, wb, 2, 4);
           } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error("文件读取失败");
@@ -208,7 +208,7 @@ public class ShowFileServiceImpl implements IShowFileService {
           ExcelUtil<ShowGsy> syUtil = new ExcelUtil<>(ShowGsy.class);
           List<ShowGsy> syList;
           try {
-            syList = syUtil.importExcel(sheetName, wb);
+            syList = syUtil.importExcel(sheetName, wb, 1, 3);
           } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error("文件读取失败");
@@ -259,7 +259,7 @@ public class ShowFileServiceImpl implements IShowFileService {
           break;
         case DL:
           try {
-            bdList = bdUtil.importExcel(sheetName, wb, 2);
+            bdList = bdUtil.importExcel(sheetName, wb, 1, 3);
           } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error("文件读取失败");

+ 1 - 1
railway-common/src/main/java/com/railway/common/utils/poi/ExcelUtil.java

@@ -386,7 +386,7 @@ public class ExcelUtil<T> {
         for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
           Cell cell = heard.getCell(i);
           if (StringUtils.isNotNull(cell)) {
-            String value = this.getCellValue(heard, i).toString();
+            String value = this.getCellValue(heard, i).toString().replaceAll("\n", "");
             if (cellMapTmp.containsKey(i)) {
               value = cellMapTmp.get(i) + value;
             }