Selaa lähdekoodia

签证下载 调整出生日期取值方式1、身份证 2、表存储值

Lyyyi 1 päivä sitten
vanhempi
commit
bafdbbbf33

+ 46 - 16
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3689,13 +3689,13 @@ FROM
             var familys = new List<Crm_VisaCustomerFamily>();
             var schools = new List<Crm_VisaCustomerSchool>();
             var works = new List<Crm_VisaCustomerCompany>();
-            var refusalRecords = new List<VisaRefusalRecord>(); //拒签记录
-            var travelHistories = new List<TravelHistory>();    //出行历史 
-            var militaries = new List<MilitaryInfo>();          //军事信息  
-            var countryVisiteds = new List<CountryVisited>();   //已出访的国家
-            var schengenVisaRecords = new List<SchengenVisaRecord>();   //申根签证记录 
-            var socialAccounts = new List<SocialAccount>();   //社交账号 
-            var personInfos = new List<PersonInfo>();   //亲属朋友信息
+            var refusalRecords = new List<VisaRefusalRecord>(); // 拒签记录
+            var travelHistories = new List<TravelHistory>();    // 出行历史 
+            var militaries = new List<MilitaryInfo>();          // 军事信息  
+            var countryVisiteds = new List<CountryVisited>();   // 已出访的国家
+            var schengenVisaRecords = new List<SchengenVisaRecord>();   // 申根签证记录 
+            var socialAccounts = new List<SocialAccount>();   // 社交账号 
+            var personInfos = new List<PersonInfo>();   // 亲属朋友信息
 
             try
             {
@@ -4300,8 +4300,11 @@ FROM
                             return Ok(JsonView(false, "工作信息添加失败!"));
                         }
                     }
-
                 }
+
+                _sqlSugar.CommitTran();
+                return Ok(JsonView(true, "操作成功"));
+
             }
             catch (Exception ex)
             {
@@ -4309,11 +4312,9 @@ FROM
                 return Ok(JsonView(false, ex.Message));
             }
 
-            _sqlSugar.CommitTran();
             #endregion
             #endregion
 
-            return Ok(JsonView(true));
         }
 
         private static bool TryGetNonEmptyStringProperty(JsonElement root, string propertyName, out string value)
@@ -7857,15 +7858,44 @@ FROM
                             SetFieldValue(formFields, "firstname", CommonFun.ConvertToPinyin(custInfo?.FirstName?.Trim() ?? "")?.ToLower() ?? "");   // 名 英文
 
                             #region 出生日期(日-月-年)
-                            string idCard = idInfo?.CertNo?.Trim() ?? "";
                             string birthday = string.Empty;
-                            if (!string.IsNullOrEmpty(idCard))
+                            string idCard = idInfo?.CertNo?.Trim() ?? "";
+
+                            // 1. 优先从身份证中提取 (需为18位身份证)
+                            if (!string.IsNullOrEmpty(idCard) && idCard.Length >= 14)
                             {
-                                string year = idCard.Substring(6, 4);
-                                string month = idCard.Substring(10, 2);
-                                string day = idCard.Substring(12, 2);
-                                birthday = day + "-" + month + "-" + year;
+                                try
+                                {
+                                    string year = idCard.Substring(6, 4);
+                                    string month = idCard.Substring(10, 2);
+                                    string day = idCard.Substring(12, 2);
+
+                                    // 统一格式为 yyyy-MM-dd
+                                    birthday = $"{day}-{month}-{year}";
+                                }
+                                catch
+                                {
+                                    // 如果截取失败,回退为空
+                                    birthday = string.Empty;
+                                }
                             }
+
+                            // 2. 身份证不存在或提取失败,则从 custInfo 获取
+                            if (string.IsNullOrEmpty(birthday))
+                            {
+                                DateTime? date = custInfo?.BirthDay;
+
+                                // 验证逻辑:排除空值、1900年、或 DateTime.MinValue
+                                if (!date.HasValue || date.Value.Year == 1900 || date.Value == DateTime.MinValue)
+                                {
+                                    birthday = "";
+                                }
+                                else
+                                {
+                                    birthday = date.Value.ToString("dd-MM-yyyy");
+                                }
+                            }
+
                             SetFieldValue(formFields, "birthday", birthday);
                             #endregion
 

+ 0 - 1
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -5886,7 +5886,6 @@ Where dfp.IsDel = 0
 -- And dfp.IsPay = 1
 ");//--Order By dfp.CreateTime Desc
 
-
                 if (_dto.Type == 1) //data
                 {
                     RefAsync<int> total = 0;

+ 1 - 0
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -634,6 +634,7 @@ namespace OASystem.Domain.ViewModels.Groups
     /// </summary>
     public class CrmByGroupIdView
     {
+        public int DcId { get; set; }
         /// <summary>
         /// 团组Id
         /// </summary>

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -1335,6 +1335,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (string.IsNullOrEmpty(idNo)) idNo = "-";
 
                     view.Add(new() {
+                        DcId = item.Id,
                         GrpId = dto.GroupId,
                         ClientName = item.LastName + item.FirstName,
                         Tel = item.Tel ?? "-",