Explorar o código

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

jiangjc hai 1 ano
pai
achega
c4f6d6a03b

+ 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 添加登录用户上线信息

+ 37 - 18
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5485,26 +5485,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>
         /// 签证费用录入下拉框初始化
@@ -7098,6 +7104,14 @@ namespace OASystem.API.Controllers
             var groupCostMap = _mapper.Map<List<Grp_GroupCostDto>>(groupCost);
             var hotelNumber = _CostTypeHotelNumberRepository.GetCostTypeHotelNumberByDiid(diid); //酒店数量 可枚举
             var GroupCostParameter = _GroupCostParameterRepository.GetGroupCostParameterListByDiid(diid); //成本系数 可枚举
+            groupCostMap = groupCostMap.Select(x =>
+            {
+                if (DateTime.TryParse(x.Date, out DateTime dataForamt))
+                {
+                    x.Date = dataForamt.ToString("yyyy-MM-dd");
+                }
+                return x;
+            }).ToList();
 
             //GroupCostParameter.Add(new
             //     Grp_GroupCostParameter());
@@ -11188,7 +11202,12 @@ namespace OASystem.API.Controllers
                     builder.Write(birthDayStr);
 
                     builder.MoveToCell(0, i + 1, 3, 0);
-                    builder.Write(DcList[i].CompanyFullName);
+                    string company = "";
+                    if (!string.IsNullOrEmpty(DcList[i].CompanyFullName))
+                    {
+                        company = DcList[i].CompanyFullName.ToString();
+                    }
+                    builder.Write(company);
 
                     builder.MoveToCell(0, i + 1, 4, 0);
                     builder.Write(DcList[i].Job);
@@ -11232,7 +11251,7 @@ namespace OASystem.API.Controllers
                     string company = "";
                     try
                     {
-                        if (!string.IsNullOrEmpty(DcList[i].CompanyFullName.ToString()))
+                        if (!string.IsNullOrEmpty(DcList[i].CompanyFullName))
                         {
                             //查询对照表
                             Res_CompanyEnglishComparison tempCec = listCEC.FirstOrDefault(s => s.zhName.Contains(DcList[i].CompanyFullName.ToString().Trim()));

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 319 - 89
OASystem/OASystem.Api/Controllers/ResourceController.cs


+ 9 - 6
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -1438,7 +1438,7 @@ namespace OASystem.API.OAMethodLib
         {
             DataTable datas =  GetTableByBlackCode(diId);
 
-            string countryStr = "";
+            string countryStr = "[黑屏代码未录入].";
             if (datas.Rows.Count > 0 )
             {
                 var airDatas = from row in datas.AsEnumerable()
@@ -1458,10 +1458,12 @@ namespace OASystem.API.OAMethodLib
                 //去掉开始和结束城市
                 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)); //到达国家
-
+                    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();
@@ -1480,7 +1482,8 @@ namespace OASystem.API.OAMethodLib
                         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}停留{days}日、";
+                        countryStr += $@"{country}停留  日、";
                     }
                 }
                 if (countryStr.Length > 0) countryStr = countryStr.Substring(0, countryStr.Length - 1);

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

+ 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

@@ -293,7 +293,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 = "暂无相关数据!" };
         }
+
     }
 }