public void ConfirmOrder(DdjbxxModel ddModel, List <DdZhxmModel> zhxmList, QyygxxModel ygModel) { StringBuilder strSql = new StringBuilder(); using (IDbConnection conn = new DapperConnection().DbConnection) { IDbTransaction transaction = conn.BeginTransaction(); try { if (ddModel.jsbz == 0)//自已才更新 { strSql.AppendFormat("UPDATE dbo.qy_ygxx SET sfyy=@sfyy WHERE id=@id"); conn.Execute(strSql.ToString(), new { sfyy = ygModel.sfyy, id = ygModel.id }, transaction); } strSql.Clear(); if (string.IsNullOrEmpty(ddModel.csrq)) { ddModel.csrq = DateTime.Now.ToString("yyyy-MM-dd"); } strSql.Append("insert into dd_jbxx_new("); strSql.Append("trade_no,zffs,ddbh,dsfdd,dsfbzid,ddzt,tcid,tcmc,dwbh,tcjg,jxbjg,ddze,intime,sfout,outtime,dh,xm,xb,hz,zjlx,zjhm,yykssj,yyjssj,sfdj,djtime,sfbg,bgtime,djlsh,sfjx,jxlist,sfjs,csrq,nl,remark,yybh,ddly,dwmc,jsbz,ygzh)"); strSql.Append(" values ("); strSql.Append("'',@zffs,@ddbh,@dsfdd,@dsfbzid,@ddzt,@tcid,@tcmc,@dwbh,@tcjg,@jxbjg,@ddze,@intime,@sfout,@outtime,@dh,@xm,@xb,@hz,@zjlx,@zjhm,@yykssj,@yyjssj,@sfdj,@djtime,@sfbg,@bgtime,@djlsh,@sfjx,@jxlist,@sfjs,@csrq,@nl,@remark,@yybh,@ddly,@dwmc,@jsbz,@ygzh)"); conn.Execute(strSql.ToString(), ddModel, transaction); strSql.Clear(); strSql.Append("insert into dd_zhxm("); strSql.Append("ddbh,zhxmbh,zhxmmc,jg,sfjx,sfdj)"); strSql.Append(" values ("); strSql.Append("@ddbh,@zhxmbh,@zhxmmc,@jg,@sfjx,@sfdj)"); conn.Execute(strSql.ToString(), zhxmList, transaction); transaction.Commit(); } catch (Exception ex) { LogApiHelper.AddLog(ex.Message); transaction.Rollback(); throw; } } }
/// <summary> /// 第三方平台按项目取消部分费用 /// </summary> /// <param name="regno">第三方平台流水号</param> /// <param name="type">C项目退费 R取消项目退费</param> /// <param name="ItemList">第三方平台体检人员到检信息反馈] 接口所返回的comb_code(待退费组合码)数组</param> /// <param name="Message"></param> /// <returns></returns> public static ReturnMessage CancelPartFeeByItem(string regno, string type, string[] ItemList) { ReturnMessage Message = ckeckJG(model); if (Message.state != "200") { Message.state = "402"; Message.message = "CancelPartFeeByItem-0机构校验失败"; Message.result = ""; return(Message); } string access_token = ""; #region 获取token string nysykey = "nysy_access_token"; if (AspNetCache.Exist(nysykey) == false) { ReturnMessage tokenModel = getToke(); if (tokenModel.state != "200") { Message.message = tokenModel.message; Message.state = tokenModel.state; Message.result = ""; return(Message); } access_token = tokenModel.result.ToString(); AspNetCache.Insert(nysykey, access_token, DateTime.Now.AddSeconds(7000)); } else { access_token = AspNetCache.Get <string>(nysykey); } #endregion try { string apiUrl = model.jgjkurl;//请求地址 apiUrl += "api/External/CancelPartFeeByItem"; NameValueCollection Headers = new NameValueCollection(); Headers.Add("Authorization", "Bearer " + access_token); //NameValueCollection parameters = new NameValueCollection(); //parameters.Add("regno", regno); //parameters.Add("type", type); //parameters.Add("ItemList", ItemList.ToString()); string jsonStr = "{'regno':'" + regno + "','type':'" + type + "','ItemList':" + JsonConvert.SerializeObject(ItemList) + "}"; LogApiHelper.AddLog("CancelPartFeeByItem jsonStr=" + jsonStr); string resultStr = Common.WebHelper.PostData_OAuth2_V3(apiUrl, jsonStr, Headers); if (string.IsNullOrEmpty(resultStr)) { Message.state = "403"; Message.message = "CancelPartFeeByItem-1取消部分费用失败"; Message.result = ""; return(Message); } else { dynamic resultObject = JsonConvert.DeserializeObject <dynamic>(resultStr); if (resultObject.success == true) { returnData TCList = JsonConvert.DeserializeObject <returnData>(Convert.ToString(resultObject.returnData)); Message.state = "200"; Message.message = ""; Message.result = resultObject.returnData; return(Message); } else { Message.state = "406"; Message.message = resultObject.returnMsg; Message.result = ""; LogApiHelper.AddErrorLog("CancelPartFeeByItem-2取消部分费用失败=" + resultObject.msg); return(Message); } } } catch (Exception ex) { Message.state = "407"; Message.message = "获取套餐信息异常:" + ex.ToString(); Message.result = ""; LogApiHelper.AddErrorLog("CancelPartFeeByItem-3取消部分费用失败=" + ex.ToString()); return(Message); } }