Commit f9417b04 by DESKTOP-732ATD8\BLT

Merge branch 'master' into webapi

parents baa1b2ff c52a0d6d
......@@ -847,7 +847,7 @@ or (is_lend=2 and cost_form=1)) and pay_time>= @start and pay_time< @end ");
public List<PlatformTypeMonthlyStatisticsDto> GetGetMonthProfitFeePlatformFeeSummary(GetMonthProfitPlatformDetailInput input)
{
var sql = BuildMonthProfitFeePlatformFeeDetailSql(input, out DynamicParameters param, false, true);
var data = SimpleCRUD.Query<PlatformTypeMonthlyStatisticsDto>(sql, param, GlobalConfig.ConnectionString_DW).ToList();
var data = SimpleCRUD.Query<PlatformTypeMonthlyStatisticsDto>(sql, param, GlobalConfig.ConnectionString_DW).ToList();
List<ReversalDto> listReversal = SimpleCRUD.Query<ReversalDto>("SELECT DISTINCT platform, website FROM order_fee_config WHERE is_reversal = 1;", null, GlobalConfig.ConnectionString_DW).ToList();
if (input.FeeName.Contains("仓储费-平台"))
{
......@@ -982,6 +982,7 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month ");
{
var sql = BuildMonthProfitFeePlatformFeeDetailSql(input, out DynamicParameters parameters, false, false);
var data = SimpleCRUD.Query<MonthPlatformProfitDto>(sql, parameters, GlobalConfig.ConnectionString_DW).ToList();
List<ReversalDto> listReversal = SimpleCRUD.Query<ReversalDto>("SELECT DISTINCT platform, website FROM order_fee_config WHERE is_reversal = 1;", null, GlobalConfig.ConnectionString_DW).ToList();
if (input.FeeName.Contains("仓储费-平台"))
{
data = data.Select(x =>
......@@ -1022,20 +1023,13 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month ");
{
data.Remove(data.Where(x => x.PlatForm == "亚马逊" && x.WebSite.ToLower() == "mx" && x.AmountVal < 0).FirstOrDefault());
}
data = data.Select(x =>
if (listReversal?.Count > 0 && data?.Count > 0)
{
if (x.PlatForm.Contains("万邑通") || x.PlatForm.Contains("速卖通"))
{
x.AmountVal = Math.Abs(x.AmountVal.Value);
x.AmountValRmb = Math.Abs(x.AmountValRmb.Value);
}
if (x.PlatForm.Contains("易可达") && x.WebSite.Contains("其他收入"))
listReversal.ForEach(l =>
{
x.AmountVal = Math.Abs(x.AmountVal.Value) * -1;
x.AmountValRmb = Math.Abs(x.AmountValRmb.Value) * -1;
}
return x;
}).ToList();
data.ForEach(x => { if (l.platform == x.PlatForm && l.website == x.WebSite) { x.AmountVal = 0 - x.AmountVal; x.AmountValRmb = 0 - x.AmountValRmb; } });
});
}
return data;
}
public decimal SyncMonthProfitFeePlatformFeeSummary(GetMonthProfitPlatformDetailInput input)
......@@ -1049,6 +1043,7 @@ WHERE s1.amountval != 0 AND s1.month = @month
AND s2.datacenter_col like '%{input.FeeName}' group by s2.platform,s1.website ";
parameters.Add("month", input.Month);
var data = SimpleCRUD.Query<(string platform, string site, decimal total)>(sql, parameters, GlobalConfig.ConnectionString_DW).ToList();
List<ReversalDto> listReversal = SimpleCRUD.Query<ReversalDto>("SELECT DISTINCT platform, website FROM order_fee_config WHERE is_reversal = 1;", null, GlobalConfig.ConnectionString_DW).ToList();
//2021-09-22张滢萍提出需求:仓储费-平台的wish改负数、广告及宣传费的Dhgate,Etsy,shopify改负数、尾程物流费-平台的lazada改负数
if (input.FeeName.Contains("仓储费-平台"))
{
......@@ -1083,6 +1078,13 @@ AND s2.datacenter_col like '%{input.FeeName}' group by s2.platform,s1.website ";
return x;
}).ToList();
}
if (listReversal?.Count > 0 && data?.Count > 0)
{
listReversal.ForEach(l =>
{
data.ForEach(x => { if (l.platform == x.platform && l.website == x.site) { x.total = 0 - x.total; } });
});
}
//其他
data = data.Select(x =>
......@@ -1173,7 +1175,7 @@ AND s2.datacenter_col like '%{input.FeeName}' group by s2.platform,s1.website ";
sql.Append(@"select platform_type AS Platform,SUM(amount_refund_rmb) AS RefundRmb,
SUM(amount_refund_usd) AS RefundUsd,Count(*) AS Totals
from dc_base_crm_refund
where refund_time >= @start and refund_time < @end
where refund_time >= @start and refund_time < @end and shipping_status = 'TotalShipping' AND is_deleted = 0 AND is_freeze = 0 AND company_id = 1
group by platform_type ");
parameters.Add("start", start);
parameters.Add("end", end);
......@@ -1183,14 +1185,14 @@ group by platform_type ");
{
sql.Append($@"
select sum(t1.amount_refund_rmb) AS RefundRmb,sum(t1.amount_refund_usd) AS RefundUsd from dc_base_crm_refund t1
where t1.refund_time >= @start and t1.refund_time < @end ");
where t1.refund_time >= @start and t1.refund_time < @end and shipping_status = 'TotalShipping' AND is_deleted = 0 AND is_freeze = 0 AND company_id = 1");
}
else
{
sql.Append($@"
select t1.platform_type AS PlatformType, t1.bailun_account AS BailunAccount, t1.website AS WebSite,
t1.origin_order_id AS OriginOrderId, t1.amount_refund_rmb AS RefundRmb, t1.amount_refund_usd AS RefundUsd, t1.refund_time AS RefundTime from dc_base_crm_refund t1
where t1.refund_time >= @start and t1.refund_time < @end ");
where t1.refund_time >= @start and t1.refund_time < @end and shipping_status = 'TotalShipping' AND is_deleted = 0 AND is_freeze = 0 AND company_id = 1");
}
parameters.Add("start", start);
parameters.Add("end", end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment