public static void DataRiskBack(string stream)
 {
     CommonFunction.WriteH3Log("大数据风控回调开始,参数:" + stream);
     try
     {
         bool rtn = false;
         JavaScriptSerializer js = new JavaScriptSerializer();
         var result = js.Deserialize <drResult>(stream);
         List <DataItemParam> keyValues = new List <DataItemParam>();
         keyValues.Add(new DataItemParam()
         {
             ItemName  = "sqrdsjmx",
             ItemValue = result.data.score
         });
         string           instanceid = result.app_id.Split('_')[0];
         WorkFlowFunction wf         = new WorkFlowFunction();
         string           SchemaCode = "APPLICATION";// wf.getSchemaCodeByInstanceID(instanceid);
         wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(instanceid), keyValues, wf.GetUserIDByCode("rsfk"));
         try
         {
             if (float.Parse(result.data.score) > 0.75)
             {
                 string workItemId = WorkFlowFunction.getRSWorkItemIDByInstanceid(instanceid);
                 if (!CommonFunction.hasData(workItemId))
                 {
                     CommonFunction.WriteH3Log("大数据风控回调结束,当前节点不在风控,不结束流程,参数:" + stream);
                     return;
                 }
                 string Application_Number = "";
                 string UserCode           = "";
                 string sql = @" select a.user_name,a.application_number 
                         from I_application a join OT_instancecontext b on a.objectid = b.bizobjectid 
                         where b.objectid = '{0}'";
                 sql = string.Format(sql, instanceid);
                 DataTable dt = CommonFunction.ExecuteDataTableSql(sql);
                 if (CommonFunction.hasData(dt))
                 {
                     Application_Number = dt.Rows[0]["application_number"].ToString();
                     UserCode           = dt.Rows[0]["user_name"].ToString();
                 }
                 //拒绝,回写CAp
                 Dictionary <string, object> dic = new Dictionary <string, object>();
                 dic.Add("InstanceID", instanceid + string.Empty);
                 dic.Add("Application_Number", Application_Number + string.Empty);
                 dic.Add("StatusCode", "拒绝" + string.Empty);
                 dic.Add("Approval_UserCode", UserCode + string.Empty);
                 dic.Add("Approval_Comment", "东正大数据风控模型拒绝" + string.Empty);
                 CommonFunction.ExecuteBizBus("CAPServiceNew", "ProposalApproval", dic);
                 //结束流程
                 wf.finishedInstance(instanceid);
                 CommonFunction.WriteH3Log("大数据风控回调处理结束,拒绝处理成功," + stream);
                 return;
             }
         }
         catch (Exception ex)
         {
             CommonFunction.WriteH3Log("大数据风控回调处理异常,参数:" + stream + ",错误信息:" + ex.Message);
         }
         rtn = wf.SubmitWorkItemByRongShu(instanceid, "", wf.GetUserIDByCode("rsfk"));
         CommonFunction.WriteH3Log("大数据风控回调处理结束,提交至信审完成," + stream);
         //return rtn.ToString();
     }
     catch (Exception ex)
     {
         CommonFunction.WriteH3Log("大数据风控回调处理异常,参数:" + stream + ",错误信息:" + ex.Message);
     }
 }
