From 065a7de5887ed23c1e0583fef8d9bc2d01d4bdc0 Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Mon, 26 Jan 2026 17:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=89=93=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/Common/YunMouHelper.cs | 42 +++++++++---- .../BLL/HSSE/SitePerson/PersonInOutService.cs | 6 +- SGGL/BLL/OpenService/YunMouService.cs | 12 +++- .../HSSE/SitePerson/PersonInfoEdit.aspx | 6 +- .../HSSE/SitePerson/PersonInfoEdit.aspx.cs | 59 +++++++++++-------- 5 files changed, 82 insertions(+), 43 deletions(-) diff --git a/SGGL/BLL/Common/YunMouHelper.cs b/SGGL/BLL/Common/YunMouHelper.cs index 5dd3896f..169e1a4e 100644 --- a/SGGL/BLL/Common/YunMouHelper.cs +++ b/SGGL/BLL/Common/YunMouHelper.cs @@ -17,10 +17,18 @@ namespace BLL.Common public static string getToken() { - string data = "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials&scope=app"; - string result = Post(YunMouUrl + "oauth/token", data, "application/x-www-form-urlencoded", ""); - var j2 = JsonConvert.DeserializeObject(result); - return j2.access_token; + try + { + string data = "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials&scope=app"; + string result = Post(YunMouUrl + "oauth/token", data, "application/x-www-form-urlencoded", ""); + var j2 = JsonConvert.DeserializeObject(result); + return j2.access_token; + } + catch (Exception e) + { + + } + return ""; } /// @@ -393,14 +401,17 @@ namespace BLL.Common /// public static string addConsumer(string access_token) { - string result = Post(YunMouUrl + "api/v1/mq/consumer/group1", "", "application/json;charset=UTF-8", access_token); - var j2 = JsonConvert.DeserializeObject(result); - if (j2.code == "200") - return j2.data.consumerId; - else + try { - return ""; + string result = Post(YunMouUrl + "api/v1/mq/consumer/group1", "", "application/json;charset=UTF-8", access_token); + var j2 = JsonConvert.DeserializeObject(result); + if (j2.code == "200") + return j2.data.consumerId; + } + catch (Exception e) { } + return ""; + } /// /// 提交偏移量 @@ -423,9 +434,14 @@ namespace BLL.Common /// public static string consumerMessage(string consumerId, string access_token) { - string data = "consumerId=" + consumerId + "&autoCommit=true"; - string result = Post(YunMouUrl + "api/v1/mq/consumer/messages", data, "application/x-www-form-urlencoded", access_token); - return result; + try + { + string data = "consumerId=" + consumerId + "&autoCommit=true"; + string result = Post(YunMouUrl + "api/v1/mq/consumer/messages", data, "application/x-www-form-urlencoded", access_token); + return result; + } + catch (Exception e) { } + return ""; } /// diff --git a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs index 20c24fb3..54997fca 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs @@ -142,13 +142,13 @@ namespace BLL }; Model.SitePerson_Person getPerson = new Model.SitePerson_Person(); - if (!string.IsNullOrEmpty(personInOut.PersonId)) + if (!string.IsNullOrEmpty(personInOut.IdentityCard)) { - getPerson = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(personInOut.ProjectId, personInOut.PersonId); + getPerson = SitePerson_PersonService.GetSitePersonByProjectIdIdentityCard(personInOut.ProjectId, personInOut.IdentityCard); } if (getPerson == null || string.IsNullOrEmpty(getPerson.PersonId)) { - getPerson = SitePerson_PersonService.GetSitePersonByProjectIdIdentityCard(personInOut.ProjectId, personInOut.IdentityCard); + getPerson = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(personInOut.ProjectId, personInOut.PersonId); } if (getPerson != null && !string.IsNullOrEmpty(getPerson.PersonId)) { diff --git a/SGGL/BLL/OpenService/YunMouService.cs b/SGGL/BLL/OpenService/YunMouService.cs index cb615418..9d8cfe08 100644 --- a/SGGL/BLL/OpenService/YunMouService.cs +++ b/SGGL/BLL/OpenService/YunMouService.cs @@ -1,4 +1,5 @@ using BLL.Common; +using Model; using Newtonsoft.Json; using System; using System.Linq; @@ -322,7 +323,16 @@ namespace BLL AmEndTime1 = AmEndTime1.Add(-time1); PmEndTime1 = PmEndTime1.Add(-time1); - var personModel = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == model.IdentityCard && x.ProjectId == model.ProjectId); + SitePerson_Person personModel = null; + if (!string.IsNullOrEmpty(model.PersonId)) + { + personModel = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == model.PersonId && x.ProjectId == model.ProjectId); + model.IdentityCard = personModel.IdentityCard; + } + else + { + personModel = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == model.IdentityCard && x.ProjectId == model.ProjectId); + } if (personModel != null) { //状态:0上午上班 1上午下班 2下午上班 3下午下班 diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx index 3b24bdbc..c127f595 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx @@ -81,11 +81,11 @@ - - + - + diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs index a9997bda..753b6d1c 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoEdit.aspx.cs @@ -232,33 +232,46 @@ namespace FineUIPro.Web.HSSE.SitePerson // string[] personIds = this.drpPersonId.Value.Split(','); foreach (var item in this.drpPersonId.Values) { - Model.SitePerson_PersonInOut newPersonInfo = new Model.SitePerson_PersonInOut - { - PersonId = item, - ProjectId = this.ProjectId, - WorkAreaName = this.txtWorkArea.Text.Trim(), - Address = this.txtAddress.Text.Trim(), - InOutWay = Const.InOutWay_2, - }; - if (!string.IsNullOrEmpty(this.drpWorkArea.SelectedValue)) - { - newPersonInfo.WorkAreaId = this.drpWorkArea.SelectedValue; - } + //Model.SitePerson_PersonInOut newPersonInfo = new Model.SitePerson_PersonInOut + //{ + // PersonId = item, + // ProjectId = this.ProjectId, + // WorkAreaName = this.txtWorkArea.Text.Trim(), + // Address = this.txtAddress.Text.Trim(), + // InOutWay = Const.InOutWay_2, + //}; + //if (!string.IsNullOrEmpty(this.drpWorkArea.SelectedValue)) + //{ + // newPersonInfo.WorkAreaId = this.drpWorkArea.SelectedValue; + //} + + //string date = string.IsNullOrEmpty(this.txtTime.Text) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : this.txtTime.Text.Trim(); + //string time = string.IsNullOrEmpty(this.txtTime2.Text) ? string.Format("{0:HH:mm:ss}", DateTime.Now) : this.txtTime2.Text.Trim(); + //newPersonInfo.ChangeTime = Funs.GetNewDateTimeOrNow(date + " " + time); + //if (this.drpType.SelectedValue == "1") + //{ + // newPersonInfo.IsIn = true; + //} + //else + //{ + // newPersonInfo.IsIn = false; + //} + + //BLL.PersonInOutService.AddPersonInOut(newPersonInfo); string date = string.IsNullOrEmpty(this.txtTime.Text) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : this.txtTime.Text.Trim(); string time = string.IsNullOrEmpty(this.txtTime2.Text) ? string.Format("{0:HH:mm:ss}", DateTime.Now) : this.txtTime2.Text.Trim(); - newPersonInfo.ChangeTime = Funs.GetNewDateTimeOrNow(date + " " + time); - if (this.drpType.SelectedValue == "1") + Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut { - newPersonInfo.IsIn = true; - } - else - { - newPersonInfo.IsIn = false; - } - - BLL.PersonInOutService.AddPersonInOut(newPersonInfo); - BLL.LogService.AddSys_Log(this.CurrUser, newPersonInfo.IdentityCard, newPersonInfo.PersonInOutId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); + ProjectId = this.ProjectId, + PersonId = item, + //IdentityCard = employeeNo, + IsIn = true, + ChangeTime = Funs.GetNewDateTimeOrNow(date + " " + time), + InOutWay = Const.InOutWay_2, + }; + YunMouService.InsertInOut(newInOut); + // BLL.LogService.AddSys_Log(this.CurrUser, newPersonInfo.IdentityCard, newPersonInfo.PersonInOutId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());