Преглед изворни кода

Add: 导出演练数据SQL脚本功能

Yue пре 3 година
родитељ
комит
10dad20593

+ 183 - 0
SourceCode/WeApp.Core/CommonManager/Export/ExportManger.cs

@@ -0,0 +1,183 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+
+using Abp.Configuration;
+using Abp.Domain.Repositories;
+using Abp.Domain.Services;
+using Abp.UI;
+
+using WeApp.BaseInfo;
+using WeApp.BasicInfo;
+using WeApp.Configuration;
+using WeApp.TrainingCamp;
+
+namespace WeApp.CommonManager.Export
+{
+    public class ExportManger : DomainService
+    {
+        public ExportManger(IRepository<CampInfo, string> campRepository, IRepository<CampGroupInfo, string> groupRepository, IRepository<GroupScoreInfo> gsRepository, IRepository<GroupLogInfo> glRepository, IRepository<TrainingGroupRelateRoleInfo> grrRepository, IRepository<GroupRoleInfo> groupRoleRepository, IRepository<CampSceneMapInfo> sceneMapRepository, IRepository<GroupPortraitInfo> gpMapRepository, IRepository<SysAttachFile> attachRepository, IRepository<CampRelateGroupRoleInfo> crgrRepository, ISettingManager settingManager)
+        {
+            CampRepository = campRepository;
+            GroupRepository = groupRepository;
+            GsRepository = gsRepository;
+            GlRepository = glRepository;
+            GrrRepository = grrRepository;
+            GroupRoleRepository = groupRoleRepository;
+            SceneMapRepository = sceneMapRepository;
+            GpMapRepository = gpMapRepository;
+            AttachRepository = attachRepository;
+            CrgrRepository = crgrRepository;
+            SettingManager = settingManager;
+        }
+
+        protected IRepository<CampInfo, string> CampRepository { get; }
+        protected IRepository<CampGroupInfo, string> GroupRepository { get; }
+        protected IRepository<GroupScoreInfo> GsRepository { get; }
+        protected IRepository<GroupLogInfo> GlRepository { get; }
+        protected IRepository<TrainingGroupRelateRoleInfo> GrrRepository { get; }
+        protected IRepository<GroupRoleInfo> GroupRoleRepository { get; }
+        protected IRepository<CampSceneMapInfo> SceneMapRepository { get; }
+        protected IRepository<GroupPortraitInfo> GpMapRepository { get; }
+        protected IRepository<SysAttachFile> AttachRepository { get; }
+
+        protected IRepository<CampRelateGroupRoleInfo> CrgrRepository { get; }
+
+        //protected IRepository<PhoneQuestionInfo, string> QuestionRepository { get; }
+        //protected IRepository<PhoneAnswerInfo> AnswerRepository { get; }
+        private StringBuilder SB;
+
+        private string No;
+
+        public async Task<string> ExportSql(string campNo)
+        {
+            SB = new StringBuilder("");
+            No = campNo;
+            var sql = await BuildSql();
+            var path = $"{SettingManager.GetSettingValue(IwbSettingNames.DownloadPath)}/Sql";
+            var filePath = $"{AppDomain.CurrentDomain.BaseDirectory}/{path}";
+            if (!Directory.Exists(filePath))
+            {
+                Directory.CreateDirectory(filePath);
+            }
+            File.WriteAllText($"{filePath}/{No}.sql", sql);
+            return $"{path}/{No}.sql";
+        }
+
+        private async Task<string> BuildSql()
+        {
+            SB.AppendLine("USE [We_AppDb_V2.2_Dev]\r\nGO");
+            await CampAndGroup();
+            await Role();
+            await Score();
+            await Log();
+            await Scene();
+            await Portrait();
+            await Attach();
+            return SB.ToString();
+        }
+
+        private async Task CampAndGroup()
+        {
+            var entity = await CampRepository.FirstOrDefaultAsync(a => a.Id == No);
+            if (entity == null)
+            {
+                throw new UserFriendlyException("培训营不存在!");
+            }
+            SB.AppendLine($"INSERT [dbo].[Train_Camps] ([Id], [Name], [PackageNo], [PackageName], [EngineModelType], [CampState], [AssessAuto], [RoundScore], [Variable], [ScoreRule], [PlanDate], [StartDate], [EngDate], [TrainingMinute], [Description], [EvalBehaviorTags], [Remark], [IsDeleted], [DeleterUserId], [DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], [CreatorUserId], [AssessRoleNames], [Address], [MaxRoundMinute]) VALUES (N'{entity.Id ?? ""}', N'{entity.Name ?? ""}', N'{entity.PackageNo ?? ""}', N'{entity.PackageName ?? ""}', {entity.EngineModelType},{entity.CampState}, {(entity.AssessAuto ? "1" : "0")}, CAST({entity.RoundScore} AS Decimal(18, 2)), N'{entity.Variable ?? ""}', N'{entity.ScoreRule ?? ""}', CAST(N'{entity.PlanDate:yyyy-MM-dd HH:mm:ss}' AS DateTime), CAST(N'{entity.StartDate:yyyy-MM-dd HH:mm:ss}' AS DateTime), CAST(N'{entity.EngDate:yyyy-MM-dd HH:mm:ss}' AS DateTime), CAST({entity.TrainingMinute} AS Decimal(18, 2)),N'{entity.Description ?? ""}',N'{entity.EvalBehaviorTags ?? ""}',N'{entity.Remark ?? ""}', {(entity.IsDeleted ? "1" : "0")}, {(entity.DeleterUserId != null ? entity.DeleterUserId + "" : "NULL")},{(entity.DeletionTime == null ? "NULL" : $"CAST(N'{entity.DeletionTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")}, {(entity.LastModificationTime == null ? "NULL" : $"CAST(N'{entity.LastModificationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(entity.LastModifierUserId == null ? entity.LastModifierUserId + "" : "NULL")}, {($"CAST(N'{entity.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(entity.CreatorUserId == null ? entity.CreatorUserId + "" : "NULL")},N'{entity.AssessRoleNames ?? ""}',N'{entity.Address ?? ""}', CAST({entity.MaxRoundMinute} AS Decimal(18, 2)))");
+            SB.AppendLine("GO");
+            var list = await GroupRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampGroups] ([Id], [Name], [CampNo], [CampGroupState], [StartDate], [EngDate], [TrainingMinute], [IsDeleted], [DeleterUserId], [DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], [CreatorUserId], [RunningInfo], [RoundIndex]) VALUES (N'{e.Id ?? ""}', N'{e.Name ?? ""}', N'{e.CampNo ?? ""}', {e.CampGroupState}, CAST(N'{e.StartDate}' AS DateTime),  CAST(N'{e.EngDate}' AS DateTime), CAST({e.TrainingMinute} AS Decimal(18, 2)), {(e.IsDeleted ? "1" : "0")}, {(e.DeleterUserId != null ? e.DeleterUserId + "" : "NULL")},{(e.DeletionTime == null ? "NULL" : $"CAST(N'{e.DeletionTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")}, {(e.LastModificationTime == null ? "NULL" : $"CAST(N'{e.LastModificationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.LastModifierUserId != null ? e.LastModifierUserId + "" : "NULL")}, {(e.CreationTime == null ? "NULL" : $"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")}, N'{e.RunningInfo ?? ""}', {e.RoundIndex})");
+                SB.AppendLine("GO");
+            }
+        }
+
+        private async Task Role()
+        {
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampRoleGroups] ON \r\nGO");
+            var list2 = await CrgrRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list2)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampRoleGroups] ([Id], [RoleGroupNo], [CampNo], [CreationTime], [CreatorUserId]) VALUES ({e.Id}, N'{e.RoleGroupNo ?? ""}', N'{e.CampNo ?? ""}', {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")}, {(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")})");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampRoleGroups] OFF\r\nGO");
+
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupRoles] ON \r\nGO");
+            var list = await GroupRoleRepository.GetAllListAsync(a => a.GroupNo.StartsWith(No));
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampGroupRoles] ([Id], [GroupNo], [RoleNames], [CreationTime], [CreatorUserId], [RoleGroupNos], [CustomRoles]) VALUES ({e.Id}, N'{e.GroupNo ?? ""}', N'{e.RoleNames ?? ""}', {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")}, {(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")}, N'{e.RoleGroupNos ?? ""}', N'{e.CustomRoles}')");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupRoles] OFF\r\nGO");
+        }
+
+        private async Task Score()
+        {
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupScores] ON \r\nGO");
+            var list = await GsRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampGroupScores] ([Id], [CampNo], [GroupNo], [RoundIndex], [SystemScore], [CorrectionScore], [SpecialistScore], [ReferenceScore], [FinalTotalScore], [BehaviorTagScoreInfo], [CreationTime], [CreatorUserId], [AudienceScore], [PhoneScore]) VALUES ({e.Id}, N'{e.CampNo ?? ""}', N'{e.GroupNo ?? ""}', {e.RoundIndex}, CAST({e.SystemScore} AS Decimal(18, 2)), CAST({e.CorrectionScore} AS Decimal(18, 2)), CAST({e.SpecialistScore} AS Decimal(18, 2)), CAST({e.ReferenceScore} AS Decimal(18, 2)), CAST({e.FinalTotalScore} AS Decimal(18, 2)), N'{e.BehaviorTagScoreInfo ?? ""}', {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")}, {(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")}, CAST({e.AudienceScore} AS Decimal(18, 2)), CAST({e.PhoneScore} AS Decimal(18, 2)))");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupScores] OFF \r\nGO");
+        }
+
+        private async Task Log()
+        {
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupLogs] ON \r\nGO");
+            var list = await GlRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampGroupLogs] ([Id], [CampNo], [GroupNo], [RoundIndex], [LogType], [LogCommand], [LogMessage], [RoleNo], [RoleName], [LogState], [LogScore], [ParentNo], [CreationTime], [CreatorUserId], [ExtendInfo1], [ExtendInfo2], [ExtendInfo3], [ExtendInfo4], [Remark]) VALUES ( {e.Id}, N' {e.CampNo ?? ""}', N' {e.GroupNo ?? ""}',  {e.RoundIndex},  {e.LogType}, N' {e.LogCommand ?? ""}', N'{e.LogMessage?.Replace("'", "''") ?? ""}',  N'{e.RoleNo}', N'{e.RoleName ?? ""}',  {e.LogState}, CAST( {e.LogScore} AS Decimal(18, 2)), N'{e.ParentNo ?? ""}', {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},  {(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")}, N'{e.ExtendInfo1 ?? ""}', N'{e.ExtendInfo2 ?? ""}', N'{e.ExtendInfo3 ?? ""}', N'{e.ExtendInfo4 ?? ""}', N'{e.Remark}')\r\n");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupLogs] OFF \r\nGO");
+        }
+
+        private async Task Scene()
+        {
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampSceneMaps] ON \r\nGO");
+            var list = await SceneMapRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampSceneMaps] ([Id], [SceneNo], [SceneName], [AttachNos], [CampNo], [CreationTime], [CreatorUserId], [PhoneQuestionNo]) VALUES ({e.Id}, N'{e.SceneNo ?? ""}', N'{e.SceneName ?? ""}', N'{e.AttachNos ?? ""}', N'{e.CampNo ?? ""}', {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},  {(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")}, N'{e.PhoneQuestionNo}')");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampSceneMaps] OFF \r\nGO");
+        }
+
+        private async Task Portrait()
+        {
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupPortraits] ON \r\nGO");
+            var list = await GpMapRepository.GetAllListAsync(a => a.CampNo == No);
+            foreach (var e in list)
+            {
+                SB.AppendLine($"INSERT [dbo].[Train_CampGroupPortraits] ([Id], [CampNo], [GroupNo], [SceneCount], [RoleCount], [CmdCount], [SceneRemark], [SiGongRemark], [WuLiRemark], [ShortRemark], [SceneInfos], [TrainingInfos], [RoleCmdInfos], [RoundScoreInfos], [SiGongInfos], [WuLiInfos], [LastModificationTime], [LastModifierUserId], [CreationTime], [CreatorUserId], [ZhuanJiaRemark]) VALUES ({e.Id}, N' {e.CampNo ?? ""}', N' {e.GroupNo ?? ""}', {e.SceneCount}, {e.RoleCount}, {e.CmdCount}, N'{e.SceneRemark ?? ""}', N'{e.SiGongRemark ?? ""}', N'{e.WuLiRemark ?? ""}', N'{e.ShortRemark ?? ""}', N'{e.SceneInfos ?? ""}',N'{e.TrainingInfos?.Replace("'", "''") ?? ""}',N'{e.RoleCmdInfos?.Replace("'", "''") ?? ""}',N'{e.RoundScoreInfos ?? ""}',N'{e.SiGongInfos ?? ""}',N'{e.WuLiInfos ?? ""}',{(e.LastModificationTime == null ? "NULL" : $"CAST(N'{e.LastModificationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.LastModifierUserId != null ? e.LastModifierUserId + "" : "NULL")}, {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")},N'{e.ZhuanJiaRemark}')");
+                SB.AppendLine("GO");
+            }
+            SB.AppendLine("SET IDENTITY_INSERT [dbo].[Train_CampGroupPortraits] OFF \r\nGO");
+        }
+
+        private async Task Attach()
+        {
+            var packageNo = (await CampRepository.FirstOrDefaultAsync(a => a.Id == No)).PackageNo;
+            if (!string.IsNullOrEmpty(packageNo))
+            {
+                SB.AppendLine("SET IDENTITY_INSERT [dbo].[Sys_AttachFiles] ON \r\nGO");
+                var list = await AttachRepository.GetAllListAsync(a => a.TableName == "Train" && a.TableName == "CampPackage" && a.SourceKey.StartsWith(packageNo));
+                foreach (var e in list)
+                {
+                    SB.AppendLine($"INSERT [dbo].[Sys_AttachFiles] ([Id], [AttachNo], [TableName], [ColumnName], [SourceKey], [FileTitle], [FileName], [FilePath], [FileType], [FileExt], [Description], [TenantId], [IsDeleted], [DeleterUserId], [DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], [CreatorUserId]) VALUES ({e.Id}, N'{e.AttachNo ?? ""}', N'{e.TableName ?? ""}', N'{e.ColumnName ?? ""}', N'{e.SourceKey ?? ""}', N'{e.FileTitle ?? ""}', N'{e.FileName ?? ""}', N'{e.FilePath ?? ""}', N'{e.FileType ?? ""}', N'{e.FileExt ?? ""}', {e.Description}, {e.TenantId}, {(e.IsDeleted ? "1" : "0")}, {(e.DeleterUserId != null ? e.DeleterUserId + "" : "NULL")}, CAST(N'{e.DeletionTime:yyyy-MM-dd HH:mm:ss}' AS DateTime), {(e.LastModificationTime == null ? "NULL" : $"CAST(N'{e.LastModificationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.LastModifierUserId != null ? e.LastModifierUserId + "" : "NULL")}, {($"CAST(N'{e.CreationTime:yyyy-MM-dd HH:mm:ss}' AS DateTime)")},{(e.CreatorUserId != null ? e.CreatorUserId + "" : "NULL")})");
+                    SB.AppendLine("GO");
+                }
+                SB.AppendLine("SET IDENTITY_INSERT [dbo].[Sys_AttachFiles] OFF \r\nGO");
+            }
+        }
+    }
+}

+ 1 - 0
SourceCode/WeApp.Core/WeApp.Core.csproj

@@ -326,6 +326,7 @@
     <Compile Include="Configuration\IwbSettingNames.cs" />
     <Compile Include="Configuration\IwbSettingProvider.cs" />
     <Compile Include="Configuration\NameValue.cs" />
+    <Compile Include="CommonManager\Export\ExportManger.cs" />
     <Compile Include="Hubs\IwbHub.cs" />
     <Compile Include="TrainingCamp\CampHelpInfo.cs" />
     <Compile Include="TrainingCamp\CampRelateGroupRoleInfo.cs" />

+ 1 - 0
SourceCode/WeApp.Web/App_Start/RouteConfig.cs

@@ -12,6 +12,7 @@ namespace WeApp
             routes.MapRoute("M", url: "M", defaults: new { controller = "MsgMonitor", action = "Index", id = UrlParameter.Optional });
             routes.MapRoute("P", url: "P", defaults: new { controller = "Play", action = "Index", id = UrlParameter.Optional });
             routes.MapRoute("P1", url: "P1", defaults: new { controller = "Play", action = "IndexWithScore", id = UrlParameter.Optional });
+            routes.MapRoute("E", url: "E/{id}", defaults: new { controller = "Exercise", action = "ExportSql", id = UrlParameter.Optional });
             routes.MapRoute("T", url: "T/{id}", defaults: new { controller = "Home", action = "Test", id = UrlParameter.Optional });
             routes.MapRoute("R", url: "R", defaults: new { controller = "Home", action = "Refresh", id = UrlParameter.Optional });
             routes.MapRoute("G", url: "G", defaults: new { controller = "Exercise", action = "Gis", id = UrlParameter.Optional });

+ 44 - 116
SourceCode/WeApp.Web/Controllers/ExerciseController.cs

@@ -2,6 +2,7 @@
 using Abp.Authorization;
 using Abp.Domain.Repositories;
 using Abp.Web.Models;
+using Abp.Web.Mvc.Authorization;
 
 using IwbZero.ToolCommon.LogHelpers;
 using IwbZero.ToolCommon.StringModel;
@@ -15,6 +16,7 @@ using System.Threading.Tasks;
 using System.Web.Mvc;
 
 using WeApp.BaseSystem.Query;
+using WeApp.CommonManager.Export;
 using WeApp.Configuration;
 using WeApp.TrainingCamp;
 using WeApp.TrainingCamp.Dto;
@@ -30,12 +32,13 @@ namespace WeApp.Controllers
     [AbpAllowAnonymous, DisableAuditing]
     public class ExerciseController : IwbControllerBase
     {
-        public ExerciseController(QueryAppService queryApp, IRepository<CampGroupInfo, string> groupRepository, IRepository<CampInfo, string> campRepository, PortraitAppService portraitApp)
+        public ExerciseController(QueryAppService queryApp, IRepository<CampGroupInfo, string> groupRepository, IRepository<CampInfo, string> campRepository, PortraitAppService portraitApp, ExportManger exportManger)
         {
             QueryApp = queryApp;
             GroupRepository = groupRepository;
             CampRepository = campRepository;
             PortraitApp = portraitApp;
+            _exportManger = exportManger;
         }
 
         protected QueryAppService QueryApp { get; }
@@ -44,6 +47,7 @@ namespace WeApp.Controllers
         protected IRepository<CampInfo, string> CampRepository { get; }
         protected IRepository<CampGroupInfo, string> GroupRepository { get; }
         protected PortraitAppService PortraitApp { get; }
+        private readonly ExportManger _exportManger;
 
         public ActionResult Index()
         {
@@ -562,6 +566,27 @@ namespace WeApp.Controllers
             return View();
         }
 
+        [AbpMvcAuthorize]
+        public async Task<ActionResult> ExportSql(string id)
+        {
+            string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
+            if (campNo.IsEmpty())
+            {
+                TempData[SelectDataKey] = new SelectCampModel
+                {
+                    PageUrl = "/Exercise/ExportSql",
+                    PageTitle = "导出SQL选择培训营",
+                    HasGroup = false
+                };
+                return RedirectToAction("SelectCampAll");
+            }
+
+            Session["CampNo"] = campNo;
+            Session.Timeout = TimeOut;
+            var path = await _exportManger.ExportSql(id);
+            return Content($"{AppDomain.CurrentDomain.BaseDirectory}{path}");
+        }
+
         ///// <summary>
         ///// 选择培训营页面
         ///// </summary>
@@ -581,6 +606,7 @@ namespace WeApp.Controllers
         //    };
         //    return View("_Select");
         //}
+
         /// <summary>
         /// 选择培训营页面
         /// </summary>
@@ -598,6 +624,23 @@ namespace WeApp.Controllers
             return View("_Select");
         }
 
+        /// <summary>
+        /// 选择培训营页面
+        /// </summary>
+        /// <returns></returns>
+        public async Task<ActionResult> SelectCampAll()
+        {
+            SelectCampModel model = (SelectCampModel)TempData[SelectDataKey];
+            if (model == null)
+            {
+                return RedirectToAction("Student");
+            }
+            string str = await QueryApp.GetCampSelectStr(CampStateDefinition.Audit, CampStateDefinition.Run, CampStateDefinition.End);
+            model.CampSelect = str;
+            ViewBag.Select = model;
+            return View("_Select");
+        }
+
         [HttpGet]
         [WrapResult(false)]
         public ActionResult Voice(string txt, int? rate = null, int? vol = null)
@@ -651,119 +694,4 @@ namespace WeApp.Controllers
             return Json(score, JsonRequestBehavior.AllowGet);
         }
     }
