Commit b77446f4 authored by liudong1993's avatar liudong1993
parents f6943c01 44c1c017
...@@ -315,7 +315,7 @@ namespace Mall.WebApi.Controllers.User ...@@ -315,7 +315,7 @@ namespace Mall.WebApi.Controllers.User
{ {
CostTypeId = x.FinanceType == 1 ? financeConfigurineModel.CBCostTypeId : financeConfigurineModel.ExpensesCostTypeId, CostTypeId = x.FinanceType == 1 ? financeConfigurineModel.CBCostTypeId : financeConfigurineModel.ExpensesCostTypeId,
Number = x.FinanceType == 1 ? x.Number : 1, Number = x.FinanceType == 1 ? x.Number : 1,
OriginalMoney = x.FinanceType == 1 ? x.CostMoney : x.FreightCostMoney, OriginalMoney = x.FinanceType == 1 ? ((x.CostMoney ?? 0) * (x.Number ?? 0)) : x.FreightCostMoney,
UnitPrice = x.FinanceType == 1 ? ((x.CostMoney ?? 0)) : x.FreightCostMoney, UnitPrice = x.FinanceType == 1 ? ((x.CostMoney ?? 0)) : x.FreightCostMoney,
Remark = x.GoodsName + x.OrderNo Remark = x.GoodsName + x.OrderNo
}); });
......
...@@ -119,7 +119,7 @@ namespace Mall.WindowsService.Module ...@@ -119,7 +119,7 @@ namespace Mall.WindowsService.Module
var addFinance = false; var addFinance = false;
DateTime startDate = System.DateTime.Now.AddDays(-1); DateTime startDate = System.DateTime.Now.AddDays(-1);
var recordModel = financeRecordRepository.GetList(new RB_Finance_Record_Extend { TenantId = item.TenantId, MallBaseId = item.MallBaseId }).OrderByDescending(x => x.CreateDate).FirstOrDefault(); var recordModel = financeRecordRepository.GetList(new RB_Finance_Record_Extend { TenantId = item.TenantId, MallBaseId = item.MallBaseId, Type = 1 }).OrderByDescending(x => x.CreateDate).FirstOrDefault();
if (recordModel == null)//今天没生成单据 if (recordModel == null)//今天没生成单据
{ {
if (Convert.ToDateTime(item.StartTime.Value.AddDays(item.IntervalDay ?? 0).ToString("yyyy-MM-dd 00:00:00")) <= Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd 00:00:00")))//判断开始时间加上执行周期是否等于当前日期 if (Convert.ToDateTime(item.StartTime.Value.AddDays(item.IntervalDay ?? 0).ToString("yyyy-MM-dd 00:00:00")) <= Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd 00:00:00")))//判断开始时间加上执行周期是否等于当前日期
...@@ -142,9 +142,12 @@ namespace Mall.WindowsService.Module ...@@ -142,9 +142,12 @@ namespace Mall.WindowsService.Module
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 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 DATE_FORMAT(b.PaymentTime,'%y-%m-%d')>= DATE_FORMAT('{startDate}','%y-%m-%d') where b.TenantId={item.TenantId} and b.MallBaseId={item.MallBaseId} 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 ( and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') AND b.OrderStatus IN (2, 3, 4, 5, 6) ");
b.OrderStatus IN (2, 3, 4, 5, 6) OR ( b.OrderStatus = 7 AND DATE_FORMAT(b.PaymentTime, '%y-%m-%d') >= DATE_FORMAT('{startDate}', '%y-%m-%d') // builder.AppendFormat($@" SELECT a.*,b.OrderNo from rb_goods_orderdetail as a LEFT JOIN rb_goods_order as b on a.OrderId=b.OrderId
AND DATE_FORMAT(b.PaymentTime, '%y-%m-%d') < DATE_FORMAT('{endDate}', '%y-%m-%d')))"); //where b.TenantId={item.TenantId} and b.MallBaseId={item.MallBaseId} 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) OR ( b.OrderStatus = 7 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')))");
Helper.LogHelper.Write("sql语句:" + builder.ToString()); Helper.LogHelper.Write("sql语句:" + builder.ToString());
var goodsDetailList = goodsOrderDetailRepository.Get<RB_Goods_OrderDetail_Extend>(builder.ToString()).ToList(); var goodsDetailList = goodsOrderDetailRepository.Get<RB_Goods_OrderDetail_Extend>(builder.ToString()).ToList();
...@@ -250,7 +253,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -250,7 +253,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
item.IsPublic, item.IsPublic,
BType = item.AccountType, BType = item.AccountType,
AccountId = item.AccountId, AccountId = item.AccountId,
WBMoney = (result.Sum(x => x.FinanceType == 1 ? (x.Final_Price ?? 0) : (x.FreightMoney ?? 0)))- OriginalFee, WBMoney = (result.Sum(x => x.FinanceType == 1 ? (x.Final_Price ?? 0) : (x.FreightMoney ?? 0))) - OriginalFee,
RB_Branch_Id = Config.IncomeBranchId, RB_Branch_Id = Config.IncomeBranchId,
RemitterName = item.RemitterName, RemitterName = item.RemitterName,
TradeDate = System.DateTime.Now.ToString("yyyy-MM-dd"), TradeDate = System.DateTime.Now.ToString("yyyy-MM-dd"),
...@@ -609,7 +612,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -609,7 +612,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <param name="afterTime">售后时间</param> /// <param name="afterTime">售后时间</param>
/// <returns></returns> /// <returns></returns>
public static bool SetOrderOperation(RB_Goods_Order_Extend orderModel, int type, string remark, decimal income, string address, int tenantId, int mallBaseId,int afterTime) public static bool SetOrderOperation(RB_Goods_Order_Extend orderModel, int type, string remark, decimal income, string address, int tenantId, int mallBaseId, int afterTime)
{ {
Dictionary<string, object> keyValues = new Dictionary<string, object>() { }; Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
switch (type) switch (type)
...@@ -693,7 +696,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -693,7 +696,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
if (afterTime > 0) if (afterTime > 0)
{ {
var omodel = goods_OrderRepository.GetEntity(orderModel.OrderId); var omodel = goods_OrderRepository.GetEntity(orderModel.OrderId);
if (omodel!=null && omodel.ReceivingTime.HasValue && omodel.ReceivingTime.Value.AddDays(afterTime) > DateTime.Now) { if (omodel != null && omodel.ReceivingTime.HasValue && omodel.ReceivingTime.Value.AddDays(afterTime) > DateTime.Now)
{
IsUpdateCommission = false; IsUpdateCommission = false;
} }
} }
...@@ -820,13 +824,16 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -820,13 +824,16 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
//查询该商户下 所有已完成 未发放佣金的单子 //查询该商户下 所有已完成 未发放佣金的单子
var OrderList = goods_OrderCommissionRepository.GetAllOrderCompletedNoCommissionForOrder(item.TenantId, item.MallBaseId); var OrderList = goods_OrderCommissionRepository.GetAllOrderCompletedNoCommissionForOrder(item.TenantId, item.MallBaseId);
var CommList = goods_OrderCommissionRepository.GetAllOrderCompletedNoCommissionList(item.TenantId, item.MallBaseId); var CommList = goods_OrderCommissionRepository.GetAllOrderCompletedNoCommissionList(item.TenantId, item.MallBaseId);
foreach (var Order in OrderList) { foreach (var Order in OrderList)
{
var omodel = goods_OrderRepository.GetEntity(Order.OrderId); var omodel = goods_OrderRepository.GetEntity(Order.OrderId);
if (omodel.ReceivingTime.HasValue) { if (omodel.ReceivingTime.HasValue)
{
if (item.AfterTime > 0) if (item.AfterTime > 0)
{ {
//判断是否到了时间 //判断是否到了时间
if (omodel.ReceivingTime.Value.AddDays(item.AfterTime) < DateTime.Now) { if (omodel.ReceivingTime.Value.AddDays(item.AfterTime) < DateTime.Now)
{
//结算佣金 //结算佣金
//更新返佣为已返佣 //更新返佣为已返佣
var ocList = CommList.Where(x => x.OrderId == Order.OrderId).ToList(); var ocList = CommList.Where(x => x.OrderId == Order.OrderId).ToList();
...@@ -943,7 +950,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -943,7 +950,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
} }
} }
} }
} }
} }
return true; return true;
} }
......
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