瀏覽代碼

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

yuanrf 2 月之前
父節點
當前提交
e9bb2021f2

+ 66 - 14
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3,6 +3,7 @@ using Aspose.Words;
 using Aspose.Words.Drawing;
 using Aspose.Words.Tables;
 using DiffMatchPatch;
+using EyeSoft.Collections.Generic;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.EntityFrameworkCore.Query.Internal;
 using NPOI.HSSF.UserModel;
@@ -412,12 +413,12 @@ namespace OASystem.API.Controllers
             watch.Start();
             RefAsync<int> total = 0;
             var countyDatas = await _sqlSugar.Queryable<Grp_DelegationInfo>()
-                                             .Where((di) => di.IsDel == 0 && !string.IsNullOrWhiteSpace(di.TeamName))
-                                             .WhereIF(!string.IsNullOrEmpty(dto.Search), (di) => di.TeamName.Contains(dto.Search))
-                                             .OrderBy((di) => new { id = SqlFunc.Desc(di.Id) })
-                                             .Select((di) => new { id = di.Id, name = di.TeamName, di.ClientName, di.VisitPNumber, di.VisitCountry, di.VisitDays, di.VisitStartDate, di.VisitEndDate, di.TourCode })
-                                             .Distinct()
-                                             .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+                .Where((di) => di.IsDel == 0 && !string.IsNullOrWhiteSpace(di.TeamName))
+                .WhereIF(!string.IsNullOrEmpty(dto.Search), (di) => di.TeamName.Contains(dto.Search))
+                .OrderBy((di) => new { id = SqlFunc.Desc(di.Id) })
+                .Select((di) => new { id = di.Id, name = di.TeamName, di.ClientName, di.VisitPNumber, di.VisitCountry, di.VisitDays, di.VisitStartDate, di.VisitEndDate,di.TourCode })
+                .Distinct()
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
             watch.Stop();
 
             return Ok(JsonView(true, $"{MsgTips.Succeed},耗时 {watch.ElapsedMilliseconds} ms", countyDatas, total));
@@ -5666,6 +5667,9 @@ FROM
                 var _DayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
                 if (_EnterExitCosts == null) return Ok(JsonView(400, "该团组未填写出入境费用;", ""));
 
+                var currencyInit = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66).ToList();
+                var enterExitCostCurrencys = (List<CurrencyInfo>?)CommonFun.GetCurrencyChinaToList(_EnterExitCosts.CurrencyRemark);
+
                 //数据源
                 var dac1 = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
                 var dac2 = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
@@ -5687,6 +5691,20 @@ FROM
                     .OrderBy((x) => x.Index)
                     .ToList();                                               //其他款项费用
 
+                var peiceItemCurrencys = new List<string>();
+                if (_DayAndCosts.Any()) {
+                    var currencyIds =  _DayAndCosts.Select(x => x.Currency).Distinct().ToList();
+                    if (currencyIds.Any()) peiceItemCurrencys.AddRange(currencyInit.Where(x => currencyIds.Contains(x.Id)).Select(x => x.Name).ToList());
+                }
+                if (dac5.Any()) peiceItemCurrencys.AddRange(dac5.Select(x => x.CurrencyStr).Distinct().ToList());
+
+                var peiceItemCurrencyInfos= new List<CurrencyInfo>();
+                if (enterExitCostCurrencys.Any() && peiceItemCurrencys.Any())
+                {
+                    peiceItemCurrencyInfos = enterExitCostCurrencys.Where(x => peiceItemCurrencys.Contains(x.CurrencyCode)).ToList();
+                }
+
+
                 var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
                 var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
                 var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
@@ -5811,12 +5829,21 @@ FROM
                             airPriceStr += $" {_EnterExitCosts.AirTD.ToString("#0.00")} 元/人(头等舱)";
                         }
 
-                        string twoItemRemark = "备注:";
-                        if (!string.IsNullOrEmpty(_EnterExitCosts.TwoItemRemark))
+                        //汇率描述
+                        string rateStr = "";
+                        if (peiceItemCurrencyInfos.Any())
                         {
-                            twoItemRemark = _EnterExitCosts.TwoItemRemark;
+                            rateStr = "\r\n汇率描述:";
+                            foreach (var item in peiceItemCurrencyInfos)
+                            {
+                                rateStr += $"{item.CurrencyName}({item.CurrencyCode}):{item.Rate.ToString("#0.0000")}  ";
+                            }
                         }
 
+                        string twoItemRemark = "备注:";
+                        if (!string.IsNullOrEmpty(_EnterExitCosts.TwoItemRemark)) twoItemRemark += _EnterExitCosts.TwoItemRemark;
+                        if (!string.IsNullOrEmpty(rateStr)) twoItemRemark += rateStr;
+
                         dic.Add("AirTotalStr", airTotalStr);
                         dic.Add("AirPriceStr", airPriceStr);
                         dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
@@ -6115,7 +6142,6 @@ FROM
 
                         #endregion
 
-
                         #region 设置页眉
 
                         string userLabel = string.Empty;
@@ -7737,6 +7763,8 @@ FROM
                 var countryIds = _DayAndCosts.Select(x => x.NationalTravelFeeId).ToList();
                 var nationalTravelFeeData = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0 && countryIds.Contains(it.Id)).ToList();
 
+                var enterExitCostCurrencys = (List<CurrencyInfo>?)CommonFun.GetCurrencyChinaToList(_EnterExitCosts.CurrencyRemark);
+
                 //数据源
                 var dac1 = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
                 var dac2 = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
@@ -7759,7 +7787,21 @@ FROM
                     .ToList();                                               //其他款项费用
 
                 var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
-                
+
+                var peiceItemCurrencys = new List<string>();
+                if (_DayAndCosts.Any())
+                {
+                    var currencyIds = _DayAndCosts.Select(x => x.Currency).Distinct().ToList();
+                    if (currencyIds.Any()) peiceItemCurrencys.AddRange(_CurrDatas.Where(x => currencyIds.Contains(x.Id)).Select(x => x.Name).ToList());
+                }
+                if (dac5.Any()) peiceItemCurrencys.AddRange(dac5.Select(x => x.CurrencyStr).Distinct().ToList());
+
+                var peiceItemCurrencyInfos = new List<CurrencyInfo>();
+                if (enterExitCostCurrencys.Any() && peiceItemCurrencys.Any())
+                {
+                    peiceItemCurrencyInfos = enterExitCostCurrencys.Where(x => peiceItemCurrencys.Contains(x.CurrencyCode)).ToList();
+                }
+
                 var threeCodes = _sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList();
                 var placeData = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
                 var rateDatas = await _EnterExitCosts.CurrencyRemark.SplitExchangeRate();
@@ -7860,11 +7902,21 @@ FROM
                             airPriceStr += $" {_EnterExitCosts.AirTD.ToString("#0.00")} 元/人(头等舱)";
                         }
 
-                        string twoItemRemark = "备注:";
-                        if (!string.IsNullOrEmpty(_EnterExitCosts.TwoItemRemark))
+                        //汇率描述
+                        string rateStr = "";
+                        if (peiceItemCurrencyInfos.Any())
                         {
-                            twoItemRemark = _EnterExitCosts.TwoItemRemark;
+                            rateStr = "\r\n汇率描述:";
+                            foreach (var item in peiceItemCurrencyInfos)
+                            {
+                                rateStr += $"{item.CurrencyName}({item.CurrencyCode}):{item.Rate.ToString("#0.0000")}  ";
+                            }
                         }