-
-    /// <summary>
-    /// 演练实施
-    /// </summary>
-    [AbpAllowAnonymous, DisableAuditing]
-    public class PlayController : IwbControllerBase
-    {
-        protected IRepository<CampInfo, string> CampRepository { get; }
-        protected QueryAppService QueryApp { get; }
-        private int TimeOut = 60 * 5;
-
-        public PlayController(QueryAppService queryApp, IRepository<CampInfo, string> campRepository)
-        {
-            QueryApp = queryApp;
-            CampRepository = campRepository;
-        }
-
-        /// <summary>
-        /// 专家屏页面
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        public async Task<ActionResult> Index(string id)
-        {
-            CampInfo camp;
-            if (id == "1")
-            {
-                camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
-                if (camp == null)
-                {
-                    CheckErrors("未查询到正在运行的培训营!");
-                    return Content("Error");
-                }
-            }
-            else
-            {
-                string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
-                if (campNo.IsEmpty())
-                {
-                    TempData[ExerciseController.SelectDataKey] = new SelectCampModel
-                    {
-                        PageUrl = "/Play/Index",
-                        PageTitle = "演示屏选择培训营",
-                        HasGroup = false
-                    };
-                    return RedirectToAction("SelectCamp", "Exercise");
-                }
-                camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
-                if (camp == null)
-                {
-                    CheckErrors($"未查到到编号为【{campNo}】的培训营!");
-                    return null;
-                }
-
-                Session["CampNo"] = campNo;
-                Session.Timeout = TimeOut;
-            }
-
-            ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
-            if (camp.CampState != CampStateDefinition.Run)
-            {
-                return View("Wait");
-            }
-            ViewBag.Groups = await QueryApp.GetCampGroups(id);
-            return View();
-        }   /// <summary>
-        /// 专家屏页面
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        public async Task<ActionResult> IndexWithScore(string id)
-        {
-            CampInfo camp;
-            if (id == "1")
-            {
-                camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
-                if (camp == null)
-                {
-                    CheckErrors("未查询到正在运行的培训营!");
-                    return Content("Error");
-                }
-            }
-            else
-            {
-                string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
-                if (campNo.IsEmpty())
-                {
-                    TempData[ExerciseController.SelectDataKey] = new SelectCampModel
-                    {
-                        PageUrl = "/Play/IndexWithScore",
-                        PageTitle = "演示屏选择培训营",
-                        HasGroup = false
-                    };
-                    return RedirectToAction("SelectCamp", "Exercise");
-                }
-                camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
-                if (camp == null)
-                {
-                    CheckErrors($"未查到到编号为【{campNo}】的培训营!");
-                    return null;
-                }
-
-                Session["CampNo"] = campNo;
-                Session.Timeout = TimeOut;
-            }
-
-            ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
-            if (camp.CampState != CampStateDefinition.Run)
-            {
-                return View("Wait");
-            }
-            ViewBag.Groups = await QueryApp.GetCampGroups(id);
-            return View();
-        }
-    }
 }

