public Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsResultDTO GetDistributorProfits(Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsSearchDTO search) { //定义返回值 Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsResultDTO result; try { //调用代理方法 result = base.Channel.GetDistributorProfits(search); } catch { //抛异常 throw; } finally { //关链接 ChannelClose(); } //返回结果 return(result); }
/// <summary> /// 查询分销统计信息 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsResultDTO GetDistributorProfits(Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsSearchDTO search) { base.Do(); Stopwatch timer = new Stopwatch(); timer.Start(); var result = this.GetDistributorProfitsExt(search); timer.Stop(); LogHelper.Debug(string.Format("DistributorSV.GetDistributorProfits:耗时:{0}。入参:search:{1},\r\n出参:{2}", timer.ElapsedMilliseconds, JsonHelper.JsonSerializer(search), JsonHelper.JsonSerializer(result))); return(result); }
/// <summary> /// 查询分销统计信息 /// </summary> /// <param name="search">查询类</param> /// <returns>结果</returns> public Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsResultDTO GetDistributorProfitsExt(Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsSearchDTO search) { Jinher.AMP.BTP.Deploy.CustomDTO.DistributorProfitsResultDTO result = new Deploy.CustomDTO.DistributorProfitsResultDTO(); if (search == null) { return(result); } //查询等级。0:本人;1:一级;2:二级 if (search.SearchType == 0) { var getResult = DSSBP.Instance.GetDistributorProfits(search); if (getResult != null && getResult.ResultCode == 200 && getResult.Data != null) { result = getResult.Data; } if (result.DistributorProfitsInfoList == null || !result.DistributorProfitsInfoList.Any()) { result.DistributorProfitsInfoList = new List <DistributorProfitsInfoDTO>(); result.DistributorProfitsInfoList.Add(new DistributorProfitsInfoDTO()); } //待收益佣金、已收益佣金改为btp实时计算 //本人只返回一条数据,这里只处理第一条数据 result.DistributorProfitsInfoList.First().CommmissionUnPay = (from orderShare in OrderShare.ObjectSet() join order in CommodityOrder.ObjectSet() on orderShare.OrderId equals order.Id join os in CommodityOrderService.ObjectSet() on orderShare.OrderId equals os.Id into tmp from orderService in tmp.DefaultIfEmpty() where new[] { 9, 10, 11 }.Contains(orderShare.PayeeType) && ( new[] { 1, 2, 8, 9, 10, 12, 13, 14 }.Contains(order.State) || ( order.State == 3 && new[] { 3, 5, 10, 12, 13 }.Contains(orderService.State) ) ) && orderShare.PayeeId == search.UserId && order.AppId == search.AppId select orderShare.Commission).ToList().Sum(); result.DistributorProfitsInfoList.First().CommissionAmount = (from orderShare in OrderShare.ObjectSet() join order in CommodityOrder.ObjectSet() on orderShare.OrderId equals order.Id join os in CommodityOrderService.ObjectSet() on orderShare.OrderId equals os.Id into tmp from orderService in tmp.DefaultIfEmpty() where new[] { 9, 10, 11 }.Contains(orderShare.PayeeType) && order.State == 3 && ( orderService.Id == null || orderService.State == 15 ) && orderShare.PayeeId == search.UserId && order.AppId == search.AppId select orderShare.Commission).ToList().Sum(); } else if (search.SearchType == 1) { var getResult = DSSBP.Instance.GetDistributorList(search); if (getResult != null && getResult.ResultCode == 200 && getResult.Data != null) { result = getResult.Data; } } else if (search.SearchType == 2) { var getResult = DSSBP.Instance.GetDistributorList(search); if (getResult != null && getResult.ResultCode == 200 && getResult.Data != null) { result = getResult.Data; } } return(result); }