ソースを参照

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

jiangjc 10 ヶ月 前
コミット
3cd4220b2a

+ 34 - 36
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -1512,29 +1512,30 @@ namespace OASystem.API.Controllers
                                     _detail.BusName = touristGuideGroundReservations.BusName;
                                 }
 
+                                _detail.PriceNameContent = touristGuideGroundReservations.PriceName;
 
-                                bool isInt = int.TryParse(touristGuideGroundReservations.Area, out int cityId);
+                                //bool isInt = int.TryParse(touristGuideGroundReservations.Area, out int cityId);
 
-                                if (isInt)
-                                {
-                                    var cityInfo = cityData.Find(it => it.Id == cityId);
-                                    if (cityInfo != null)
-                                    {
-                                        string nameContent = $@"{cityInfo.Country}-{cityInfo.City}";
+                                //if (isInt)
+                                //{
+                                //    var cityInfo = cityData.Find(it => it.Id == cityId);
+                                //    if (cityInfo != null)
+                                //    {
+                                //        string nameContent = $@"{cityInfo.Country}-{cityInfo.City}";
 
-                                        var carFeeItem = carFeeItems.Find(it => it.Id == touristGuideGroundReservations.PriceType);
-                                        if (carFeeItem != null)
-                                        {
-                                            nameContent += $@"({carFeeItem.Name})";
-                                        }
-                                        _detail.PriceNameContent = nameContent;
+                                //        var carFeeItem = carFeeItems.Find(it => it.Id == touristGuideGroundReservations.PriceType);
+                                //        if (carFeeItem != null)
+                                //        {
+                                //            nameContent += $@"({carFeeItem.Name})";
+                                //        }
+                                //        _detail.PriceNameContent = nameContent;
 
-                                    }
-                                }
-                                else
-                                {
-                                    _detail.PriceNameContent = touristGuideGroundReservations.Area;
-                                }
+                                //    }
+                                //}
+                                //else
+                                //{
+                                //    _detail.PriceNameContent = touristGuideGroundReservations.Area;
+                                //}
 
 
 
@@ -5089,8 +5090,6 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(false, "操作失败"));
         }
 
-
-
         /// <summary>
         /// 团组模块 - 出入境费用 - 子项删除
         /// </summary>
@@ -6462,7 +6461,6 @@ namespace OASystem.API.Controllers
                                 string exstr = ex.Message.ToString();
                             }
                         }
-
                     }
 
                     //排序
@@ -6760,7 +6758,6 @@ namespace OASystem.API.Controllers
             return str;
         }
 
-
         /// <summary>
         /// 根据月份返回天数
         /// </summary>
@@ -8663,19 +8660,21 @@ namespace OASystem.API.Controllers
                 {
                     decimal _rate = 1;
                     decimal _rate1 = item.Rate;
-                    decimal _scale = 0.95M;
+                    decimal _scale = 1;
+
+                    //decimal _scale = 0.95M; 雷怡 2024-06-11 10:06:08  屏蔽
                     #region 处理地接价格比例 总经理 国交部经理 主管 不下调 其他人 下调 5% 
-                    var userInfo = _usersRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.Id == dto.UserId).First();
-                    if (userInfo != null)
-                    {
-                        if (userInfo.DepId == 1 || userInfo.DepId == 7)
-                        {
-                            if (userInfo.JobPostId == 1 || userInfo.JobPostId == 22 || userInfo.JobPostId == 32)
-                            {
-                                _scale = 1.00M;
-                            }
-                        }
-                    }
+                    //var userInfo = _usersRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.Id == dto.UserId).First();
+                    //if (userInfo != null)
+                    //{
+                    //    if (userInfo.DepId == 1 || userInfo.DepId == 7)
+                    //    {
+                    //        if (userInfo.JobPostId == 1 || userInfo.JobPostId == 22 || userInfo.JobPostId == 32)
+                    //        {
+                    //            _scale = 1.00M;
+                    //        }
+                    //    }
+                    //}
                     #endregion
 
 
@@ -9344,7 +9343,6 @@ namespace OASystem.API.Controllers
             {
             }
             //删除多余行
