Browse Source

提交

master
gwbvipvip 8 months ago
parent
commit
a3eae2d938
7 changed files with 94 additions and 11 deletions
  1. +15
    -3
      BPA.SAAS.KitChenManage.Application/Authorization/AuthorizationServices.cs
  2. +14
    -0
      BPA.SAAS.KitChenManage.Application/Authorization/Dtos/StoreAuthorizationDto.cs
  3. +26
    -3
      BPA.SAAS.KitChenManage.Application/Authorization/Services/AuthorizationService.cs
  4. +5
    -2
      BPA.SAAS.KitChenManage.Application/Authorization/Services/IAuthorizationService.cs
  5. +22
    -3
      BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml
  6. +5
    -0
      BPA.SAAS.KitChenManage.Core/BPA.SAAS.KitChenManage.Core.xml
  7. +7
    -0
      BPA.SAAS.KitChenManage.Core/Model/BPA_StoreAuthorization.cs

+ 15
- 3
BPA.SAAS.KitChenManage.Application/Authorization/AuthorizationServices.cs View File

@@ -1,4 +1,5 @@
using BPA.SAAS.KitChenManage.Application.Food.Services;
using BPA.SAAS.KitChenManage.Application.Authorization.Dtos;
using BPA.SAAS.KitChenManage.Application.Food.Services;
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Core.Model;
using System;
@@ -36,9 +37,9 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization
/// </summary>
/// <returns></returns>
[HttpPost("/api/authorization/addstoreauthorization")]
public async Task<bool> AddStoreAuthorization(string storeId)
public async Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input)
{
return await _authorizationService.AddStoreAuthorization(storeId);
return await _authorizationService.AddStoreAuthorization(input);
}

/// <summary>
@@ -52,6 +53,17 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization
return await _authorizationService.UpdateStoreAuthorization(id);
}

/// <summary>
/// 修改店铺授权时间
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/authorization/updatestoreauthtime")]
public async Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input)
{
return await _authorizationService.UpdateStoreAuthTime(input);
}

/// <summary>
/// CodeFirst
/// </summary>


+ 14
- 0
BPA.SAAS.KitChenManage.Application/Authorization/Dtos/StoreAuthorizationDto.cs View File

@@ -12,4 +12,18 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Dtos
public string StoreName { get; set; }
public string StoreId { get; set; }
}

public class CreateOrUpDateStoreAuthorizationDto
{
public string Id { get; set; }

public string Key { get; set; }

public string StoreId { get; set; }

/// <summary>
/// 有效期 长期有效为空
/// </summary>
public DateTime? PeriodValidity { get; set; }
}
}

+ 26
- 3
BPA.SAAS.KitChenManage.Application/Authorization/Services/AuthorizationService.cs View File

@@ -52,9 +52,9 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services
/// 添加店铺授权码
/// </summary>
/// <returns></returns>
public async Task<bool> AddStoreAuthorization(string storeId)
public async Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input)
{
var data = _db.Queryable<BPA_StoreAuthorization>().Where(x=>x.StoreId== storeId).ToList();
var data = _db.Queryable<BPA_StoreAuthorization>().Where(x=>x.StoreId== input.StoreId).ToList();
if (data.Count > 0)
{
throw Oops.Oh("店铺授权码已存在");
@@ -62,8 +62,10 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services

var res = await _db.Insertable(new BPA_StoreAuthorization()
{
StoreId = storeId,
StoreId = input.StoreId,
Key = Guid.NewGuid().ToString(),
PeriodValidity = input.PeriodValidity,
UpdateAt=DateTime.Now,

}).CallEntityMethod(t => t.Create()).ExecuteCommandAsync();

@@ -83,6 +85,27 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services
throw Oops.Oh("授权信息不存在");
}
data.Key = Guid.NewGuid().ToString();
data.UpdateAt = DateTime.Now;

return await _db.Updateable(data).ExecuteCommandHasChangeAsync();
}


/// <summary>
/// 修改店铺授权码
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input)
{
var data = await _db.Queryable<BPA_StoreAuthorization>().FirstAsync(x => x.Id == input.Id);
if (data == null)
{
throw Oops.Oh("授权信息不存在");
}
data.Key = Guid.NewGuid().ToString();
data.PeriodValidity = input.PeriodValidity;
data.UpdateAt = DateTime.Now;

return await _db.Updateable(data).ExecuteCommandHasChangeAsync();
}


+ 5
- 2
BPA.SAAS.KitChenManage.Application/Authorization/Services/IAuthorizationService.cs View File

@@ -1,4 +1,5 @@
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Application.Authorization.Dtos;
using BPA.SAAS.KitChenManage.Core.Base;
using BPA.SAAS.KitChenManage.Core.Model;
using System;
using System.Collections.Generic;
@@ -23,7 +24,7 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services
/// 添加店铺授权码
/// </summary>
/// <returns></returns>
Task<bool> AddStoreAuthorization(string storeId);
Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input);

/// <summary>
/// 修改店铺授权码
@@ -32,6 +33,8 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services
/// <returns></returns>
Task<bool> UpdateStoreAuthorization(string id);

Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input);






+ 22
- 3
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml View File

@@ -11,7 +11,7 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.AddStoreAuthorization(System.String)">
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)">
<summary>
添加店铺授权码
</summary>
@@ -24,12 +24,24 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.UpdateStoreAuthTime(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)">
<summary>
修改店铺授权时间
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.CodeFirst">
<summary>
CodeFirst
</summary>
<param name="tableNames"></param>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto.PeriodValidity">
<summary>
有效期 长期有效为空
</summary>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.PageStoreAuthorization(BPA.SAAS.KitChenManage.Core.Base.PageInputBase)">
<summary>
分页店铺授权码
@@ -37,7 +49,7 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.AddStoreAuthorization(System.String)">
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)">
<summary>
添加店铺授权码
</summary>
@@ -50,6 +62,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.UpdateStoreAuthTime(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)">
<summary>
修改店铺授权码
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.CodeFirst">
<summary>
CodeFirst
@@ -63,7 +82,7 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.IAuthorizationService.AddStoreAuthorization(System.String)">
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.IAuthorizationService.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)">
<summary>
添加店铺授权码
</summary>


+ 5
- 0
BPA.SAAS.KitChenManage.Core/BPA.SAAS.KitChenManage.Core.xml View File

@@ -80,6 +80,11 @@
商品id
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Core.Model.BPA_StoreAuthorization.PeriodValidity">
<summary>
有效期 长期有效为空
</summary>
</member>
<member name="M:BPA.KitChen.GroupMeal.SqlSugar.SqlSugarDb.TableFilterItem(SqlSugar.SqlSugarClient)">
<summary>
全局过滤


+ 7
- 0
BPA.SAAS.KitChenManage.Core/Model/BPA_StoreAuthorization.cs View File

@@ -14,5 +14,12 @@ namespace BPA.SAAS.KitChenManage.Core.Model
public string StoreId { get; set; }
public string Key { get; set; }
public string GroupId { get; set; }

/// <summary>
/// 有效期 长期有效为空
/// </summary>
public DateTime? PeriodValidity { get; set; }

public DateTime UpdateAt { get; set; }
}
}

Loading…
Cancel
Save