Explorar o código

三公费用 汇率预警提示调整

Lyyyi hai 15 horas
pai
achega
a4f189c009

+ 2 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -8691,6 +8691,7 @@ FROM
             try
             {
                 var rateRecords = new List<RateRecordInfo>();
+
                 #region 汇率保存前存储
                 var info = await _sqlSugar.Queryable<Grp_EnterExitCost>().FirstAsync(x => x.IsDel == 0 && x.DiId == dto.DiId);
                 if (info != null)
@@ -8810,10 +8811,9 @@ FROM
                 {
                     //消息推送
                     await AppNoticeLibrary.SendUserMsg_GroupShare_ToFin(dto.DiId, dto.UserId, msgContent);
-
                 }
 
-                #region //日志汇率记录
+                #region 日志汇率记录
 
                 //按照已使用币种记录
                 if (checkCurrencys != null && checkCurrencys.Count > 0)

+ 23 - 23
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -4285,6 +4285,16 @@ namespace OASystem.API.OAMethodLib
 
         #region 汇率
 
+        /// <summary>
+        /// 三公费用实时汇率调差
+        /// </summary>
+        private readonly static decimal _xchgRateAdj = 0.00M;
+
+        /// <summary>
+        /// 三公费用实时汇率上浮比例
+        /// </summary>
+        private readonly static decimal _fxRateRise = 1.0350M;
+
         /// <summary>
         /// 出入境费用 初始化汇率
         /// </summary>
@@ -4310,13 +4320,9 @@ namespace OASystem.API.OAMethodLib
                     if (rateInfo != null)
                     {
                         decimal rate1 = Convert.ToDecimal(rateInfo.FSellPri) / 100.00M;
+                        rate1 *= _fxRateRise;
 
-                        //if (rateInfo.Name.Equals("日元")) rate1 *= 1.3700M; //rate1 = rate1 * 1;
-                        //else rate1 *= 1.035M;
-
-                        rate1 *= 1.035M;
-
-                        item.Rate = rate1.TruncDecimals(4) + 0.01M;
+                        item.Rate = rate1.TruncDecimals(4) + _xchgRateAdj;
                     }
                 }
             }
@@ -4350,13 +4356,7 @@ namespace OASystem.API.OAMethodLib
                     {
                         item.Rate = Convert.ToDecimal((Convert.ToDecimal(rateInfo.FSellPri == null ? 0.00M : rateInfo.FSellPri) / 100.00M).ToString("#0.0000"));
 
-                        //currency == usd  上浮比例 1.0300
-                        decimal increaseRate = 1.0350M;
-
-                        //if (item.CurrencyCode.ToUpper().equals("USD")) increaseRate = 1.0300M;
-
-                        decimal rate1 = item.Rate * increaseRate;
-                        //rate1 += 0.01M;
+                        decimal rate1 = item.Rate * _fxRateRise + _xchgRateAdj;
 
                         reteInfos.Add(new
                         {
@@ -4409,7 +4409,7 @@ namespace OASystem.API.OAMethodLib
 
             var cacheRateInfos = CommonFun.GetCurrencyChinaToList(info.CurrencyRemark);
 
-            var isSendMsg = false;
+            var isSendMsg = true;
             var msgContent = new StringBuilder();
 
             //去掉费用未使用得币种
@@ -4420,19 +4420,20 @@ namespace OASystem.API.OAMethodLib
 
             if (cacheRateInfos.Any())
             {
-                decimal rowthRate = 1.0350M;
+                decimal rowthRate = _fxRateRise;
                 foreach (var cacheRate in cacheRateInfos)
                 {
                     var liveRate = liveRates.Find(x => x.CurrencyName.Equals(cacheRate.CurrencyName));
                     if (liveRate == null) continue;
 
-                    var currRate = (rowthRate * liveRate.Rate).TruncDecimals(4);
-                    if (cacheRate.Rate != currRate)
-                    {
-                        isSendMsg = true;
+                    var currRate = (rowthRate * liveRate.Rate).TruncDecimals(4) + _xchgRateAdj;
+
+                    //if (cacheRate.Rate != currRate)
+                    //{
+                    //    isSendMsg = true;
                         //>团组归属:<font color='info'>{groupName}</font>
                         msgContent.AppendLine($">- {cacheRate.CurrencyName}汇率(页面保存):{cacheRate.Rate:#0.0000}  / 实时汇率(接口保存,已上浮1.0350):{currRate:#0.0000}【原接口输出汇率为:{liveRate.Rate:#0.0000}】");
-                    }
+                    //}
                 }
                 return (isSendMsg, msgContent.ToString(), liveRates);
             }
@@ -4514,7 +4515,7 @@ namespace OASystem.API.OAMethodLib
                 List<Grp_DayAndCost> dac4 = dayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
 
                 var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
-                var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
+                var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == dto.DiId).First();
                 var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
                                                       .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
                                                       .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
@@ -4533,8 +4534,7 @@ namespace OASystem.API.OAMethodLib
                 var placeData = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
                 var rateDatas = await enterExitCosts.CurrencyRemark.SplitExchangeRate();
 
-
-                _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+                _DelegationInfo.VisitCountry = _DelegationInfo?.VisitCountry?.Replace("|", "、") ?? "";
 
                 if (dto.ExportType == 1) //明细表
                 {

+ 4 - 4
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -905,7 +905,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
         /// <returns></returns>
         public static async Task<bool> SendUserMsg_GroupShare_ToFin(int diId, int operationId, string msgContent)
         {
-            Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+            var groupInfo = _grpDeleRep._sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == diId);
 
             var operationName = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.Id == operationId).First()?.CnName ?? "Unknown";
 
@@ -922,10 +922,10 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 >**汇率明细**   
 {1}
 
->操作人员:<font color='comment'>{2}</font> l
+>操作人员:<font color='comment'>{2}</font> 
 >操作时间:<font color='comment'>{3}</font> 
 
-[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)   ", groupInfo.TeamName, msgContent, operationName, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
+[详细信息请前往OA系统查看](http://oa.pan-american-intl.com:4399/)   ", groupInfo?.TeamName ?? "-", msgContent, operationName, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
 
 
                 ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, resMsg);
@@ -959,7 +959,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             GroupShare_ToGMModel info = new GroupShare_ToGMModel()
             {
                 RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
-                TeamName = groupInfo.TeamName,
+                TeamName = groupInfo?.TeamName ?? "-",
                 CreateUser = _grpDeleRep.Query<Sys_Users>(s => s.Id == updateUserId).First()?.CnName ?? "-",
                 Url = url
             };