+                        
+                        string twoItemRemark = "备注:";
+                        if (!string.IsNullOrEmpty(_EnterExitCosts.TwoItemRemark)) twoItemRemark += _EnterExitCosts.TwoItemRemark;
+
+                        if (!string.IsNullOrEmpty(rateStr)) twoItemRemark += rateStr;
 
                         dic.Add("AirTotalStr", airTotalStr);
                         dic.Add("AirPriceStr", airPriceStr);

+ 71 - 10
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -11,6 +11,7 @@ using System.Data;
 using System.Diagnostics;
 using System.Linq;
 using OASystem.Domain.Attributes;
+using EyeSoft.Extensions;
 
 namespace OASystem.API.Controllers
 {
@@ -271,15 +272,8 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryUserSelect()
         {
-            try
-            {
-                Result resTable = _clientDataRepository.QueryUserSelect();
-                return Ok(JsonView(true, resTable.Msg, resTable.Data));
-            }
-            catch (Exception)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-            }
+            Result resTable = _clientDataRepository.QueryUserSelect();
+            return Ok(JsonView(true, resTable.Msg, resTable.Data));
         }
 
         /// <summary>
@@ -625,6 +619,73 @@ namespace OASystem.API.Controllers
 
         }
 
+        /// <summary>
+        /// 客户资料数据 历史记录 Init
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> NewClientDataRecordInit(NewClientDataRecordInitDto dto)
+        {
+
+            #region 参数验证
+            if (dto.UserId < 0) return Ok(JsonView(false, MsgTips.UserId));
+            if (!SharingStaticData.PortTypes.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+            if (dto.PageId < 0) return Ok(JsonView(false, MsgTips.PageId));
+            #endregion
+
+            #region 页面操作权限验证
+            var pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+
+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
+            #endregion
+            var enumfiltrates = new string[] { "NoOperation", "Audit", "Login" };
+            var operations = EnumHelper.GetEnumDescriptions(typeof(OperationEnum), enumfiltrates);
+
+            object userDatas = Array.Empty<object>();
+            if (dto.UserId == 21)
+            {
+                var userIds = await _sqlSugar.Queryable<Crm_ClientDataAndUser>().Where(x => x.IsDel == 0).Select(x => x.usersId).Distinct().ToListAsync();
+                if (userIds.Any())
+                {
+                    userDatas = await _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0 && userIds.Contains(x.Id)).Select(x => new { value = x.Id, text = x.CnName }).ToListAsync();
+                }
+            }
+
+            var data = new {
+                operations = operations,
+                userDatas = userDatas
+            };
+            return Ok(JsonView(data));
+
+        }
+
+        /// <summary>
+        /// 客户资料数据 历史记录
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> NewClientDataRecord(NewClientDataRecordDto dto)
+        {
+            #region 参数验证
+            if (dto.UserId < 0) return Ok(JsonView(false, MsgTips.UserId));
+            if (!SharingStaticData.PortTypes.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+            if (dto.PageId < 0) return Ok(JsonView(false, MsgTips.PageId));
+            #endregion
+
+            #region 页面操作权限验证
+            var pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+
+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
+            #endregion
+
+            return Ok(await _clientDataRepository.NewClientDataRecord(dto));
+
+        }
+
         #region 修改数据
         //[HttpPost]
         //public IActionResult SynchronizationData()
@@ -889,7 +950,7 @@ namespace OASystem.API.Controllers
         /// <summary>
         /// 客户资料 操作记录记录查询
         /// </summary>
-        /// <param name="dto"></param>
+        /// <param name="userId"></param>
         /// <returns></returns>
         [HttpGet]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]

+ 48 - 49
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -55,7 +55,6 @@ namespace OASystem.API.Controllers
         private readonly List<int> _portIds;
         private readonly BasicInsuranceCostRepository _insuranceCostRep;
 
-
         public ResourceController(
             IMapper mapper, 
             IConfiguration config, 
@@ -173,7 +172,6 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(true, "查询成功", info));
         }
 
-
         /// <summary>
         /// 车公司信息添加
         /// </summary>
