|
@@ -3572,25 +3572,25 @@ namespace OASystem.API.Controllers
|
|
{
|
|
{
|
|
var jw = JsonView(false);
|
|
var jw = JsonView(false);
|
|
|
|
|
|
- if (dto.File == null)
|
|
|
|
|
|
+ if (dto.Files == null || dto.Files.Count == 0)
|
|
{
|
|
{
|
|
jw.Msg = "无文件信息!";
|
|
jw.Msg = "无文件信息!";
|
|
return Ok(jw);
|
|
return Ok(jw);
|
|
}
|
|
}
|
|
|
|
|
|
- var nameSp = dto.File.FileName.Split(".");
|
|
|
|
- if (nameSp.Length < 2)
|
|
|
|
- {
|
|
|
|
- jw.Msg = "拓展名称有误!";
|
|
|
|
- return Ok(jw);
|
|
|
|
- }
|
|
|
|
|
|
+ //var nameSp = dto.File.FileName.Split(".");
|
|
|
|
+ //if (nameSp.Length < 2)
|
|
|
|
+ //{
|
|
|
|
+ // jw.Msg = "拓展名称有误!";
|
|
|
|
+ // return Ok(jw);
|
|
|
|
+ //}
|
|
|
|
|
|
- var existsName = new string[]{ "RAR", "ZIP", "ARJ","GZ","Z","7Z","TAR" };
|
|
|
|
- if (!existsName.Contains(nameSp[1].ToUpper()))
|
|
|
|
- {
|
|
|
|
- jw.Msg = $"请使用指定拓展名!({string.Join("-",existsName)})";
|
|
|
|
- return Ok(jw);
|
|
|
|
- }
|
|
|
|
|
|
+ //var existsName = new string[]{ "RAR", "ZIP", "ARJ","GZ","Z","7Z","TAR" };
|
|
|
|
+ //if (!existsName.Contains(nameSp[1].ToUpper()))
|
|
|
|
+ //{
|
|
|
|
+ // jw.Msg = $"请使用指定拓展名!({string.Join("-",existsName)})";
|
|
|
|
+ // return Ok(jw);
|
|
|
|
+ //}
|
|
|
|
|
|
var Ctable = _sqlSugar.Queryable<Sys_SetData>().First(x => x.STid == 16 && x.IsDel == 0 && x.Id == dto.Ctable);
|
|
var Ctable = _sqlSugar.Queryable<Sys_SetData>().First(x => x.STid == 16 && x.IsDel == 0 && x.Id == dto.Ctable);
|
|
if (Ctable == null)
|
|
if (Ctable == null)
|
|
@@ -3621,38 +3621,49 @@ namespace OASystem.API.Controllers
|
|
Directory.CreateDirectory(fileBase);
|
|
Directory.CreateDirectory(fileBase);
|
|
}
|
|
}
|
|
|
|
|
|
- var saveFilePath = fileBase +"\\"+ dto.File.FileName;
|
|
|
|
|
|
+ List<Grp_GroupModelFile> saveArr = new List<Grp_GroupModelFile>();
|
|
|
|
|
|
- Grp_GroupModelFile file = new Grp_GroupModelFile()
|
|
|
|
|
|
+ foreach (var fileStream in dto.Files)
|
|
{
|
|
{
|
|
- Cid = dto.Cid,
|
|
|
|
- CreateTime = DateTime.Now,
|
|
|
|
- CreateUserId = dto.Userid,
|
|
|
|
- Ctable = dto.Ctable,
|
|
|
|
- Diid = dto.Diid,
|
|
|
|
- IsDel = 0,
|
|
|
|
- FilePath = saveFilePath,
|
|
|
|
- FileName = nameSp[0]
|
|
|
|
- };
|
|
|
|
|
|
+ var saveFilePath = fileBase + "\\" + fileStream.FileName;
|
|
|
|
|
|
- using (FileStream fs = System.IO.File.Create(saveFilePath))
|
|
|
|
- {
|
|
|
|
- dto.File.CopyTo(fs);
|
|
|
|
- fs.Flush();
|
|
|
|
|
|
+ Grp_GroupModelFile file = new Grp_GroupModelFile()
|
|
|
|
+ {
|
|
|
|
+ Cid = dto.Cid,
|
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
|
+ CreateUserId = dto.Userid,
|
|
|
|
+ Ctable = dto.Ctable,
|
|
|
|
+ Diid = dto.Diid,
|
|
|
|
+ IsDel = 0,
|
|
|
|
+ FilePath = saveFilePath,
|
|
|
|
+ FileName = fileStream.FileName
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ using (FileStream fs = System.IO.File.Create(saveFilePath))
|
|
|
|
+ {
|
|
|
|
+ fileStream.CopyTo(fs);
|
|
|
|
+ fs.Flush();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ saveArr.Add(file);
|
|
}
|
|
}
|
|
|
|
|
|
- var addResult = _sqlSugar.Insertable<Grp_GroupModelFile>(file).ExecuteCommand();
|
|
|
|
|
|
+ var addResult = _sqlSugar.Insertable<Grp_GroupModelFile>(saveArr).ExecuteCommand();
|
|
|
|
+
|
|
|
|
+ //url = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("GrpFileFtpPath") + path + "\\" + dto.File.FileName
|
|
|
|
|
|
jw = JsonView(true, "保存成功!", new
|
|
jw = JsonView(true, "保存成功!", new
|
|
{
|
|
{
|
|
- url = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("GrpFileFtpPath") + path + "\\" + dto.File.FileName
|
|
|
|
- });
|
|
|
|
|
|
+ count = addResult,
|
|
|
|
+ filesName = saveArr.Select(x => x.FileName)
|
|
|
|
+ }) ;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
jw = JsonView(false, $"保存失败! ({ex.Message}) ", new
|
|
jw = JsonView(false, $"保存失败! ({ex.Message}) ", new
|
|
{
|
|
{
|
|
- url = ""
|
|
|
|
|
|
+ count = 0,
|
|
|
|
+ filesName = new string[0],
|
|
}) ;
|
|
}) ;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3703,8 +3714,7 @@ namespace OASystem.API.Controllers
|
|
var byts = io.ConvertZipStream(Zips);
|
|
var byts = io.ConvertZipStream(Zips);
|
|
var path = "\\GroupModelFiles\\" + groupInfo.TeamName;
|
|
var path = "\\GroupModelFiles\\" + groupInfo.TeamName;
|
|
io.ByteToFile(byts, AppSettingsHelper.Get("GrpFileBasePath") + $"{path}\\{groupInfo.TeamName}_.Zip");
|
|
io.ByteToFile(byts, AppSettingsHelper.Get("GrpFileBasePath") + $"{path}\\{groupInfo.TeamName}_.Zip");
|
|
- //http://132.232.92.186:24/Office/Word/EnterExitCost/File/
|
|
|
|
- jw = JsonView(true, "success", new { url = AppSettingsHelper.Get("GrpFileBasePath") + $"\\Office\\Excel\\ExportLocalGuidePriceDetail\\{groupInfo.TeamName}_地接费用明细.zip" });
|
|
|
|
|
|
+ jw = JsonView(true, "success", new { url = AppSettingsHelper.Get("GrpFileBaseUrl") + $"{AppSettingsHelper.Get("GrpFileFtpPath")}{path}\\{groupInfo.TeamName}_.zip" });
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|