Browse Source

查询店铺和团关系接口

qianyi
shanji 3 years ago
parent
commit
39de8edd83
  1. 16
      BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
  2. 10
      BBWY.Server.API/Controllers/VenderController.cs
  3. 30
      BBWY.Server.Business/Vender/VenderBusiness.cs
  4. 29
      BBWY.Server.Model/Db/Mds/Shopdepartment.cs
  5. 50
      BBWY.Server.Model/Db/Mds/Userdepartment.cs
  6. 28
      BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs

16
BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml

@ -24,8 +24,8 @@
</Grid.RowDefinitions>
<Border Background="{StaticResource Border.Background}" Padding="5,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ComboBox Width="100" IsEnabled="false"/>
<ComboBox Width="100" IsEnabled="false" Margin="5,0,0,0"/>
<ComboBox Width="100" />
<ComboBox Width="100" Margin="5,0,0,0"/>
<DatePicker Width="100" IsEnabled="false" Height="30" Margin="5,0,0,0"/>
<DatePicker Width="100" IsEnabled="false" Height="30" Margin="5,0,0,0"/>
<c:BButton Content="执行" Margin="5,0,0,0" Padding="10,0" Command="{Binding AuditCommand}"/>
@ -43,11 +43,11 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="支付数据"/>
<TextBlock Text="采购数据" Grid.Column="1"/>
<TextBlock Text="销售数据" Grid.Column="2"/>
<TextBlock Text="支付数据" Visibility="Collapsed"/>
<TextBlock Text="采购数据" Grid.Column="1" Visibility="Collapsed"/>
<TextBlock Text="销售数据" Grid.Column="2" Visibility="Collapsed"/>
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Margin="0,0,5,0">
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.ColumnSpan="3" Margin="0,0,5,0">
<StackPanel Orientation="Horizontal">
<c:BButton Content="导入支付宝账单" Padding="10,0" Margin="5,0,0,0" Command="{Binding ImportAliPayBillCommand}"/>
<c:BButton Content="导入微信账单" Padding="10,0" Margin="5,0,0,0"
@ -55,7 +55,7 @@
</StackPanel>
</Border>
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="1" Margin="0,0,5,0">
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="1" Margin="0,0,5,0" Visibility="Collapsed">
<StackPanel Orientation="Horizontal">
<c:BButton Content="导入1688采购单" Padding="10,0" Margin="5,0,0,0" Command="{Binding Import1688PurchaseOrderCommand}"/>
<c:BButton Content="导入淘宝采购单" Padding="10,0" Margin="5,0,0,0"
@ -65,7 +65,7 @@
</StackPanel>
</Border>
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="2">
<Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="2" Visibility="Collapsed">
<StackPanel Orientation="Horizontal">
<c:BButton Content="后台出单表(京东)" Padding="10,0" Margin="5,0,0,0" Command="{Binding ImportJDShopOrderCommand}"/>
<c:BButton Content="后台出单表(淘宝)" Padding="10,0" Margin="5,0,0,0"

10
BBWY.Server.API/Controllers/VenderController.cs

@ -72,5 +72,15 @@ namespace BBWY.Server.API.Controllers
logger.Info(stringBuilder.ToString());
venderBusiness.AcceptJDShopToken(jDShopToken);
}
/// <summary>
/// 获取部门和下属店铺
/// </summary>
/// <returns></returns>
[HttpGet]
public IList<DepartmentResponse> GetDeparmentList()
{
return venderBusiness.GetDeparmentList();
}
}
}

30
BBWY.Server.Business/Vender/VenderBusiness.cs

@ -9,6 +9,7 @@ using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Yitter.IdGenerator;
@ -145,5 +146,34 @@ namespace BBWY.Server.Business
}
return shopSettingRequest.PurchaseAccountId;
}
public IList<DepartmentResponse> GetDeparmentList()
{
var relationGroups = freeSqlMultiDBManager.MDSfsql.Select<Userdepartment, Shopdepartment, Shops>()
.InnerJoin((ud, sd, s) => ud.Id == sd.DepartmentId)
.InnerJoin((ud, sd, s) => s.Id == sd.ShopId)
.Where((ud, sd, s) => !string.IsNullOrEmpty(s.ShopId))
.ToList((ud, sd, s) => new
{
DepartmentId = ud.Id,
ud.DepartmentName,
s.ShopId,
s.ShopName
}).GroupBy(x => x.DepartmentId);
if (relationGroups.Count() == 0)
return null;
var list = new List<DepartmentResponse>();
foreach (var relationGroup in relationGroups)
{
var department = new DepartmentResponse()
{
Id = relationGroup.Key,
Name = relationGroup.FirstOrDefault().DepartmentName,
ShopList = relationGroup.Select(x => new SimpleShopResponse() { Id = x.ShopId, Name = x.ShopName }).ToList()
};
list.Add(department);
}
return list;
}
}
}

29
BBWY.Server.Model/Db/Mds/Shopdepartment.cs

@ -0,0 +1,29 @@
using FreeSql.DataAnnotations;
namespace BBWY.Server.Model.Db.Mds
{
/// <summary>
/// 店铺与团关系
/// </summary>
[Table(Name = "shopdepartment", DisableSyncStructure = true)]
public partial class Shopdepartment {
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)]
public string Id { get; set; }
/// <summary>
/// 团队ID
/// </summary>
[Column(StringLength = 50)]
public string DepartmentId { get; set; }
/// <summary>
/// 店铺ID
/// </summary>
[ Column(StringLength = 50)]
public string ShopId { get; set; }
}
}

50
BBWY.Server.Model/Db/Mds/Userdepartment.cs

@ -0,0 +1,50 @@
using FreeSql.DataAnnotations;
using System;
namespace BBWY.Server.Model.Db.Mds
{
/// <summary>
/// 团队
/// </summary>
[ Table(Name = "userdepartment", DisableSyncStructure = true)]
public partial class Userdepartment {
/// <summary>
/// 主键
/// </summary>
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)]
public string Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
[Column(StringLength = 50)]
public string CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
[Column(DbType = "tinyint(4)")]
public sbyte Deleted { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public string DepartmentName { get; set; }
/// <summary>
/// 上级部门
/// </summary>
[Column(StringLength = 50)]
public string ParentDepartmentId { get; set; }
}
}

28
BBWY.Server.Model/Dto/Response/Vender/DepartmentResponse.cs

@ -0,0 +1,28 @@
using System.Collections.Generic;
namespace BBWY.Server.Model.Dto
{
public class DepartmentResponse
{
public string Id { get; set; }
public string Name { get; set; }
public IList<SimpleShopResponse> ShopList { get; set; }
public DepartmentResponse()
{
ShopList = new List<SimpleShopResponse>();
}
}
public class SimpleShopResponse
{
/// <summary>
/// ShopId
/// </summary>
public string Id { get; set; }
public string Name { get; set; }
}
}
Loading…
Cancel
Save