示例#2
0
        public void RSRiskControllerResult(RSResult entity)
        {
            bool result = false;

            if (entity != null && entity.reqID != "")
            {
                WorkFlowFunction wf = new WorkFlowFunction();
                //00 - 成功
                //01 - 正在处理中
                //02 - 错误
                //03 - 失败
                //04 - 超时转人工

                List <DataItemParam> keyValues = new List <DataItemParam>();
                string fkResult = "";
                if (entity.code == "00")
                {
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = fkResult
                    });
                    //Automatic_approval:0人工(默认值),1自动审批,-1拒绝
                    if (fkResult == "cloudaccept")
                    {
                        //在融数通过的情况下,根据东正的业务判断是否需要走自动审批
                        #region
                        int auto = 0;
                        auto = wf.AutomaticApprovalByRongShu(entity.reqID);
                        keyValues.Add(new DataItemParam()
                        {
                            ItemName  = "Automatic_approval",
                            ItemValue = auto
                        });
                        #endregion
                    }
                    else
                    {
                        keyValues.Add(new DataItemParam()
                        {
                            ItemName  = "Automatic_approval",
                            ItemValue = 0
                        });
                    }
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                }
                else if (entity.code == "02")
                {
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    //manual:1--》 人工查询外部数据源
                    //manual:2--》 超时重提进件
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = "error"
                    });
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "Automatic_approval",
                        ItemValue = 0
                    });
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                }
                else if (entity.code == "03")
                {
                    OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:处理超时,重新提交");
                    //重新提交请求
                    //string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    //wf.postHttp(SchemaCode, entity.reqID);
                }
                else if (entity.code == "04")//超时转人工
                {
                    OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:处理超时转人工");
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = "overtime"
                    });
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "Automatic_approval",
                        ItemValue = 0
                    });
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                }
            }
            else
            {
                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:回传参数为空!");
            }
        }
        public void RSRiskControllerResult(RSResult entity)
        {
            bool result = false;

            if (entity != null && entity.reqID != "")
            {
                WorkFlowFunction    wf     = new WorkFlowFunction();
                WorkFlowFunctionNew wf_New = new WorkFlowFunctionNew();
                //00 - 成功
                //01 - 正在处理中
                //02 - 错误
                //03 - 失败
                //04 - 超时转人工

                List <DataItemParam> keyValues = new List <DataItemParam>();
                string fkResult = "";
                if (entity.code == "00")
                {
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = fkResult
                    });
                    //Automatic_approval:0人工(默认值),1自动审批,-1拒绝
                    int auto = 0;
                    if (fkResult == "cloudaccept")
                    {
                        //在融数通过的情况下,根据东正的业务判断是否需要走自动审批
                        #region

                        auto = wf_New.AutomaticApprovalByRongShu(entity.reqID);
                        keyValues.Add(new DataItemParam()
                        {
                            ItemName  = "Automatic_approval",
                            ItemValue = auto
                        });
                        #endregion
                    }
                    else
                    {
                        keyValues.Add(new DataItemParam()
                        {
                            ItemName  = "Automatic_approval",
                            ItemValue = 0
                        });
                    }
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    //result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                    //判断是否是外网经销商
                    string dep = "";
                    string sql = @"select b.name from OT_User a join OT_Organizationunit b on a.parentid = b.objectid
                                    join OT_instancecontext c on c.originator = a.objectid
                                    where c.objectid = '{0}'";
                    sql = string.Format(sql, entity.reqID);
                    dep = OThinker.H3.Controllers.AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteScalar(sql).ToString();
                    if (auto == 1 && !dep.Contains("外网"))//自动通过的外网经销商需要走大数据风控模型
                    {
                        result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                    }
                    else
                    {
                        //调用东正大数据模型
                        DataRisk.postDataRisk(entity.reqID);
                    }
                }
                else if (entity.code == "02")
                {
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    //manual:1--》 人工查询外部数据源
                    //manual:2--》 超时重提进件
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = "error"
                    });
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "Automatic_approval",
                        ItemValue = 0
                    });
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    //result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                    //调用东正大数据模型
                    DataRisk.postDataRisk(entity.reqID);
                }
                else if (entity.code == "03")
                {
                    OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:处理超时,重新提交");
                    //重新提交请求
                    //string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    //wf.postHttp(SchemaCode, entity.reqID);
                }
                else if (entity.code == "04")//超时转人工
                {
                    OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:处理超时转人工");
                    //localreject: 部署在东正本地规则拒绝;
                    //cloudaccept: 部署在云端规则通过;
                    //cloudreject: 部署在云端规则拒绝;
                    //cloudmanual: 部署在云端规则返回转人工
                    fkResult = entity.data.action;
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "fkResult",
                        ItemValue = "overtime"
                    });
                    keyValues.Add(new DataItemParam()
                    {
                        ItemName  = "Automatic_approval",
                        ItemValue = 0
                    });
                    string SchemaCode = wf.getSchemaCodeByInstanceID(entity.reqID);
                    wf.SetItemValues(SchemaCode, wf.getBizobjectByInstanceid(entity.reqID), keyValues, wf.GetUserIDByCode("rsfk"));
                    //result = wf.SubmitWorkItemByRongShu(entity.reqID, "", wf.GetUserIDByCode("rsfk"));
                    //调用东正大数据模型
                    DataRisk.postDataRisk(entity.reqID);
                }
            }
            else
            {
                OThinker.H3.Controllers.AppUtility.Engine.LogWriter.Write("融数风控回调执行结果:回传参数为空!");
            }
        }