Преглед изворни кода

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

yuanrf пре 10 месеци
родитељ
комит
6edd90b674

+ 27 - 0
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -1,4 +1,5 @@
 using Microsoft.AspNetCore.Mvc;
+using NetTaste;
 using NPOI.SS.Formula.Functions;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.ALiYun;
@@ -99,6 +100,32 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(groupData.Data, groupData.Data.Count));
         }
 
+
+        /// <summary>
+        /// 团组信息 团组名称 Page List
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostGroupNameScreen(GroupNameScreenDto dto)
+        {
+            //验证
+            var validator = new GroupNameScreenDtoFoaValidator();
+            var validatorRes = await validator.ValidateAsync(dto);
+            if (!validatorRes.IsValid)
+            {
+                var errors = new StringBuilder();
+                foreach (var error in validatorRes.Errors) errors.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false,errors.ToString()));
+            }
+
+            //获取数据
+            var res = await _groupRep.GetGroupNameList(dto.PortType, dto.PageIndex, dto.PageSize, dto.groupName, dto.userId);
+
+            return Ok(res);
+        }
+
         /// <summary>
         /// 获取团组指向分类
         /// </summary>

Разлика између датотеке није приказан због своје велике величине
+ 464 - 415
OASystem/OASystem.Api/Controllers/FinancialController.cs


+ 45 - 85
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -1559,11 +1559,6 @@ namespace OASystem.API.Controllers
                                 //    _detail.PriceNameContent = touristGuideGroundReservations.Area;
                                 //}
 
-
-
-
-
-
                                 List<Grp_CarTouristGuideGroundReservationsContent> touristGuideGroundReservationsContents = _CarTouristGuideGroundReservationsContent
                                     .Where(s => s.CTGGRId == touristGuideGroundReservations.Id && s.IsDel == 0 && s.Price != 0).ToList();
 
@@ -1599,7 +1594,7 @@ namespace OASystem.API.Controllers
                             if (visaInfo != null)
                             {
                                 _detail.PriceNameContent = getClientNameStr(clientNameList, visaInfo.VisaClient);
-                                _detail.PriceMsgContent = "备注:" + visaInfo.Remark;
+                                _detail.PriceMsgContent =  $"签证描述:{visaInfo.VisaDescription}<br/> 备注:{visaInfo.Remark}";
                             }
 
                             break;
@@ -2244,7 +2239,7 @@ namespace OASystem.API.Controllers
                 Result groupData = await _airTicketResRep.DeriveAirTicketRes(dto);
                 if (groupData.Code != 0)
                 {
-                    return Ok(JsonView(false, groupData.Msg));
+                    return Ok(JsonView(StatusCodes.Status400BadRequest, groupData.Msg, ""));
                 }
                 else
                 {
@@ -2297,14 +2292,14 @@ namespace OASystem.API.Controllers
                     }
                     else
                     {
-                        return Ok(JsonView(false, "暂无数据!"));
+                        return Ok(JsonView(StatusCodes.Status400BadRequest, "暂无数据!", ""));
                     }
                 }
 
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, ex.Message, ""));
                 throw;
             }
         }
@@ -2326,7 +2321,7 @@ namespace OASystem.API.Controllers
                 Result groupData = await _airTicketResRep.ItineraryAirTicketRes(dto);
                 if (groupData.Code != 0)
                 {
-                    return Ok(JsonView(false, groupData.Msg));
+                    return Ok(JsonView(StatusCodes.Status400BadRequest, groupData.Msg, ""));
                 }
                 else
                 {
@@ -2877,7 +2872,7 @@ namespace OASystem.API.Controllers
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, "程序错误!"));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, "程序错误!", ""));
                 throw;
             }
         }
@@ -2901,13 +2896,7 @@ namespace OASystem.API.Controllers
 
             #endregion
 
-            var res = await _decreasePaymentsRep.DecreasePaymentsSelect(dto);
-            if (res.Code != 0)
-            {
-                return Ok(JsonView(false, res.Msg));
-            }
-
-            return Ok(JsonView(true, "操作成功!", res.Data));
+            return Ok(await _decreasePaymentsRep.DecreasePaymentsSelect(dto));
 
         }
 
@@ -2920,28 +2909,16 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DecreasePaymentsList(DecreasePaymentsListDto dto)
         {
-            try
-            {
-                #region 参数验证
+            #region 参数验证
 
-                if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数!"));
-                if (dto.DiId < 1) return Ok(JsonView(false, "请传入有效的DiId参数!"));
+            if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数!"));
+            if (dto.DiId < 1) return Ok(JsonView(false, "请传入有效的DiId参数!"));
 
-                #endregion
+            #endregion
 
-                Result groupData = await _decreasePaymentsRep.DecreasePaymentsList(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-            }
+            return Ok(await _decreasePaymentsRep.DecreasePaymentsList(dto));
         }
-        
+
         /// <summary>
         /// 团组增减款项操作(Status:1.新增,2.修改)
         /// </summary>
@@ -2951,34 +2928,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OpDecreasePayments(DecreasePaymentsOpDto dto)
         {
-            try
+            JsonView groupData = await _decreasePaymentsRep.OpDecreasePayments(dto);
+            if (groupData.Code != 200)
             {
-                Result groupData = await _decreasePaymentsRep.OpDecreasePayments(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
+                return Ok(JsonView(false, groupData.Msg));
+            }
 
-                #region 应用推送
-                try
-                {
-                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
-                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
+            #region 应用推送
+            int ccpId = (int)groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+            int sign = (int)groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
-                    await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
-                }
-                catch (Exception ex)
-                {
-                }
-                #endregion
+            await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
+           
+            #endregion
+
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
 
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
-            }
         }
         /// <summary>
         /// 团组增减款项操作 删除
@@ -3013,12 +2978,7 @@ namespace OASystem.API.Controllers
         {
             if (dto.Id < 1) return Ok(JsonView(false, "请传入有效的数据Id!"));
 
-            Result groupData = await _decreasePaymentsRep.QueryDecreasePaymentsById(dto);
-            if (groupData.Code != 0)
-            {
-                return Ok(JsonView(false, groupData.Msg));
-            }
-            return Ok(JsonView(true, groupData.Msg, groupData.Data));
+            return Ok(await _decreasePaymentsRep.QueryDecreasePaymentsById(dto));
 
         }
 
@@ -10312,13 +10272,13 @@ ORDER by  gctggrc.id DESC
         public async Task<IActionResult> PostHotelReservationsCreateVoucher(HotelReservationsCreateVoucherDto _dto)
         {
             #region  参数验证
-            if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
+            if (_dto.UserId < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "员工Id为空", ""));
             if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
-            if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
+            if (_dto.DiId < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组Id为空", ""));
 
             #region 团组操作权限验证 76 酒店预定模块
             var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
-            if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
+            if (groupAuthView.Code != 0) return Ok(JsonView(StatusCodes.Status400BadRequest, groupAuthView.Msg, ""));
             #endregion
 
             PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
@@ -10335,7 +10295,7 @@ ORDER by  gctggrc.id DESC
             List<Grp_HotelReservations> hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToListAsync();
 
             //判断数据是否完整
-            if (hrDtas.Count < 1) return Ok(JsonView(false, "请先录入酒店预订信息!"));
+            if (hrDtas.Count < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "请先录入酒店预订信息!", ""));
 
             hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
             string strFileName = "HotelStatement/";
@@ -10481,7 +10441,7 @@ ORDER by  gctggrc.id DESC
                 var errors = new StringBuilder();
                 foreach (var valid in vadalitorRes.Errors) errors.AppendLine(valid.ErrorMessage);
 
-                return Ok(JsonView(false, errors.ToString()));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, errors.ToString(), ""));
             }
 
             #region 团组操作权限验证 76 酒店预定模块
