Forráskód Böngészése

导入工时支持多项目的内容

seyason 1 hónapja
szülő
commit
87d4ea2ff0

+ 14 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -5619,6 +5619,20 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                 if (withCheckIn != null) {
                                     if (row.getCell(workContentIndex) != null) {
                                         workContent = row.getCell(workContentIndex).getStringCellValue().trim();
+                                        //支持多个项目内容,用 | 隔开,每个项目内容以项目名称:开头,支持中英文冒号,取当前项目名称匹配的内容
+                                        if (!StringUtils.isEmpty(workContent)) {
+                                            String[] split = workContent.split("\\|");
+                                            for (String s : split) {
+                                                //按:或者:分割
+                                                String[] split1 = s.split(":|:");
+                                                if (split1.length >= 2) {
+                                                    if (split1[0].equals(pName)) {
+                                                        workContent = s.replaceAll(split1[0] + ":", "").replaceAll(split1[0] + ":", "");
+                                                        break;
+                                                    }
+                                                }
+                                            }
+                                        }
                                         report.setContent(workContent);
                                     }
                                 }