using YLErp; namespace System.Web.Mvc { /// /// 用于处理确认书文件帮助类 /// public static class DocFileHelper { /// /// 检查确认书文件返回的结果路径是否能够正确对应物理文件,如果不能够对应,尝试修补 /// public static List CheckResultDocFilePath(IEnumerable files) { return files?.Where(n => !string.IsNullOrWhiteSpace(n)).Select(n => { var physicalPath = OtcAppContext.MapPath(n.TrimStart('.')); if (physicalPath.EndsWith("x")) { if (!File.Exists(physicalPath)) { physicalPath = physicalPath.Substring(0, physicalPath.Length - 1); return File.Exists(physicalPath) ? n.Substring(0, n.Length - 1) : n; } } else if (!File.Exists(physicalPath)) { return File.Exists(physicalPath + "x") ? n + "x" : n; } return n; }).ToList(); } } }