@@ -10489,14 +10449,14 @@ ORDER by  gctggrc.id DESC
             if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
             #endregion
 
-            //PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
 
-            //#region 页面操作权限验证
-            //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+            #region 页面操作权限验证
+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
 
-            //if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权限!"));
+            if (pageFunAuthView.FilesDownloadAuth == 0) return Ok(JsonView(false, "您没有文件下载权限!"));
 
-            //#endregion
+            #endregion
 
             #endregion
             decimal _rate = 1.00M;
@@ -10504,13 +10464,13 @@ ORDER by  gctggrc.id DESC
 
             var currDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.STid == 66).ToList();
             List<Grp_HotelReservations> hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToListAsync();
-            if (hrDtas.Count < 1) return Ok(JsonView(false, "酒店预订费用未录入,不支持预定成本Excel导出"));
+            if (hrDtas.Count < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "酒店预订费用未录入,不支持预定成本Excel导出", ""));
 
             Grp_GroupCostParameter _GroupCostParameter = await _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).FirstAsync();
-            if (_GroupCostParameter == null) return Ok(JsonView(false, "团组成本费用未录入,不支持预定成本Excel导出"));
+            if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
             if (string.IsNullOrEmpty(_GroupCostParameter.Currency))
             {
-                return Ok(JsonView(false, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出"));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
             }
             _currency = _GroupCostParameter.Currency;
 
@@ -10526,7 +10486,7 @@ ORDER by  gctggrc.id DESC
             var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
             if (currInfo == null)
             {
-                return Ok(JsonView(false, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出"));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
                 
             }
 
@@ -10785,13 +10745,13 @@ ORDER by  gctggrc.id DESC
             try
             {
                 #region  参数验证
-                if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
+                if (_dto.UserId < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "员工Id为空", ""));
                 if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
-                if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
+                if (_dto.DiId < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组Id为空", ""));
 
                 #region 团组操作权限验证 76 酒店预定模块
                 var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
-                if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
+                if (groupAuthView.Code != 0) return Ok(JsonView(StatusCodes.Status400BadRequest, groupAuthView.Msg, ""));
                 #endregion
 
                 PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
@@ -10813,7 +10773,7 @@ ORDER by  gctggrc.id DESC
 
                 if (listhoteldata.Count < 0)
                 {
-                    return Ok(JsonView(false, "当前团组暂无酒店预订信息!"));
+                    return Ok(JsonView(StatusCodes.Status400BadRequest, "当前团组暂无酒店预订信息!", ""));
                 }
 
                 //利datatable存储
@@ -10909,7 +10869,7 @@ ORDER by  gctggrc.id DESC
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(StatusCodes.Status400BadRequest, ex.Message, ""));
             }
         }
 

+ 82 - 0
OASystem/OASystem.Api/Middlewares/ExceptionHandlingMiddleware.cs

@@ -0,0 +1,82 @@
+using Microsoft.AspNetCore.Http;
+
+namespace OASystem.API.Middlewares
+{
+    /// <summary>
+    /// 全局异常捕获中间件
+    /// </summary>
+    public class ExceptionHandlingMiddleware
+    {
+        private readonly RequestDelegate _next;  // 用来处理上下文请求
+        private readonly ILogger<ExceptionHandlingMiddleware> _logger;
+
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        /// <param name="next"></param>
+        /// <param name="logger"></param>
+        public ExceptionHandlingMiddleware(RequestDelegate next, ILogger<ExceptionHandlingMiddleware> logger)
+        {
+            _next = next;
+            _logger = logger;
+        }
+
+        /// <summary>
+        /// 执行中间件
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <returns></returns>
+        public async Task InvokeAsync(HttpContext httpContext)
+        {
+            try
+            {
+                await _next(httpContext); //要么在中间件中处理,要么被传递到下一个中间件中去
+            }
+            catch (Exception ex)
+            {
+                await HandleExceptionAsync(httpContext, ex); // 捕获异常了 在HandleExceptionAsync中处理
+            }
+        }
+
+        /// <summary>
+        /// 异步处理异常
+        /// </summary>
+        /// <param name="context"></param>
+        /// <param name="exception"></param>
+        /// <returns></returns>
+        private async Task HandleExceptionAsync(HttpContext context, Exception exception)
+        {
+            context.Response.ContentType = "application/json";  // 返回json 类型
+            var response = context.Response;
+            var errorResponse = new JsonView
+            {
+                Code = StatusCodes.Status400BadRequest,
+                Data = ""
+            };  // 自定义的异常错误信息类型
+            switch (exception)
+            {
+                case ApplicationException ex:
+                    if (ex.Message.Contains("Invalid token"))
+                    {
+                        response.StatusCode = StatusCodes.Status403Forbidden;
+                        errorResponse.Msg = ex.Message;
+                        break;
+                    }
+                    response.StatusCode = StatusCodes.Status400BadRequest;
+                    errorResponse.Msg = ex.Message;
+                    break;
+                case KeyNotFoundException ex:
+                    response.StatusCode = StatusCodes.Status404NotFound;
+                    errorResponse.Msg = ex.Message;
+                    break;
+                default:
+                    response.StatusCode = StatusCodes.Status500InternalServerError;
+                    errorResponse.Msg = exception.Message;
+                    break;
+            }
+            _logger.LogError(exception.Message);
+            var result = JsonConvert.SerializeObject(errorResponse);
+            await context.Response.WriteAsync(result);
+        }
+    }
+}

+ 68 - 7
OASystem/OASystem.Api/OAMethodLib/JuHeAPI/JuHeApiService.cs

@@ -4,6 +4,7 @@ using OASystem.Domain;
 using OASystem.Domain.Dtos.SmallFun;
 using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.SmallFun;
+using StackExchange.Redis;
 using System.DirectoryServices.Protocols;
 using System.Net.Http;
 using System.Net.Http.Json;
@@ -19,6 +20,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
     {
         private readonly HttpClient _httpClient;
         private readonly string _appKey = "0f5429e9fbb8637c0ff3f14bbb42c732"; //配置您申请的appkey
+        private readonly string _appkey_textTranslate = "59db9edbac297e30695973aa1d856391"; //文本翻译 appkey
 
         /// <summary>
         /// 初始化
@@ -29,13 +31,15 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
             _httpClient = clientFactory.CreateClient("PublicJuHeApi"); ;
         }
 
+        #region 汇率
+
         /// <summary>
         /// 获取汇率
         /// </summary>
         /// <returns></returns>
         public async Task<JuHeAPIResult> GetExchangeRateAsync()
         {
-            var result = new JuHeAPIResult() { Resultcode = "-2",Reason="未知错误" };
+            var result = new JuHeAPIResult() { Resultcode = "-2", Reason = "未知错误" };
 
             string rateDataString = await RedisRepository.RedisFactory
                                                          .CreateRedisRepository()
@@ -130,7 +134,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
         {
 
             var result = new Result();
-            if (currencyCode.ToUpper() == "CNY" )
+            if (currencyCode.ToUpper() == "CNY")
             {
                 return result;
             }
@@ -165,7 +169,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
         {
 
             List<ExchangeRateModel> result = new List<ExchangeRateModel>();
-            if (currencyCodes.Length  <= 0 )
+            if (currencyCodes.Length <= 0)
             {
                 return result;
             }
@@ -184,7 +188,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
                         foreach (var item in currencyModel)
                         {
                             ExchangeRateModel exchangeRateModel = data.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
-                            if (exchangeRateModel != null )
+                            if (exchangeRateModel != null)
                             {
                                 result.Add(exchangeRateModel);
                             }
@@ -226,15 +230,16 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
                     return result;
                 }
 
-                decimal moneySuf = Convert.ToDecimal(rateModelSuf.Data.FSellPri) / 100 ; //fSellPri
+                decimal moneySuf = Convert.ToDecimal(rateModelSuf.Data.FSellPri) / 100; //fSellPri
                 decimal settlementMoney = dto.Money / moneySuf;
-                var rateView = new ExchangeRateView { 
+                var rateView = new ExchangeRateView
+                {
                     CurrencyCodePre = dto.CurrencyCodePer,
                     CurrencyNamePre = "人民币",
                     MoneyPre = dto.Money,
                     CurrencyCodeSuf = dto.CurrencyCodeSuf,
                     CurrencyNameSuf = currencyModelSuf.CurrencyName,
-                    MoneySuf = CommonFun.CutDecimalWithN( settlementMoney,4),
+                    MoneySuf = CommonFun.CutDecimalWithN(settlementMoney, 4),
                     UpdateTime = string.Format("{0} {1}", rateModelSuf.Data.Date, rateModelSuf.Data.Time)
                 };
 
@@ -330,5 +335,61 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
             return result;
         }
 
+        #endregion
+
+        #region 文本翻译
+        /// <summary>
+        /// 文本翻译
+        /// </summary>
+        /// <param name="source">原文,数据类型为字符串,也可为数组(元素必须为字符串类型);每次请求的字符串长度之和尽量不要超过 </param>
+        /// <param name="trans_type">翻译方向:en2zh(英文-中文),zh2en(中文-英文),ja2zh(日文-中文),zh2ja(中文-日文),ko2zh(韩文-中文),zh2ko(中文-韩文)</param>
+        /// <returns></returns>
+        public async Task<JuHeAPIResult> GetTextTranslateAsync(string source,string trans_type = "zh2en")
+        {
+            var result = new JuHeAPIResult() { Resultcode = "10020", Reason = "接口维护" };
+
+
+            
+            #region 请求接口并存入缓存
+            string url = string.Format("/finance/exchange/rmbquot");
+
+            var exchangeReq = await _httpClient
+                                    .PostAsync(url,
+                                     new FormUrlEncodedContent(new List<KeyValuePair<string, string>>()
+                                     {
+                                             new KeyValuePair<string, string>("key",_appKey),//你申请的key 
+                                             new KeyValuePair<string, string>("source",source),   
+                                             new KeyValuePair<string, string>("trans_type",trans_type)    
+
+                                     }));
+            if (exchangeReq.IsSuccessStatusCode)
+            {
+                var stringResponse = await exchangeReq.Content.ReadAsStringAsync();
+
+                result = System.Text.Json.JsonSerializer.Deserialize<JuHeAPIResult>(stringResponse,
+                new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+                if (result.Resultcode == "200")
+                {
+                    string resStr = (string)result.Result.GetType().GetProperty("res").GetValue(result.Result, null);
+                    result.Result = resStr;
+                }
+                else
+                {
+                    result.Reason = string.Format("聚合APIError[Error_Code:{0} Resultcode:{1} Msg:{2}]",
+                        result.Error_code, result.Resultcode, result.Result);
+                }
+            }
+            else
+            {
+                result.Reason = "汇率接口请求失败!";
+            }
+
+            #endregion
+
+            return result;
+        }
+
+        #endregion
     }
 }

+ 1 - 0
OASystem/OASystem.Api/OASystem.API.csproj

@@ -28,6 +28,7 @@
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
     <PackageReference Include="Betalgo.OpenAI.GPT3" Version="6.8.3" />
     <PackageReference Include="BouncyCastle.NetCore" Version="1.8.8" />
+    <PackageReference Include="EPPlus" Version="7.1.3" />
     <PackageReference Include="Flurl.Http" Version="3.2.4" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.11" />
     <PackageReference Include="NPOI" Version="2.7.0" />

+ 3 - 0
OASystem/OASystem.Api/Program.cs

@@ -28,6 +28,7 @@ using OASystem.API.OAMethodLib.Hub.HubClients;
 using Microsoft.Extensions.Options;
 using Microsoft.AspNetCore.Identity;
 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
+using OASystem.API.Middlewares;
 
     var builder = WebApplication.CreateBuilder(args);
 var basePath = AppContext.BaseDirectory;
@@ -316,6 +317,8 @@ if (!app.Environment.IsDevelopment())
 }
 app.UseStaticFiles();
 
+app.UseMiddleware<ExceptionHandlingMiddleware>();
+
 app.UseRouting();
 app.UseCors("Cors");  //Cors
 

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

@@ -43,7 +43,21 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int OrbitalPrivateTransfer { get; set; }
 
-
+        /// <summary>
+        /// 对方开户行
+        /// </summary>
+        public string OtherBankName { get; set; }
+        /// <summary>
+        /// 对方银行账号
+        /// </summary>
+        public string OtherSideNo { get; set; }
+        /// <summary>
+        /// 对方姓名
+        /// </summary>
+        public string OtherSideName
+        {
+            get; set;
+        }
 
         /// <summary>
         /// 编号
@@ -63,7 +77,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 供应商类型
         /// </summary>
-        public int SupplierTypeId { get; set; }
+        public int SupplierTypeId { get; set; } = 0;
 
         /// <summary>
         /// 供应商名称
@@ -80,6 +94,22 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public string SupplierContactNumber { get; set; }
 
+        /// <summary>
+        /// 供应商社交账号
+        /// </summary>
+        public string SupplierSocialAccount { get; set; }
+
+        /// <summary>
+        /// 供应商邮箱
+        /// </summary>
+        public string SupplierEmail { get; set; }
+
+        /// <summary>
+        /// 供应商地址
+        /// </summary>
+        public string SupplierAddress { get; set; }
+
+
         /// <summary>
         /// 费用名称
         /// </summary>

+ 24 - 1
OASystem/OASystem.Domain/Dtos/Groups/GroupListDto.cs

@@ -1,4 +1,5 @@
-using Newtonsoft.Json;
+using FluentValidation;
+using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -249,6 +250,28 @@ namespace OASystem.Domain.Dtos.Groups
 
     }
 
+    public class GroupNameScreenDto : DtoBase
+    {
+        public string groupName { get; set; } = "";
+
+        public int userId { get; set; } = -1;
+    }
+
+    #region GroupNameScreenDto 验证
+
+    public class GroupNameScreenDtoFoaValidator : AbstractValidator<GroupNameScreenDto>
+    {
+        public GroupNameScreenDtoFoaValidator() {
+            RuleFor(it => it.PortType)
+                .NotNull()
+                .NotEmpty()
+                .InclusiveBetween(1, 3)
+                .WithMessage(MsgTips.Port);
+        }
+    }
+
+    #endregion
+
     /// <summary>
     /// 
     /// </summary>

+ 18 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DecreasePayments.cs

@@ -51,6 +51,24 @@ namespace OASystem.Domain.Entities.Groups
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
         public string SupplierContactNumber { get; set; }
 
+        /// <summary>
+        /// 供应商社交账号
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(100)")]
+        public string SupplierSocialAccount { get; set; }
+
+        /// <summary>
+        /// 供应商邮箱
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(50)")]
+        public string SupplierEmail { get; set; }
+
+        /// <summary>
+        /// 供应商地址
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(300)")]
+        public string SupplierAddress { get; set; }
+
         /// <summary>
         /// 费用名称
         /// </summary>

+ 1 - 1
OASystem/OASystem.Domain/Result.cs

@@ -60,7 +60,7 @@ namespace OASystem.Domain
         /// <summary>
         /// UserId错误消息提示
         /// </summary>
-        public static string UserId = "请检查状态UserId是否正确!";
+        public static string UserId = "请检查UserId是否正确!";
     }
 
    

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

@@ -91,6 +91,12 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public string SupplierContactNumber { get; set; }
 
+        public string SupplierSocialAccount { get; set; }
+
+        public string SupplierEmail { get; set; }
+
+        public string SupplierAddress { get; set; }
+
         /// <summary>
         /// 费用名称
         /// </summary>
@@ -127,6 +133,13 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 费用标识
         /// </summary>
         public int orbitalPrivateTransfer { get; set; }
+
+        public string OtherBankName { get; set; }
+        public string OtherSideName { get; set; }
+        public string OtherSideNo { get; set; }
+
+        public int IsAuditGM { get; set; }
+
         /// <summary>
         /// 备注
         /// </summary>

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

@@ -530,6 +530,11 @@ namespace OASystem.Domain.ViewModels.Groups
         public string GroupName { get; set; }
     }
 
+    public class GroupNamePageView : GroupNameView
+    {
+        public int RowNumber { get; set; }
+    }
+
     /// <summary>
     /// 根据团组ID 查询客户
     /// </summary>

+ 188 - 220
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -34,53 +34,29 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        public async Task<Result> DecreasePaymentsList(DecreasePaymentsListDto dto)
+        public async Task<JsonView> DecreasePaymentsList(DecreasePaymentsListDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+            string sqlWhere = "";
+            if (dto.IsPaySign != -1)
             {
-                //string UserId = "0";
-                //List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 98).ToList();
-                //UserId = string.Join(",", gtaUIdList.Select(it => it.UId).ToList());
-
-                //string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
-                //                            (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
-                //                            Grp_CreditCardPayment where CTable=98 and CId=s.Id and DiId = {0} and IsDel=0) as 'isAudit' from Grp_DecreasePayments s 
-                //                            where DIID={0} and IsDel=0  and s.CreateUserId in ({1}) ", dto.DiId, dto.UserId);
-
-                string sqlWhere = "";
-                if (dto.IsPaySign != -1) {
-                    sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
-                }
+                sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
+            }
 
-                //雷怡 2024-5-8 15:14 新增View字段 CreateTime
-                string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
+            //雷怡 2024-5-8 15:14 新增View字段 CreateTime
+            string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
                                               ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
                                               From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
                                               Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
                                               Left Join Sys_Users as su On gdp.CreateUserId = su.Id
                                               Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
-                List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
-                if (_DecreasePayments.Count > 0)
-                {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
-                }
-                else
-                {
-                    result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
-                }
-            }
-            catch (Exception ex)
-            {
-                result = new Result() { Code = -2, Msg = ex.Message };
-            }
-            return result;
+            List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
+            
+            return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = _DecreasePayments };
         }
 
