Quellcode durchsuchen

优化时间处理

yuanrf vor 1 Jahr
Ursprung
Commit
be052565dd

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

@@ -282,7 +282,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         List<Crm_CustomerCert> _CustomerCerts = await _sqlSugar.Queryable<Crm_CustomerCert>().Where(it => it.IsDel == 0 && it.SdId == 773).ToListAsync(); // 身份证类型证件信息
                         List<Crm_CustomerCompany> CompanyArr = await _sqlSugar.Queryable<Crm_CustomerCompany>().Where(it => it.IsDel == 0).ToListAsync();
                         var TourClientListInfoArr = new List<TourClientListProcessInfo>();
-
+                        var timeParam = new DateTime();
                         foreach (var item in _DeleClients)
                         {
                             var param = new TourClientListProcessInfo();
@@ -295,7 +295,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                             param.IDCardNo = clientIDInfo.CertNo;
                             param.Remark = item.Remark;
-                            param.BirthDay = clientInfo.BirthDay.Length > 10 ? clientInfo.BirthDay.Substring(0, 10).Replace("/", "-").Trim() : "";
+                            param.BirthDay = DateTime.TryParse(clientInfo.BirthDay, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
                             param.FirstName = clientInfo.FirstName;
                             param.LastName = clientInfo.LastName;
                             param.CompanyFullName = Company.CompanyFullName;
@@ -314,8 +314,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                         GroupProcessOperationDtoParam.PortType = dto.PortType;
                         GroupProcessOperationDtoParam.TourClientListInfos = TourClientListInfoArr;
-                        GroupProcessOperationDtoParam.VisitDate = GroupProcessOperationDtoParam.VisitDate.Length > 10 ? GroupProcessOperationDtoParam.VisitDate.Substring(0, 10).Replace("/","-").Trim() : "";
-                        GroupProcessOperationDtoParam.TontractTime = GroupProcessOperationDtoParam.TontractTime.Length > 10 ? GroupProcessOperationDtoParam.TontractTime.Substring(0, 10).Replace("/","-").Trim() : "";
+                        GroupProcessOperationDtoParam.VisitDate = DateTime.TryParse(GroupProcessOperationDtoParam.VisitDate, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+                        GroupProcessOperationDtoParam.TontractTime = DateTime.TryParse(GroupProcessOperationDtoParam.TontractTime, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
 
                         result.Data = GroupProcessOperationDtoParam;
                     }