荣圣达服务微调;诚锐钉钉接口返回值处理微调

DS7_JinGang
ddlucky 2 years ago
parent 9bfb872062
commit acca263354

@ -34,8 +34,8 @@ namespace DSWeb.Common.DB
public int requestid { get; set; } public int requestid { get; set; }
public int workflowid { get; set; } public int workflowid { get; set; }
public string requestname { get; set; } public string requestname { get; set; }
public int creater { get; set; } public int? creater { get; set; }
public int lastoperator { get; set; } public int? lastoperator { get; set; }
public string lastoperatedate { get; set; } public string lastoperatedate { get; set; }
public string lastoperatetime { get; set; } public string lastoperatetime { get; set; }
public string currentnodetype { get; set; } public string currentnodetype { get; set; }

@ -2,12 +2,14 @@
using DSWeb.Common.DB; using DSWeb.Common.DB;
using DSWeb.Common.Helper; using DSWeb.Common.Helper;
using log4net; using log4net;
using log4net.Repository.Hierarchy;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Quartz; using Quartz;
using RabbitMQ.Client; using RabbitMQ.Client;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; using System.Configuration;
using System.Linq; using System.Linq;
using System.Runtime.Caching; using System.Runtime.Caching;
@ -32,10 +34,14 @@ namespace DSWeb.Service.Output
public void Execute(IJobExecutionContext context) public void Execute(IJobExecutionContext context)
{ {
//int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout"));
try 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); var dc1 = new OtherDB(OAconnStr);
@ -48,7 +54,7 @@ namespace DSWeb.Service.Output
var idList = List.Select(s => s.PAYAPPID).ToList(); var idList = List.Select(s => s.PAYAPPID).ToList();
log.Info(idList.ToList());
//从dc1中寻找这些id的业务的审核结果 //从dc1中寻找这些id的业务的审核结果
var List = dc1.view_pjrequestbas.Where(x => x.workflowid == 79 && x.currentnodetype == "3" && idList.Contains(x.requestid.ToString())).ToList(); 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); SetAudit(dc1, cdc, DS7URL, item);
} }
//将审核完成的更新至cdc中的业务中 //将审核完成的更新至cdc中的业务中
//update ch_fee_payapplication set BILLSTATUS=0,AUDITUSER='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BILLNO=@BILLNO"); //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) 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<string, string> { //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<string, string> {
{ "requestid",Audititem.requestid.ToString()}, { "requestid",Audititem.requestid.ToString()},
{ "userid",userid} { "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);
} }
} }

@ -717,7 +717,7 @@ namespace DSWeb.Areas.Account.Controllers
var bodyList = ChpayapplicationDAL.GetDataList(0, 9999, " cm.payappid in("+ requestid + ")", userid); 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") if (result.Message2 == "1")
{ {
var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL.GetData("PARAMNAME='PAYAUDITAUTOCLOSEDR'"); var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL.GetData("PARAMNAME='PAYAUDITAUTOCLOSEDR'");

@ -20,6 +20,8 @@ using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using DSWeb.Areas.MvcShipping.Helper; using DSWeb.Areas.MvcShipping.Helper;
using HcUtility.Comm; using HcUtility.Comm;
using DSWeb.MvcShipping.DAL.MsSysParamSet; using DSWeb.MvcShipping.DAL.MsSysParamSet;
using NPOI.SS.Formula.Functions;
using sun.security.krb5.@internal.crypto;
namespace DSWeb.Areas.CommMng.Controllers namespace DSWeb.Areas.CommMng.Controllers
{ {
@ -325,21 +327,29 @@ namespace DSWeb.Areas.CommMng.Controllers
{ {
var result = ""; var result = "";
var _r = new DBResult(); 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<CallBackInfo>(text); var callbackinfo = JsonConvert.Deserialize<CallBackInfo>(text);
var = .GetDingTalkProcessByProcessCode(callbackinfo.processCode); 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) if ("bpms_instance_change" == callbackinfo.EventType)
{ {

@ -878,7 +878,7 @@ namespace DSWeb.Areas.MvcShipping.Helper
//根据内容修改wms和wmsin值 //根据内容修改wms和wmsin值
var cdc = new CommonDataContext(); var cdc = new CommonDataContext();
var lv = BasicDataRefDAL.GetLogicHaveValue("钉钉审批", "instanceId", "Wnr2YHcmSD-PjBWkTDkqIg05361673511300"); var lv = BasicDataRefDAL.GetLogicHaveValue("钉钉审批", "instanceId", processInstanceId);
if (lv != null && lv.ContainsKey("instanceId")) if (lv != null && lv.ContainsKey("instanceId"))
{ {
var wmsno = lv["BSNO"]; var wmsno = lv["BSNO"];
@ -1045,7 +1045,7 @@ namespace DSWeb.Areas.MvcShipping.Helper
cdc.SaveChanges(); cdc.SaveChanges();
//然后执行入库的费用入账原逻辑 //然后执行入库的费用入账原逻辑
DSWeb.MvcShipping.DAL.WMSNewDAL.WMSNewDAL.DoWMSLOCK(wmsno); DSWeb.MvcShipping.DAL.WMSNewDAL.WMSNewDAL.DoWMSLOCK("'"+wmsno+"'");
} }
} }
catch (Exception e) catch (Exception e)
@ -1382,7 +1382,7 @@ namespace DSWeb.Areas.MvcShipping.Helper
return result; return result;
} }
new public DingTalkProcess GetDingTalkProcessByProcessCode(string processCode) public override DingTalkProcess GetDingTalkProcessByProcessCode(string processCode)
{ {
var processdic = new Dictionary<string, string> { var processdic = new Dictionary<string, string> {
{ "PROC-0888A19C-0562-42AC-A9C6-24E4C4398410","诚锐入货通知"}, { "PROC-0888A19C-0562-42AC-A9C6-24E4C4398410","诚锐入货通知"},

Loading…
Cancel
Save