打印模板权限

optimize
wet 2 years ago
parent e61cf3d8c7
commit 2dfe52abf9

@ -0,0 +1,23 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 订舱打印模板权限表
/// </summary>
[SugarTable("booking_printtemplateright")]
[Description("订舱打印模板权限表")]
public class BookingPrinttemplateRight : PrimaryKeyEntity
{
/// <summary>
/// 人员id
/// </summary>
public long SysUserId { get; set; }
/// <summary>
/// 模板id
/// </summary>
public long PrintTemplateId { get; set; }
}
}

@ -367,7 +367,7 @@ namespace Myshipping.Application
}
var entity = input.Adapt<BookingOrder>();
entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.InsertAsync(entity);
if (input.ctnInputs != null)
{
@ -474,7 +474,7 @@ namespace Myshipping.Application
}
var main = await _rep.AsQueryable().Where(x => x.Id == input.Id).FirstAsync();
var entity = input.Adapt<BookingOrder>();
entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == input.Id).Select(x => x.Id).ToListAsync();
await _repCtn.DeleteAsync(x => x.BILLID == input.Id);
@ -1555,7 +1555,7 @@ namespace Myshipping.Application
{
//当前公司所有已配置的模板
var allList = await _repPrintTemplate.AsQueryable()
.Filter(null, true)
.Filter(null, true).InnerJoin<BookingPrinttemplateRight>((d,t)=>d.Id==t.PrintTemplateId&&t.SysUserId==UserManager.UserId)
.Where(x => x.TenantId == UserManager.TENANT_ID)
.Select(x => new
{

@ -18,6 +18,9 @@ using Furion.RemoteRequest.Extensions;
using System.Text;
using System.Web;
using Myshipping.Application.Enum;
using System.Collections.Generic;
using Myshipping.Application.Service.BookingPrintTemplate.Dto;
using Myshipping.Core.Entity;
namespace Myshipping.Application
{
@ -28,11 +31,15 @@ namespace Myshipping.Application
public class BookingPrintTemplateService : IBookingPrintTemplateService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BookingPrintTemplate> _rep;
private readonly SqlSugarRepository<BookingPrinttemplateRight> _repRight;
private readonly SqlSugarRepository<SysUser> _repUser;
private readonly ILogger<BookingPrintTemplate> _logger;
public BookingPrintTemplateService(SqlSugarRepository<BookingPrintTemplate> rep, ILogger<BookingPrintTemplate> logger)
public BookingPrintTemplateService(SqlSugarRepository<BookingPrintTemplate> rep, SqlSugarRepository<BookingPrinttemplateRight> repRight, SqlSugarRepository<SysUser> repUser, ILogger<BookingPrintTemplate> logger)
{
_rep = rep;
_repRight = repRight;
_repUser = repUser;
_logger = logger;
}
@ -251,5 +258,48 @@ namespace Myshipping.Application
var result = new FileStreamResult(new FileStream(fileFullPath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
return result;
}
/// <summary>
/// 新增打印模板权限
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[SqlSugarUnitOfWork]
[HttpPost("/BookingPrintTemplate/AddPrinttemplateRight")]
public async Task AddPrinttemplateRight(BookingPrinttemplateRightDto input)
{
if (input == null)
{
throw Oops.Bah("未上传正确数据");
}
await _repRight.DeleteAsync(x => x.SysUserId == input.SysUserId);
foreach (var item in input.PrintTemplateId)
{
BookingPrinttemplateRight right = new BookingPrinttemplateRight();
right.SysUserId = input.SysUserId;
right.PrintTemplateId = item;
await _repRight.InsertAsync(right);
}
}
/// <summary>
/// 获取打印模板权限
/// </summary>
/// <returns></returns>
[HttpGet("/BookingPrintTemplate/GetPrinttemplateRightList")]
public async Task<dynamic> GetPrinttemplateRightList(long userId)
{
var list = await _repRight.AsQueryable().InnerJoin<BookingPrintTemplate>((d, t) => d.PrintTemplateId == t.Id && t.TenantId == UserManager.TENANT_ID).
WhereIF(userId != 0, x => x.SysUserId == userId).
Select((d, t) => new
{
TypeCode = t.TypeCode,
TypeName = t.TypeName,
FilePath = t.FilePath,
FileName = t.FileName,
TenantName = t.TenantName,
UserName = _repUser.Where(x => x.Id == d.SysUserId).Select(x => x.Name).FirstAsync().Result
}).ToListAsync();
return list;
}
}
}

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingPrintTemplate.Dto
{
public class BookingPrinttemplateRightDto
{
/// <summary>
/// 人员id
/// </summary>
public long SysUserId { get; set; }
public List<long> PrintTemplateId { get; set; }
}
}

@ -156,7 +156,7 @@ namespace Myshipping.Core.Extension
ret = "";
if (strf == "00") //下面是小数部分的转换
{
ret = ret + "整";
ret = ret ;
}
else
{
@ -169,7 +169,7 @@ namespace Myshipping.Core.Extension
tmp = getint(strf[1]);
if (tmp == "零")
ret = ret + "整";
ret = ret ;
else
ret = ret + tmp + "分";
}

@ -14248,6 +14248,20 @@
用户数据范围
</summary>
</member>
<member name="M:Myshipping.Core.Service.SysDataUserMenuService.GetGrantData(System.Int64)">
<summary>
获取权限
</summary>
<param name="userid"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysDataUserMenuService.GetGrantRightData(System.Int64)">
<summary>
获取用户自定义权限
</summary>
<param name="userid"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysDataUserMenuService.GrantData(Myshipping.Core.Service.User.Dto.SysDataUserMenuDto)">
<summary>
授权用户数据

@ -53,7 +53,7 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController,IT
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
[HttpGet("/SysDataUserMenu/GetGrantData")]
[HttpGet("/SysDataUserMenu/GetGrantRightData")]
public async Task<dynamic> GetGrantRightData(long userid)
{

Loading…
Cancel
Save