-
             while (tableOne.Rows.Count > dt.Rows.Count + 1)
             {
                 tableOne.Rows.RemoveAt(dt.Rows.Count + 1);

+ 180 - 77
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1757,7 +1757,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> OfficialActivitiesFileDownload(AskFileDownloadDto dto)
+        public async Task<IActionResult> OfficialActivitiesFileDownload(OfficialActivitiesFileDownload dto)
         {
             #region 参数验证
 
@@ -1768,9 +1768,10 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             //团组基础信息
             var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
             if (groupInfo == null) return Ok(JsonView(false, "该团组基本信息不存在"));
+            groupInfo.VisitCountry = groupInfo.VisitCountry.Replace("|", "、");
 
             //团组公务信息
-            var obDatas = _sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
+            var obDatas = _sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).OrderBy(it => it.Date).ToList();
             if (obDatas.Count < 1) return Ok(JsonView(false, "请先录入公务信息!"));
 
             //请示数据库范例数据
@@ -1780,100 +1781,202 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
             List<TourClientListByDiIdView> guestInfos = new List<TourClientListByDiIdView>();
             if (guestResult.Result.Code == 0) guestInfos = guestResult.Result.Data as List<TourClientListByDiIdView>;
 
-            //载入模板
-            string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/省外办出访请示 - 模板.docx";
-            var doc = new Document(tempPath);
-            DocumentBuilder builder = new DocumentBuilder(doc);
+            if (dto.FileType == 1)
+            {
+                //载入模板
+                string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/省外办出访请示 - 模板.docx";
+                var doc = new Document(tempPath);
+                DocumentBuilder builder = new DocumentBuilder(doc);
 
-            //键值对存放数据
-            Dictionary<string, string> dic = new Dictionary<string, string>();
+                //键值对存放数据
+                Dictionary<string, string> dic = new Dictionary<string, string>();
 
-            //××(组团单位):接团客户信息团组
-            dic.Add("GroupClient", groupInfo.ClientUnit);
+                //××(组团单位):接团客户信息团组
+                dic.Add("GroupClient", groupInfo.ClientUnit);
 
-            //关于××(职务、姓名)等×人赴××(国家或地区)进行×××(出访目的)的请示
-            string guestName = "";
-            string guestJob = "";
-            string guestInfoStr = "";
-            var guestFirstInfo = guestInfos.FirstOrDefault();
-            if (guestFirstInfo != null)
-            {
-                guestName = guestFirstInfo.LastName + guestFirstInfo.FirstName;
-                guestJob = guestFirstInfo.Job;
-                guestInfoStr = $@"{guestJob}、{guestName}";
-            }
-            string askTitle = $@"关于{guestInfoStr}等{guestInfos.Count}人赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}的请示";
-            dic.Add("AskTitle", askTitle);
+                //关于××(职务、姓名)等×人赴××(国家或地区)进行×××(出访目的)的请示
+                string guestName = "";
+                string guestJob = "";
+                string guestInfoStr = "";
+                var guestFirstInfo = guestInfos.FirstOrDefault();
+                if (guestFirstInfo != null)
+                {
+                    guestName = guestFirstInfo.LastName + guestFirstInfo.FirstName;
+                    guestJob = guestFirstInfo.Job;
+                    guestInfoStr = $@"{guestJob}、{guestName}";
+                }
+                string askTitle = $@"关于{guestInfoStr}等{guestInfos.Count}人赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}的请示";
+                dic.Add("AskTitle", askTitle);
 
-            //应×××(邀请方名称+邀请人职务和姓名)的邀请,我单位拟派×××(职务、姓名)等×人(人数)于×××年×××月×××日赴×××(国家或地区)进行×××(出访目的)。现请示如下。
-            string visitDateStr = @$"{groupInfo.VisitDate.Year}年{groupInfo.VisitDate.Month}月{groupInfo.VisitDate.Day}日";
-            string obInfoStr = "";
-            foreach (var ob in obDatas)
-            {
-                obInfoStr += @$"{ob.Client}{ob.Job}{ob.Contact}、";
-            }
-            if (obInfoStr.Length > 0)
-            {
-                obInfoStr = obInfoStr.Substring(0, obInfoStr.Length - 1);
-            }
+                //应×××(邀请方名称+邀请人职务和姓名)的邀请,我单位拟派×××(职务、姓名)等×人(人数)于×××年×××月×××日赴×××(国家或地区)进行×××(出访目的)。现请示如下。
+                string visitDateStr = @$"{groupInfo.VisitDate.Year}年{groupInfo.VisitDate.Month}月{groupInfo.VisitDate.Day}日";
+                string obInfoStr = "";
+                string obBackgroundStr = "×××";//出访背景
+                foreach (var ob in obDatas)
+                {
+                    obInfoStr += @$"{ob.Client}{ob.Job}{ob.Contact}、";
 
-            string askSubTitle = $@"应{obInfoStr}的邀请,我单位拟派{guestInfoStr}等{guestInfos.Count}人于{visitDateStr}赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}。现请示如下。";
-            dic.Add("AskSubTitle", askSubTitle);
+                    obBackgroundStr += $"{ob.Client}\r\n \t {ob.Setting}\r\n";
 
-            //出访背景
-            dic.Add("AskTitle", askTitle);
+                }
+                if (obInfoStr.Length > 0)
+                {
+                    obInfoStr = obInfoStr.Substring(0, obInfoStr.Length - 1);
+                }
+                string askSubTitle = $@"应{obInfoStr}的邀请,我单位拟派{guestInfoStr}等{guestInfos.Count}人于{visitDateStr}赴{groupInfo.VisitCountry}进行{groupInfo.VisitPurpose}。现请示如下。";
+                dic.Add("AskSubTitle", askSubTitle);
 
-            #region 填充word模板书签内容
-            foreach (var key in dic.Keys)
-            {
-                builder.MoveToBookmark(key);
-                builder.Write(dic[key]);
-            }
-            #endregion
+                //出访背景
+                obBackgroundStr = "×××";//出访背景
+                dic.Add("OBSetting", obBackgroundStr);
 
-            //获取word里所有表格
-            NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
-            //获取所填表格的序数
-            Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+                //出访目的
+                dic.Add("VisitPurpose", groupInfo.VisitPurpose);
 
-            var rowStart = tableOne.Rows[0]; //获取第1行
+                //出访任务
+                //(一)××(国家或地区)
+                //1.拜访×××(机构名称)×××(姓名、职务)洽谈(或调研、推动等)×××(项目或机构名称等)。(例:拜会×××经济与发展司司长×××,商讨“×××活动”相关筹备工作。)
+                //2.拜访×××(机构名称)×××(姓名、职务)洽谈(或调研、推动等)×××(项目或机构名称等)。(例:拜会×××经济与发展司司长×××,商讨“×××活动”相关筹备工作。)
 
-            //循环赋值
-            for (int i = 0; i < guestInfos.Count; i++)
-            {
-                var guestInfo = guestInfos[i];
-                builder.MoveToCell(0, i + 1, 0, 0);
-                builder.Write(guestInfo.LastName + guestInfo.FirstName);
+                string taskStr = "××××"; ;
+                //List<string> countrys = groupInfo.VisitCountry.Split("、").ToList();
+                //int countryIndex = 1;
+                //foreach (var item in countrys)
+                //{
+                //    string taskTitle = $"({GetToUpperNumber(countryIndex)}){item}\r\n";
+
+                //    string taskContent = "";
+                //    var countryObDatas = obDatas.Where(it => it.Client.Contains(item)).ToList();
+                //    int obIndex = 1;
+                //    foreach (var obInfo in countryObDatas)
+                //    {
+                //        taskContent += $"{obIndex}. 拜访{obInfo.Client}({obInfo.Contact}、{obInfo.Job})洽谈“{groupInfo.VisitPurpose}”相关工作。\r\n";
+                //    }
+
+                //    taskStr += $"{taskTitle}{taskContent}";
+
+                //    countryIndex++;
+                //}
+
+                //出访任务
+                dic.Add("TaskContent", taskStr);
+
+                //出访时间
+                //代表团拟于××年×月×日—×月×日出访,在外停留×天。其中,××国家(或地区)×天,××国家(或地区)×天。
+                string visitCountryStr = $"[OP行程单读取]";
+                visitCountryStr = GeneralMethod.GetCountryStandingTime(groupInfo.Id); //计算国家出访天数
 
-                builder.MoveToCell(0, i + 1, 1, 0);
-                int sex = guestInfo.Sex;
-                string sexStr = string.Empty;
-                if (sex == 0) sexStr = "男";
-                else if (sex == 1) sexStr = "女";
-                else sexStr = "未设置";
-                builder.Write(sexStr);
 
-                builder.MoveToCell(0, i + 1, 2, 0);
-                builder.Write(guestInfo.CompanyFullName + guestInfo.Job);
+                string visitTimeQuantumStr = $"代表团拟于{groupInfo.VisitStartDate.Year}年{groupInfo.VisitStartDate.Month}月{groupInfo.VisitStartDate.Day}日—{groupInfo.VisitEndDate.Month}月{groupInfo.VisitEndDate.Day}日出访,在外停留{groupInfo.VisitDays}天。其中,{visitCountryStr}。";
+                //出访时间
+                dic.Add("TimeQuantum", visitTimeQuantumStr);
 
+                //出访路线
+                //成都—××(出境城市名称)—××(转机不出机场)—××(公务所在城市)……—××(入境城市名称)—成都。(例:成都—法兰克福<转机不出机场>—巴黎—巴塞罗那—阿姆斯特丹<转机不出机场>-成都)
+                string lineStr = GeneralMethod.GetGroupCityLine(groupInfo.Id, "—");
+                dic.Add("Line", lineStr);
 
-                builder.MoveToCell(0, i + 1, 3, 0);
-                string birthDay = "";
-                string birthDayStr = string.Empty;
-                if (!string.IsNullOrEmpty(birthDay))
+                //scheduling //行程安排
+                string schedulingStr = $"[OP行程单暂未生成]";
+
+                var tripInfo = _sqlSugar.Queryable<Grp_TravelList>().Where(it => it.IsDel == 0 && it.Diid == groupInfo.Id).OrderBy(it => it.Days).ToList();
+
+                if (tripInfo.Count > 0 )
                 {
-                    birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy-MM-dd");
+                    schedulingStr = "";
+
+                    foreach (var item in tripInfo)
+                    {
+                        schedulingStr += $"{item.Date}({item.WeekDay})\r\n{item.Trip}\r\n";
+                    }
                 }
-                builder.Write(birthDayStr);
+
+                dic.Add("Scheduling", schedulingStr);
+
+                #region 填充word模板书签内容
+                foreach (var key in dic.Keys)
+                {
+                    builder.MoveToBookmark(key);
+                    builder.Write(dic[key]);
+                }
+                #endregion
+
+                //获取word里所有表格
+                NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                //获取所填表格的序数
+                Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+
+                var rowStart = tableOne.Rows[0]; //获取第1行
+
+                //循环赋值
+                for (int i = 0; i < guestInfos.Count; i++)
+                {
+                    var guestInfo = guestInfos[i];
+                    builder.MoveToCell(0, i + 1, 0, 0);
+                    builder.Write(guestInfo.LastName + guestInfo.FirstName);
+
+                    builder.MoveToCell(0, i + 1, 1, 0);
+                    int sex = guestInfo.Sex;
+                    string sexStr = string.Empty;
+                    if (sex == 0) sexStr = "男";
+                    else if (sex == 1) sexStr = "女";
+                    else sexStr = "未设置";
+                    builder.Write(sexStr);
+
+                    builder.MoveToCell(0, i + 1, 2, 0);
+                    builder.Write(guestInfo.CompanyFullName + guestInfo.Job);
+
+
+                    builder.MoveToCell(0, i + 1, 3, 0);
+                    string birthDay = "";
+                    string birthDayStr = string.Empty;
+                    if (!string.IsNullOrEmpty(birthDay))
+                    {
+                        birthDayStr = Convert.ToDateTime(birthDay).ToString("yyyy-MM-dd");
+                    }
+                    builder.Write(birthDayStr);
+                }
+
+                //删除多余行
+                while (tableOne.Rows.Count > guestInfos.Count + 1)
+                {
+                    tableOne.Rows.RemoveAt(guestInfos.Count + 1);
+                }
+
+                var fileDir = AppSettingsHelper.Get("WordBasePath");
+                string fileName = $"{groupInfo.TeamName}省外办出访请示.docx";
+                string filePath = fileDir + $@"OfficialActivities/{fileName}";
+                doc.Save(filePath);
+
+                string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/OfficialActivities/{fileName}";
+                return Ok(JsonView(true, "操作成功!", Url));
+            }
+            else if (dto.FileType == 2)
+            {
 
             }
 
-            var fileDir = AppSettingsHelper.Get("WordBasePath");
-            string fileName = $"{groupInfo.TeamName}省外办出访请示.docx";
-            string filePath = fileDir + $@"Ask/{fileName}";
-            doc.Save(filePath);
-            string Url = $@"{AppSettingsHelper.Get("WordBaseUrl")}Office/Word/Ask/{fileName}";
-            return Ok(JsonView(true, "操作成功!", Url));
+
+            return Ok(JsonView(true, "操作失败!"));
+        }
+
+        private string GetToUpperNumber(int num)
+        {
+            string numStr = "";
+
+            if (num == 1) numStr = "一";
+            else if (num == 2) numStr = "二";
+            else if (num == 3) numStr = "三";
+            else if (num == 4) numStr = "四";
+            else if (num == 5) numStr = "五";
+            else if (num == 6) numStr = "六";
+            else if (num == 7) numStr = "七";
+            else if (num == 8) numStr = "八";
+            else if (num == 9) numStr = "九";
+            else if (num == 10) numStr = "十";
+
+
+            return numStr;
         }
 
         #endregion

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

@@ -450,7 +450,7 @@ namespace OASystem.API.Controllers
 
                 List<GroupCTGGRFeeView> groupCTGGRFeeViews = new List<GroupCTGGRFeeView>();
 
-                string CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.Area,ctggrc.*,ctggrc.Price As PayMoney,
+                string CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,ctggrc.*,ctggrc.Price As PayMoney,
                                                      sd2.name As PaymentCurrency,ccp.PayPercentage,
                                                      (ctggrc.Price / (ccp.PayPercentage / 100)) As AmountPaid,
                                                      (ctggrc.Price / (ccp.PayPercentage / 100) - ctggrc.Price) As BalancePayment,

+ 701 - 0
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -15,10 +15,12 @@ using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Infrastructure.Repositories.CRM;
 using OASystem.Infrastructure.Repositories.Groups;
+using System.Data;
 using System.IdentityModel.Tokens.Jwt;
 using System.IO.Compression;
 using System.Security.Claims;
 using System.Web;
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 
 namespace OASystem.API.OAMethodLib
 {
@@ -1429,5 +1431,704 @@ namespace OASystem.API.OAMethodLib
 
         #endregion
 
+
+        #region op行程单,黑屏幕代码
+
+        public static string GetCountryStandingTime(int diId) 
+        {
+            DataTable datas =  GetTableByBlackCode(diId);
+
+            string countryStr = "";
+            if (datas.Rows.Count > 0 )
+            {
+                var airDatas = from row in datas.AsEnumerable()
+                               select new
+                               {
+                                   Three = row.Field<string>("Three"),
+                                   Day = row.Field<string>("Day"),
+                                   ArrivedDate = row.Field<string>("ArrivedDate"),
+                               };
+
+
+                //三字码信息
+                List<Res_ThreeCode> listcode = _dirRep._sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.IsDel == 0).ToList();
+                //string countryStr = "";
+                int index = 0;
+                List<string> cityCodes = new List<string>();
+                //去掉开始和结束城市
+                foreach (var row in airDatas) 
+                {
+                    if (index == 0) cityCodes.Add(row.Three.Substring(3, 3)); //到达国家
+                    else if (airDatas.Count()-1 == index) cityCodes.Add(row.Three.Substring(0, 3)); //到达国家
+                    else cityCodes.Add(row.Three.Substring(0, 3)); //到达国家
+
+                    index++;
+                }
+                cityCodes = cityCodes.Distinct().ToList();
+
+                foreach (var item in cityCodes)
+                {
+                    var airData = airDatas.Where(it => it.Three.Contains(item)).ToList();
+                    string country = listcode.Find(it => it.Three.Equals(item))?.Country ?? "Unknown";
+                    if (country.Equals("中国"))
+                    {
+                        country = listcode.Find(it => it.Three.Equals(item))?.City ?? "Unknown";
+                    }
+                    int days = 0;
+                    if (airData.Count == 2)
+                    {
+                        DateTime arr_dt = Convert.ToDateTime(airData[0].ArrivedDate); //抵达时间
+                        DateTime dep_dt = Convert.ToDateTime(airData[1].Day); //离开时间
+                        days = (dep_dt - arr_dt).Days;
+                        countryStr += $@"{country}停留{days}日、";
+                    }
+                }
+                if (countryStr.Length > 0) countryStr = countryStr.Substring(0, countryStr.Length - 1);
+
+            }
+
+            return countryStr;
+        }
+
+        /// <summary>
+        ///根据机票黑屏代码整理DataTable
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public static  DataTable GetTableByBlackCode(int diid)
+        {
+            //黑屏代码信息
+            List<Air_TicketBlackCode> listcode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.DiId == diid && x.IsDel == 0).ToList();
+
+            //测试数据为序号,航班号,起飞日期,三字码,起飞时刻,到达时刻,出发航站楼,到达航站楼,机型,飞行时间
+            //1.3U8391   TU17NOV CTUCAI  0220 0715   T1 T2  330  10H55M
+            DataTable dt = new DataTable();
+            dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
+            dt.Columns.Add("Date", typeof(string));//起飞日期
+            dt.Columns.Add("Three", typeof(string));//三字码
+            dt.Columns.Add("StartTime", typeof(string));//起飞时刻
+            dt.Columns.Add("EndTime", typeof(string));//到达时刻
+            dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
+            dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
+            dt.Columns.Add("AirModel", typeof(string)); //机型
+            dt.Columns.Add("FlightTime", typeof(string));//飞行时间
+            dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据 
+            dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
+            dt.Columns.Add("Error", typeof(string));//整理的到达日期
+            dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
+
+            //判断是否录入黑屏代码
+            if (listcode.Count() == 0 || listcode == null)
+            {
+                dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null);
+            }
+            else
+            {
+                //读取单段黑屏代码
+                for (int i = 0; i < listcode.Count; i++)
+                {
+                    //去除序号
+                    string[] CodeList = Regex.Split(listcode[i].BlackCode, "\\d+\\.", RegexOptions.IgnoreCase);
+                    //去除多余空格,方法一Linq扩展方法
+                    CodeList = CodeList.Where(str => str != "").ToArray();
+                    CodeList = CodeList.Where(str => str != " ").ToArray();
+
+                    //年
+                    int year = Convert.ToInt32(DateTime.Now.Year.ToString());
+
+                    //读取单条黑屏代码
+                    for (int j = 0; j < CodeList.Count(); j++)
+                    {
+                        //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
+                        CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
+                        string[] Info = CodeList[j].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+
+                        //string[] Info = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty)
+                        //                   .TrimStart().TrimEnd().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+
+                        //去除多余空格
+                        Info = Info.Where(str => str != "").ToArray();
+                        Info = Info.Where(str => str != " ").ToArray();
+
+                        //判断黑屏代码是否正确拆分; 理应拆成9段
+                        if (Info.Count() < 9)
+                        {
+                            dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "本团组第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误,请联系机票同事核对", null);
+                        }
+                        else
+                        {
+                            try
+                            {
+                                //月                  
+                                int month = Convert.ToInt32(GetLonger(Info[1].Substring(4, 3)));
+                                //日
+                                int day = Convert.ToInt32(Info[1].Substring(2, 2));
+
+                                #region 逐一比较月份,判断是否翻年;逐一比较三字码顶真,判断是否跑错机场
+                                if (j > 0)
+                                {
+                                    string[] Temp = CodeList[j - 1].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty)
+                                                  .TrimStart().TrimEnd().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+                                    Temp = Temp.Where(str => str != "").ToArray();
+                                    Temp = Temp.Where(str => str != " ").ToArray();
+                                    int monthTemp = Convert.ToInt32(GetLonger(Temp[1].Substring(4, 3)));
+                                    // 如果相邻月份之差小于0,则证明次一条年份需+1
+                                    if (month - monthTemp < 0)
+                                    {
+                                        year = year + 1;
+                                    }
+                                    //如果相邻代码三字码不顶真,提醒
+                                    string FootThree = Temp[2].Substring(3, 3);
+                                    string HeadThree = Info[2].Substring(0, 3);
+                                    if (FootThree != HeadThree)
+                                    {
+                                        //DelegationInfoService s = new DelegationInfoService();
+                                        //UsersService us = new UsersService();
+                                        //GroupsTaskAssignmentService gts = new GroupsTaskAssignmentService();
+
+                                        //77	行程
+                                        List<Grp_GroupsTaskAssignment> list2 = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(x => x.CTId == 77 && x.DIId == diid && x.IsDel == 0).ToList();
+                                        foreach (var temp in list2)
+                                        {
+                                            //if (temp.UId != 21)
+                                            //SendAndReturn(us.GetUsersByID(temp.UId).Email,
+                                            //    "黑屏代码提醒",
+                                            //   s.GetDelegationInfoByID(diid).TeamName + "的机票黑屏代码中,相邻航段的三字码不连续,请查看!");
+                                        }
+
+                                        //85	机票预订
+                                        List<Grp_GroupsTaskAssignment> list6 = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(x => x.CTId == 85 && x.DIId == diid && x.IsDel == 0).ToList();
+                                        foreach (var temp in list6)
+                                        {
+                                            //if (temp.UId != 21)
+                                            //SendAndReturn(us.GetUsersByID(temp.UId).Email,
+                                            //    "黑屏代码提醒",
+                                            //     s.GetDelegationInfoByID(diid).TeamName + "的机票黑屏代码中,相邻航段的三字码不连续,请查看!");
+                                        }
+                                    }
+
+                                }
+                                #endregion
+
+
+                                #region 判断到达日期是否需要加1
+                                if (Info[4].Contains("+"))
+                                {
+                                    //日期+1
+                                    day = day + 1;
+
+                                    //判断是否进入下一月
+                                    if (day > Convert.ToInt32(GetDaysByMonth(Info[1].Substring(4, 3), year)))
+                                    {
+                                        day = day - Convert.ToInt32(GetDaysByMonth(Info[1].Substring(4, 3), year));
+                                        month = month + 1;
+
+                                        //判断是否进入下一年
+                                        if (month > 12)
+                                        {
+                                            month = month - 12;
+                                            year = year + 1;
+                                        }
+                                    }
+
+                                    //月份整理格式
+                                    string monthTemp = month.ToString();
+                                    if (month < 10)
+                                    {
+                                        monthTemp = "0" + monthTemp;
+                                    }
+                                    //日期整理格式
+                                    string daytemp = day.ToString();
+                                    if (day < 10)
+                                    {
+
+                                        daytemp = "0" + daytemp;
+                                    }
+
+                                    string temp = Info[4].Split('+')[0];
+
+                                    //添加起飞数据
+                                    dt.Rows.Add(Info[0],
+                                       Info[1],
+                                       Info[2],
+                                       Info[3],
+                                       temp,
+                                       Info[5],
+                                       Info[6],
+                                       Info[7],
+                                       Info[8],
+                                       year + "-" + GetLonger(Info[1].Substring(4, 3)) + "-" + Info[1].Substring(2, 2),
+                                       year + "-" + monthTemp + "-" + daytemp,
+                                       "",
+                                       "0");
+                                    //加1天,添加到达数据
+                                    dt.Rows.Add(Info[0],
+                                       Info[1].Replace(Info[1].Substring(2, 2), daytemp),
+                                       Info[2],
+                                       Info[3],
+                                       temp,
+                                       Info[5],
+                                       Info[6],
+                                       Info[7],
+                                       Info[8],
+                                       year + "-" + monthTemp + "-" + daytemp,
+                                       year + "-" + monthTemp + "-" + daytemp,
+                                       "",
+                                       "1");
+                                }
+                                else
+                                {
+                                    //月份整理格式
+                                    string monthTemp = month.ToString();
+                                    if (month < 10)
+                                    {
+                                        monthTemp = "0" + monthTemp;
+                                    }
+                                    //日期整理格式
+                                    string daytemp = day.ToString();
+                                    if (day < 10)
+                                    {
+
+                                        daytemp = "0" + daytemp;
+                                    }
+
+                                    dt.Rows.Add(Info[0],
+                                        Info[1],
+                                        Info[2],
+                                        Info[3],
+                                        Info[4],
+                                        Info[5],
+                                        Info[6],
+                                        Info[7],
+                                        Info[8],
+                                        year + "-" + monthTemp + "-" + daytemp,
+                                        year + "-" + monthTemp + "-" + daytemp,
+                                        "",
+                                        "0");
+                                }
+                                #endregion
+                            }
+                            catch (Exception ex)
+                            {
+                                string exstr = ex.Message.ToString();
+                            }
+                        }
+
+                    }
+
+                    //排序
+                    dt.DefaultView.Sort = "Day asc";
+                    dt = dt.DefaultView.ToTable();
+                }
+            }
+
+            return dt;
+        }
+
+        /// <summary>
+        /// 根据星期,月份的缩写,转换成数字或者全称
+        /// 根据币种中文名称返回币种代码
+        /// 根据数字返回机型型号【2、3开头的就是空客,比如空客320,7开头的就是波音,比如波音777】
+        /// 20210903贾文滔
+        /// </summary>
+        /// <param name="startDate"></param>
+        /// <param name="endDate"></param>
+        /// <returns></returns>
+        public static string GetLonger(string temp)
+        {
+            string str = "";
+            switch (temp.ToUpper())
+            {
+                case "美元":
+                    str = "USD";
+                    break;
+                case "日元":
+                    str = "JPY";
+                    break;
+                case "英镑":
+                    str = "GBP";
+                    break;
+                case "欧元":
+                    str = "EUR";
+                    break;
+                case "港币":
+                    str = "HKD";
+                    break;
+                case "MO":
+                    str = "星期一";
+                    break;
+                case "TU":
+                    str = "星期二";
+                    break;
+                case "WE":
+                    str = "星期三";
+                    break;
+                case "TH":
+                    str = "星期四";
+                    break;
+                case "FR":
+                    str = "星期五";
+                    break;
+                case "SA":
+                    str = "星期六";
+                    break;
+                case "SU":
+                    str = "星期天";
+                    break;
+                case "JAN":
+                    str = "01";
+                    break;
+                case "FEB":
+                    str = "02";
+                    break;
+                case "MAR":
+                    str = "03";
+                    break;
+                case "APR":
+                    str = "04";
+                    break;
+                case "MAY":
+                    str = "05";
+                    break;
+                case "JUN":
+                    str = "06";
+                    break;
+                case "JUL":
+                    str = "07";
+                    break;
+                case "AUG":
+                    str = "08";
+                    break;
+                case "SEP":
+                    str = "09";
+                    break;
+                case "OCT":
+                    str = "10";
+                    break;
+                case "NOV":
+                    str = "11";
+                    break;
+                case "DEC":
+                    str = "12";
+                    break;
+                case "MONDAY":
+                    str = "星期一";
+                    break;
+                case "TUESDAY":
+                    str = "星期二";
+                    break;
+                case "WEDNESDAY":
+                    str = "星期三";
+                    break;
+                case "THURSDAY":
+                    str = "星期四";
+                    break;
+                case "FRIDAY":
+                    str = "星期五";
+                    break;
+                case "SATURDAY":
+                    str = "星期六";
+                    break;
+                case "SUNDAY":
+                    str = "星期日";
+                    break;
+                case "01":
+                    str = "JAN";
+                    break;
+                case "02":
+                    str = "FEB";
+                    break;
+                case "03":
+                    str = "MAR";
+                    break;
+                case "04":
+                    str = "APR";
+                    break;
+                case "05":
+                    str = "MAY";
+                    break;
+                case "06":
+                    str = "JUN";
+                    break;
+                case "07":
+                    str = "JUL";
+                    break;
+                case "08":
+                    str = "AUG";
+                    break;
+                case "09":
+                    str = "SEP";
+                    break;
+                case "10":
+                    str = "OCT";
+                    break;
+                case "11":
+                    str = "NOV";
+                    break;
+                case "12":
+                    str = "DEC";
+                    break;
+                case "2":
+                    str = "空客A";
+                    break;
+                case "3":
+                    str = "空客A";
+                    break;
+                case "7":
+                    str = "波音";
+                    break;
+            }
+
+            return str;
+        }
+
+        /// <summary>
+        /// 根据月份返回天数
+        /// </summary>
+        /// <param name="temp"></param>
+        /// <returns></returns>
+        public static string GetDaysByMonth(string Month, int year)
+        {
+            string str = "";
+            //判断是否是闰年
+            if (DateTime.IsLeapYear(year) == false)
+            {
+                switch (Month.ToUpper())
+                {
+                    case "JAN":
+                        str = "31";
+                        break;
+                    case "FEB":
+                        str = "28";
+                        break;
+                    case "MAR":
+                        str = "31";
+                        break;
+                    case "APR":
+                        str = "30";
+                        break;
+                    case "MAY":
+                        str = "31";
+                        break;
+                    case "JUN":
+                        str = "30";
+                        break;
+                    case "JUL":
+                        str = "31";
+                        break;
+                    case "AUG":
+                        str = "31";
+                        break;
+                    case "SEP":
+                        str = "30";
+                        break;
+                    case "OCT":
+                        str = "31";
+                        break;
+                    case "NOV":
+                        str = "30";
+                        break;
+                    case "DEC":
+                        str = "31";
+                        break;
+                    case "01":
+                        str = "31";
+                        break;
+                    case "02":
+                        str = "28";
+                        break;
+                    case "03":
+                        str = "31";
+                        break;
+                    case "04":
+                        str = "30";
+                        break;
+                    case "05":
+                        str = "31";
+                        break;
+                    case "06":
+                        str = "30";
+                        break;
+                    case "07":
+                        str = "31";
+                        break;
+                    case "08":
+                        str = "31";
+                        break;
+                    case "09":
+                        str = "30";
+                        break;
+                    case "10":
+                        str = "31";
+                        break;
+                    case "11":
+                        str = "30";
+                        break;
+                    case "12":
+                        str = "31";
+                        break;
+                }
+            }
+            else
+            {
+                switch (Month.ToUpper())
+                {
+                    case "JAN":
+                        str = "31";
+                        break;
+                    case "FEB":
+                        str = "29";
+                        break;
+                    case "MAR":
+                        str = "31";
+                        break;
+                    case "APR":
+                        str = "30";
+                        break;
+                    case "MAY":
+                        str = "31";
+                        break;
+                    case "JUN":
+                        str = "30";
+                        break;
+                    case "JUL":
+                        str = "31";
+                        break;
+                    case "AUG":
+                        str = "31";
+                        break;
+                    case "SEP":
+                        str = "30";
+                        break;
+                    case "OCT":
+                        str = "31";
+                        break;
+                    case "NOV":
+                        str = "30";
+                        break;
+                    case "DEC":
+                        str = "31";
+                        break;
+                    case "01":
+                        str = "31";
+                        break;
+                    case "02":
+                        str = "29";
+                        break;
+                    case "03":
+                        str = "31";
+                        break;
+                    case "04":
+                        str = "30";
+                        break;
+                    case "05":
+                        str = "31";
+                        break;
+                    case "06":
+                        str = "30";
+                        break;
+                    case "07":
+                        str = "31";
+                        break;
+                    case "08":
+                        str = "31";
+                        break;
+                    case "09":
+                        str = "30";
+                        break;
+                    case "10":
+                        str = "31";
+                        break;
+                    case "11":
+                        str = "30";
+                        break;
+                    case "12":
+                        str = "31";
+                        break;
+                }
+            }
+            return str;
+        }
+
+        /// <summary>
+        /// op行程单 团组 城市路径
+        /// </summary>
+        /// <param name="diid">团组Id</param>
+        /// <param name="separator">分隔符</param>
+        /// <returns></returns>
+        public static string GetGroupCityLine(int diid,string separator)
+        {
+            string city = string.Empty;
+            var blackCode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && x.DiId == diid).ToList();
+            if (blackCode.Count > 0)
+            {
+                var black = blackCode.First();
+                black.BlackCode = black.BlackCode == null ? "" : black.BlackCode;
+                var blackSp = Regex.Split(black.BlackCode, "\\d+\\.", RegexOptions.IgnoreCase).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
+                if (blackSp.Length > 0)
+                {
+                    try
+                    {
+                        var cityArrCode = new List<string>(20);
+                        foreach (var item in blackSp)
+                        {
+                            var itemSp = item.Split(' ').Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
+                            var IndexSelect = itemSp[2];
+                            var cityArrCodeLength = cityArrCode.Count - 1;
+                            var startCity = IndexSelect.Substring(0, 3);
+                            if (cityArrCodeLength > 0)
+                            {
+                                var arrEndCity = cityArrCode[cityArrCodeLength];
+                                if (arrEndCity != startCity)
+                                {
+                                    cityArrCode.Add(startCity.ToUpper());
+                                }
+                            }
+                            else
+                            {
+                                cityArrCode.Add(startCity.ToUpper());
+                            }
+
+                            var endCity = IndexSelect.Substring(3, 3);
+                            cityArrCode.Add(endCity.ToUpper());
+                        }
+
+                        var cityThree = string.Empty;
+                        cityArrCode.ForEach(x => cityThree += "'" + x + "',");
+                        cityThree = cityThree.TrimEnd(',');
+                        if (string.IsNullOrWhiteSpace(cityThree))
+                        {
+                            throw new Exception("error");
+                        }
+
+                        string sql = $"SELECT * FROM Res_ThreeCode rtc WHERE UPPER(rtc.Three) in ({cityThree}) ";
+                        var cityArr = _dirRep._sqlSugar.SqlQueryable<Res_ThreeCode>(sql).ToList();
+                        foreach (var item in cityArrCode)
+                        {
+                            var find = cityArr.Find(x => x.Three.ToUpper() == item.ToUpper());
+                            if (find != null)
+                            {
+                                city += find.City + separator;
+                            }
+                            else
+                            {
+                                city += item + "[三字码未收录]" + separator;
+                            }
+                        }
+                        city = city.TrimEnd(char.Parse(separator));
+                    }
+                    catch (Exception e)
+                    {
+                        city = "[黑屏代码格式不正确!]";
+                    }
+                }
+            }
+            else city = "[未录入黑屏代码]";
+
+            return city;
+        }
+
+        #endregion
+
     }
 }

+ 57 - 1
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -64,6 +64,15 @@ namespace OASystem.API.OAMethodLib
                 return _result;
             }
 
+            //Task<QYWX_UserInfosView> GetUserInfosAsync()
+            //QYWX_UserInfosView usersView = await _qiYeWeChatApiService.GetUserInfosAsync();
+            //if (usersView.errcode != 0)
+            //{
+            //    _result.Msg = $"【企业微信】【打卡】【获取员工基础信息】【Msg】{userIdListView.errmsg}";
+            //    return _result;
+            //}
+
+
             List<string> qyWhchatIdList = new List<string>();
             qyWhchatIdList = userIdListView.dept_user.Select(it => it.userid).ToList();
             CheckInDayDataView checkInDayDataView = await _qiYeWeChatApiService.GetCheckInDayDataAsync(qyWhchatIdList, startDt, endDt);
@@ -138,6 +147,50 @@ namespace OASystem.API.OAMethodLib
             string _name = "";
             try
             {
+                #region 手动配置企业员工userid,通过userid 去匹配打卡数据
+                //Dictionary<string, string> wx_useridDic = new Dictionary<string, string>();
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("罗诗怡", "lsyyyy");
+                //wx_useridDic.Add("赖红燕", "LaiHongYan");
+                //wx_useridDic.Add("刘一茹", "liuyiru");
+                //wx_useridDic.Add("李雯琪", "LiWenQi");
+                //wx_useridDic.Add("罗聪惠", "LuoCongHui");
+                //wx_useridDic.Add("肖俊杰", "20230410");
+                //wx_useridDic.Add("朱成梅", "amy.zhu@pan-american-intl.com");
+                //wx_useridDic.Add("伏虹瑾", "FuHongJin");
+                //wx_useridDic.Add("曾艳", "judy.zeng@pan-american-intl.com");
+                //wx_useridDic.Add("舒庆", "cilina.shu@pan-american-intl.com");
+                //wx_useridDic.Add("高媛媛", "GaoYuanYuan");
+                //wx_useridDic.Add("龙畑恬", "longtiantian");
+                //wx_useridDic.Add("叶琪琪", "YeQiQi");
+                //wx_useridDic.Add("王鸽", "ellisa.wang@pan-american-intl.com");
+                //wx_useridDic.Add("赵雅琪", "ZhaoYaQi");
+                //wx_useridDic.Add("陈思帆", "ChenSiFan");
+                //wx_useridDic.Add("廖文雅", "LiaoWenYa");
+                //wx_useridDic.Add("李敏", "annie.li@pan-american-intl.com");
+                //wx_useridDic.Add("李明华", "LiMingHua");
+                //wx_useridDic.Add("李文婷", "LiWenTing");
+                //wx_useridDic.Add("仇久龙", "rf");
+                //wx_useridDic.Add("宋夏雨", "songxiayu");
+                //wx_useridDic.Add("王思雨", "ysw");
+                //wx_useridDic.Add("汪燕平", "yime");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+                //wx_useridDic.Add("张海麟", "fred.chang@pan-american-intl.com");
+
+
+                #endregion
+
                 foreach (var pm_wsInfo in pm_WageSheetDattaSources)
                 {
                     _name = userNames.Find(it => it.Id == pm_wsInfo.UserId)?.CnName ?? "Unknown";
@@ -189,13 +242,16 @@ namespace OASystem.API.OAMethodLib
 
                     List<Root> userRoots = new List<Root>();
 
+                    string wx_userid = "";
+
+
                     if (_name == "蔡雯")
                     {
                         userRoots = workday_userRoots.Where(it => it.base_info.name == "蔡蔡" || it.base_info.name == "蔡雯").ToList(); //工作日日报 1-固定上下班;
                     }
                     else
                     {
-                        userRoots = workday_userRoots.Where(it => it.base_info.name == _name).ToList(); //工作日日报 1-固定上下班;
+                        userRoots = workday_userRoots.Where(it => it.base_info.name == _name || it.base_info.name.Contains(_name)).ToList(); //工作日日报 1-固定上下班;
                     } 
 
                     //userRoots = userRoots.Distinct().ToList();

+ 6 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/IQiYeWeChatApiService.cs

@@ -34,6 +34,12 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         /// <returns></returns>
         Task<UserIdListView> GetUserIdListAsync();
 
+        /// <summary>
+        /// 获取成员信息
+        /// </summary>
+        /// <returns></returns>
+        Task<QYWX_UserInfosView> GetUserInfosAsync();
+
         /// <summary>
         /// 获取企业所有打卡规则
         /// </summary>

+ 67 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs

@@ -1,4 +1,5 @@
 using Microsoft.AspNetCore.Identity;
+using NPOI.Util;
 using OASystem.Domain.Dtos.QiYeWeChat;
 using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.QiYeWeChat;
@@ -175,6 +176,72 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
             return userIdListView;
         }
 
+        /// <summary>
+        /// 获取成员信息
+        /// </summary>
+        /// <returns></returns>
+        public async Task<QYWX_UserInfosView> GetUserInfosAsync() {
+
+            QYWX_UserInfosView infoViews = new QYWX_UserInfosView();
+
+            //获取员工useridList
+            UserIdListView useridView = await GetUserIdListAsync();
+
+            if (useridView.errcode != 0 )
+            {
+                infoViews.errcode = useridView.errcode;
+                infoViews.errmsg = useridView.errmsg;
+                return infoViews;
+            }
+
+            Access_TokenView access_Token = await GetTokenAsync(4);
+            if (access_Token.errcode != 0)
+            {
+                infoViews.errcode = access_Token.errcode;
+                infoViews.errmsg = access_Token.errmsg;
+                return infoViews;
+            }
+
+            List<QYWX_UserInfo> items = new List<QYWX_UserInfo>();
+
+            string urlTitle = string.Format("/cgi-bin/user/get?access_token={0}", access_Token.access_token);
+
+            foreach (var item in useridView.dept_user)
+            {
+                if (!string.IsNullOrEmpty(item.userid))
+                {
+                    QYWX_UserInfoView _UserInfoView = new QYWX_UserInfoView();
+                    string url = string.Format("{0}&userid={1}", urlTitle, item.userid);
+                    var create_Req = await _httpClient.GetAsync(url);
+
+                    if (create_Req.IsSuccessStatusCode)
+                    {
+                        var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+                        _UserInfoView = System.Text.Json.JsonSerializer.Deserialize<QYWX_UserInfoView>(stringResponse,
+                            new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+                        if (_UserInfoView.errcode == 0)
+                        {
+                            items.Add(new QYWX_UserInfo()
+                            {
+                                userid = _UserInfoView.QYWX_User.userid,
+                                name = _UserInfoView.QYWX_User.name,
+                                mobile = _UserInfoView.QYWX_User.mobile,
+                                position = _UserInfoView.QYWX_User.position,
+                                email = _UserInfoView.QYWX_User.email,
+                                biz_mail = _UserInfoView.QYWX_User.biz_mail,
+                            });
+                        }
+                    }
+                }
+            }
+
+            infoViews.errcode = 0;
+            infoViews.errmsg = "操作成功!";
+            infoViews.QYWX_Users = items;
+            return infoViews;
+        }
+
         /// <summary>
         /// 获取部门列表
         /// </summary>

+ 17 - 0
OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs

@@ -114,4 +114,21 @@ namespace OASystem.Domain.Dtos.Resource
         /// </summary>
         public int IsPay { get; set; }
     }
+
+    /// <summary>
+    /// 导出请示参数
+    /// </summary>
+    public class OfficialActivitiesFileDownload
+    {
+        /// <summary>
+        /// 文件类型
+        /// 1 省外办出访请示
+        /// 2 市外办出访请示
+        /// </summary>
+        public int FileType { get; set; } = 1;
+
+        public int DiId { get; set; }
+
+        public int[] IdList { get; set; }
+    }
 }

