Kaynağa Gözat

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

yuanrf 11 ay önce
ebeveyn
işleme
7e2eb47139
24 değiştirilmiş dosya ile 1774 ekleme ve 379 silme
  1. 4 5
      OASystem/OASystem.Api/Controllers/AuthController.cs
  2. 42 38
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  3. 11 3
      OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs
  4. 305 65
      OASystem/OASystem.Api/Controllers/ResourceController.cs
  5. 1 1
      OASystem/OASystem.Api/Controllers/StatisticsController.cs
  6. 622 1
      OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs
  7. 57 1
      OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs
  8. 110 0
      OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs
  9. 69 0
      OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs
  10. 24 0
      OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/IQiYeWeChatApiService.cs
  11. 114 1
      OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs
  12. 7 0
      OASystem/OASystem.Domain/Dtos/QiYeWeChat/ApprovalData_Request.cs
  13. 6 0
      OASystem/OASystem.Domain/Dtos/Resource/HotelDataDto.cs
  14. 32 4
      OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs
  15. 28 0
      OASystem/OASystem.Domain/Entities/Resource/Res_OfficialActivities.cs
  16. 2 0
      OASystem/OASystem.Domain/ViewModels/Groups/TourClientListView.cs
  17. 35 0
      OASystem/OASystem.Domain/ViewModels/QiYeWeChat/GroupStatusView.cs
  18. 54 0
      OASystem/OASystem.Domain/ViewModels/QiYeWeChat/UserIdListView.cs
  19. 47 0
      OASystem/OASystem.Domain/ViewModels/Resource/HotelDataView.cs
  20. 18 1
      OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs
  21. 1 1
      OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs
  22. 2 1
      OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs
  23. 72 170
      OASystem/OASystem.Infrastructure/Repositories/Resource/HotelDataRepository.cs
  24. 111 87
      OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

+ 4 - 5
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -98,10 +98,11 @@ namespace OASystem.API.Controllers
                 AnnouncementUnReadCount = announcementUnReadCount
             };
 
+
             DateTime createZebraTime = DateTime.Now;
             string authorId = dto.Number + "Token";
             string authorToken = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>(authorId);//string 取
-            if (authorToken !=  null)
+            if (authorToken != null)
             {
                 #region 解析出过期时间
                 var jwtHandler = new JwtSecurityTokenHandler();
@@ -112,7 +113,7 @@ namespace OASystem.API.Controllers
                 if (expDt >= createZebraTime)  //超时重新获取token
                 {
                     //authorToken = await GeneralMethod.GetToken(_config, dto.Number, uId,uName, createZebraTime);
-                    authorToken = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName,Role = role }); //
+                    authorToken = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Role = role }); //
                 }
 
                 view.Expires = expDt;
@@ -122,11 +123,9 @@ namespace OASystem.API.Controllers
             {
                 view.Expires = createZebraTime.AddMinutes(30);
                 //view.Token = await GeneralMethod.GetToken(_config, dto.Number, uId, uName, createZebraTime); //JwtHelper
-                view.Token = await JwtHelper.IssueJwtAsync(new TokenModelJwt (){ UserId = uId,UserName = uName,Role = role }); //
+                view.Token = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Role = role }); //
                 TimeSpan ts = view.Expires.AddMinutes(-1) - createZebraTime; //设置redis 过期时间 比 jwt 时间 快一分钟
                 await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>(authorId, view.Token, ts);//string 存
-
-
             }
 
             //#region 添加登录用户上线信息

+ 42 - 38
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;
+                                //}
 
 
 
@@ -5399,26 +5400,32 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DelVisaPrice(DelBaseDto dto)
         {
-            try
+            _sqlSugar.BeginTran();
+
+            var res = await _visaPriceRep.SoftDeleteByIdAsync<Grp_VisaInfo>(dto.Id.ToString(), dto.DeleteUserId);
+
+            if (!res)
             {
-                var res = await _visaPriceRep.SoftDeleteByIdAsync<Grp_VisaInfo>(dto.Id.ToString(), dto.DeleteUserId);
-                if (!res)
-                {
-                    return Ok(JsonView(false, "删除失败"));
-                }
-                var resultC = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80).SetColumns(a => new Grp_CreditCardPayment()
-                {
-                    IsDel = 1,
-                    DeleteUserId = dto.DeleteUserId,
-                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
-                }).ExecuteCommandAsync();
-                return Ok(JsonView(true, "删除成功!"));
+                _sqlSugar.RollbackTran();
+                return Ok(JsonView(false, "删除失败"));
             }
-            catch (Exception ex)
+
+            var resSub = _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                  .Where(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80)
+                                  .SetColumns(a => new Grp_CreditCardPayment()
+                                  {
+                                      IsDel = 1,
+                                      DeleteUserId = dto.DeleteUserId,
+                                      DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                  }).ExecuteCommand();
+            if (resSub < 1)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                _sqlSugar.RollbackTran();
+                return Ok(JsonView(false, "删除失败"));
             }
+            _sqlSugar.CommitTran();
+            return Ok(JsonView(true, "删除成功!"));
+
         }
         /// <summary>
         /// 签证费用录入下拉框初始化
@@ -6460,7 +6467,6 @@ namespace OASystem.API.Controllers
                                 string exstr = ex.Message.ToString();
                             }
                         }
-
                     }
 
                     //排序
