فهرست منبع

波兰 签证 10%

Lyyyi 7 ماه پیش
والد
کامیت
44e9e052c1
1فایلهای تغییر یافته به همراه945 افزوده شده و 251 حذف شده
  1. 945 251
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 945 - 251
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5380,7 +5380,7 @@ FROM
                 case 3: // 韩国
                 case 3: // 韩国
 
 
                     visaTypeName = $"韩国签证申请表";
                     visaTypeName = $"韩国签证申请表";
-                    currTempPath = $"{tempPath}{visaTypeName}.doc";
+                    currTempPath = $"{tempPath}{visaTypeName}.pdf";
 
 
                     var korSavePath = $"{fileServerPath}{visaTypeName}/";
                     var korSavePath = $"{fileServerPath}{visaTypeName}/";
                     if (!Directory.Exists(fileServerPath)) Directory.CreateDirectory(korSavePath);
                     if (!Directory.Exists(fileServerPath)) Directory.CreateDirectory(korSavePath);
@@ -5389,8 +5389,6 @@ FROM
                     {
                     {
                         EncryptionProcessor.DecryptProperties(custInfo);
                         EncryptionProcessor.DecryptProperties(custInfo);
 
 
-                        Dictionary<string, string> dics = new();
-
                         var idInfo = certInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.PassportType == 773);
                         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 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 clinetInfo = companyInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.Id == custInfo.CrmCompanyId);
@@ -5398,304 +5396,502 @@ FROM
                         var currFamilyInfos = familyInfos.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();
                         var currCompanyInfos = companyInfos.Where(x => x.DcId == custInfo.Id).ToList();
 
 