-        public async Task<Result> DecreasePaymentsSelect(DecreasePaymentsDto dto)
+        public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-
+            
             #region 团组下拉框
 
             List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
@@ -167,228 +143,213 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 supplier = _supplier,
                 supplierArea = _supplierArea
             };
-            return result = new Result() { Code = 0, Msg = "查询成功!", Data = data };
+            return  new JsonView() { Code = 200, Msg = MsgTips.Status, Data = data };
 
         }
 
-        public async Task<Result> OpDecreasePayments(DecreasePaymentsOpDto dto)
+        public async Task<JsonView> OpDecreasePayments(DecreasePaymentsOpDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
             BeginTran();
-            try
+            int id = 0;
+            Grp_DecreasePayments grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
+            //处理费用总计
+            if (grp_Decrease.FeeTotal == 0.00M)
             {
-                int id = 0;
-                Grp_DecreasePayments grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
-                //处理费用总计
-                if (grp_Decrease.FeeTotal == 0.00M)
+                grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
+            }
+
+            List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
+            if (dto.Status == 1)//添加
+            {
+                string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
+                                                , dto.PriceName, 0, dto.DiId);
+                var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
+                if (DecreasePayments != null)
                 {
-                    grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
+                    return new JsonView() { Code = 400, Msg = "该数据已存在,请勿重复添加!" };
                 }
-
-                List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
-                if (dto.Status == 1)//添加
+                else//不存在,可添加
                 {
-                    string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
-                                                    , dto.PriceName, 0, dto.DiId);
-                    var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
-                    if (DecreasePayments != null)
+                    id = await AddAsyncReturnId(grp_Decrease);
+                    if (id < 1)
                     {
-                        return new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
+                        RollbackTran();
+                        return new JsonView() { Code = 400, Msg = "添加失败!" };
                     }
-                    else//不存在,可添加
+
+                    //进行C表添加
+                    Grp_CreditCardPayment C = new Grp_CreditCardPayment();
+                    C.PayDId = dto.PayDId;
+                    C.ConsumptionPatterns = "";
+                    C.ConsumptionDate = "";
+                    C.CTDId = 0;
+                    C.BankNo = "";
+                    C.CardholderName = "";
+                    C.PayMoney = grp_Decrease.FeeTotal;
+                    C.PaymentCurrency = grp_Decrease.Currency;
+                    //当天汇率
+                    //if (!string.IsNullOrEmpty(hfRate.Value))
+                    //    C.DayRate = hfRate.Value;
+                    //else
+                    //C.DayRate = "";
+                    C.CompanyBankNo = "";
+                    C.OtherBankName = dto.OtherBankName;
+                    C.OtherSideNo = dto.OtherSideNo;
+                    C.OtherSideName = dto.OtherSideName;
+                    C.Remark = "";
+                    C.CreateUserId = grp_Decrease.CreateUserId;
+                    C.MFOperator = 0;
+                    C.MFOperatorDate = "";
+                    C.IsAuditDM = 0;
+                    C.AuditDMOperate = 0;
+                    C.AuditDMDate = "";
+                    C.IsAuditMF = 0;
+                    C.AuditMFOperate = 0;
+                    C.AuditMFDate = "";
+                    C.IsAuditGM = 0;
+                    C.AuditGMOperate = 21;
+                    C.AuditGMDate = "";
+
+                    if (C.PayDId == 72) C.IsPay = 1;
+                    else C.IsPay = 0;
+
+                    C.DIId = grp_Decrease.DiId;
+                    C.CId = id;
+                    C.CTable = 98;
+                    C.PayPercentage = 100;
+                    C.PayThenMoney = 0;
+                    C.PayPercentageOld = 0;
+                    C.PayThenMoneyOld = 0;
+                    C.UpdateDate = "";
+                    C.Payee = dto.SupplierName;
+                    C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
+                    C.ExceedBudget = 0;
+                    //C.RMBPrice = 0.00f;
+
+                    //设置该团组的汇率
+                    TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
+                    //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
+                    if (teamRate != null)
                     {
-                        id = await AddAsyncReturnId(grp_Decrease);
-                        if (id < 1)
+                        if (teamRate.CurrencyCode.Equals("CNY"))
                         {
-                            RollbackTran();
-                            return new Result() { Code = -1, Msg = "添加失败!" };
+                            C.DayRate = 1.0000M;
+                            C.RMBPrice = C.PayMoney;
+                        }
+                        else
+                        {
+                            C.DayRate = teamRate.Rate;
+                            C.RMBPrice = C.PayMoney * C.DayRate;
                         }
+                    }
+                    else
+                    {
+                        RollbackTran();
+                        return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
+                    }
+                    int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
+                    if (cId != 0)
+                    {
+                        CommitTran();
+
+                        var data = new { ccpId = cId, sign = 1 };
+                        return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
+                    }
+                    else
+                    {
+                        RollbackTran();
+                        return new JsonView() { Code = 400, Msg = "添加失败!" };
+                    }
 
-                        //进行C表添加
-                        Grp_CreditCardPayment C = new Grp_CreditCardPayment();
-                        C.PayDId = dto.PayDId;
-                        C.ConsumptionPatterns = "";
-                        C.ConsumptionDate = "";
-                        C.CTDId = 0;
-                        C.BankNo = "";
-                        C.CardholderName = "";
-                        C.PayMoney = grp_Decrease.FeeTotal;
-                        C.PaymentCurrency = grp_Decrease.Currency;
-                        //当天汇率
-                        //if (!string.IsNullOrEmpty(hfRate.Value))
-                        //    C.DayRate = hfRate.Value;
-                        //else
-                        //C.DayRate = "";
-                        C.CompanyBankNo = "";
-                        C.OtherBankName = "";
-                        C.OtherSideNo = "";
-                        C.OtherSideName = "";
-                        C.Remark = "";
-                        C.CreateUserId = grp_Decrease.CreateUserId;
-                        C.MFOperator = 0;
-                        C.MFOperatorDate = "";
-                        C.IsAuditDM = 0;
-                        C.AuditDMOperate = 0;
-                        C.AuditDMDate = "";
-                        C.IsAuditMF = 0;
-                        C.AuditMFOperate = 0;
-                        C.AuditMFDate = "";
-                        C.IsAuditGM = 0;
-                        C.AuditGMOperate = 21;
-                        C.AuditGMDate = "";
-
-                        if (C.PayDId == 72) C.IsPay = 1;
-                        else C.IsPay = 0;
-
-                        C.DIId = grp_Decrease.DiId;
-                        C.CId = id;
-                        C.CTable = 98;
-                        C.PayPercentage = 100;
-                        C.PayThenMoney = 0;
-                        C.PayPercentageOld = 0;
-                        C.PayThenMoneyOld = 0;
-                        C.UpdateDate = "";
-                        C.Payee = dto.SupplierName;
-                        C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
-                        C.ExceedBudget = 0;
-                        //C.RMBPrice = 0.00f;
+                }
 