@@ -6758,7 +6764,6 @@ namespace OASystem.API.Controllers
             return str;
         }
 
-
         /// <summary>
         /// 根据月份返回天数
         /// </summary>
@@ -9352,7 +9357,6 @@ namespace OASystem.API.Controllers
             {
             }
             //删除多余行
-
             while (tableOne.Rows.Count > dt.Rows.Count + 1)
             {
                 tableOne.Rows.RemoveAt(dt.Rows.Count + 1);

+ 11 - 3
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -5,8 +5,10 @@ using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI;
+using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.PersonnelModule;
+using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.PersonnelModule;
 using OASystem.Domain.ViewModels.PersonnelModule;
 using OASystem.Domain.ViewModels.QiYeWeChat;
@@ -1702,16 +1704,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> Test_QIYEWX(PostTourClientListDownloadFile _dto)
         {
-            GroupStatus_UserSimplelistView list = await _qiYeWeChatApiService.GroupStatus_GetUserList();
+            //GroupStatus_UserSimplelistView list = await _qiYeWeChatApiService.GroupStatus_GetUserList();
 
             //创建群聊
 
-            List<string> userList = new List<string>() { "huaju.liu", "Feint", "johnny.yang@pan-american-intl.com" };
+            //List<string> userList = new List<string>() { "huaju.liu", "Feint", "johnny.yang@pan-american-intl.com" };
 
-            GroupStatus_CreateChatView rst1 = await _qiYeWeChatApiService.GroupStatus_CreateChat("团组状态通知测试", "Feint", userList, "groupstatuschat01");
+            //GroupStatus_CreateChatView rst1 = await _qiYeWeChatApiService.GroupStatus_CreateChat("团组状态通知测试", "Feint", userList, "groupstatuschat01");
 
             //推送消息(模板)
 
+
+
+            //团组出发
+            //费用审核
+            //费用审核结果通知(通过情况下发送财务群)
+
             string q = "";
 
             return Ok(JsonView(true, "操作成功!"));

Dosya farkı çok büyük olduğundan ihmal edildi
+ 305 - 65
OASystem/OASystem.Api/Controllers/ResourceController.cs


+ 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,

+ 622 - 1
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
 {
@@ -1430,7 +1432,626 @@ namespace OASystem.API.OAMethodLib
         #endregion
 
 
-        #region op行程单 
+        #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 (!string.IsNullOrEmpty(row.Three))
+                    {
+                        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}日、";
+                        //countryStr += $@"{country}停留  日、";
+                    }
+                }
+                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行程单 团组 城市路径

+ 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();

+ 110 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs

@@ -0,0 +1,110 @@
+using MathNet.Numerics.Statistics;
+using System.ComponentModel;
+
+namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
+{
+    public enum QiyeWeChatEnum
+    {
+        /// <summary>
+        /// 测试用
+        /// </summary>
+        [Description("groupstatuschat01")]
+        TestChat = 0,
+
+        /// <summary>
+        /// 团组通知-公司客户群(总经理;国交部经理、主管),发送条件(1.确认出团)
+        /// </summary>
+        [Description("CompanyCRMChat01")]
+        CompanyCRMChat = 1,
+
+        /// <summary>
+        /// 团组通知-市场客户群(市场部经理、主管;国交部经理、主管)发送条件(1.确认出团)
+        /// </summary>
+        [Description("MarketCRMChat01")]
+        MarketCRMChat,
+
+        /// <summary>
+        /// 团组通知-财务群(财务部全员),发送条件(1.费用审核-通过;2,团组出访时间出发-7 天,结束-3 天,通知财务三人签合同、收尾款)
+        /// </summary>
+        [Description("CaiWuChat01")]
+        CaiWuChat,
+
+        /// <summary>
+        /// 团组通知-国交管理群(国交部经理、主管),发送条件(1.费用审核-提交)
+        /// </summary>
+        [Description("GuoJiaoLeader01")]
+        GuoJiaoLeaderChat,
+    }
+
+    public class MarkdownLib
+    {
+
+        /// <summary>
+        /// 通知文本-确认出团
+        /// </summary>
+        /// <param name="info"></param>
+        /// <returns></returns>
+        public static string GroupStatus_Create(GroupStatus_CreateModel info)
+        {
+            string result = string.Format(@" `确认出团`  
+
+>**团组基本信息**  
+>团组名称:<font color='info'>{0}</font> 
+
+>团组类型:{1}
+>出访日期:<font color='comment'>{2}</font> 
+>出访人数/天数:{3}人/{4}天 
+>客户单位:{5}
+>客户名称:{6}
+
+[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)
+", info.TeamName, info.TeamDid_Text, info.VisitDateRange, info.VisitPNumber, info.VisitDays, info.ClientUnit, info.ClientName);
+
+            return result;
+        }
+
+        /// <summary>
+        /// 通知文本-费用申请
+        /// </summary>
+        /// <returns></returns>
+        public static string GroupStatus_ApplyFee()
+        {
+            string result = string.Format(@" `费用审核`  
+
+>团组:<font color='info'>雅安市经合和外事局赴美国 6日</font> 
+
+<font color='comment'>- </font>新增一笔需要审核的费用
+
+>费用模块:签证
+>费用名称:<font color='warning'>于冀川等6人</font>
+>此次付款金额:<font color='warning'>8850.00 CNY</font>
+
+>申请人:李敏
+>申请时间:<font color='comment'>2024-05-06 17:21</font> 
+
+<font color='comment'>- </font>当前团组费用待审核数量: 1
+
+[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/) ");
+
+            return result;
+        }
+
+    }
+    #region 实体类
+
+    public class GroupStatus_ApplyFeeModel { }
+
+    public class GroupStatus_CreateModel
+    {
+        public string TeamName { get; set; }
+        public string TeamDid_Text { get; set; }
+        public string VisitDateRange { get; set; }
+        public int VisitPNumber { get; set; }
+        public int VisitDays { get; set; }
+        public string ClientUnit { get; set; }
+        public string ClientName { get; set; }
+    }
+
+    #endregion
+
+}

+ 69 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -0,0 +1,69 @@
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.ViewModels.QiYeWeChat;
+using OASystem.Infrastructure.Repositories.Groups;
+
+namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
+{
+    public static class AppNoticeLibrary
+    {
+        private static readonly IQiYeWeChatApiService _qiYeWeChatApiService = AutofacIocManager.Instance.GetService<IQiYeWeChatApiService>();
+
+        private static readonly DelegationInfoRepository _grpDeleRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
+
+        /// <summary>
+        /// 向指定群聊发送- 确认出团 -通知
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <param name="qwEnum"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendChatMsg_GroupStatus_Create(int diId, QiyeWeChatEnum qwEnum)
+        {
+            Grp_DelegationInfo entity = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+
+            string dateRange = string.Format(@"{0}至{1}", entity.VisitStartDate.ToString("yyyy-MM-dd"), entity.VisitEndDate.ToString("yyyy-MM-dd"));
+
+            string grpTypeStr = (_grpDeleRep.Query<Sys_SetData>(s => s.Id == entity.TeamDid).First()).Name;
+
+            GroupStatus_CreateModel info = new GroupStatus_CreateModel()
+            {
+                ClientName = entity.ClientName,
+                ClientUnit = entity.ClientUnit,
+                TeamName = entity.TeamName,
+                VisitDays = entity.VisitDays,
+                VisitPNumber = entity.VisitPNumber,
+                VisitDateRange = dateRange,
+                TeamDid_Text = grpTypeStr
+            };
+            string chatId = qwEnum.GetEnumDescription();
+            //发送信息
+            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupStatus_Create(info));
+            if (result.errcode != 0)
+            {
+                //抄送日志 
+                return false;
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 向指定群聊发送- 费用审核 -通知
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <param name="qwEnum"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendChatMsg_GroupStatus_ApplyFee(int diId, QiyeWeChatEnum qwEnum)
+        {
+            string chatId = qwEnum.GetEnumDescription();
+            //发送信息
+            ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendChatMsg_Markdown(chatId, MarkdownLib.GroupStatus_ApplyFee());
+            if (result.errcode != 0)
+            {
+                //抄送日志 
+                return false;
+            }
+
+            return true;
+        }
+    }
+}

+ 24 - 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>
@@ -161,6 +167,24 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         /// </summary>
         /// <returns></returns>
         Task<GroupStatus_CreateChatView> GroupStatus_CreateChat(string chatName, string owner, List<string> userList, string chatId);
+
+        /// <summary>
+        /// 向群聊发送消息
+        /// </summary>
+        /// <param name="chatId"></param>
+        /// <param name="msgContent"></param>
+        /// <returns></returns>
+        Task<ResponseBase> GroupStatus_SendChatMsg_Markdown(string chatId, string msgContent, string msgType = "markdown");
+
+
+        /// <summary>
+        /// 向用户发送信息
+        /// </summary>
+        /// <param name="toUser"></param>
+        /// <param name="msgContent"></param>
+        /// <param name="msgType"></param>
+        /// <returns></returns>
+        Task<GroupStatus_SendMessageView> GroupStatus_SendMessage_ToUser(string toUser, string msgContent, string msgType = "markdown");
         #endregion
     }
 }

+ 114 - 1
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>
@@ -1409,6 +1476,53 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
             return result;
         }
 
+        /// <summary>
+        /// 向群聊发送信息
+        /// </summary>
+        /// <param name="chatId"></param>
+        /// <param name="msgContent"></param>
+        /// <param name="msgType"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<ResponseBase> GroupStatus_SendChatMsg_Markdown(string chatId, string msgContent, string msgType = "markdown")
+        {
+            ResponseBase result = new ResponseBase();
+
+            Access_TokenView access_Token = await GetTokenAsync(6);
+            if (access_Token.errcode != 0)
+            {
+                result.errcode = access_Token.errcode;
+                result.errmsg = string.Format("【企业微信】【团组状态通知】【Token】【Msg】{0}", access_Token.errmsg);
+                return result;
+            }
+
+            RobotSendMsg_GroupInfo_Content markdown = new RobotSendMsg_GroupInfo_Content() { content = msgContent };
+
+            GroupStatus_AppChatSend_Markdown reqJson = new GroupStatus_AppChatSend_Markdown()
+            {
+                chatid = chatId,
+                msgtype = msgType,
+                markdown = markdown
+            };
+
+            string url = string.Format("/cgi-bin/appchat/send?access_token={0}", access_Token.access_token);
+            var json = System.Text.Json.JsonSerializer.Serialize(reqJson);
+            var content = new StringContent(json, Encoding.UTF8, "application/json");
+            var create_Req = await _httpClient.PostAsync(url, content);
+            var stringResponse = await create_Req.Content.ReadAsStringAsync();
+
+            result = System.Text.Json.JsonSerializer.Deserialize<ResponseBase>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+            return result;
+        }
+
+        public Task<GroupStatus_SendMessageView> GroupStatus_SendMessage_ToUser(string toUser, string msgContent, string msgType = "markdown")
+        {
+            throw new NotImplementedException();
+        }
+
+
         #endregion
 
         public long ConvertToTimeSpan(DateTime dt)
@@ -1417,6 +1531,5 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
         }
 
 