-                        #region 韩国签证模板书签
-
-                        dics.Add("LastNameEn", custInfo?.LastName ?? "");//姓
-                        dics.Add("FirstNameEn", custInfo?.FirstName ?? "");//名
-                        var userName = $"{custInfo?.LastName ?? ""}{custInfo?.FirstName ?? ""}";
-                        dics.Add("User", userName);//姓名
+                        #region 生成文件
 
 
-                        //判断性别
-                        if (custInfo.Sex == 0)
-                            dics.Add("SexMale", "√");
-                        else if (custInfo.Sex == 1)
-                            dics.Add("SexFemale", "√");
+                        PdfReader reader = null;
+                        FileStream templateStream = null;
+                        FileStream outputStream = null;
+                        PdfStamper stamper = null;
 
 
-                        string idCard = idInfo.CertNo;
-                        string birthday = string.Empty;
-                        if (!string.IsNullOrEmpty(idCard))
+                        try
                         {
                         {
-                            string year = idCard.Substring(6, 4);
-                            string month = idCard.Substring(10, 2);
-                            string day = idCard.Substring(12, 2);
-                            birthday = year + "/" + month + "/" + day;
-                        }
+                            string outputPath = $"{korSavePath}{custInfo.LastName}{custInfo.FirstName}.pdf";
+
+                            //读取模板文件
+                            templateStream = new FileStream(currTempPath, FileMode.Open, FileAccess.Read, FileShare.Read);
+                            reader = new PdfReader(templateStream);
 
 
-                        dics.Add("BirthDay", birthday);//出生日期 
-                        dics.Add("Nationality", "中国");//国籍                                                                               
-                        dics.Add("NationalityCountry", "中国");//出生国 
-                        dics.Add("IdCard", idCard);//身份证号码
+                            //创建输出文件
+                            outputStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write);
+                            stamper = new PdfStamper(reader, outputStream);
+
+                            AcroFields formFields = stamper.AcroFields;
+
+                            #region 设置文本值
 
 
-                        dics.Add("OtherPassProt", "√"); //默认没有其他护照
+                            string selected = "√";
 
 
-                        //判断是否否曾用名 是否申请过该国家
-                        string isGetSchengenStr = custInfo.IsGetSchengen == 0 ? "否" : "是";
-                        if (!string.IsNullOrEmpty(custInfo.OldName) && isGetSchengenStr.equals("是"))
-                        {
-                            dics.Add("IsGetSchengenYes", "√");
+                            #region 1. 个人信息
+
+                            SetFieldValue(formFields, "family_name", CommonFun.ConvertToPinyin(custInfo?.LastName?.Trim() ?? "")?.ToLower() ?? "");  // 姓 英文
+                            SetFieldValue(formFields, "given_names", CommonFun.ConvertToPinyin(custInfo?.FirstName?.Trim() ?? "")?.ToLower() ?? ""); // 名 英文
+                            string name_cn = custInfo.LastName + custInfo.FirstName;
+                            SetFieldValue(formFields, "name_cn", name_cn);   // 姓名 中文
+
+                            #region 性别 
+                            //清除性别
+                            SetFieldValue(formFields, "sex_male", "Off");   // 性别 - 男
+                            SetFieldValue(formFields, "sex_female", "Off"); // 性别 - 女
+                            //设置性别
+                            if (custInfo.Sex == 0) //男
+                            {
+                                SetFieldValue(formFields, "sex_male", "Yes");   // 性别 - 男
+                            }
+                            else if (custInfo.Sex == 1) //女
+                            {
+                                SetFieldValue(formFields, "sex_female", "Yes"); // 性别 - 女
+                            }
+
+                            #endregion
+
+                            #region 出生日期(日-月-年)
+                            string idCard = idInfo?.CertNo?.Trim() ?? "";
+                            string birthday = string.Empty;
+                            if (!string.IsNullOrEmpty(idCard))
+                            {
+                                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
+
+                            SetFieldValue(formFields, "previous_nationality", "中国");   // 现国籍
+                            SetFieldValue(formFields, "nationality", "中国");            // 出生国
+                            SetFieldValue(formFields, "IdNo", idCard);                  // 身份证号码
+
+                            #region 是否曾用别名从韩国出入境
+                            SetFieldValue(formFields, "applicant_no", selected);   // 否 默认选中
+                            SetFieldValue(formFields, "applicant_yes", "");  
+
+                            string isGetSchengenStr = custInfo.IsGetSchengen == 0 ? "否" : "是";
                             string oldName = custInfo?.OldName ?? "";
                             string oldName = custInfo?.OldName ?? "";
-                            if (!string.IsNullOrEmpty(oldName))
+                            if (!string.IsNullOrEmpty(oldName) && isGetSchengenStr.equals("是"))
                             {
                             {
-                                dics.Add("OldLastName", oldName.Substring(0, 1));
-                                dics.Add("OldFirstName", oldName.Remove(0, 1));
+                                SetFieldValue(formFields, "applicant_no", "");
+                                SetFieldValue(formFields, "applicant_yes", selected);
+                                if (!string.IsNullOrEmpty(oldName))
+                                {
+                                    SetFieldValue(formFields, "former_surname", oldName.Substring(0, 1));
+                                    SetFieldValue(formFields, "former_given_name", oldName.Remove(0, 1));
+                                }
                             }
                             }
-                        }
-                        else
-                            dics.Add("IsGetSchengenNo", "√");
 
 
-                        dics.Add("IsDoubleNationality", "√");  //默认没有双重国籍
+                            #endregion
 
 
-                        //护照
-                        if (passportInfo != null)
-                        {
-                            dics.Add("PassprotNo", passportInfo?.CertNo ?? "");     // 护照編號
-                            dics.Add("PassprotCountry", passportInfo?.Country ?? "");     // 护照签发国
-                            dics.Add("PassprotIssuePlase", passportInfo?.Area ?? "");     // 护照签发地
-                            dics.Add("PassprotStartTime", passportInfo?.IssueDt?.ToString("yyyy-MM-dd") ?? "");  //护照开始时间
-                            dics.Add("PassprotEndTime", passportInfo?.ExpiryDt?.ToString("yyyy-MM-dd") ?? "");     // 护照过期时间
-                        }
+                            #region 是否拥有双重国籍
+                            SetFieldValue(formFields, "dual_citizenship_no", selected);   // 否 默认选中
+                            SetFieldValue(formFields, "dual_citizenship_yes", "");
+                            SetFieldValue(formFields, "dual_citizenship_remark", "");
+                            #endregion
 
 
-                        dics.Add("Address", custInfo?.Address ?? "");//现居家庭地址
-                        dics.Add("Tel1", custInfo?.Tel ?? "");//移动电话 /家庭电话 /电子信箱
-                                                              //dics.Add("Tel2",  );//电子信箱
-                        dics.Add("Email", custInfo?.Email ?? "");//电子信箱
+                            #endregion
 
 
-                        //判断婚姻状况
-                        var marriage = custInfo.Marriage switch
-                        {
-                            1 => "未婚",
-                            2 => "已婚",
-                            3 => "离异",
-                            4 => "丧偶",
-                            _ => "未设置"
-                        };
+                            #region 2. 申请签证信息
 
 
-                        if (marriage.Contains("未婚") || marriage == null || marriage == "")
-                            dics.Add("Single", "√");
-                        else if (marriage == "已婚")
-                            dics.Add("Married", "√");
-                        else if (marriage == "离婚" || marriage == "离异")
-                            dics.Add("Divorced", "√");
+                            //SetFieldValue(formFields, "overstay_period_over_90_days", selected);  // 90天以上长期滞留
+                            //SetFieldValue(formFields, "overstay_period_under_90_days", selected); // 90天以下短期滞留
+                            //SetFieldValue(formFields, "overstay_period_status", "");         // 滞留资格
 
 
-                        //判断是否已婚 已婚则输出配偶信息
-                        if (marriage == "已婚")
-                        {
-                            string mateName = custInfo?.MateName ?? "";
+                            #endregion
+
+                            #region 3. 护照信息
 
 
-                            if (!string.IsNullOrEmpty(mateName))
+                            //清除值
+                            SetFieldValue(formFields, "passport_type_diplomatic", ""); // 旅行证件类型 - 外交护照
+                            SetFieldValue(formFields, "passport_type__official", "");  // 旅行证件类型 - 公务护照
+                            SetFieldValue(formFields, "passport_type__regular", "");   // 旅行证件类型 - 普通护照
+                            SetFieldValue(formFields, "passport_type__other", "");     // 旅行证件类型 - 其它
+                            //设置值
+                            if (passportInfo != null)
                             {
                             {
-                                try
+                                // 签证类型
+                                var visatypeInfo = await _sqlSugar.Queryable<Sys_SetData>().FirstAsync(x => x.Id == passportInfo.PassportType);
+                                if (visatypeInfo != null)
                                 {
                                 {
-                                    string mateFirstName = mateName.Remove(0, 1);
-                                    dics.Add("MateLastName", mateName.Substring(0, 1)); //配偶姓
-                                    dics.Add("MateFirstName", mateFirstName);  //配偶名
-                                                                               //dics.Add("MateLastName", MateName.Substring(0, 1)); //配偶姓
-                                                                               //dics.Add("MateFirstName", MateName.Substring(1, MateName.Length - 1));  //配偶名
+                                    string visaName = visatypeInfo?.Name ?? "-";
+                                    if (visaName.contains("外交")) SetFieldValue(formFields, "passport_type_diplomatic", selected);     // 旅行证件类型 - 外交护照
+                                    else if (visaName.contains("公务")) SetFieldValue(formFields, "passport_type__official", selected); // 旅行证件类型 - 公务护照
+                                    else if (visaName.contains("普通")) SetFieldValue(formFields, "passport_type__regular", selected);  // 旅行证件类型 - 普通护照
+                                    else if (visaName.contains("其它"))                                                                 // 旅行证件类型 - 其它
+                                    {
+                                        SetFieldValue(formFields, "passport_type__other", selected);
+                                        SetFieldValue(formFields, "passport_type__other_remark", "");
+                                    }   
+                                    else SetFieldValue(formFields, "passport_ordinary", selected);                                      // 旅行证件类型 - 普通护照
                                 }
                                 }
-                                catch { }
-                                dics.Add("MateBirthDay", custInfo?.MateBirthDay.ToString("yyyy-MM-dd"));   //配偶生日
-                                //dics.Add("MateNationality", custInfo.ma.ToString());   //配偶国籍
-                                //dics.Add("MateTel", custInfo..ToString());  //配偶联系电话
-                                dics.Add("MateAddress", custInfo.MateAddress.ToString());  //配偶居住地址
-
-                                //家人信息书签
-                                if (currFamilyInfos.Count > 0)
-                                {
-                                    //定义接受子女人数
-                                    int children = currFamilyInfos.Where(x => x.Appellation.contains("儿子") || x.Appellation.contains("女儿")).ToList().Count;
 
 
-                                    //判断子女人数
-                                    if (children == 0)  //无子女
-                                        dics.Add("NoChildren", "√"); //未查询出 则无子女
-                                    else
+                                SetFieldValue(formFields, "passport_no", passportInfo.CertNo);        // 签证 编号
+                                SetFieldValue(formFields, "passport_country", passportInfo.Country);  // 签发 国
+                                SetFieldValue(formFields, "passport_issuePlace", passportInfo.Area);  // 签发 地
+                                SetFieldValue(formFields, "passport_issue_date", passportInfo.IssueDt?.ToString("yyyy-MM-dd") ?? "");  // 签发日期
+                                SetFieldValue(formFields, "passport_expiryDate", passportInfo.ExpiryDt?.ToString("yyyy-MM-dd") ?? ""); // 有效期至
+
+                                #region 是否有其他护照信息
+                                SetFieldValue(formFields, "otherPassport_no", selected);  // 否 默认选中
+                                SetFieldValue(formFields, "otherPassport_yes", ""); // 是
+                                //清除值
+                                SetFieldValue(formFields, "other_passport_type_diplomatic", ""); // 旅行证件类型 - 外交护照
+                                SetFieldValue(formFields, "other_passport_type_official", "");   // 旅行证件类型 - 公务护照
+                                SetFieldValue(formFields, "other_passport_type_regular", "");    // 旅行证件类型 - 普通护照
+                                SetFieldValue(formFields, "other_passport_type_other", "");      // 旅行证件类型 - 其它
+                                SetFieldValue(formFields, "other_passport_no", "");              // 签证 编号
+                                SetFieldValue(formFields, "other_passport_country", "");         // 签发 国
+                                SetFieldValue(formFields, "other_passport_expiry_date",  "");    // 有效期至
+                                #endregion
+                            }
+
+                            #endregion
+
+                            #region 4. 联系信息
+
+                            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);      // 电子邮件
+
+                            #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", ""); // 关系 
+                            #endregion
+
+                            #endregion
+
+                            #region 5. 婚姻状况及家庭成员信息
+                            //清除婚姻状况
+                            SetFieldValue(formFields, "marital_married", "");  // 婚姻状况 - 已婚
+                            SetFieldValue(formFields, "marital_divorced", ""); // 婚姻状况 - 离婚
+                            SetFieldValue(formFields, "marital_single", "");   // 婚姻状况 - 单身
+                            //设置婚姻状况
+                            switch (custInfo.Marriage)
+                            {
+                                case 1: // 未婚
+                                    break;
+                                case 2: // 已婚
+                                    SetFieldValue(formFields, "marital_married", selected);
+
+                                    #region 配偶信息
+                                    string mateName = custInfo?.MateName ?? "";
+                                    if (!string.IsNullOrEmpty(mateName))
                                     {
                                     {
-                                        dics.Add("HaveChildren", "√");
-                                        dics.Add("ChildrenNum", children.ToString());//有子女则输出人数
+                                        string mateFirstName = mateName.Remove(0, 1);
+                                        SetFieldValue(formFields, "marital_personal_surname", mateName.Substring(0, 1));  // 姓
+                                        SetFieldValue(formFields, "marital_personal_name", mateFirstName);  // 名
                                     }
                                     }
+                                    SetFieldValue(formFields, "marital_personal_birthday", custInfo?.MateBirthDay.ToString("yyyy-MM-dd"));   // 生日
+                                    SetFieldValue(formFields, "marital_personal_nationaliy", custInfo.MateBirthCountry);  // 国家
+                                    SetFieldValue(formFields, "marital_personal_nationaliy", custInfo.MateAddress);  // 居住地址
+                                    SetFieldValue(formFields, "marital_personal_nationaliy", ""); // 电话
+                                    #endregion
+
+                                    break;
+                                case 3: // 离婚/离异
+                                    SetFieldValue(formFields, "marriage_divorce", selected);
+                                    break;
+                                case 4: // 离异
+
+                                    break;
+                            }
+
+                            //子女信息
+                            SetFieldValue(formFields, "famliy_children_no", selected);  // 否
+                            SetFieldValue(formFields, "famliy_children_yes", "");  // 是
+                            if (currFamilyInfos.Count > 0)
+                            {
+                                // 定义接受子女人数
+                                int children = currFamilyInfos.Where(x => x.Appellation.contains("儿子") || x.Appellation.contains("女儿")).ToList().Count;
+
+                                // 判断子女人数
+                                if (children > 0) 
+                                {
+                                    SetFieldValue(formFields, "famliy_children_yes", selected);
+                                    SetFieldValue(formFields, "famliy_children_number", children.ToString()); // 子女人数
                                 }
                                 }
-                                else
-                                    dics.Add("NoChildren", "√"); //未查询出 则无子女
                             }
                             }
-                        }
-                        else
-                            dics.Add("NoChildren", "√"); //未婚则无子女
-
-                        //学历
-                        if (custInfo.HighestEducation.Contains("硕士") || custInfo.HighestEducation.Contains("博士"))
-                            dics.Add("Master", "√");
-                        else if (custInfo.HighestEducation.Contains("学士"))
-                            dics.Add("Bachelor", "√");
-                        else if (custInfo.HighestEducation.Contains("高中"))
-                            dics.Add("HighSchool", "√");
-                        else
-                        {
-                            dics.Add("Other", "√");
-                            dics.Add("OtherDetails", custInfo.HighestEducation.Trim());
-                        }
 
 
-                        //dics.Add("Job", custInfo.Job.ToString()); ;//职业
-                        dics.Add("Company", companyInfos.FirstOrDefault()?.Company ?? "");//单位名称
-                        dics.Add("jobs", companyInfos.FirstOrDefault()?.Job ?? "");  //职务
-                        dics.Add("CompanyAddress", companyInfos.FirstOrDefault()?.CompanyAddress ?? "");//单位地址
-                        dics.Add("CompanyTel", companyInfos.FirstOrDefault()?.Phone ?? "");//单位电话
+                            #endregion
 
 
-                        string day1 = "";   //得到抵达日期
-                        string day2 = "";   //得到离开日期
+                            #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", "");              // 其他 - 备注
+
+                            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
+                            {
+                                SetFieldValue(formFields,"education_other", selected);
+                                SetFieldValue(formFields, "education_other_remark", custInfo.HighestEducation.Trim());
+                            }
 
 
-                        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('、');
-                        }
+                            SetFieldValue(formFields, "education_school_name", "");               // 学校名称
+                            SetFieldValue(formFields, "education_school_address", "");            // 学校地址
+                            #endregion
 
 
-                        var atbc = GeneralMethod.GetTableByBlackCode(groupId);
-                        int k = 0;
-                        for (int i = 0; i < HG_countryName.Length; i++)
-                        {
-                            for (int j = 0; j < atbc.Rows.Count; j++)
+                            #region 7. 职业
+
+                            //清除值
+                            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", "");  // 其他 - 备注
+
+                            //职业信息
+                            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 ?? "");    // 电话
+                            }
+
+                            #endregion
+
+                            #region 8. 访问信息
+
+                            //入境事由 
+                            //清除值
+                            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", "");    // 其他 - 备注
+
+                            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("活动"))
+                                {
+                                    SetFieldValue(formFields, "korea_meeting", selected);          // 参加会议等活动
+                                }
+                                else if (visit_purpose.contains("医疗") || visit_purpose.contains("旅游"))
+                                {
+                                    SetFieldValue(formFields, "korea_medical_tourism", selected);  // 医疗旅游
+                                }
+                                else if(visit_purpose.contains("短期商务") || visit_purpose.contains("商务"))
+                                {
+                                    SetFieldValue(formFields, "korea_business", selected);         // 短期商务
+                                }
+                                else if(visit_purpose.contains("学习") || visit_purpose.contains("培训"))
+                                {
+                                    SetFieldValue(formFields, "korea_study", selected);         // 学习/培训
+                                }
+                                else if (visit_purpose.contains("就业活动"))
+                                {
+                                    SetFieldValue(formFields, "korea_work", selected);             // 就业活动
+                                }
+                                else if (visit_purpose.contains("贸易") || visit_purpose.contains("投资") || visit_purpose.contains("派驻"))
+                                {
+                                    SetFieldValue(formFields, "korea_trade", selected);            // 贸易/投资/派驻
+                                }
+                                else if (visit_purpose.contains("探亲访友") || visit_purpose.contains("探亲") || visit_purpose.contains("访友"))
+                                {
+                                    SetFieldValue(formFields, "korea_visiting_family", selected);  // 探亲访友
+                                }
+                                else if (visit_purpose.contains("结婚移民") || visit_purpose.contains("结婚") || visit_purpose.contains("移民"))
+                                {
+                                    SetFieldValue(formFields, "marriage_migrant", selected);       // 结婚移民
+                                }
+                                else if (visit_purpose.contains("外交") || visit_purpose.contains("公务"))
+                                {
+                                    SetFieldValue(formFields, "korea_diplomatic", selected);       // 外交/公务
+                                }
+                                else
+                                {
+                                    SetFieldValue(formFields, "korea_other", selected);            // 其他
+                                    SetFieldValue(formFields, "korea_other_details", visit_purpose);// 其他 - 备注
+                                }
+                            }
+
+                            #region 滞留信息
+                            string day1 = "";   //得到抵达日期
+                            string day2 = "";   //得到离开日期
+
+                            string country = groupInfo.VisitCountry;    //国家名
+                            string HG_City = "";  //城市
+                            string HG_Country = "";//国家
+                            string[] HG_countryName = new string[] { };
+                            if (!string.IsNullOrEmpty(country))
                             {
                             {
-                                string HL_Three = atbc.Rows[j]["Three"].ToString();
+                                //处理国家名
+                                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('、');
+                            }
 
 
-                                if (!string.IsNullOrEmpty(HL_Three))
+                            var atbc = GeneralMethod.GetTableByBlackCode(groupId);
+                            int k = 0;
+                            for (int i = 0; i < HG_countryName.Length; i++)
+                            {
+                                for (int j = 0; j < atbc.Rows.Count; j++)
                                 {
                                 {
+                                    string HL_Three = atbc.Rows[j]["Three"].ToString();
 
 
-                                    var hl_three = HL_Three.Substring(3);
-                                    var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == hl_three).First();
-                                    if (tc != null)
+                                    if (!string.IsNullOrEmpty(HL_Three))
                                     {
                                     {
-                                        HG_Country = HG_countryName[i];
-                                        HG_City = tc.City;  //得到当前国家 城市名
-                                        day1 = atbc.Rows[j]["Day"].ToString();  //得到抵达日期
-                                        k = j + 1;
-                                    }
 
 
+                                        var hl_three = HL_Three.Substring(3);
+                                        var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == hl_three).First();
+                                        if (tc != null)
+                                        {
+                                            HG_Country = HG_countryName[i];
+                                            HG_City = tc.City;  //得到当前国家 城市名
+                                            day1 = atbc.Rows[j]["Day"].ToString();  //得到抵达日期
+                                            k = j + 1;
+                                        }
+
+                                    }
+                                    if (k == j)
+                                        day2 = atbc.Rows[j]["Day"].ToString(); //离开航班起飞时间
                                 }
                                 }
