From 1fb765dc50412a021435c172db90cbc70938078c Mon Sep 17 00:00:00 2001 From: ddlucky Date: Fri, 6 Jan 2023 11:14:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=8D=A3=E5=9C=A3=E8=BE=BE=E6=B3=9B?= =?UTF-8?q?=E5=BE=AEOA=E5=AF=B9=E6=8E=A5=EF=BC=8CDS7=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9B=9E=E5=86=99=E6=B3=9B=E5=BE=AEOA=E7=9A=84=E6=B5=81?= =?UTF-8?q?=E7=A8=8BID=E8=87=B3ch=5Ffee=5Fpayapplication=E7=9A=84PAYAPPID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DSWeb.Common/DB/Comm.cs | 36 +++++++++++++ .../Chfee_PayapplicationDAL.cs | 35 +++++++++---- DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs | 52 +++++++++++-------- JobReqWebData/JobFanWeiOA.cs | 6 ++- 4 files changed, 97 insertions(+), 32 deletions(-) diff --git a/DSWeb.Common/DB/Comm.cs b/DSWeb.Common/DB/Comm.cs index f2e3c0c4..4b7c96c6 100644 --- a/DSWeb.Common/DB/Comm.cs +++ b/DSWeb.Common/DB/Comm.cs @@ -1706,4 +1706,40 @@ namespace DSWeb.Common.DB return firstNumberBetweenBrackets; } } + + + public static class StrHelper + { + #region 将一个dictionary转化为用;;和::隔开的文本 + public static string DicToStr(Dictionary dic) + { + var result = ""; + + foreach (var item in dic) + { + result += item.Key + "::" + item.Value + ";;"; + } + + return result; + } + #endregion + + #region 将一个用;;和::隔开的文本转化为dictionary + public static Dictionary StrToDic(string dicstr) + { + var result = new Dictionary(); + + var list = Regex.Split(dicstr, ";;").ToList(); + + foreach (var item in list) + { + var itemarray = Regex.Split(item, "::"); + if (itemarray.Length < 2) continue; + result.Add(itemarray[0], itemarray[1] == null ? "" : itemarray[1]); + } + + return result; + } + #endregion + } } \ No newline at end of file diff --git a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs index 56642657..d41d1928 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs @@ -2408,7 +2408,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication if (WorkFlowid == "") WorkFlowid = "no"; } - + var headdata = ChpayapplicationDAL.GetData(" BILLNO='" + bill + "'", USERID, usercode, companyid); Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, bill, USERID,bill, bill,"", WorkFlowid); @@ -2445,7 +2445,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication if (result.Success) { - var _r = FanWeiOA_Submit(bill, USERID, usercode, companyid); + var _r = FanWeiOA_Submit(headdata, USERID, usercode, companyid); if (!_r.Success) { @@ -2455,6 +2455,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication return result; } + else { + var requestid = result.Data.ToString(); + + var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='"+ requestid + "' where BILLNO=@BILLNO"); + cmdupdate.Parameters.Clear(); + db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, bill); + db.ExecuteNonQuery(cmdupdate, tran); + } } tran.Commit(); } @@ -2509,11 +2517,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication try { - var oacommitList = new List(); + var oacommitList = new List(); foreach (var bill in billList) { - + var headdata = ChpayapplicationDAL.GetData(" BILLNO='" + bill + "'", USERID, usercode, companyid); var isclose = false; if (FEECLOSEPAYAUTOAUDIT.PARAMVALUE == "1") { @@ -2599,7 +2607,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication result.Success = true; result.Message = "提交审核成功"; - oacommitList.Add(bill); + oacommitList.Add(headdata); //FanWeiOA_Submit(bill, USERID, usercode, companyid); } @@ -2613,8 +2621,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication } - foreach (var bill in oacommitList) { - var _r =FanWeiOA_Submit(bill, USERID, usercode, companyid); + foreach (var headdata in oacommitList) { + var _r =FanWeiOA_Submit(headdata, USERID, usercode, companyid); if (!_r.Success) { tran.Rollback(); @@ -2623,6 +2631,15 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication return result; } + else + { + var requestid = _r.Data.ToString(); + + var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='" + requestid + "' where BILLNO=@BILLNO"); + cmdupdate.Parameters.Clear(); + db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, headdata.BILLNO); + db.ExecuteNonQuery(cmdupdate, tran); + } } tran.Commit(); @@ -2932,7 +2949,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication return result; } - public static DBResult FanWeiOA_Submit(string bill, string userid, string usercode, string companyid) + public static DBResult FanWeiOA_Submit(ChPayapplication headdata, string userid, string usercode, string companyid) { var result = new DBResult(); @@ -2948,7 +2965,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication { //泛微OAHelper.GetToken(); - var headdata = ChpayapplicationDAL.GetData(" BILLNO='" + bill + "'", userid, usercode, companyid); + //var headdata = ChpayapplicationDAL.GetData(" BILLNO='" + bill + "'", userid, usercode, companyid); //var userid = Convert.ToString(Session["USERID"]); //var usercode = Convert.ToString(Session["CODENAME"]); diff --git a/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs b/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs index c34fb39f..3c9800dd 100644 --- a/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs @@ -1216,14 +1216,9 @@ namespace DSWeb.Areas.CommMng.DAL var cdc = new CommonDataContext(); var _user = cdc.VW_user.FirstOrDefault(x => x.USERID == userid); - //String secretUserid = rsa.encrypt(null, userid, null, "utf-8", spk, false); - //heads.put("userid", secretUserid); - //userid将会填在user.wechetaccount里面 + #region 正式获取userid的逻辑 + var _userid = "0"; - //var _userinfo = MsSysThirdPartyAccountDAL.GetDataList($" userid='{userid}' and thirdparty='泛微OA账号'"); - //if (_userinfo != null && _userinfo.Count > 0) { - // _userid = _userinfo[0].ACCOUNT; - //} var fanweiconnstr = MsSysParamSetDAL.GetData("PARAMNAME='FanWei_DBCONN'").PARAMVALUE; @@ -1237,12 +1232,15 @@ namespace DSWeb.Areas.CommMng.DAL result.SetErrorInfo($"用户[{_user.SHOWNAME}]在OA系统中不存在"); return result; } - else { + else + { _userid = fwuser[0].id.ToString(); } - var _userid_m = EncryptByPublicKey(_userid, SPK); + + #endregion + //var _userid_m = EncryptByPublicKey("49", SPK); var dic = new Dictionary { @@ -1282,11 +1280,20 @@ namespace DSWeb.Areas.CommMng.DAL try { _res = JsonConvert.Deserialize(rtn); + result.Data = _res.data.requestid; result.OK("发送成功"); + + //要记录requestid + + + //var logicdic = new Dictionary { + // { "requestid", _res.data.requestid } + //}; + //BasicDataRefDAL.SaveLogicInfo(headdata.GID, "泛微审批", logicdic); } catch (Exception e) { _res2 = JsonConvert.Deserialize(rtn); - result.SetErrorInfo("发送失败:"+ _res2.errMsg.saveRequestError); + result.SetErrorInfo("发送失败:"+ _res2.errMsg.ToString()); } @@ -1319,6 +1326,7 @@ namespace DSWeb.Areas.CommMng.DAL public class SuccessResponse : 泛微Response { + public string code { get; set; } /// /// /// @@ -1326,7 +1334,11 @@ namespace DSWeb.Areas.CommMng.DAL /// /// /// - public string errMsg { get; set; } + public ErrMsg errMsg { get; set; } + /// + /// + /// + public ReqFailMsg reqFailMsg { get; set; } } @@ -1342,15 +1354,14 @@ namespace DSWeb.Areas.CommMng.DAL public class Data { - public string requestid { get; set; } + /// + /// + /// + public int requestid { get; set; } } public class ErrMsg { - /// - /// 流程保存失败 - /// - public string saveRequestError { get; set; } } public class KeyParameters @@ -1363,6 +1374,10 @@ namespace DSWeb.Areas.CommMng.DAL public class OtherParams { + /// + /// + /// + public string doAutoApprove { get; set; } } public class ReqFailMsg @@ -1378,15 +1393,10 @@ namespace DSWeb.Areas.CommMng.DAL /// /// /// - public string msgType { get; set; } - /// - /// - /// public OtherParams otherParams { get; set; } } - } #endregion diff --git a/JobReqWebData/JobFanWeiOA.cs b/JobReqWebData/JobFanWeiOA.cs index 4295c83b..27df9ed2 100644 --- a/JobReqWebData/JobFanWeiOA.cs +++ b/JobReqWebData/JobFanWeiOA.cs @@ -21,20 +21,22 @@ namespace JobReqWebData { try { - string connStr = context.JobDetail.JobDataMap.GetString("ConnectString"); + string OAconnStr = context.JobDetail.JobDataMap.GetString("ConnectString"); string DS7connStr = context.JobDetail.JobDataMap.GetString("DS7ConnectString"); int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); - var dc1 = new CommonDataContext(connStr); + var dc1 = new OtherDB(OAconnStr); var cdc = new CommonDataContext(DS7connStr); //从cdc中寻找待读取审核结果的业务 + //var 待审核付费申请List = cdc.ch_fee_p //从dc1中寻找这些id的业务的审核结果 //将审核完成的更新至cdc中的业务中 + //update ch_fee_payapplication set BILLSTATUS=0,AUDITUSER='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BILLNO=@BILLNO"); } catch (Exception ex) { From 2206329be2483ee001a2aa50cb629c8964918784 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Fri, 6 Jan 2023 11:45:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?webconfig=E4=B8=ADFanWeiOAAPI=3Dtrue?= =?UTF-8?q?=E6=97=B6=E4=BB=98=E8=B4=B9=E7=94=B3=E8=AF=B7=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E6=89=A7=E8=A1=8C=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Chfee_PayapplicationDAL.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs index d41d1928..f6351eec 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs @@ -2661,11 +2661,34 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication return result; } - + /// + /// 撤回提交 + /// + /// + /// + /// + /// public static DBResult SubmitAuditBack(string WorkFlowName, String USERID, String bill) { var result = new DBResult(); + try + { + if (ConfigurationManager.AppSettings["FanWeiOAAPI"] == "true") + { + result = new DBResult(); + result.Success = false; + result.Message = "现行逻辑不允许执行撤回提交!"; + return result; + } + } + catch (Exception e) + { + + } + finally { } + + Database db = DatabaseFactory.CreateDatabase(); using (var conn = db.CreateConnection()) {