五环二期集团数据对接

This commit is contained in:
2025-06-19 16:55:10 +08:00
parent 5ed020c7e1
commit 0736adf719
105 changed files with 14375 additions and 1224 deletions
+60
View File
@@ -545,5 +545,65 @@ namespace BLL
}
return result;
}
/// <summary>
/// 获取附件数据流类 多附件的情况
/// </summary>
/// <param name="attachUrl">附件路径</param>
/// <returns></returns>
public static List<byte[]> GetMoreFileStructByAttachUrl(string attachUrl)
{
List<byte[]> fileContext = new List<byte[]>();
try
{
if (!String.IsNullOrEmpty(attachUrl))
{
string physicalpath = ConfigurationManager.AppSettings["localRoot"];
string filePath = string.Empty;
string[] strs = attachUrl.Trim().Split(',');
foreach (var item in strs)
{
//HttpContext.Current.Request.PhysicalApplicationPath;
filePath = physicalpath + item;
if (File.Exists(filePath))
{
fileContext.Add(fileConvertByte(item));
}
}
}
}
catch (Exception ex)
{
string a = ex.Message;
}
return fileContext;
}
#region ()
/// <summary>
/// 附件转换二进制数据(用于保存数据库)
/// </summary>
/// <param name="filePath">附件路径</param>
/// <returns>二进制</returns>
public static byte[] fileConvertByte(string filePath)
{
string physicalpath = (ConfigurationManager.AppSettings["localRoot"] + "\\" + filePath).Replace("\\\\", "\\");
byte[] bytContent = null;
System.IO.FileStream fs = null;
System.IO.BinaryReader br = null;
try
{
fs = new FileStream(physicalpath, System.IO.FileMode.Open);
}
catch
{
}
br = new BinaryReader((Stream)fs);
bytContent = br.ReadBytes((Int32)fs.Length);
fs.Dispose();
return bytContent;
}
#endregion
}
}