+ 133 - 0
SourceCode/WeApp.Web/Controllers/PlayController.cs

@@ -0,0 +1,133 @@
+using System.Threading.Tasks;
+using System.Web.Mvc;
+
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+
+using IwbZero.ToolCommon.StringModel;
+
+using WeApp.BaseSystem.Query;
+using WeApp.Configuration;
+using WeApp.TrainingCamp;
+using WeApp.TrainingCamp.Dto;
+using WeApp.Views.Shared.Camp;
+
+namespace WeApp.Controllers
+{
+    /// <summary>
+    /// 演练实施
+    /// </summary>
+    [AbpAllowAnonymous, DisableAuditing]
+    public class PlayController : IwbControllerBase
+    {
+        protected IRepository<CampInfo, string> CampRepository { get; }
+        protected QueryAppService QueryApp { get; }
+        private int TimeOut = 60 * 5;
+
+        public PlayController(QueryAppService queryApp, IRepository<CampInfo, string> campRepository)
+        {
+            QueryApp = queryApp;
+            CampRepository = campRepository;
+        }
+
+        /// <summary>
+        /// 专家屏页面
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<ActionResult> Index(string id)
+        {
+            CampInfo camp;
+            if (id == "1")
+            {
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
+                if (camp == null)
+                {
+                    CheckErrors("未查询到正在运行的培训营!");
+                    return Content("Error");
+                }
+            }
+            else
+            {
+                string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
+                if (campNo.IsEmpty())
+                {
+                    TempData[ExerciseController.SelectDataKey] = new SelectCampModel
+                    {
+                        PageUrl = "/Play/Index",
+                        PageTitle = "演示屏选择培训营",
+                        HasGroup = false
+                    };
+                    return RedirectToAction("SelectCamp", "Exercise");
+                }
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
+                if (camp == null)
+                {
+                    CheckErrors($"未查到到编号为【{campNo}】的培训营!");
+                    return null;
+                }
+
+                Session["CampNo"] = campNo;
+                Session.Timeout = TimeOut;
+            }
+
+            ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
+            if (camp.CampState != CampStateDefinition.Run)
+            {
+                return View("Wait");
+            }
+            ViewBag.Groups = await QueryApp.GetCampGroups(id);
+            return View();
+        }   /// <summary>
+
+            /// 专家屏页面
+            /// </summary>
+            /// <param name="id"></param>
+            /// <returns></returns>
+        public async Task<ActionResult> IndexWithScore(string id)
+        {
+            CampInfo camp;
+            if (id == "1")
+            {
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
+                if (camp == null)
+                {
+                    CheckErrors("未查询到正在运行的培训营!");
+                    return Content("Error");
+                }
+            }
+            else
+            {
+                string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
+                if (campNo.IsEmpty())
+                {
+                    TempData[ExerciseController.SelectDataKey] = new SelectCampModel
+                    {
+                        PageUrl = "/Play/IndexWithScore",
+                        PageTitle = "演示屏选择培训营",
+                        HasGroup = false
+                    };
+                    return RedirectToAction("SelectCamp", "Exercise");
+                }
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
+                if (camp == null)
+                {
+                    CheckErrors($"未查到到编号为【{campNo}】的培训营!");
+                    return null;
+                }
+
+                Session["CampNo"] = campNo;
+                Session.Timeout = TimeOut;
+            }
+
+            ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
+            if (camp.CampState != CampStateDefinition.Run)
+            {
+                return View("Wait");
+            }
+            ViewBag.Groups = await QueryApp.GetCampGroups(id);
+            return View();
+        }
+    }
+}