-                                if (k == j)
-                                    day2 = atbc.Rows[j]["Day"].ToString(); //离开航班起飞时间
                             }
                             }
-                        }
 
 
-                        if (atbc != null)
-                        {
-                            if (day2 != null && day1 != null)
+                            if (atbc != null)
                             {
                             {
-                                try
+                                if (day2 != null && day1 != null)
                                 {
                                 {
-                                    int Han_day = (Convert.ToDateTime(day2) - Convert.ToDateTime(day1)).Days; //得到天数
-                                    dics.Add("Days", Han_day.ToString() + "天");//滞留天数
-                                    dics.Add("EntryTime", day1.ToString());//入境日期  TemporaryAddress
+                                    try
+                                    {
+                                        int Han_day = (Convert.ToDateTime(day2) - Convert.ToDateTime(day1)).Days; //得到天数
+                                        SetFieldValue(formFields, "visit_prtiod_stay", Han_day.ToString());       // 滞留天数
+                                    }
+                                    catch (Exception) { }
                                 }
                                 }
-                                catch (Exception) { }
                             }
                             }
-                        }
 
 
-                        //得到当前国家下的城市酒店信息
-                        var hotelInfo = _sqlSugar.Queryable<Grp_HotelReservations>()
-                            .Where(x => x.DiId == groupId)
-                            .Where(x => x.City.contains(HG_City))
-                            .First();
-                        //访问信息
-                        if (hotelInfo != null)
-                        {
-                            dics.Add("TemporaryAddress", hotelInfo?.HotelAddress ?? "");//停留酒店地址  TATel 
-                            dics.Add("TATel", hotelInfo?.HotelTel ?? "");   //停留酒店联系电话    
-                        }
-
-                        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();
-                            //在韩邀请方信息
-                            if (oa != null)
+                            //得到当前国家下的城市酒店信息
+                            var hotelInfo = _sqlSugar.Queryable<Grp_HotelReservations>()
+                                .Where(x => x.DiId == groupId)
+                                .Where(x => x.City.contains(HG_City))
+                                .First();
+                            //访问信息
+                            if (hotelInfo != null)
                             {
                             {
-                                dics.Add("IsYes", "√");
-                                dics.Add("TT", oa?.Contact ?? "");  //联系人
-                                dics.Add("TTAddress", oa?.Address ?? "");  //联系地址
-                                dics.Add("TTtel", oa?.Tel ?? "");  //联系电话
-                                dics.Add("TTGuanxi", "BY INVITED");  //和在邀联系人关系
+                                SetFieldValue(formFields, "visit_address", hotelInfo?.HotelAddress ?? ""); // 停留酒店地址
+                                SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? "");         // 停留酒店联系电话    
                             }
                             }