@@ -263,7 +261,7 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryLocalGuide(QueryLocalGuide dto)
         {
-            Stopwatch stopwatch = Stopwatch.StartNew(); 
+            Stopwatch stopwatch = Stopwatch.StartNew();
             Result LocalGuide = await _localGuideDataRep.QueryLocalGuide(dto);
             if (LocalGuide.Code == 0)
             {
@@ -391,6 +389,7 @@ namespace OASystem.API.Controllers
 
 
         }
+        
         /// <summary>
         /// 机场三字码数据城市下拉框数据
         /// </summary>
@@ -1469,22 +1468,23 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
 
                 DateTime endTime = new DateTime();
                 var InvitationOfficialActivityDataList = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
-                                                                  .Where(x => x.IsDel == 0)
-                                                                  .WhereIF(dto.CreateUserId != 0 && !string.IsNullOrWhiteSpace(dto.CreateUserId.ToString()), x => x.CreateUserId == dto.CreateUserId)
-                                                                  .WhereIF(DateTime.TryParse(dto.StartCreateTime , out DateTime startTime) && DateTime.TryParse(dto.EndCreateTime, out  endTime), x => x.CreateTime >= startTime && x.CreateTime <= endTime )
-                                                                  .Select(columns)
-                                                                  .ToList();
+                    .Where(x => x.IsDel == 0)
+                    .WhereIF(dto.CreateUserId != 0 && !string.IsNullOrWhiteSpace(dto.CreateUserId.ToString()), x => x.CreateUserId == dto.CreateUserId)
+                    .WhereIF(DateTime.TryParse(dto.StartCreateTime , out DateTime startTime) && DateTime.TryParse(dto.EndCreateTime, out  endTime), x => x.CreateTime >= startTime && x.CreateTime <= endTime )
+                    .Select(columns)
+                    .ToList();
 
                 foreach (var item in InvitationOfficialActivityDataList)
                 {
                     EncryptionProcessor.DecryptProperties(item);
                 }
-                InvitationOfficialActivityDataList = InvitationOfficialActivityDataList.WhereIF(!string.IsNullOrWhiteSpace(dto.Country), x => !string.IsNullOrWhiteSpace(x.Country) && x.Country.Contains(dto.Country))
-                                                                                       .WhereIF(!string.IsNullOrWhiteSpace(dto.UnitName), x => !string.IsNullOrWhiteSpace(x.UnitName) && x.UnitName.Contains(dto.UnitName))
-                                                                                       .WhereIF(!string.IsNullOrWhiteSpace(dto.Contact), x => !string.IsNullOrWhiteSpace(x.Contact) && x.Contact.Contains(dto.Contact))
-                                                                                       .WhereIF(!string.IsNullOrWhiteSpace(dto.Delegation), x => !string.IsNullOrWhiteSpace(x.Delegation) && x.Delegation.Contains(dto.Delegation))
-                                                                                       .WhereIF(!string.IsNullOrWhiteSpace(dto.Field), x => !string.IsNullOrWhiteSpace(x.Field) && x.Field.Contains(dto.Field))
-                                                                                       .ToList();
+                InvitationOfficialActivityDataList = InvitationOfficialActivityDataList
+                    .WhereIF(!string.IsNullOrWhiteSpace(dto.Country), x => !string.IsNullOrWhiteSpace(x.Country) && x.Country.Contains(dto.Country))
+                    .WhereIF(!string.IsNullOrWhiteSpace(dto.UnitName), x => !string.IsNullOrWhiteSpace(x.UnitName) && x.UnitName.Contains(dto.UnitName))
+                    .WhereIF(!string.IsNullOrWhiteSpace(dto.Contact), x => !string.IsNullOrWhiteSpace(x.Contact) && x.Contact.Contains(dto.Contact))
+                    .WhereIF(!string.IsNullOrWhiteSpace(dto.Delegation), x => !string.IsNullOrWhiteSpace(x.Delegation) && x.Delegation.Contains(dto.Delegation))
+                    .WhereIF(!string.IsNullOrWhiteSpace(dto.Field), x => !string.IsNullOrWhiteSpace(x.Field) && x.Field.Contains(dto.Field))
+                    .ToList();
 
                 foreach (var item in ExcludedKeyStr)
                 {
@@ -1504,40 +1504,40 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
                 RefAsync<int> totalCount = 0;
 
                 var _ivitiesViews = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
-                                             .LeftJoin<Sys_Users>((a, b) => b.IsDel == 0 && a.CreateUserId == b.Id)
-                                             .Where((a, b) => ids.Contains(a.Id))
-                                             .OrderByDescending((a, b) => a.CreateTime)
-                                             .Select((a, b) => new InvitationOfficialActivityDataView
-                                             {
-                                                 FaceBook = a.FaceBook,
-                                                 Id = a.Id,
-                                                 CreateUserId = a.CreateUserId,
-                                                 IsDel = 0,
-                                                 Address = a.Address,
-                                                 Background = a.Background,
-                                                 City = a.City,
-                                                 Contact = a.Contact,
-                                                 Country = a.Country,
-                                                 CreateTime = a.CreateTime,
-                                                 CreateUserName = b.CnName,
-                                                 Delegation = a.Delegation,
-                                                 Email = a.Email,
-                                                 Fax = a.Fax,
-                                                 Field = a.Field,
-                                                 FilePath = a.FilePath,
-                                                 Ins = a.Ins,
-                                                 WeChat = a.WeChat,
-                                                 UnitWeb = a.UnitWeb,
-                                                 UnitName = a.UnitName,
-                                                 UnitInfo = a.UnitInfo,
-                                                 Tel = a.Tel,
-                                                 SndFilePath = a.SndFilePath,
-                                                 SndFileName = a.SndFileName,
-                                                 Remark = a.Remark,
-                                                 OtherInfo = a.OtherInfo,
-                                                 Job = a.Job
-                                             })
-                                             .ToPageListAsync(dto.PageIndex, dto.PageSize, totalCount);
+                    .LeftJoin<Sys_Users>((a, b) => b.IsDel == 0 && a.CreateUserId == b.Id)
+                    .Where((a, b) => ids.Contains(a.Id))
+                    .OrderByDescending((a, b) => a.CreateTime)
+                    .Select((a, b) => new InvitationOfficialActivityDataView
+                    {
+                        FaceBook = a.FaceBook,
+                        Id = a.Id,
+                        CreateUserId = a.CreateUserId,
+                        IsDel = 0,
+                        Address = a.Address,
+                        Background = a.Background,
+                        City = a.City,
+                        Contact = a.Contact,
+                        Country = a.Country,
+                        CreateTime = a.CreateTime,
+                        CreateUserName = b.CnName,
+                        Delegation = a.Delegation,
+                        Email = a.Email,
+                        Fax = a.Fax,
+                        Field = a.Field,
+                        FilePath = a.FilePath,
+                        Ins = a.Ins,
+                        WeChat = a.WeChat,
+                        UnitWeb = a.UnitWeb,
+                        UnitName = a.UnitName,
+                        UnitInfo = a.UnitInfo,
+                        Tel = a.Tel,
+                        SndFilePath = a.SndFilePath,
+                        SndFileName = a.SndFileName,
+                        Remark = a.Remark,
+                        OtherInfo = a.OtherInfo,
+                        Job = a.Job
+                    })
+                    .ToPageListAsync(dto.PageIndex, dto.PageSize, totalCount);
 
                 var allGroupIds = new HashSet<int>();
                 foreach (var item in _ivitiesViews)
@@ -4062,7 +4062,6 @@ WHERE
 
         #region 翻译人员
 
-
         /// <summary>
         /// 翻译人员库
         /// Init

+ 180 - 25
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -7768,8 +7768,161 @@ WHERE
         {
             var view = new CorporateProfitInfosView();
 
-            string sql = string.Format(@"SELECT 
-  ROW_NUMBER() OVER(ORDER BY di.VisitDate Asc)  AS 'RowIndex', 
+            //已审核SQL
+            //            string sql = string.Format(@"SELECT 
+            //  ROW_NUMBER() OVER(ORDER BY di.VisitDate Asc)  AS 'RowIndex', 
+            //  di.Id,
+            //  di.ClientName,
+            //  di.TeamName,
+            //  di.TeamDid,
+            //  ss.Name AS 'GroupTypeName',
+            //  di.VisitDate,
+            //  di.VisitPNumber,
+            //  (
+            //    SELECT
+            //      SUM(ffr.ItemSumPrice * ffr.Rate)
+            //    FROM
+            //      OA2023DB.dbo.Fin_ForeignReceivables ffr
+            //    WHERE
+            //      ffr.IsDel = 0
+            //      AND ffr.Diid = di.Id
+            //  ) 'ReceivableAmount',
+            //  (
+            //    SELECT
+            //      SUM(fpr.Price)
+            //    FROM
+            //      OA2023DB.dbo.Fin_ProceedsReceived fpr
+            //    WHERE
+            //      fpr.IsDel = 0
+            //      AND fpr.DIId = di.Id
+            //  ) 'ReceivedAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Fin_PaymentRefundAndOtherMoney prom
+            //      INNER JOIN Grp_CreditCardPayment ccp ON prom.Id = ccp.CId
+            //      AND prom.DiId = ccp.DIId
+            //    WHERE
+            //      prom.IsDel = 0
+            //      AND prom.PayType = 1
+            //      AND ccp.CTable = 285
+            //      AND ccp.IsAuditGM = 1
+            //      AND prom.DiId = di.Id
+            //  ) AS 'RefundedAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_HotelReservations hr
+            //      INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId
+            //    WHERE
+            //      hr.IsDel = 0
+            //      AND ccp.IsDel = 0
+            //      AND ccp.CTable = 76
+            //      AND (
+            //        ccp.IsAuditGM = 1
+            //        OR ccp.IsAuditGM = 3
+            //      )
+            //      AND hr.DiId = di.Id
+            //  ) AS 'HotelAmount',
+            //  (
+            //    SELECT
+            //      SUM(
+            //        (ccp.PayMoney * (ccp.PayPercentage / 100) * ccp.DayRate)
+            //      )
+            //    FROM
+            //      Grp_CarTouristGuideGroundReservations ctggr
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.IsDel = 0
+            //      AND ccp.CTable = 79
+            //      AND ctggr.Id = ccp.CId
+            //    WHERE
+            //      ctggr.IsDel = 0
+            //      AND (
+            //        ccp.IsAuditGM = 1
+            //        OR ccp.IsAuditGM = 3
+            //      )
+            //      AND ctggr.DiId = di.Id
+            //  ) AS 'LocalGuideAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_AirTicketReservations atr
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+            //      AND ccp.CTable = 85
+            //      AND atr.Id = ccp.CId
+            //    WHERE
+            //      atr.IsDel = 0
+            //      AND ccp.IsAuditGM = 1
+            //      AND atr.DIId = di.Id
+            //  ) AS 'AirTicketAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_VisaInfo vi
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+            //      AND ccp.CTable = 80
+            //      AND vi.Id = ccp.CId
+            //    WHERE
+            //      vi.IsDel = 0
+            //      AND ccp.IsAuditGM = 1
+            //      AND vi.DIId = di.Id
+            //  ) AS 'VisaAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_InvitationOfficialActivities ioa
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+            //      AND ccp.CTable = 81
+            //      AND ioa.Id = ccp.CId
+            //    WHERE
+            //      ioa.IsDel = 0
+            //      AND ccp.IsAuditGM = 1
+            //      AND ioa.DiId = di.Id
+            //  ) AS 'OAAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_Customers ic
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+            //      AND ccp.CTable = 82
+            //      AND ic.Id = ccp.CId
+            //    WHERE
+            //      ic.IsDel = 0
+            //      AND ccp.IsAuditGM = 1
+            //      AND ic.DiId = di.Id
+            //  ) AS 'InsureAmount',
+            //  (
+            //    SELECT
+            //      SUM(ccp.PayMoney * ccp.DayRate)
+            //    FROM
+            //      Grp_DecreasePayments dp
+            //      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+            //      AND ccp.CTable = 98
+            //      AND dp.Id = ccp.CId
+            //    WHERE
+            //      dp.IsDel = 0
+            //      AND ccp.IsAuditGM = 1
+            //      AND dp.Diid = di.Id
+            //  ) AS 'OtherAmount'
+            //FROM
+            //  OA2023DB.dbo.Grp_DelegationInfo di
+            //  LEFT JOIN Sys_SetData ss ON di.TeamDid = ss.Id
+            //WHERE
+            //  di.IsDel = 0
+            //  AND di.IsBid = 0
+            //  AND di.VisitDate BETWEEN '{0}' AND '{1}'", beginDt, endDt);
+
+            //含未审核SQL
+            string sql = string.Format(@"SELECT
+  ROW_NUMBER() OVER(
+    ORDER BY
+      di.VisitDate Asc
+  ) AS 'RowIndex',
   di.Id,
   di.ClientName,
   di.TeamName,
@@ -7805,8 +7958,8 @@ WHERE
     WHERE
       prom.IsDel = 0
       AND prom.PayType = 1
-      AND ccp.CTable = 285
-      AND ccp.IsAuditGM = 1
+      AND ccp.CTable = 285 --AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND prom.DiId = di.Id
   ) AS 'RefundedAmount',
   (
@@ -7818,11 +7971,11 @@ WHERE
     WHERE
       hr.IsDel = 0
       AND ccp.IsDel = 0
-      AND ccp.CTable = 76
-      AND (
-        ccp.IsAuditGM = 1
-        OR ccp.IsAuditGM = 3
-      )
+      AND ccp.CTable = 76 -- AND (
+      --   ccp.IsAuditGM = 1
+      --   OR ccp.IsAuditGM = 3
+      -- )
+      AND ccp.IsAuditGM != 2
       AND hr.DiId = di.Id
   ) AS 'HotelAmount',
   (
@@ -7836,11 +7989,11 @@ WHERE
       AND ccp.CTable = 79
       AND ctggr.Id = ccp.CId
     WHERE
-      ctggr.IsDel = 0
-      AND (
-        ccp.IsAuditGM = 1
-        OR ccp.IsAuditGM = 3
-      )
+      ctggr.IsDel = 0 -- AND (
+      --   ccp.IsAuditGM = 1
+      --   OR ccp.IsAuditGM = 3
+      -- )
+      AND ccp.IsAuditGM != 2
       AND ctggr.DiId = di.Id
   ) AS 'LocalGuideAmount',
   (
@@ -7852,8 +8005,8 @@ WHERE
       AND ccp.CTable = 85
       AND atr.Id = ccp.CId
     WHERE
-      atr.IsDel = 0
-      AND ccp.IsAuditGM = 1
+      atr.IsDel = 0 -- AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND atr.DIId = di.Id
   ) AS 'AirTicketAmount',
   (
@@ -7865,8 +8018,8 @@ WHERE
       AND ccp.CTable = 80
       AND vi.Id = ccp.CId
     WHERE
-      vi.IsDel = 0
-      AND ccp.IsAuditGM = 1
+      vi.IsDel = 0 -- AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND vi.DIId = di.Id
   ) AS 'VisaAmount',
   (
@@ -7878,8 +8031,8 @@ WHERE
       AND ccp.CTable = 81
       AND ioa.Id = ccp.CId
     WHERE
-      ioa.IsDel = 0
-      AND ccp.IsAuditGM = 1
+      ioa.IsDel = 0 -- AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND ioa.DiId = di.Id
   ) AS 'OAAmount',
   (
@@ -7891,8 +8044,8 @@ WHERE
       AND ccp.CTable = 82
       AND ic.Id = ccp.CId
     WHERE
-      ic.IsDel = 0
-      AND ccp.IsAuditGM = 1
+      ic.IsDel = 0 -- AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND ic.DiId = di.Id
   ) AS 'InsureAmount',
   (
@@ -7904,8 +8057,8 @@ WHERE
       AND ccp.CTable = 98
       AND dp.Id = ccp.CId
     WHERE
-      dp.IsDel = 0
-      AND ccp.IsAuditGM = 1
+      dp.IsDel = 0 -- AND ccp.IsAuditGM = 1
+      AND ccp.IsAuditGM != 2
       AND dp.Diid = di.Id
   ) AS 'OtherAmount'
 FROM
@@ -8026,11 +8179,13 @@ ORDER BY
             decimal totalProfit = groupProfitTotal + notGroupProfitTotal;
 
             var dailyLabel = $"*不含日付费用类型(信用卡还款、张总私人费用、代报销社保生育补贴、人事行政费用 - 张总家用类、会展部备用金、团组签证保险)\r\n";
+            var dailyExcelLabel = dailyLabel;
             if (companyDailyItems.Any())
             {
                 foreach (var dailyFee in companyDailyItems)
                 {
                     dailyLabel += $"<p>[{dailyFee.CompanyName}]日常产生费用:{dailyFee.CNYTotal.ToString("#0.00")} CNY </p>";
+                    dailyExcelLabel += $"[{dailyFee.CompanyName}]日常产生费用:{dailyFee.CNYTotal.ToString("#0.00")} CNY \r\n";
                 }
             }
 
@@ -8050,7 +8205,7 @@ ORDER BY
                 designer.SetDataSource("notSumAccounts", notGroupCollectionTotal.ToString("#0.00"));
                 designer.SetDataSource("notSumReceived", notGroupCostTotal.ToString("#0.00"));
                 designer.SetDataSource("SumOfNotTeamBalance", notGroupProfitTotal.ToString("#0.00"));
-                designer.SetDataSource("DailyLabel", dailyLabel);
+                designer.SetDataSource("DailyLabel", dailyExcelLabel);
                 designer.SetDataSource("MeetingNumber", inforCount + "个");
                 designer.SetDataSource("ServiceNumber", serviceCount + "人");
                 designer.SetDataSource("SumAllBalance", totalProfit.ToString("#0.00"));

+ 22 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -24,6 +24,7 @@ using OASystem.Domain.Dtos.PersonnelModule;
 using OASystem.Domain.Dtos.Statistics;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Statistics;
+using AutoMapper.Internal;
 
 namespace OASystem.Domain.AutoMappers
 {
@@ -307,6 +308,7 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<NewClientOpDto, Crm_NewClientData>();
             CreateMap<Crm_NewClientData, NewClientDataView>();
             CreateMap<Crm_NewClientData, NewClientDataExcelDownloadView>();
+            CreateMap<NewClientDataRecordInfoView, NewClientDataRecordView>();
             #endregion
             #endregion
 
@@ -364,4 +366,24 @@ namespace OASystem.Domain.AutoMappers
             #endregion
         }
     }
+
+    public class AutoMapperConfig
+    {
+        /// <summary>
+        /// 验证配置
+        /// </summary>
+        public static void Initialize()
+        {
+            var config = new MapperConfiguration(cfg =>
+            {
+                cfg.Internal().AllowAdditiveTypeMapCreation = true;
+                cfg.AddProfile<_baseMappingProfile>();
+            });
+
+            var mapper = config.CreateMapper();
+
+            // 验证配置
+            config.AssertConfigurationIsValid();
+        }
+    }
 }

+ 31 - 0
OASystem/OASystem.Domain/Dtos/CRM/NewClientDataQueryDto.cs

@@ -1,4 +1,6 @@
 using AutoMapper.Execution;
+using OASystem.Domain.Dtos.System;
+using OASystem.Domain.ViewModels;
 using OASystem.Domain.ViewModels.CRM;
 using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Asn1.X9;
@@ -64,6 +66,32 @@ namespace OASystem.Domain.Dtos.CRM
         public int PageId { get; set; }
     }
 
+    public class NewClientDataRecordInitDto : UserPageFuncDtoBase
+    { }
+
+    public class NewClientDataRecordDto : UserPageFuncDtoBase
+    {
+        public int PageIndex { get; set; } = 1;
+
+        public int PageSize { get; set; } = 10;
+
+        /// <summary>
+        /// 操作类型 全部不传值、多个逗号隔开 
+        /// NoOperation, List, Details, Add, Edit, Del, Audit, Upload, Download, BatchAssignment, Login
+        /// </summary>
+        public string OpTypeLabel { get; set; }
+
+        /// <summary>
+        /// 操作用户  userId=21 时传值
+        /// 全部不传值、多个逗号隔开
+        /// 21, 22, 23
+        /// </summary>
+        public string OpUserLabel { get; set; }
+
+        public string BeginTime { get; set; }
+        public string EndTime { get; set; }
+    }
+
     public class NewClientOpDto:PortDtoBase
     {
         /// <summary>
@@ -72,10 +100,12 @@ namespace OASystem.Domain.Dtos.CRM
         /// 2 修改 
         /// </summary>
         public int Status { get; set; }
+
         /// <summary>
         /// 编号
         /// </summary>
         public int Id { get; set; }
+
         /// <summary>
         /// 序号
         /// </summary>
@@ -276,4 +306,5 @@ namespace OASystem.Domain.Dtos.CRM
         }
     }
 
