From acca2633544111f136d1ad6c3b048f30f3108b74 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Thu, 19 Jan 2023 17:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=A3=E5=9C=A3=E8=BE=BE=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=BE=AE=E8=B0=83=EF=BC=9B=E8=AF=9A=E9=94=90=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=80=BC=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DSWeb.Common/DB/OtherDBModel.cs | 4 +- DSWeb.Service.Output/JobFanWeiToDS7.cs | 65 +++++++++++++++---- .../Chfee_payapplicationController.cs | 2 +- .../CommMng/Controllers/WorkFlowController.cs | 28 +++++--- .../MvcShipping/Helper/DingTalkHelper.cs | 6 +- 5 files changed, 78 insertions(+), 27 deletions(-) diff --git a/DSWeb.Common/DB/OtherDBModel.cs b/DSWeb.Common/DB/OtherDBModel.cs index 134622ab..ada712ba 100644 --- a/DSWeb.Common/DB/OtherDBModel.cs +++ b/DSWeb.Common/DB/OtherDBModel.cs @@ -34,8 +34,8 @@ namespace DSWeb.Common.DB public int requestid { get; set; } public int workflowid { get; set; } public string requestname { get; set; } - public int creater { get; set; } - public int lastoperator { get; set; } + public int? creater { get; set; } + public int? lastoperator { get; set; } public string lastoperatedate { get; set; } public string lastoperatetime { get; set; } public string currentnodetype { get; set; } diff --git a/DSWeb.Service.Output/JobFanWeiToDS7.cs b/DSWeb.Service.Output/JobFanWeiToDS7.cs index e44b157b..d12ceecc 100644 --- a/DSWeb.Service.Output/JobFanWeiToDS7.cs +++ b/DSWeb.Service.Output/JobFanWeiToDS7.cs @@ -2,12 +2,14 @@ using DSWeb.Common.DB; using DSWeb.Common.Helper; using log4net; +using log4net.Repository.Hierarchy; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Quartz; using RabbitMQ.Client; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Configuration; using System.Linq; using System.Runtime.Caching; @@ -32,10 +34,14 @@ namespace DSWeb.Service.Output public void Execute(IJobExecutionContext context) { + + //int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); + try { + log.Debug("Execute start"); + //int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); - int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); var dc1 = new OtherDB(OAconnStr); @@ -48,7 +54,7 @@ namespace DSWeb.Service.Output var idList = 待审核付费申请List.Select(s => s.PAYAPPID).ToList(); - + log.Info(idList.ToList()); //从dc1中寻找这些id的业务的审核结果 var 审核结果List = dc1.view_pjrequestbas.Where(x => x.workflowid == 79 && x.currentnodetype == "3" && idList.Contains(x.requestid.ToString())).ToList(); @@ -59,8 +65,10 @@ namespace DSWeb.Service.Output SetAudit(dc1, cdc, DS7URL, item); } + //将审核完成的更新至cdc中的业务中 //update ch_fee_payapplication set BILLSTATUS=0,AUDITUSER='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BILLNO=@BILLNO"); + log.Debug("Execute end"); } catch (Exception ex) { @@ -70,29 +78,62 @@ namespace DSWeb.Service.Output } } - private void SetAudit(OtherDB dc1, CommonDataContext cdc, string DS7URL, view_pjrequestbas_md Audititem) + public void DoWork() { - //根据oa系统的userid查找ds7系统的userid + var dc1 = new OtherDB(OAconnStr); + + var cdc = new CommonDataContext(DS7connStr); - var OAUser = dc1.view_hrmresource.FirstOrDefault(x => x.id == Audititem.lastoperator); + //从cdc中寻找待读取审核结果的业务 + var 待审核付费申请List = cdc.ch_fee_payapplication.Where(x => x.BILLSTATUS == 2 && x.PAYAPPID != null && x.PAYAPPID != "").ToList(); - var ds7user = cdc.VW_user.Where(x => x.SHOWNAME == OAUser.lastname).ToList(); + if (待审核付费申请List == null || 待审核付费申请List.Count <= 0) return; - //var ds7user = cdc.VW_user.Where(x => x.SHOWNAME == "系统管理员").ToList(); + var idList = 待审核付费申请List.Select(s => s.PAYAPPID).ToList(); + + log.Debug(idList.ToList()); + + //从dc1中寻找这些id的业务的审核结果 + var 审核结果List = dc1.view_pjrequestbas.Where(x => x.workflowid == 79 && x.currentnodetype == "3" && idList.Contains(x.requestid.ToString())).ToList(); + + //var AuditGidlistStr = ""; + + foreach (var item in 审核结果List) + { + SetAudit(dc1, cdc, DS7URL, item); + } - if (ds7user != null && ds7user.Count > 0) + } + private void SetAudit(OtherDB dc1, CommonDataContext cdc, string DS7URL, view_pjrequestbas_md Audititem) + { + try { - var userid = ds7user[0].USERID; + //根据oa系统的userid查找ds7系统的userid + log.Debug("audit start"); + var OAUser = dc1.view_hrmresource.FirstOrDefault(x => x.id == Audititem.lastoperator); + + var ds7user = cdc.VW_user.Where(x => x.SHOWNAME.Replace(" ","") == OAUser.lastname).ToList(); - var dic = new Dictionary { + //var ds7user = cdc.VW_user.Where(x => x.SHOWNAME == "系统管理员").ToList(); + + if (ds7user != null && ds7user.Count > 0) + { + var userid = ds7user[0].USERID; + + var dic = new Dictionary { { "requestid",Audititem.requestid.ToString()}, { "userid",userid} }; - string rtn = WebRequestHelper.DoPost(DS7URL, dic, 12000); + string rtn = WebRequestHelper.DoPost(DS7URL, dic, 12000); - log.Debug("rtn=" + rtn); + log.Debug("rtn=" + rtn); + } + log.Debug("audit end"); + } + catch (Exception e) { + log.Error(e.Message); } } diff --git a/DSWeb/Areas/Account/Controllers/Chfee_payapplicationController.cs b/DSWeb/Areas/Account/Controllers/Chfee_payapplicationController.cs index bca4d12e..503413d6 100644 --- a/DSWeb/Areas/Account/Controllers/Chfee_payapplicationController.cs +++ b/DSWeb/Areas/Account/Controllers/Chfee_payapplicationController.cs @@ -717,7 +717,7 @@ namespace DSWeb.Areas.Account.Controllers var bodyList = ChpayapplicationDAL.GetDataList(0, 9999, " cm.payappid in("+ requestid + ")", userid); - DBResult result = ChpayapplicationDAL.AuditList(bodyList, Convert.ToString(Session["USERID"])); + DBResult result = ChpayapplicationDAL.AuditList(bodyList, userid); if (result.Message2 == "1") { var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL.GetData("PARAMNAME='PAYAUDITAUTOCLOSEDR'"); diff --git a/DSWeb/Areas/CommMng/Controllers/WorkFlowController.cs b/DSWeb/Areas/CommMng/Controllers/WorkFlowController.cs index 81566684..c678e8a1 100644 --- a/DSWeb/Areas/CommMng/Controllers/WorkFlowController.cs +++ b/DSWeb/Areas/CommMng/Controllers/WorkFlowController.cs @@ -20,6 +20,8 @@ using DSWeb.Areas.MvcShipping.Models.Message.VGM; using DSWeb.Areas.MvcShipping.Helper; using HcUtility.Comm; using DSWeb.MvcShipping.DAL.MsSysParamSet; +using NPOI.SS.Formula.Functions; +using sun.security.krb5.@internal.crypto; namespace DSWeb.Areas.CommMng.Controllers { @@ -325,21 +327,29 @@ namespace DSWeb.Areas.CommMng.Controllers { var result = ""; var _r = new DBResult(); - var 钉钉应用 = DingTalkApp.GetDingTalkApp("诚锐东胜对接"); + var appname = MsSysParamSetDAL.GetSysParamValue("DingTalkAppName"); + + //var 钉钉应用 = DingTalkApp.GetDingTalkApp("诚锐东胜对接"); + var 钉钉应用 = DingTalkApp.GetDingTalkApp(appname); + //钉钉应用=DingTalkProcess.GetDingTalkProcessByProcessCode(callbackinfo.processCode); + + + + //实例化钉钉解密类构造参数为对应的 应用中的token、aes_key、AppKey值 + DingTalkEncryptor dingTalkEncryptor = new DingTalkEncryptor(钉钉应用.token, 钉钉应用.aes_key, 钉钉应用.appkey); + + + //定义字符串接收解密后的值 + + //JeffSoft.Logger.Error("dingTalkEncryptor.getDecryptMsg:" + text + ""); + BasicDataRefDAL.SaveLog(text, "admin", "钉钉回调", "测试1"); var callbackinfo = JsonConvert.Deserialize(text); var 钉钉审批 = 钉钉应用.GetDingTalkProcessByProcessCode(callbackinfo.processCode); - 钉钉审批.SaveCallBack(callbackinfo); - - //var objRtn2 = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(text.ToString(), new { EventType = "" }); - //var _jsstr = JsonConvert.Serialize(objRtn2); + 钉钉审批.SaveCallBack(callbackinfo); - //BasicDataRefDAL.SaveLog(_jsstr, "admin", "钉钉回调", "保存2"); - //取出事件类型字段 - //JeffSoft.Logger.Error("DingdingCallback Success,EventType:" + EventType + ""); - //第二部分 // { //判断事件类型是否是日程事件 if ("bpms_instance_change" == callbackinfo.EventType) { diff --git a/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs b/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs index 6df69cc2..cf885a5e 100644 --- a/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs +++ b/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs @@ -878,7 +878,7 @@ namespace DSWeb.Areas.MvcShipping.Helper //根据内容修改wms和wmsin值 var cdc = new CommonDataContext(); - var lv = BasicDataRefDAL.GetLogicHaveValue("钉钉审批", "instanceId", "Wnr2YHcmSD-PjBWkTDkqIg05361673511300"); + var lv = BasicDataRefDAL.GetLogicHaveValue("钉钉审批", "instanceId", processInstanceId); if (lv != null && lv.ContainsKey("instanceId")) { var wmsno = lv["BSNO"]; @@ -1045,7 +1045,7 @@ namespace DSWeb.Areas.MvcShipping.Helper cdc.SaveChanges(); //然后执行入库的费用入账原逻辑 - DSWeb.MvcShipping.DAL.WMSNewDAL.WMSNewDAL.DoWMSLOCK(wmsno); + DSWeb.MvcShipping.DAL.WMSNewDAL.WMSNewDAL.DoWMSLOCK("'"+wmsno+"'"); } } catch (Exception e) @@ -1382,7 +1382,7 @@ namespace DSWeb.Areas.MvcShipping.Helper return result; } - new public DingTalkProcess GetDingTalkProcessByProcessCode(string processCode) + public override DingTalkProcess GetDingTalkProcessByProcessCode(string processCode) { var processdic = new Dictionary { { "PROC-0888A19C-0562-42AC-A9C6-24E4C4398410","诚锐入货通知"},