|
@@ -16,6 +16,7 @@ using ZhonTai.Admin.Repositories.Project;
|
|
|
using ZhonTai.Admin.Repositories.ProjectLink;
|
|
|
using ZhonTai.Admin.Services.DiTuiAPI.Dto;
|
|
|
using ZhonTai.Admin.Services.Notice.Dto;
|
|
|
+using ZhonTai.Admin.Services.Project;
|
|
|
using ZhonTai.Admin.Services.ProjectLink.Dto;
|
|
|
using ZhonTai.DynamicApi;
|
|
|
using ZhonTai.DynamicApi.Attributes;
|
|
@@ -71,17 +72,18 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
UseCount = m.Sum(m.Value.IsUse == 1 ? 1 : 0),
|
|
|
ProjectName = ""
|
|
|
});
|
|
|
+
|
|
|
var priceList = await _projectConfigRepository.Select
|
|
|
.Where(m=> m.EffectDate < DateTime.Now)
|
|
|
.OrderByDescending(m => m.DrawAmount)
|
|
|
- .GroupBy(m => m.ProjectId)
|
|
|
+ //.GroupBy(m => m.ProjectId)
|
|
|
.ToListAsync(
|
|
|
m => new
|
|
|
{
|
|
|
- ProjectId = m.Value.ProjectId,
|
|
|
- ProjectPriceId = m.Value.ProjectPriceId,
|
|
|
- DrawAmount = m.Value.DrawAmount,
|
|
|
- EffectDate = m.Value.EffectDate,
|
|
|
+ ProjectId = m.ProjectId,
|
|
|
+ ProjectPriceId = m.ProjectPriceId,
|
|
|
+ DrawAmount = m.DrawAmount,
|
|
|
+ EffectDate = m.EffectDate,
|
|
|
});
|
|
|
|
|
|
|
|
@@ -93,24 +95,41 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
m.Id,
|
|
|
m.Name,
|
|
|
m.Logo,
|
|
|
- m.MaxPrice.ToString(),
|
|
|
+ //m.MaxPrice.ToString(),
|
|
|
+ "",
|
|
|
"T+" + m.SettleDay.ToString() + "结算"
|
|
|
));
|
|
|
-
|
|
|
- if(priceList.Count() >0)
|
|
|
+ foreach(var projectItem in listProject)
|
|
|
{
|
|
|
- foreach(var priceItem in priceList)
|
|
|
- {
|
|
|
- foreach (var projectItem in listProject)
|
|
|
+ var maxPrice = await _projectPriceRepository
|
|
|
+ .Select
|
|
|
+ .DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(m => m.ProjectId == projectItem.Id)
|
|
|
+ .OrderByDescending(m => m.Price)
|
|
|
+ .FirstAsync(m => new
|
|
|
{
|
|
|
- if(priceItem.ProjectId == projectItem.Id)
|
|
|
- {
|
|
|
- projectItem.Price = (Convert.ToDecimal(projectItem.Price) - priceItem.DrawAmount).ToString();
|
|
|
- }
|
|
|
- }
|
|
|
+ ProjectPriceId = m.Id,
|
|
|
+ ProjectPrice = m.Price
|
|
|
+ });
|
|
|
+ var priceConfig = await _projectConfigRepository
|
|
|
+ .Select
|
|
|
+ .DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(m => m.ProjectPriceId == maxPrice.ProjectPriceId)
|
|
|
+ .FirstAsync(m => new
|
|
|
+ {
|
|
|
+ DrawAmount = m.DrawAmount
|
|
|
+ }) ;
|
|
|
+ if(priceConfig is null)
|
|
|
+ {
|
|
|
+ // 未单独设置佣金抽成 默认抽取 5% 取 一位小数
|
|
|
+ projectItem.Price = (Convert.ToDecimal(projectItem.Price) - ProjectPriceService.GetDrawAmount(Convert.ToDecimal( projectItem.Price),Convert.ToDecimal(5.00))).ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ projectItem.Price = (maxPrice.ProjectPrice - priceConfig.DrawAmount).ToString();
|
|
|
}
|
|
|
}
|
|
|
- foreach(var proItem in listProject)
|
|
|
+ foreach (var proItem in listProject)
|
|
|
{
|
|
|
proItem.Price = proItem.Price + "元";
|
|
|
}
|
|
@@ -139,19 +158,37 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
|
|
|
var result = await _projectRepository.Select.DisableGlobalFilter()
|
|
|
.Where(a => a.Id == id)
|
|
|
- .FirstAsync(a => new ProjectDescOutput(a.Id,a.Logo,a.Name,a.MaxPrice.ToString(),a.SettleDay.ToString(),a.Tips));
|
|
|
- return result;
|
|
|
+ .FirstAsync(a => new ProjectDescOutput(a.Id,a.Logo,a.Name,"",a.SettleDay.ToString(),a.Tips));
|
|
|
+
|
|
|
+ var maxPrice = await _projectPriceRepository
|
|
|
+ .Select
|
|
|
+ .DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(m => m.ProjectId == id)
|
|
|
+ .OrderByDescending(m => m.Price)
|
|
|
+ .FirstAsync(m => new
|
|
|
+ {
|
|
|
+ ProjectPriceId = m.Id,
|
|
|
+ ProjectPrice = m.Price
|
|
|
+ });
|
|
|
|
|
|
- //ProjectDescOutput projectDescOutput = new ProjectDescOutput();
|
|
|
- //var doubleUser = await _ProjectLinkRepository.Select.Where(a => a.SalesmanPhone == input.SalesmanPhone && a.ProjectId == input.ProjectId)
|
|
|
- // .FirstAsync(a => new { a.Salesman, a.SalesmanPhone, a.Id });
|
|
|
- //projectDescOutput.Id = result.Id;
|
|
|
- //projectDescOutput.Logo = result.Logo;
|
|
|
- //projectDescOutput.Name = "快手极速版";
|
|
|
- //projectDescOutput.Price = "25";
|
|
|
- //projectDescOutput.SettleDay = "T+1结算";
|
|
|
- //projectDescOutput.Description = "快手极速版APP的新用户,全国可做不限推广方式,实时进件数据,不测次播,官方直推版。";
|
|
|
- //return projectDescOutput;
|
|
|
+ var priceConfig = await _projectConfigRepository
|
|
|
+ .Select
|
|
|
+ .DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(m => m.ProjectPriceId == maxPrice.ProjectPriceId)
|
|
|
+ .FirstAsync(m => new
|
|
|
+ {
|
|
|
+ DrawAmount = m.DrawAmount
|
|
|
+ });
|
|
|
+ if (priceConfig is null)
|
|
|
+ {
|
|
|
+ // 未单独设置佣金抽成 默认抽取 5% 取 一位小数
|
|
|
+ result.Price = (Convert.ToDecimal(maxPrice.ProjectPrice) - ProjectPriceService.GetDrawAmount(Convert.ToDecimal(maxPrice.ProjectPrice), Convert.ToDecimal(5.00))).ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result.Price = (maxPrice.ProjectPrice - priceConfig.DrawAmount).ToString();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -175,10 +212,53 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
result.Prices = await _projectPriceRepository.Select.DisableGlobalFilter()
|
|
|
.Where(a => a.ProjectId == id)
|
|
|
.ToListAsync(a => new ProjectPrice(
|
|
|
+ a.Id,
|
|
|
a.Name,
|
|
|
a.Price.ToString()
|
|
|
));
|
|
|
|
|
|
+ var priceList = await _projectConfigRepository.Select
|
|
|
+ .Where(m => m.EffectDate < DateTime.Now)
|
|
|
+ .Where(m => m.ProjectId == id)
|
|
|
+ .OrderByDescending(m => m.DrawAmount)
|
|
|
+ .ToListAsync(
|
|
|
+ m => new
|
|
|
+ {
|
|
|
+ ProjectId = m.ProjectId,
|
|
|
+ ProjectPriceId = m.ProjectPriceId,
|
|
|
+ DrawAmount = m.DrawAmount,
|
|
|
+ EffectDate = m.EffectDate,
|
|
|
+ });
|
|
|
+ if(priceList.Count() == 0)
|
|
|
+ {
|
|
|
+ foreach (var priceItem in result.Prices)
|
|
|
+ {
|
|
|
+ priceItem.Price = (Convert.ToDecimal(priceItem.Price) - ProjectPriceService.GetDrawAmount(Convert.ToDecimal(priceItem.Price), Convert.ToDecimal(5.00))).ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (var item in priceList)
|
|
|
+ {
|
|
|
+ foreach (var priceItem in result.Prices)
|
|
|
+ {
|
|
|
+ if (item.ProjectPriceId == priceItem.Id)
|
|
|
+ {
|
|
|
+ priceItem.Price = (Convert.ToDecimal(priceItem.Price) - item.DrawAmount).ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ priceItem.Price = (Convert.ToDecimal(priceItem.Price) - ProjectPriceService.GetDrawAmount(Convert.ToDecimal(priceItem.Price), Convert.ToDecimal(5.00))).ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return result;
|
|
|
|
|
|
|