+    
 }

+ 48 - 13
OASystem/OASystem.Domain/Entities/Customer/Crm_NewClientData.cs

@@ -2,6 +2,7 @@
 using Org.BouncyCastle.Asn1.Ocsp;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -36,98 +37,113 @@ namespace OASystem.Domain.Entities.Customer
         private int category;
         private int predele;
         private int finlishedDele;
+        private int lastUpdateUserId;
+        private DateTime lastUpdateTime;
 
         /// <summary>
         /// 序号
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        [SugarColumn(ColumnDescription = "序号", IsNullable = true, ColumnDataType = "int")]
         public int Number { get => number; set => number = value; }
 
         /// <summary>
         /// 地市州Id
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        [Description("客户区域")]
+        [SugarColumn(ColumnDescription = "客户区域", IsNullable = true, ColumnDataType = "int")]
         public int Lvlid { get => lvlid; set => lvlid = value; }
 
         /// <summary>
         /// 客户单位
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("客户单位")]
+        [SugarColumn(ColumnDescription = "客户单位", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Client { get => client; set => client = value; }
 
         /// <summary>
         /// 权重
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(100)")]
+        [Description("权重")]
+        [SugarColumn(ColumnDescription = "权重", IsNullable = true, ColumnDataType = "nvarchar(100)")]
         public string Weight { get => weight; set => weight = value; }
 
         /// <summary>
         /// 客户单位简写
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("客户单位简写")]
+        [SugarColumn(ColumnDescription = "客户单位简写", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string ClientShort { get => clientshort; set => clientshort = value; }
 
         /// <summary>
         /// 联系人
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("联系人")]
+        [SugarColumn(ColumnDescription = "联系人", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Contact { get => contact; set => contact = value; }
 
         /// <summary>
         /// 联系人性别
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        [Description("性别")]
+        [SugarColumn(ColumnDescription = "性别", IsNullable = true, ColumnDataType = "int")]
         public int Gender { get => gender; set => gender = value; }
 
         /// <summary>
         /// 护照
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("护照")]
+        [SugarColumn(ColumnDescription = "护照", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Passport { get => passport; set => passport = value; }
 
         /// <summary>
         /// 护照日期
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
+        [Description("护照日期")]
+        [SugarColumn(ColumnDescription = "护照日期", IsNullable = true, ColumnDataType = "DateTime")]
         public DateTime? PassportDate { get => passportDate; set => passportDate = value; }
 
         /// <summary>
         /// 职位
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("职位")]
+        [SugarColumn(ColumnDescription = "职位", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Job { get => job; set => job = value; }
 
         /// <summary>
         /// 联系手机号
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("手机号")]
+        [SugarColumn(ColumnDescription = "手机号", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Telephone { get => telephone; set => telephone = value; }
 
         /// <summary>
         /// 联系座机号
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("座机号")]
+        [SugarColumn(ColumnDescription = "座机号", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Phone { get => phone; set => phone = value; }
 
         /// <summary>
         /// 邮件
         /// </summary>
         [Encrypted]
-        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
+        [Description("邮件")]
+        [SugarColumn(ColumnDescription = "邮件", IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Email { get => email; set => email = value; }
 
         /// <summary>
         /// 所属区域(所在城市)
         /// </summary>
         [Encrypted]
+        [Description("所在城市")]
         [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(MAX)")]
         public string Location { get => location; set => location = value; }
 
@@ -135,6 +151,7 @@ namespace OASystem.Domain.Entities.Customer
         /// 地址
         /// </summary>
         [Encrypted]
+        [Description("具体地址")]
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(80)")]
         public string Address { get => address; set => address = value; }
 
@@ -142,6 +159,7 @@ namespace OASystem.Domain.Entities.Customer
         /// 生日
         /// </summary>
         [Encrypted]
+        [Description("生日信息")]
         [SugarColumn(IsNullable = true, ColumnDataType = "string")]
         public string Birthday { get => birthday; set => birthday = value; }
 
@@ -149,6 +167,7 @@ namespace OASystem.Domain.Entities.Customer
         /// 其他信息
         /// </summary>
         [Encrypted]
+        [Description("备注")]
         [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(MAX)")]
         public string OtherInfo { get => otherinfo; set => otherinfo = value; }
 
@@ -156,25 +175,41 @@ namespace OASystem.Domain.Entities.Customer
         /// 微信
         /// </summary>
         [Encrypted]
+        [Description("微信")]
         [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(200)")]
         public string Wechat { get => wechat; set => wechat = value; }
 
         /// <summary>
         /// 分类
         /// </summary>
+        [Description("业务归属")]
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int Category { get => category; set => category = value; }
 
         /// <summary>
         /// 预计出团
         /// </summary>
+        [Description("今年预计出团")]
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int PreDele { get => predele; set => predele = value; }
 
         /// <summary>
         /// 已出团
         /// </summary>
+        [Description("今年已出团")]
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int FinlishedDele { get => finlishedDele; set => finlishedDele = value; }
+
+        /// <summary>
+        /// 最后更新者Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新者Id", IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get => lastUpdateUserId; set => lastUpdateUserId = value; }
+
+        /// <summary>
+        /// 最后更新时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新时间", IsNullable = true, ColumnDataType = "DateTime")]
+        public DateTime LastUpdateTime { get => lastUpdateTime; set => lastUpdateTime = value; }
     }
 }

+ 4 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_NationalTravelFee.cs

@@ -70,3 +70,7 @@ namespace OASystem.Domain.Entities.Groups
 
     }
 }
+
+
+
+

+ 11 - 0
OASystem/OASystem.Domain/Entities/Resource/Res_InvitationOfficialActivityData.cs

@@ -145,5 +145,16 @@ namespace OASystem.Domain.Entities.Resource
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
         [Encrypted]
         public string Background { get; set; }
+
+        /// <summary>
+        /// 最后更新者Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新者Id", IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get; set; }
+        /// <summary>
+        ///  最后更新时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新时间", IsNullable = true, ColumnDataType = "DateTime")]
+        public DateTime LastUpdateTime { get; set; }
     }
 }

+ 37 - 0
OASystem/OASystem.Domain/Enums/EnumHelper.cs

@@ -92,5 +92,42 @@ namespace OASystem.Domain.Enums
             }
             return nvc;
         }
+
+        /// <summary>
+        /// 获取枚举的所有值及其对应的描述
+        /// </summary>
+        /// <param name="enumType"></param>
+        /// <param name="enumKeys"></param>
+        /// <returns></returns>
+        public static Dictionary<string, string> GetEnumDescriptions(Type enumType, string[]? enumKeys = null)
+        {
+            var descriptions = new Dictionary<string, string>();
+            if (!enumType.IsEnum)
+            {
+                return descriptions;
+                //throw new ArgumentException("Type must be an enum", nameof(enumType));
+            }
+
+
+            foreach (var field in enumType.GetFields(BindingFlags.Static | BindingFlags.GetField | BindingFlags.Public))
+            {
+                var descriptionAttribute = field.GetCustomAttribute<DescriptionAttribute>();
+                var description = descriptionAttribute?.Description ?? field.Name;
+                var name = field.Name;
+                if (enumKeys != null && enumKeys.Any())
+                {
+                    if (!enumKeys.Contains(name))
+                    {
+                        descriptions[name] = description;
+                    }
+                }
+                else {
+                    descriptions[name] = description;
+                }
+
+            }
+
+            return descriptions;
+        }
     }
 }

+ 5 - 5
OASystem/OASystem.Domain/Enums/OperationEnum.cs

@@ -11,21 +11,21 @@ namespace OASystem.Domain.Enums
     /// 操作项目
     /// </summary>
     public enum OperationEnum : int
-    {
+    {    
         /// <summary>
         /// 未操作
         /// </summary>
         [Description("未操作")]
         NoOperation = 0,
         /// <summary>
-        /// 列表
+        /// 查看列表
         /// </summary>
-        [Description("列表")]
+        [Description("查看列表")]
         List = 1,
         /// <summary>
         /// 详情
         /// </summary>
-        [Description("详情")]
+        [Description("查看详情")]
         Details = 2,
         /// <summary>
         /// 添加
@@ -66,6 +66,6 @@ namespace OASystem.Domain.Enums
         /// 登录
         /// </summary>
         [Description("登录")]
-        Login = 9,
+        Login = 10,
     }
 }

+ 162 - 1
OASystem/OASystem.Domain/ViewModels/CRM/NewClientDataView.cs

@@ -1,10 +1,16 @@
-using OASystem.Domain.Attributes;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using OASystem.Domain.AesEncryption;
+using OASystem.Domain.Attributes;
 using OASystem.Domain.Entities.Customer;
+using OASystem.Domain.Enums;
 using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Asn1.X9;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using static Google.Protobuf.Reflection.SourceCodeInfo.Types;
@@ -209,6 +215,20 @@ namespace OASystem.Domain.ViewModels.CRM
         /// 归属部门
         /// </summary>
         public dynamic AscribedDepartment { get; set; }
+
+        /// <summary>
+        /// 未更新信息天数
+        /// </summary>
+        public int NotUpdateDays
+        {
+            get
+            {
+                int days = 0;
+                if (LastUpdateTime == DateTime.MinValue) days = DateTime.Now.Subtract(CreateTime).Days;
+                else days = DateTime.Now.Subtract(LastUpdateTime).Days;
+                return days;
+            }
+        }
     }
     /// <summary>
     ///归属人员
@@ -298,4 +318,145 @@ namespace OASystem.Domain.ViewModels.CRM
         public int DeleteNum { get; set; }
     }
 
+
+    public class NewClientDataRecordInfoView
+    {
+        public int RowIndex { get; set; }
+        public int Id { get; set; }
+        public int PortType { get; set; }
+        public string PortTypeLabel
+        {
+            get
+            {
+                string lable = string.Empty;
+                if (PortType == 1) lable = "WEB";
+                else if (PortType == 2) lable = "ANDROID";
+                else if (PortType == 3) lable = "IOS";
+                return lable;
+            }
+        }
+        public OperationEnum OperationItem { get; set; }
+        public string OperationItemLable
+        {
+            get
+            {
+                return OperationItem.GetEnumDescription();
+            }
+        }
+
+        public int DataId { get; set; }
+        public string Client { get; set; }
+
+        public string ClientLable
+        {
+            get
+            {
+                var lable = string.Empty;
+
+                if (OperationItem == OperationEnum.Add || OperationItem == OperationEnum.Details || OperationItem == OperationEnum.Edit)
+                {
+                    if (!string.IsNullOrEmpty(Client))
+                    {
+                        lable = AesEncryptionHelper.Decrypt(Client);
+                    }
+                }
+                return lable;
+            }
+        }
+
+        public int CreateUserId { get; set; }
+        public string CreateUserName { get; set; }
+        public DateTime CreateTime { get; set; }
+        public string UpdatePreData { get; set; }
+        public string UpdateBefData { get; set; }
+
+        public string Label
+        {
+            get
+            {
+                string lable = string.Empty;
+                if (OperationItem == OperationEnum.Edit)
+                {
+                    Crm_NewClientData? originalInfo = null;
+                    Crm_NewClientData? newInfo = null;
+                    if (!string.IsNullOrEmpty(UpdatePreData) && IsValidJson(UpdatePreData)) originalInfo = JsonConvert.DeserializeObject<Crm_NewClientData>(UpdatePreData);
+                    if (!string.IsNullOrEmpty(UpdateBefData) && IsValidJson(UpdateBefData)) newInfo = JsonConvert.DeserializeObject<Crm_NewClientData>(UpdateBefData);
+
+                    string operationLabel = $"执行了{OperationItemLable}操作。";
+                    if (originalInfo != null && newInfo != null)
+                    {
+                        string updatedFieldLable = GetUpdatedFields(originalInfo, newInfo);
+                        if (!string.IsNullOrEmpty(updatedFieldLable)) operationLabel = $"{OperationItemLable}了“{ClientLable}”单位的{GetUpdatedFields(originalInfo, newInfo)}数据。";
+                        else operationLabel = $"未{OperationItemLable}“{ClientLable}”单位的数据,但点击了保存。";
+                    }
+                    lable = $"{CreateUserName}{operationLabel}";
+                }
+                else if (OperationItem == OperationEnum.List || OperationItem == OperationEnum.NoOperation) lable = $"{CreateUserName}查看了列表数据。";
+                else if (OperationItem == OperationEnum.Details)
+                {
+                    if (!string.IsNullOrEmpty(ClientLable)) lable = $"{CreateUserName}查看了“{ClientLable}”单位数据。";
+                    else lable = $"{CreateUserName}查看了详情数据。";
+                }
+                else if (OperationItem == OperationEnum.Add)
+                {
+                    if (!string.IsNullOrEmpty(ClientLable)) lable = $"{CreateUserName}添加了“{ClientLable}”单位数据。";
+                    else lable = $"{CreateUserName}添加了数据。";
+                }
+                else if (OperationItem == OperationEnum.Del) {
+                    if (!string.IsNullOrEmpty(ClientLable)) lable = $"{CreateUserName}删除了“{ClientLable}”单位数据。";
+                    else lable = $"{CreateUserName}删除了数据。";
+                }
+                else if (OperationItem == OperationEnum.Download) lable = $"{CreateUserName}下载了“公司客户资料”文件。";
+                else if (OperationItem == OperationEnum.BatchAssignment) lable = $"{CreateUserName}{OperationItemLable}了“公司客户资料”查看权限。";
+
+                return lable;
+            }
+        }
+        private static string GetUpdatedFields(Crm_NewClientData originalInfo, Crm_NewClientData newInfo)
+        {
+            var updatedFields = new List<string>();
+            // 使用反射获取字段名称
+            var columnNames = originalInfo.GetType().GetProperties().Select(p => p.Name).ToList();
+            foreach (var columnName in columnNames)
+            {
+                var originalValue = originalInfo.GetType().GetProperty(columnName).GetValue(originalInfo, null)?.ToString() ?? "";
+                var newValue = newInfo.GetType().GetProperty(columnName).GetValue(newInfo, null)?.ToString() ?? "";
+                if (!originalValue.Equals(newValue) )
+                {
+                    var propertyInfo = typeof(Crm_NewClientData).GetProperty(columnName);
+                    var descriptionAttribute = propertyInfo.GetCustomAttribute<DescriptionAttribute>();
+                    var fieldName = descriptionAttribute?.Description;
+                    if (!string.IsNullOrEmpty(fieldName)) updatedFields.Add(fieldName);
+
+                }
+            }
+            return string.Join("、", updatedFields);
+        }
+
+        /// <summary>
+        /// 验证json字符串是否合法
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        private static bool IsValidJson(string jsonString)
+        {
+            try
+            {
+                JToken.Parse(jsonString);
+                return true;
+            }
+            catch (JsonReaderException)
+            {
+                return false;
+            }
+        }
+    }
+
+    public class NewClientDataRecordView
+    {
+        public int RowIndex { get; set; }
+        public string Label { get; set; }
+        public DateTime CreateTime { get; set; }
+    }
+
 }

