Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 7 months ago
parent
commit
e295967605

+ 106 - 124
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1215,16 +1215,12 @@ namespace OASystem.API.Controllers
                             }
 
                             //计算费用总和
-                            decimal AllPrice = airPrice + cityTranffic + dac1.Sum(x => x.SubTotal) + dac2.Sum(x => x.SubTotal) +
-                                               dac3.Sum(x => x.SubTotal) + dac4.Sum(x => x.SubTotal) + _EnterExitCosts.Visa + _EnterExitCosts.Safe +
+                            decimal AllPrice = airPrice + cityTranffic + _EnterExitCosts.Visa + _EnterExitCosts.Safe +
                                                +_EnterExitCosts.YiMiao + _EnterExitCosts.YiMiao + _EnterExitCosts.Ticket + _EnterExitCosts.Service;
-                            WordAllPrice += AllPrice;
-
-                            UsersTop += firstName + "出访费用为¥" + AllPrice.ToString("#0.00") + "元、";
-
+                            
                             TeableBookmarkArr.Add("jp", airPrice.ToString("#0.00") + " 元"); //机票金额
                             TeableBookmarkArr.Add("cs", $"{cityTranffic:#0.00} 元"); //城市交通费用
-                            TeableBookmarkArr.Add("zs", dac1.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //住宿费
+                            
                             string zsinfo = string.Empty;
                             string hsinfo = string.Empty;
                             string gzinfo = string.Empty;
@@ -1235,166 +1231,148 @@ namespace OASystem.API.Controllers
                             Aspose.Words.Tables.Table ChildTable1 = (Aspose.Words.Tables.Table)FirstTable.GetChild(NodeType.Table, 1, true);
                             Aspose.Words.Tables.Table ChildTable2 = (Aspose.Words.Tables.Table)FirstTable.GetChild(NodeType.Table, 2, true);
 
+                            var totalAccom = 0.00M;  // 住宿费合计
                             int rowIndex = 0;
                             if (dac1.Count <= 0 && ChildTable != null) ChildTable.Remove(); //删除表格
                             foreach (var item in dac1)
                             {
-                                if (string.IsNullOrWhiteSpace(item.Place))
-                                {
-                                    continue;
-                                }
+                                if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
 
-                                if (placeArr.Contains(item.Place))
-                                {
-                                    continue;
-                                }
-                                else
+                                placeArr.Add(item.Place);
+
+                                if (rowIndex > ChildTable.Rows.Count - 1)
                                 {
-                                    placeArr.Add(item.Place);
+                                    var chitableRow = ChildTable.LastRow.Clone(true);
+                                    ChildTable.AppendChild(chitableRow);
                                 }
-                                if (!string.IsNullOrWhiteSpace(item.Place))
+
+                                decimal currencyRate = item.SubTotal / item.Cost;
+                                string currencyCode = $"Unknown";
+                                var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
+                                if (sys_currencyInfo != null)
                                 {
-                                    if (rowIndex > ChildTable.Rows.Count - 1)
+                                    var sys_currencyCode = sys_currencyInfo.Name;
+                                    var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
+                                    if (eec_currencyInfo != null)
                                     {
-                                        var chitableRow = ChildTable.LastRow.Clone(true);
-                                        ChildTable.AppendChild(chitableRow);
+                                        currencyRate = eec_currencyInfo.Rate;
+                                        currencyCode = eec_currencyInfo.Name;
                                     }
-                                    int days = dac1.FindAll(x => x.Place == item.Place).Count;
-                                    SetCells(ChildTable, doc, rowIndex, 0, item.Place);
-                                    SetCells(ChildTable, doc, rowIndex, 1, days + "晚");
+                                }
 
-                                    string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
-                                    SetCells(ChildTable, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/晚");
+                                int days = dac1.FindAll(x => x.Place == item.Place).Count;
+                                SetCells(ChildTable, doc, rowIndex, 0, item.Place);
+                                SetCells(ChildTable, doc, rowIndex, 1, $"{days}晚");
+                                SetCells(ChildTable, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/晚");
+                                SetCells(ChildTable, doc, rowIndex, 3, $"汇率{currencyRate:0.0000}");
 
-                                    var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
-                                    var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
-                                    if (sys_currencyInfo != null)
-                                    {
-                                        var sys_currencyCode = sys_currencyInfo.Name;
-                                        var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
-                                        if (eec_currencyInfo != null)
-                                        {
-                                            currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
-                                        }
-                                    }
-
-                                    SetCells(ChildTable, doc, rowIndex, 3, "汇率" + currencyRate);
-                                    SetCells(ChildTable, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
-                                    rowIndex++;
-                                    zsinfo += item.Place + "  " + days + "晚 " + item.Cost.ToString("#0.00") + currencyCode + "/晚" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + "   CNY " + item.SubTotal * days + "\r\n";
-                                }
+                                decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
+                                SetCells(ChildTable, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}\r\n");
 
+                                zsinfo += $"{item.Place}  {days}晚 {item.Cost:0.00}/晚 汇率{currencyRate:0.0000}   CNY{currSubTotal:0.00}\r\n";
+                                totalAccom += currSubTotal;
+                                rowIndex++;
                             }
                             placeArr.Clear();
 
+                            AllPrice += totalAccom;
+                            TeableBookmarkArr.Add("zs", $"{totalAccom:0.00} 元"); // 住宿费
+                            TeableBookmarkArr.Add("zsinfo", zsinfo);              // 住宿费详情
+
+                            decimal totalMeal = 0.00m;       // 伙食费合计
                             rowIndex = 0;
                             if (dac2.Count <= 0 && ChildTable1 != null) ChildTable1.Remove(); //删除表格
                             foreach (var item in dac2)
                             {
-                                if (string.IsNullOrWhiteSpace(item.Place))
-                                {
-                                    continue;
-                                }
+                                if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
 
-                                if (placeArr.Contains(item.Place))
-                                {
-                                    continue;
-                                }
-                                else
+                                placeArr.Add(item.Place);
+
+                                if (rowIndex > ChildTable1.Rows.Count - 1)
                                 {
-                                    placeArr.Add(item.Place);
+                                    var chitableRow = ChildTable1.LastRow.Clone(true);
+                                    ChildTable1.AppendChild(chitableRow);
                                 }
-                                if (!string.IsNullOrWhiteSpace(item.Place))
+
+                                decimal currencyRate = item.SubTotal / item.Cost; //默认汇率
+                                string currencyCode = "Unknown";
+                                var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
+                                if (sys_currencyInfo != null)
                                 {
-                                    if (rowIndex > ChildTable1.Rows.Count - 1)
+                                    var sys_currencyCode = sys_currencyInfo.Name;
+                                    var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
+                                    if (eec_currencyInfo != null)
                                     {
-                                        var chitableRow = ChildTable1.LastRow.Clone(true);
-                                        ChildTable1.AppendChild(chitableRow);
+                                        currencyRate = eec_currencyInfo.Rate;
+                                        currencyCode = eec_currencyInfo.Name;
                                     }
-                                    int days = dac2.FindAll(x => x.Place == item.Place).Count;
-                                    SetCells(ChildTable1, doc, rowIndex, 0, item.Place);
-                                    SetCells(ChildTable1, doc, rowIndex, 1, days + "天");
-
-                                    string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
-                                    SetCells(ChildTable1, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
+                                }
 
-                                    var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
-                                    var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
-                                    if (sys_currencyInfo != null)
-                                    {
-                                        var sys_currencyCode = sys_currencyInfo.Name;
-                                        var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
-                                        if (eec_currencyInfo != null)
-                                        {
-                                            currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
-                                        }
-                                    }
+                                int days = dac2.FindAll(x => x.Place == item.Place).Count;
+                                SetCells(ChildTable1, doc, rowIndex, 0, item.Place);
+                                SetCells(ChildTable1, doc, rowIndex, 1, $"{days}天");
+                                SetCells(ChildTable1, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/天");
+                                SetCells(ChildTable1, doc, rowIndex, 3, "汇率" + currencyRate);
 
-                                    SetCells(ChildTable1, doc, rowIndex, 3, "汇率" + currencyRate);
-                                    SetCells(ChildTable1, doc, rowIndex, 4, "CNY " + item.SubTotal);
-                                    rowIndex++;
-                                    hsinfo += item.Place + "  " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + "   CNY " + item.SubTotal * days + "\r\n";
-                                }
+                                decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
+                                SetCells(ChildTable1, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}");
 
+                                totalMeal += currSubTotal;
+                                rowIndex++;
+                                hsinfo += $"{item.Place}  {days}天 {item.Cost:0.00}{currencyCode}/天 汇率{currencyRate:0.0000}   CNY{currSubTotal}\r\n";
                             }
                             placeArr.Clear();
 
+                            AllPrice += totalMeal;
+                            TeableBookmarkArr.Add("hs", $"{totalMeal} 元"); //伙食费
+                            TeableBookmarkArr.Add("hsinfo", hsinfo);        //伙食费详情
+
+                            decimal totalMisc= 0.00M;       // 公杂费合计
                             rowIndex = 0;
                             if (dac2.Count <= 0 && ChildTable2 != null) ChildTable2.Remove(); //删除表格
                             foreach (var item in dac3)
                             {
-                                if (string.IsNullOrWhiteSpace(item.Place))
-                                {
-                                    continue;
-                                }
+                                if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
 
-                                if (placeArr.Contains(item.Place))
-                                {
-                                    continue;
-                                }
-                                else
+                                placeArr.Add(item.Place);
+
+                                if (rowIndex > ChildTable2.Rows.Count - 1)
                                 {
-                                    placeArr.Add(item.Place);
+                                    var chitableRow = ChildTable2.LastRow.Clone(true);
+                                    ChildTable2.AppendChild(chitableRow);
                                 }
-                                if (!string.IsNullOrWhiteSpace(item.Place))
-                                {
-                                    if (rowIndex > ChildTable2.Rows.Count - 1)
-                                    {
-                                        var chitableRow = ChildTable2.LastRow.Clone(true);
-                                        ChildTable2.AppendChild(chitableRow);
-                                    }
-                                    int days = dac3.FindAll(x => x.Place == item.Place).Count;
-                                    SetCells(ChildTable2, doc, rowIndex, 0, item.Place);
-                                    SetCells(ChildTable2, doc, rowIndex, 1, days + "天");
-
-                                    string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
-                                    SetCells(ChildTable2, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
 
-                                    var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
-                                    var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
-                                    if (sys_currencyInfo != null)
+                                decimal currencyRate = item.SubTotal / item.Cost;
+                                string currencyCode = "Unknown";
+                                var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
+                                if (sys_currencyInfo != null)
+                                {
+                                    var sys_currencyCode = sys_currencyInfo.Name;
+                                    var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
+                                    if (eec_currencyInfo != null)
                                     {
-                                        var sys_currencyCode = sys_currencyInfo.Name;
-                                        var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
-                                        if (eec_currencyInfo != null)
-                                        {
-                                            currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
-                                        }
+                                        currencyRate = eec_currencyInfo.Rate;
+                                        currencyCode = eec_currencyInfo.Name;
                                     }
-                                    SetCells(ChildTable2, doc, rowIndex, 3, "汇率" + currencyRate);
-                                    SetCells(ChildTable2, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
-                                    rowIndex++;
-                                    gzinfo += item.Place + "  " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00") + "   CNY " + item.SubTotal * days + "\r\n";
                                 }
 
+                                int days = dac3.FindAll(x => x.Place == item.Place).Count;
+                                SetCells(ChildTable2, doc, rowIndex, 0, item.Place);
+                                SetCells(ChildTable2, doc, rowIndex, 1, $"{days}天");
+                                SetCells(ChildTable2, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/天");
+                                SetCells(ChildTable2, doc, rowIndex, 3, $"汇率{currencyRate:0.0000}");
+
+                                decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
+                                SetCells(ChildTable2, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}\r\n");
+                                totalMisc += currSubTotal;
+                                gzinfo += $"{item.Place}  {days}天 {item.Cost:0.00}{currencyCode}/天 汇率{currencyRate:0.0000}   CNY {currSubTotal:0.00}\r\n";
+                                rowIndex++;
                             }
                             placeArr.Clear();
+                            AllPrice += totalMisc;
 
-                            TeableBookmarkArr.Add("zsinfo", zsinfo); //住宿费详情
-                            TeableBookmarkArr.Add("hs", dac2.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //伙食费
-                            TeableBookmarkArr.Add("hsinfo", hsinfo); //伙食费详情
-                            TeableBookmarkArr.Add("gz", dac3.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //公杂费
-                            TeableBookmarkArr.Add("gzinfo", gzinfo); //公杂费详情
+                            TeableBookmarkArr.Add("gz",$"{totalMisc:0.00} 元"); //公杂费
+                            TeableBookmarkArr.Add("gzinfo", gzinfo);            //公杂费详情
 
                             string otherFeestr = "";
                             decimal otherFee = 0.00M;
@@ -1429,11 +1407,15 @@ namespace OASystem.API.Controllers
                                 otherFeestr += "等费用";
                             }
 
-                            TeableBookmarkArr.Add("qt", otherFee.ToString("#0.00") + " 元");//其他费用
+                            WordAllPrice += AllPrice;
+
+                            UsersTop +=  $"{firstName}出访费用为¥{AllPrice:0.00}元、";
+
+                            TeableBookmarkArr.Add("qt", $"{otherFee:0.00} 元");//其他费用
                             TeableBookmarkArr.Add("qtinfo", otherFeestr);//其他费用第二列
 
-                            TeableBookmarkArr.Add("fw", _EnterExitCosts.Service.ToString("#0.00") + "元/人");//服务费
-                            TeableBookmarkArr.Add("AllPrice", AllPrice.ToString("#0.00") + "元/人");//表格合计费用
+                            TeableBookmarkArr.Add("fw", $"{_EnterExitCosts.Service:0.00}元/人");//服务费
+                            TeableBookmarkArr.Add("AllPrice", $"{AllPrice:0.00}元/人");//表格合计费用
                             TeableBookmarkArr.Add("title", $"费用清单-{airName}({firstName})");
                             foreach (var book in TeableBookmarkArr.Keys)
                             {
@@ -1456,7 +1438,7 @@ namespace OASystem.API.Controllers
                             TeableBookmarkArr.Clear();
                         }
 
-                        bookmarkArr.Add("VisitPrice", WordAllPrice.ToString());//出访费用总额
+                        bookmarkArr.Add("VisitPrice", $"{WordAllPrice:0.00}");//出访费用总额
                         bookmarkArr.Add("CnAllPrice", WordAllPrice.ConvertCNYUpper());//出访费用总额中文
                         bookmarkArr.Add("namesPrice", UsersTop.TrimEnd('、'));//各人员出访费用  付辰同志出访费用为¥73,604.8元
 

+ 650 - 225
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -4692,6 +4692,7 @@ FROM
             { 3, "韩国" },
             { 4, "瑞典" },
             { 5, "波兰" },
+            { 6, "加拿大" },
         };
 
         /// <summary>
@@ -6472,9 +6473,11 @@ FROM
                             #endregion
                             #endregion
 
+                            // 申请人的家庭住址和电子邮箱地址
                             string applicantAddressAndEmail = $"{custInfo.Address} {custInfo.Email}";
-                            SetFieldValue(formFields, "applicant_address_and_email", applicantAddressAndEmail);   // 申请人的家庭住址和电子邮箱地址
-                            SetFieldValue(formFields, "applicant_tel", custInfo.Tel);   // 申请人的电话
+                            SetFieldValue(formFields, "applicant_address_and_email", applicantAddressAndEmail);
+                            // 申请人的电话
+                            SetFieldValue(formFields, "applicant_tel", custInfo.Tel);   
 
                             #region 在非当前国籍所属国家的居住情况 “默认空”
                             SetFieldValue(formFields, "uncurrent_count_no", "Yes");      // 否
@@ -6484,352 +6487,774 @@ FROM
                             SetFieldValue(formFields, "uncurrent_country_valid_until", "");// 有效期至
                             #endregion
 
+                            #region 职业
+                            //职业信息
+                            if (companyInfos != null && companyInfos.Count > 0)
+                            {
+                                // 当前职业
+                                SetFieldValue(formFields, "current_occupation", companyInfos.FirstOrDefault()?.Job ?? "");
+                                //雇主及雇主的地址和电话号码。对于学生而言,应填写教育机构的名称及地址
+                                string employerInfo = $"{companyInfos.FirstOrDefault()?.CompanyAddress ?? ""} {companyInfos.FirstOrDefault()?.Phone ?? ""}";
+                            }
 
+                            #endregion
 
+                            #region 此次行程的目的
 
-                            string selected = "√";
+                            //清除值
+                            SetFieldValue(formFields, "purpose_tourism", "Off");                // 旅游
+                            SetFieldValue(formFields, "purpose_business", "Off");               // 商务
+                            SetFieldValue(formFields, "purpose_visiting_family_friends", "Off");// 庆祝亲友团聚
+                            SetFieldValue(formFields, "purpose_cultural", "Off");               // 文化交流
+                            SetFieldValue(formFields, "purpose_sports", "Off");                 // 体育活动
+                            SetFieldValue(formFields, "purpose_offcial_visit", "Off");          // 官方访问
+                            SetFieldValue(formFields, "purpose_medical_reasons", "Off");        // 医疗原因
+                            SetFieldValue(formFields, "purpose_study", "Off");                  // 学习
+                            SetFieldValue(formFields, "purpose_airport_transit", "Off");        // 机场中转
+                            SetFieldValue(formFields, "purpose_other", "Off");                  // 其他
+                            SetFieldValue(formFields, "purpose_other_remark", "");              // 其他 - 备注
 
-                            #region 1. 个人信息
+                            var visit_purpose = groupInfo.VisitPurpose;
+                            if (!string.IsNullOrEmpty(visit_purpose))
+                            {
+                                if (visit_purpose.contains("旅游"))
+                                {
+                                    SetFieldValue(formFields, "purpose_tourism", "Yes");                // 旅游
+                                }
+                                else if (visit_purpose.contains("商务"))
+                                {
+                                    SetFieldValue(formFields, "purpose_business", "Yes");               // 商务
+                                }
+                                else if (visit_purpose.contains("亲友") )
+                                {
+                                    SetFieldValue(formFields, "purpose_visiting_family_friends", "Yes");// 庆祝亲友团聚
+                                }
+                                else if (visit_purpose.contains("文化交流") || visit_purpose.contains("旅游"))
+                                {
+                                    SetFieldValue(formFields, "purpose_cultural", "Yes");               // 文化交流
+                                }
+                                else if (visit_purpose.contains("体育") || visit_purpose.contains("活动"))
+                                {
+                                    SetFieldValue(formFields, "purpose_sports", "Yes");                 // 体育活动
+                                }
+                                else if (visit_purpose.contains("官方访问"))
+                                {
+                                    SetFieldValue(formFields, "purpose_offcial_visit", "Yes");          // 官方访问
+                                }
+                                else if (visit_purpose.contains("医疗原因") || visit_purpose.contains("医疗"))
+                                {
+                                    SetFieldValue(formFields, "purpose_medical_reasons", "Yes");        // 医疗原因
+                                }
+                                else if (visit_purpose.contains("学习"))
+                                {
+                                    SetFieldValue(formFields, "purpose_study", "Yes");                  // 学习
+                                }
+                                else if (visit_purpose.contains("机场中转"))
+                                {
+                                    SetFieldValue(formFields, "purpose_airport_transit", "Yes");        // 机场中转
+                                }
+                                else
+                                {
+                                    SetFieldValue(formFields, "purpose_other", "Yes");                  // 其他
+                                    SetFieldValue(formFields, "purpose_other_remark", "");              // 其他 - 备注
+                                }
+                            }
 
-                            #region 是否曾用别名从韩国出入境
-                            SetFieldValue(formFields, "applicant_no", selected);   // 否 默认选中
-                            SetFieldValue(formFields, "applicant_yes", "");
+                            #endregion
 
-                            string isGetSchengenStr = custInfo.IsGetSchengen == 0 ? "否" : "是";
-                            string oldName = custInfo?.OldName ?? "";
-                            if (!string.IsNullOrEmpty(oldName) && isGetSchengenStr.equals("是"))
+                            #region 目的国相关信息
+
+                            //关于停留目的的补充说明
+                            SetFieldValue(formFields, "purpose_stay_info", "");
+
+                            string[] RD_country = new string[] { };  //接收处理的国家
+
+                            string firstEntryLabel = string.Empty; // 首入申根国标签
+                            string membeDescLabel = string.Empty;  // 申根国目的地
+                            string RuJingTime = string.Empty;      // 入境时间
+                            string LiJingTime = string.Empty;      // 离境时间
+                            string stopDays = string.Empty;        // 停留天数
+                            if (!string.IsNullOrEmpty(groupInfo.VisitCountry))
                             {
-                                SetFieldValue(formFields, "applicant_no", "");
-                                SetFieldValue(formFields, "applicant_yes", selected);
-                                if (!string.IsNullOrEmpty(oldName))
+                                List<string> SGGNames = new List<string>();//接收处理后的国家  是申根国
+                                if (groupInfo.VisitCountry.Contains(","))
+                                    RD_country = groupInfo.VisitCountry.Split(',');
+                                else if (groupInfo.VisitCountry.Contains(' '))
+                                    RD_country = groupInfo.VisitCountry.Split(' ');
+                                else if (groupInfo.VisitCountry.Contains(","))
+                                    RD_country = groupInfo.VisitCountry.Split(',');
+                                else if (groupInfo.VisitCountry.Contains("、"))
+                                    RD_country = groupInfo.VisitCountry.Split('、');
+                                else if (groupInfo.VisitCountry.Contains("|"))
+                                    RD_country = groupInfo.VisitCountry.Split('|');
+
+                                //判断是否是申根国家
+                                for (int i = 0; i < RD_country.Length; i++)
                                 {
-                                    SetFieldValue(formFields, "former_surname", oldName.Substring(0, 1));
-                                    SetFieldValue(formFields, "former_given_name", oldName.Remove(0, 1));
+                                    if (RD_country[i].ToString() != null)
+                                    {
+                                        //在申根国家中筛选 该国家是否是申根国家
+                                        for (int j = 0; j < _shenGenGuos.Length; j++)
+                                        {
+                                            if (RD_country[i] == _shenGenGuos[j])
+                                                SGGNames.Add(_shenGenGuos[j]); //添加申根国
+                                        }
+                                    }
+                                }
+
+                                //目的地国是否有申根国
+                                if (SGGNames.Count > 0)
+                                {
+                                    firstEntryLabel = SGGNames.First();
+                                    membeDescLabel = string.Join(",", SGGNames.ToArray());
+
+                                    //接收生根国详细信息  存储顺序 起飞日期:Day 起飞时刻:StartTime  抵达日期:ArrivedDate 到达时刻:EndTime
+                                    List<SSGDetails> ListSSGDetails = new List<SSGDetails>();
+
+                                    //处理申根国家 预定到达时间  预定离开时间 预定停留天数   
+                                    for (int i = 0; i < SGGNames.Count; i++)
+                                    {
+                                        //在相同的国家下  得到该航班的信息  //抵达时间 起飞日期:Day   起飞时刻:StartTime  到达时刻:EndTime  抵达日期:ArrivedDate 飞行时间:FlightTime  航司  Fliagtcode  入境口岸 
+                                        var atbc = GeneralMethod.GetTableByBlackCode(groupId);
+                                        //ResidenceTime1 机票三字码信息
+                                        if (atbc != null)
+                                        {
+                                            string HL_Three = ""; //三字码  Three  
+
+                                            for (int j = 0; j < atbc.Rows.Count; j++)
+                                            {
+                                                HL_Three = atbc.Rows[j]["Three"].ToString();
+
+                                                if (!string.IsNullOrEmpty(HL_Three))
+                                                {
+                                                    string threeCodeTwo = HL_Three.Substring(3);
+                                                    var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == threeCodeTwo).First();
+                                                    if (tc != null)
+                                                    {
+                                                        //首入申根国时间
+                                                        if (SGGNames[i] == tc.Country)
+                                                        {
+                                                            SSGDetails SSGDetails = new SSGDetails()
+                                                            {
+                                                                Three = atbc.Rows[j]["Three"].ToString(),           //三字码
+                                                                Fliagtcode = atbc.Rows[j]["Fliagtcode"].ToString(), //航司
+                                                                startDate = atbc.Rows[j]["Day"].ToString(),        //整理起飞日期
+                                                                startTime = atbc.Rows[j]["StartTime"].ToString(),  //整理起飞时刻
+                                                                endDate = atbc.Rows[j]["ArrivedDate"].ToString(),  //整理抵达日期
+                                                                endTime = atbc.Rows[j]["EndTime"].ToString()       //整理抵达时刻
+                                                            };
+                                                            ListSSGDetails.Add(SSGDetails);
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                    ListSSGDetails.Sort((a, b) => a.startDate.CompareTo(b.startDate));
+                                    //得到并计算出入境时间
+                                    if (ListSSGDetails != null)
+                                    {
+                                        RuJingTime = ListSSGDetails.First().endDate + " " + ListSSGDetails.First().endTime.Substring(0, 2) + ":" + ListSSGDetails.First().endTime.Substring(2);  //入境时间
+                                        LiJingTime = ListSSGDetails[ListSSGDetails.Count - 1].startDate + " " + ListSSGDetails[ListSSGDetails.Count - 1].endTime.Substring(0, 2) + ":" + ListSSGDetails[ListSSGDetails.Count - 1].endTime.Substring(2); //离境时间
+
+                                        stopDays = Convert.ToDateTime(LiJingTime).Subtract(Convert.ToDateTime(RuJingTime)).Days.ToString();
+                                    }
                                 }
                             }
 
+                            SetFieldValue(formFields, "main_destination", membeDescLabel);  // 主要目的地成员国(如适用,还包括目的地的其他成员国)
+                            SetFieldValue(formFields, "first_entry", firstEntryLabel);      // 首次加入的成员国
+
+                            // 申请入境次数
+                            SetFieldValue(formFields, "entries_requested_single", "Off");   // 一次入境
+                            SetFieldValue(formFields, "entries_requested_two", "Off");      // 两次入境
+                            SetFieldValue(formFields, "entries_requested_multiple", "Off"); // 多次入境
+
+                            SetFieldValue(formFields, "first_schenggen_stay_arrival_date", RuJingTime);   // 首次计划在申根区停留的预计抵达日期
+                            SetFieldValue(formFields, "first_schenggen_stay_departure_date", LiJingTime); // 首次计划在申根区停留结束后离开申根区的预计离境日期
+
                             #endregion
 
-                            #region 是否拥有双重国籍
-                            SetFieldValue(formFields, "dual_citizenship_no", selected);   // 否 默认选中
-                            SetFieldValue(formFields, "dual_citizenship_yes", "");
-                            SetFieldValue(formFields, "dual_citizenship_remark", "");
+                            #region 申请申根签证而先前采集的指纹
+                            SetFieldValue(formFields, "schengen_visa_no", "");        // 否 
+                            SetFieldValue(formFields, "schengen_visa_yes", "");       // 是 
+                            SetFieldValue(formFields, "fingerpints_date", "");        // 如有,请写明日期
+                            SetFieldValue(formFields, "fingerpints_visa_number", ""); // 如有,请写明签证贴纸号码
                             #endregion
 
+                            #region 最终目的地国家的入境许可(如适用)
+                            SetFieldValue(formFields, "entry_permit_country_issued", ""); // 颁发单位
+                            SetFieldValue(formFields, "entry_permit_country_valid", "");  // 颁发日期
+                            SetFieldValue(formFields, "entry_permit_country_until", "");  // 有效期限
                             #endregion
 
-                            #region 2. 申请签证信息
+                            #region 招待方在成员国中的姓氏和名字。如无此信息,则填写成员国内的酒店或临时住宿场所的名称
+                            var hotelInfo = _sqlSugar.Queryable<Grp_HotelReservations>()
+                                .Where(x => x.DiId == groupId)
+                                //.Where(x => x.City.contains(city))
+                                .First();
+                            //酒店住址
+                            if (hotelInfo != null)
+                            {
+                                SetFieldValue(formFields, "hotel_namee", hotelInfo?.HotelName ?? ""); // 招待方的地址和电子邮箱地址 
+                                var otherInfo = $"{hotelInfo.HotelAddress}";
+                                SetFieldValue(formFields, "hotel_address_and_email", otherInfo);      // 酒店/临时住宿场所的地址和电子邮箱地址 
+                                SetFieldValue(formFields, "hotel_tel", hotelInfo?.HotelTel ?? "");    // 电话号码
+                            }
+                            #endregion
 
-                            //SetFieldValue(formFields, "overstay_period_over_90_days", selected);  // 90天以上长期滞留
-                            //SetFieldValue(formFields, "overstay_period_under_90_days", selected); // 90天以下短期滞留
-                            //SetFieldValue(formFields, "overstay_period_status", "");         // 滞留资格
+                            #region 邀请公司/组织信息
+                            var oa = _sqlSugar.Queryable<Res_OfficialActivities>()
+                                   .Where(x => x.IsDel == 0 && x.DiId == groupId)
+                                   //.Where(x => x.Country.Contains(county))
+                                   //.Where(x => x.Area.Contains(city))
+                                   .First();
+                            if (oa != null)
+                            {
+                                string oaInfo = $"{oa.Client} {oa.Address}";
+                                SetFieldValue(formFields, "inviting_name_and_address", oaInfo);   // 邀请公司/组织的名称及地址
+                                string contactInfo = $"{oa?.Contact ?? ""} {oa?.Tel ?? ""} {oa?.EmailOrWeChat ?? ""}";
+                                SetFieldValue(formFields, "inviting_contact_Info", contactInfo);  // 公司/组织中联系人的姓氏、名字、地址、电话号码以及电子邮箱地址
+                                SetFieldValue(formFields, "inviting_company_tel", oa?.Tel ?? ""); //电话号码(关于)公司/组织
+                            }
+                            #endregion
 
+                            #region 申请人在留宿期间的旅行及生活费用已由申请人本人承担
+
+                            #region 支持方式
+
+                            SetFieldValue(formFields, "cost_type_himself", "Off");              // 支持方式
+                            SetFieldValue(formFields, "cost_type_himself_cash", "Off");         // 现金
+                            SetFieldValue(formFields, "cost_type_himself_cheques", "Off");      // 旅行支票
+                            SetFieldValue(formFields, "cost_type_himself_creditcard", "Off");   // 信用卡
+                            SetFieldValue(formFields, "cost_type_himself_accommodation", "Off");// 预付费住宿
+                            SetFieldValue(formFields, "cost_type_himself_transport", "Off");    // 预付费交通
+                            SetFieldValue(formFields, "cost_type_himself_other", "Off");        // 其他
+                            SetFieldValue(formFields, "cost_type_himself_other_specify", "");   // 其他(请具体说明)
                             #endregion
 
+                            #region 由赞助方(主办方、公司、组织)提供
 
+                            SetFieldValue(formFields, "cost_type_himself", "Off");            // 由赞助方(主办方、公司、组织)提供
+                            SetFieldValue(formFields, "cost_type_himself_cash", "Off");       // 在第 30 或 31 栏中提及
+                            SetFieldValue(formFields, "cost_type_sponsor_other", "Off");      // 其他
+                            SetFieldValue(formFields, "cost_type_sponsor_other_specify", ""); // 其他(请具体说明
 
-                            #region 4. 联系信息
+                            //支持方式
+                            SetFieldValue(formFields, "cost_type_support_cash", "Off");       // 现金
+                            SetFieldValue(formFields, "cost_type_support_provided", "Off");   // 提供住宿
+                            SetFieldValue(formFields, "cost_type_support_covered", "Off");    // 旅行期间的所有费用均由主办方承担
+                            SetFieldValue(formFields, "cost_type_support_transport", "Off");  // 预先支付的交通费用
+                            SetFieldValue(formFields, "cost_type_support_other", "Off");      // 其他
+                            SetFieldValue(formFields, "cost_type_support_other_specify", ""); // 其他(请具体说明
+                            #endregion
 
-                            SetFieldValue(formFields, "contact_info_address", custInfo.Address);  // 本国地址 
-                            SetFieldValue(formFields, "contact_info_current_adress", "");         // 现居住地址,如与本国地址不同填写 
-                            SetFieldValue(formFields, "contact_info_tel_or_phone", custInfo.Tel); // 电话
-                            SetFieldValue(formFields, "contact_info_email", custInfo.Email);      // 电子邮件
+                            #endregion
 
-                            #region 紧急联系人
-                            //默认没有
-                            SetFieldValue(formFields, "contact_info_emergency_name", "");         // 姓名 
-                            SetFieldValue(formFields, "contact_info_emergency_country", "");      // 居住国家 
-                            SetFieldValue(formFields, "contact_info_emergency_tel", "");          // 电话 
-                            SetFieldValue(formFields, "contact_info_emergency_relationship", ""); // 关系 
+                            #region 填写申请表的人员的姓氏和名字(若与申请人姓名不同)
+                            SetFieldValue(formFields, "application_form_name", custInfo.TableOpName);  // 申请表的人员
+                            SetFieldValue(formFields, "application_form_address_email", "");   // 申请表人员的地址及电子邮箱地址
+                            SetFieldValue(formFields, "assistance_tel", custInfo.TableOpTel);  // 电话号码
                             #endregion
 
+                            var date_year = DateTime.Now.Year.ToString();
+                            var date_month = DateTime.Now.Month.ToString();
+                            var date_day = DateTime.Now.Day.ToString();
+                            SetFieldValue(formFields, "place_and_date", DateTime.Now.ToString("yyyy-MM-dd"));   // 申请日期
+                            var applicant_name = custInfo.LastName + custInfo.FirstName;
+                            SetFieldValue(formFields, "applicant_signature", applicant_name); // 申请人姓名
+                            SetFieldValue(formFields, "signature_parental_info", "");         // (如适用,需签名的家长授权/监护人信息):
+
                             #endregion
 
-                            #region 5. 婚姻状况及家庭成员信息
+                            filePaths.Add(outputPath);
+                        }
+                        catch (Exception ex)
+                        {
+                            return Ok(JsonView(false, $"生成PDF文件时出错:{ex.Message}"));
+                        }
+                        finally
+                        {
+                            // 按正确顺序关闭资源
+                            stamper?.Close();
+                            reader?.Close();
+                            templateStream?.Close();
+                            outputStream?.Close();
+                        }
+                        #endregion
+                    }
 
+                    break;
+                case 6:  // 加拿大
 
-                            //子女信息
-                            SetFieldValue(formFields, "famliy_children_no", selected);  // 否
-                            SetFieldValue(formFields, "famliy_children_yes", "");  // 是
-                            if (currFamilyInfos.Count > 0)
+                    visaTypeName = $"加拿大签证申请表";
+                    currTempPath = $"{tempPath}{visaTypeName}.pdf";
+
+                    var canadaSavePath = $"{fileServerPath}{visaTypeName}/";
+                    if (!Directory.Exists(canadaSavePath)) Directory.CreateDirectory(canadaSavePath);
+
+                    if (!System.IO.File.Exists(currTempPath))
+                    {
+                        return Ok(JsonView(false, $"{currTempPath}模板不存在!"));
+                    }
+
+                    foreach (var custInfo in groupCustInfos)
+                    {
+                        EncryptionProcessor.DecryptProperties(custInfo);
+
+                        var idInfo = certInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.PassportType == 773);
+                        var passportInfo = certInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.PassportType == 774);
+                        var clinetInfo = companyInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.Id == custInfo.CrmCompanyId);
+                        var currSchoolInfos = schoolInfos.Where(x => x.DcId == custInfo.Id).ToList();
+                        var currFamilyInfos = familyInfos.Where(x => x.DcId == custInfo.Id).ToList();
+                        var currCompanyInfos = companyInfos.Where(x => x.DcId == custInfo.Id).ToList();
+
+                        #region 生成文件
+
+                        PdfReader reader = null;
+                        FileStream templateStream = null;
+                        FileStream outputStream = null;
+                        PdfStamper stamper = null;
+
+                        try
+                        {
+                            string outputPath = $"{canadaSavePath}{custInfo.LastName}{custInfo.FirstName}.pdf";
+
+                            //读取模板文件
+                            templateStream = new FileStream(currTempPath, FileMode.Open, FileAccess.Read, FileShare.Read);
+                            reader = new PdfReader(templateStream);
+
+                            //创建输出文件
+                            outputStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write);
+                            stamper = new PdfStamper(reader, outputStream);
+
+                            AcroFields formFields = stamper.AcroFields;
+
+                            #region 设置文本值
+
+                            SetFieldValue(formFields, "surname", CommonFun.ConvertToPinyin(custInfo?.LastName?.Trim() ?? "")?.ToLower() ?? "");       // 姓 英文
+                            SetFieldValue(formFields, "surname_birth", CommonFun.ConvertToPinyin(custInfo?.LastName?.Trim() ?? "")?.ToLower() ?? ""); // 出生时姓 英文
+                            SetFieldValue(formFields, "first_name", CommonFun.ConvertToPinyin(custInfo?.FirstName?.Trim() ?? "")?.ToLower() ?? "");   // 名 英文
+
+                            #region 出生日期(日-月-年)
+                            string idCard = idInfo?.CertNo?.Trim() ?? "";
+                            string birthday = string.Empty;
+                            if (!string.IsNullOrEmpty(idCard))
                             {
-                                // 定义接受子女人数
-                                int children = currFamilyInfos.Where(x => x.Appellation.contains("儿子") || x.Appellation.contains("女儿")).ToList().Count;
+                                string year = idCard.Substring(6, 4);
+                                string month = idCard.Substring(10, 2);
+                                string day = idCard.Substring(12, 2);
+                                birthday = day + "-" + month + "-" + year;
+                            }
+                            SetFieldValue(formFields, "birthday", birthday);
+                            #endregion
 
-                                // 判断子女人数
-                                if (children > 0)
-                                {
-                                    SetFieldValue(formFields, "famliy_children_yes", selected);
-                                    SetFieldValue(formFields, "famliy_children_number", children.ToString()); // 子女人数
-                                }
+                            var area = custInfo.BirthProvince + custInfo.BirthCity;
+                            SetFieldValue(formFields, "birth_place", area);           // 出生地区
+                            SetFieldValue(formFields, "birth_country", "中国");       // 出生国籍
+                            SetFieldValue(formFields, "current_nationality", "中国"); // 现国籍
+                            SetFieldValue(formFields, "birth_nationality", "中国");   // 出生国
+                            SetFieldValue(formFields, "other_nationality", "");       // 其他国籍
+
+                            #region 设置性别
+                            //清除性别
+                            SetFieldValue(formFields, "sex_male", "Off");   // 性别 - 男
+                            SetFieldValue(formFields, "sex_female", "Off"); // 性别 - 女
+                            SetFieldValue(formFields, "sex_other", "Off");  // 性别 - 其他
+                            //设置性别
+                            if (custInfo.Sex == 0) // 男
+                            {
+                                SetFieldValue(formFields, "sex_male", "Yes");   // 性别 - 男
+                            }
+                            else if (custInfo.Sex == 1) // 女
+                            {
+                                SetFieldValue(formFields, "sex_female", "Yes"); // 性别 - 女
                             }
+                            else  // 其他
+                            {
+                                SetFieldValue(formFields, "sex_other", "Yes"); // 性别 - 其他
+                            }
+                            #endregion
+
+                            #region 婚姻状态
+                            //清除婚姻状况
+                            SetFieldValue(formFields, "civil_single", "Off");                  // 婚姻状况 - 未婚
+                            SetFieldValue(formFields, "civil_married", "Off");                 // 婚姻状况 - 已婚
+                            SetFieldValue(formFields, "civil_registerered_partnership", "Off");// 婚姻状况 - 注册伴侣关系
+                            SetFieldValue(formFields, "civil_separated", "Off");               // 婚姻状况 - 分居
+                            SetFieldValue(formFields, "civil_divorced", "Off");                // 婚姻状况 - 离异
+                            SetFieldValue(formFields, "civil_windower", "Off");                // 婚姻状况 - 妻子(丈夫)去世
+                            SetFieldValue(formFields, "civil_other", "Off");                   // 婚姻状况 - 其他
+                            SetFieldValue(formFields, "civil_other_details", "");              // 婚姻状况 - 其他(请具体说明)
+                            //设置婚姻状况
+                            switch (custInfo.Marriage)
+                            {
+                                case 1: // 未婚
+                                    break;
+                                case 2: // 已婚
+                                    SetFieldValue(formFields, "civil_married", "Yes");
+                                    break;
+                                case 3: // 离婚/离异
+                                    SetFieldValue(formFields, "civil_divorced", "Yes");
+                                    break;
+                                case 4:
 
+                                    break;
+                            }
                             #endregion
 
-                            #region 6. 学历
-                            SetFieldValue(formFields, "education_masters_or_doctoral_degree", "");// 博士/硕士
-                            SetFieldValue(formFields, "education_bachelors_degree", "");          // 学士
-                            SetFieldValue(formFields, "education_hight_school_diploma", "");      // 高中
-                            SetFieldValue(formFields, "education_other", "");                     // 其他
-                            SetFieldValue(formFields, "education_other_remark", "");              // 其他 - 备注
+                            // 父母的监护权(针对未成年人)/法定监护人(姓氏、名字、地址(若与申请人的地址不同)、电话号码、电子邮箱地址以及国籍)
+                            SetFieldValue(formFields, "parental_authority", "");
+                            //(如适用)国民身份号码
+                            SetFieldValue(formFields, "id_number", idCard);
 
-                            if (custInfo.HighestEducation.Contains("硕士") || custInfo.HighestEducation.Contains("博士"))
-                                SetFieldValue(formFields, "education_masters_or_doctoral_degree", selected);
-                            else if (custInfo.HighestEducation.Contains("学士"))
-                                SetFieldValue(formFields, "education_bachelors_degree", selected);
-                            else if (custInfo.HighestEducation.Contains("高中"))
-                                SetFieldValue(formFields, "education_hight_school_diploma", selected);
-                            else
+                            #region 护照信息
+                            //清除值
+                            SetFieldValue(formFields, "travel_type_ordinary_passport", "Off");    // 旅行证件类型 - 普通护照
+                            SetFieldValue(formFields, "travel_type_diplomatic_passport", "Off");  // 旅行证件类型 - 外交护照
+                            SetFieldValue(formFields, "travel_type_service_passport", "Off");     // 旅行证件类型 - 服务护照
+                            SetFieldValue(formFields, "travel_type_offical_passport", "Off");     // 旅行证件类型 - 公务护照
+                            SetFieldValue(formFields, "travel_type_special_passport", "Off");     // 旅行证件类型 - 特别护照
+                            SetFieldValue(formFields, "travel_type_other_passport_details", "");  // 其他旅行证件(请注明)
+                            //设置值
+                            if (passportInfo != null)
                             {
-                                SetFieldValue(formFields, "education_other", selected);
-                                SetFieldValue(formFields, "education_other_remark", custInfo.HighestEducation.Trim());
+                                // 签证类型
+                                var visatypeInfo = await _sqlSugar.Queryable<Sys_SetData>().FirstAsync(x => x.Id == passportInfo.PassportType);
+                                if (visatypeInfo != null)
+                                {
+                                    string visaName = visatypeInfo?.Name ?? "-";
+                                    if (visaName.contains("普通")) SetFieldValue(formFields, "travel_type_ordinary_passport", "Yes");        // 旅行证件类型 - 普通护照
+                                    else if (visaName.contains("外交")) SetFieldValue(formFields, "travel_type_diplomatic_passport", "Yes"); // 旅行证件类型 - 外交护照
+                                    else if (visaName.contains("服务")) SetFieldValue(formFields, "travel_type_service_passport", "Yes");    // 旅行证件类型 - 服务护照
+                                    else if (visaName.contains("公务")) SetFieldValue(formFields, "travel_type_offical_passport", "Yes");    // 旅行证件类型 - 公务护照
+                                    else                                                                                                     // 旅行证件类型 - 特别护照
+                                    {
+                                        SetFieldValue(formFields, "travel_type_other_passport", "Yes");
+                                        SetFieldValue(formFields, "travel_type_other_passport_details", "");
+                                    }
+                                }
+
+                                #region 护照信息
+                                SetFieldValue(formFields, "travel_number", passportInfo.CertNo);         // 签证 编号
+                                SetFieldValue(formFields, "travel_issue_country", passportInfo.Country); // 签发 国
+                                SetFieldValue(formFields, "travel_issue_date", passportInfo.IssueDt?.ToString("yyyy-MM-dd") ?? "");  // 签发日期
+                                SetFieldValue(formFields, "travel_issue_vaild", passportInfo.ExpiryDt?.ToString("yyyy-MM-dd") ?? ""); // 有效期至
+                                #endregion
                             }
 
-                            SetFieldValue(formFields, "education_school_name", "");               // 学校名称
-                            SetFieldValue(formFields, "education_school_address", "");            // 学校地址
                             #endregion
 
-                            #region 7. 职业
+                            #region 适用情况下,欧盟、欧洲经济区或瑞士公民,或英国籍且为《欧盟-英国脱欧协议》受益人的家庭成员的个人资料 “默认空”
 
-                            //清除值
-                            SetFieldValue(formFields, "employment_entreeneur", "");    // 事业家
-                            SetFieldValue(formFields, "employment_self_employed", ""); // 自雇
-                            SetFieldValue(formFields, "employment_employed", "");      // 公司职员
-                            SetFieldValue(formFields, "employment_civil_servant", selected);// 公务员 默认
-                            SetFieldValue(formFields, "employment_student", "");       // 学生
-                            SetFieldValue(formFields, "employment_retired", "");       // 退休
-                            SetFieldValue(formFields, "employment_unemployed", "");    // 无业
-                            SetFieldValue(formFields, "employment_other", "");         // 其他
-                            SetFieldValue(formFields, "employment_other_remark", "");  // 其他 - 备注
+                            SetFieldValue(formFields, "eu_info_surname", "");      // 姓氏(家族名)
+                            SetFieldValue(formFields, "eu_info_first_name", "");  // 名字(名字)
+                            SetFieldValue(formFields, "eu_info_birthday", "");    // 出生日期 (日-月-年)
+                            SetFieldValue(formFields, "eu_info_nationality", ""); // 国籍
+                            SetFieldValue(formFields, "eu_info_id_number", "");   // 旅行证件或身份证号码
+
+                            #region 与欧盟、欧洲经济区或瑞士公民,或作为《欧盟-英国脱欧协议》受益人的英国国民之间的家庭关系(如适用)
+                            SetFieldValue(formFields, "eu_family_relationship_spouse", "Off");      // 夫妻
+                            SetFieldValue(formFields, "eu_family_relationship_child", "Off");       // 子女
+                            SetFieldValue(formFields, "eu_family_relationship_grandchild", "Off");  // 孙子女
+                            SetFieldValue(formFields, "eu_family_relationship_ascendant", "Off");   // 有赡养关系的长辈
+                            SetFieldValue(formFields, "eu_family_relationship_registered", "Off");  // 注册伴侣关系
+                            #endregion
+                            #endregion
+
+                            // 申请人的家庭住址和电子邮箱地址
+                            string applicantAddressAndEmail = $"{custInfo.Address} {custInfo.Email}";
+                            SetFieldValue(formFields, "applicant_address_and_email", applicantAddressAndEmail);
+                            // 申请人的电话
+                            SetFieldValue(formFields, "applicant_tel", custInfo.Tel);
 
+                            #region 在非当前国籍所属国家的居住情况 “默认空”
+                            SetFieldValue(formFields, "uncurrent_count_no", "Yes");      // 否
+                            SetFieldValue(formFields, "uncurrent_count_yes", "Off");     // 是
+                            SetFieldValue(formFields, "uncurrent_country_residence", "");// 居留许可或同等证明
+                            SetFieldValue(formFields, "uncurrent_country_no", "");        // No
+                            SetFieldValue(formFields, "uncurrent_country_valid_until", "");// 有效期至
+                            #endregion
+
+                            #region 职业
                             //职业信息
                             if (companyInfos != null && companyInfos.Count > 0)
                             {
-                                SetFieldValue(formFields, "employment_name", companyInfos.FirstOrDefault()?.Company ?? ""); // 单位名称
-                                SetFieldValue(formFields, "employment_position", companyInfos.FirstOrDefault()?.Job ?? ""); // 职业
-                                SetFieldValue(formFields, "employment_address", companyInfos.FirstOrDefault()?.CompanyAddress ?? ""); // 地址
-                                SetFieldValue(formFields, "employment_tel", companyInfos.FirstOrDefault()?.Phone ?? "");    // 电话
+                                // 当前职业
+                                SetFieldValue(formFields, "current_occupation", companyInfos.FirstOrDefault()?.Job ?? "");
+                                //雇主及雇主的地址和电话号码。对于学生而言,应填写教育机构的名称及地址
+                                string employerInfo = $"{companyInfos.FirstOrDefault()?.CompanyAddress ?? ""} {companyInfos.FirstOrDefault()?.Phone ?? ""}";
                             }
 
                             #endregion
 
-                            #region 8. 访问信息
+                            #region 此次行程的目的
 
-                            //入境事由 
                             //清除值
-                            SetFieldValue(formFields, "korea_tourism", "");          // 旅游/过境
-                            SetFieldValue(formFields, "korea_meeting", "");          // 参加会议等活动
-                            SetFieldValue(formFields, "korea_medical_tourism", "");  // 医疗旅游
-                            SetFieldValue(formFields, "korea_business", "");         // 短期商务
-                            SetFieldValue(formFields, "korea_study", "");            // 学习/培训
-                            SetFieldValue(formFields, "korea_work", "");             // 就业活动
-                            SetFieldValue(formFields, "korea_trade", "");            // 贸易/投资/派驻
-                            SetFieldValue(formFields, "korea_visiting_family", "");  // 探亲访友
-                            SetFieldValue(formFields, "marriage_migrant", "");       // 结婚移民
-                            SetFieldValue(formFields, "korea_diplomatic", "");       // 外交/公务
-                            SetFieldValue(formFields, "korea_other", "");            // 其他
-                            SetFieldValue(formFields, "korea_other_details", "");    // 其他 - 备注
+                            SetFieldValue(formFields, "purpose_tourism", "Off");                // 旅游
+                            SetFieldValue(formFields, "purpose_business", "Off");               // 商务
+                            SetFieldValue(formFields, "purpose_visiting_family_friends", "Off");// 庆祝亲友团聚
+                            SetFieldValue(formFields, "purpose_cultural", "Off");               // 文化交流
+                            SetFieldValue(formFields, "purpose_sports", "Off");                 // 体育活动
+                            SetFieldValue(formFields, "purpose_offcial_visit", "Off");          // 官方访问
+                            SetFieldValue(formFields, "purpose_medical_reasons", "Off");        // 医疗原因
+                            SetFieldValue(formFields, "purpose_study", "Off");                  // 学习
+                            SetFieldValue(formFields, "purpose_airport_transit", "Off");        // 机场中转
+                            SetFieldValue(formFields, "purpose_other", "Off");                  // 其他
+                            SetFieldValue(formFields, "purpose_other_remark", "");              // 其他 - 备注
 
                             var visit_purpose = groupInfo.VisitPurpose;
                             if (!string.IsNullOrEmpty(visit_purpose))
                             {
-                                if (visit_purpose.contains("旅游") || visit_purpose.contains("过境"))
-                                {
-                                    SetFieldValue(formFields, "korea_tourism", selected);  // 旅游/过境
-                                }
-                                else if (visit_purpose.contains("会议") || visit_purpose.contains("活动"))
+                                if (visit_purpose.contains("旅游"))
                                 {
-                                    SetFieldValue(formFields, "korea_meeting", selected);          // 参加会议等活动
+                                    SetFieldValue(formFields, "purpose_tourism", "Yes");                // 旅游
                                 }
-                                else if (visit_purpose.contains("医疗") || visit_purpose.contains("旅游"))
+                                else if (visit_purpose.contains("商务"))
                                 {
-                                    SetFieldValue(formFields, "korea_medical_tourism", selected);  // 医疗旅游
+                                    SetFieldValue(formFields, "purpose_business", "Yes");               // 商务
                                 }
-                                else if (visit_purpose.contains("短期商务") || visit_purpose.contains("商务"))
+                                else if (visit_purpose.contains("亲友"))
                                 {
-                                    SetFieldValue(formFields, "korea_business", selected);         // 短期商务
+                                    SetFieldValue(formFields, "purpose_visiting_family_friends", "Yes");// 庆祝亲友团聚
                                 }
-                                else if (visit_purpose.contains("学习") || visit_purpose.contains("培训"))
+                                else if (visit_purpose.contains("文化交流") || visit_purpose.contains("旅游"))
                                 {
-                                    SetFieldValue(formFields, "korea_study", selected);         // 学习/培训
+                                    SetFieldValue(formFields, "purpose_cultural", "Yes");               // 文化交流
                                 }
-                                else if (visit_purpose.contains("就业活动"))
+                                else if (visit_purpose.contains("体育") || visit_purpose.contains("活动"))
                                 {
-                                    SetFieldValue(formFields, "korea_work", selected);             // 就业活动
+                                    SetFieldValue(formFields, "purpose_sports", "Yes");                 // 体育活动
                                 }
-                                else if (visit_purpose.contains("贸易") || visit_purpose.contains("投资") || visit_purpose.contains("派驻"))
+                                else if (visit_purpose.contains("官方访问"))
                                 {
-                                    SetFieldValue(formFields, "korea_trade", selected);            // 贸易/投资/派驻
+                                    SetFieldValue(formFields, "purpose_offcial_visit", "Yes");          // 官方访问
                                 }
-                                else if (visit_purpose.contains("探亲访友") || visit_purpose.contains("探亲") || visit_purpose.contains("访友"))
+                                else if (visit_purpose.contains("医疗原因") || visit_purpose.contains("医疗"))
                                 {
-                                    SetFieldValue(formFields, "korea_visiting_family", selected);  // 探亲访友
+                                    SetFieldValue(formFields, "purpose_medical_reasons", "Yes");        // 医疗原因
                                 }
-                                else if (visit_purpose.contains("结婚移民") || visit_purpose.contains("结婚") || visit_purpose.contains("移民"))
+                                else if (visit_purpose.contains("学习"))
                                 {
-                                    SetFieldValue(formFields, "marriage_migrant", selected);       // 结婚移民
+                                    SetFieldValue(formFields, "purpose_study", "Yes");                  // 学习
                                 }
-                                else if (visit_purpose.contains("外交") || visit_purpose.contains("公务"))
+                                else if (visit_purpose.contains("机场中转"))
                                 {
-                                    SetFieldValue(formFields, "korea_diplomatic", selected);       // 外交/公务
+                                    SetFieldValue(formFields, "purpose_airport_transit", "Yes");        // 机场中转
                                 }
                                 else
                                 {
-                                    SetFieldValue(formFields, "korea_other", selected);            // 其他
-                                    SetFieldValue(formFields, "korea_other_details", visit_purpose);// 其他 - 备注
+                                    SetFieldValue(formFields, "purpose_other", "Yes");                  // 其他
+                                    SetFieldValue(formFields, "purpose_other_remark", "");              // 其他 - 备注
                                 }
                             }
 
-                            #region 滞留信息
-                            string day1 = "";   //得到抵达日期
-                            string day2 = "";   //得到离开日期
+                            #endregion
 
-                            string country = groupInfo.VisitCountry;    //国家名
-                            string HG_City = "";  //城市
-                            string HG_Country = "";//国家
-                            string[] HG_countryName = new string[] { };
-                            if (!string.IsNullOrEmpty(country))
-                            {
-                                //处理国家名
-                                if (country.Contains(" "))
-                                    HG_countryName = country.Split(' ');
-                                else if (country.Contains(","))
-                                    HG_countryName = country.Split(',');
-                                else if (country.Contains(","))
-                                    HG_countryName = country.Split(',');
-                                else if (country.Contains("、"))
-                                    HG_countryName = country.Split('、');
-                            }
+                            #region 目的国相关信息
 
-                            var atbc = GeneralMethod.GetTableByBlackCode(groupId);
-                            int k = 0;
-                            for (int i = 0; i < HG_countryName.Length; i++)
+                            //关于停留目的的补充说明
+                            SetFieldValue(formFields, "purpose_stay_info", "");
+
+                            string[] RD_country = new string[] { };  //接收处理的国家
+
+                            string firstEntryLabel = string.Empty; // 首入申根国标签
+                            string membeDescLabel = string.Empty;  // 申根国目的地
+                            string RuJingTime = string.Empty;      // 入境时间
+                            string LiJingTime = string.Empty;      // 离境时间
+                            string stopDays = string.Empty;        // 停留天数
+                            if (!string.IsNullOrEmpty(groupInfo.VisitCountry))
                             {
-                                for (int j = 0; j < atbc.Rows.Count; j++)
-                                {
-                                    string HL_Three = atbc.Rows[j]["Three"].ToString();
+                                List<string> SGGNames = new List<string>();//接收处理后的国家  是申根国
+                                if (groupInfo.VisitCountry.Contains(","))
+                                    RD_country = groupInfo.VisitCountry.Split(',');
+                                else if (groupInfo.VisitCountry.Contains(' '))
+                                    RD_country = groupInfo.VisitCountry.Split(' ');
+                                else if (groupInfo.VisitCountry.Contains(","))
+                                    RD_country = groupInfo.VisitCountry.Split(',');
+                                else if (groupInfo.VisitCountry.Contains("、"))
+                                    RD_country = groupInfo.VisitCountry.Split('、');
+                                else if (groupInfo.VisitCountry.Contains("|"))
+                                    RD_country = groupInfo.VisitCountry.Split('|');
 
-                                    if (!string.IsNullOrEmpty(HL_Three))
+                                //判断是否是申根国家
+                                for (int i = 0; i < RD_country.Length; i++)
+                                {
+                                    if (RD_country[i].ToString() != null)
                                     {
-
-                                        var hl_three = HL_Three.Substring(3);
-                                        var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == hl_three).First();
-                                        if (tc != null)
+                                        //在申根国家中筛选 该国家是否是申根国家
+                                        for (int j = 0; j < _shenGenGuos.Length; j++)
                                         {
-                                            HG_Country = HG_countryName[i];
-                                            HG_City = tc.City;  //得到当前国家 城市名
-                                            day1 = atbc.Rows[j]["Day"].ToString();  //得到抵达日期
-                                            k = j + 1;
+                                            if (RD_country[i] == _shenGenGuos[j])
+                                                SGGNames.Add(_shenGenGuos[j]); //添加申根国
                                         }
-
                                     }
-                                    if (k == j)
-                                        day2 = atbc.Rows[j]["Day"].ToString(); //离开航班起飞时间
                                 }
-                            }
 
-                            if (atbc != null)
-                            {
-                                if (day2 != null && day1 != null)
+                                //目的地国是否有申根国
+                                if (SGGNames.Count > 0)
                                 {
-                                    try
+                                    firstEntryLabel = SGGNames.First();
+                                    membeDescLabel = string.Join(",", SGGNames.ToArray());
+
+                                    //接收生根国详细信息  存储顺序 起飞日期:Day 起飞时刻:StartTime  抵达日期:ArrivedDate 到达时刻:EndTime
+                                    List<SSGDetails> ListSSGDetails = new List<SSGDetails>();
+
+                                    //处理申根国家 预定到达时间  预定离开时间 预定停留天数   
+                                    for (int i = 0; i < SGGNames.Count; i++)
                                     {
-                                        int Han_day = (Convert.ToDateTime(day2) - Convert.ToDateTime(day1)).Days; //得到天数
-                                        SetFieldValue(formFields, "visit_prtiod_stay", Han_day.ToString());       // 滞留天数
+                                        //在相同的国家下  得到该航班的信息  //抵达时间 起飞日期:Day   起飞时刻:StartTime  到达时刻:EndTime  抵达日期:ArrivedDate 飞行时间:FlightTime  航司  Fliagtcode  入境口岸 
+                                        var atbc = GeneralMethod.GetTableByBlackCode(groupId);
+                                        //ResidenceTime1 机票三字码信息
+                                        if (atbc != null)
+                                        {
+                                            string HL_Three = ""; //三字码  Three  
+
+                                            for (int j = 0; j < atbc.Rows.Count; j++)
+                                            {
+                                                HL_Three = atbc.Rows[j]["Three"].ToString();
+
+                                                if (!string.IsNullOrEmpty(HL_Three))
+                                                {
+                                                    string threeCodeTwo = HL_Three.Substring(3);
+                                                    var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == threeCodeTwo).First();
+                                                    if (tc != null)
+                                                    {
+                                                        //首入申根国时间
+                                                        if (SGGNames[i] == tc.Country)
+                                                        {
+                                                            SSGDetails SSGDetails = new SSGDetails()
+                                                            {
+                                                                Three = atbc.Rows[j]["Three"].ToString(),           //三字码
+                                                                Fliagtcode = atbc.Rows[j]["Fliagtcode"].ToString(), //航司
+                                                                startDate = atbc.Rows[j]["Day"].ToString(),        //整理起飞日期
+                                                                startTime = atbc.Rows[j]["StartTime"].ToString(),  //整理起飞时刻
+                                                                endDate = atbc.Rows[j]["ArrivedDate"].ToString(),  //整理抵达日期
+                                                                endTime = atbc.Rows[j]["EndTime"].ToString()       //整理抵达时刻
+                                                            };
+                                                            ListSSGDetails.Add(SSGDetails);
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                    ListSSGDetails.Sort((a, b) => a.startDate.CompareTo(b.startDate));
+                                    //得到并计算出入境时间
+                                    if (ListSSGDetails != null)
+                                    {
+                                        RuJingTime = ListSSGDetails.First().endDate + " " + ListSSGDetails.First().endTime.Substring(0, 2) + ":" + ListSSGDetails.First().endTime.Substring(2);  //入境时间
+                                        LiJingTime = ListSSGDetails[ListSSGDetails.Count - 1].startDate + " " + ListSSGDetails[ListSSGDetails.Count - 1].endTime.Substring(0, 2) + ":" + ListSSGDetails[ListSSGDetails.Count - 1].endTime.Substring(2); //离境时间
+
+                                        stopDays = Convert.ToDateTime(LiJingTime).Subtract(Convert.ToDateTime(RuJingTime)).Days.ToString();
                                     }
-                                    catch (Exception) { }
                                 }
                             }
 
-                            //得到当前国家下的城市酒店信息
+                            SetFieldValue(formFields, "main_destination", membeDescLabel);  // 主要目的地成员国(如适用,还包括目的地的其他成员国)
+                            SetFieldValue(formFields, "first_entry", firstEntryLabel);      // 首次加入的成员国
+
+                            // 申请入境次数
+                            SetFieldValue(formFields, "entries_requested_single", "Off");   // 一次入境
+                            SetFieldValue(formFields, "entries_requested_two", "Off");      // 两次入境
+                            SetFieldValue(formFields, "entries_requested_multiple", "Off"); // 多次入境
+
+                            SetFieldValue(formFields, "first_schenggen_stay_arrival_date", RuJingTime);   // 首次计划在申根区停留的预计抵达日期
+                            SetFieldValue(formFields, "first_schenggen_stay_departure_date", LiJingTime); // 首次计划在申根区停留结束后离开申根区的预计离境日期
+
+                            #endregion
+
+                            #region 申请申根签证而先前采集的指纹
+                            SetFieldValue(formFields, "schengen_visa_no", "");        // 否 
+                            SetFieldValue(formFields, "schengen_visa_yes", "");       // 是 
+                            SetFieldValue(formFields, "fingerpints_date", "");        // 如有,请写明日期
+                            SetFieldValue(formFields, "fingerpints_visa_number", ""); // 如有,请写明签证贴纸号码
+                            #endregion
+
+                            #region 最终目的地国家的入境许可(如适用)
+                            SetFieldValue(formFields, "entry_permit_country_issued", ""); // 颁发单位
+                            SetFieldValue(formFields, "entry_permit_country_valid", "");  // 颁发日期
+                            SetFieldValue(formFields, "entry_permit_country_until", "");  // 有效期限
+                            #endregion
+
+                            #region 招待方在成员国中的姓氏和名字。如无此信息,则填写成员国内的酒店或临时住宿场所的名称
                             var hotelInfo = _sqlSugar.Queryable<Grp_HotelReservations>()
                                 .Where(x => x.DiId == groupId)
-                                .Where(x => x.City.contains(HG_City))
+                                //.Where(x => x.City.contains(city))
                                 .First();
-                            //访问信息
+                            //酒店住址
                             if (hotelInfo != null)
                             {
-                                SetFieldValue(formFields, "visit_address", hotelInfo?.HotelAddress ?? ""); // 停留酒店地址
-                                SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? "");         // 停留酒店联系电话    
+                                SetFieldValue(formFields, "hotel_namee", hotelInfo?.HotelName ?? ""); // 招待方的地址和电子邮箱地址 
+                                var otherInfo = $"{hotelInfo.HotelAddress}";
+                                SetFieldValue(formFields, "hotel_address_and_email", otherInfo);      // 酒店/临时住宿场所的地址和电子邮箱地址 
+                                SetFieldValue(formFields, "hotel_tel", hotelInfo?.HotelTel ?? "");    // 电话号码
                             }
-
                             #endregion
-                            SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? ""); // 停留酒店联系电话 
-                            SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? ""); // 停留酒店联系电话 
-
-                            SetFieldValue(formFields, "visit_travelled_5year_no", "");      // 近五年到访过韩国
-                            SetFieldValue(formFields, "visit_travelled_5year_othercountry_no", ""); // 近五年到访过除韩国之外的国家
-                            SetFieldValue(formFields, "visit_travelled_no", "");            // 是否有其他家人滞留在韩国
-                            SetFieldValue(formFields, "visit_travelled_travelling_no", ""); // 是否有随行家属
 
+                            #region 邀请公司/组织信息
+                            var oa = _sqlSugar.Queryable<Res_OfficialActivities>()
+                                   .Where(x => x.IsDel == 0 && x.DiId == groupId)
+                                   //.Where(x => x.Country.Contains(county))
+                                   //.Where(x => x.Area.Contains(city))
+                                   .First();
+                            if (oa != null)
+                            {
+                                string oaInfo = $"{oa.Client} {oa.Address}";
+                                SetFieldValue(formFields, "inviting_name_and_address", oaInfo);   // 邀请公司/组织的名称及地址
+                                string contactInfo = $"{oa?.Contact ?? ""} {oa?.Tel ?? ""} {oa?.EmailOrWeChat ?? ""}";
+                                SetFieldValue(formFields, "inviting_contact_Info", contactInfo);  // 公司/组织中联系人的姓氏、名字、地址、电话号码以及电子邮箱地址
+                                SetFieldValue(formFields, "inviting_company_tel", oa?.Tel ?? ""); //电话号码(关于)公司/组织
+                            }
                             #endregion
 
-                            #region 9. 在韩邀请方信息
-
-                            SetFieldValue(formFields, "invitation_no", selected);  // 是否有邀请方 - 否 默认选中
-                            SetFieldValue(formFields, "invitation_yes", "");       // 是否有邀请方 - 是
-
-                            if (!string.IsNullOrEmpty(HG_Country) && !string.IsNullOrEmpty(HG_City))
-                            {
-                                var oa = _sqlSugar.Queryable<Res_OfficialActivities>()
-                                    .Where(x => x.IsDel == 0 && x.DiId == groupId)
-                                    .Where(x => x.Country.Contains(HG_Country))
-                                    .Where(x => x.Area.Contains(HG_City))
-                                    .First();
+                            #region 申请人在留宿期间的旅行及生活费用已由申请人本人承担
 
-                                //邀请 接待单位 
-                                if (oa != null)
-                                {
-                                    SetFieldValue(formFields, "invitation_no", "");        // 是否有邀请方 - 否 
-                                    SetFieldValue(formFields, "invitation_yes", selected); // 是否有邀请方 - 是
+                            #region 支持方式
 
-                                    SetFieldValue(formFields, "invitation_name", oa?.Contact?.Trim() ?? "");// 邀请方 姓名
-                                    SetFieldValue(formFields, "invitation_birthday", "");                  // 邀请方 生日/证件号
-                                    SetFieldValue(formFields, "invitation_relationship", "邀请方");         // 邀请方 关系
-                                    SetFieldValue(formFields, "invitation_address", oa?.Address ?? "");    // 邀请方 地址
-                                    SetFieldValue(formFields, "invitation_tel", oa?.Tel ?? "");            // 邀请方 电话
-                                }
-                            }
+                            SetFieldValue(formFields, "cost_type_himself", "Off");              // 支持方式
+                            SetFieldValue(formFields, "cost_type_himself_cash", "Off");         // 现金
+                            SetFieldValue(formFields, "cost_type_himself_cheques", "Off");      // 旅行支票
+                            SetFieldValue(formFields, "cost_type_himself_creditcard", "Off");   // 信用卡
+                            SetFieldValue(formFields, "cost_type_himself_accommodation", "Off");// 预付费住宿
+                            SetFieldValue(formFields, "cost_type_himself_transport", "Off");    // 预付费交通
+                            SetFieldValue(formFields, "cost_type_himself_other", "Off");        // 其他
+                            SetFieldValue(formFields, "cost_type_himself_other_specify", "");   // 其他(请具体说明)
                             #endregion
 
-                            #region 9. 费用信息
+                            #region 由赞助方(主办方、公司、组织)提供
 
-                            var compnayName = currCompanyInfos.FirstOrDefault(x => x.Id == custInfo.CrmCompanyId)?.Company ?? "";
-                            SetFieldValue(formFields, "funding_costs", "");                     // 费用金额
-                            SetFieldValue(formFields, "funding_pay_name_or_unit", compnayName); // 单位名称
-                            SetFieldValue(formFields, "funding_pay_relationship", "企业");      // 关系
-                            SetFieldValue(formFields, "funding_pay_cost_type", "自费");         // 费用类别
-                            SetFieldValue(formFields, "funding_pay_tel", custInfo.ClientPhone); // 电话
+                            SetFieldValue(formFields, "cost_type_himself", "Off");            // 由赞助方(主办方、公司、组织)提供
+                            SetFieldValue(formFields, "cost_type_himself_cash", "Off");       // 在第 30 或 31 栏中提及
+                            SetFieldValue(formFields, "cost_type_sponsor_other", "Off");      // 其他
+                            SetFieldValue(formFields, "cost_type_sponsor_other_specify", ""); // 其他(请具体说明
 
+                            //支持方式
+                            SetFieldValue(formFields, "cost_type_support_cash", "Off");       // 现金
+                            SetFieldValue(formFields, "cost_type_support_provided", "Off");   // 提供住宿
+                            SetFieldValue(formFields, "cost_type_support_covered", "Off");    // 旅行期间的所有费用均由主办方承担
+                            SetFieldValue(formFields, "cost_type_support_transport", "Off");  // 预先支付的交通费用
+                            SetFieldValue(formFields, "cost_type_support_other", "Off");      // 其他
+                            SetFieldValue(formFields, "cost_type_support_other_specify", ""); // 其他(请具体说明
                             #endregion
 
-                            #region 10. 协助填表人信息
-
-                            if (string.IsNullOrEmpty(custInfo.TableOpName))
-                                SetFieldValue(formFields, "assistance_no", selected);    // 否
-                            else
-                            {
-                                SetFieldValue(formFields, "assistance_yes", selected);   // 是
-                                SetFieldValue(formFields, "assistance_name", selected);  // 姓名
-                                SetFieldValue(formFields, "assistance_birthday", "");    // 生日
-                                SetFieldValue(formFields, "assistance_tel", custInfo.TableOpTel);  // 电话
-                                SetFieldValue(formFields, "assistance_relationship", "雇佣");      // 和协助人关系
-                            }
+                            #endregion
 
+                            #region 填写申请表的人员的姓氏和名字(若与申请人姓名不同)
+                            SetFieldValue(formFields, "application_form_name", custInfo.TableOpName);  // 申请表的人员
+                            SetFieldValue(formFields, "application_form_address_email", "");   // 申请表人员的地址及电子邮箱地址
+                            SetFieldValue(formFields, "assistance_tel", custInfo.TableOpTel);  // 电话号码
                             #endregion
 
                             var date_year = DateTime.Now.Year.ToString();
                             var date_month = DateTime.Now.Month.ToString();
                             var date_day = DateTime.Now.Day.ToString();
-                            SetFieldValue(formFields, "declaration_year", date_year);    // 申请日期 - 年
-                            SetFieldValue(formFields, "declaration_month", date_month);  // 申请日期 - 月
-                            SetFieldValue(formFields, "declaration_day", date_day);      // 申请日期 - 日
-
+                            SetFieldValue(formFields, "place_and_date", DateTime.Now.ToString("yyyy-MM-dd"));   // 申请日期
                             var applicant_name = custInfo.LastName + custInfo.FirstName;
-                            SetFieldValue(formFields, "declaration_applicant_name", applicant_name);  // 申请人姓名
-                            #endregion
-
+                            SetFieldValue(formFields, "applicant_signature", applicant_name); // 申请人姓名
+                            SetFieldValue(formFields, "signature_parental_info", "");         // (如适用,需签名的家长授权/监护人信息):
 
+                            #endregion
 
                             filePaths.Add(outputPath);
                         }

+ 156 - 1
OASystem/OASystem.Api/Controllers/SearchController.cs

@@ -211,7 +211,6 @@ namespace OASystem.API.Controllers
 
         }
 
-
         /// <summary>
         /// 客户资料
         /// </summary>
@@ -466,5 +465,161 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(true, $"搜索服务暂时不可用!"));
             }
         }
+
+        /// <summary>
+        /// 团组各项费用录入 关键字输入提示(智能版)
+        /// 76	酒店预订
+        /// 79	车/导游地接
+        /// 80	签证
+        /// 81	邀请/公务活动
+        /// 82	团组客户保险
+        /// 85	机票预订
+        /// 98	其他款项
+        /// 285	收款退还
+        /// 1015 超支费用
+        /// 1081 文档下载
+        /// 1466 会务相关
+        /// </summary>
+        /// <param name="userId">用户Id</param>
+        /// <param name="feeType">费用类型</param>
+        /// <param name="keyword">关键字</param>
+        /// <returns></returns>
+        [HttpGet("GroupFeeKeywordSearch/{userId}/{feeType}/{keyword}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GroupFeeKeywordSearch(int userId, int feeType, string keyword)
+        {
+            try
+            {
+                #region 参数验证
+
+                // 基本参数验证
+                if (userId <= 0)
+                    return Ok(JsonView(false, "用户ID必须大于0!"));
+
+                if (feeType <= 0)
+                    return Ok(JsonView(false, "费用类型必须大于0!"));
+
+                // 验证用户是否存在
+                var userExists = await _sqlSugar.Queryable<Sys_Users>()
+                    .Where(x => x.IsDel == 0 && x.Id == userId)
+                    .AnyAsync();
+
+                if (!userExists)
+                {
+                    return Ok(JsonView(false, "用户不存在或已被删除"));
+                }
+
+                // 验证费用类型是否有效
+                var feeTypeExists = await _sqlSugar.Queryable<Sys_SetData>()
+                    .Where(x => x.IsDel == 0 && x.STid == 16 && x.Id == feeType)
+                    .AnyAsync();
+
+                if (!feeTypeExists)
+                {
+                    return Ok(JsonView(false, "无效的费用类型"));
+                }
+
+                // 验证关键字
+                if (string.IsNullOrWhiteSpace(keyword))
+                {
+                    return Ok(JsonView(false, "请输入搜索关键字"));
+                }
+
+                #endregion
+
+                #region 获取用户有权限的团组ID
+
+                // 获取用户有权限访问的团组ID列表
+                var authorizedGroupIds = await _sqlSugar.Queryable<Grp_GroupsTaskAssignment>()
+                    .Where(x => x.IsDel == 0 && x.UId == userId && x.CTId == feeType)
+                    .Select(x => x.DIId)
+                    .Distinct()
+                    .ToListAsync();
+
+                if (!authorizedGroupIds.Any())
+                {
+                    return Ok(JsonView(true, "暂无数据", new List<object>(), 0));
+                }
+
+                #endregion
+
+                #region 构建搜索请求
+
+                var searchRequest = new DynamicSearchRequest
+                {
+                    Keyword = keyword.Trim(),
+                    RequireAllSingleChars = true,
+                    PageIndex = 1,
+                    PageSize = 20, // 限制返回数量,提高性能
+                    FieldWeights = new Dictionary<string, int>
+                    {
+                        { "TeamName", 10 }
+                    },
+                    Filters = new List<SearchFilter>
+                    {
+                        new SearchFilter { Field = "IsDel", Operator = "eq", Value = "0" },
+                        new SearchFilter { Field = "Id", Operator = "in", Values = authorizedGroupIds.ConvertAll<object>(x => x) }
+                    },
+                    OrderBy = "VisitDate", // 添加排序方向
+                    ReturnFields = new List<string> { "Id", "TeamName" } // 添加ID字段
+                };
+
+                #endregion
+
+                #region 字段配置验证
+
+                var validation = _groupSearchService.ValidateFieldConfig(
+                    searchRequest.FieldWeights,
+                    searchRequest.ReturnFields);
+
+                if (!validation.IsValid)
+                {
+                    return Ok(JsonView(false, $"字段配置错误: {validation.Message}"));
+                }
+
+                #endregion
+
+                #region 执行搜索
+
+                var result = await _groupSearchService.SearchAsync(searchRequest);
+
+                if (!result.Success)
+                {
+                    return Ok(JsonView(false, result.Message ?? "搜索失败"));
+                }
+
+                if (result.Items == null || !result.Items.Any())
+                {
+                    return Ok(JsonView(true, "未找到匹配的团组", new List<object>(), 0));
+                }
+
+                #endregion
+
+                #region 构建返回数据
+
+                var responseData = result.Items
+                    .Where(item => item.Data != null)
+                    .Select(item => new
+                    {
+                        Id = item.Data.Id,
+                        TeamName = item.Data.TeamName
+                    })
+                    .Where(x => !string.IsNullOrWhiteSpace(x.TeamName)) // 过滤空名称
+                    .Distinct() // 去重
+                    .ToList();
+
+                #endregion
+
+                return Ok(JsonView(true, "搜索成功", responseData, responseData.Count));
+            }
+            catch (Exception ex)
+            {
+                // 记录日志(实际项目中应该使用日志框架)
+                // _logger.LogError(ex, "团组费用关键字搜索失败,用户ID: {UserId}, 费用类型: {FeeType}", userId, feeType);
+
+                // 生产环境中不要返回详细的错误信息
+                return Ok(JsonView(false, "搜索服务暂时不可用,请稍后重试"));
+            }
+        }
     }
 }

+ 4 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -327,7 +327,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 #region 团组下拉框
 
                 List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 85).ToList();
-                var grp_NameView = new List<GroupNameView>();
+                var grp_NameView = new List<dynamic>();
                 string DiId = "";
                 foreach (var item in grp_GroupsTaskAssignment)
                 {
@@ -347,10 +347,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                     foreach (var item in grp_Delegations)
                     {
-                        var groupNameView = new GroupNameView
+                        var groupNameView = new
                         {
-                            Id = item.Id,
-                            GroupName = item.TeamName
+                            item.Id,
+                            item.TeamName
                         };
                         grp_NameView.Add(groupNameView);
                     }