+ 1 - 16
OASystem/OASystem.Domain/Dtos/Resource/QueryAskDataDto.cs

@@ -66,20 +66,5 @@ namespace OASystem.Domain.Dtos.Resource
         /// </summary>
         public string Remark { get; set; }
     }
-    /// <summary>
-    /// 导出请示参数
-    /// </summary>
-    public class AskFileDownloadDto
-    {
-        /// <summary>
-        /// 文件类型
-        /// 1 省外办出访请示
-        /// 2 市外办出访请示
-        /// </summary>
-        public int FileType { get; set; } = 1;
-
-        public int DiId { get; set; }
-
-        public int[] IdList { get; set; }
-    }
+   
 }

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

@@ -10,10 +10,15 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Linq;
 using System.Text;
+using System.Text.Json.Serialization;
 using System.Threading.Tasks;
+using JsonConverter = System.Text.Json.Serialization.JsonConverter;
 
 namespace OASystem.Domain.ViewModels.Groups
 {
+
+
+
     /// <summary>
     /// 接团信息
     /// 返回视图

+ 54 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/UserIdListView.cs

@@ -39,4 +39,58 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
         /// </summary>
         public uint department { get; set; }
     }
+
+    /// <summary>
+    /// 成员信息
+    /// </summary>
+    public class QYWX_UserInfo
+    {
+        /// <summary>
+        /// userid
+        /// </summary>
+        public string userid { get; set; }
+
+        /// <summary>
+        /// 姓名
+        /// </summary>
+        public string name { get; set; }
+
+        /// <summary>
+        /// 手机
+        /// </summary>
+        public string mobile { get; set; }
+
+        /// <summary>
+        /// 职位
+        /// </summary>
+        public string position { get; set; }
+
+        /// <summary>
+        /// 邮箱
+        /// </summary>
+        public string email { get; set; }
+
+        /// <summary>
+        /// 企业邮箱
+        /// </summary>
+        public string biz_mail { get; set; }
+    }
+
+
+    /// <summary>
+    /// 成员信息 View
+    /// </summary>
+    public class QYWX_UserInfoView : ResponseBase
+    {
+        public QYWX_UserInfo QYWX_User { get; set; }
+    }
+
+    /// <summary>
+    /// 成员信息 item View
+    /// </summary>
+    public class QYWX_UserInfosView : ResponseBase 
+    {
+        public List<QYWX_UserInfo> QYWX_Users { get; set; }
+    }
+
 }

