From a85f7ed2da56ff12975aabac75befb930fd0a279 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 9 Jan 2023 18:04:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=93=81=E5=90=8D?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 14 +++++++++ .../Service/Para/ParaService.cs | 10 +++--- .../Interface/ITaskManageService.cs | 14 +++++++++ .../TaskManagePlat/TaskManageService.cs | 31 +++++++++++++++++++ 4 files changed, 64 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index dd1f088c..e68a6bfa 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -13200,6 +13200,13 @@ 提单纸登记请求参数 + + + 下载任务附件 + + + 返回文件流 + 任务管理 @@ -13326,5 +13333,12 @@ 任务主键数组 返回结果 + + + 下载任务附件 + + + 返回文件流 + diff --git a/Myshipping.Application/Service/Para/ParaService.cs b/Myshipping.Application/Service/Para/ParaService.cs index 7017bacc..90982ea6 100644 --- a/Myshipping.Application/Service/Para/ParaService.cs +++ b/Myshipping.Application/Service/Para/ParaService.cs @@ -470,12 +470,12 @@ namespace Myshipping.Application } //这里需要判断当前的品名分类是否已经对应到品名上,如果已有对应则不能直接作废 - var existsList = _paraGoodsCategoryInfoRepository.AsQueryable() - .LeftJoin(_paraGoodsInfoRepository.AsQueryable(),(cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY) - .Where(cate => Ids.Contains(cate.Id)) - .Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList(); + var existsList = _paraGoodsCategoryInfoRepository.EntityContext.Queryable() + .InnerJoin((cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY) + .Where(cate => Ids.Contains(cate.Id)) + .Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList(); - if(existsList.Any(t=>t.Goods != null)) + if(existsList.Count > 0) throw Oops.Oh($"以下分类代码已指定品名参数不能直接删除,{string.Join(",",existsList.Select(t=>t.Cate.GOODS_CATEGORY).Distinct().ToArray())}"); list.ForEach(async entity => diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs index bd9b9f78..cc4b104a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs @@ -97,5 +97,19 @@ namespace Myshipping.Application /// Task LaraPaperRegistPost(string taskPKId, LaraPaperRegistPostDto model); + /// + /// 下载任务附件 + /// + /// + /// 返回文件流 + IActionResult DownloadTaskAttach(string taskPKId); + + + ///// + ///// 正本附件批量打印 + ///// + ///// 任务主键数组 + ///// 返回结果 + //Task PrintBatch(string[] PKIds); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 242e2710..9f8cf32e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; +using System.Net; using System.Net.Http; using System.Reflection.Metadata.Ecma335; using System.Runtime.InteropServices; @@ -1208,6 +1209,7 @@ namespace Myshipping.Application /// 任务主键 /// 提单纸登记请求参数 /// + [HttpPost("/TaskManage/LaraPaperRegistPost")] public async Task LaraPaperRegistPost(string taskPKId, LaraPaperRegistPostDto model) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -1536,8 +1538,37 @@ namespace Myshipping.Application return result; } #endregion + + /// + /// 下载任务附件 + /// + /// + /// 返回文件流 + [HttpGet("/TaskManage/DownloadTaskAttach")] + public IActionResult DownloadTaskAttach([FromQuery] string taskPKId) + { + FileStreamResult result = null; + + var fileList = _taskFileInfoRepository.AsQueryable().Where(t => t.TASK_PKID == taskPKId).ToList(); + + var fileInfo = fileList.FirstOrDefault(); + if (fileInfo.FILE_PATH.StartsWith("http://")) + { + WebClient wc = new WebClient(); + var data = wc.DownloadData(fileInfo.FILE_PATH); + + result = new FileStreamResult(new MemoryStream(data), "application/octet-stream") { FileDownloadName = fileInfo.FILE_NAME }; + } + else if (System.IO.File.Exists(fileInfo.FILE_PATH)) + { + result = new FileStreamResult(new FileStream(fileInfo.FILE_PATH, FileMode.Open), "application/octet-stream") { FileDownloadName = fileInfo.FILE_NAME }; + } + + return result; + } } + public static class DraftPaperExtension { From 6f9e6f9bace9783797408e7e28037d1d5a25b79c Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 10 Jan 2023 09:40:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 5 +++-- Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 57a8447c..77b4060d 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1671,11 +1671,12 @@ namespace Myshipping.Application /// /// 订舱Id /// 打印模板ID + /// 分类代码(使用字典【booking_template_category】中的代码) /// 类型,1:pdf、2:xlsx、3:docx /// 打印类型,10:FastReport、20:Excel模板 /// [HttpGet("/BookingOrder/PrintOrder")] - public async Task PrintOrder(long bookingId, long templateId, int type = 1, BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) + public async Task PrintOrder(long bookingId, long templateId, string cateCode, int type = 1, BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) { var printTemplate = await _repPrintTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == templateId); if (printTemplate == null) @@ -1777,7 +1778,7 @@ namespace Myshipping.Application //记录打印次数和时间,用于前端动态展示常用的打印类型 - var printRecentListKey = $"{PrintRecentListTypeKey}_{printTemplate.CateCode}_{printType}"; + var printRecentListKey = $"{PrintRecentListTypeKey}_{cateCode}_{printType}"; var usrCfg = _repUserConfig.AsQueryable().First(x => x.CreatedUserId == UserManager.UserId && x.Type == printRecentListKey); if (usrCfg == null) { diff --git a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs index 3485fbbe..88a3a9bd 100644 --- a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs +++ b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs @@ -51,7 +51,7 @@ namespace Myshipping.Core.Service /// /// /// - [HttpPost("/DjyApiAuth/sava")] + [HttpPost("/DjyApiAuth/save")] public async Task Save(SaveDjyApiAuthInput input) { DjyApiAuth entity = null;