+            }
+            else if (dto.Status == 2)
+            {
+                bool res = await UpdateAsync(a => a.Id == grp_Decrease.Id, a => new Grp_DecreasePayments
+                {
+                    DiId = grp_Decrease.DiId,
+                    SupplierArea = grp_Decrease.SupplierArea,
+                    SupplierTypeId = grp_Decrease.SupplierTypeId,
+                    SupplierName = grp_Decrease.SupplierName,
+                    SupplierContact = grp_Decrease.SupplierContact,
+                    SupplierContactNumber = grp_Decrease.SupplierContactNumber,
+                    SupplierSocialAccount = grp_Decrease.SupplierSocialAccount,
+                    SupplierEmail = grp_Decrease.SupplierEmail,
+                    SupplierAddress = grp_Decrease.SupplierAddress,
+                    PriceName = grp_Decrease.PriceName,
+                    Price = grp_Decrease.Price,
+                    Quantity = grp_Decrease.Quantity,
+                    FeeTotal = grp_Decrease.FeeTotal,
+                    Currency = grp_Decrease.Currency,
+                    FilePath = grp_Decrease.FilePath,
+                    Remark = grp_Decrease.Remark,
+                });
+                if (res)
+                {
+                    Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
+                    if (grp_CreditCardPayment != null)
+                    {
                         //设置该团组的汇率
                         TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
-                        //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
+
                         if (teamRate != null)
                         {
                             if (teamRate.CurrencyCode.Equals("CNY"))
                             {
-                                C.DayRate = 1.0000M;
-                                C.RMBPrice = C.PayMoney;
+                                grp_CreditCardPayment.DayRate = 1.0000M;
+                                grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
                             }
                             else
                             {
-                                C.DayRate = teamRate.Rate;
-                                C.RMBPrice = C.PayMoney * C.DayRate;
+                                grp_CreditCardPayment.DayRate = teamRate.Rate;
+                                grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
                             }
-                        }
-                        else
-                        {
-                            RollbackTran();
-                            return new Result() { Code = -1, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
-                        }
-                        int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
-                        if (cId != 0)
-                        {
-                            CommitTran();
 
-                            var data = new { ccpId = cId, sign = 1 };
-                            return new Result() { Code = 0, Msg = "添加成功!", Data = data };
                         }
                         else
                         {
                             RollbackTran();
-                            return new Result() { Code = -1, Msg = "添加失败!" };
+                            return new JsonView() { Code = 400, Msg = "修改失败!" };
                         }
 
-                    }
-
-                }
-                else if (dto.Status == 2)
-                {
-                    bool res = await UpdateAsync(a => a.Id == grp_Decrease.Id, a => new Grp_DecreasePayments
-                    {
-                        DiId = grp_Decrease.DiId,
-                        SupplierArea = grp_Decrease.SupplierArea,
-                        SupplierTypeId = grp_Decrease.SupplierTypeId,
-                        SupplierName = grp_Decrease.SupplierName,
-                        SupplierContact = grp_Decrease.SupplierContact,
-                        SupplierContactNumber = grp_Decrease.SupplierContactNumber,
-                        PriceName = grp_Decrease.PriceName,
-                        Price = grp_Decrease.Price,
-                        Quantity    = grp_Decrease.Quantity,
-                        FeeTotal = grp_Decrease.FeeTotal,
-                        Currency = grp_Decrease.Currency,
-                        FilePath = grp_Decrease.FilePath,
-                        Remark = grp_Decrease.Remark,
-                    });
-                    if (res)
-                    {
-                        Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
-                        if (grp_CreditCardPayment != null)
+                        int ispay = 0;
+                        if (dto.PayDId == 72) ispay = 1;
+
+
+                        int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                                    .Where(a => a.Id == grp_CreditCardPayment.Id)
+                                                    .SetColumns(a => new Grp_CreditCardPayment
+                                                    {
+                                                        OtherSideName = dto.OtherSideName,
+                                                        OtherSideNo = dto.OtherSideNo,
+                                                        OtherBankName = dto.OtherBankName,
+                                                        PayDId = dto.PayDId,
+                                                        IsPay = ispay,
+                                                        PayMoney = grp_Decrease.FeeTotal,
+                                                        PaymentCurrency = grp_Decrease.Currency,
+                                                        Payee = dto.SupplierName,
+                                                        OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
+                                                        DayRate = grp_CreditCardPayment.DayRate,
+                                                        RMBPrice = grp_CreditCardPayment.RMBPrice,
+
+                                                    }).ExecuteCommandAsync();
+                        if (CTable > 0)
                         {
-                            //设置该团组的汇率
-                            TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
-
-                            if (teamRate != null)
-                            {
-                                if (teamRate.CurrencyCode.Equals("CNY"))
-                                {
-                                    grp_CreditCardPayment.DayRate = 1.0000M;
-                                    grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
-                                }
-                                else
-                                {
-                                    grp_CreditCardPayment.DayRate = teamRate.Rate;
-                                    grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
-                                }
-
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                return new Result() { Code = -1, Msg = "修改失败!" };
-                            }
-
-                            int ispay = 0;
-                            if (dto.PayDId == 72) ispay = 1;
-
-
-                            int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                                                        .Where(a => a.Id == grp_CreditCardPayment.Id)
-                                                        .SetColumns(a => new Grp_CreditCardPayment
-                                                        {
-                                                            PayDId = dto.PayDId,
-                                                            IsPay = ispay,
-                                                            PayMoney = grp_Decrease.FeeTotal,
-                                                            PaymentCurrency = grp_Decrease.Currency,
-                                                            Payee = dto.SupplierName,
-                                                            OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
-                                                            DayRate = grp_CreditCardPayment.DayRate,
-                                                            RMBPrice = grp_CreditCardPayment.RMBPrice,
-
-                                                        }).ExecuteCommandAsync();
-                            if (CTable > 0)
-                            {
-                                CommitTran();
+                            CommitTran();
 
-                                var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2 };
+                            var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2 };
 
-                                return new Result() { Code = 0, Msg = "修改成功!", Data = data };
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                return new Result() { Code = -1, Msg = "修改失败!" };
-                            }
+                            return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
                         }
-                        else
-                        {
-                            RollbackTran();
-                            return new Result() { Code = -1, Msg = "修改失败!" };
-                        }
-                    }
-                    else
-                    {
-                        RollbackTran();
-                        return new Result() { Code = -1, Msg = "修改失败!" };
                     }
                 }
 