-
     }
 }

+ 7 - 0
OASystem/OASystem.Domain/Dtos/QiYeWeChat/ApprovalData_Request.cs

@@ -146,4 +146,11 @@ namespace OASystem.Domain.Dtos.QiYeWeChat
         /// </summary>
         public string chatid { get; set; }
     }
+
+    public class GroupStatus_AppChatSend_Markdown
+    {
+        public string chatid { get; set; }
+        public string msgtype { get; set; }
+        public RobotSendMsg_GroupInfo_Content markdown { get; set; }
+    }
 }

+ 6 - 0
OASystem/OASystem.Domain/Dtos/Resource/HotelDataDto.cs

@@ -91,4 +91,10 @@ namespace OASystem.Domain.Dtos.Resource
         public int Id { get; set; }
         public int DeleteUserId { get; set; }
     }
+
+    public class QueryHotelDataInfoDto : PortDtoBase
+    {
+        public int Id { get; set; }
+
+    }
 }

+ 32 - 4
OASystem/OASystem.Domain/Dtos/Resource/OfficialActivitiesDto.cs

@@ -36,9 +36,7 @@ namespace OASystem.Domain.Dtos.Resource
         /// 邀请方 1  公务方 0 
         /// </summary>
         public int Type { get; set; }
-        /// <summary>
-        /// 公务单位
-        /// </summary>
+
         public string Client { get; set; }
         /// <summary>
         /// 公务日期
