Commit 4f3fa625 authored by liudong1993's avatar liudong1993
parents 47095602 15c8771c
using Mall.Common.Enum;
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 分享分类表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Share_Category
{
/// <summary>
/// 分类编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 层级
/// </summary>
public int Level { get; set; }
/// <summary>
/// 父节点编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 删除状态(1-删除)
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateDate { get; set; }
}
}
using Mall.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Entity.MarketingCenter
{
/// <summary>
/// 分享详情实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Share_Friend
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 分类编号
/// </summary>
public int CateId { get; set; }
/// <summary>
/// 商品编号
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImg { get; set; }
/// <summary>
/// 素材图片
/// </summary>
public string MaterialImg { get; set; }
/// <summary>
/// 素材文案
/// </summary>
public string MaterialInfo { get; set; }
/// <summary>
/// 链接地址
/// </summary>
public string LinkUrl { get; set; }
/// <summary>
/// 是否置顶(1-是)
/// </summary>
public int IsTop { get; set; }
/// <summary>
/// 排序
/// </summary>
public int SortNum { get; set; }
/// <summary>
/// 删除状态(1-删除)
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 更新人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateDate { get; set; }
}
}
using Mall.Model.Entity.MarketingCenter;
using System;
using System.Collections.Generic;
using VT.FW.DB;
namespace Mall.Model.Extend.MarketingCenter
{
/// <summary>
/// 分享分类扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Share_Category_Extend : RB_Share_Category
{
}
}
using Mall.Model.Entity.MarketingCenter;
using System;
using VT.FW.DB;
namespace Mall.Model.Extend.MarketingCenter
{
/// <summary>
/// 分享详情扩展实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Share_Friend_Extend : RB_Share_Friend
{
}
}
\ No newline at end of file
......@@ -13,6 +13,9 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderCommission_Extend : RB_Goods_OrderCommission
{
public string OrderDetailIds { get; set; }
/// <summary>
/// ids
/// </summary>
......
using Mall.Common.Enum;
using Mall.Model.Extend.MarketingCenter;
using Mall.Repository.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
using System.Linq;
namespace Mall.Module.MarketingCenter
{
/// <summary>
/// 分享处理类
/// </summary>
public class ShareModule
{
/// <summary>
/// 分享分类仓储层对象
/// </summary>
private readonly RB_Share_CategoryRepository share_CategoryRepository = new RB_Share_CategoryRepository();
/// <summary>
/// 分享详情实体仓储层对象
/// </summary>
private readonly RB_Share_FriendRepository share_FriendRepository = new RB_Share_FriendRepository();
/// <summary>
/// 获取分享分类分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Category_Extend> GetShareCategoryPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Share_Category_Extend query)
{
return share_CategoryRepository.GetShareCategoryPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取分享分类列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<object> GetShareCategoryListModule(RB_Share_Category_Extend query)
{
List<object> resultList = new List<object>();
var list = share_CategoryRepository.GetShareCategoryListRepository(query);
if (list != null)
{
var leavelList = list.GroupBy(qitem => new { qitem.Level }).OrderBy(qitem => qitem.Key.Level);
foreach (var item in list.Where(qitem => qitem.Level == 1))
{
List<object> secondList = new List<object>();
var subList = list.Where(qitem => qitem.Level == 2 && qitem.ParentId == item.Id).ToList();
foreach (var subItem in subList)
{
var subModel = new
{
subItem.Id,
subItem.Level,
subItem.Name,
subItem.ParentId,
hasChildren = list.Where(qitem => qitem.Level == 3 && qitem.ParentId == subItem.Id)?.Count() > 0,
children = list.Where(qitem => qitem.Level == 3 && qitem.ParentId == subItem.Id).Select(qitem => new { qitem.Id, qitem.Name, qitem.Level, qitem.ParentId })
};
secondList.Add(subModel);
}
var rootModel = new
{
item.Id,
item.Level,
item.Name,
item.ParentId,
hasChildren = secondList?.Count>0,
children = secondList
};
resultList.Add(rootModel);
}
}
return resultList;
}
/// <summary>
/// 获取分享详情分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Friend_Extend> GetShareFriendPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Share_Friend_Extend query)
{
return share_FriendRepository.GetShareFriendPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取分享详情列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Friend_Extend> GetShareFriendListModule(RB_Share_Friend_Extend query)
{
return share_FriendRepository.GetShareFriendListRepository(query);
}
/// <summary>
/// 新增修改分类
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetShareCategoryModule(RB_Share_Category_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Category_Extend.Name),extModel.Name },
{nameof(RB_Share_Category_Extend.Level),extModel.Level },
{nameof(RB_Share_Category_Extend.ParentId),extModel.ParentId },
{nameof(RB_Share_Category_Extend.UpdateDate),extModel.UpdateDate },
};
flag = share_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Category_Extend.Id), extModel.Id));
}
else
{
var newId = share_CategoryRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 删除分享分类
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveShareCategoryModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Category_Extend.Status),(int) DateStateEnum.Delete},
};
flag = share_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Category_Extend.Id), Id));
return flag;
}
/// <summary>
/// 获取分享分类实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Share_Category_Extend GetShareCategoryModule(object Id)
{
return share_CategoryRepository.GetEntity<RB_Share_Category_Extend>(Id);
}
/// <summary>
/// 新增修改分享详情
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetShareFriendModule(RB_Share_Friend_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.CateId),extModel.CateId },
{nameof(RB_Share_Friend_Extend.GoodsId),extModel.GoodsId },
{nameof(RB_Share_Friend_Extend.CoverImg),extModel.CoverImg },
{nameof(RB_Share_Friend_Extend.MaterialImg),extModel.MaterialImg },
{nameof(RB_Share_Friend_Extend.MaterialInfo),extModel.MaterialInfo },
{nameof(RB_Share_Friend_Extend.LinkUrl),extModel.LinkUrl },
{nameof(RB_Share_Friend_Extend.IsTop),extModel.IsTop },
{nameof(RB_Share_Friend_Extend.SortNum),extModel.SortNum },
{nameof(RB_Share_Friend_Extend.UpdateBy),extModel.UpdateBy },
{nameof(RB_Share_Friend_Extend.UpdateDate),extModel.UpdateDate },
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), extModel.Id));
}
else
{
var newId = share_FriendRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取分享详情实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Share_Friend_Extend GetShareFriendModule(object Id)
{
return share_FriendRepository.GetEntity<RB_Share_Friend_Extend>(Id);
}
/// <summary>
/// 根据编号删除分享详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveShareFriendModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.Status),(int) DateStateEnum.Delete},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
}
}
......@@ -80,17 +80,34 @@ namespace Mall.Module.MarketingCenter
{
var list = orderRepository.GetFXOrderProfitLossList(pageIndex, pageSize, out count, dmodel);
if (list != null && list.Any())
{
//查询订单的返佣信息
string orderDetailIds = string.Join(",", list.Select(x => x.Id));
//分销情况
var oclist = goods_OrderCommissionRepository.GetListGroupByUser_V2(new RB_Goods_OrderCommission_Extend { TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId, OrderDetailIds = orderDetailIds });
foreach (var item in list)
{
item.FXCommission = (oclist != null && oclist.Any()) ? oclist.Where(x => x.OrderDetailId == item.Id).Sum(x => (x.Commission ?? 0)) : 0;
item.RemitFXCommission = (oclist != null && oclist.Any()) ? oclist.Where(x => x.OrderDetailId == item.Id && x.IsRemit == 1).Sum(x => (x.Commission ?? 0)) : 0;
}
}
return list;
}
public List<OrderStatistics_Query> GetFXAllOrderProfitLossList(OrderStatistics_Query dmodel)
{
var list = orderRepository.GetFXAllOrderProfitLossList(dmodel);
if (dmodel.IsSelectOrderCommission == 1)
if (list != null && list.Any())
{
if (list != null && list.Any())
//分销情况
//分销情况
var oclist = goods_OrderCommissionRepository.GetListGroupByUser_V2(new RB_Goods_OrderCommission_Extend { TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId, OrderIds = string.Join(",", list.Select(x => x.OrderId)) });
// var oclist = goods_OrderCommissionRepository.GetListGroupByOrderDetailIds(new RB_Goods_OrderCommission_Extend() { TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId, OrderIds = string.Join(",", list.Select(x => x.OrderId)) });
if (dmodel.IsSelectOrderCommission == 1)
{
//分销情况
var oclist = goods_OrderCommissionRepository.GetListGroupByOrderDetailIds(new RB_Goods_OrderCommission_Extend() { TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId, OrderIds = string.Join(",", list.Select(x => x.OrderId)) });
if (oclist.Any())
{
//获取用户
......@@ -115,41 +132,54 @@ namespace Mall.Module.MarketingCenter
item.UserName = umodel?.Name ?? "";
item.Mobile = umodel?.Moblie ?? "";
item.Name = dislist.Where(x => x.UserId == item.UserId).FirstOrDefault()?.Name ?? "";
if (item.Type == 1)
if (item.CommissionType == 1 || item.CommissionType == 4)
{
if (item.Grade == 0)
if (item.Type == 1)
{
item.GradeDescription = "自购返利";
if (item.Grade == 0)
{
item.GradeDescription = "自购返利";
}
else if (item.Grade == 1)
{
item.GradeDescription = "一级佣金";
}
else if (item.Grade == 2)
{
item.GradeDescription = "二级佣金";
}
else if (item.Grade == 3)
{
item.GradeDescription = "三级佣金";
}
}
else if (item.Grade == 1)
else if (item.Type == 2)
{
item.GradeDescription = "一级佣金";
var hpGModel = HpgradeList.Where(x => x.Id == item.Grade).FirstOrDefault();
item.GradeDescription = hpGModel?.GradeName ?? "暂无等级";
}
else if (item.Grade == 2)
else if (item.Type == 3)
{
item.GradeDescription = "二级佣金";
}
else if (item.Grade == 3)
{
item.GradeDescription = "三级佣金";
var fxGModel = FXGradeList.Where(x => x.Id == item.Grade).FirstOrDefault();
item.GradeDescription = fxGModel?.GradeName ?? "暂无等级";
}
}
else if (item.Type == 2)
else if (item.CommissionType == 2)
{
var hpGModel = HpgradeList.Where(x => x.Id == item.Grade).FirstOrDefault();
item.GradeDescription = hpGModel?.GradeName ?? "暂无等级";
item.GradeDescription = "供应商返佣";
}
else if (item.Type == 3)
else if (item.CommissionType == 3)
{
var fxGModel = FXGradeList.Where(x => x.Id == item.Grade).FirstOrDefault();
item.GradeDescription = fxGModel?.GradeName ?? "暂无等级";
item.GradeDescription = "微店返佣";
}
}
}
foreach (var item in list)
{
item.OrderCommissionList = oclist.Where(x => x.OrderDetailId == item.Id).ToList();
}
}
foreach (var item in list)
{
item.OrderCommissionList = oclist.Where(x => x.OrderDetailId == item.Id).ToList();
item.FXCommission = (item.OrderCommissionList != null && item.OrderCommissionList.Any()) ? item.OrderCommissionList.Where(x => x.OrderDetailId == item.Id).Sum(x => (x.Commission ?? 0)) : 0;
item.RemitFXCommission = (item.OrderCommissionList != null && item.OrderCommissionList.Any()) ? item.OrderCommissionList.Where(x => x.OrderDetailId == item.Id && x.IsRemit == 1).Sum(x => (x.Commission ?? 0)) : 0;
}
}
return list;
......@@ -169,7 +199,7 @@ namespace Mall.Module.MarketingCenter
var HpgradeList = new List<RB_Distributor_HPGradeInfo_Extend>();
if (oclist.Where(x => x.Type == 2).Any())
{
string gradeIds = string.Join(",", oclist.Where(x => x.Type == 2 &&(x.CommissionType == 1|| x.CommissionType == 4)).Select(x => x.Grade).Distinct());
string gradeIds = string.Join(",", oclist.Where(x => x.Type == 2 && (x.CommissionType == 1 || x.CommissionType == 4)).Select(x => x.Grade).Distinct());
HpgradeList = distributor_HPGradeInfoRepository.GetList(new RB_Distributor_HPGradeInfo_Extend() { GradeIds = gradeIds, TenantId = model.TenantId, MallBaseId = model.MallBaseId }, true);
}
var FXGradeList = new List<RB_Distributor_FXGrade_Extend>();
......
......@@ -87,7 +87,7 @@ namespace Mall.Repository.AppletWeChat
builder.Append($" AND a.{nameof(RB_Live_HouseExtension_Extend.MallBaseId)}={query.MallBaseId}");
}
}
builder.Append($" order by a.{nameof(RB_Live_HouseExtension_Extend.roomid)} desc,a.{nameof(RB_Live_HouseExtension_Extend.start_time)} desc");
builder.Append($" order by a.{nameof(RB_Live_HouseExtension_Extend.ID)} asc");
return GetPage<RB_Live_HouseExtension_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
}
......
using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Extend.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Mall.Repository.MarketingCenter
{
/// <summary>
/// 分享分类仓储层
/// </summary>
public class RB_Share_CategoryRepository : BaseRepository<RB_Share_Category>
{
/// <summary>
/// 获取分享分类分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Category_Extend> GetShareCategoryPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Share_Category_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_share_category
WHERE 1=1 AND Status=0
");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.Name)} like '%{query.Name}%'");
}
}
return GetPage<RB_Share_Category_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取分享分类列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Category_Extend> GetShareCategoryListRepository(RB_Share_Category_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_share_category
WHERE 1=1 AND Status=0
");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Share_Category_Extend.Name)} like '%{query.Name}%'");
}
}
return Get<RB_Share_Category_Extend>(builder.ToString()).ToList();
}
}
}
using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Extend.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Mall.Repository.MarketingCenter
{
/// <summary>
/// 分享详情实体仓储层
/// </summary>
public class RB_Share_FriendRepository : BaseRepository<RB_Share_Friend>
{
/// <summary>
/// 获取分享详情分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Friend_Extend> GetShareFriendPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Share_Friend_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_share_friend
WHERE 1=1 AND Status=0
");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.MallBaseId)}={query.MallBaseId}");
}
}
return GetPage<RB_Share_Friend_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取分享详情列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Share_Friend_Extend> GetShareFriendListRepository(RB_Share_Friend_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_share_friend
WHERE 1=1 AND Status=0
");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.MallBaseId)}={query.MallBaseId}");
}
}
return Get<RB_Share_Friend_Extend>(builder.ToString()).ToList();
}
}
}
\ No newline at end of file
......@@ -124,10 +124,14 @@ where {where} group by oc.OrderId,oc.UserId,oc.Grade,oc.Type order by oc.Grade a
{
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
if (!string.IsNullOrEmpty(dmodel.OrderDetailIds))
{
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderDetailId)} in({dmodel.OrderDetailIds})";
}
string sql = $@"SELECT oc.OrderId,oc.UserId,oc.Grade,oc.Type,oc.CommissionState,SUM(oc.Commission) as Commission,oc.CommissionType FROM All_Commission oc
string sql = $@"SELECT oc.OrderId,oc.OrderDetailId,oc.UserId,oc.Grade,oc.Type,oc.CommissionState,SUM(oc.Commission) as Commission,oc.CommissionType FROM All_Commission oc
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5)
where {where} group by oc.OrderId,oc.UserId,oc.Grade,oc.Type,oc.CommissionType order by oc.Grade asc";
where {where} group by oc.OrderDetailId,oc.UserId,oc.Grade,oc.Type,oc.CommissionType order by oc.Grade asc";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
......
......@@ -1287,27 +1287,27 @@ GROUP BY od.GoodsId,o.OrderId
}
}
// string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,0 as Paid
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
//from rb_goods_orderdetail as b
//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 (SELECT SUM(Commission) as FXCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from rb_goods_ordercommission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
//GROUP BY b.Id order by b.Id desc";
string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
from rb_goods_orderdetail as b
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 (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
GROUP BY b.Id order by b.Id desc";
......@@ -1359,29 +1359,29 @@ GROUP BY b.Id order by b.Id desc";
}
// string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,0 as Paid
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
//from rb_goods_orderdetail as b
//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 (SELECT SUM(Commission) as FXCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from rb_goods_ordercommission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
//GROUP BY b.Id ";
string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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 B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
from rb_goods_orderdetail as b
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 (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
GROUP BY b.Id ";
return Get<OrderStatistics_Query>(sql).ToList();
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Extend.MarketingCenter;
using Mall.Module.MarketingCenter;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mall.WebApi.Controllers.MarketingCenter
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class ShareController : BaseController
{
/// <summary>
/// 分享处理类对象
/// </summary>
private readonly ShareModule shareModule = new ShareModule();
/// <summary>
/// 获取分享分类分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetShareCategoryPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Share_Category_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var list = shareModule.GetShareCategoryPageListModule(pagelist.pageIndex, pagelist.pageSize, out long count, query);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取分享分类列表
/// </summary>
/// <returns></returns>
public ApiResult GetShareCategoryList()
{
var query = JsonConvert.DeserializeObject<RB_Share_Category_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = RequestParm.MallBaseId;
var list = shareModule.GetShareCategoryListModule(query);
return ApiResult.Success("", list);
}
/// <summary>
/// 新增修改分享分类
/// </summary>
/// <returns></returns>
public ApiResult SetShareCategory()
{
var extModel = JsonConvert.DeserializeObject<RB_Share_Category_Extend>(RequestParm.msg.ToString());
extModel.TenantId = UserInfo.TenantId;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.CreateDate = DateTime.Now;
extModel.UpdateDate = DateTime.Now;
bool flag = shareModule.SetShareCategoryModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 删除分享分类
/// </summary>
/// <returns></returns>
public ApiResult RemoveShareCategory()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
int Id = parm.GetInt("Id", 0);
bool flag = shareModule.RemoveShareCategoryModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取分享分类
/// </summary>
/// <returns></returns>
public ApiResult GetShareCategory()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
int Id = parm.GetInt("Id", 0);
var extModel = shareModule.GetShareCategoryModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 获取分享详情分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetShareFriendPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Share_Friend_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var list = shareModule.GetShareFriendPageListModule(pagelist.pageIndex, pagelist.pageSize, out long count, query);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取分享详情列表
/// </summary>
/// <returns></returns>
public ApiResult GetShareFriendList()
{
var query = JsonConvert.DeserializeObject<RB_Share_Friend_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = RequestParm.MallBaseId;
var list = shareModule.GetShareFriendListModule(query);
return ApiResult.Success("", list);
}
/// <summary>
/// 新增修改分享详情
/// </summary>
/// <returns></returns>
public ApiResult SetShareFriend()
{
var extModel = JsonConvert.DeserializeObject<RB_Share_Friend_Extend>(RequestParm.msg.ToString());
extModel.TenantId = UserInfo.TenantId;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.CreateDate = DateTime.Now;
extModel.UpdateDate = DateTime.Now;
bool flag = shareModule.SetShareFriendModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号删除分享详情
/// </summary>
/// <returns></returns>
public ApiResult RemoveShareFriend()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
int Id = parm.GetInt("Id", 0);
bool flag = shareModule.RemoveShareFriendModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取分享详情实体
/// </summary>
/// <returns></returns>
public ApiResult GetShareFriend()
{
JObject parm = JObject.Parse(RequestParm.msg.ToString());
int Id = parm.GetInt("Id", 0);
var extModel = shareModule.GetShareFriendModule(Id);
return ApiResult.Success(data: extModel);
}
}
}
\ No newline at end of file
......@@ -1834,7 +1834,7 @@ namespace Mall.WebApi.Controllers.User
}
if (string.IsNullOrEmpty(demodel.Logo))
{
demodel.Name = userInfo.Photo;
demodel.Logo = userInfo.Photo;
}
demodel.UserId = userInfo.UserId;
demodel.GradeId = 0;
......
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