|
@@ -62,6 +62,7 @@ using System.Security.Policy;
|
|
|
using System.Xml;
|
|
|
using OASystem.Domain.Dtos.QiYeWeChat;
|
|
|
using static NPOI.POIFS.Crypt.CryptoFunctions;
|
|
|
+using Aspose.Words.Lists;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -9072,6 +9073,84 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(viewData.Data));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 倒推表
|
|
|
+ /// File Download
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostInvertedListFileDownload(InvertedListFileDownloadDto dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ var info1 = await _invertedListRep._sqlSugar.Queryable<Grp_InvertedList>().Where(it => it.Id == dto.DiId).FirstAsync();
|
|
|
+ if (info1 == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "倒推表数据未生成,请先生成倒退表数据!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var info = await _invertedListRep._sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == dto.DiId).FirstAsync();
|
|
|
+ string teamName = "";
|
|
|
+ if (info != null) teamName = info.TeamName;
|
|
|
+
|
|
|
+ //载入模板
|
|
|
+ Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/邀请函模板0210.docx");
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ //利用键值对存放数据
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+ dic.Add("TeamName", teamName);
|
|
|
+
|
|
|
+ dic.Add("StartTime", info1.AirportdDropOffDt.ConvertToDatetime());
|
|
|
+
|
|
|
+ dic.Add("BPtime", info1.ApprovalDataDt.ConvertToDatetime());
|
|
|
+ dic.Add("BPRemark", info1.ApprovalDataRemark);
|
|
|
+
|
|
|
+ dic.Add("SQtime", info1.ApprovalDt.ConvertToDatetime());
|
|
|
+ dic.Add("SQRemark", info1.ApprovalRemark);
|
|
|
+
|
|
|
+ dic.Add("CPJtime", info1.ApprovalDt.ConvertToDatetime());
|
|
|
+ dic.Add("CPJRemark", info1.ApprovalRemark);
|
|
|
+
|
|
|
+ dic.Add("HZtime", info1.ApplyPassportDt.ConvertToDatetime());
|
|
|
+ dic.Add("HZRemark", info1.ApplyPassportRemark);
|
|
|
+
|
|
|
+ dic.Add("QZtime", info1.VisaInformationDt.ConvertToDatetime());
|
|
|
+ dic.Add("QZRemark", info1.VisaInformationRemark);
|
|
|
+
|
|
|
+ dic.Add("SQQZtime", info1.SendVisaDt.ConvertToDatetime());
|
|
|
+ dic.Add("SQQZRemark", info1.SendVisaRemark);
|
|
|
+
|
|
|
+ dic.Add("CQtime", info1.IssueVisaDt.ConvertToDatetime());
|
|
|
+ dic.Add("SQQZRemark", info1.IssueVisaRemark);
|
|
|
+
|
|
|
+ dic.Add("XQHtime", info1.PreTripMeetingDt.ConvertToDatetime());
|
|
|
+ dic.Add("XQHRemark", info1.PreTripMeetingRemark);
|
|
|
+
|
|
|
+ dic.Add("SJtime", info1.AirportdDropOffDt.ConvertToDatetime());
|
|
|
+ dic.Add("SJRemark", info1.AirportdDropOffRemark);
|
|
|
+
|
|
|
+ #region 填充word模板书签内容
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
|
|
|
+ string fileName = $"{teamName}团出行准备流程表.doc";
|
|
|
+ string filePath = fileDir + $@"商邀相关文件/{fileName}";
|
|
|
+ doc.Save(filePath);
|
|
|
+ string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/InvertedList/{fileName}";
|
|
|
+ return Ok(JsonView(true, "操作成功!", Url));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
}
|