@@ -113,6 +111,28 @@ namespace OASystem.Domain.Dtos.Resource
         /// 是否付费
         /// </summary>
         public int IsPay { get; set; }
+
+
+        /// <summary>
+        /// 国家
+        /// </summary>
+        public string Country { get; set; }
+
+        /// <summary>
+        /// 区域
+        /// </summary>
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 涉及领域
+        /// </summary>
+        public string Field { get; set; }
+
+        /// <summary>
+        /// 请示范例
+        /// </summary>
+        public string ReqSample { get; set; }
+
     }
 
     /// <summary>
@@ -129,6 +149,14 @@ namespace OASystem.Domain.Dtos.Resource
 
         public int DiId { get; set; }
 
-        public int[] IdList { get; set; }
+    }
+
+    public class PostOfficialActivitiesReqReqSampleTipsDto
+    {
+        public string country { get; set; }
+
+        public string area { get; set; }
+
+        public string client { get; set; }
     }
 }

+ 28 - 0
OASystem/OASystem.Domain/Entities/Resource/Res_OfficialActivities.cs

@@ -16,11 +16,25 @@ namespace OASystem.Domain.Entities.Resource
          /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int DiId { get; set; }
+
         /// <summary>
         /// 邀请方 1  公务方 0 
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int Type { get; set; }
+
+        /// <summary>
+        /// 所在国家
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Country { get; set; }
+
+        /// <summary>
+        /// 所在区域(城市)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string Area { get; set; }
+
         /// <summary>-
         /// 公务单位
         /// </summary>
@@ -62,6 +76,20 @@ namespace OASystem.Domain.Entities.Resource
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int OfficialForm { get; set; }
+
+
+        /// <summary>
+        /// 公务方所属领域
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Field { get; set; }
+
+        /// <summary>
+        /// 请示范例
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(500)")]
+        public string ReqSample { get; set; }
+
         /// <summary>
         /// 公务方背景
         /// </summary>

+ 2 - 0
OASystem/OASystem.Domain/ViewModels/Groups/TourClientListView.cs

@@ -57,6 +57,8 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public int Sex { get; set; }
 
+        public DateTime BirthDay { get; set; }
+
     }
 
     /// <summary>

+ 35 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/GroupStatusView.cs

@@ -39,4 +39,39 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
     {
         public string chatid { get; set; }
     }
+
+    public class GroupStatus_SendMessageView : ResponseBase
+    {
+        /// <summary>
+        /// 不合法的userid,不区分大小写,统一转为小写
+        /// </summary>
+        public string invaliduser { get; set; }
+
+        /// <summary>
+        /// 不合法的partyid
+        /// </summary>
+        public string invalidparty { get; set; }
+
+        /// <summary>
+        /// 不合法的标签id
+        /// </summary>
+        public string invalidtag { get; set; }
+
+        /// <summary>
+        /// 没有基础接口许可(包含已过期)的userid
+        /// </summary>
+        public string unlicenseduser { get; set; }
+
+        /// <summary>
+        /// 消息id,用于撤回应用消息
+        /// </summary>
+        public string msgid { get; set; }
+
+        /// <summary>
+        /// 仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,72小时内有效,且只能使用一次
+        /// </summary>
+        public string response_code { get; set; }
+    }
+
+
 }

+ 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; }
+    }
+
 }

+ 47 - 0
OASystem/OASystem.Domain/ViewModels/Resource/HotelDataView.cs

