Sfoglia il codice sorgente

团组操作-批量添加 日期格式判断问题

jiangjc 10 mesi fa
parent
commit
7b0e51fdda

+ 1 - 1
OASystem/OASystem.Domain/Dtos/Groups/AirTicketResDto.cs

@@ -13,8 +13,8 @@ namespace OASystem.Domain.Dtos.Groups
     {
         public int DiId { get; set; } = 0;
         public int UserId { get; set; } = 0;
+        public int IsPaySign { get; set; } = -1;
 
-        
     }
    public class ItineraryAirTicketResDto
     {

+ 2 - 0
OASystem/OASystem.Domain/Dtos/Groups/DecreasePaymentsDto.cs

@@ -15,11 +15,13 @@ namespace OASystem.Domain.Dtos.Groups
         public int CTId { get; set; }
         public int PageIndex { get; set; } = 1;
         public int PageSize { get; set; } = 10;
+        
     }
     public class DecreasePaymentsListDto
     {
         public int UserId { get; set; }
         public int DiId { get; set; }
+        public int IsPaySign { get; set; } = -1;
     }
     /// <summary>
     /// 团组增减款项操作

+ 2 - 0
OASystem/OASystem.Domain/Dtos/Groups/InvitationOfficialActivitiesListDto.cs

@@ -18,6 +18,8 @@ namespace OASystem.Domain.Dtos.Groups
 
         public int PageIndex { get; set; } = 1;
         public int PageSize { get; set; } = 10;
+
+        public int IsPaySign { get; set; }
     }
 
     /// <summary>

+ 1 - 0
OASystem/OASystem.Domain/Dtos/Groups/VisaPriceDto.cs

@@ -19,6 +19,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// 客户名称
         /// </summary>
         public String VisaClient { get; set; }
+        public int IsPaySign { get; set; }
     }
     public class PostVisaByIdDto 
     {

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

@@ -22,6 +22,7 @@ namespace OASystem.Domain.ViewModels.Groups
 
         public string FlightDescription { get; set; }
         public string ClientNameStr { get; set; }
+        public int IsPay { get; set; }
     }
 
     public class AirGroupCostParameterView

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

@@ -36,5 +36,6 @@ namespace OASystem.Domain.ViewModels.Groups
         public string CreateUserName { get; set; }
         public DateTime CreateTime { get; set; }
         public int isAudit { get; set; }
+        public int IsPay { get; set; }
     }
 }

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

@@ -53,6 +53,7 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 签证描述
         /// </summary>
         public string VisaDescription { get; set; }
+        public int IsPay { get; set; }
     }
 
 }

+ 9 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -93,14 +93,20 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     UserId = "0";
                 }
-                string sql = string.Format(@"Select atr.*,ccp.IsAuditGM,sd1.Name As CTypeName,sd2.Name As PreCurrencyStr,sd3.Name As CurrencyStr
+                string sqlWhere = "";
+                if (dto.IsPaySign != -1)
+                {
+                    sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
+                }
+
+                string sql = string.Format(@"Select atr.*,ccp.IsAuditGM,sd1.Name As CTypeName,sd2.Name As PreCurrencyStr,sd3.Name As CurrencyStr,ccp.IsPay
                                              From Grp_AirTicketReservations atr
                                              Left Join Grp_CreditCardPayment ccp On atr.Id = ccp.CId  And atr.DIId = ccp.DIId And ccp.IsDel = 0
                                              Left Join Sys_SetData sd1 On sd1.Id = atr.ctype
                                              Left Join Sys_SetData sd2 On sd2.Id = atr.PreCurrency
                                              Left Join Sys_SetData sd3 On sd3.Id = atr.Currency
-                                             Where atr.IsDel = 0 And atr.DIId={0} 
-                                             Order By atr.FlightsDate Asc", dto.DiId);
+                                             Where atr.IsDel = 0 And atr.DIId={0} {1}
+                                             Order By atr.FlightsDate Asc", dto.DiId, sqlWhere);
                 List<AirTicketReservationsView> _AirTicketReservations = _sqlSugar.SqlQueryable<AirTicketReservationsView>(sql).ToList();
 
                 foreach (var item in _AirTicketReservations)

+ 16 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -42,10 +42,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 //List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 98).ToList();
                 //UserId = string.Join(",", gtaUIdList.Select(it => it.UId).ToList());
 
-                string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
-                                            (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
-                                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and DiId = {0} and IsDel=0) as 'isAudit' from Grp_DecreasePayments s 
-                                            where DIID={0} and IsDel=0  and s.CreateUserId in ({1}) ", dto.DiId, dto.UserId);
+                //string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
+                //                            (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
+                //                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and DiId = {0} and IsDel=0) as 'isAudit' from Grp_DecreasePayments s 
+                //                            where DIID={0} and IsDel=0  and s.CreateUserId in ({1}) ", dto.DiId, dto.UserId);
+
+                string sqlWhere = "";
+                if (dto.IsPaySign != -1) {
+                    sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
+                }
+
+                string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.Price,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
+ccp.IsAuditDM as isAudit,ccp.IsPay
+From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
+Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
+Left Join Sys_Users as su On gdp.CreateUserId = su.Id
+Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
                 List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
                 if (_DecreasePayments.Count > 0)
                 {

+ 13 - 5
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -563,7 +563,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             companyId = companyAdd;
                         }
                     }
-                    
+
                     _DeleClientInfo = new Crm_DeleClient() 
                     {
                         LastName = item.LastName,
@@ -572,9 +572,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         CrmCompanyId = companyId,
                         Job = item.Job,
                         Sex = item.Sex,
-                        Phone = item.Phone,
-                        BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay),
+                        Phone = item.Phone
                     };
