@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -16,8 +17,7 @@ namespace YhCore.WebApi.Controllers.Api.DocPrint
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 审核角色 + 流程配置控制器(对应旧 Areas/DocPrint/WYSHRoleController,路由 api/docprint/wyshrole)。
|
/// 审核角色 + 流程配置控制器(对应旧 Areas/DocPrint/WYSHRoleController,路由 api/docprint/wyshrole)。
|
||||||
/// 45 action 中本批落地 39 个;Excel 导入导出(ExceltotalListSHRole/WYRDExceldaochu/UpfileExcelSHRole/
|
/// 45 action 全部落地(Excel 导入导出 5 个走 NPOI/EPPlus,审批单 PDF 走 wkhtmltopdf)。
|
||||||
/// downMBOfSHRole/downUpfileSHRoleFK)与审批单 PDF(DwonWYSQD)依赖 NPOI/PdfHelper,延后迁移。
|
|
||||||
/// POST 动作一律 [FromForm]:前端 api/index.js 固定 x-www-form-urlencoded 提交([FromForm] 会 415);
|
/// POST 动作一律 [FromForm]:前端 api/index.js 固定 x-www-form-urlencoded 提交([FromForm] 会 415);
|
||||||
/// 老契约"表单字段塞 JSON"的动作(WYSHRole/SHTeaTxt/listXxxTxt/data/docdata/docnumdata)
|
/// 老契约"表单字段塞 JSON"的动作(WYSHRole/SHTeaTxt/listXxxTxt/data/docdata/docnumdata)
|
||||||
/// 以 [FromForm] string 接收后手动反序列化。
|
/// 以 [FromForm] string 接收后手动反序列化。
|
||||||
@@ -297,8 +297,74 @@ namespace YhCore.WebApi.Controllers.Api.DocPrint
|
|||||||
return await _role.ShenheOkSHRoleAsync(model);
|
return await _role.ShenheOkSHRoleAsync(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 延后:ExceltotalListSHRole / WYRDExceldaochu / UpfileExcelSHRole / downMBOfSHRole / downUpfileSHRoleFK(Excel,NPOI)
|
#region Excel 导入导出 / 审批单 PDF
|
||||||
// 延后:DwonWYSQD(审批单 PDF,PdfHelper + Server.MapPath)
|
|
||||||
|
/// <summary>全部文印导出(旧 ExceltotalListSHRole,NPOI .xls)。</summary>
|
||||||
|
[HttpGet("ExceltotalListSHRole")]
|
||||||
|
public async Task<IActionResult> ExceltotalListSHRole(
|
||||||
|
[FromQuery] string Name,
|
||||||
|
[FromQuery] string stateid,
|
||||||
|
[FromQuery] string starttime,
|
||||||
|
[FromQuery] string endtime)
|
||||||
|
{
|
||||||
|
var (content, fileName) = await _role.ExceltotalListSHRoleAsync(SchSerID(), Name, stateid, starttime, endtime);
|
||||||
|
return File(content, ContentType(fileName), fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>文印记录导出(旧 WYRDExceldaochu,flag=page 简版 / 完整版,EPPlus)。</summary>
|
||||||
|
[HttpGet("WYRDExceldaochu")]
|
||||||
|
public async Task<IActionResult> WYRDExceldaochu(
|
||||||
|
[FromQuery] int flowid,
|
||||||
|
[FromQuery] int DWid,
|
||||||
|
[FromQuery] string Name,
|
||||||
|
[FromQuery] string stateid,
|
||||||
|
[FromQuery] string starttime,
|
||||||
|
[FromQuery] string endtime,
|
||||||
|
[FromQuery] string flag)
|
||||||
|
{
|
||||||
|
var (content, fileName) = await _role.WYRDExceldaochuAsync(SchSerID(), flowid, DWid, Name, stateid, starttime, endtime, flag);
|
||||||
|
return File(content, ContentType(fileName), fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Excel 批量导入审核角色(旧 UpfileExcelSHRole,multipart 文件字段名不敏感取第一个)。</summary>
|
||||||
|
[HttpPost("UpfileExcelSHRole")]
|
||||||
|
public async Task<string> UpfileExcelSHRole()
|
||||||
|
{
|
||||||
|
var file = Request.Form.Files.Count > 0 ? Request.Form.Files[0] : null;
|
||||||
|
return await _role.UpfileExcelSHRoleAsync(SchSerID(), UserId(), file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>下载导入模板(旧 downMBOfSHRole,代码生成)。</summary>
|
||||||
|
[HttpGet("downMBOfSHRole")]
|
||||||
|
public async Task<IActionResult> DownMBOfSHRole()
|
||||||
|
{
|
||||||
|
var content = await _role.DownMBOfSHRoleAsync();
|
||||||
|
return File(content, "application/vnd.ms-excel", "批量导入审核角色.xls");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>下载最近一次导入的反馈 Excel(旧 downUpfileSHRoleFK)。</summary>
|
||||||
|
[HttpGet("downUpfileSHRoleFK")]
|
||||||
|
public async Task<IActionResult> DownUpfileSHRoleFK()
|
||||||
|
{
|
||||||
|
var content = await _role.DownUpfileSHRoleFKAsync(UserId());
|
||||||
|
return File(content, "application/vnd.ms-excel", "批量导入审核角色反馈.xls");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>审批单 PDF 下载(旧 DwonWYSQD,IDS 逗号分隔的 WY_DocPrint.SerID;依赖服务器安装 wkhtmltopdf)。</summary>
|
||||||
|
[HttpGet("DwonWYSQD")]
|
||||||
|
public async Task<IActionResult> DwonWYSQD([FromQuery] string IDS)
|
||||||
|
{
|
||||||
|
var (content, fileName) = await _role.DwonWYSQDAsync(SchSerID(), UserId(), IDS);
|
||||||
|
return File(content, "application/pdf", fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>按扩展名取下载 Content-Type(对齐 CommonController.GetContentType 约定)。</summary>
|
||||||
|
private static string ContentType(string fileName)
|
||||||
|
=> fileName != null && fileName.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase)
|
||||||
|
? "application/pdf"
|
||||||
|
: "application/vnd.ms-excel";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ namespace YhCore.WebApi
|
|||||||
// Redis 缓存(RedisUtil 单例,连接串取 Redis:ConnectionString)
|
// Redis 缓存(RedisUtil 单例,连接串取 Redis:ConnectionString)
|
||||||
services.AddRedisCache(Configuration);
|
services.AddRedisCache(Configuration);
|
||||||
|
|
||||||
|
// 进程内内存缓存:WYSHRole Excel 导入的反馈表(updateSHRole_{userId},单实例;
|
||||||
|
// 多实例部署需改 Redis 支撑的分布式缓存)
|
||||||
|
services.AddMemoryCache();
|
||||||
|
|
||||||
// ===== 会话状态(Session)=====
|
// ===== 会话状态(Session)=====
|
||||||
// 对应 Java HttpSession / session.invalidate();旧 DocPrintCore 同款配置。
|
// 对应 Java HttpSession / session.invalidate();旧 DocPrintCore 同款配置。
|
||||||
// 注意:YhAuth 的登录态走自定义短 Cookie(SessionTicketDataFormat,票据存进程内存),
|
// 注意:YhAuth 的登录态走自定义短 Cookie(SessionTicketDataFormat,票据存进程内存),
|
||||||
@@ -174,6 +178,8 @@ namespace YhCore.WebApi
|
|||||||
// 静态门面(对齐 Java Config):文件路径由配置注入
|
// 静态门面(对齐 Java Config):文件路径由配置注入
|
||||||
YhCore.Common.Config.Config.FilePath = Configuration["FILE_PATH"];
|
YhCore.Common.Config.Config.FilePath = Configuration["FILE_PATH"];
|
||||||
YhCore.Common.Config.Config.FileWebPath = Configuration["FILE_WEB_PATH"];
|
YhCore.Common.Config.Config.FileWebPath = Configuration["FILE_WEB_PATH"];
|
||||||
|
// 审批单 PDF:wkhtmltopdf 可执行文件路径(空则用 PATH)
|
||||||
|
YhCore.Common.Config.Config.WkHtmlToPdfPath = Configuration["wkhtmltopdf_path"];
|
||||||
|
|
||||||
// 接口文档:对应 Java SpringDoc,按渠道分三组(api / mobiapi / oapi)
|
// 接口文档:对应 Java SpringDoc,按渠道分三组(api / mobiapi / oapi)
|
||||||
services.AddSwaggerGen(c =>
|
services.AddSwaggerGen(c =>
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
"Redis": {
|
"Redis": {
|
||||||
"ConnectionString": "localhost:6379,defaultDatabase=0"
|
"ConnectionString": "localhost:6379,defaultDatabase=0"
|
||||||
},
|
},
|
||||||
|
"FILE_PATH": "UploadFile",
|
||||||
|
"FILE_WEB_PATH": "",
|
||||||
|
"wkhtmltopdf_path": "",
|
||||||
"yh": {
|
"yh": {
|
||||||
"auth": {
|
"auth": {
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user