-            }
-            catch (Exception ex)
-            {
                 RollbackTran();
-                return new Result() { Code = -2, Msg = ex.Message };
+                return new JsonView() { Code = 400, Msg = "修改失败!" };
             }
-            return result;
+            RollbackTran();
+            return new JsonView() { Code = 400, Msg = MsgTips.Fail }; ;
         }
 
         public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
@@ -467,7 +428,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// <param name="dto"></param>
         /// <returns></returns>
         /// <exception cref="NotImplementedException"></exception>
-        public async Task<Result> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
+        public async Task<JsonView> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
         {
             string sql = string.Format($@"Select 
 											dp.Id,
@@ -477,6 +438,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
 											dp.SupplierName,
 											dp.SupplierContact,
 											dp.SupplierContactNumber,
+											dp.SupplierSocialAccount,
+											dp.SupplierEmail,
+											dp.SupplierAddress,
 											dp.PriceName,
 											dp.Price,
 											dp.Quantity,
@@ -485,14 +449,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
 											dp.FilePath,
 											dp.Remark,
 											ccp.PayDId,
-											ccp.OrbitalPrivateTransfer
+											ccp.OrbitalPrivateTransfer,
+											ccp.OtherBankName,
+											ccp.OtherSideName,
+											ccp.OtherSideNo,
+                                            ccp.IsAuditGM
 										From Grp_DecreasePayments dp With(NoLock)
 										Left Join Grp_CreditCardPayment ccp With(NoLock) On dp.Id = ccp.CId And dp.DiId = ccp.DIId And ccp.CTable = 98
-										Where dp.IsDel = 0  And dp.Id = {dto.Id}");
+										Where dp.IsDel = 0 And dp.Id = {dto.Id}");
 
             var info = await _sqlSugar.SqlQueryable<DecreasePaymentsInfoView>(sql).FirstAsync();
 
-            return new Result() { Code = 0, Msg = "查询成功!", Data = info };
+            return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = info };
         }
 
         /// <summary>

