Commit ef8d182d authored by 吴春's avatar 吴春

提交代码,制单新增部门字段

parent 1907d9c5
...@@ -4551,6 +4551,7 @@ namespace Mall.Module.Product ...@@ -4551,6 +4551,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.IsQuickBuy),model.IsQuickBuy==1?2:1} { nameof(RB_Goods.IsQuickBuy),model.IsQuickBuy==1?2:1}
}; };
} }
else else
{ {
return false; return false;
...@@ -4595,7 +4596,7 @@ namespace Mall.Module.Product ...@@ -4595,7 +4596,7 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param> /// <param name="tenantId"></param>
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <returns></returns> /// <returns></returns>
public bool SetProductGoodsQuickUpdate(string goodsIds, int type, int sort, string goodsName, int freightId, int limitBuyGoodsNum, int limitBuyOrderNum, int integralPresent, int integralPresentType, decimal pointsDeduction, int pointsDeductionType, int isMultipleDeduction, int isQuickBuy, int isGoodsNegotiable, int tenantId, int mallBaseId) public bool SetProductGoodsQuickUpdate(string goodsIds, int type, int sort, string goodsName, int freightId, int limitBuyGoodsNum, int limitBuyOrderNum, int integralPresent, int integralPresentType, decimal pointsDeduction, int pointsDeductionType, int isMultipleDeduction, int isQuickBuy, int isGoodsNegotiable,int SupplierId, int tenantId, int mallBaseId)
{ {
Dictionary<string, object> keyValues; Dictionary<string, object> keyValues;
if (type == 1) if (type == 1)
...@@ -4674,6 +4675,12 @@ namespace Mall.Module.Product ...@@ -4674,6 +4675,12 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.IsGoodsNegotiable),isGoodsNegotiable} { nameof(RB_Goods.IsGoodsNegotiable),isGoodsNegotiable}
}; };
}//面议 }//面议
else if (type == 12)
{
keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods.SupplierId),SupplierId}
};
}//面议
else else
{ {
return false; return false;
...@@ -5623,5 +5630,6 @@ namespace Mall.Module.Product ...@@ -5623,5 +5630,6 @@ namespace Mall.Module.Product
#endregion #endregion
} }
} }
...@@ -1757,7 +1757,7 @@ namespace Mall.Module.User ...@@ -1757,7 +1757,7 @@ namespace Mall.Module.User
string wenXinResult = string.Empty; string wenXinResult = string.Empty;
if (!string.IsNullOrWhiteSpace(token)) if (!string.IsNullOrWhiteSpace(token))
{ {
string Url = " http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token; string Url = " https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=" + token;
var postdata = new var postdata = new
{ {
start = 0, start = 0,
......
...@@ -2105,9 +2105,11 @@ namespace Mall.Module.User ...@@ -2105,9 +2105,11 @@ namespace Mall.Module.User
if (!string.IsNullOrEmpty(remodel.ReOrderNos) && !string.IsNullOrEmpty(remodel.ReOrderIds)) if (!string.IsNullOrEmpty(remodel.ReOrderNos) && !string.IsNullOrEmpty(remodel.ReOrderIds))
{ {
List<int> OrderIdList = JsonConvert.DeserializeObject<List<int>>(remodel.ReOrderIds); List<int> OrderIdList = JsonConvert.DeserializeObject<List<int>>(remodel.ReOrderIds);
if (OrderIdList.Any()) { if (OrderIdList.Any())
{
var oclist = goods_OrderCommissionRepository.GetUserCommissionRemitedList(remodel.UserId ?? 0, string.Join(",", OrderIdList)); var oclist = goods_OrderCommissionRepository.GetUserCommissionRemitedList(remodel.UserId ?? 0, string.Join(",", OrderIdList));
foreach (var qitem in oclist) { foreach (var qitem in oclist)
{
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() { Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderCommission_Extend.IsRemit),0} { nameof(RB_Goods_OrderCommission_Extend.IsRemit),0}
}; };
...@@ -2560,6 +2562,20 @@ namespace Mall.Module.User ...@@ -2560,6 +2562,20 @@ namespace Mall.Module.User
return member_ShippingAddressRepository.Update(keyValues, wheres); return member_ShippingAddressRepository.Update(keyValues, wheres);
} }
#region 地址
/// <summary>
/// 根据地区名称获取地区列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<Model.Extend.BaseSetUp.RB_Destination_Extend> GetDestinationListByNames(string[] where)
{
return destinationRepository.GetListByNames(where);
}
#endregion
#endregion #endregion
#region 收藏商品 #region 收藏商品
...@@ -3214,7 +3230,8 @@ namespace Mall.Module.User ...@@ -3214,7 +3230,8 @@ namespace Mall.Module.User
#region 写入提现订单 #region 写入提现订单
if (demodel.TenantId == 1) { if (demodel.TenantId == 1)
{
//所有未提现的 返佣 //所有未提现的 返佣
var clist = goods_OrderCommissionRepository.GetUserCommissionRemit(demodel.UserId ?? 0); var clist = goods_OrderCommissionRepository.GetUserCommissionRemit(demodel.UserId ?? 0);
if (clist.Any()) if (clist.Any())
......
...@@ -63,7 +63,7 @@ namespace Mall.Repository.Product ...@@ -63,7 +63,7 @@ namespace Mall.Repository.Product
{ {
where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)}={(int)dmodel.OrderStatus}"; where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)}={(int)dmodel.OrderStatus}";
} }
if (dmodel.IsNotSelectCancel == 1) if (dmodel.IsNotSelectCancel == 1)
{ {
where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)} <> {(int)OrderStatusEnum.Cancel}"; where += $@" and o.{nameof(RB_Goods_Order.OrderStatus)} <> {(int)OrderStatusEnum.Cancel}";
where += $@" and o.{nameof(RB_Goods_Order.Recycled)} =2"; where += $@" and o.{nameof(RB_Goods_Order.Recycled)} =2";
...@@ -501,7 +501,7 @@ GROUP BY oc.OrderId"; ...@@ -501,7 +501,7 @@ GROUP BY oc.OrderId";
/// <param name="startTime"></param> /// <param name="startTime"></param>
/// <param name="endTime"></param> /// <param name="endTime"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Order_Extend> GetOrderRefunedCreateList(int tenantId, int mallBaseId, string startTime, string endTime) public List<RB_Goods_Order_Extend> GetOrderRefunedCreateList(int tenantId, int mallBaseId, string startTime, string endTime)
{ {
string sql = $@"SELECT * FROM rb_goods_order o string sql = $@"SELECT * FROM rb_goods_order o
WHERE o.TenantId={tenantId} and o.MallBaseId={mallBaseId} and o.OrderStatus = 7 AND o.PaymentTime IS NOT NULL AND DATE_FORMAT(o.PaymentTime,'%Y-%m-%d') <> DATE_FORMAT(o.CancelTime,'%Y-%m-%d') AND o.CancelTime>='{startTime}' AND o.CancelTime <'{endTime}'"; WHERE o.TenantId={tenantId} and o.MallBaseId={mallBaseId} and o.OrderStatus = 7 AND o.PaymentTime IS NOT NULL AND DATE_FORMAT(o.PaymentTime,'%Y-%m-%d') <> DATE_FORMAT(o.CancelTime,'%Y-%m-%d') AND o.CancelTime>='{startTime}' AND o.CancelTime <'{endTime}'";
...@@ -699,41 +699,43 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id ...@@ -699,41 +699,43 @@ LEFT JOIN rb_member_user as c on b.UserId=c.Id
// payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}"; // payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
//} //}
if (dmodel.OrderStatus > 0)
if (dmodel.OrderStatus == 1 || dmodel.OrderStatus == 0)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in (2,4,3,5,6)";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)} in (2,4,5,3,6)";
}
else if (dmodel.OrderStatus == 2)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=5";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=5";
}
else if (dmodel.OrderStatus == 3)
{ {
if (dmodel.OrderStatus == 1) where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=7";
{ payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=7";
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in (1,2,4,3,6)";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)} in (1,2,4,3,6)";
}
else if (dmodel.OrderStatus == 2)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=5";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=5";
}
else if (dmodel.OrderStatus == 3)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=7";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=7";
}
else if (dmodel.OrderStatus == 4)//后面做因为现在还没有售后表
{
where += $@" and a.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)} in (1,2,4,3)";
}
else if (dmodel.OrderStatus == 5)//后面做因为现在还没有售后表
{
}
} }
else if (dmodel.OrderStatus == 4)//后面做因为现在还没有售后表
{
where += $@" and a.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)} in (1,2,4,3)";
}
else if (dmodel.OrderStatus == 5)//后面做因为现在还没有售后表
{
where += $@" and a.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)} =5";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate)) if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{ {
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )"; where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )"; // payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT(a.{nameof(RB_Goods_OrderAfterSale.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
} }
if (!string.IsNullOrWhiteSpace(dmodel.EndDate)) if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{ {
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )"; where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )"; payMemerNumWhere += $" AND DATE_FORMAT(a.{nameof(RB_Goods_OrderAfterSale.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
// payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
} }
// string sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney, // string sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney,
...@@ -751,7 +753,7 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate, ...@@ -751,7 +753,7 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} ) as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc"; as t GROUP BY t.CreateDate desc";
} }
else if (dmodel.OrderStatus == 4) else
{ {
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
...@@ -759,22 +761,22 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate, ...@@ -759,22 +761,22 @@ LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} ) as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc"; as t GROUP BY t.CreateDate desc";
} }
else if (dmodel.OrderStatus == 4) // else if (dmodel.OrderStatus == 4)
{ // {
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum // sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a //from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.Refund as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' )) //LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} ) //as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc"; //as t GROUP BY t.CreateDate desc";
} // }
else if (dmodel.OrderStatus == 5) // else if (dmodel.OrderStatus == 5)
{ // {
sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum // sql = $@"SELECT t.CreateDate,SUM(t.ReNumber)as GoodsNum ,COUNT(t.ReOrderId)as OrderNum ,SUM(t.Income)as PayMoney,MAX(t.PayMemerNum) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.RefundActual as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a //from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,a.ReNumber,a.RefundActual as Income,c.PayMemerNum,a.ReOrderId from RB_Goods_OrderAfterSale as a
LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' )) //LEFT JOIN (SELECT COUNT(DISTINCT UserId) as PayMemerNum, DATE_FORMAT(CreateDate,'%Y-%m-%d' ) as CreateDate from RB_Goods_OrderAfterSale where {payMemerNumWhere} GROUP BY DATE_FORMAT(CreateDate,'%Y-%m-%d' ))
as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} ) //as c on c.CreateDate=DATE_FORMAT(a.CreateDate,'%Y-%m-%d' ) {where} )
as t GROUP BY t.CreateDate desc"; //as t GROUP BY t.CreateDate desc";
} // }
return GetPage<DataStatistics_Query>(pageIndex, pageSize, out count, sql).ToList(); return GetPage<DataStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
} }
...@@ -788,112 +790,112 @@ as t GROUP BY t.CreateDate desc"; ...@@ -788,112 +790,112 @@ as t GROUP BY t.CreateDate desc";
/// <param name="dmodel"></param> /// <param name="dmodel"></param>
/// <returns></returns> /// <returns></returns>
public List<DataStatistics_Query> GetSellExcel(DataStatistics_Query dmodel) public List<DataStatistics_Query> GetSellExcel(DataStatistics_Query dmodel)
{
string where = $" where 1=1 ";
string payMemerNumWhere = "";
string orderTypeWhere = "";
if (dmodel.TenantId > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.PlatformType > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
}
if (dmodel.OrderType > 0)
{
orderTypeWhere += $@" and {nameof(RB_Goods_OrderDetail.OrderType)}={dmodel.OrderType}";
}
if (dmodel.OrderStatus > 0)
{
if (dmodel.OrderStatus == 1)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in(1,2,4,3)";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}in(1,2,4,3)";
}
else if (dmodel.OrderStatus == 2)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=5";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=5";
}
else if (dmodel.OrderStatus == 3)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=7";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=7";
}
else if (dmodel.OrderStatus == 4)//后面做因为现在还没有售后表
{ {
string where = $" where 1=1 ";
string payMemerNumWhere = "";
string orderTypeWhere = "";
if (dmodel.TenantId > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.PlatformType > 0)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderSource)}={(int)dmodel.PlatformType}";
}
if (dmodel.OrderType > 0) }
{ else if (dmodel.OrderStatus == 5)//后面做因为现在还没有售后表
orderTypeWhere += $@" and {nameof(RB_Goods_OrderDetail.OrderType)}={dmodel.OrderType}"; {
}
if (dmodel.OrderStatus > 0) }
{ }
if (dmodel.OrderStatus == 1) if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{ {
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)} in(1,2,4,3)"; where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}in(1,2,4,3)"; payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
} }
else if (dmodel.OrderStatus == 2) if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{ {
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=5"; where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=5"; payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
} }
else if (dmodel.OrderStatus == 3)
{
where += $@" and a.{nameof(RB_Goods_Order.OrderStatus)}=7";
payMemerNumWhere += $@" and {nameof(RB_Goods_Order.OrderStatus)}=7";
}
else if (dmodel.OrderStatus == 4)//后面做因为现在还没有售后表
{
}
else if (dmodel.OrderStatus == 5)//后面做因为现在还没有售后表
{
}
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' )";
}
if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{
where += $" AND DATE_FORMAT(a.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
payMemerNumWhere += $" AND DATE_FORMAT({nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' )";
}
string sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney, string sql = $@"SELECT t.CreateDate,SUM(t.GoodsNum)as GoodsNum ,COUNT(t.OrderId)as OrderNum ,SUM(t.Income)as PayMoney,
(SELECT COUNT(UserId) from rb_goods_order where DATE_FORMAT(CreateDate,'%Y-%m-%d' )=t.CreateDate {payMemerNumWhere} GROUP BY UserId) as PayMemerNum (SELECT COUNT(UserId) from rb_goods_order where DATE_FORMAT(CreateDate,'%Y-%m-%d' )=t.CreateDate {payMemerNumWhere} GROUP BY UserId) as PayMemerNum
from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.UserId,a.Income,a.OrderId from rb_goods_order as a from (SELECT DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )as CreateDate,b.GoodsNum,a.UserId,a.Income,a.OrderId from rb_goods_order as a
LEFT JOIN (SELECT OrderId,SUM(Number)as GoodsNum from rb_goods_orderdetail where 1=1 {orderTypeWhere} GROUP BY OrderId)as b on a.OrderId=b.OrderId {where}) LEFT JOIN (SELECT OrderId,SUM(Number)as GoodsNum from rb_goods_orderdetail where 1=1 {orderTypeWhere} GROUP BY OrderId)as b on a.OrderId=b.OrderId {where})
as t GROUP BY t.CreateDate desc"; as t GROUP BY t.CreateDate desc";
return Get<DataStatistics_Query>(sql).ToList(); return Get<DataStatistics_Query>(sql).ToList();
}
#endregion
#region 损益核算表
public List<OrderStatistics_Query> GetOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel)
{
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
if (dmodel != null)
{
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
} }
#endregion
#region 损益核算表 if (dmodel.SupplierId > 0)
public List<OrderStatistics_Query> GetOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel)
{ {
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) "; where += $" and b.SupplierId={dmodel.SupplierId} ";
}
if (dmodel != null) if (dmodel.OneUserId > 0)
{ {
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo)) where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} ";
{ }
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'"; if (dmodel.GoodsID > 0)
} {
where += $" and b.GoodsId={dmodel.GoodsID} ";
if (dmodel.SupplierId > 0) }
{
where += $" and b.SupplierId={dmodel.SupplierId} "; if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
} {
if (dmodel.OneUserId > 0) where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
{ }
where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} "; if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
} {
if (dmodel.GoodsID > 0) where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )< DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
{ }
where += $" and b.GoodsId={dmodel.GoodsID} ";
} }
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
}
if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )< DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
}
}
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight, SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid
...@@ -904,48 +906,48 @@ LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.Use ...@@ -904,48 +906,48 @@ LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.Use
LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where} LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where}
GROUP BY b.GoodsId,b.SupplierId,b.OrderId "; GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return GetPage<OrderStatistics_Query>(pageIndex, pageSize, out count, sql).ToList(); return GetPage<OrderStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
} }
public List<OrderStatistics_Query> GetAllOrderProfitLossList( OrderStatistics_Query dmodel) public List<OrderStatistics_Query> GetAllOrderProfitLossList(OrderStatistics_Query dmodel)
{ {
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) "; string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
if (dmodel != null) if (dmodel != null)
{ {
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo)) if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{ {
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'"; where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
} }
if (dmodel.SupplierId > 0) if (dmodel.SupplierId > 0)
{ {
where += $" and b.SupplierId={dmodel.SupplierId} "; where += $" and b.SupplierId={dmodel.SupplierId} ";
} }
if (dmodel.OneUserId > 0) if (dmodel.OneUserId > 0)
{ {
where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} "; where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} ";
} }
if (dmodel.GoodsID > 0) if (dmodel.GoodsID > 0)
{ {
where += $" and b.GoodsId={dmodel.GoodsID} "; where += $" and b.GoodsId={dmodel.GoodsID} ";
} }
if (!string.IsNullOrWhiteSpace(dmodel.StartDate)) if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
} }
if (!string.IsNullOrWhiteSpace(dmodel.EndDate)) if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )< DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )< DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
} }
} }
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight, SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid
...@@ -956,86 +958,86 @@ LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.Use ...@@ -956,86 +958,86 @@ LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.Use
LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where} LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where}
GROUP BY b.GoodsId,b.SupplierId,b.OrderId "; GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
// string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, // string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
//SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice , //SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
//SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight, //SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
//c.OneCommission,d.TwoCommission,0 as OtherPrice,e.ALLCommission,0 as Paid //c.OneCommission,d.TwoCommission,0 as OtherPrice,e.ALLCommission,0 as Paid
//from rb_goods_orderdetail as b //from rb_goods_orderdetail as b
//LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId //LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
//LEFT JOIN rb_supplier as f on f.ID=b.SupplierId //LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
//LEFT JOIN (SELECT SUM(Commission) as OneCommission,OrderId from rb_goods_ordercommission where Grade=1 and CommissionState=2 GROUP BY OrderId ) as c on a.OrderId=c.OrderId //LEFT JOIN (SELECT SUM(Commission) as OneCommission,OrderId from rb_goods_ordercommission where Grade=1 and CommissionState=2 GROUP BY OrderId ) as c on a.OrderId=c.OrderId
//LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId //LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId
//LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where} //LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where}
//GROUP BY b.GoodsId,b.SupplierId,b.OrderId "; //GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return Get<OrderStatistics_Query>( sql).ToList(); return Get<OrderStatistics_Query>(sql).ToList();
} }
/// <summary> /// <summary>
/// 获取用户 订单下的商品数量 /// 获取用户 订单下的商品数量
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <param name="limitGoodsIds"></param> /// <param name="limitGoodsIds"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderGoodsNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId) public List<RB_Goods_Order_Extend> GetUserOrderGoodsNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{ {
string sql = $@"SELECT od.GoodsId,SUM(od.Number) as GoodsTotalNum FROM rb_goods_orderdetail od string sql = $@"SELECT od.GoodsId,SUM(od.Number) as GoodsTotalNum FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on od.OrderId=o.OrderId INNER JOIN rb_goods_order o on od.OrderId=o.OrderId
WHERE od.TenantId={tenantId} and od.MallBaseId={mallBaseId} and o.`Status`=0 and o.OrderStatus in (1,2,3,4,5,6) and o.Recycled=2 AND o.UserId={userId} and od.GoodsId in ({limitGoodsIds}) WHERE od.TenantId={tenantId} and od.MallBaseId={mallBaseId} and o.`Status`=0 and o.OrderStatus in (1,2,3,4,5,6) and o.Recycled=2 AND o.UserId={userId} and od.GoodsId in ({limitGoodsIds})
GROUP BY od.GoodsId"; GROUP BY od.GoodsId";
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
/// <summary> /// <summary>
/// 获取用户 商品订单得数量 /// 获取用户 商品订单得数量
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <param name="limitGoodsIds"></param> /// <param name="limitGoodsIds"></param>
/// <param name="tenantId"></param> /// <param name="tenantId"></param>
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Order_Extend> GetUserOrderNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId) public List<RB_Goods_Order_Extend> GetUserOrderNum(int userId, string limitGoodsIds, int tenantId, int mallBaseId)
{ {
string sql = $@"SELECT t.GoodsId,COUNT(0) as OrderNum FROM( string sql = $@"SELECT t.GoodsId,COUNT(0) as OrderNum FROM(
SELECT od.GoodsId,o.* FROM rb_goods_orderdetail od SELECT od.GoodsId,o.* FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on od.OrderId=o.OrderId INNER JOIN rb_goods_order o on od.OrderId=o.OrderId
WHERE od.TenantId={tenantId} and od.MallBaseId={mallBaseId} and o.`Status`=0 and o.OrderStatus in (1,2,3,4,5,6) and o.Recycled=2 AND o.UserId={userId} and od.GoodsId in ({limitGoodsIds}) WHERE od.TenantId={tenantId} and od.MallBaseId={mallBaseId} and o.`Status`=0 and o.OrderStatus in (1,2,3,4,5,6) and o.Recycled=2 AND o.UserId={userId} and od.GoodsId in ({limitGoodsIds})
GROUP BY od.GoodsId,o.OrderId GROUP BY od.GoodsId,o.OrderId
)t GROUP BY t.GoodsId"; )t GROUP BY t.GoodsId";
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
#endregion #endregion
#region #region
/// <summary> /// <summary>
/// 获取超时取消的订单列表 /// 获取超时取消的订单列表
/// </summary> /// </summary>
/// <param name="cancelTime"></param> /// <param name="cancelTime"></param>
/// <param name="t"></param> /// <param name="t"></param>
/// <param name="m"></param> /// <param name="m"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime, int t, int m) public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime, int t, int m)
{ {
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'"; string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
/// <summary> /// <summary>
/// 获取可自动收货的订单列表 /// 获取可自动收货的订单列表
/// </summary> /// </summary>
/// <param name="day"></param> /// <param name="day"></param>
/// <param name="t"></param> /// <param name="t"></param>
/// <param name="m"></param> /// <param name="m"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m) public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m)
{ {
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =3 and DATE_ADD(DeliveryTime,INTERVAL {day} DAY) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'"; string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =3 and DATE_ADD(DeliveryTime,INTERVAL {day} DAY) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
#endregion #endregion
} }
} }
...@@ -63,8 +63,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -63,8 +63,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("", result); return ApiResult.Success("", result);
} }
public static List<RB_Destination_Extend> GetData(List<RB_Destination_Extend> nodeList) public static List<RB_Destination_Extend> GetData(List<RB_Destination_Extend> nodeList)
{ {
......
...@@ -66,7 +66,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -66,7 +66,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetMaterialInfo() { public ApiResult SetMaterialInfo()
{
var parms = RequestParm; var parms = RequestParm;
RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString()); RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) if (string.IsNullOrEmpty(demodel.Name))
...@@ -77,10 +78,12 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -77,10 +78,12 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
if ((demodel.GroupId ?? 0) < 0) { if ((demodel.GroupId ?? 0) < 0)
{
return ApiResult.ParamIsNull("请输入分组"); return ApiResult.ParamIsNull("请输入分组");
} }
if (string.IsNullOrEmpty(demodel.Path)) { if (string.IsNullOrEmpty(demodel.Path))
{
return ApiResult.ParamIsNull("请传递文件路径"); return ApiResult.ParamIsNull("请传递文件路径");
} }
...@@ -134,13 +137,16 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -134,13 +137,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetMaterialGroupInfo() { public ApiResult SetMaterialGroupInfo()
{
var parms = RequestParm; var parms = RequestParm;
RB_Material_Group_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Group_Extend>(parms.msg.ToString()); RB_Material_Group_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Group_Extend>(parms.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) { if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入分组名称"); return ApiResult.ParamIsNull("请输入分组名称");
} }
if (demodel.Type != 1 && demodel.Type != 2) { if (demodel.Type != 1 && demodel.Type != 2)
{
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
...@@ -155,7 +161,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -155,7 +161,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -165,11 +172,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -165,11 +172,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetMaterialGroupRecycled() { public ApiResult SetMaterialGroupRecycled()
{
var requestParm = RequestParm; var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString()); var parms = JObject.Parse(requestParm.msg.ToString());
int GroupId = parms.GetInt("GroupId", 0); int GroupId = parms.GetInt("GroupId", 0);
if (GroupId < 0) { if (GroupId < 0)
{
return ApiResult.ParamIsNull("请传递分组id"); return ApiResult.ParamIsNull("请传递分组id");
} }
...@@ -178,7 +187,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -178,7 +187,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -330,7 +340,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -330,7 +340,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请传递素材ids"); return ApiResult.ParamIsNull("请传递素材ids");
} }
if (GroupId <= 0) if (GroupId <= 0)
{ {
return ApiResult.ParamIsNull("请传递分组id"); return ApiResult.ParamIsNull("请传递分组id");
} }
...@@ -393,7 +403,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -393,7 +403,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductCategoryTreeList() { public ApiResult GetProductCategoryTreeList()
{
var parms = RequestParm; var parms = RequestParm;
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(parms.msg.ToString()); RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(parms.msg.ToString());
...@@ -409,11 +420,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -409,11 +420,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductCategoryInfo() { public ApiResult GetProductCategoryInfo()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0); int CategoryId = parms.GetInt("CategoryId", 0);
if (CategoryId <= 0) { if (CategoryId <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -448,24 +461,30 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -448,24 +461,30 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductCategoryInfo() { public ApiResult SetProductCategoryInfo()
{
var req = RequestParm; var req = RequestParm;
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(req.msg.ToString()); RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(req.msg.ToString());
if ((demodel.Tier ?? 0) <= 0) { if ((demodel.Tier ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择层级"); return ApiResult.ParamIsNull("请选择层级");
} }
if (string.IsNullOrEmpty(demodel.Name)) { if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入分类名称"); return ApiResult.ParamIsNull("请输入分类名称");
} }
if (!demodel.Sort.HasValue) { if (!demodel.Sort.HasValue)
{
return ApiResult.ParamIsNull("请输入排序"); return ApiResult.ParamIsNull("请输入排序");
} }
if (demodel.Tier == 1) if (demodel.Tier == 1)
{ {
demodel.ParentId = 0; demodel.ParentId = 0;
} }
else if (demodel.Tier > 1) { else if (demodel.Tier > 1)
if ((demodel.ParentId ?? 0) <= 0) { {
if ((demodel.ParentId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请选择上级"); return ApiResult.ParamIsNull("请选择上级");
} }
} }
...@@ -482,12 +501,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -482,12 +501,13 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.IsForeignShare ??= 2; demodel.IsForeignShare ??= 2;
demodel.CreateDate = DateTime.Now; demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now; demodel.UpdateDate = DateTime.Now;
bool flag= productModule.SetProductCategoryInfo(demodel); bool flag = productModule.SetProductCategoryInfo(demodel);
if (flag) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
...@@ -498,7 +518,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -498,7 +518,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult DelProductCategoryInfo() { public ApiResult DelProductCategoryInfo()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0); int CategoryId = parms.GetInt("CategoryId", 0);
...@@ -523,30 +544,37 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -523,30 +544,37 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductCategoryTransfer() { public ApiResult SetProductCategoryTransfer()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int CategoryId = parms.GetInt("CategoryId", 0); int CategoryId = parms.GetInt("CategoryId", 0);
int ParentId = parms.GetInt("ParentId", 0); int ParentId = parms.GetInt("ParentId", 0);
if (CategoryId <= 0) { if (CategoryId <= 0)
{
return ApiResult.ParamIsNull("请选择需转移分类id"); return ApiResult.ParamIsNull("请选择需转移分类id");
} }
if (ParentId < 0) { if (ParentId < 0)
{
return ApiResult.ParamIsNull("请选择转入分类id"); return ApiResult.ParamIsNull("请选择转入分类id");
} }
if (CategoryId == ParentId) { if (CategoryId == ParentId)
{
return ApiResult.ParamIsNull("不能转入同一分类下"); return ApiResult.ParamIsNull("不能转入同一分类下");
} }
var list = productModule.GetProductCategoryForALLChlid(CategoryId, Convert.ToInt32(req.uid), req.MallBaseId); var list = productModule.GetProductCategoryForALLChlid(CategoryId, Convert.ToInt32(req.uid), req.MallBaseId);
if (list.Where(x => x.Id == ParentId).Any()) { if (list.Where(x => x.Id == ParentId).Any())
{
return ApiResult.ParamIsNull("不能转入当前分类的子集分类"); return ApiResult.ParamIsNull("不能转入当前分类的子集分类");
} }
var model = list.Where(x => x.Id == CategoryId).FirstOrDefault(); var model = list.Where(x => x.Id == CategoryId).FirstOrDefault();
if (model == null) { if (model == null)
{
return ApiResult.ParamIsNull("分类不存在,请核实后再试"); return ApiResult.ParamIsNull("分类不存在,请核实后再试");
} }
if (model.ParentId == ParentId) { if (model.ParentId == ParentId)
{
return ApiResult.ParamIsNull("已在当前分类下,未转移"); return ApiResult.ParamIsNull("已在当前分类下,未转移");
} }
...@@ -555,7 +583,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -555,7 +583,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -565,10 +594,12 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -565,10 +594,12 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductCategorySort() { public ApiResult SetProductCategorySort()
{
var req = RequestParm; var req = RequestParm;
List<RB_Product_CategorySort> delist = JsonConvert.DeserializeObject<List<RB_Product_CategorySort>>(req.msg.ToString()); List<RB_Product_CategorySort> delist = JsonConvert.DeserializeObject<List<RB_Product_CategorySort>>(req.msg.ToString());
if (delist == null || !delist.Any()) { if (delist == null || !delist.Any())
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -588,7 +619,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -588,7 +619,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductCategoryStyleInfo() { public ApiResult GetProductCategoryStyleInfo()
{
var parms = RequestParm; var parms = RequestParm;
var model = productModule.GetProductCategoryStyleInfo(parms.TenantId, parms.MallBaseId); var model = productModule.GetProductCategoryStyleInfo(parms.TenantId, parms.MallBaseId);
...@@ -608,7 +640,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -608,7 +640,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductCategoryStyleInfo() { public ApiResult SetProductCategoryStyleInfo()
{
var req = RequestParm; var req = RequestParm;
RB_Product_CategoryStyle_Extend demodel = JsonConvert.DeserializeObject<RB_Product_CategoryStyle_Extend>(req.msg.ToString()); RB_Product_CategoryStyle_Extend demodel = JsonConvert.DeserializeObject<RB_Product_CategoryStyle_Extend>(req.msg.ToString());
...@@ -662,7 +695,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -662,7 +695,7 @@ namespace Mall.WebApi.Controllers.MallBase
[HttpPost] [HttpPost]
public ApiResult GetProductSpecificationList() public ApiResult GetProductSpecificationList()
{ {
var parms = RequestParm; var parms = RequestParm;
RB_Product_Specification_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Specification_Extend>(parms.msg.ToString()); RB_Product_Specification_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Specification_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
...@@ -684,13 +717,16 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -684,13 +717,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductSpecificationInfo() { public ApiResult SetProductSpecificationInfo()
{
var req = RequestParm; var req = RequestParm;
RB_Product_Specification_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Specification_Extend>(req.msg.ToString()); RB_Product_Specification_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Specification_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) { if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入规格名"); return ApiResult.ParamIsNull("请输入规格名");
} }
if (demodel.SpecList == null || !demodel.SpecList.Any()) { if (demodel.SpecList == null || !demodel.SpecList.Any())
{
return ApiResult.ParamIsNull("请输入规格值"); return ApiResult.ParamIsNull("请输入规格值");
} }
demodel.Content = JsonConvert.SerializeObject(demodel.SpecList); demodel.Content = JsonConvert.SerializeObject(demodel.SpecList);
...@@ -704,7 +740,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -704,7 +740,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -714,11 +751,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -714,11 +751,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult DelProductSpecificationInfo() { public ApiResult DelProductSpecificationInfo()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int SpecificationId = parms.GetInt("SpecificationId", 0); int SpecificationId = parms.GetInt("SpecificationId", 0);
if (SpecificationId <= 0) { if (SpecificationId <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -727,7 +766,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -727,7 +766,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -800,7 +840,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -800,7 +840,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
var req = RequestParm; var req = RequestParm;
RB_Product_QuickBuy_Extend demodel = JsonConvert.DeserializeObject<RB_Product_QuickBuy_Extend>(req.msg.ToString()); RB_Product_QuickBuy_Extend demodel = JsonConvert.DeserializeObject<RB_Product_QuickBuy_Extend>(req.msg.ToString());
if ((demodel.CategoryId??0)<=0) if ((demodel.CategoryId ?? 0) <= 0)
{ {
return ApiResult.ParamIsNull("请选择分类"); return ApiResult.ParamIsNull("请选择分类");
} }
...@@ -808,7 +848,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -808,7 +848,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请输入排序"); return ApiResult.ParamIsNull("请输入排序");
} }
if (productModule.ValidateQuickBuyCategory(demodel.Id, demodel.CategoryId, req.TenantId, req.MallBaseId)) { if (productModule.ValidateQuickBuyCategory(demodel.Id, demodel.CategoryId, req.TenantId, req.MallBaseId))
{
return ApiResult.Failed("该分类已存在,无法再次添加"); return ApiResult.Failed("该分类已存在,无法再次添加");
} }
...@@ -864,7 +905,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -864,7 +905,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductRecommendSetInfo() { public ApiResult GetProductRecommendSetInfo()
{
var req = RequestParm; var req = RequestParm;
var model = productModule.GetProductRecommendSetInfo(req.TenantId, req.MallBaseId); var model = productModule.GetProductRecommendSetInfo(req.TenantId, req.MallBaseId);
return ApiResult.Success("", new return ApiResult.Success("", new
...@@ -888,18 +930,23 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -888,18 +930,23 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductRecommendSetInfo() { public ApiResult SetProductRecommendSetInfo()
{
var req = RequestParm; var req = RequestParm;
RB_Product_Recommend_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Recommend_Extend>(req.msg.ToString()); RB_Product_Recommend_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Recommend_Extend>(req.msg.ToString());
if (demodel.IsOrderRecommend == 1) { if (demodel.IsOrderRecommend == 1)
if (demodel.OrderProductList == null || !demodel.OrderProductList.Any()) { {
if (demodel.OrderProductList == null || !demodel.OrderProductList.Any())
{
return ApiResult.ParamIsNull("请选择自定义推荐商品"); return ApiResult.ParamIsNull("请选择自定义推荐商品");
} }
demodel.OrderProductIds = string.Join(",", demodel.OrderProductList.Select(x => x.Id).Distinct()); demodel.OrderProductIds = string.Join(",", demodel.OrderProductList.Select(x => x.Id).Distinct());
} }
if (demodel.IsCommentRecommend == 1) { if (demodel.IsCommentRecommend == 1)
if (demodel.CommentProductList == null || !demodel.CommentProductList.Any()) { {
if (demodel.CommentProductList == null || !demodel.CommentProductList.Any())
{
return ApiResult.ParamIsNull("请选择自定义推荐商品"); return ApiResult.ParamIsNull("请选择自定义推荐商品");
} }
demodel.CommentProductIds = string.Join(",", demodel.CommentProductList.Select(x => x.Id).Distinct()); demodel.CommentProductIds = string.Join(",", demodel.CommentProductList.Select(x => x.Id).Distinct());
...@@ -916,7 +963,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -916,7 +963,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -982,16 +1030,19 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -982,16 +1030,19 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductServiceInfo() { public ApiResult GetProductServiceInfo()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int ServiceId = parms.GetInt("ServiceId", 0); int ServiceId = parms.GetInt("ServiceId", 0);
if (ServiceId <= 0) { if (ServiceId <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
var model = productModule.GetProductServiceInfo(ServiceId); var model = productModule.GetProductServiceInfo(ServiceId);
return ApiResult.Success("",new { return ApiResult.Success("", new
{
model.Id, model.Id,
model.Name, model.Name,
model.Sort, model.Sort,
...@@ -1017,7 +1068,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1017,7 +1068,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请输入排序"); return ApiResult.ParamIsNull("请输入排序");
} }
demodel.TenantId = req.TenantId; demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId; demodel.MallBaseId = req.MallBaseId;
demodel.IsDefault ??= 1; demodel.IsDefault ??= 1;
...@@ -1070,7 +1121,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1070,7 +1121,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductGoodsPageList() { public ApiResult GetProductGoodsPageList()
{
var parms = RequestParm; var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString()); RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
...@@ -1100,7 +1152,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1100,7 +1152,7 @@ namespace Mall.WebApi.Controllers.MallBase
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}); });
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
} }
/// <summary> /// <summary>
/// 商品信息下载 /// 商品信息下载
...@@ -1196,7 +1248,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1196,7 +1248,8 @@ namespace Mall.WebApi.Controllers.MallBase
x.GoodsNumbers x.GoodsNumbers
})); }));
} }
else { else
{
List<object> objList = new List<object>(); List<object> objList = new List<object>();
List<object> SpecificationValueList = new List<object>(); List<object> SpecificationValueList = new List<object>();
SpecificationValueList.Add(new SpecificationValueList.Add(new
...@@ -1232,7 +1285,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1232,7 +1285,8 @@ namespace Mall.WebApi.Controllers.MallBase
GGMX = JsonConvert.SerializeObject(SpecificationPriceList);//序列化 GGMX = JsonConvert.SerializeObject(SpecificationPriceList);//序列化
} }
string AreaList = ""; string AreaList = "";
if (item.IsAreaBuy == 1) { if (item.IsAreaBuy == 1)
{
AreaList = JsonConvert.SerializeObject(item.AreaList.Select(x => new AreaList = JsonConvert.SerializeObject(item.AreaList.Select(x => new
{ {
x.Id, x.Id,
...@@ -1306,7 +1360,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1306,7 +1360,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductGoodsDialogList() { public ApiResult GetProductGoodsDialogList()
{
var parms = RequestParm; var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString()); RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
...@@ -1332,11 +1387,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1332,11 +1387,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetProductGoodsInfo() { public ApiResult GetProductGoodsInfo()
{
var req = RequestParm; var req = RequestParm;
JObject prams = JObject.Parse(req.msg.ToString()); JObject prams = JObject.Parse(req.msg.ToString());
int GoodsId = prams.GetInt("GoodsId", 0); int GoodsId = prams.GetInt("GoodsId", 0);
if (GoodsId <= 0) { if (GoodsId <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -1392,17 +1449,20 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1392,17 +1449,20 @@ namespace Mall.WebApi.Controllers.MallBase
model.ProxyRises, model.ProxyRises,
model.ProxyMoney, model.ProxyMoney,
model.IsProcurement, model.IsProcurement,
CategoryList = model.CategoryList.Select(x=>new { CategoryList = model.CategoryList.Select(x => new
{
x.Id, x.Id,
x.CategoryId, x.CategoryId,
x.CategoryName x.CategoryName
}), }),
SpecificationList= model.SpecificationList.Select(x=>new { SpecificationList = model.SpecificationList.Select(x => new
{
x.Id, x.Id,
x.EnabledImage, x.EnabledImage,
x.Name, x.Name,
x.Sort, x.Sort,
SpecificationValueList= x.SpecificationValueList.Select(y=>new { SpecificationValueList = x.SpecificationValueList.Select(y => new
{
y.Id, y.Id,
y.Image, y.Image,
y.ImagePath, y.ImagePath,
...@@ -1410,7 +1470,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1410,7 +1470,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.Sort y.Sort
}) })
}), }),
SpecificationPriceList= model.SpecificationPriceList.Select(x=>new { SpecificationPriceList = model.SpecificationPriceList.Select(x => new
{
x.Id, x.Id,
x.GoodsNumbers, x.GoodsNumbers,
x.GoodsWeight, x.GoodsWeight,
...@@ -1419,13 +1480,15 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1419,13 +1480,15 @@ namespace Mall.WebApi.Controllers.MallBase
x.SpecificationSort, x.SpecificationSort,
x.AttrList x.AttrList
}), }),
AreaList= model.AreaList.Select(x=>new { AreaList = model.AreaList.Select(x => new
{
x.Id, x.Id,
x.AreaId, x.AreaId,
x.AreaName, x.AreaName,
x.AreaType x.AreaType
}), }),
DistributionCommissionList= model.DistributionCommissionList.Select(x=>new { DistributionCommissionList = model.DistributionCommissionList.Select(x => new
{
x.Id, x.Id,
x.DistributorGrade, x.DistributorGrade,
x.OneCommission, x.OneCommission,
...@@ -1433,28 +1496,33 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1433,28 +1496,33 @@ namespace Mall.WebApi.Controllers.MallBase
x.ThreeCommission, x.ThreeCommission,
x.TwoCommission x.TwoCommission
}), }),
DistributionCommissionTreeList= model.DistributionCommissionTreeList.Select(x=>new { DistributionCommissionTreeList = model.DistributionCommissionTreeList.Select(x => new
{
x.Id, x.Id,
x.SpecificationSort, x.SpecificationSort,
x.AttrList, x.AttrList,
GradeCommissionList= x.GradeCommissionList.Select(y=>new { GradeCommissionList = x.GradeCommissionList.Select(y => new
{
y.DistributorGrade, y.DistributorGrade,
y.OneCommission, y.OneCommission,
y.ThreeCommission, y.ThreeCommission,
y.TwoCommission y.TwoCommission
}) })
}), }),
MemberPriceList = model.MemberPriceList.Select(x=>new { MemberPriceList = model.MemberPriceList.Select(x => new
{
x.Id, x.Id,
x.MemberGrade, x.MemberGrade,
x.MemberPrice, x.MemberPrice,
x.SpecificationSort x.SpecificationSort
}), }),
MemberPriceTreeList= model.MemberPriceTreeList.Select(x=>new { MemberPriceTreeList = model.MemberPriceTreeList.Select(x => new
{
x.Id, x.Id,
x.SpecificationSort, x.SpecificationSort,
x.AttrList, x.AttrList,
GradePriceList= x.GradePriceList.Select(y=>new { GradePriceList = x.GradePriceList.Select(y => new
{
y.MemberGrade, y.MemberGrade,
y.MemberPrice y.MemberPrice
}) })
...@@ -1469,26 +1537,32 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1469,26 +1537,32 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductGoodsInfo() { public ApiResult SetProductGoodsInfo()
{
var parms = RequestParm; var parms = RequestParm;
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString()); RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
if (string.IsNullOrEmpty(demodel.Name)) { if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请输入商品名称"); return ApiResult.ParamIsNull("请输入商品名称");
} }
if (demodel.CarouselImageList == null || !demodel.CarouselImageList.Any()) { if (demodel.CarouselImageList == null || !demodel.CarouselImageList.Any())
{
return ApiResult.ParamIsNull("请添加商品轮播图"); return ApiResult.ParamIsNull("请添加商品轮播图");
} }
demodel.CarouselImage = JsonConvert.SerializeObject(demodel.CarouselImageList.Select(x => x.Path)); demodel.CarouselImage = JsonConvert.SerializeObject(demodel.CarouselImageList.Select(x => x.Path));
if ((demodel.SellingPrice ?? 0) <= 0){ if ((demodel.SellingPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入售价"); return ApiResult.ParamIsNull("请输入售价");
} }
if ((demodel.OriginalPrice ?? 0) <= 0){ if ((demodel.OriginalPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入原价"); return ApiResult.ParamIsNull("请输入原价");
} }
if (string.IsNullOrEmpty(demodel.Unit)){ if (string.IsNullOrEmpty(demodel.Unit))
{
return ApiResult.ParamIsNull("请输入单位"); return ApiResult.ParamIsNull("请输入单位");
} }
demodel.IsCustomSpecification ??= 1; demodel.IsCustomSpecification ??= 1;
...@@ -1498,35 +1572,44 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1498,35 +1572,44 @@ namespace Mall.WebApi.Controllers.MallBase
if (demodel.IsCustomSpecification == 1) if (demodel.IsCustomSpecification == 1)
{ {
demodel.InventoryNum = 0; demodel.InventoryNum = 0;
if (demodel.SpecificationList == null || !demodel.SpecificationList.Any()) { if (demodel.SpecificationList == null || !demodel.SpecificationList.Any())
{
return ApiResult.ParamIsNull("请传递规格列表"); return ApiResult.ParamIsNull("请传递规格列表");
} }
if (demodel.SpecificationPriceList == null || !demodel.SpecificationPriceList.Any()) { if (demodel.SpecificationPriceList == null || !demodel.SpecificationPriceList.Any())
{
return ApiResult.ParamIsNull("请传递规格价格库存列表"); return ApiResult.ParamIsNull("请传递规格价格库存列表");
} }
if (demodel.SpecificationList.Count() != demodel.SpecificationList.Select(x => x.Sort).Distinct().Count()) { if (demodel.SpecificationList.Count() != demodel.SpecificationList.Select(x => x.Sort).Distinct().Count())
{
return ApiResult.ParamIsNull("规格名排序有误"); return ApiResult.ParamIsNull("规格名排序有误");
} }
int TotalNum = 1; int TotalNum = 1;
foreach (var item in demodel.SpecificationList) { foreach (var item in demodel.SpecificationList)
{
if (item.SpecificationValueList == null || !item.SpecificationValueList.Any()) if (item.SpecificationValueList == null || !item.SpecificationValueList.Any())
{ {
return ApiResult.ParamIsNull("请传递规格值列表"); return ApiResult.ParamIsNull("请传递规格值列表");
} }
if (item.SpecificationValueList.Count() != item.SpecificationValueList.Select(x => x.Sort).Distinct().Count()) { if (item.SpecificationValueList.Count() != item.SpecificationValueList.Select(x => x.Sort).Distinct().Count())
{
return ApiResult.ParamIsNull("规格值排序有误"); return ApiResult.ParamIsNull("规格值排序有误");
} }
TotalNum *= item.SpecificationValueList.Count(); TotalNum *= item.SpecificationValueList.Count();
if (item.EnabledImage == 1) { if (item.EnabledImage == 1)
foreach (var qitem in item.SpecificationValueList) { {
if ((qitem.Image ?? "") == "") { foreach (var qitem in item.SpecificationValueList)
{
if ((qitem.Image ?? "") == "")
{
return ApiResult.ParamIsNull("请选择规格图片"); return ApiResult.ParamIsNull("请选择规格图片");
} }
} }
} }
} }
//验证总keys数量 //验证总keys数量
if (demodel.SpecificationPriceList.Count() != TotalNum) { if (demodel.SpecificationPriceList.Count() != TotalNum)
{
return ApiResult.ParamIsNull("规格价格数量有误"); return ApiResult.ParamIsNull("规格价格数量有误");
} }
//初始化所有keys //初始化所有keys
...@@ -1537,14 +1620,16 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1537,14 +1620,16 @@ namespace Mall.WebApi.Controllers.MallBase
} }
int MGBJNum = 1; int MGBJNum = 1;
//组装所有keys //组装所有keys
foreach (var item in demodel.SpecificationList) { foreach (var item in demodel.SpecificationList)
{
int LBBJNum = TotalNum / item.SpecificationValueList.Count() / MGBJNum; int LBBJNum = TotalNum / item.SpecificationValueList.Count() / MGBJNum;
int KeyIndex = 0; int KeyIndex = 0;
for (var i = 1; i <= LBBJNum; i++) for (var i = 1; i <= LBBJNum; i++)
{ {
foreach (var qitem in item.SpecificationValueList) foreach (var qitem in item.SpecificationValueList)
{ {
for (var j = 1; j <= MGBJNum; j++) { for (var j = 1; j <= MGBJNum; j++)
{
KeyList[KeyIndex] = KeyList[KeyIndex] + ":" + qitem.Sort; KeyList[KeyIndex] = KeyList[KeyIndex] + ":" + qitem.Sort;
KeyIndex++; KeyIndex++;
} }
...@@ -1552,16 +1637,20 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1552,16 +1637,20 @@ namespace Mall.WebApi.Controllers.MallBase
} }
} }
//验证所有keys //验证所有keys
foreach (var item in KeyList) { foreach (var item in KeyList)
{
string keys = item[1..]; string keys = item[1..];
var pricemodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == keys).FirstOrDefault(); var pricemodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
if (pricemodel == null) { if (pricemodel == null)
{
return ApiResult.ParamIsNull("规格价格Key有误"); return ApiResult.ParamIsNull("规格价格Key有误");
} }
if ((pricemodel.SellingPrice ?? 0) <= 0) { if ((pricemodel.SellingPrice ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请输入规格列表价格"); return ApiResult.ParamIsNull("请输入规格列表价格");
} }
if ((pricemodel.InventoryNum ?? 0) < 0) { if ((pricemodel.InventoryNum ?? 0) < 0)
{
return ApiResult.ParamIsNull("规格列表库存不正确"); return ApiResult.ParamIsNull("规格列表库存不正确");
} }
pricemodel.InventoryNum ??= 0; pricemodel.InventoryNum ??= 0;
...@@ -1573,7 +1662,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1573,7 +1662,8 @@ namespace Mall.WebApi.Controllers.MallBase
//主表价格 如果有自定义规格,直接取最小值 //主表价格 如果有自定义规格,直接取最小值
demodel.SellingPrice = demodel.SpecificationPriceList.Min(x => x.SellingPrice ?? 0); demodel.SellingPrice = demodel.SpecificationPriceList.Min(x => x.SellingPrice ?? 0);
//分销佣金 //分销佣金
if (demodel.SeparateDistribution == 1) { if (demodel.SeparateDistribution == 1)
{
if (DGradeList == null) if (DGradeList == null)
{ {
DGradeList = productModule.GetDistributorGradeList(new Model.Extend.User.RB_Distributor_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); DGradeList = productModule.GetDistributorGradeList(new Model.Extend.User.RB_Distributor_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
...@@ -1590,11 +1680,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1590,11 +1680,14 @@ namespace Mall.WebApi.Controllers.MallBase
} }
//转换 //转换
List<RB_Goods_DistributionCommission_Extend> Rlist = new List<RB_Goods_DistributionCommission_Extend>(); List<RB_Goods_DistributionCommission_Extend> Rlist = new List<RB_Goods_DistributionCommission_Extend>();
foreach (var item in demodel.DistributionCommissionList) { foreach (var item in demodel.DistributionCommissionList)
if (item.GradeCommissionList == null || !item.GradeCommissionList.Any()) { {
if (item.GradeCommissionList == null || !item.GradeCommissionList.Any())
{
return ApiResult.ParamIsNull("请传递分销佣金列表"); return ApiResult.ParamIsNull("请传递分销佣金列表");
} }
foreach (var qitem in item.GradeCommissionList) { foreach (var qitem in item.GradeCommissionList)
{
Rlist.Add(new RB_Goods_DistributionCommission_Extend() Rlist.Add(new RB_Goods_DistributionCommission_Extend()
{ {
DistributorGrade = qitem.DistributorGrade, DistributorGrade = qitem.DistributorGrade,
...@@ -1606,7 +1699,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1606,7 +1699,8 @@ namespace Mall.WebApi.Controllers.MallBase
}); });
} }
} }
if (Rlist.Any()) { if (Rlist.Any())
{
demodel.DistributionCommissionList = Rlist; demodel.DistributionCommissionList = Rlist;
} }
if (demodel.SeparateDistributionType == 1) if (demodel.SeparateDistributionType == 1)
...@@ -1623,7 +1717,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1623,7 +1717,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表不存在"); return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表不存在");
} }
var gcmodel = gradeList.Where(x => x.SpecificationSort == "").FirstOrDefault(); var gcmodel = gradeList.Where(x => x.SpecificationSort == "").FirstOrDefault();
if (gcmodel == null) if (gcmodel == null)
{ {
...@@ -1640,7 +1734,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1640,7 +1734,7 @@ namespace Mall.WebApi.Controllers.MallBase
if (DGradeList.Count() * TotalNum != demodel.DistributionCommissionList.Count()) if (DGradeList.Count() * TotalNum != demodel.DistributionCommissionList.Count())
{ {
LogHelper.Write(DGradeList.Count().ToString() + "|||" + JsonConvert.SerializeObject(DGradeList)); LogHelper.Write(DGradeList.Count().ToString() + "|||" + JsonConvert.SerializeObject(DGradeList));
LogHelper.Write("TotalNum:"+ TotalNum.ToString()); LogHelper.Write("TotalNum:" + TotalNum.ToString());
LogHelper.Write(JsonConvert.SerializeObject(demodel.DistributionCommissionList)); LogHelper.Write(JsonConvert.SerializeObject(demodel.DistributionCommissionList));
return ApiResult.ParamIsNull("分销佣金列表数量不正确"); return ApiResult.ParamIsNull("分销佣金列表数量不正确");
} }
...@@ -1672,7 +1766,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1672,7 +1766,8 @@ namespace Mall.WebApi.Controllers.MallBase
} }
//会员价格 //会员价格
if (demodel.EnjoyMember == 1 && demodel.SeparateSetMember == 1) { if (demodel.EnjoyMember == 1 && demodel.SeparateSetMember == 1)
{
// 获取所有会员等级 // 获取所有会员等级
if (MGradeList == null) if (MGradeList == null)
{ {
...@@ -1739,7 +1834,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1739,7 +1834,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
} }
} }
#region 默认值 #region 默认值
demodel.VideoAddress ??= ""; demodel.VideoAddress ??= "";
demodel.CustomShareTitles ??= ""; demodel.CustomShareTitles ??= "";
...@@ -1761,7 +1856,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1761,7 +1856,8 @@ namespace Mall.WebApi.Controllers.MallBase
} }
demodel.GoodsService = JsonConvert.SerializeObject(demodel.ServiceList.Select(x => x.Id)); demodel.GoodsService = JsonConvert.SerializeObject(demodel.ServiceList.Select(x => x.Id));
} }
else { else
{
demodel.GoodsService = "[]"; demodel.GoodsService = "[]";
} }
demodel.FreightId ??= 0; demodel.FreightId ??= 0;
...@@ -1772,8 +1868,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1772,8 +1868,10 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.FullMoneyPinkage ??= 0; demodel.FullMoneyPinkage ??= 0;
demodel.IsAreaBuy ??= 2; demodel.IsAreaBuy ??= 2;
if (demodel.IsAreaBuy == 1) { if (demodel.IsAreaBuy == 1)
if (demodel.AreaList == null || !demodel.AreaList.Any()) { {
if (demodel.AreaList == null || !demodel.AreaList.Any())
{
return ApiResult.ParamIsNull("请选择区域"); return ApiResult.ParamIsNull("请选择区域");
} }
} }
...@@ -1789,7 +1887,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1789,7 +1887,8 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion #endregion
demodel.SeparateDistribution ??= 2; demodel.SeparateDistribution ??= 2;
demodel.SeparateDistributionType ??= 1; demodel.SeparateDistributionType ??= 1;
if (demodel.SeparateDistribution == 1) { if (demodel.SeparateDistribution == 1)
{
//获取所有分销商等级 //获取所有分销商等级
if (DGradeList == null) if (DGradeList == null)
{ {
...@@ -1803,14 +1902,17 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1803,14 +1902,17 @@ namespace Mall.WebApi.Controllers.MallBase
} }
if (demodel.SeparateDistributionType == 1) if (demodel.SeparateDistributionType == 1)
{ {
if (demodel.DistributionCommissionList == null || !demodel.DistributionCommissionList.Any()) { if (demodel.DistributionCommissionList == null || !demodel.DistributionCommissionList.Any())
{
return ApiResult.ParamIsNull("请传递分销佣金列表"); return ApiResult.ParamIsNull("请传递分销佣金列表");
} }
//普通设置 直接根据等级验证数量 //普通设置 直接根据等级验证数量
if (DGradeList.Count() != demodel.DistributionCommissionList.Count()) { if (DGradeList.Count() != demodel.DistributionCommissionList.Count())
{
return ApiResult.ParamIsNull("分销佣金列表数量不正确"); return ApiResult.ParamIsNull("分销佣金列表数量不正确");
} }
foreach (var item in DGradeList) { foreach (var item in DGradeList)
{
var defaultModel = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).FirstOrDefault(); var defaultModel = demodel.DistributionCommissionList.Where(x => x.DistributorGrade == item.Id).FirstOrDefault();
if (defaultModel == null) if (defaultModel == null)
{ {
...@@ -1822,8 +1924,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1822,8 +1924,10 @@ namespace Mall.WebApi.Controllers.MallBase
defaultModel.SpecificationSort = ""; defaultModel.SpecificationSort = "";
} }
} }
else { else
if (demodel.IsCustomSpecification != 1) { {
if (demodel.IsCustomSpecification != 1)
{
return ApiResult.ParamIsNull("无法开启详细设置"); return ApiResult.ParamIsNull("无法开启详细设置");
} }
} }
...@@ -1838,7 +1942,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1838,7 +1942,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
MGradeList = productModule.GetMemberGradeList(new Model.Extend.User.RB_Member_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); MGradeList = productModule.GetMemberGradeList(new Model.Extend.User.RB_Member_Grade_Extend() { Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
} }
if (!MGradeList.Any()) { if (!MGradeList.Any())
{
return ApiResult.ParamIsNull("单独设置会员价需先添加会员等级"); return ApiResult.ParamIsNull("单独设置会员价需先添加会员等级");
} }
if (demodel.IsCustomSpecification == 2) if (demodel.IsCustomSpecification == 2)
...@@ -1846,7 +1951,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1846,7 +1951,7 @@ namespace Mall.WebApi.Controllers.MallBase
if (demodel.MemberPriceList == null || !demodel.MemberPriceList.Any()) if (demodel.MemberPriceList == null || !demodel.MemberPriceList.Any())
{ {
return ApiResult.ParamIsNull("请传递会员价格列表"); return ApiResult.ParamIsNull("请传递会员价格列表");
} }
if (MGradeList.Count() != demodel.MemberPriceList.Count()) if (MGradeList.Count() != demodel.MemberPriceList.Count())
{ {
return ApiResult.ParamIsNull("会员价格列表数量不正确"); return ApiResult.ParamIsNull("会员价格列表数量不正确");
...@@ -1873,16 +1978,19 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1873,16 +1978,19 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.ProxyRises ??= 0; demodel.ProxyRises ??= 0;
demodel.ProxyMoney ??= 0; demodel.ProxyMoney ??= 0;
demodel.IsProcurement = 2;//新增时 demodel.IsProcurement = 2;//新增时
if (demodel.IsProxy == 1 && demodel.CostPrice > 0) { if (demodel.IsProxy == 1 && demodel.CostPrice > 0)
{
decimal ProxyMoney = 0; decimal ProxyMoney = 0;
if (demodel.ProxyType == 1) if (demodel.ProxyType == 1)
{ {
ProxyMoney = Math.Round((demodel.CostPrice ?? 0) * (1 + (demodel.ProxyRises ?? 0)), 2, MidpointRounding.AwayFromZero); ProxyMoney = Math.Round((demodel.CostPrice ?? 0) * (1 + (demodel.ProxyRises ?? 0)), 2, MidpointRounding.AwayFromZero);
} }
else { else
{
ProxyMoney = (demodel.CostPrice ?? 0) + (demodel.ProxyRises ?? 0); ProxyMoney = (demodel.CostPrice ?? 0) + (demodel.ProxyRises ?? 0);
} }
if (ProxyMoney != (demodel.ProxyMoney ?? 0)) { if (ProxyMoney != (demodel.ProxyMoney ?? 0))
{
return ApiResult.ParamIsNull("代理价格不正确"); return ApiResult.ParamIsNull("代理价格不正确");
} }
} }
...@@ -1892,7 +2000,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1892,7 +2000,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -1902,11 +2011,12 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1902,11 +2011,12 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductGoodsQuickUpdate() { public ApiResult SetProductGoodsQuickUpdate()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
string GoodsIds = parms.GetStringValue("GoodsIds"); string GoodsIds = parms.GetStringValue("GoodsIds");
int Type = parms.GetInt("Type", 0);//1排序 2商品名称 3快速购买 4上架 5下架 6删除 7运费 8限购 9积分 10快速购买 11面议 int Type = parms.GetInt("Type", 0);//1排序 2商品名称 3快速购买 4上架 5下架 6删除 7运费 8限购 9积分 10快速购买 11面议,12 供应商
int Sort = parms.GetInt("Sort", 0); int Sort = parms.GetInt("Sort", 0);
string GoodsName = parms.GetStringValue("GoodsName"); string GoodsName = parms.GetStringValue("GoodsName");
int FreightId = parms.GetInt("FreightId", 0);//运费 int FreightId = parms.GetInt("FreightId", 0);//运费
...@@ -1919,19 +2029,28 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1919,19 +2029,28 @@ namespace Mall.WebApi.Controllers.MallBase
int IsMultipleDeduction = parms.GetInt("IsMultipleDeduction", 2);//是否多件抵扣 int IsMultipleDeduction = parms.GetInt("IsMultipleDeduction", 2);//是否多件抵扣
int IsQuickBuy = parms.GetInt("IsQuickBuy", 2);//快速购买 int IsQuickBuy = parms.GetInt("IsQuickBuy", 2);//快速购买
int IsGoodsNegotiable = parms.GetInt("IsGoodsNegotiable", 2);//商品面议 int IsGoodsNegotiable = parms.GetInt("IsGoodsNegotiable", 2);//商品面议
int SupplierId = parms.GetInt("SupplierId", 0);//供应商
if (string.IsNullOrEmpty(GoodsIds)) if (string.IsNullOrEmpty(GoodsIds))
{ {
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
if (Type == 2) { if (Type == 2)
if (string.IsNullOrEmpty(GoodsName)) { {
if (string.IsNullOrEmpty(GoodsName))
{
return ApiResult.ParamIsNull("请传递商品名称"); return ApiResult.ParamIsNull("请传递商品名称");
} }
} }
else if (Type == 12)
{
if (SupplierId == 0 && req.TenantId==1 && req.MallBaseId == 1)
{
return ApiResult.ParamIsNull("请选择供应商");
}
}
bool flag = productModule.SetProductGoodsQuickUpdate(GoodsIds, Type, Sort, GoodsName, FreightId, LimitBuyGoodsNum, LimitBuyOrderNum, IntegralPresent bool flag = productModule.SetProductGoodsQuickUpdate(GoodsIds, Type, Sort, GoodsName, FreightId, LimitBuyGoodsNum, LimitBuyOrderNum, IntegralPresent
, IntegralPresentType, PointsDeduction, PointsDeductionType, IsMultipleDeduction, IsQuickBuy, IsGoodsNegotiable, req.TenantId, req.MallBaseId); , IntegralPresentType, PointsDeduction, PointsDeductionType, IsMultipleDeduction, IsQuickBuy, IsGoodsNegotiable, SupplierId, req.TenantId, req.MallBaseId);
if (flag) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -1947,11 +2066,13 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1947,11 +2066,13 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult DelProcudtGoodsInfo() { public ApiResult DelProcudtGoodsInfo()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0); int GoodsId = parms.GetInt("GoodsId", 0);
if (GoodsId <= 0) { if (GoodsId <= 0)
{
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -1960,7 +2081,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1960,7 +2081,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -2013,12 +2135,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2013,12 +2135,14 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetProductGoodsProxy() { public ApiResult SetProductGoodsProxy()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0); int GoodsId = parms.GetInt("GoodsId", 0);
string CategoryStr = parms.GetStringValue("CategoryStr"); string CategoryStr = parms.GetStringValue("CategoryStr");
if (GoodsId <= 0) { if (GoodsId <= 0)
{
return ApiResult.ParamIsNull("请传递商品id"); return ApiResult.ParamIsNull("请传递商品id");
} }
if (string.IsNullOrEmpty(CategoryStr) || CategoryStr == "[]") if (string.IsNullOrEmpty(CategoryStr) || CategoryStr == "[]")
...@@ -2035,7 +2159,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2035,7 +2159,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult CancelGoodsProxy() { public ApiResult CancelGoodsProxy()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
...@@ -2051,7 +2176,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2051,7 +2176,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -2061,7 +2187,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2061,7 +2187,8 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetGoodsProxyStatus() { public ApiResult SetGoodsProxyStatus()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0); int GoodsId = parms.GetInt("GoodsId", 0);
...@@ -2107,7 +2234,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2107,7 +2234,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请选择商品状态"); return ApiResult.ParamIsNull("请选择商品状态");
} }
if (string.IsNullOrEmpty(CategoryList)) { if (string.IsNullOrEmpty(CategoryList))
{
return ApiResult.ParamIsNull("请选择商品分类"); return ApiResult.ParamIsNull("请选择商品分类");
} }
List<int> CategoryIdList = new List<int>(); List<int> CategoryIdList = new List<int>();
......
...@@ -243,6 +243,22 @@ namespace Mall.WebApi.Controllers.User ...@@ -243,6 +243,22 @@ namespace Mall.WebApi.Controllers.User
} }
} }
/// <summary>
/// 根据地区名称获取地区列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public virtual ApiResult GetDestinationListByNames()
{
var request = RequestParm;
var userInfo = AppletUserInfo;
JObject parm = JObject.Parse(request.msg.ToString());
var area = parm.GetStringValue("area");
var where = Common.Plugin.JsonHelper.DeserializeObject<string[]>(area);
var list = userModule.GetDestinationListByNames(where);
return ApiResult.Success(data: list.Select(qitem => new { qitem.ID, qitem.Name, qitem.CodeLevel }));
}
#endregion #endregion
#region 收藏商品 #region 收藏商品
......
...@@ -334,6 +334,7 @@ namespace Mall.WebApi.Controllers.User ...@@ -334,6 +334,7 @@ namespace Mall.WebApi.Controllers.User
OtherType = 13, OtherType = 13,
Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "生成财务单据", Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "生成财务单据",
detailList, detailList,
RB_Depart_Id= Config.ExpendDepartment
}; };
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey); string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new var resultInfo = new
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
"ViewFileSiteUrl": "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com", "ViewFileSiteUrl": "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com",
"ImKey": "b612b31e837c79c68f141aeb719d2b20", "ImKey": "b612b31e837c79c68f141aeb719d2b20",
"ImSecret": "66000451fb72", "ImSecret": "66000451fb72",
"Mongo": "mongodb://192.168.2.214:27017", //"Mongo": "mongodb://192.168.2.214:27017",
//"Mongo": "mongodb://47.96.25.130:27017", "Mongo": "mongodb://47.96.25.130:27017",
"MongoDBName": "Mall", "MongoDBName": "Mall",
"ProjectUrl": "D:/project/GitProject/mallapp", "ProjectUrl": "D:/project/GitProject/mallapp",
"DeveloperKitsPort": "15720", "DeveloperKitsPort": "15720",
...@@ -35,24 +35,25 @@ ...@@ -35,24 +35,25 @@
"RB_Branch_Id": 49, //所属公司id "RB_Branch_Id": 49, //所属公司id
"IncomeDirector": 1756, //财务收入创建人 "IncomeDirector": 1756, //财务收入创建人
"IncomeBranchId": 49, //财务收入创建人公司 "IncomeBranchId": 49, //财务收入创建人公司
"IncomeDepartment": 331,
"ExpendDirector": 1756, //财务支出创建人 "ExpendDirector": 1756, //财务支出创建人
"ExpendBranchId": 49, //财务支出创建人公司 "ExpendBranchId": 49, //财务支出创建人公司
"ExpendDepartment": 331,
"RebornDMC": "reborn_dmc", "RebornDMC": "reborn_dmc",
"IncomeFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallIn", "IncomeFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallIn",
"PaymentFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallOut", "PaymentFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallOut",
"FinanceKey": "FinanceMallInsertToERPViitto2020", "FinanceKey": "FinanceMallInsertToERPViitto2020",
"SettlementRate": "0.60", "SettlementRate": "0.60",
"RedisSetting": {
"RedisServer": "192.168.2.214",
"RedisPort": "6379",
"RedisPwd": "123456"
},
//"RedisSetting": { //"RedisSetting": {
// "RedisServer": "47.96.23.199", // "RedisServer": "192.168.2.214",
// "RedisPort": "6379", // "RedisPort": "6379",
// "RedisPwd": "Viitto2018" // "RedisPwd": "123456"
//}, //},
"RedisSetting": {
"RedisServer": "47.96.23.199",
"RedisPort": "6379",
"RedisPwd": "Viitto2018"
},
"VirtualDirectory": "WebFile", "VirtualDirectory": "WebFile",
"FileService": "2", "FileService": "2",
"IsNormalServer": 2, "IsNormalServer": 2,
......
...@@ -266,7 +266,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -266,7 +266,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OrderSource = 16, OrderSource = 16,
Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据", Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据",
detailList, detailList,
OriginalFee OriginalFee,
RB_Depart_Id= Config.IncomeDepartment
}; };
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey); string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new var resultInfo = new
...@@ -1171,7 +1172,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A ...@@ -1171,7 +1172,8 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
OtherType = 14, OtherType = 14,
ReFinanceId = 0, ReFinanceId = 0,
Remark, Remark,
detailList detailList,
RB_Depart_Id = Config.ExpendDepartment
}; };
string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey); string sign = EncryptionHelper.AesEncrypt(JsonHelper.Serialize(financeObj), Config.FinanceKey);
var resultInfo = new var resultInfo = new
......
...@@ -30,8 +30,10 @@ ...@@ -30,8 +30,10 @@
"sTenpayNotify": "http://mallapi.oytour.com/api/WeChatNotify/Notify", //微信回调地址 "sTenpayNotify": "http://mallapi.oytour.com/api/WeChatNotify/Notify", //微信回调地址
"IncomeDirector": 1756, //财务收入创建人 "IncomeDirector": 1756, //财务收入创建人
"IncomeBranchId": 49, //财务收入创建人公司 "IncomeBranchId": 49, //财务收入创建人公司
"IncomeDepartment": 331,
"ExpendDirector": 1756, //财务支出创建人 "ExpendDirector": 1756, //财务支出创建人
"ExpendBranchId": 49, //财务支出创建人公司 "ExpendBranchId": 49, //财务支出创建人公司
"ExpendDepartment": 331,
"NetworkDirector": 1756, //网络主管的id,用于新建供应商账户的时候的创建人 "NetworkDirector": 1756, //网络主管的id,用于新建供应商账户的时候的创建人
"RB_Branch_Id": 49, //所属公司id "RB_Branch_Id": 49, //所属公司id
"RebornDMC": "reborn_dmc", "RebornDMC": "reborn_dmc",
......
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