+ 115 - 22
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -25,14 +25,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
         private readonly CheckBoxsRepository _checkRep;
         private readonly SetDataRepository _setDataRep;
         private readonly DailyFeePaymentRepository _daiRep;    //日付申请仓库
+        private readonly GroupCostParameterRepository _groupCostParameterRepository;
 
-        public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper, CheckBoxsRepository checkRep, SetDataRepository setDataRep, DailyFeePaymentRepository daiRep)
+        public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper, CheckBoxsRepository checkRep, SetDataRepository setDataRep, DailyFeePaymentRepository daiRep, GroupCostParameterRepository groupCostParameterRepository)
             : base(sqlSugar)
         {
             _mapper = mapper;
             _checkRep = checkRep;
             _setDataRep = setDataRep;
             _daiRep = daiRep;
+            _groupCostParameterRepository = groupCostParameterRepository;
         }
 
         public async Task<Result> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
@@ -731,6 +733,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                     //车超时费
                     //餐费和三公经费那个表做完匹配后也放进超支表里
+                    //添加导游超时费用
+
                     DataTable tb = new DataTable();
                     tb.Columns.Add("日期", typeof(DateTime));
                     tb.Columns.Add("费用", typeof(decimal));
@@ -738,6 +742,46 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     var addsTourClientList = new List<Grp_TourClientList>();
                     var carExtraList = carTouristList.Where(x => x.SId == 982 && x.Price != 0).ToList();
                     var mealPriceList = carTouristList.Where(x => (x.SId == 93 || x.SId == 988 || x.SId == 989) && x.Price != 0).GroupBy(x => x.DatePrice).ToList();