@@ -21,4 +21,51 @@ namespace OASystem.Domain.ViewModels.Resource
         public string City { get; set; }
     }
 
+    public class HotelDataInfoView
+    {
+        public int id { get; set; }
+
+        public string city { get; set; }
+
+        public string name { get; set; }
+
+        public string tel { get; set; }
+
+        public string fax { get; set; }
+
+        public string contact { get; set; }
+
+        public string contactPhone { get; set; }
+
+        public string level { get; set; }
+        public string address { get; set; }
+
+        public string otherInformation { get; set; }
+        public string remark { get; set; }
+
+    }
+
+    public class HotelDataItemView
+    {
+        public int Row_Number { get; set; }
+
+        public int Id { get; set; }
+
+        public string City { get; set; }
+
+        public string Name { get; set; }
+
+        public string Tel { get; set; }
+
+        public string Fax { get; set; }
+
+        public string Contact { get; set; }
+
+        public string CreateUserName { get; set; }
+
+        public string ContactPhone { get; set; }
+
+        public DateTime CreateTime { get; set; }
+    }
+
 }

+ 18 - 1
OASystem/OASystem.Domain/ViewModels/Resource/OfficialActivitiesView.cs

@@ -7,9 +7,26 @@ using System.Threading.Tasks;
 
 namespace OASystem.Domain.ViewModels.Resource
 {
-    public class OfficialActivitiesView:Res_OfficialActivities
+    public class OfficialActivitiesView : Res_OfficialActivities
     {
         public string CreateUserName { get; set; }
         public string OfficialFormName { get; set; }
     }
+
+    /// <summary>
+    /// 请示范例 Tips View
+    /// </summary>
+    public class ReqReqSampleTipsView
+    {
+        public string TeamName { get; set; }
+
+        public string Country { get; set; }
+
+        public string Area { get; set; }
+
+        public string Client { get; set; }
+
+        public string ReqSample { get; set; }
+    }
+
 }

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -292,7 +292,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
                 string feeSql = string.Format(@"Select * From Fin_DailyFeePayment 
                                                 Where IsDel=0 And Id = {0} ", dto.Id);
                 feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfoAndroidlView>(feeSql).FirstAsync();
-                feeData.TransferTypeId = feeData.TransferTypeId == 0 ? 62 : feeData.TransferTypeId == 1 ? 63 : 0;
+                //feeData.TransferTypeId = feeData.TransferTypeId == 0 ? 62 : feeData.TransferTypeId == 1 ? 63 : 0;
                 string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent 
                                                         Where IsDel=0 And DFPId = {0} ", dto.Id);
                 feeData.FeeContents = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToListAsync();

+ 2 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -74,7 +74,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
             {
                 string sql = string.Format(@"Select tcl.Id,tcl.DiId,temp.* From Grp_TourClientList tcl
                                                  Left Join 
-	                                                 (Select dc.Id As DcId,dc.LastName,dc.FirstName,ccom.CompanyFullName,dc.Job,cc.CertNo As IDCardNo,dc.Sex 
+	                                                 (Select dc.Id As DcId,dc.LastName,dc.FirstName,ccom.CompanyFullName,dc.Job,
+                                                     cc.CertNo As IDCardNo,dc.Sex,dc.BirthDay
 	                                                 From Crm_DeleClient dc
 	                                                 Left Join Crm_CustomerCompany ccom On dc.CrmCompanyId = ccom.Id  And ccom.IsDel = 0
 	                                                 Left Join Crm_CustomerCert cc On dc.Id = cc.DcId And cc.SdId = 773 And cc.IsDel = 0

+ 72 - 170
OASystem/OASystem.Infrastructure/Repositories/Resource/HotelDataRepository.cs

@@ -1,4 +1,5 @@
 using AutoMapper;
+using MySqlX.XDevAPI.Common;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.Resource;
@@ -9,6 +10,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Result = OASystem.Domain.Result;
 
 namespace OASystem.Infrastructure.Repositories.Resource
 {
@@ -19,198 +21,98 @@ namespace OASystem.Infrastructure.Repositories.Resource
         {
             _mapper= mapper;
         }
-        public async Task<Result> OperationHotelData(OperationHotelDto dto)
+
+        public async Task<Result> _Info(int portType, int id)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                if (dto.Status == 1)//添加
-                {
-                    string selectSql = string.Format(@"select * from Res_HotelData where Name='{0}' and IsDel='{1}'"
-                                                       , dto.Name,0);
-                    var HotelData = await _sqlSugar.SqlQueryable<Res_HotelData>(selectSql).FirstAsync();//查询是否存在
-                    if (HotelData != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
+            if (id< 1) return new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
 
-                    }
-                    else//不存在,可添加
-                    {
-                        Res_HotelData _HotelDataDto = _mapper.Map<Res_HotelData>(dto);
-                        int id = await AddAsyncReturnId(_HotelDataDto);
-                        if (id == 0)
-                        {
-                            return result = new Result() { Code = -1, Msg = "添加失败!" };
 
-                        }
-                        return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
-                    }
-                }
-                else if (dto.Status == 2)//修改
-                {
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_HotelData
-                    {
-                        City = dto.City,
-                        Name = dto.Name,
-                        Level = dto.Level,
-                        Address = dto.Address,
-                        Tel = dto.Tel,
-                        Fax = dto.Fax,
-                        Contact = dto.Contact,
-                        ContactPhone = dto.ContactPhone,
-                        OtherInformation = dto.OtherInformation,
-                        Remark = dto.Remark,
-                    });
-                    if (!res)
-                    {
-                        return result = new Result() { Code = -1, Msg = "修改失败!" };
-                    }
-                    return result = new Result() { Code = 0, Msg = "修改成功!" };
-                }
-                else
-                {
-                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
-                }
-            }
-            catch (Exception ex)
+            string sql = string.Format(@"SELECT
+  Id,
+  City,
+  [Name],
+  [Level],
+  [Address],
+  Tel,
+  Fax,
+  Contact,
+  ContactPhone,
+  OtherInformation,
+  Remark
+FROM
+  Res_HotelData
+WHERE
+  IsDel = 0
+  AND Id = {0}", id);
+
+            if (portType == 1 || portType == 2 || portType == 3)
             {
-                return result = new Result() { Code = -2, Msg = ex.Message };
-                }
+                var info = await _sqlSugar.SqlQueryable<HotelDataInfoView>(sql).FirstAsync();
+                if (info != null) return new Result() { Code = 0, Msg = "操作成功!",Data = info };
+                return new Result() { Code = -1, Msg = "暂无数据!" };
+            }
+           
+
+            
+
+
+            return new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
         }
 
-        public async Task<Result> QueryHotelData(QueryHotelDataDto dto)
+        public async Task<Result> OperationHotelData(OperationHotelDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+
+            if (dto.Status == 1)//添加
             {
-                string sqlWhere = string.Empty;
-                if (!string.IsNullOrWhiteSpace(dto.Name))
-                {
-                    sqlWhere += string.Format(@" And Name like '%{0}%'", dto.Name);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.City) && dto.City != "全部")
+                string selectSql = string.Format(@"select * from Res_HotelData where Name='{0}' and IsDel='{1}'"
+                                                   , dto.Name, 0);
+                var HotelData = await _sqlSugar.SqlQueryable<Res_HotelData>(selectSql).FirstAsync();//查询是否存在
+                if (HotelData != null)
                 {
-                    sqlWhere += string.Format(@" And City like '%{0}%'", dto.City);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.Contact))
-                {
-                    sqlWhere += string.Format(@" And Contact like '%{0}%'", dto.Contact);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.ContactPhone))
-                {
-                    sqlWhere += string.Format(@" And ContactPhone like '%{0}%'", dto.ContactPhone);
-                }
-                sqlWhere += string.Format(@" And IsDel={0}", 0);
-                if (!string.IsNullOrEmpty(sqlWhere.Trim()))
-                {
-                    Regex r = new Regex("And");
-                    sqlWhere = r.Replace(sqlWhere, "Where", 1);
-                }
-                if (dto.PortType == 1)
-                {
-                    string sql = string.Format(@"select * from Res_HotelData {0}", sqlWhere);
-                    List<Res_HotelData> HotelDataData = await _sqlSugar.SqlQueryable<Res_HotelData>(sql).ToListAsync();
-                    if (HotelDataData.Count == 0)
-                    {
-                        return result = new Result() { Code = -1, Msg = "暂无数据" };
-                    }
-                    HotelDataData = HotelDataData.OrderByDescending(x => x.CreateTime).ToList();
-
-                    if (dto.PageSize == 0 && dto.PageIndex == 0)
-                    {
-                        return result = new Result()
-                        {
-                            Code = 0,
-                            Msg = "查询成功",
-                            Data = HotelDataData,
-                        };
-                    }
-                    else
-                    {
-                        int count = HotelDataData.Count;
-                        float totalPage = (float)count / dto.PageSize;//总页数
-                        if (totalPage == 0) totalPage = 1;
-                        else totalPage = (int)Math.Ceiling((double)totalPage);
-
-                        List<Res_HotelData> _HotelData = new List<Res_HotelData>();
-                        for (int i = 0; i < dto.PageSize; i++)
-                        {
-                            var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
-                            if (RowIndex < HotelDataData.Count)
-                            {
-                                _HotelData.Add(HotelDataData[RowIndex]);
-                            }
-                            else
-                            {
-                                break;
-                            }
-                        }
-                        return result = new Result()
-                        {
-                            Code = 0,
-                            Msg = "查询成功",
-                            Data = new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = _HotelData },
-                        };
-                    }
+                    return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
 
                 }
-                else if (dto.PortType == 2)
+                else//不存在,可添加
                 {
-                    string sql = string.Format(@"select * from Res_HotelData {0}", sqlWhere);
-                    List<Res_HotelData> HotelDataData = await _sqlSugar.SqlQueryable<Res_HotelData>(sql).ToListAsync();
-                    if (HotelDataData.Count == 0)
-                    {
-                        return result = new Result() { Code = -1, Msg = "暂无数据" };
-                    }
-                    HotelDataData = HotelDataData.OrderByDescending(x => x.CreateTime).ToList();
-
-                    if (dto.PageSize == 0 && dto.PageIndex == 0)
-                    {
-                        return result = new Result()
-                        {
-                            Code = 0,
-                            Msg = "查询成功",
-                            Data = HotelDataData,
-                        };
-                    }
-                    else
+                    Res_HotelData _HotelDataDto = _mapper.Map<Res_HotelData>(dto);
+                    int id = await AddAsyncReturnId(_HotelDataDto);
+                    if (id == 0)
                     {
-                        int count = HotelDataData.Count;
-                        float totalPage = (float)count / dto.PageSize;//总页数
-                        if (totalPage == 0) totalPage = 1;
-                        else totalPage = (int)Math.Ceiling((double)totalPage);
+                        return result = new Result() { Code = -1, Msg = "添加失败!" };
 
-                        List<Res_HotelData> _HotelData = new List<Res_HotelData>();
-                        for (int i = 0; i < dto.PageSize; i++)
-                        {
-                            var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
-                            if (RowIndex < HotelDataData.Count)
-                            {
-                                _HotelData.Add(HotelDataData[RowIndex]);
-                            }
-                            else
-                            {
-                                break;
-                            }
-                        }
-                        return result = new Result()
-                        {
-                            Code = 0,
-                            Msg = "查询成功",
-                            Data = new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = _HotelData },
-                        };
                     }
+                    return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
                 }