+ 75 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -902,6 +902,81 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
+        //PostGroupNameScreen
+
+        /// <summary>
+        /// 获取接团名称 Page List
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GetGroupNameList(int portType,int pageIndex,int pageSize, string groupName,int userId)
+        {
+            var _res = new JsonView() {  Code = 400 ,  Msg = MsgTips.Fail };
+            string sql = "";
+            string sqlWhere = "";
+            string mobileSqlWhere = "";
+            if (!string.IsNullOrEmpty(groupName))
+            {
+                sqlWhere += string.Format($@"And TeamName Like '%{groupName}%'");
+                mobileSqlWhere += string.Format($@"GroupName Like '%{groupName}%'");
+            }
+
+            List<int> userIds = new List<int>() { -1, 21 };
+
+            if (!userIds.Contains(userId))
+            {
+                sqlWhere += string.Format($@"And JietuanOperator = {userId}");
+            }
+
+
+            sql = string.Format($@"Select ROW_NUMBER()Over(Order By Id Desc) as RowNumber,Id,TeamName GroupName From  Grp_DelegationInfo 
+                                             Where IsDel = 0 {sqlWhere}");
+
+            if (portType == 1) //web
+            { }
+            else if (portType == 2 || portType == 3)
+            {
+                //国交部 7 (主管 22,经理 32)团操操作权限  市场部 6 接团人
+                var userInfo = await _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == userId && it.IsDel == 0).FirstAsync();
+
+                if (userInfo != null)
+                {
+                    if (userInfo.DepId == 7)
+                    {
+                        if (userInfo.JobPostId != 22 || userInfo.JobPostId != 32)
+                        {
+                            if (!string.IsNullOrEmpty(mobileSqlWhere)) mobileSqlWhere = $" Where {mobileSqlWhere}";
+                            sql = string.Format($@"Select 
+											ROW_NUMBER()Over(Order By Id Desc) as RowNumber, 
+											Id,
+											GroupName
+										From (
+											Select 
+												  distinct 
+                                                  di.Id,
+												  di.TeamName GroupName 
+											From Grp_GroupsTaskAssignment gta With(NoLock)
+											Inner Join Grp_DelegationInfo di With(NoLock) On gta.DIId = di.Id 
+											Where gta.IsDel = 0 And di.IsDel = 0 And gta.UId = {userId}
+										) Temp {mobileSqlWhere}");
+                        }
+                    }
+                }
+            }
+
+            RefAsync<int> total = 0;
+            var groupNamePageData = await _sqlSugar.SqlQueryable<GroupNamePageView>(sql).ToPageListAsync(pageIndex, pageSize, total);
+
+            _res.Code = 200;
+            _res.Data = groupNamePageData;
+            _res.Msg = MsgTips.Succeed;
+            _res.Count = total;
+
+
+            return _res;
+        }
+
+
         /// <summary>
         /// 获取接团名称List And 签证国别
         /// </summary>

+ 100 - 101
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -287,126 +287,125 @@ Order By i.id  Desc ", sqlWhere);
                 Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
                 if (dto.Status == 1)//添加
                 {
-                    string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
-                                                    , dto.InviterArea, dto.Inviter, dto.DiId, 0);
-                    var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
-                    if (_InvitationOfficialActivities != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
-                    }
-                    else
+                    //string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
+                    //                                , dto.InviterArea, dto.Inviter, dto.DiId, 0);
+                    //var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
+                    //if (_InvitationOfficialActivities != null)
+                    //{
+                    //    return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
+                    //}
+
+                    id = await AddAsyncReturnId(grp_Invitation);
+                    if (id != 0)//修改或添加商邀资料
                     {
-                        id = await AddAsyncReturnId(grp_Invitation);
-                        if (id != 0)//修改或添加商邀资料
+                        Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+                        res_InvitationData.Country = dto.InviterArea;
+                        res_InvitationData.UnitName = dto.Inviter;
+                        res_InvitationData.Delegation = dto.DiId.ToString();
+                        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);
+                        if (ifNullUp == null)///添加或修改商邀资料
                         {
-                            Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
-                            res_InvitationData.Country = dto.InviterArea;
-                            res_InvitationData.UnitName = dto.Inviter;
-                            res_InvitationData.Delegation = dto.DiId.ToString();
-                            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);
-                            if (ifNullUp == null)///添加或修改商邀资料
+                            res_InvitationData.Remark = dto.OtherInformation;
+                            int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                            if (DataID != 0)
                             {
-                                res_InvitationData.Remark = dto.OtherInformation;
-                                int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                                if (DataID != 0)
-                                {
-                                    result = new Result() { Code = 0, Msg = "添加成功!" };
-                                }
-                                else
-                                {
-                                    RollbackTran();
-                                    result = new Result() { Code = -1, Msg = "添加失败!" };
-                                }
-
+                                result = new Result() { Code = 0, Msg = "添加成功!" };
                             }
                             else
                             {
-                                int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
-                                {
-                                    Contact = dto.Contact,
-                                    Tel = dto.Tel,
-                                    Email = dto.Email,
-                                    Fax = dto.Fax,
-                                    Address = dto.Address,
-                                    Remark = dto.OtherInformation,
-                                }).ExecuteCommandAsync();
+                                RollbackTran();
+                                result = new Result() { Code = -1, Msg = "添加失败!" };
                             }
 