+                    var tgOvertime = carTouristList.Where(x => x.SId == 1059 && x.Price != 0 ).ToList();
+
+                    //成本数据
+                    List<Grp_GroupCost> _GroupCosts = new List<Grp_GroupCost>();
+
+                    var _GroupCostParameters = _groupCostParameterRepository.GetGroupCostParameterMainByDiid(dto.DiId);
+
+                    if (_GroupCostParameters != null && _GroupCostParameters.IsShare == 1)
+                    {
+                        _GroupCosts = _sqlSugar.Queryable<Grp_GroupCost>().Where(it => it.IsDel == 0 && it.Diid == dto.DiId).ToList();
+                    }
+
+                    //处理date为空问题
+                    if (_GroupCosts.Count > 0)
+                    {
+                        for (int i = 0; i < _GroupCosts.Count; i++)
+                        {
+                            if (string.IsNullOrEmpty(_GroupCosts[i].Date))
+                            {
+                                if (i > 0)
+                                {
+                                    _GroupCosts[i].Date = _GroupCosts[i - 1].Date;
+                                }
+                            }
+                        }
+
+                        var CostSoure = _GroupCosts.GroupBy(x => x.Date).ToList();
+
+                        _GroupCosts.Clear();
+
+                        foreach (var costSoure in CostSoure)
+                        {
+                            var cost = costSoure.ToList();
+                            cost[0].D = cost.Sum(x => x.D);
+                            cost[0].B = cost.Sum(x => x.B);
+                            cost[0].L = cost.Sum(x => x.L);
+                            _GroupCosts.Add(cost[0]);
+                        }
+                    }
+
                     mealPriceList.ForEach(x =>
                     {
                         var row = tb.NewRow();
@@ -748,9 +792,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     });
 
                     //限制只能选择地区
