|
|
@@ -1812,7 +1812,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
|
//××(组团单位):接团客户信息团组
|
|
|
- dic.Add("GroupClient", groupInfo.ClientUnit);
|
|
|
+ dic.Add("GroupClient", $"{groupInfo.ClientUnit}\r\n");
|
|
|
|
|
|
//关于××(职务、姓名)等×人赴××(国家或地区)进行×××(出访目的)的请示
|
|
|
string guestName = "";
|
|
|
@@ -1952,7 +1952,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
string birthDayStr = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(birthDay))
|
|
|
{
|
|
|
- birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy-MM-dd");
|
|
|
+ birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy.MM");
|
|
|
}
|
|
|
builder.Write(birthDayStr);
|
|
|
}
|
|
|
@@ -1973,7 +1973,154 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
|
|
|
}
|
|
|
else if (dto.FileType == 2)
|
|
|
{
|
|
|
+ //载入模板
|
|
|
+ string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/市外办出访请示 - 模板.docx";
|
|
|
+ var doc = new Document(tempPath);
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ //键值对存放数据
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
|
+ //××(组团单位):接团客户信息团组
|
|
|
+ dic.Add("GroupClient", $"{groupInfo.ClientUnit}");
|
|
|
+
|
|
|
+ dic.Add("GroupClient1", $"{groupInfo.ClientUnit}");
|
|
|
+ //关于××(职务、姓名)等×人赴××(国家或地区)进行×××(出访目的)的请示
|
|
|
+ string guestName = "";
|
|
|
+ string guestJob = "";
|
|
|
+ string guestInfoStr = "";
|
|
|
+ var guestFirstInfo = guestInfos.FirstOrDefault();
|
|
|
+ if (guestFirstInfo != null)
|
|
|
+ {
|
|
|
+ guestName = guestFirstInfo.LastName + guestFirstInfo.FirstName;
|
|
|
+ guestJob = guestFirstInfo.Job;
|
|
|
+ guestInfoStr = $@"{guestJob}、{guestName}";
|
|
|
+ }
|
|
|
+ string reqTitle = $@"关于{guestInfoStr}等{guestInfos.Count}人赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}的请示";
|
|
|
+ dic.Add("ReqTitle", reqTitle);
|
|
|
+
|
|
|
+ //应×××(邀请方名称+邀请人职务和姓名)的邀请,我单位拟派×××(职务、姓名)等×人(人数)于×××年×××月×××日赴×××(国家或地区)进行×××(出访目的)。
|
|
|
+ string visitDateStr = @$"{groupInfo.VisitDate.Year}年{groupInfo.VisitDate.Month}月{groupInfo.VisitDate.Day}日";
|
|
|
+ string obInfoStr = "";
|
|
|
+ string obBackgroundStr = "×××";//出访背景
|
|
|
+ foreach (var ob in obDatas)
|
|
|
+ {
|
|
|
+ obInfoStr += @$"{ob.Client}{ob.Job}{ob.Contact}、";
|
|
|
+
|
|
|
+ //obBackgroundStr += $"{ob.Client}\r\n \t {ob.Setting}\r\n";
|
|
|
+
|
|
|
+ }
|
|
|
+ if (obInfoStr.Length > 0)
|
|
|
+ {
|
|
|
+ obInfoStr = obInfoStr.Substring(0, obInfoStr.Length - 1);
|
|
|
+ }
|
|
|
+ string reqSubTitle = $@"应{obInfoStr}的邀请,我单位拟派{guestInfoStr}等{guestInfos.Count}人于{visitDateStr}赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}。";
|
|
|
+ dic.Add("ReqSubTitle", reqSubTitle);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 出访任务
|
|
|
+ * (一)××(国家或地区)
|
|
|
+ * 1.拜访×××(机构名称)×××(姓名、职务)洽谈(或调研、推动等)×××(项目或机构名称等)。(例:拜会×××经济与发展司司长×××,商讨“×××活动”相关筹备工作。)背景:拟拜访机构的优势、拟洽谈项目的前期进展情况等。(例:背景:由×××总领馆联合×××市政府共同举办的“×××活动”将于今年6月在×××举行。)
|
|
|
+ * 2.拜访×××(机构名称)×××(姓名、职务)洽谈(或调研等)×××(项目或机构名称等)。(例:拜会友城×××市市长×××,巩固和发展两市传统友谊,商谈两市未来互动交流合作项目。)背景:拟拜访机构的优势、拟洽谈项目的前期进展情况等。(例:背景:×××年×月,×××市与×××市正式缔结友好城市关系。在此框架下,两市开展了一系列友好互访和商务交流。并于×××年×月共同举办了“×××活动”。)
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+ string taskStr = "××××"; ;
|
|
|
+ //List<string> countrys = groupInfo.VisitCountry.Split("、").ToList();
|
|
|
+ //int countryIndex = 1;
|
|
|
+ //foreach (var item in countrys)
|
|
|
+ //{
|
|
|
+ // string taskTitle = $"({GetToUpperNumber(countryIndex)}){item}\r\n";
|
|
|
+
|
|
|
+ // string taskContent = "";
|
|
|
+ // var countryObDatas = obDatas.Where(it => it.Client.Contains(item)).ToList();
|
|
|
+ // int obIndex = 1;
|
|
|
+ // foreach (var obInfo in countryObDatas)
|
|
|
+ // {
|
|
|
+ // taskContent += $"{obIndex}. 拜访{obInfo.Client}({obInfo.Contact}、{obInfo.Job})洽谈“{groupInfo.VisitPurpose}”相关工作。\r\n";
|
|
|
+ // }
|
|
|
+
|
|
|
+ // taskStr += $"{taskTitle}{taskContent}";
|
|
|
+
|
|
|
+ // countryIndex++;
|
|
|
+ //}
|
|
|
+
|
|
|
+ //出访任务
|
|
|
+ dic.Add("TaskContent", taskStr);
|
|
|
+
|
|
|
+ //出访目的
|
|
|
+ dic.Add("VisitPurpose", groupInfo.VisitPurpose);
|
|
|
+
|
|
|
+ //出访信息
|
|
|
+ //代表团拟于××年×月×日—×月×日出访,在外停留×天。其中,××国家(或地区)×天,××国家(或地区)×天。出访路线:成都—××(出境城市名称)—××(转机不出机场)—××(公务所在城市)……—××(入境城市名称)—成都。(例:成都—法兰克福<转机不出机场>—巴黎—巴塞罗那—阿姆斯特丹<转机不出机场>-成都)出访费用:由××承担(注明由外方或上级机关承担,还是由派员单位在年度安排的预算经费中列支)。
|
|
|
+
|
|
|
+ string tripInfoStr = "";
|
|
|
+ string visitCountryStr = $"[OP行程单读取]";
|
|
|
+ visitCountryStr = GeneralMethod.GetCountryStandingTime(groupInfo.Id); //计算国家出访天数
|
|
|
+ string lineStr = GeneralMethod.GetGroupCityLine(groupInfo.Id, "—"); //出访路线
|
|
|
+ tripInfoStr = $"代表团拟于{groupInfo.VisitStartDate.Year}年{groupInfo.VisitStartDate.Month}月{groupInfo.VisitStartDate.Day}日—{groupInfo.VisitEndDate.Month}月{groupInfo.VisitEndDate.Day}日出访,在外停留{groupInfo.VisitDays}天。其中,{visitCountryStr}。出访路线:{lineStr}出访费用:由××承担(注明由外方或上级机关承担,还是由派员单位在年度安排的预算经费中列支)";
|
|
|
+
|
|
|
+
|
|
|
+ dic.Add("TripInfo", tripInfoStr);
|
|
|
+
|
|
|
+
|
|
|
+ #region 填充word模板书签内容
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //获取word里所有表格
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
+ //获取所填表格的序数
|
|
|
+ Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
+
|
|
|
+ var rowStart = tableOne.Rows[0]; //获取第1行
|
|
|
+
|
|
|
+ //循环赋值
|
|
|
+ for (int i = 0; i < guestInfos.Count; i++)
|
|
|
+ {
|
|
|
+ var guestInfo = guestInfos[i];
|
|
|
+ builder.MoveToCell(0, i + 1, 0, 0);
|
|
|
+ builder.Write(guestInfo.LastName + guestInfo.FirstName);
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 1, 0);
|
|
|
+ int sex = guestInfo.Sex;
|
|
|
+ string sexStr = string.Empty;
|
|
|
+ if (sex == 0) sexStr = "男";
|
|
|
+ else if (sex == 1) sexStr = "女";
|
|
|
+ else sexStr = "未设置";
|
|
|
+ builder.Write(sexStr);
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 2, 0);
|
|
|
+ builder.Write(guestInfo.CompanyFullName + guestInfo.Job);
|
|
|
+
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 3, 0);
|
|
|
+ string birthDay = "";
|
|
|
+ string birthDayStr = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(birthDay))
|
|
|
+ {
|
|
|
+ birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy.MM");
|
|
|
+ }
|
|
|
+ builder.Write(birthDayStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除多余行
|
|
|
+ while (tableOne.Rows.Count > guestInfos.Count + 1)
|
|
|
+ {
|
|
|
+ tableOne.Rows.RemoveAt(guestInfos.Count + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ var fileDir = AppSettingsHelper.Get("WordBasePath");
|
|
|
+ string fileName = $"{groupInfo.TeamName}市外办出访请示.docx";
|
|
|
+ string filePath = fileDir + $@"OfficialActivities/{fileName}";
|
|
|
+ doc.Save(filePath);
|
|
|
+
|
|
|
+ string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/OfficialActivities/{fileName}";
|
|
|
+ return Ok(JsonView(true, "操作成功!", Url));
|
|
|
}
|
|
|
|
|
|
|