-                else
+            }
+            else if (dto.Status == 2)//修改
+            {
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_HotelData
+                {
+                    City = dto.City,
+                    Name = dto.Name,
+                    Level = dto.Level,
+                    Address = dto.Address,
+                    Tel = dto.Tel,
+                    Fax = dto.Fax,
+                    Contact = dto.Contact,
+                    ContactPhone = dto.ContactPhone,
+                    OtherInformation = dto.OtherInformation,
+                    Remark = dto.Remark,
+                });
+                if (!res)
                 {
-                    return result = new Result() { Code = -2, Msg = "请传入PortType参数!1:Web,2:Android,3:IOS" };
+                    return result = new Result() { Code = -1, Msg = "修改失败!" };
                 }
+                return result = new Result() { Code = 0, Msg = "修改成功!" };
             }
-            catch (Exception)
+            else
             {
-                return result;
-                throw;
+                return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
             }
         }
+
+
+
     }
 }

+ 111 - 87
OASystem/OASystem.Infrastructure/Repositories/Resource/OfficialActivitiesRepository.cs

@@ -22,8 +22,6 @@ namespace OASystem.Infrastructure.Repositories.Resource
             _mapper = mapper;
         }
 
-
-
         /// <summary>
         /// 根据Diid查询公务出访数据List
         /// </summary>
