From 6a7a44f9dadcf797ea46df5392a288c0f81eb269 Mon Sep 17 00:00:00 2001 From: geh <1923421292@qq.com> Date: Tue, 6 May 2025 15:21:24 +0800 Subject: [PATCH] fix:1 --- SUBQHSE/BLL/ZHGL/DataSync/MainSevice.cs | 6 +++- .../HSSE/SitePerson/PersonList.aspx.cs | 10 +++---- .../HSSE/InformedConsentFormController.cs | 8 ++--- .../Controllers/HSSE/TestRecordController.cs | 29 +++++++++++++++++-- .../WebAPI/Filter/TestPermissionAttribute.cs | 2 +- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/SUBQHSE/BLL/ZHGL/DataSync/MainSevice.cs b/SUBQHSE/BLL/ZHGL/DataSync/MainSevice.cs index 6c1ed34..7f36518 100644 --- a/SUBQHSE/BLL/ZHGL/DataSync/MainSevice.cs +++ b/SUBQHSE/BLL/ZHGL/DataSync/MainSevice.cs @@ -281,7 +281,6 @@ namespace BLL CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId), CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId), CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId), - CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)), ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), @@ -309,6 +308,11 @@ namespace BLL SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) }; + if (!string.IsNullOrEmpty(_unitId)) + { + table.CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)); + } + if (_unitType == 0) { table.BeUnderConstructionNum = beUnderConstructionList.Count(); diff --git a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs index 5ed4d58..2527368 100644 --- a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs @@ -1006,11 +1006,11 @@ namespace FineUIPro.Web.HSSE.SitePerson // JValueCount = sysTestRule.JValue * getIsTrueItem.Count; //总分 } - if (!string.IsNullOrEmpty(sign1)) + if (!string.IsNullOrEmpty(Signature)) { - helper.AddImage(rootPath + sign1, "sign1", 50, 25, 15, 30); - helper.AddImage(rootPath + sign1, "sign1_1", 50, 25, 15, 30); - helper.AddImage(rootPath + sign1, "sign1_2", 50, 25, 15, 30); + helper.AddImage(rootPath + Signature, "sign1", 50, 25, 15, 30); + helper.AddImage(rootPath + Signature, "sign1_1", 50, 25, 15, 30); + helper.AddImage(rootPath + Signature, "sign1_2", 50, 25, 15, 30); } else { @@ -1259,7 +1259,7 @@ namespace FineUIPro.Web.HSSE.SitePerson object[] fieldValues = { }; if (!string.IsNullOrEmpty(Signature)) { - helper.AddImage(rootPath + Signature, "testName", 50, 25, 10, 5); + helper.AddImage(rootPath + Signature, "testName", 50, 25, 30, 5); fieldNames = new[] { "projectName", "name", "time", "sex", "InTime", "sign", diff --git a/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs b/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs index 3f1db27..c98a6c8 100644 --- a/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs +++ b/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs @@ -88,7 +88,7 @@ namespace WebAPI.Controllers.HSSE Model.ToDoItem toDoItem = new Model.ToDoItem { MenuId = Const.PersonListMenuId, - DataId = item.PersonId + "_1", + DataId = item.PersonId + "_2", UrlStr = item.AttachUrl1, }; if (!string.IsNullOrEmpty(item.AttachUrl1)) @@ -96,21 +96,21 @@ namespace WebAPI.Controllers.HSSE APIUpLoadFileService.SaveAttachUrl(toDoItem); } - toDoItem.DataId = item.PersonId + "_2"; + toDoItem.DataId = item.PersonId + "_3"; toDoItem.UrlStr = item.AttachUrl2; if (!string.IsNullOrEmpty(item.AttachUrl2)) { APIUpLoadFileService.SaveAttachUrl(toDoItem); } - toDoItem.DataId = item.PersonId + "_3"; + toDoItem.DataId = item.PersonId + "_4"; toDoItem.UrlStr = item.AttachUrl3; if (!string.IsNullOrEmpty(item.AttachUrl3)) { APIUpLoadFileService.SaveAttachUrl(toDoItem); } - toDoItem.DataId = item.PersonId + "_4"; + toDoItem.DataId = item.PersonId + "_5"; toDoItem.UrlStr = item.AttachUrl4; if (!string.IsNullOrEmpty(item.AttachUrl4)) { diff --git a/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs b/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs index 387c9a7..91dcd5a 100644 --- a/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SUBQHSE/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -641,8 +641,11 @@ namespace WebAPI.Controllers /// 岗位交卷 /// 试卷ID /// - public Model.ResponeData SaveSubmitTestRecord(string testRecordId,string Signature) + [HttpPost] + public Model.ResponeData postSubmitTestRecord(Model.TestRecordItem testRecordItem) { + string testRecordId = testRecordItem.TestRecordId; + string Signature = testRecordItem.Signature; var responeData = new Model.ResponeData(); try { @@ -653,9 +656,31 @@ namespace WebAPI.Controllers var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId); if (getTestRecord != null) { + string rootUrl = ConfigurationManager.AppSettings["localRoot"]; + string SignatureUrl = @"FileUpload\TestRecord\" + getTestRecord.TestRecordId + "~签名" + ".png"; + string Signaturefilename = rootUrl + SignatureUrl; if (getTestRecord.TestStartTime.HasValue) { - getTestRecord.Signature = Signature; + if (!string.IsNullOrEmpty(Signature)) + { + Signature = Signature.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换 + byte[] bytes = Convert.FromBase64String(Signature); + + MemoryStream memStream = new MemoryStream(bytes); + Image mImage = Image.FromStream(memStream); + Bitmap bp = new Bitmap(mImage); + MemoryStream ms = new MemoryStream(); + // 确保目录存在 + string directory = Path.GetDirectoryName(Signaturefilename); + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + bp.Save(Signaturefilename, System.Drawing.Imaging.ImageFormat.Png); + + getTestRecord.Signature = Signaturefilename.Replace(rootUrl, ""); + + } getTestRecord.TestEndTime = DateTime.Now; getTestRecord.TestScores = db.Training_TestRecordItem.Where(x => x.TestRecordId == testRecordId).Sum(x => x.SubjectScore ?? 0); db.SubmitChanges(); diff --git a/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs b/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs index d05779f..fe1fabe 100644 --- a/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs +++ b/SUBQHSE/WebAPI/Filter/TestPermissionAttribute.cs @@ -158,7 +158,7 @@ namespace WebAPI.Filter , "TestRecord*getTestRecordItemListByTestRecordId" , "TestRecord*getTestTimesByTestRecordId" , "TestRecord*getTestRecordItemAnswerBySelectedItem" - , "TestRecord*SaveSubmitTestRecord" + , "TestRecord*postSubmitTestRecord" }; ///