+ 15 - 0
OASystem/OASystem.Domain/ViewModels/Resource/InvitationOfficialActivityDataView.cs

@@ -18,6 +18,20 @@ namespace OASystem.Domain.ViewModels.Resource
         public int Row_Number { get; set; }
         public string CreateUserName { get; set; }
         public string DelegationStr { get; set; }
+
+        /// <summary>
+        /// 最后更新时间距今天的天数
+        /// </summary>
+        public int LastUpdateDays
+        {
+            get
+            {
+                int days = 0;
+                if (LastUpdateTime == DateTime.MinValue) days = DateTime.Now.Subtract(CreateTime).Days;
+                else days = DateTime.Now.Subtract(LastUpdateTime).Days;
+                return days;
+            }
+        }
     }
 
     public class IOAInfoView
@@ -178,5 +192,6 @@ namespace OASystem.Domain.ViewModels.Resource
         public string Remark { get; set; }
 
         public string DelegationStr { get; set; }
+
     }
 }

+ 11 - 0
OASystem/OASystem.Domain/ViewModels/Resource/TranslatorLibraryView.cs

@@ -159,6 +159,17 @@ namespace OASystem.Domain.ViewModels.Resource
         public DateTime CreateTime { get; set; }
         [Encrypted]
         public string Remark { get; set; }