-                            Grp_CreditCardPayment C = new Grp_CreditCardPayment();
-                            C.PayDId = dto.PayDId;
-                            if (C.PayDId == 72) C.IsPay = 1;
-                            else C.IsPay = 0;
+                        }
+                        else
+                        {
+                            int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
+                            {
+                                Contact = dto.Contact,
+                                Tel = dto.Tel,
+                                Email = dto.Email,
+                                Fax = dto.Fax,
+                                Address = dto.Address,
+                                Remark = dto.OtherInformation,
+                            }).ExecuteCommandAsync();
+                        }
 
-                            C.ConsumptionPatterns = dto.ConsumptionPatterns;
-                            C.ConsumptionDate = dto.ConsumptionDate;
-                            C.CTDId = dto.CTDId;
-                            C.BankNo = dto.BankNo;
-                            C.CardholderName = dto.CardholderName;
-                            C.PayMoney = dto.PayMoney;
-                            C.PaymentCurrency = dto.PaymentCurrency;
-                            C.CompanyBankNo = dto.CompanyBankNo;
-                            C.OtherBankName = dto.OtherBankName;
-                            C.OtherSideNo = dto.OtherSideNo;
-                            C.OtherSideName = dto.OtherSideName;
-                            C.Remark = "";
-                            C.CreateUserId = dto.CreateUserId;
-                            C.MFOperator = 0;
-                            C.MFOperatorDate = "";
-                            C.IsAuditDM = 0;
-                            C.AuditDMOperate = 0;
-                            C.AuditDMDate = "";
-                            C.IsAuditMF = 0;
-                            C.AuditMFOperate = 0;
-                            C.AuditMFDate = "";
-                            C.IsAuditGM = 0;
-                            C.AuditGMOperate = 0;
-                            C.AuditGMDate = "";
-                            //C.IsPay = 0;
-                            C.DIId = dto.DiId;
-                            C.CId = id;
-                            C.CTable = 81;
-                            C.PayPercentage = 100;
-                            C.PayThenMoney = 0;
-                            C.PayPercentageOld = 0;
-                            C.PayThenMoneyOld = 0;
-                            C.UpdateDate = "";
-                            C.Payee = dto.Payee;
-                            C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
-                            C.ExceedBudget = 0;
+                        Grp_CreditCardPayment C = new Grp_CreditCardPayment();
+                        C.PayDId = dto.PayDId;
+                        if (C.PayDId == 72) C.IsPay = 1;
+                        else C.IsPay = 0;
 
-                            //获取新汇率  int diId,int CId, int currencyId
-                            var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
+                        C.ConsumptionPatterns = dto.ConsumptionPatterns;
+                        C.ConsumptionDate = dto.ConsumptionDate;
+                        C.CTDId = dto.CTDId;
+                        C.BankNo = dto.BankNo;
+                        C.CardholderName = dto.CardholderName;
+                        C.PayMoney = dto.PayMoney;
+                        C.PaymentCurrency = dto.PaymentCurrency;
+                        C.CompanyBankNo = dto.CompanyBankNo;
+                        C.OtherBankName = dto.OtherBankName;
+                        C.OtherSideNo = dto.OtherSideNo;
+                        C.OtherSideName = dto.OtherSideName;
+                        C.Remark = "";
+                        C.CreateUserId = dto.CreateUserId;
+                        C.MFOperator = 0;
+                        C.MFOperatorDate = "";
+                        C.IsAuditDM = 0;
+                        C.AuditDMOperate = 0;
+                        C.AuditDMDate = "";
+                        C.IsAuditMF = 0;
+                        C.AuditMFOperate = 0;
+                        C.AuditMFDate = "";
+                        C.IsAuditGM = 0;
+                        C.AuditGMOperate = 0;
+                        C.AuditGMDate = "";
+                        //C.IsPay = 0;
+                        C.DIId = dto.DiId;
+                        C.CId = id;
+                        C.CTable = 81;
+                        C.PayPercentage = 100;
+                        C.PayThenMoney = 0;
+                        C.PayPercentageOld = 0;
+                        C.PayThenMoneyOld = 0;
+                        C.UpdateDate = "";
+                        C.Payee = dto.Payee;
+                        C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
+                        C.ExceedBudget = 0;
 
-                            if (rate.Code == 0)
-                            {
-                                var rateInfo = (rate.Data as CurrencyInfo);
-                                if (rateInfo is not null)
-                                {
+                        //获取新汇率  int diId,int CId, int currencyId
+                        var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
 
-                                    C.DayRate = rateInfo.Rate;
-                                    C.RMBPrice = rateInfo.Rate * C.PayMoney;
-                                }
-                                else
-                                {
-                                    C.DayRate = 1;
-                                    C.RMBPrice = C.PayMoney;
-                                }
-                            }
-
-                            int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
-                            var data = new { ccpId = cId, sign = 1 };
-                            if (cId != 0)
+                        if (rate.Code == 0)
+                        {
+                            var rateInfo = (rate.Data as CurrencyInfo);
+                            if (rateInfo is not null)
                             {
-                                result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+
+                                C.DayRate = rateInfo.Rate;
+                                C.RMBPrice = rateInfo.Rate * C.PayMoney;
                             }
                             else
                             {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
+                                C.DayRate = 1;
+                                C.RMBPrice = C.PayMoney;
                             }
                         }
+
+                        int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
+                        var data = new { ccpId = cId, sign = 1 };
+                        if (cId != 0)
+                        {
+                            result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+                        }
+                        else
+                        {
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
+                        }
                     }
+                    
                 }
                 else//修改
                 {