From 2dfe52abf9c9c53ac78fb78863a59294e492166e Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Mon, 26 Dec 2022 15:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A8=A1=E6=9D=BF=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BookingPrinttemplateRight.cs | 23 ++++++++ .../BookingOrder/BookingOrderService.cs | 6 +-- .../BookingPrintTemplateService.cs | 52 ++++++++++++++++++- .../Dto/BookingPrinttemplateRightDto.cs | 19 +++++++ Myshipping.Core/Extension/NumberToUpper.cs | 4 +- Myshipping.Core/Myshipping.Core.xml | 14 +++++ .../Service/User/SysDataUserMenu.cs | 2 +- 7 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 Myshipping.Application/Entity/BookingPrinttemplateRight.cs create mode 100644 Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs diff --git a/Myshipping.Application/Entity/BookingPrinttemplateRight.cs b/Myshipping.Application/Entity/BookingPrinttemplateRight.cs new file mode 100644 index 00000000..477a0dc0 --- /dev/null +++ b/Myshipping.Application/Entity/BookingPrinttemplateRight.cs @@ -0,0 +1,23 @@ +using System; +using SqlSugar; +using System.ComponentModel; +using Myshipping.Core.Entity; +namespace Myshipping.Application.Entity +{ + /// + /// 订舱打印模板权限表 + /// + [SugarTable("booking_printtemplateright")] + [Description("订舱打印模板权限表")] + public class BookingPrinttemplateRight : PrimaryKeyEntity + { + /// + /// 人员id + /// + public long SysUserId { get; set; } + /// + /// 模板id + /// + public long PrintTemplateId { get; set; } + } +} \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 51696566..43a54dc7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -367,7 +367,7 @@ namespace Myshipping.Application } var entity = input.Adapt(); - 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(); - 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((d,t)=>d.Id==t.PrintTemplateId&&t.SysUserId==UserManager.UserId) .Where(x => x.TenantId == UserManager.TENANT_ID) .Select(x => new { diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs index fb142fe5..694554d2 100644 --- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs +++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs @@ -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 _rep; + private readonly SqlSugarRepository _repRight; + private readonly SqlSugarRepository _repUser; private readonly ILogger _logger; - public BookingPrintTemplateService(SqlSugarRepository rep, ILogger logger) + public BookingPrintTemplateService(SqlSugarRepository rep, SqlSugarRepository repRight, SqlSugarRepository repUser, ILogger 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; } + /// + /// 新增打印模板权限 + /// + /// + /// + [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); + } + } + /// + /// 获取打印模板权限 + /// + /// + [HttpGet("/BookingPrintTemplate/GetPrinttemplateRightList")] + public async Task GetPrinttemplateRightList(long userId) + { + var list = await _repRight.AsQueryable().InnerJoin((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; + } } } diff --git a/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs new file mode 100644 index 00000000..ef442241 --- /dev/null +++ b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs @@ -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 + { + /// + /// 人员id + /// + public long SysUserId { get; set; } + + public List PrintTemplateId { get; set; } + + } +} diff --git a/Myshipping.Core/Extension/NumberToUpper.cs b/Myshipping.Core/Extension/NumberToUpper.cs index 1a4db28e..81e08d01 100644 --- a/Myshipping.Core/Extension/NumberToUpper.cs +++ b/Myshipping.Core/Extension/NumberToUpper.cs @@ -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 + "分"; } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 410ca20e..9a6f0165 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -14248,6 +14248,20 @@ 用户数据范围 + + + 获取权限 + + + + + + + 获取用户自定义权限 + + + + 授权用户数据 diff --git a/Myshipping.Core/Service/User/SysDataUserMenu.cs b/Myshipping.Core/Service/User/SysDataUserMenu.cs index f4d0d95d..89aa8e29 100644 --- a/Myshipping.Core/Service/User/SysDataUserMenu.cs +++ b/Myshipping.Core/Service/User/SysDataUserMenu.cs @@ -53,7 +53,7 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController,IT /// /// /// - [HttpGet("/SysDataUserMenu/GetGrantData")] + [HttpGet("/SysDataUserMenu/GetGrantRightData")] public async Task GetGrantRightData(long userid) {