Bladeren bron

Merge branch 'master' into 20240912-空派国际快递收货调整

lzk 1 maand geleden
bovenliggende
commit
6244e49405

+ 2 - 1
1.Command/XYY.Core.Standard/AliYun/AliYunPostFileService.cs

@@ -167,7 +167,8 @@ namespace XYY.Core.Standard.AliYun
         /// <returns></returns>
         public string GetPublicCDN(string fileName)
         {
-            string endPoint = "http://label3.oss-cn-guangzhou-internal.aliyuncs.com/";
+            string endPoint = _aliYunConfig.CDNEndPoint;
+
             return GetCDN(fileName, endPoint).Replace("-internal", "");
 
         }

+ 56 - 40
2.Data/XYY.Model.Standard.Finance.Charging/XYY.Model.Standard.Finance.Charging/FeeFormula/FormulaService.cs

@@ -4,6 +4,7 @@ using StackExchange.Redis;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection.Emit;
 using System.Threading;
 using System.Threading.Tasks;
 using XYY.Core.Standard.Data.Infrastructure;
@@ -44,57 +45,30 @@ namespace XYY.Service.Standard.Finance.Charging.FeeFormula
         public async Task<ApiJsonModel> Charges(ExpressFeechargesModel t)
         {
             ThreadPool.SetMinThreads(200, 200);
-            if (t.PublicExpressId != 48 && t.PublicExpressId != 50)
+            if (t.PublicExpressId != 48 && t.PublicExpressId != 50 && t.PublicExpressId != 607)
             {
-                string formulaTrim = "";
-                //取计费公式
-                FormulaBase formulaBase = new FormulaBase(t.TransactionTime, t.CustomerId, t.PublicExpressId, null);
-                var set = await db.SortedSetRangeByScoreAsync(formulaBase.Key, 0, formulaBase.DateTimeVersion, order: Order.Descending, take: 1);
-                if (set.Length == 0)
-                    return ApiJsonModel.OK();
-                string formula = set[0];
-                //格式清理,只读取需要的值
-                formulaTrim =
-                  formula.Replace("@", "").Replace("原价", "").Replace("(", "").Replace(")", "").Replace("*", " ").Replace("+", " ").Replace("-", " ").Replace("/", "");
-
-
-
-
-                Dictionary<string, decimal> otherList = new Dictionary<string, decimal>();
-                foreach (var item in formulaTrim.Split(' ', StringSplitOptions.RemoveEmptyEntries))
-                {
-                    var otherBath = new OtherBase(t.TransactionTime, t.PublicExpressId, t.CustomerId, item, 0);
-                    var otherSet = await db.SortedSetRangeByScoreAsync(otherBath.Key, 0, formulaBase.DateTimeVersion, order: Order.Descending, take: 1);
-                    if (otherSet.Length == 0)
-                        return ApiJsonModel.OK();
-
-                    string v = otherSet[0];
-                    decimal d = decimal.Parse(v.Split(",")[1]);
-
-                    otherList.Add(item, d);
-                }
-                foreach (var item in otherList)
-                {
-                    //替换公式
-                    formula = formula.Replace(item.Key, item.Value.ToString());
-                }
-                formula = formula.Replace("原价", t.AmountinOriginalCurrency.ToString()).Replace("@", "");
-                //计算公式值
-                decimal fee = Convert.ToDecimal(new Expression(formula).Evaluate());
-                t.SettlementAmount = fee;
-                t.AmountinOriginalCurrency = fee;
-                return ApiJsonModel.OK();
+                return await SetBaseFee(t);
             }
             else
             {
 
                 if (t.CustomerId != 683)
                 {
+                    int publicExpressid = t.PublicExpressId;
+                    if (t.CountryCode != "US" && t.PublicExpressId == 607 && t.IsChargeBranchCompany)
+                    {
+                        publicExpressid = 50;
+                    }
+                    else if (t.CountryCode == "US" && t.PublicExpressId == 607)
+                    {
+                        return await SetBaseFee(t);
+                    }
+
 
                     //FEDEX和DHL写死,不要读来读去了
                     decimal otherFee = (_unitOfWork.Connection.QuerySingle<decimal>("select top 1 Price from Logistics_Fee_Other(nolock)  " +
                         "where  ExpressId = @PubicExpressId AND CustomerId =0 and feetype=2  AND EffectiveDate <= @EffectiveDate  order by  EffectiveDate DESC  ",
-                         new { PubicExpressId = t.PublicExpressId, EffectiveDate = t.TransactionTime }
+                         new { PubicExpressId = publicExpressid, EffectiveDate = t.TransactionTime }
                     ));
                     t.SettlementAmount = t.AmountinOriginalCurrency * (1 + otherFee);
                     t.AmountinOriginalCurrency = t.SettlementAmount;
@@ -107,6 +81,48 @@ namespace XYY.Service.Standard.Finance.Charging.FeeFormula
             }
         }
 
+        private async Task<ApiJsonModel> SetBaseFee(ExpressFeechargesModel t)
+        {
+        A:
+            string formulaTrim = "";
+            //取计费公式
+            FormulaBase formulaBase = new FormulaBase(t.TransactionTime, t.CustomerId, t.PublicExpressId, null);
+            var set = await db.SortedSetRangeByScoreAsync(formulaBase.Key, 0, formulaBase.DateTimeVersion, order: Order.Descending, take: 1);
+            if (set.Length == 0)
+                return ApiJsonModel.OK();
+            string formula = set[0];
+            //格式清理,只读取需要的值
+            formulaTrim =
+              formula.Replace("@", "").Replace("原价", "").Replace("(", "").Replace(")", "").Replace("*", " ").Replace("+", " ").Replace("-", " ").Replace("/", "");
+
+
+
+
+            Dictionary<string, decimal> otherList = new Dictionary<string, decimal>();
+            foreach (var item in formulaTrim.Split(' ', StringSplitOptions.RemoveEmptyEntries))
+            {
+                var otherBath = new OtherBase(t.TransactionTime, t.PublicExpressId, t.CustomerId, item, 0);
+                var otherSet = await db.SortedSetRangeByScoreAsync(otherBath.Key, 0, formulaBase.DateTimeVersion, order: Order.Descending, take: 1);
+                if (otherSet.Length == 0)
+                    return ApiJsonModel.OK();
+
+                string v = otherSet[0];
+                decimal d = decimal.Parse(v.Split(",")[1]);
+
+                otherList.Add(item, d);
+            }
+            foreach (var item in otherList)
+            {
+                //替换公式
+                formula = formula.Replace(item.Key, item.Value.ToString());
+            }
+            formula = formula.Replace("原价", t.AmountinOriginalCurrency.ToString()).Replace("@", "");
+            //计算公式值
+            decimal fee = Convert.ToDecimal(new Expression(formula).Evaluate());
+            t.SettlementAmount = fee;
+            t.AmountinOriginalCurrency = fee;
+            return ApiJsonModel.OK();
+        }
 
         public async Task<ApiJsonModel> LoadFormula(int expressId = 0, int customerId = 0)
         {

+ 2 - 1
XYY.sln

@@ -121,7 +121,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XYY.Service.Strandard.EMail
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XYY.Service.Standard.TencentCloud", "XYY.Service.Standard.TencentCloud\XYY.Service.Standard.TencentCloud.csproj", "{1A4325DA-80E3-495A-9E19-9F476ABE0A9B}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XYY.Service.JobManage", "XYY.Service.JobManage\XYY.Service.JobManage.csproj", "{1567AADC-5716-4E56-9CEA-2010B557D1A1}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XYY.Service.JobManage", "XYY.Service.JobManage\XYY.Service.JobManage.csproj", "{1567AADC-5716-4E56-9CEA-2010B557D1A1}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -361,6 +361,7 @@ Global
 		{CA791D42-C3AD-42CC-97B9-A1549369BE58} = {EC532B78-A040-4F6D-9C60-22CD137A9798}
 		{52E7CA01-6798-4011-AA4D-3E7B51458A5D} = {EC532B78-A040-4F6D-9C60-22CD137A9798}
 		{B68B323E-F82A-4DAA-B454-F26894EBBD66} = {EC532B78-A040-4F6D-9C60-22CD137A9798}
+		{B1AA2A6A-1C24-42C0-91E9-91C18A190D2D} = {EC532B78-A040-4F6D-9C60-22CD137A9798}
 		{4D5AB3DC-4C81-47A1-A12D-5189D45497A7} = {B1AA2A6A-1C24-42C0-91E9-91C18A190D2D}
 		{D8EC1F57-76F0-4553-AEC8-54ACFA06BDF6} = {A5F2FECF-EE7C-492E-AF2A-BB9805440EAB}
 		{9F0FA584-F6F9-4ECA-B296-7561D729DCB0} = {A5F2FECF-EE7C-492E-AF2A-BB9805440EAB}