string ddUrl = ""; //钉钉前端地址 public void ProcessRequest(HttpContext context) { //判断客户端请求是否为post方法 if (context.Request.HttpMethod.ToUpper() != "POST") { context.Response.Write("{\"errmsg\":\"请求方式不允许,请使用POST方式(DD0001)\",\"errcode\":1}"); return; } //数据库链接 connectionString = ToolsClass.GetConfig("DataOnLine"); //sqlServer da = new DbHelper.SqlHelper("SqlServer", connectionString); //获取请求json using (var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8)) { CsJson = reader.ReadToEnd(); } if (CsJson == "") { context.Response.Write("{\"errmsg\":\"报文格式错误(DD0003)\",\"errcode\":1}"); return; } CsJson = Regex.Replace(CsJson, @"[\n\r]", "").Replace(@"\n", ""); //#微应用ID:agentId #企业ID:corpId #应用的唯一标识:appKey #应用的密钥:appSecret AppWyy = ToolsClass.GetConfig("AppWyy"); ScList = AppWyy.Split('$'); agentId = ScList[0].ToString(); corpId = ScList[1].ToString(); appKey = ScList[2].ToString(); appSecret = ScList[3].ToString(); isWrite = ToolsClass.GetConfig("isWrite"); ddUrl = ToolsClass.GetConfig("ddUrl"); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nProInfo=>入参:" + CsJson + "\r\n"); } //前端传入数据 TravelApproval traApprClass = new TravelApproval(); traApprClass = (TravelApproval)JsonConvert.DeserializeObject(CsJson, typeof(TravelApproval)); try { if (traApprClass.IsAuditing == "1") { audiIdea = "同意"; } else if (traApprClass.IsAuditing == "2") { audiIdea = "驳回"; } else { audiIdea = "抄送"; } #region 获取access_token url = "https://oapi.dingtalk.com/gettoken?appkey=" + appKey + "&appsecret=" + appSecret; FhJson = ToolsClass.ApiFun("GET", url, ""); TokenClass tokenClass = new TokenClass(); tokenClass = (TokenClass)JsonConvert.DeserializeObject(FhJson, typeof(TokenClass)); access_token = tokenClass.access_token; errcode = tokenClass.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"获取ACCESS_TOKEN报错(DD0004)\",\"errcode\":1}"); return; } #endregion #region 获取用户详情 url = "https://oapi.dingtalk.com/user/get?access_token=" + access_token + "&userid=" + traApprClass.DDAuditingId; FhJson = ToolsClass.ApiFun("GET", url, ""); GetUserXq userXqClass = new GetUserXq(); userXqClass = (GetUserXq)JsonConvert.DeserializeObject(FhJson, typeof(GetUserXq)); errcode = userXqClass.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"获取审批人详细信息报错(DD6003)\",\"errcode\":1}"); return; } audiName = userXqClass.name; #endregion #region 获取用户guid Sql = "select top 1 a.guid,b.StartDate,b.EndDate from FlowEmployee a left join (select convert(varchar(20), min(b.StartDate), 23) StartDate,convert(varchar(20), max(EndDate), 23) EndDate from TravelReq a left join TravelReqDetail b on a.billno = b.billno where a.billno = '" + traApprClass.BillNo + "' group by a.billno) b on 1 = 1 where a.employeecode = '" + userXqClass.jobnumber + "'"; obj = da.GetDataTable(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"用户不存在(DD9002)\",\"errcode\":1}"); return; } dt = obj as DataTable; if (dt.Rows.Count == 0) { context.Response.Write("{\"errmsg\":\"申请信息不存在(DD9003)\",\"errcode\":1}"); return; } AuditingGuid = dt.Rows[0]["guid"].ToString(); #endregion #region 发送工作通知消息 CsJson = "{\"agent_id\":\"" + agentId + "\",\"userid_list\":\"" + traApprClass.DDAuditingId + "," + traApprClass.CopyPerson + "," + traApprClass.DDOperatorId + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"" + ddUrl + "/shenpi/index.html?billno=" + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"已" + audiIdea + "【" + audiName + "】\",\"text\":\"出发日期: " + dt.Rows[0]["StartDate"].ToString() + "\r\n申请人: " + traApprClass.OperatorName + "【出差】\r\n审批意见: " + traApprClass.AuditingIdea + "\"}}}"; url = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + access_token; FhJson = ToolsClass.ApiFun("POST", url, CsJson); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nProInfo=>CsJson:" + CsJson + "FhJson\r\n:" + FhJson); } XXTZ xxtzClass2 = new XXTZ(); xxtzClass2 = (XXTZ)JsonConvert.DeserializeObject(FhJson, typeof(XXTZ)); errcode = xxtzClass2.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"您的出差申请消息通知失败(DD6004)\",\"errcode\":1}"); return; } #endregion #region 发送普通会话消息 //if (traApprClass.Cid != "" && traApprClass.Cid != null) //{ // CsJson = "{\"cid\":\"" + traApprClass.Cid + "\",\"sender\":\"" + traApprClass.DDOperatorId + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"http://oa.romens.cn:8090/shenpi/index.html?billno=" + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"已" + audiIdea + "\",\"text\":\"" + audiName + audiIdea + "了审批\"}}}"; // url = "https://oapi.dingtalk.com/message/send_to_conversation?access_token=" + access_token; // FhJson = ToolsClass.ApiFun("POST", url, CsJson); // if (isWrite == "1") // { // ToolsClass.TxtLog("DDLog", "\r\nProInfo=>CsJson:" + CsJson + "FhJson\r\n:" + FhJson); // } // XXTZ xxtzClass = new XXTZ(); // xxtzClass = (XXTZ)JsonConvert.DeserializeObject(FhJson, typeof(XXTZ)); // errcode = xxtzClass.errcode; // if (errcode != 0) // { // context.Response.Write("{\"errmsg\":\"您的出差申请消息通知失败(DD6004)\",\"errcode\":1}"); // return; // } //} #endregion #region 更新审批信息 //更新单据消息id与返回内容 Sql = "update TravelReq set isauditing='" + traApprClass.IsAuditing + "',auditingdate=getdate(),auditingidea='" + traApprClass.AuditingIdea + "',DDAuditingId='" + traApprClass.DDAuditingId + "',auditingguid='" + AuditingGuid + "',auditingname='" + audiName + "' where billno='" + traApprClass.BillNo + "'"; if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nProInfo=>update:" + Sql.ToString() + "\r\n"); } obj = da.ExecSql(Sql); if (obj == null) { if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nProInfo=>update:" + Sql.ToString() + "\r\n"); } context.Response.Write("{\"errmsg\":\"更新审批信息出错(DD6006)\",\"errcode\":1}"); return; } #endregion context.Response.Write("{\"errmsg\":\"ok\",\"errcode\":0}"); return; } catch (Exception ex) { context.Response.Write("{\"errmsg\":\"提交的信息有误(DD0005)\",\"errcode\":1}"); context.Response.End(); } }
string ddUrl = ""; //钉钉前端地址 public void ProcessRequest(HttpContext context) { //判断客户端请求是否为post方法 if (context.Request.HttpMethod.ToUpper() != "POST") { context.Response.Write("{\"errmsg\":\"请求方式不允许,请使用POST方式(DD0001)\",\"errcode\":1}"); return; } //数据库链接 connectionString = ToolsClass.GetConfig("DataOnLine"); //sqlServer da = new DbHelper.SqlHelper("SqlServer", connectionString); //获取请求json using (var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8)) { CsJson = reader.ReadToEnd(); } if (CsJson == "") { context.Response.Write("{\"errmsg\":\"报文格式错误(DD0003)\",\"errcode\":1}"); return; } CsJson = Regex.Replace(CsJson, @"[\n\r]", "").Replace(@"\n", ""); //#微应用ID:agentId #企业ID:corpId #应用的唯一标识:appKey #应用的密钥:appSecret AppWyy = ToolsClass.GetConfig("AppWyy"); ScList = AppWyy.Split('$'); agentId = ScList[0].ToString(); corpId = ScList[1].ToString(); appKey = ScList[2].ToString(); appSecret = ScList[3].ToString(); isWrite = ToolsClass.GetConfig("isWrite"); ddUrl = ToolsClass.GetConfig("ddUrl"); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nTxfAudi=>入参:" + CsJson + "\r\n"); } //前端传入数据 TravelApproval traApprClass = new TravelApproval(); traApprClass = (TravelApproval)JsonConvert.DeserializeObject(CsJson, typeof(TravelApproval)); try { if (traApprClass.IsSp == "1") { audiIdea = "同意"; } else if (traApprClass.IsSp == "2") { audiIdea = "驳回"; } else { audiIdea = "抄送"; } if (traApprClass.FeeType == "01") { //市内交通费 billTypeNo = "100520005015"; ProName = "EXPEAUDITING"; typeName = "交通费"; typeUrl = ddUrl + "/jtfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "02") { //通讯费 billTypeNo = "100520005020"; ProName = "EXPEAUDITING"; typeName = "通讯费"; typeUrl = ddUrl + "/txfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "03") { //车辆费 billTypeNo = "100520005025"; ProName = "EXPEAUDITING"; typeName = "车辆费"; typeUrl = ddUrl + "/clui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "04") { //房租费 billTypeNo = "100520005030"; ProName = "EXPEAUDITING"; typeName = "房租费"; typeUrl = ddUrl + "/fzfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "05") { //水费 billTypeNo = "100520005035"; ProName = "EXPEAUDITING"; typeName = "水费"; typeUrl = ddUrl + "/sfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "06") { //电费 billTypeNo = "100520005040"; ProName = "EXPEAUDITING"; typeName = "电费"; typeUrl = ddUrl + "/dfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "00") { //招待费 billTypeNo = "100520005010"; ProName = "EXPEAUDITING"; typeName = "招待费"; typeUrl = ddUrl + "/zdfui/shenpi/index.html?billno="; } else { context.Response.Write("{\"errmsg\":\"提交的报销类型不存在(DD9001)\",\"errcode\":1}"); return; } #region 获取access_token url = "https://oapi.dingtalk.com/gettoken?appkey=" + appKey + "&appsecret=" + appSecret; FhJson = ToolsClass.ApiFun("GET", url, ""); TokenClass tokenClass = new TokenClass(); tokenClass = (TokenClass)JsonConvert.DeserializeObject(FhJson, typeof(TokenClass)); access_token = tokenClass.access_token; errcode = tokenClass.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"获取ACCESS_TOKEN报错(DD0004)\",\"errcode\":1}"); return; } #endregion #region 获取用户详情 url = "https://oapi.dingtalk.com/user/get?access_token=" + access_token + "&userid=" + traApprClass.DDAuditingId; FhJson = ToolsClass.ApiFun("GET", url, ""); GetUserXq userXqClass = new GetUserXq(); userXqClass = (GetUserXq)JsonConvert.DeserializeObject(FhJson, typeof(GetUserXq)); errcode = userXqClass.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"获取审批人详细信息报错(DD6003)\",\"errcode\":1}"); return; } audiName = userXqClass.name; #endregion #region 获取用户guid if (traApprClass.FeeType == "00") { Sql = "select top 1 a.Guid,b.BillCount,b.FeeAmount from Employee a left join (select BillCount,FeeAmount from EXPEENTEMENT where billno = '[申请号]') b on 1 = 1 where a.employeecode = '[工号]'"; } else { Sql = "select top 1 a.Guid,b.BillCount,b.FeeAmount from Employee a left join (select BillCount,FeeAmount from EXPEOTHER where billno = '[申请号]') b on 1 = 1 where a.employeecode = '[工号]'"; } Sql = Sql.Replace("[申请号]", traApprClass.BillNo).Replace("[工号]", userXqClass.jobnumber); obj = da.GetDataTable(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"用户不存在(DD6000)\",\"errcode\":1}"); return; } dt = obj as DataTable; AuditingGuid = dt.Rows[0]["Guid"].ToString(); #endregion #region 更新审批信息 if (traApprClass.FeeType == "00") { //更新单据消息id与返回内容 Sql = "update EXPEENTEMENT set IsSp='" + traApprClass.IsSp + "',auditingidea='" + traApprClass.AuditingIdea + "',DDAuditingId='" + traApprClass.DDAuditingId + "',auditingguid='" + AuditingGuid + "' where billno='" + traApprClass.BillNo + "'"; } else { //更新单据消息id与返回内容 Sql = "update EXPEOTHER set IsSp='" + traApprClass.IsSp + "',auditingidea='" + traApprClass.AuditingIdea + "',DDAuditingId='" + traApprClass.DDAuditingId + "',auditingguid='" + AuditingGuid + "' where billno='" + traApprClass.BillNo + "'"; } if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nTxfAudi=>update:" + Sql.ToString() + "\r\n"); } obj = da.ExecSql(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"更新审批信息出错(DD6006)\",\"errcode\":1}"); return; } #endregion #region 调用审核存储过程 if (traApprClass.IsSp == "1") { billno = traApprClass.BillNo; if (!sqlPro()) { if (traApprClass.FeeType == "00") { Sql = "update EXPEENTEMENT set IsSp='0',auditingidea=null,DDAuditingId=null,auditingguid=null where billno='" + traApprClass.BillNo + "'"; } else { Sql = "update EXPEOTHER set IsSp='0',auditingidea=null,DDAuditingId=null,auditingguid=null where billno='" + traApprClass.BillNo + "'"; } obj = da.ExecSql(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"更新审批状态出错(DD6006)\",\"errcode\":1}"); return; } context.Response.Write("{\"errmsg\":\"" + ProResult + "(DD9003)\",\"errcode\":1}"); return; } } #endregion #region 发送工作通知消息 CsJson = "{\"agent_id\":\"" + agentId + "\",\"userid_list\":\"" + traApprClass.DDAuditingId + "," + traApprClass.CopyPerson + "," + traApprClass.DDOperatorId + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"" + typeUrl + "" + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"已" + audiIdea + "【" + audiName + "】\",\"text\":\"金额: " + dt.Rows[0]["FeeAmount"].ToString() + "¥ 发票: " + dt.Rows[0]["BillCount"].ToString() + "张\r\n申请人: " + traApprClass.OperatorName + "【" + typeName + "】\r\n审批意见: " + traApprClass.AuditingIdea + "\"}}}"; url = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + access_token; FhJson = ToolsClass.ApiFun("POST", url, CsJson); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nTxfAudi=>CsJson:" + CsJson + "FhJson\r\n:" + FhJson); } XXTZ xxtzClass2 = new XXTZ(); xxtzClass2 = (XXTZ)JsonConvert.DeserializeObject(FhJson, typeof(XXTZ)); errcode = xxtzClass2.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"您的报销申请消息通知失败(DD6004)\",\"errcode\":1}"); return; } #endregion context.Response.Write("{\"errmsg\":\"ok\",\"errcode\":0}"); return; } catch (Exception ex) { context.Response.Write("{\"errmsg\":\"提交的信息有误(DD0005)\",\"errcode\":1}"); context.Response.End(); } }
string ddUrl = ""; //钉钉前端地址 public void ProcessRequest(HttpContext context) { //判断客户端请求是否为post方法 if (context.Request.HttpMethod.ToUpper() != "POST") { context.Response.Write("{\"errmsg\":\"请求方式不允许,请使用POST方式(DD0001)\",\"errcode\":1}"); return; } //数据库链接 connectionString = ToolsClass.GetConfig("DataOnLine"); //sqlServer da = new DbHelper.SqlHelper("SqlServer", connectionString); //获取请求json using (var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8)) { CsJson = reader.ReadToEnd(); } if (CsJson == "") { context.Response.Write("{\"errmsg\":\"报文格式错误(DD0003)\",\"errcode\":1}"); return; } CsJson = Regex.Replace(CsJson, @"[\n\r]", "").Replace(@"\n", ""); //#微应用ID:agentId #企业ID:corpId #应用的唯一标识:appKey #应用的密钥:appSecret AppWyy = ToolsClass.GetConfig("AppWyy"); ScList = AppWyy.Split('$'); agentId = ScList[0].ToString(); corpId = ScList[1].ToString(); appKey = ScList[2].ToString(); appSecret = ScList[3].ToString(); isWrite = ToolsClass.GetConfig("isWrite"); ddUrl = ToolsClass.GetConfig("ddUrl"); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nSendMsg=>入参:" + CsJson + "\r\n"); } //前端传入数据 TravelApproval traApprClass = new TravelApproval(); traApprClass = (TravelApproval)JsonConvert.DeserializeObject(CsJson, typeof(TravelApproval)); try { #region 设置消息跳转链接地址 if (traApprClass.FeeType == "01") { //市内交通费; typeName = "交通费"; typeUrl = ddUrl + "/jtfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "02") { //通讯费 typeName = "通讯费"; typeUrl = ddUrl + "/txfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "03") { //车辆费 typeName = "车辆费"; typeUrl = ddUrl + "/clui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "04") { //房租费 typeName = "房租费"; typeUrl = ddUrl + "/fzfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "05") { //水费 typeName = "水费"; typeUrl = ddUrl + "/sfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "06") { //电费 typeName = "电费"; typeUrl = ddUrl + "/dfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "11") { //出差 typeName = "出差"; typeUrl = ddUrl + "/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "12") { //差旅费 typeName = "差旅费"; typeUrl = ddUrl + "/clfui/shenpi/index.html?billno="; } else if (traApprClass.FeeType == "00") { //招待费 typeName = "招待费"; typeUrl = ddUrl + "/zdfui/shenpi/index.html?billno="; } else { context.Response.Write("{\"errmsg\":\"提交的申请类型不存在(DD9001)\",\"errcode\":1}"); return; } #endregion #region 获取access_token url = "https://oapi.dingtalk.com/gettoken?appkey=" + appKey + "&appsecret=" + appSecret; FhJson = ToolsClass.ApiFun("GET", url, ""); TokenClass tokenClass = new TokenClass(); tokenClass = (TokenClass)JsonConvert.DeserializeObject(FhJson, typeof(TokenClass)); access_token = tokenClass.access_token; errcode = tokenClass.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"获取ACCESS_TOKEN报错(DD0004)\",\"errcode\":1}"); return; } #endregion #region 获取通知信息字段 //出差 if (traApprClass.FeeType == "11") { Sql = "select a.TravelReason,convert(varchar(20),min(b.StartDate),23) StartDate,convert(varchar(20),max(EndDate),23) EndDate from TravelReq a left join TravelReqDetail b on a.billno=b.billno where a.billno='" + traApprClass.BillNo + "' group by a.billno,a.TravelReason"; } //差旅费报销申请 else if (traApprClass.FeeType == "12") { Sql = "select top 1 A.DepaCity1 DepaCity,A.DestCity1 DestCity,b.TranAmount,convert(varchar(20),c.BillDate,23) BillDate from ExpeTravDetail A left join (select billno,sum(TotalAmount) TranAmount from ExpeTravDetail group by billno) b on a.billno=b.billno left join ExpeTrav c on a.BillNo=c.BillNo where a.BillNo = '" + traApprClass.BillNo + "' order by a.depadate"; } //招待费 else if (traApprClass.FeeType == "00") { Sql = "select FeeAmount,BillCount,convert(varchar(20),ReferDate,23) BillDate,Notes from EXPEENTEMENT where billno='" + traApprClass.BillNo + "'"; } //其他费用 else { Sql = "select FeeAmount,BillCount,convert(varchar(20),ReferDate,23) BillDate,Notes from EXPEOTHER where billno='" + traApprClass.BillNo + "'"; } obj = da.GetDataTable(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"用户不存在(DD9002)\",\"errcode\":1}"); return; } dt = obj as DataTable; if (dt.Rows.Count == 0) { context.Response.Write("{\"errmsg\":\"申请信息不存在(DD9003)\",\"errcode\":1}"); return; } #endregion #region 发送工作通知消息 //出差 if (traApprClass.FeeType == "11") { CsJson = "{\"agent_id\":\"" + agentId + "\",\"userid_list\":\"" + traApprClass.CopyPerson + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"" + typeUrl + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"" + traApprClass.OperatorName + "的【" + typeName + "】申请\",\"text\":\"出发日期: " + dt.Rows[0]["StartDate"].ToString() + "\r\n返程日期: " + dt.Rows[0]["EndDate"].ToString() + "\r\n事由: " + dt.Rows[0]["TravelReason"].ToString() + "\"}}}"; } //差旅费报销申请 else if (traApprClass.FeeType == "12") { CsJson = "{\"agent_id\":\"" + agentId + "\",\"userid_list\":\"" + traApprClass.CopyPerson + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"" + typeUrl + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"" + traApprClass.OperatorName + "的【" + typeName + "】报销申请\",\"text\":\"金额: " + dt.Rows[0]["TranAmount"].ToString() + " ¥\r\n行程: " + dt.Rows[0]["DepaCity"].ToString() + " - " + dt.Rows[0]["DestCity"].ToString() + "\r\n申请日期: " + dt.Rows[0]["BillDate"].ToString() + "\"}}}"; } //其他费用 else { CsJson = "{\"agent_id\":\"" + agentId + "\",\"userid_list\":\"" + traApprClass.CopyPerson + "\",\"msg\":{\"msgtype\":\"link\",\"link\":{\"messageUrl\":\"" + typeUrl + traApprClass.BillNo + "\",\"picUrl\":\"@\",\"title\":\"" + traApprClass.OperatorName + "的【" + typeName + "】报销申请\",\"text\":\"金额: " + dt.Rows[0]["FeeAmount"].ToString() + "¥ 发票: " + dt.Rows[0]["BillCount"].ToString() + " 张\r\n申请日期: " + dt.Rows[0]["BillDate"].ToString() + "\r\n备注: " + dt.Rows[0]["Notes"].ToString() + "\"}}}"; } url = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=" + access_token; FhJson = ToolsClass.ApiFun("POST", url, CsJson); if (isWrite == "1") { ToolsClass.TxtLog("DDLog", "\r\nSendMsg=>CsJson:" + CsJson + "FhJson\r\n:" + FhJson); } XXTZ xxtzClass2 = new XXTZ(); xxtzClass2 = (XXTZ)JsonConvert.DeserializeObject(FhJson, typeof(XXTZ)); errcode = xxtzClass2.errcode; if (errcode != 0) { context.Response.Write("{\"errmsg\":\"您的报销申请消息通知失败(DD9004)\",\"errcode\":1}"); return; } #endregion #region 更新 将转发人拼接在抄送人字段后面 //出差 if (traApprClass.FeeType == "11") { Sql = "update TravelReq set CopyPerson=(case when isnull(CopyPerson,' ')=' ' then '" + traApprClass.CopyPerson + "' else CopyPerson+','+'" + traApprClass.CopyPerson + "' end) where billno='" + traApprClass.BillNo + "'"; } //差旅费报销申请 else if (traApprClass.FeeType == "12") { Sql = "update ExpeTrav set CopyPerson=(case when isnull(CopyPerson,' ')=' ' then '" + traApprClass.CopyPerson + "' else CopyPerson+','+'" + traApprClass.CopyPerson + "' end) where billno='" + traApprClass.BillNo + "'"; } //招待费 else if (traApprClass.FeeType == "00") { Sql = "update EXPEENTEMENT set CopyPersonID=(case when isnull(CopyPersonID,' ')=' ' then '" + traApprClass.CopyPerson + "' else CopyPersonID+','+'" + traApprClass.CopyPerson + "' end) where billno='" + traApprClass.BillNo + "'"; } //其他费用 else { Sql = "update EXPEOTHER set CopyPersonID=(case when isnull(CopyPersonID,' ')=' ' then '" + traApprClass.CopyPerson + "' else CopyPersonID+','+'" + traApprClass.CopyPerson + "' end) where billno='" + traApprClass.BillNo + "'"; } obj = da.ExecSql(Sql); if (obj == null) { context.Response.Write("{\"errmsg\":\"更新抄送人信息出错(DD9005)\",\"errcode\":1}"); return; } #endregion context.Response.Write("{\"errmsg\":\"ok\",\"errcode\":0}"); return; } catch (Exception ex) { context.Response.Write("{\"errmsg\":\"提交的信息有误(DD9006)\",\"errcode\":1}"); context.Response.End(); } }