Commit a24d9551 authored by liudong1993's avatar liudong1993

Merge branch 'sdzq' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq-ld

parents b72776de c0dd4822
...@@ -80,6 +80,16 @@ namespace Mall.Model.Entity.User ...@@ -80,6 +80,16 @@ namespace Mall.Model.Entity.User
} }
/// <summary>
/// 保险收入费用
/// </summary>
public int? InsuranceTypeId
{
get;
set;
}
/// <summary> /// <summary>
/// 退款费用 /// 退款费用
/// </summary> /// </summary>
......
...@@ -188,7 +188,7 @@ namespace Mall.WindowsService.Module ...@@ -188,7 +188,7 @@ namespace Mall.WindowsService.Module
if (addFinance)//满足今天执行的条件查询间隔周期的订单 if (addFinance)//满足今天执行的条件查询间隔周期的订单
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat($@" SELECT a.*,b.OrderNo from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId builder.AppendFormat($@" SELECT a.*,b.OrderNo,b.OrderClassify from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId
where b.TenantId={item.TenantId} and b.MallBaseId={item.MallBaseId} and b.OrderSource!=6 and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')>= DATE_FORMAT('{startDate}','%y-%m-%d') where b.TenantId={item.TenantId} and b.MallBaseId={item.MallBaseId} and b.OrderSource!=6 and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')>= DATE_FORMAT('{startDate}','%y-%m-%d')
and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') AND b.OrderStatus IN (2, 3, 4, 5, 6) "); and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') AND b.OrderStatus IN (2, 3, 4, 5, 6) ");
// builder.AppendFormat($@" SELECT a.*,b.OrderNo from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId // builder.AppendFormat($@" SELECT a.*,b.OrderNo from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId
...@@ -239,35 +239,76 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -239,35 +239,76 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
{ {
if (orderGoodsItem.Final_Price > 0) if (orderGoodsItem.Final_Price > 0)
{ {
if (orderGoodsItem.OrderClassify == 1 && orderGoodsItem.CarType != GuideCarGoodsTypeEnum.Line)
{
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 1,
Final_Price = orderGoodsItem.Final_Price,
Number = 1,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id,
InsuranceMoney = orderGoodsItem.InsuranceMoney
};
result.Add(newOrderGoods);
}
else
{
var newOrderGoods = new RB_Goods_OrderDetail_Extend
{
FinanceType = 1,
Final_Price = orderGoodsItem.Final_Price,
Number = orderGoodsItem.Number,
FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id,
InsuranceMoney = orderGoodsItem.InsuranceMoney
};
result.Add(newOrderGoods);
}
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 1;
}
if (orderGoodsItem.FreightMoney.HasValue && orderGoodsItem.FreightMoney.Value > 0)
{
//var newOrderGoods = new RB_Goods_OrderDetail_Extend();
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 2;
var newOrderGoods = new RB_Goods_OrderDetail_Extend var newOrderGoods = new RB_Goods_OrderDetail_Extend
{ {
FinanceType = 1, FinanceType = 2,
Final_Price = orderGoodsItem.Final_Price, Final_Price = orderGoodsItem.Final_Price,
Number = 1, Number = 1,
FreightMoney = orderGoodsItem.FreightMoney, FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName, GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo, OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id Id = orderGoodsItem.Id,
InsuranceMoney = orderGoodsItem.InsuranceMoney
}; };
//newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 1;
result.Add(newOrderGoods); result.Add(newOrderGoods);
} }
if (orderGoodsItem.FreightMoney.HasValue && orderGoodsItem.FreightMoney.Value > 0)
if (orderGoodsItem.InsuranceMoney.HasValue && orderGoodsItem.InsuranceMoney.Value > 0)
{ {
//var newOrderGoods = new RB_Goods_OrderDetail_Extend(); //var newOrderGoods = new RB_Goods_OrderDetail_Extend();
//newOrderGoods = orderGoodsItem; //newOrderGoods = orderGoodsItem;
//newOrderGoods.FinanceType = 2; //newOrderGoods.FinanceType = 2;
var newOrderGoods = new RB_Goods_OrderDetail_Extend var newOrderGoods = new RB_Goods_OrderDetail_Extend
{ {
FinanceType = 2, FinanceType = 3,
Final_Price = orderGoodsItem.Final_Price, Final_Price = orderGoodsItem.Final_Price,
Number = 1, Number = 1,
FreightMoney = orderGoodsItem.FreightMoney, FreightMoney = orderGoodsItem.FreightMoney,
GoodsName = orderGoodsItem.GoodsName, GoodsName = orderGoodsItem.GoodsName,
OrderNo = orderGoodsItem.OrderNo, OrderNo = orderGoodsItem.OrderNo,
Id = orderGoodsItem.Id Id = orderGoodsItem.Id,
InsuranceMoney = orderGoodsItem.InsuranceMoney
}; };
result.Add(newOrderGoods); result.Add(newOrderGoods);
} }
...@@ -287,7 +328,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -287,7 +328,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
GoodsPrice = ((orderGoodsItem.Final_Price ?? 0) - (orderGoodsItem.FreightMoney ?? 0)), GoodsPrice = ((orderGoodsItem.Final_Price ?? 0) - (orderGoodsItem.FreightMoney ?? 0)),
FreightMoney = orderGoodsItem.FreightMoney, FreightMoney = orderGoodsItem.FreightMoney,
Unit_Price = orderGoodsItem.Unit_Price, Unit_Price = orderGoodsItem.Unit_Price,
Number = orderGoodsItem.Number Number = orderGoodsItem.Number,
InsuranceCostMoney = orderGoodsItem.InsuranceCostMoney
}; };
record.RecordDetailList.Add(financeRecordDetail); record.RecordDetailList.Add(financeRecordDetail);
ECList.Add(new RB_ECFinanceId_Relation() ECList.Add(new RB_ECFinanceId_Relation()
...@@ -300,25 +342,20 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -300,25 +342,20 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
if (result != null && result.Any()) if (result != null && result.Any())
{ {
decimal OriginalFee = 0; decimal OriginalFee = 0;
var goodsDetailGroupList = goodsDetailList.GroupBy(x => x.OrderId); var goodsDetailGroupList = goodsDetailList.GroupBy(x => x.OrderId);
foreach (var goodsDetailGroupItem in goodsDetailGroupList) foreach (var goodsDetailGroupItem in goodsDetailGroupList)
{ {
decimal totalPrice = goodsDetailList.Where(x => x.OrderId == goodsDetailGroupItem.Key).Sum(x => (x.FreightMoney ?? 0) + (x.Final_Price ?? 0)) * (Convert.ToDecimal(Config.SettlementRate) / 100); decimal totalPrice = goodsDetailList.Where(x => x.OrderId == goodsDetailGroupItem.Key).Sum(x => (x.FreightMoney ?? 0) + (x.Final_Price ?? 0) + (x.InsuranceMoney ?? 0)) * (Convert.ToDecimal(Config.SettlementRate) / 100);
OriginalFee += Math.Round(totalPrice, 2, MidpointRounding.AwayFromZero); OriginalFee += Math.Round(totalPrice, 2, MidpointRounding.AwayFromZero);
} }
var detailList = result.Select(x => new var detailList = result.Select(x => new
{ {
CostTypeId = x.FinanceType == 1 ? item.IncomeCostTypeId : item.FreightCostTypeId, CostTypeId = x.FinanceType == 1 ? item.IncomeCostTypeId : (x.FinanceType==2? item.FreightCostTypeId: item.InsuranceTypeId),
Number = x.FinanceType == 1 ? x.Number : 1, Number = x.FinanceType == 1 ? x.Number : 1,
OriginalMoney = x.FinanceType == 1 ? (x.Final_Price ?? 0) : (x.FreightMoney ?? 0), OriginalMoney = x.FinanceType == 1 ? (x.Final_Price ?? 0) : (x.FinanceType == 2 ? (x.FreightMoney ?? 0) : (x.InsuranceMoney ?? 0)),
// OriginalMoney = x.FinanceType == 1 ? ((x.Unit_Price ?? 0) * (x.Number ?? 0)) : x.FreightMoney, UnitPrice = x.FinanceType == 1 ? ((x.Final_Price ?? 0) / (x.Number ?? 0)) : (x.FinanceType == 2 ? (x.FreightMoney ?? 0) : (x.InsuranceMoney ?? 0)),
UnitPrice = x.FinanceType == 1 ? ((x.Final_Price ?? 0) / (x.Number ?? 0)) : x.FreightMoney,
// UnitPrice = x.FinanceType == 1 ? (((x.Final_Price ?? 0) - (x.FreightMoney ?? 0)) / (x.Number ?? 0)) : x.FreightMoney,
Remark = x.GoodsName + x.OrderNo Remark = x.GoodsName + x.OrderNo
}); });
var financeObj = new var financeObj = new
......
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