+        public DateTime LastUpddateTime { get; set; }
+        public int LastUpdateDays
+        {
+            get
+            {
+                int days = 0;
+                if (LastUpddateTime == DateTime.MinValue) days = DateTime.Now.Subtract(CreateTime).Days;
+                else days = DateTime.Now.Subtract(LastUpddateTime).Days;
+                return days;
+            }
+        }
     }
 
 

+ 7 - 0
OASystem/OASystem.Domain/ViewModels/ViewBase.cs

@@ -101,4 +101,11 @@
 
         public int Total { get; set; }
     }
+
+    public class TextView
+    {
+        public string Value { get; set; }
+        public string Text { get; set; }
+    }
+
 }

+ 97 - 4
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -8,6 +8,7 @@ using NPOI.SS.Formula.Functions;
 using NPOI.SS.UserModel;
 using OASystem.Domain;
 using OASystem.Domain.AesEncryption;
+using OASystem.Domain.AutoMappers;
 using OASystem.Domain.Dtos;
 using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Entities.Customer;
@@ -210,7 +211,6 @@ namespace OASystem.Infrastructure.Repositories.CRM
             return result;
         }
 
-
         /// <summary>
         /// 客户资料初识初始化
         /// </summary>
@@ -1011,7 +1011,8 @@ namespace OASystem.Infrastructure.Repositories.CRM
             var newClientDataUnEncrypted = _mapper.Map<Crm_NewClientData>(dto);
             newClientDataUnEncrypted.Birthday = BirthdayStr;
             if (newClientDataUnEncrypted.PassportDate == DateTime.MinValue) newClientDataUnEncrypted.PassportDate = null;
-
+            newClientDataUnEncrypted.LastUpdateTime = DateTime.Now;
+            newClientDataUnEncrypted.LastUpdateUserId = dto.CreateUserId;
 
             var newClientDataEncrypted = newClientDataUnEncrypted; 
             EncryptionProcessor.EncryptProperties(newClientDataEncrypted); //加密
@@ -1400,8 +1401,6 @@ namespace OASystem.Infrastructure.Repositories.CRM
             return userArr;
         }
 
-
-
         /// <summary>
         /// 客户资料
         /// excel download
@@ -1630,5 +1629,99 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 return dt;
             }
         }
+
+        /// <summary>
+        /// 客户资料操作记录
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> NewClientDataRecord(NewClientDataRecordDto dto)
+        {
+            var jsonView = new JsonView();
+
+            string whereSql = string.Empty;
+
+            if (dto.UserId != 21) whereSql += string.Format(" AND tor.CreateUserId = '{0}'", dto.UserId);
+            else
+            {
+                if (!string.IsNullOrEmpty(dto.OpUserLabel))
+                {
+                    var userIdArray = dto.OpUserLabel.Split(',')
+                        .Select(userId =>
+                        {
+                            if (int.TryParse(userId, out int id)) return id;
+                            else return -1;
+
+                        })
+                        .ToArray();
+
+                    if (userIdArray.Any(x => x != -1)) whereSql += string.Format(" AND tor.CreateUserId IN ({0})", string.Join(",", userIdArray.Where(x => x != -1).ToList()));
+                }
+            }
+
+            if (!string.IsNullOrEmpty(dto.OpTypeLabel))
+            {
+                var enumArray = dto.OpTypeLabel.Split(',')
+                    .Select(status =>
+                    {
+                        if (Enum.TryParse(status, out OperationEnum result)) return result;
+                        else return default;
+                    })
+                    .ToList();
+                //移除默认值
+
+                if (enumArray.Contains(OperationEnum.NoOperation)) enumArray.Remove(OperationEnum.NoOperation);
+
+                if (enumArray.Any())
+                {
+                    if (enumArray.Contains(OperationEnum.List)) enumArray.Add(OperationEnum.NoOperation);
+                    if (enumArray.Any()) whereSql += string.Format(" AND tor.OperationItem IN ({0})", string.Join(",", enumArray.Select(status => ((int)status).ToString())));
+                }
+            }
+
+            bool beginDateBool = DateTime.TryParse(dto.BeginTime,out _),
+                 endDateBool = DateTime.TryParse(dto.EndTime,out _);
+            if (beginDateBool && endDateBool)
+            {
+                string beginLable = $"{dto.BeginTime} 00:00:00",
+                       endLable = $"{dto.EndTime} 23:59:59";
+                whereSql += string.Format(" AND tor.CreateTime BETWEEN '{0}' AND '{1}'", beginLable, endLable);
+            }
+
+            string sql = string.Format(@"SELECT
+  row_number() OVER (
+    ORDER BY
+      tor.CreateTime DESC
+  ) 'RowNum',
+  tor.Id,
+  tor.PortType,
+  tor.OperationItem,
+  tor.DataId,
+  ncd.Client,
+  tor.CreateUserId,
+  u.CnName 'CreateUserName',
+  tor.CreateTime,
+  tor.UpdatePreData,
+  tor.UpdateBefData
+FROM
+  OA2023DB.dbo.Crm_TableOperationRecord tor
+  LEFT JOIN sys_users u On tor.CreateUserId = u.Id
+  LEFT JOIN Crm_NewClientData ncd On tor.DataId = ncd.Id
+Where
+  TableName = 'Crm_NewClientData'
+  {0}", whereSql);
+
+            RefAsync<int> total = 0;
+
+            var datas = await _sqlSugar.SqlQueryable<NewClientDataRecordInfoView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+            var viewData = datas.Select(x => new NewClientDataRecordView() { RowIndex = x.RowIndex, Label = x.Label, CreateTime = x.CreateTime }).ToList();
+            jsonView.Data = viewData;
+            jsonView.Code = 200;
+            jsonView.Count = total;
+            jsonView.Msg = "查询成功!";
+
+            return jsonView;
+        }
     }
 }

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