-                    var opSingle = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.CTGGRId);
+                    var opSingle = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.CTGGRId && x.IsDel == 0);
                     var opSingleCityId = 0;
                     Grp_NationalTravelFee cityPrice = null;
+                    string priceCity = string.Empty;
 
                     //三公费用
                     if (int.TryParse(opSingle.Area, out opSingleCityId))
@@ -758,18 +803,20 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         cityPrice = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(x =>
                          x.Id == opSingleCityId
                         ).First();
+                        priceCity = cityPrice == null ? string.Empty :cityPrice.Country + cityPrice?.City;
                     }
                     else
                     {
                         cityPrice = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(x =>
                             !string.IsNullOrEmpty(x.City) && x.City.Contains(opSingle.Area)
                         ).First();
+                        priceCity = opSingle.Area;
                     }
 
                     //超支费用表(数据添加)  Fin_GroupExtraCost
                     List<Fin_GroupExtraCost> groupExtraCostsArr = new List<Fin_GroupExtraCost>();
 
-                    var di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.DiId);
+                    var di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.DiId && x.IsDel == 0);
                     if (di == null)
                     {
                         result.Code = -1;
@@ -789,7 +836,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 Coefficient = 1,
                                 DiId = dto.DiId,
                                 PriceCurrency = item.Currency,
-                                PriceName = di.TeamName + "车超时费(地接导入)",
+                                PriceName = di.TeamName +"-"+ priceCity + "-" + "车超时费(地接导入)",
                                 PriceType = 1028,
                                 PriceDt = item.DatePrice.ObjToDate(),
                                 PriceSum = item.Price * item.Count,
@@ -800,33 +847,80 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
 
-                    if (cityPrice != null)
+                    //导游超时费用
+                    if (tgOvertime.Count > 0)
+                    {
+                        foreach (var item in tgOvertime)
+                        {
+                            groupExtraCostsArr.Add(new Fin_GroupExtraCost
+                            {
+                                Price = item.Price,
+                                CreateTime = DateTime.Now,
+                                CreateUserId = dto.CreateUserId,
+                                Coefficient = 1,
+                                DiId = dto.DiId,
+                                PriceCurrency = item.Currency,
+                                PriceName = di.TeamName + "-" + priceCity + "-" + "导游超时费(地接导入)",
+                                PriceType = 1028,
+                                PriceDt = item.DatePrice.ObjToDate(),
+                                PriceSum = item.Price * item.Count,
+                                PriceCount = item.Count,
+                                FilePath = string.Empty,
+                                PriceDetailType = 1072,
+                            });
+                        }
+                    }
+
+                    if (_GroupCostParameters != null)
                     {
                         //币种
                         var currOpResult = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, carTouristList[0].Currency);
                         var currOp = currOpResult.Code == 0 ? (currOpResult.Data as CurrencyInfo) == null ? 1 : (currOpResult.Data as CurrencyInfo)!.Rate : 1;
-                        var cityCurrResult = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, cityPrice.Currency);
-                        var cityCurr = cityCurrResult.Code == 0 ? (cityCurrResult.Data as CurrencyInfo) == null ? 1 : (cityCurrResult.Data as CurrencyInfo)!.Rate : 1;
+
+                        //三公费用汇率 (修改为对比成本)
+                        //var cityCurrResult = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, cityPrice.Currency);
+                        //var cityCurr = cityCurrResult.Code == 0 ? (cityCurrResult.Data as CurrencyInfo) == null ? 1 : (cityCurrResult.Data as CurrencyInfo)!.Rate : 1;
+
+                        //成本汇率
+                        var costCurr = _GroupCostParameters.Rate;
 
                         if (tb.Rows.Count > 0)
                         {
                             foreach (DataRow item in tb.Rows)
                             {
-                                decimal foodCost = 1;
-                                if (!decimal.TryParse(cityPrice.FoodCost, out foodCost))
-                                {
-                                    //三公费用 ( 城市餐费用有问题! )
-                                }
+                                var listTime =  Convert.ToDateTime(item["日期"]);
+                                var costFliterArr = _GroupCosts.Where(x => DateTime.TryParse(x.Date, out DateTime costData) 
+                                && costData.ToString("yyyy-MM-dd") == listTime.ToString("yyyy-MM-dd")).ToList();
+
+                                //成本日期费用
+                                decimal foodCost = (costFliterArr.Sum(x=>x.D) + costFliterArr.Sum(x => x.L) + costFliterArr.Sum(x => x.B)) * di.VisitPNumber;
 
                                 var price = Convert.ToDecimal(item["费用"]);
-                                if (item["币种"].ToString() != cityPrice.Currency.ToString()) //币种不相同
+                                if (item["币种"].ToString() != _GroupCostParameters.Currency.ToString().Trim()) //币种不相同
                                 {
-                                    //全部转换为rmb;
-                                    item["费用"] = price * currOp;
-                                    cityPrice.FoodCost = (foodCost * cityCurr).ToString("F2");
+                                    var a = item["币种"].ToString();
+                                    var b = _GroupCostParameters.Currency.ToString().Trim();
 
-                                    item["币种"] = "836";
-                                    cityPrice.Currency = 836;
+                                    //币种str匹配不上在匹配Name
+                                    if (int.TryParse(a,out int a1))
+                                    {
+                                        a = _sqlSugar.Queryable<Sys_SetData>().First(x=>x.IsDel ==0 && x.Id == a1).Name; 
+                                    }
+
+                                    if (int.TryParse(b, out int b1))
+                                    {
+                                        b = _sqlSugar.Queryable<Sys_SetData>().First(x => x.IsDel == 0 && x.Id == b1).Name;
+                                    }
+
+                                    if (a != b) 
+                                    {
+                                        //全部转换为rmb;
+                                        item["费用"] = price * currOp;
+                                        foodCost = (foodCost * costCurr);
+
+                                        item["币种"] = "836";
+                                        //cityPrice.Currency = 836;
+                                    }
                                 }
 
                                 if (price > foodCost)
@@ -839,8 +933,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                         CreateUserId = dto.CreateUserId,
                                         Coefficient = 1,
                                         DiId = dto.DiId,
-                                        PriceCurrency = cityPrice.Currency,
-                                        PriceName = di.TeamName + "餐费(地接导入)",
+                                        PriceCurrency = Convert.ToInt32(item["币种"]),
+                                        PriceName = di.TeamName + "-" + priceCity + "-" + "餐费(地接导入)",
                                         PriceType = 1028,
                                         PriceDt = Convert.ToDateTime(item["日期"]),
                                         PriceSum = price - foodCost,
@@ -848,7 +942,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                         FilePath = string.Empty,
                                         PriceDetailType = 1049,
                                     });
