| | |
| | | using Ao.Lang; |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Framework.AspNetCore.Users; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | using Microsoft.AspNetCore.Authorization; |
| | |
| | | public class WorkPlanController : ControllerBase |
| | | { |
| | | private readonly IWorkPlanAppService _workPlanAppService; |
| | | private readonly ICurrentUser _currentUser; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WorkPlanController"/> class. |
| | | /// </summary> |
| | | /// <param name="workPlanAppService">The workPlan application service.</param> |
| | | public WorkPlanController(IWorkPlanAppService workPlanAppService) |
| | | public WorkPlanController(IWorkPlanAppService workPlanAppService, ICurrentUser currentUser) |
| | | { |
| | | _workPlanAppService = workPlanAppService; |
| | | _currentUser = currentUser; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | await file.CopyToAsync(stream); |
| | | stream.Seek(0L, SeekOrigin.Begin); |
| | | |
| | | var userAccount = _currentUser.UserAccount; |
| | | var userId = _currentUser.UserId; |
| | | |
| | | var sheetNames = stream.GetSheetNames(); |
| | | var workPlanRows = sheetNames.Contains("配置") ? MiniExcel.Query<WorkPlansImportModel.WorkPlanImportModel>(stream, sheetName: "配置").ToList() : new(); |
| | | |
| | |
| | | await _workPlanAppService.ImportAsync(new WorkPlansImportModel |
| | | { |
| | | WorkPlans = workPlanRows, |
| | | }); |
| | | }, userId, userAccount); |
| | | |
| | | return Ok(); |
| | | } |