@@ -535,6 +535,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     }).ToList();
                 }
 
+                var userDepDatas = new List<TextView>();
+                userDepDatas.Insert(0, new TextView() { Text = "全部", Value = "全部" });
+                userDepDatas.Insert(1, new TextView() { Text = "国交部", Value = "国交部" });
+                userDepDatas.Insert(2, new TextView() { Text = "市场部", Value = "市场部" });
+                userDepDatas.Insert(3, new TextView() { Text = "策划部", Value = "策划部" });
+
+                var rankDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 56).Select(x => new TextView { Value = x.Id.ToString(), Text = x.Name }).ToListAsync();
+                rankDatas.Insert(0, new TextView { Value = "0", Text = "全部" });
+
                 result.Code = 0;
                 result.Msg = "成功!";
                 result.Data = new
@@ -542,7 +551,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     teamTypeData = teamTypeData1,
                     teamLevData = teamLevData1,
                     userData = userData1,
-                    clientData = clientData1
+                    clientData = clientData1,
+                    depData = userDepDatas,
+                    rankData = rankDatas
                 };
             }
 

+ 30 - 27
OASystem/OASystem.Infrastructure/Repositories/Resource/InvitationOfficialActivityDataRepository.cs

@@ -45,31 +45,31 @@ namespace OASystem.Infrastructure.Repositories.Resource
             RefAsync<int> total = 0;
             
             var _view = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
-                                        .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
-                                        .Where((ioa,u) => ioa.IsDel == 0)
-                                        .WhereIF(!string.IsNullOrEmpty(dto.Country), (ioa, u) => ioa.Country.Contains(dto.Country))
-                                        .WhereIF(!string.IsNullOrEmpty(dto.UnitName), (ioa, u) => ioa.UnitName.Contains(dto.UnitName))
-                                        .WhereIF(!string.IsNullOrEmpty(dto.Contact), (ioa, u) => ioa.Contact.Contains(dto.Contact))
-                                        .WhereIF(!string.IsNullOrEmpty(dto.Delegation), (ioa, u) => ioa.Delegation.Contains(dto.Delegation))
-                                        .WhereIF(!string.IsNullOrEmpty(dto.Field), (ioa, u) => ioa.Field.Contains(dto.Field))
-                                        .WhereIF(_beginDtBool && _endDtBool, (ioa, u) => ioa.CreateTime >= _beginDt && ioa.CreateTime <= _endDt)
-                                        .WhereIF(dto.CreateUserId > 0, (ioa, u) => ioa.CreateUserId == dto.CreateUserId)
-                                        .Select((ioa, u) => new { 
-                                            Row_Number = ioa.RowIndex,
-                                            ioa.Id,
-                                            ioa.Country,
-                                            ioa.City,
-                                            ioa.UnitName,
-                                            ioa.Field,
-                                            ioa.Contact,
-                                            ioa.Job,
-                                            ioa.Tel,
-                                            ioa.CreateTime,
-                                            CreateUserName = u.CnName,
-                                            DelegationStr = ioa.Delegation
-                                        })
-                                        .OrderByDescending((ioa) => ioa.CreateTime)
-                                        .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+                .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
+                .Where((ioa,u) => ioa.IsDel == 0)
+                .WhereIF(!string.IsNullOrEmpty(dto.Country), (ioa, u) => ioa.Country.Contains(dto.Country))
+                .WhereIF(!string.IsNullOrEmpty(dto.UnitName), (ioa, u) => ioa.UnitName.Contains(dto.UnitName))
+                .WhereIF(!string.IsNullOrEmpty(dto.Contact), (ioa, u) => ioa.Contact.Contains(dto.Contact))
+                .WhereIF(!string.IsNullOrEmpty(dto.Delegation), (ioa, u) => ioa.Delegation.Contains(dto.Delegation))
+                .WhereIF(!string.IsNullOrEmpty(dto.Field), (ioa, u) => ioa.Field.Contains(dto.Field))
+                .WhereIF(_beginDtBool && _endDtBool, (ioa, u) => ioa.CreateTime >= _beginDt && ioa.CreateTime <= _endDt)
+                .WhereIF(dto.CreateUserId > 0, (ioa, u) => ioa.CreateUserId == dto.CreateUserId)
+                .Select((ioa, u) => new { 
+                    Row_Number = ioa.RowIndex,
+                    ioa.Id,
+                    ioa.Country,
+                    ioa.City,
+                    ioa.UnitName,
+                    ioa.Field,
+                    ioa.Contact,
+                    ioa.Job,
+                    ioa.Tel,
+                    ioa.CreateTime,
+                    CreateUserName = u.CnName,
+                    DelegationStr = ioa.Delegation
+                })
+                .OrderByDescending((ioa) => ioa.CreateTime)
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
 
 
             foreach (var item in _view)
@@ -214,6 +214,8 @@ namespace OASystem.Infrastructure.Repositories.Resource
             JsonView result = new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败!" };
 
             var _info = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+            _info.LastUpdateTime = _info.CreateTime;
+            _info.LastUpdateUserId = _info.CreateUserId;
 
             if (dto.Status == 1)//添加
             {
@@ -286,7 +288,9 @@ namespace OASystem.Infrastructure.Repositories.Resource
                     SndFileName = _info.SndFileName,
                     Fax = _info.Fax,
                     //CreateUserId = _info.CreateUserId,
-                    Remark = _info.Remark
+                    Remark = _info.Remark,
+                    LastUpdateUserId = _info.LastUpdateUserId,
+                    LastUpdateTime = _info.LastUpdateTime
                 });
 
                 if (!res) return result;
@@ -316,7 +320,6 @@ namespace OASystem.Infrastructure.Repositories.Resource
             return result;
         }
 
-
         public async Task< List<string>> Upload(IFormFile[] formFiles)
         {
             var fileNames = new List<string>();