-                            else
-                                dics.Add("IsNo", "√");
-                        }
-
-                        //费用信息
-                        if (groupInfo != null)
-                        {
-                            //dics.Add("Payer", "Unit");  //在外期间费用承担
-                            dics.Add("Team1", groupInfo.ClientUnit); //客户单位名称
-                            dics.Add("Team12", "雇佣"); //与申请人关系  BY INVITED
-                            dics.Add("PriceType", "Payment By Unit");  //资金类型
-                            dics.Add("TeamNameTel", custInfo.ClientPhone); //联系方式
-                        }
-
-                        //是否有协助填表人
-                        if (!string.IsNullOrEmpty(custInfo.TableOpName))
-                            dics.Add("WirteTableNo", "√");
-                        else
-                        {
-                            dics.Add("WirteTableYes", "√");
-                            dics.Add("OpTableName", custInfo.TableOpName.ToString());  //协助填表人姓名
-                                                                                       //dics.Add("OpTableDateTime",custInfo.OpDate.ToString());   //填表时间 
-                            dics.Add("OpTableTel", custInfo.TableOpTel.ToString());     //协助人联系电话
-                            dics.Add("OpTableGuanXi", "雇佣");     //和协助人关系
-                        }
 
 
-                        dics.Add("NowDateTime", DateTime.Now.ToString("yyyy/MM/dd"));  //获取当前系统时间
-                        dics.Add("ApplicantName", custInfo.LastName + " " + custInfo.FirstName);  //申请人
+                            #endregion
+                            SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? ""); // 停留酒店联系电话 
+                            SetFieldValue(formFields, "visit_tel", hotelInfo?.HotelTel ?? ""); // 停留酒店联系电话 
 
 
-                        #endregion
+                            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 生成文件
+                            #endregion
 
 
-                        try
-                        {
-                            Document doc = new(currTempPath);
-                            Aspose.Words.DocumentBuilder builder = new(doc);
+                            #region 9. 在韩邀请方信息
 
 
-                            string strTemp = "";
+                            SetFieldValue(formFields, "invitation_no", selected);  // 是否有邀请方 - 否 默认选中
+                            SetFieldValue(formFields, "invitation_yes", "");       // 是否有邀请方 - 是
 
 
-                            //循环键值对
-                            foreach (var key in dics.Keys)
+                            if (!string.IsNullOrEmpty(HG_Country) && !string.IsNullOrEmpty(HG_City))
                             {
                             {
-                                //将光标移入书签的位置
-                                builder.MoveToBookmark(key);
+                                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();
 
 
-                                //判断书签值是否为空
-                                if (!string.IsNullOrEmpty(dics[key]))
+                                //邀请 接待单位 
+                                if (oa != null)
                                 {
                                 {
-                                    strTemp = dics[key];
+                                    SetFieldValue(formFields, "invitation_no", "");        // 是否有邀请方 - 否 
+                                    SetFieldValue(formFields, "invitation_yes", selected); // 是否有邀请方 - 是
+
+                                    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 ?? "");            // 邀请方 电话
                                 }
                                 }
-                                else strTemp = "";
+                            }
+                            #endregion
 
 
-                                //填充书签
-                                builder.Write(strTemp.Replace("\\N", "\n"));
+                            #region 9. 费用信息
+
+                            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); // 电话
+
+                            #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", "雇佣");      // 和协助人关系
                             }
                             }
 
 