Разлика између датотеке није приказан због своје велике величине
+ 9 - 0
SourceCode/WeApp.Web/Download/AttachFiles/Sql/JY2001000010020.sql


+ 3 - 3
SourceCode/WeApp.Web/Views/Shared/Camp/_Report.cshtml

@@ -410,7 +410,7 @@
 @if (Model.IsSystem)
 {
     <div id="export" style="position: fixed; right: 17%; top: 80px; display: block;">
-        <button type="button" class="btn btn-iwb btn-sm" onclick="Export()">导出PDF</button>
+        <button type="button" class="btn btn-iwb btn-sm" onclick="ExportSql()">导出PDF</button>
     </div>
 }
 
@@ -1266,7 +1266,7 @@
                 hasLoad = true;
             });
             
-            function Export() {
+            function ExportSql() {
                 if (!hasLoad) {
                     $('#export button').text("正在加载PDF导出插件").prop("disabled", true);
                     abp.message.warn("PDF导出插件正在加载中,请稍后...!");
@@ -1286,7 +1286,7 @@
                     });
 
                 @*$('#report .first-page').css('display', 'flex');
-            ExportPdf('report', '@(group.Name)演练报告-' + new Date().format('yyMMddhhmm'));
+            ExportSqlPdf('report', '@(group.Name)演练报告-' + new Date().format('yyMMddhhmm'));
             $('#report .first-page').css('display', 'none');*@
             }
         </script>

+ 1 - 0
SourceCode/WeApp.Web/WeApp.Web.csproj

@@ -1826,6 +1826,7 @@
     <Compile Include="Controllers\MsgMonitorController.cs" />
     <Compile Include="Controllers\PhoneAnswerController.cs" />
     <Compile Include="Controllers\PhoneQuestionController.cs" />
+    <Compile Include="Controllers\PlayController.cs" />
     <Compile Include="Controllers\TrainController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
     <Compile Include="Controllers\Results\ChallengeResult.cs" />

Неке датотеке нису приказане због велике количине промена