@@ -174,113 +172,139 @@ namespace OASystem.Infrastructure.Repositories.Resource
         public async Task<Result> OpOfficialActivities(OpOfficialActivitiesDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+
+            #region 特殊字符转码  037 - 4.28 15:17
+
+            if (!string.IsNullOrEmpty(dto.Contact))
             {
-                #region 特殊字符转码  037 - 4.28 15:17
+                byte[] utf8Bytes = Encoding.UTF8.GetBytes(dto.Contact);
+                byte[] utf16Bytes = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, utf8Bytes);
+                dto.Contact = Encoding.Unicode.GetString(utf16Bytes);
+            }
 
-                if (!string.IsNullOrEmpty(dto.Contact))
-                {
-                    byte[] utf8Bytes = Encoding.UTF8.GetBytes(dto.Contact);
-                    byte[] utf16Bytes = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, utf8Bytes);
-                    dto.Contact = Encoding.Unicode.GetString(utf16Bytes);
-                }
-                
-                #endregion
+            #endregion
+
+            if (dto.Status == 1)//添加
+            {
+                _sqlSugar.BeginTran();
 
+                string selectSql = string.Format(@"select * from Res_OfficialActivities where Client='{0}' and Address='{1}' and IsDel='{2}'", dto.Client, dto.Address, 0);
+                var res_InvitationOfficial = await _sqlSugar.SqlQueryable<Res_OfficialActivities>(selectSql).FirstAsync();//查询是否存在
+                if (res_InvitationOfficial != null)
+                {
+                    _sqlSugar.RollbackTran();
+                    return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
 
-                if (dto.Status == 1)//添加
+                }
+                else//不存在,可添加
                 {
-                    _sqlSugar.BeginTran();
 
-                    string selectSql = string.Format(@"select * from Res_OfficialActivities where Client='{0}' and Address='{1}' and IsDel='{2}'", dto.Client, dto.Address, 0);
-                    var res_InvitationOfficial = await _sqlSugar.SqlQueryable<Res_OfficialActivities>(selectSql).FirstAsync();//查询是否存在
-                    if (res_InvitationOfficial != null)
+                    Res_OfficialActivities _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
+                    int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
+                    if (id == 0)
                     {
                         _sqlSugar.RollbackTran();
-                        return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
-
+                        return result = new Result() { Code = -1, Msg = "添加失败!" };
                     }
-                    else//不存在,可添加
-                    {
 
-                        Res_OfficialActivities _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
-                        int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
-                        if (id == 0)
+                    //添加到资料库
+                    Res_InvitationOfficialActivityData res_InvitationData = new Res_InvitationOfficialActivityData();
+                    res_InvitationData.Country = dto.Country;
+                    res_InvitationData.City = dto.Area;
+                    res_InvitationData.UnitName = dto.Client;
+                    res_InvitationData.Delegation = dto.DiId.ToString();
+                    res_InvitationData.Address = dto.Address;
+                    res_InvitationData.CreateUserId = dto.CreateUserId;
+                    res_InvitationData.Contact = dto.Contact;
+                    res_InvitationData.Job = dto.Job;
+                    res_InvitationData.Tel = dto.Tel;
+
+                    Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
+                        (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0 && a.Address == res_InvitationData.Address);
+
+                    if (ifNullUp == null)
+                    {
+                        int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                        if (DataID != 0)
                         {
-                            _sqlSugar.RollbackTran();
-                            return result = new Result() { Code = -1, Msg = "添加失败!" };
+                            _sqlSugar.CommitTran();
+                            return  new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
                         }
-
-                        //添加到资料库
-                        Res_InvitationOfficialActivityData res_InvitationData = new Res_InvitationOfficialActivityData();
-                        res_InvitationData.Country = "";
-                        res_InvitationData.City = "";
-                        res_InvitationData.UnitName = dto.Client;
-                        res_InvitationData.Delegation = dto.DiId.ToString();
-                        res_InvitationData.Address = dto.Address;
-                        res_InvitationData.CreateUserId = dto.CreateUserId;
-                        res_InvitationData.Contact = dto.Contact;
-                        res_InvitationData.Job = dto.Job;
-                        res_InvitationData.Tel = dto.Tel;
-
-                        Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
-                            (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0 && a.Address == res_InvitationData.Address);
-
-                        if (ifNullUp == null)
+                        else
                         {
-                            int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                            if (DataID != 0)
-                            {
-                                result = new Result() { Code = 0, Msg = "添加成功!" };
-                            }
-                            else
-                            {
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
-                            }
+                            _sqlSugar.RollbackTran();
+                            return  new Result() { Code = -1, Msg = "添加失败!" };
                         }
-
-                        _sqlSugar.CommitTran();
-                        return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
                     }
+
+                   
                 }
-                else if (dto.Status == 2)//修改
+            }
+            else if (dto.Status == 2)//修改
+            {
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_OfficialActivities
                 {
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_OfficialActivities
-                    {
-                        Type = dto.Type,
-                        Client = dto.Client,
-                        Date = dto.Date,
-                        Time = dto.Time,
-                        Address = dto.Address,
-                        Contact = dto.Contact,
-                        Job = dto.Job,
-                        Tel = dto.Tel,
-                        OfficialForm = dto.OfficialForm,
-                        Setting = dto.Setting,
-                        Dresscode = dto.Dresscode,
-                        Attendees = dto.Attendees,
-                        IsNeedTrans = dto.IsNeedTrans,
-                        Translators = dto.Translators,
-                        language = dto.language,
-                        Trip = dto.Trip,
-                        CreateUserId = dto.CreateUserId,
-                        Remark = dto.Remark,
-                    });
-                    if (!res)
-                    {
-                        return result = new Result() { Code = -1, Msg = "修改失败!" };
-                    }
-                    return result = new Result() { Code = 0, Msg = "修改成功!", Data = new { Id = dto.Id } };
-                }
-                else
+
+                    Country = dto.Country,
+                    Area = dto.Area,
+                    Type = dto.Type,
+                    Client = dto.Client,
+                    Date = dto.Date,
+                    Time = dto.Time,
+                    Address = dto.Address,
+                    Contact = dto.Contact,
+                    Job = dto.Job,
+                    Tel = dto.Tel,
+                    OfficialForm = dto.OfficialForm,
+                    Field = dto.Field,
+                    ReqSample = dto.ReqSample,
+                    Setting = dto.Setting,
+                    Dresscode = dto.Dresscode,
+                    Attendees = dto.Attendees,
+                    IsNeedTrans = dto.IsNeedTrans,
+                    Translators = dto.Translators,
+                    language = dto.language,
+                    Trip = dto.Trip,
+                    CreateUserId = dto.CreateUserId,
+                    Remark = dto.Remark,
+                });
+                if (!res)
                 {
-                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+                    return result = new Result() { Code = -1, Msg = "修改失败!" };
                 }
+                return result = new Result() { Code = 0, Msg = "修改成功!", Data = new { Id = dto.Id } };
             }
-            catch (Exception ex)
+            else
+            {
+                return new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+            }
+            return result;
+        }
+
+        public async Task<Result> PostReqReqSampleTips(string country, string Area,string client)
+        {
+            if (string.IsNullOrEmpty(country)) return new Result() { Code = -1, Msg = "国家为空!" };
+
+            string sqlWhere = string.Empty;
+            if (!string.IsNullOrEmpty(Area)) sqlWhere = string.Format(@$" And oa.Area Like '%{Area}%'");
+
+            if (!string.IsNullOrEmpty(client)) sqlWhere = string.Format(@$" And oa.Client Like '%{client}%'");
+
+
+            string sql = string.Format(@$"Select di.TeamName,oa.Id,oa.Country,oa.Area,oa.Client,oa.ReqSample 
+                                          From Res_OfficialActivities oa With(NoLock)
+                                          Left Join Grp_DelegationInfo di On oa.DiId = di.Id 
+                                          Where oa.IsDel = 0 And oa.Country='{country}' {sqlWhere}");
+
+            //ReqReqSampleTipsView
+            var _views = await _sqlSugar.SqlQueryable< ReqReqSampleTipsView >(sql).ToListAsync();
+            if (_views.Count > 0 )
             {
-                return result = new Result() { Code = -2, Msg = "程序错误!" };
+                return new Result() { Code = 0, Msg = "操作成功!", Data = _views };
             }
+
+            return new Result() { Code = -1, Msg = "暂无相关数据!" };
         }
+
     }
 }