|
|
@@ -0,0 +1,803 @@
|
|
|
+using Abp.Auditing;
|
|
|
+using Abp.Authorization;
|
|
|
+using Abp.Domain.Repositories;
|
|
|
+using Abp.Web.Models;
|
|
|
+using Abp.Web.Mvc.Authorization;
|
|
|
+
|
|
|
+using IwbZero.ToolCommon.LogHelpers;
|
|
|
+using IwbZero.ToolCommon.StringModel;
|
|
|
+
|
|
|
+using System;
|
|
|
+using System.Data.Entity;
|
|
|
+using System.IO;
|
|
|
+using System.Speech.Synthesis;
|
|
|
+using System.Threading;
|
|
|
+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;
|
|
|
+using WeApp.TrainingCampGroup.Dto;
|
|
|
+using WeApp.TrainingPortrait;
|
|
|
+using WeApp.Views.Shared.Camp;
|
|
|
+
|
|
|
+namespace WeApp.Controllers
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 演练实施
|
|
|
+ /// </summary>
|
|
|
+ [AbpAllowAnonymous, DisableAuditing]
|
|
|
+ public class ExerciseV2Controller : IwbControllerBase
|
|
|
+ {
|
|
|
+ public ExerciseV2Controller(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; }
|
|
|
+ public const string SelectDataKey = "SELECTDATA";
|
|
|
+ private int TimeOut = 60 * 5;
|
|
|
+ protected IRepository<CampInfo, string> CampRepository { get; }
|
|
|
+ protected IRepository<CampGroupInfo, string> GroupRepository { get; }
|
|
|
+ protected PortraitAppService PortraitApp { get; }
|
|
|
+ private readonly ExportManger _exportManger;
|
|
|
+
|
|
|
+ public ActionResult Index()
|
|
|
+ {
|
|
|
+ Session["GroupNo"] = "";
|
|
|
+ Session["CampNo"] = "";
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ public ActionResult Clear()
|
|
|
+ {
|
|
|
+ Session["GroupNo"] = "";
|
|
|
+ Session["CampNo"] = "";
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+
|
|
|
+ public ActionResult Select(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+ switch (id)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ return RedirectToAction("Student");
|
|
|
+
|
|
|
+ case 2:
|
|
|
+ return RedirectToAction("Leader");
|
|
|
+
|
|
|
+ case 3:
|
|
|
+ return RedirectToAction("Public");
|
|
|
+
|
|
|
+ case 4:
|
|
|
+ return RedirectToAction("Specialist");
|
|
|
+
|
|
|
+ case 5:
|
|
|
+ return RedirectToAction("Manual");
|
|
|
+
|
|
|
+ case 6:
|
|
|
+ return RedirectToAction("Gis");
|
|
|
+
|
|
|
+ default:
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 学员指挥部页面
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ActionResult HeadquarterStu()
|
|
|
+ {
|
|
|
+ return RedirectToAction("Headquarter");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 指挥长组建指挥部
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ActionResult HeadquarterLeader()
|
|
|
+ {
|
|
|
+ return RedirectToAction("Headquarter", new { id = 1 });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 组建指挥部
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Headquarter(int? id)
|
|
|
+ {
|
|
|
+ ViewBag.IsLeader = id == 1;
|
|
|
+ string groupNo = (string)Session["GroupNo"];
|
|
|
+ if (groupNo.IsEmpty())
|
|
|
+ {
|
|
|
+ if (id == 1)
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Leader",
|
|
|
+ PageTitle = "指挥长屏选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Student",
|
|
|
+ PageTitle = "学员屏选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ Session["GroupNo"] = groupNo;
|
|
|
+ Session.Timeout = 60 * 5;
|
|
|
+ var group = await GroupRepository.GetAllIncluding(a => a.CampInfo).FirstOrDefaultAsync(a => a.Id == groupNo);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{groupNo}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+ if (group.CampInfo.CampState == CampStateDefinition.End)
|
|
|
+ {
|
|
|
+ CheckErrors($"培训营已演练结束!");
|
|
|
+ }
|
|
|
+ if (group.CampGroupState == CampGroupStateDefinition.End)
|
|
|
+ {
|
|
|
+ CheckErrors($"培训营分组已演练结束!");
|
|
|
+ }
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+ switch (group.CampGroupState)
|
|
|
+ {
|
|
|
+ case CampGroupStateDefinition.New:
|
|
|
+ return View("Enter");
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.Ready:
|
|
|
+ return View("Enter");
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilding:
|
|
|
+ ViewBag.HasBuilded = false;
|
|
|
+ return View();
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilded:
|
|
|
+ ViewBag.HasBuilded = true;
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (id == 1)
|
|
|
+ {
|
|
|
+ return RedirectToAction("Leader");
|
|
|
+ }
|
|
|
+ return RedirectToAction("Student");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 学员页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Student(string id)
|
|
|
+ {
|
|
|
+ string groupNo = id.IsEmpty() ? (string)Session["GroupNo"] : id;
|
|
|
+ if (groupNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Student",
|
|
|
+ PageTitle = "学员屏选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var group = await GroupRepository.GetAllIncluding(a => a.CampInfo).FirstOrDefaultAsync(a => a.Id == groupNo);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{groupNo}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+ Session["GroupNo"] = groupNo;
|
|
|
+ Session.Timeout = TimeOut;
|
|
|
+ if (group.CampGroupState != CampGroupStateDefinition.Run)
|
|
|
+ {
|
|
|
+ string text;
|
|
|
+ switch (group.CampGroupState)
|
|
|
+ {
|
|
|
+ case CampGroupStateDefinition.Report:
|
|
|
+ text = "正在生成演练报告";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.End:
|
|
|
+ text = "演练报告已生成";
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ return RedirectToAction("HeadquarterStu");
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.IsLeader = false;
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+ ViewBag.Text = text;
|
|
|
+ return View("WaitRport");
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 指挥长页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Leader(string id)
|
|
|
+ {
|
|
|
+ string groupNo = id.IsEmpty() ? (string)Session["GroupNo"] : id;
|
|
|
+ if (groupNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Leader",
|
|
|
+ PageTitle = "指挥长屏选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var group = await GroupRepository.GetAllIncluding(a => a.CampInfo).FirstOrDefaultAsync(a => a.Id == groupNo);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{groupNo}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+
|
|
|
+ Session["GroupNo"] = groupNo;
|
|
|
+ Session.Timeout = TimeOut;
|
|
|
+ if (group.CampGroupState != CampGroupStateDefinition.Run)
|
|
|
+ {
|
|
|
+ string text;
|
|
|
+ switch (group.CampGroupState)
|
|
|
+ {
|
|
|
+ case CampGroupStateDefinition.Report:
|
|
|
+ text = "正在生成演练报告";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.End:
|
|
|
+ text = "演练报告已生成";
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ return RedirectToAction("HeadquarterLeader");
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.IsLeader = true;
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+ ViewBag.Text = text;
|
|
|
+ return View("WaitRport");
|
|
|
+ }
|
|
|
+
|
|
|
+ //if (group.CampGroupState != CampGroupStateDefinition.Run)
|
|
|
+ //{
|
|
|
+ // return RedirectToAction("HeadquarterLeader");
|
|
|
+ //}
|
|
|
+
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 公共屏页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Public(string id)
|
|
|
+ {
|
|
|
+ string groupNo = id.IsEmpty() ? (string)Session["GroupNo"] : id;
|
|
|
+ if (groupNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Public",
|
|
|
+ PageTitle = "公共屏选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var group = await GroupRepository.GetAllIncluding(a => a.CampInfo).FirstOrDefaultAsync(a => a.Id == groupNo);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{groupNo}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+
|
|
|
+ Session["GroupNo"] = groupNo;
|
|
|
+ Session.Timeout = TimeOut;
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+ if (group.CampGroupState != CampGroupStateDefinition.Run)
|
|
|
+ {
|
|
|
+ string text = "";
|
|
|
+ switch (group.CampGroupState)
|
|
|
+ {
|
|
|
+ case CampGroupStateDefinition.New:
|
|
|
+ text = "";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.Ready:
|
|
|
+ text = "培训营已就绪";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilding:
|
|
|
+ text = "正在组建指挥部";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilded:
|
|
|
+ text = "等待演练开始";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.Report:
|
|
|
+ text = "正在生成演练报告";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.End:
|
|
|
+ return RedirectToAction("StuReport", new { id = groupNo });
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.State = group.CampGroupState;
|
|
|
+ ViewBag.Text = text;
|
|
|
+ return View("PublicWait");
|
|
|
+ }
|
|
|
+
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 公共屏页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [AccessOriginal]
|
|
|
+ public async Task<ActionResult> Display(string id)
|
|
|
+ {
|
|
|
+ var group = await GroupRepository.GetAllIncluding(a => a.CampInfo).FirstOrDefaultAsync(a => a.Id == id);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{id}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.Group = ObjectMapper.Map<CampGroupDto>(group);
|
|
|
+ if (group.CampGroupState != CampGroupStateDefinition.Run)
|
|
|
+ {
|
|
|
+ string text = "";
|
|
|
+ switch (group.CampGroupState)
|
|
|
+ {
|
|
|
+ case CampGroupStateDefinition.New:
|
|
|
+ text = "";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.Ready:
|
|
|
+ text = "培训营已就绪";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilding:
|
|
|
+ text = "正在组建指挥部";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.HeadQuarterBuilded:
|
|
|
+ text = "等待演练开始";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.Report:
|
|
|
+ text = "正在生成演练报告";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CampGroupStateDefinition.End:
|
|
|
+ return RedirectToAction("StuReport", new { id });
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewBag.State = group.CampGroupState;
|
|
|
+ ViewBag.Text = text;
|
|
|
+ return View("PublicWait");
|
|
|
+ }
|
|
|
+
|
|
|
+ return View("_Run/Display");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 专家屏页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Specialist(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[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Specialist",
|
|
|
+ PageTitle = "专家屏选择培训营",
|
|
|
+ HasGroup = false
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ ViewBag.Groups = await QueryApp.GetCampGroups(id);
|
|
|
+ if (camp.CampState != CampStateDefinition.Run)
|
|
|
+ {
|
|
|
+ var text = camp.CampState != CampStateDefinition.End ? "等待演练开始" : "演练已结束";
|
|
|
+ ViewBag.Text = text;
|
|
|
+ return View("SpecWait");
|
|
|
+ }
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 主屏页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Play(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", "ExerciseV2");
|
|
|
+ }
|
|
|
+ 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("_Play/Wait");
|
|
|
+ }
|
|
|
+ ViewBag.Groups = await QueryApp.GetCampGroups(id);
|
|
|
+ return View("_Play/Index");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 主屏页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> PlayWithScore(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", "ExerciseV2" );
|
|
|
+ }
|
|
|
+ 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("_Play/Wait");
|
|
|
+ }
|
|
|
+ ViewBag.Groups = await QueryApp.GetCampGroups(id);
|
|
|
+ return View("_Play/IndexWithScore");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 演练报告
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> StuReport(string id)
|
|
|
+ {
|
|
|
+ string groupNo = id.IsEmpty() ? (string)Session["GroupNo"] : id;
|
|
|
+ if (groupNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/StuReport",
|
|
|
+ PageTitle = "演练报告选择培训营",
|
|
|
+ HasGroup = true
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var group = await PortraitApp.GetGroupReportBase(id);
|
|
|
+ if (group == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{groupNo}】的培训营分组!");
|
|
|
+ return Content("");
|
|
|
+ }
|
|
|
+ return View(group);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 手动记录演练页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Manual(string id)
|
|
|
+ {
|
|
|
+ string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
|
|
|
+ if (campNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Manual",
|
|
|
+ PageTitle = "培训营演练情况手动记录",
|
|
|
+ HasGroup = false
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
|
|
|
+ if (camp == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{campNo}】的培训营!");
|
|
|
+ }
|
|
|
+ if (camp?.CampState == CampStateDefinition.End)
|
|
|
+ {
|
|
|
+ CheckErrors($"培训营已结束!");
|
|
|
+ }
|
|
|
+ //if (camp?.CampState!=CampStateDefinition.Run)
|
|
|
+ //{
|
|
|
+ // CheckErrors($"培训营未开始!");
|
|
|
+ //}
|
|
|
+ Session["CampNo"] = campNo;
|
|
|
+ Session.Timeout = TimeOut;
|
|
|
+ ViewBag.CampName = camp?.Name;
|
|
|
+ ViewBag.Groups = await QueryApp.GetCampGroups(id);
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// GIS页面
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> Gis(string id)
|
|
|
+ {
|
|
|
+ string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
|
|
|
+ if (campNo.IsEmpty())
|
|
|
+ {
|
|
|
+ TempData[SelectDataKey] = new SelectCampModel
|
|
|
+ {
|
|
|
+ PageUrl = "/ExerciseV2/Gis",
|
|
|
+ PageTitle = "培训营GIS推演实时路径",
|
|
|
+ HasGroup = false
|
|
|
+ };
|
|
|
+ return RedirectToAction("SelectCamp");
|
|
|
+ }
|
|
|
+ var camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
|
|
|
+ if (camp == null)
|
|
|
+ {
|
|
|
+ CheckErrors($"未查到到编号为【{campNo}】的培训营!");
|
|
|
+ }
|
|
|
+ if (camp?.CampState == CampStateDefinition.End)
|
|
|
+ {
|
|
|
+ CheckErrors($"培训营已结束!");
|
|
|
+ }
|
|
|
+ //if (camp?.CampState!=CampStateDefinition.Run)
|
|
|
+ //{
|
|
|
+ // CheckErrors($"培训营未开始!");
|
|
|
+ //}
|
|
|
+ Session["CampNo"] = campNo;
|
|
|
+ Session.Timeout = TimeOut;
|
|
|
+ ViewBag.CampNo = camp?.Id;
|
|
|
+ ViewBag.CampName = camp?.Name;
|
|
|
+ //ViewBag.Groups = await QueryApp.GetCampGroups(id);
|
|
|
+ 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 = "/ExerciseV2/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>
|
|
|
+ ///// <param name="url"></param>
|
|
|
+ ///// <param name="title"></param>
|
|
|
+ ///// <param name="hasGroup"></param>
|
|
|
+ ///// <returns></returns>
|
|
|
+ //public async Task<ActionResult> Select(string url,string title,bool hasGroup)
|
|
|
+ //{
|
|
|
+ // string str = await QueryApp.GetCampSelectStr(CampStateDefinition.Audit, CampStateDefinition.Run);
|
|
|
+ // ViewBag.Select = new SelectCampModel()
|
|
|
+ // {
|
|
|
+ // HasGroup = hasGroup,
|
|
|
+ // PageTitle = title,
|
|
|
+ // PageUrl = url,
|
|
|
+ // CampSelect = str
|
|
|
+ // };
|
|
|
+ // return View("_Select");
|
|
|
+ //}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 选择培训营页面
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<ActionResult> SelectCamp()
|
|
|
+ {
|
|
|
+ SelectCampModel model = (SelectCampModel)TempData[SelectDataKey];
|
|
|
+ if (model == null)
|
|
|
+ {
|
|
|
+ return RedirectToAction("Student");
|
|
|
+ }
|
|
|
+ string str = await QueryApp.GetCampSelectStr(CampStateDefinition.Audit, CampStateDefinition.Run);
|
|
|
+ model.CampSelect = str;
|
|
|
+ ViewBag.Select = model;
|
|
|
+ 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)
|
|
|
+ {
|
|
|
+ using (MemoryStream ms = new MemoryStream())
|
|
|
+ {
|
|
|
+ var t = new Thread(() =>
|
|
|
+ {
|
|
|
+ using (SpeechSynthesizer sp = new SpeechSynthesizer())
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ sp.Rate = rate ?? 0;
|
|
|
+ sp.Volume = vol ?? 90;
|
|
|
+ sp.SetOutputToWaveStream(ms);
|
|
|
+ sp.Speak(txt);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ this.LogError(ex);
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ t.Start();
|
|
|
+ t.Join();
|
|
|
+ ms.Position = 0;
|
|
|
+ var buBytes = ms.GetBuffer();
|
|
|
+ return new FileStreamResult(new MemoryStream(buBytes), "application/wav");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpGet]
|
|
|
+ [WrapResult(false)]
|
|
|
+ public async Task<ActionResult> QueryScore(string id)
|
|
|
+ {
|
|
|
+ if (id.IsEmpty())
|
|
|
+ {
|
|
|
+ var camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
|
|
|
+ if (camp == null)
|
|
|
+ {
|
|
|
+ CheckErrors("未查询到正在运行的培训营!");
|
|
|
+ return Content("Error");
|
|
|
+ }
|
|
|
+
|
|
|
+ id = camp.Id;
|
|
|
+ }
|
|
|
+
|
|
|
+ var score = await QueryApp.GetScoreInfo(id);
|
|
|
+
|
|
|
+ return Json(score, JsonRequestBehavior.AllowGet);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|