-
                                 }
                             }
                         }
@@ -859,7 +952,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         foreach (var item in groupExtraCostsArr)
                         {
-                            var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && item.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd")).First();
+                            var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && x.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd")).First();
                             if (QuerySgin == null)
                             {
                                 var resultThis = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP

+ 5 - 4
OASystem/OASystem.Infrastructure/Repositories/Resource/LocalGuideDataRepository.cs

@@ -171,10 +171,11 @@ namespace OASystem.Infrastructure.Repositories.Resource
                 {
                     string sql = string.Format(@"select * from Res_LocalGuideData {0}", sqlWhere);
                     List<Res_LocalGuideData> LocalGuideData = await _sqlSugar.SqlQueryable<Res_LocalGuideData>(sql).ToListAsync();
-                    if (LocalGuideData.Count == 0)
-                    {
-                        return result = new Result() { Code = 0, Msg = "暂无数据" };
-                    }
+                    //2024-05-11 修改,取消该判断,避免前端报错
+                    //if (LocalGuideData.Count == 0)
+                    //{
+                    //    return result = new Result() { Code = 0, Msg = "暂无数据" };
+                    //}
                     LocalGuideData = LocalGuideData.OrderByDescending(x => x.CreateTime).ToList();
 
                     if (dto.PageSize == 0 && dto.PageIndex == 0)