+                    string temp_birthDay = "";
+                    DateTime tempDt_Birthday;
+                    bool b_birth = DateTime.TryParse(item.BirthDay, out tempDt_Birthday);
+                    _DeleClientInfo.BirthDay = b_birth ? tempDt_Birthday : null;
+
                     var clientAdd = await _sqlSugar.Insertable(_DeleClientInfo).ExecuteReturnIdentityAsync();
                     if (clientAdd < 0)
                     {
@@ -635,9 +639,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         FirstName = item.FirstName,
                         Pinyin = item.Pinyin,
                         Sex = item.Sex,
-                        Phone = item.Phone,
-                        BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay)
+                        Phone = item.Phone
                     };
+                    string temp_birthDay = "";
+                    DateTime tempDt_Birthday;
+                    bool b_birth = DateTime.TryParse(item.BirthDay, out tempDt_Birthday);
+                    _DeleClient.BirthDay = b_birth ? tempDt_Birthday : null;
+
                     var clientEdit = await _sqlSugar.Updateable(_DeleClient).UpdateColumns(it =>
                                                                                  new
                                                                                  {

+ 17 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -14,6 +14,7 @@ using OASystem.Infrastructure.Tools;
 using Org.BouncyCastle.Asn1.Cms;
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Linq;
 using System.Security.Cryptography;
 using System.Text;
@@ -69,6 +70,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     UserId = "0";
                 }
                 sqlWhere += string.Format(@" And v.CreateUserId in ({0})", UserId);
+
+                if (dto.IsPaySign != -1)
+                {
+                    sqlWhere += string.Format(@" And c.IsPay = {0} ", dto.IsPaySign);
+                }
+
                 if (!string.IsNullOrEmpty(sqlWhere.Trim()))
                 {
                     Regex r = new Regex("And");
@@ -80,9 +87,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 int endIndex = startIndex + dto.PageSize - 1;
                 if (dto.PortType==1)
                 {
-                    string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id and IsDel=0) IsAuditGM,
-                                                (select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from
-                                                Grp_VisaInfo v {0} order by CreateTime desc",sqlWhere);
+                    //string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id and IsDel=0) IsAuditGM,
+                    //                            (select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from
+                    //                            Grp_VisaInfo v {0} order by CreateTime desc",sqlWhere);
+
+                    string sql = string.Format(@" Select v.*, c.IsAuditGM,c.IsPay,sd1.[Name] as VisaCurrencyStr
+From Grp_VisaInfo as v With(Nolock) Left Join Grp_CreditCardPayment as c With(Nolock) On v.Id = c.CId
+Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
+{0} And c.CTable = 80 And c.IsDel = 0 And sd1.IsDel = 0  ", sqlWhere);
+
                     List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
                     var parseIntValue = 0;
                     var CrmIds = (from item in infoViews
@@ -244,7 +257,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     }
                 }
             }
-            catch (Exception)
+            catch (Exception ex)
             {
                 return result = new Result() { Code = -2, Msg = "未知错误" };
                 throw;