-                            var custName = custInfo.LastName + custInfo.FirstName;
-                            string fileName = $"{custName}_{visaTypeName}.doc";
+                            #endregion
 
 
-                            var currFilePath = $"{korSavePath}{fileName}";
-                            doc.Save(currFilePath);
+                            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);      // 申请日期 - 日
 
 
-                            filePaths.Add(currFilePath);
+                            var applicant_name = custInfo.LastName + custInfo.FirstName;
+                            SetFieldValue(formFields, "declaration_applicant_name", applicant_name);  // 申请人姓名
+                            #endregion
+
+                            filePaths.Add(outputPath);
                         }
                         }
                         catch (Exception ex)
                         catch (Exception ex)
                         {
                         {
-                            return Ok(JsonView(false, $"{currTempPath}模板不存在!"));
+                            return Ok(JsonView(false, $"生成PDF文件时出错:{ex.Message}"));
+                        }
+                        finally
+                        {
+                            // 按正确顺序关闭资源
+                            stamper?.Close();
+                            reader?.Close();
+                            templateStream?.Close();
+                            outputStream?.Close();
                         }
                         }
                         #endregion
                         #endregion
                     }
                     }
@@ -6116,22 +6312,520 @@ FROM
                     {
                     {
                         EncryptionProcessor.DecryptProperties(custInfo);
                         EncryptionProcessor.DecryptProperties(custInfo);
 
 
-                        var visaData = new VisaDateView()
+                        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
                         {
                         {
-                            groupInfo = groupInfo,
-                            idInfo = certInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.PassportType == 773),
-                            passportInfo = certInfos.FirstOrDefault(x => x.DcId == custInfo.Id && x.PassportType == 774),
-                            custInfo = custInfo,
-                            schoolInfos = schoolInfos.Where(x => x.DcId == custInfo.Id).ToList(),
-                            familyInfos = familyInfos.Where(x => x.DcId == custInfo.Id).ToList(),
-                            companyInfos = companyInfos.Where(x => x.DcId == custInfo.Id).ToList()
-                        };
+                            string outputPath = $"{polandSavePath}{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))
+                            {
+                                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
+
+                            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
+
+
+                            SetFieldValue(formFields, "IdNo", idCard);                   // 身份证号码
+
+
+
+
+                            string selected = "√";
+
+                            #region 1. 个人信息
+
+
+
+                            
+
+                            #region 是否曾用别名从韩国出入境
+                            SetFieldValue(formFields, "applicant_no", selected);   // 否 默认选中
+                            SetFieldValue(formFields, "applicant_yes", "");
+
+                            string isGetSchengenStr = custInfo.IsGetSchengen == 0 ? "否" : "是";
+                            string oldName = custInfo?.OldName ?? "";
+                            if (!string.IsNullOrEmpty(oldName) && isGetSchengenStr.equals("是"))
+                            {
+                                SetFieldValue(formFields, "applicant_no", "");
+                                SetFieldValue(formFields, "applicant_yes", selected);
+                                if (!string.IsNullOrEmpty(oldName))
+                                {
+                                    SetFieldValue(formFields, "former_surname", oldName.Substring(0, 1));
+                                    SetFieldValue(formFields, "former_given_name", oldName.Remove(0, 1));
+                                }
+                            }
+
+                            #endregion
+
+                            #region 是否拥有双重国籍
+                            SetFieldValue(formFields, "dual_citizenship_no", selected);   // 否 默认选中
+                            SetFieldValue(formFields, "dual_citizenship_yes", "");
+                            SetFieldValue(formFields, "dual_citizenship_remark", "");
+                            #endregion
+
+                            #endregion
+
+                            #region 2. 申请签证信息
+
+                            //SetFieldValue(formFields, "overstay_period_over_90_days", selected);  // 90天以上长期滞留
+                            //SetFieldValue(formFields, "overstay_period_under_90_days", selected); // 90天以下短期滞留
+                            //SetFieldValue(formFields, "overstay_period_status", "");         // 滞留资格
+
+                            #endregion
+
+                            #region 3. 护照信息
+
+                            //清除值
+                            SetFieldValue(formFields, "passport_type_diplomatic", ""); // 旅行证件类型 - 外交护照
+                            SetFieldValue(formFields, "passport_type__official", "");  // 旅行证件类型 - 公务护照
+                            SetFieldValue(formFields, "passport_type__regular", "");   // 旅行证件类型 - 普通护照
+                            SetFieldValue(formFields, "passport_type__other", "");     // 旅行证件类型 - 其它
+                            //设置值
+                            if (passportInfo != null)
+                            {
+                                // 签证类型
+                                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, "passport_type_diplomatic", selected);     // 旅行证件类型 - 外交护照
+                                    else if (visaName.contains("公务")) SetFieldValue(formFields, "passport_type__official", selected); // 旅行证件类型 - 公务护照
+                                    else if (visaName.contains("普通")) SetFieldValue(formFields, "passport_type__regular", selected);  // 旅行证件类型 - 普通护照
+                                    else if (visaName.contains("其它"))                                                                 // 旅行证件类型 - 其它
+                                    {
+                                        SetFieldValue(formFields, "passport_type__other", selected);
+                                        SetFieldValue(formFields, "passport_type__other_remark", "");
+                                    }
+                                    else SetFieldValue(formFields, "passport_ordinary", selected);                                      // 旅行证件类型 - 普通护照
+                                }
+
+                                SetFieldValue(formFields, "passport_no", passportInfo.CertNo);        // 签证 编号
+                                SetFieldValue(formFields, "passport_country", passportInfo.Country);  // 签发 国
+                                SetFieldValue(formFields, "passport_issuePlace", passportInfo.Area);  // 签发 地
+                                SetFieldValue(formFields, "passport_issue_date", passportInfo.IssueDt?.ToString("yyyy-MM-dd") ?? "");  // 签发日期
+                                SetFieldValue(formFields, "passport_expiryDate", passportInfo.ExpiryDt?.ToString("yyyy-MM-dd") ?? ""); // 有效期至
+
+                                #region 是否有其他护照信息
+                                SetFieldValue(formFields, "otherPassport_no", selected);  // 否 默认选中
+                                SetFieldValue(formFields, "otherPassport_yes", ""); // 是
+                                //清除值
+                                SetFieldValue(formFields, "other_passport_type_diplomatic", ""); // 旅行证件类型 - 外交护照
+                                SetFieldValue(formFields, "other_passport_type_official", "");   // 旅行证件类型 - 公务护照
+                                SetFieldValue(formFields, "other_passport_type_regular", "");    // 旅行证件类型 - 普通护照
+                                SetFieldValue(formFields, "other_passport_type_other", "");      // 旅行证件类型 - 其它
+                                SetFieldValue(formFields, "other_passport_no", "");              // 签证 编号
+                                SetFieldValue(formFields, "other_passport_country", "");         // 签发 国
+                                SetFieldValue(formFields, "other_passport_expiry_date", "");    // 有效期至
+                                #endregion
+                            }
+
+                            #endregion
+
+                            #region 4. 联系信息
+
+                            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);      // 电子邮件
+
+                            #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", ""); // 关系 
+                            #endregion
 
 
-                        //生成文件
-                        string outFilePath = CreatePolandVisaPdf(visaData, polandSavePath, currTempPath);
+                            #endregion
+
+                            #region 5. 婚姻状况及家庭成员信息
+                            
+
+                            //子女信息
+                            SetFieldValue(formFields, "famliy_children_no", selected);  // 否
+                            SetFieldValue(formFields, "famliy_children_yes", "");  // 是
+                            if (currFamilyInfos.Count > 0)
+                            {
+                                // 定义接受子女人数
+                                int children = currFamilyInfos.Where(x => x.Appellation.contains("儿子") || x.Appellation.contains("女儿")).ToList().Count;
 
 
-                        filePaths.Add(outFilePath);
+                                // 判断子女人数
+                                if (children > 0)
+                                {
+                                    SetFieldValue(formFields, "famliy_children_yes", selected);
+                                    SetFieldValue(formFields, "famliy_children_number", children.ToString()); // 子女人数
+                                }
+                            }
 
 
+                            #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", "");              // 其他 - 备注
+
+                            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
+                            {
+                                SetFieldValue(formFields, "education_other", selected);
+                                SetFieldValue(formFields, "education_other_remark", custInfo.HighestEducation.Trim());
+                            }
+
+                            SetFieldValue(formFields, "education_school_name", "");               // 学校名称
+                            SetFieldValue(formFields, "education_school_address", "");            // 学校地址
+                            #endregion
+
+                            #region 7. 职业
+
+                            //清除值
+                            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", "");  // 其他 - 备注
+
+                            //职业信息
+                            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 ?? "");    // 电话
+                            }
+
+                            #endregion
+
+                            #region 8. 访问信息
+
+                            //入境事由 
+                            //清除值
+                            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", "");    // 其他 - 备注
+
+                            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("活动"))
+                                {
+                                    SetFieldValue(formFields, "korea_meeting", selected);          // 参加会议等活动
+                                }
+                                else if (visit_purpose.contains("医疗") || visit_purpose.contains("旅游"))
+                                {
+                                    SetFieldValue(formFields, "korea_medical_tourism", selected);  // 医疗旅游
+                                }
+                                else if (visit_purpose.contains("短期商务") || visit_purpose.contains("商务"))
+                                {
+                                    SetFieldValue(formFields, "korea_business", selected);         // 短期商务
+                                }
+                                else if (visit_purpose.contains("学习") || visit_purpose.contains("培训"))
+                                {
+                                    SetFieldValue(formFields, "korea_study", selected);         // 学习/培训
+                                }
+                                else if (visit_purpose.contains("就业活动"))
+                                {
+                                    SetFieldValue(formFields, "korea_work", selected);             // 就业活动
+                                }
+                                else if (visit_purpose.contains("贸易") || visit_purpose.contains("投资") || visit_purpose.contains("派驻"))
+                                {
+                                    SetFieldValue(formFields, "korea_trade", selected);            // 贸易/投资/派驻
+                                }
+                                else if (visit_purpose.contains("探亲访友") || visit_purpose.contains("探亲") || visit_purpose.contains("访友"))
+                                {
+                                    SetFieldValue(formFields, "korea_visiting_family", selected);  // 探亲访友
+                                }
+                                else if (visit_purpose.contains("结婚移民") || visit_purpose.contains("结婚") || visit_purpose.contains("移民"))
+                                {
+                                    SetFieldValue(formFields, "marriage_migrant", selected);       // 结婚移民
+                                }
+                                else if (visit_purpose.contains("外交") || visit_purpose.contains("公务"))
+                                {
+                                    SetFieldValue(formFields, "korea_diplomatic", selected);       // 外交/公务
+                                }
+                                else
+                                {
+                                    SetFieldValue(formFields, "korea_other", selected);            // 其他
+                                    SetFieldValue(formFields, "korea_other_details", visit_purpose);// 其他 - 备注
+                                }
+                            }
+
+                            #region 滞留信息
+                            string day1 = "";   //得到抵达日期
+                            string day2 = "";   //得到离开日期
+
+                            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('、');
+                            }
+
+                            var atbc = GeneralMethod.GetTableByBlackCode(groupId);
+                            int k = 0;
+                            for (int i = 0; i < HG_countryName.Length; i++)
+                            {
+                                for (int j = 0; j < atbc.Rows.Count; j++)
+                                {
+                                    string HL_Three = atbc.Rows[j]["Three"].ToString();
+
+                                    if (!string.IsNullOrEmpty(HL_Three))
+                                    {
+
+                                        var hl_three = HL_Three.Substring(3);
+                                        var tc = _sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.Three == hl_three).First();
+                                        if (tc != null)
+                                        {
+                                            HG_Country = HG_countryName[i];
+                                            HG_City = tc.City;  //得到当前国家 城市名
+                                            day1 = atbc.Rows[j]["Day"].ToString();  //得到抵达日期
+                                            k = j + 1;
+                                        }
+
+                                    }
+                                    if (k == j)
+                                        day2 = atbc.Rows[j]["Day"].ToString(); //离开航班起飞时间
+                                }
+                            }
+
+                            if (atbc != null)
+                            {
+                                if (day2 != null && day1 != null)
+                                {
+                                    try
+                                    {
+                                        int Han_day = (Convert.ToDateTime(day2) - Convert.ToDateTime(day1)).Days; //得到天数
+                                        SetFieldValue(formFields, "visit_prtiod_stay", Han_day.ToString());       // 滞留天数
+                                    }
+                                    catch (Exception) { }
+                                }
+                            }
+
+                            //得到当前国家下的城市酒店信息
+                            var hotelInfo = _sqlSugar.Queryable<Grp_HotelReservations>()
+                                .Where(x => x.DiId == groupId)
+                                .Where(x => x.City.contains(HG_City))
+                                .First();
+                            //访问信息
+                            if (hotelInfo != null)
+                            {
+                                SetFieldValue(formFields, "visit_address", hotelInfo?.HotelAddress ?? ""); // 停留酒店地址
+                                SetFieldValue(formFields, "visit_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", ""); // 是否有随行家属
+
+                            #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();
+
+                                //邀请 接待单位 
+                                if (oa != null)
+                                {
+                                    SetFieldValue(formFields, "invitation_no", "");        // 是否有邀请方 - 否 
+                                    SetFieldValue(formFields, "invitation_yes", selected); // 是否有邀请方 - 是
+
+                                    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 ?? "");            // 邀请方 电话
+                                }
+                            }
+                            #endregion
+
+                            #region 9. 费用信息
+
+                            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); // 电话
+
+                            #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
+
+                            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);      // 申请日期 - 日
+
+                            var applicant_name = custInfo.LastName + custInfo.FirstName;
+                            SetFieldValue(formFields, "declaration_applicant_name", applicant_name);  // 申请人姓名
+                            #endregion
+
+                            filePaths.Add(outputPath);
+                        }
+                        catch (Exception ex)
+                        {
+                            return Ok(JsonView(false, $"生成PDF文件时出错:{ex.Message}"));
+                        }
+                        finally
+                        {
+                            // 按正确顺序关闭资源
+                            stamper?.Close();
+                            reader?.Close();
+                            templateStream?.Close();
+                            outputStream?.Close();
+                        }
+                        #endregion
                     }
                     }
 
 
                     break;
                     break;