风控中台对接-评分结果处理保存

This commit is contained in:
zhanglei 2023-08-25 16:41:21 +08:00
parent 2c1d168224
commit b76daf6e19
7 changed files with 366 additions and 153 deletions

View File

@ -763,12 +763,6 @@
<attribute name="score_result_id" label="唯一标识" type="STRING" length="32" />
<attribute name="project_no" label="业务申请编号" type="STRING" length="32" />
<attribute name="flow_no" label="流程编号" type="STRING" length="32"/>
<attribute name="fraud_result_data" label="反欺诈结果" type="STRING" length="2000"/>
<attribute name="score_result_data" label="评分结果" type="STRING" length="2000"/>
<attribute name="fraud_result_status" label="反欺诈结果状态" type="STRING" length="32"/>
<attribute name="fraud_result_status_value" label="反欺诈结果状态描述" type="STRING" length="32"/>
<attribute name="score_result_status" label="评分结果状态" type="STRING" length="32"/>
<attribute name="score_result_status_value" label="评分结果状态描述" type="STRING" length="32"/>
<attribute name="fraud_alert_code" label="反欺诈预警结果H、S、C" type="STRING" length="32"/>
<attribute name="fraud_taken_code" label="反欺诈判定结果F、K、S、空" type="STRING" length="32"/>
<attribute name="score_result_code" label="评分结果 AA RR RD DD" type="STRING" length="32"/>
@ -794,6 +788,11 @@
<attribute name="person_card_no" label="人员证件号码" type="STRING" length="32"/>
<attribute name="third_result_url" label="三方结果链接地址" type="STRING" length="500"/>
<attribute name="pboc_result_url" label="pboc结果链接地址" type="STRING" length="500"/>
<attribute name="score_level" label="登记时间" type="STRING" length="32"/>
<attribute name="third_state_code" label="登记时间" type="STRING" length="32"/>
<attribute name="error_message" label="登记时间" type="STRING" length="32"/>
<attribute name="name_result" label="登记时间" type="STRING" length="32"/>
<attribute name="cert_id_result" label="登记时间" type="STRING" length="32"/>
<attribute name="input_time" label="登记时间" type="STRING" length="32"/>
<attribute name="update_time" label="更新时间" type="STRING" length="32"/>
</attributes>
@ -809,10 +808,9 @@
<attribute name="score_result_id" label="唯一标识" type="STRING" length="32" />
<attribute name="project_no" label="业务申请编号" type="STRING" length="32" />
<attribute name="flow_no" label="流程编号" type="STRING" length="32"/>
<attribute name="result_type" label="推送结果类型:评分结果 score, 反欺诈 fraud" type="STRING" length="32"/>
<attribute name="result_data" label="结果" type="STRING" length="2000"/>
<attribute name="result_status" label="结果状态" type="STRING" length="32"/>
<attribute name="result_status_value" label="结果状态描述" type="STRING" length="32"/>
<attribute name="fraud_alert_code" label="反欺诈预警结果H、S、C" type="STRING" length="32"/>
<attribute name="fraud_taken_code" label="反欺诈判定结果F、K、S、空" type="STRING" length="32"/>
<attribute name="score_result_code" label="评分结果 AA RR RD DD" type="STRING" length="32"/>
<attribute name="input_time" label="登记时间" type="STRING" length="32"/>
</attributes>
<manager>
@ -821,5 +819,23 @@
</managerProperties>
</manager>
</class>
<class name="RC_CALLBACK_LOG" label="北财风控中台回调接口处理日志表" describe="北财风控中台回调接口处理日志表" keyAttributes="id">
<attributes>
<attribute name="id" label="唯一标识" type="STRING" length="32" />
<attribute name="callback_id" label="唯一标识" type="STRING" length="32" />
<attribute name="project_no" label="业务申请编号" type="STRING" length="32" />
<attribute name="callback_type" label="推送结果类型:评分结果 score, 反欺诈 fraud" type="STRING" length="32"/>
<attribute name="callback_data" label="结果" type="STRING" length="2000"/>
<attribute name="handle_sts" label="结果状态" type="STRING" length="32"/>
<attribute name="handle_value" label="结果状态描述" type="STRING" length="32"/>
<attribute name="input_time" label="登记时间" type="STRING" length="32"/>
<attribute name="update_time" label="更新时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="rc_callback_log"/>
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -1,11 +1,20 @@
package com.ample.esb.server;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.*;
import com.ample.sms.WriteRptThread;
import com.tenwa.httpclient.pboc.PbocXmlUtils;
import com.tenwa.reckon.util.UUIDUtil;
import jbo.oti.RC_CALLBACK_LOG;
import jbo.oti.RC_SCORE_RESULT_LOG;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 评分结果推送接收接口
@ -16,29 +25,81 @@ public class ScoreResultServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// TODO: 2023-8-25 确实判断ip白名单
response.setContentType("application/xml;charset:utf-8");
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0L);
response.setCharacterEncoding("utf-8");
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
StringBuilder stb = new StringBuilder();
String xmlHead = "";
String xmlContent = "";
String line = null;
while ((line = in.readLine()) != null) {
stb.append(line);
}
ARE.getLog().info("接收到Rpt记录" + stb.toString());
String userid = request.getParameter("userid");
JSONObject resultJson = new JSONObject();
String userid = request.getParameter("userid");
resultJson.put("cmd","RPT_RESP");
PrintWriter out = response.getWriter();
ARE.getLog().info("接收到Rpt记录" + 1 + "");
resultJson.put("status","200");
resultJson.put("result","success");
try{
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
StringBuilder stb = new StringBuilder();
String line = null;
while ((line = in.readLine()) != null) {
stb.append(line);
}
ARE.getLog().info("接收到Rpt记录" + stb.toString());
savePushLog(stb.toString());
}catch (Exception e){
e.printStackTrace();
resultJson.put("status","500");
resultJson.put("result",e.getMessage());
}
out.print(resultJson.toJSONString());
out.close();
}
private void savePushLog(String xmlRes) throws Exception{
JBOTransaction tx = null;
try{
if (!WriteScoreResultThread.rptIsAlive()) {
WriteScoreResultThread.getRptthread().start();
}
tx = JBOFactory.createJBOTransaction();
JSONObject resStrJson = PbocXmlUtils.toJson(xmlRes);
JSONObject resJson = resStrJson.getJSONObject("APPLICATION");//申请号
JSONObject baseInfoJson = resJson.getJSONObject("BASE_INFO");//申请号
String projectNo = baseInfoJson.getString("APPLICATION_NUMBER");//申请号
BizObjectManager rcCallbackLog = JBOFactory.getBizObjectManager(RC_CALLBACK_LOG.CLASS_NAME, tx);
BizObject rcCallbackLogBizObject = rcCallbackLog.newObject();
rcCallbackLogBizObject.setAttributeValue("project_no", projectNo);
rcCallbackLogBizObject.setAttributeValue("callback_data", xmlRes);
// 推送结果类型评分结果 score, 反欺诈 fraud
rcCallbackLogBizObject.setAttributeValue("callback_type", "score");
rcCallbackLogBizObject.setAttributeValue("handle_sts", "0");
rcCallbackLogBizObject.setAttributeValue("handle_value", "待处理");
String callBackLogId = UUIDUtil.getUUID();
rcCallbackLogBizObject.setAttributeValue("callback_id", callBackLogId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); //日期格式
String date = sdf.format(new Date()); //将系统时间转换成上方指定类型
rcCallbackLogBizObject.setAttributeValue("input_time", date);
rcCallbackLogBizObject.setAttributeValue("update_time", date);
rcCallbackLog.saveObject(rcCallbackLogBizObject);
resStrJson.put("callBackLogId", callBackLogId);
WriteScoreResultThread.scoreResultQueue.put(resStrJson);
} catch (Exception e) {
tx.rollback();
e.printStackTrace();
throw new RuntimeException(e);
} finally {
try {
if (tx != null) {
tx.commit();
}
} catch (JBOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
}

View File

@ -2,10 +2,8 @@ package com.ample.esb.server;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.*;
import com.ample.sms.FileUtil;
import com.tenwa.httpclient.pboc.PbocXmlUtils;
import com.tenwa.reckon.util.UUIDUtil;
@ -15,10 +13,7 @@ import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS;
import jbo.oti.RC_SCORE_RESULT;
import jbo.oti.RC_SCORE_RESULT_DETAIL;
import jbo.oti.RC_SCORE_RESULT_LOG;
import jbo.oti.SMS_RPT;
import jbo.oti.*;
import org.apache.commons.collections.CollectionUtils;
import org.dom4j.DocumentException;
@ -27,7 +22,7 @@ import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
public class WriteScoreResultThread extends Thread{
public static LinkedBlockingQueue<String> scoreResultQueue = new LinkedBlockingQueue<>();
public static LinkedBlockingQueue<JSONObject> scoreResultQueue = new LinkedBlockingQueue<>();
private static boolean STOP = false;
private static Thread rptThread = new WriteScoreResultThread();
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -39,8 +34,8 @@ public class WriteScoreResultThread extends Thread{
STOP = false;
try {
while(!STOP) {
String rptXmlStr = scoreResultQueue.take();
saveSmsRpt(rptXmlStr);
JSONObject resJson = scoreResultQueue.take();
saveSmsRpt(resJson);
}
} catch (Exception var5) {
var5.printStackTrace();
@ -61,8 +56,8 @@ public class WriteScoreResultThread extends Thread{
return rptThread;
}
public void saveSmsRpt(String rptXmlStr) throws JBOException, DocumentException {
JSONObject resJson = PbocXmlUtils.toJson(rptXmlStr);
public void saveSmsRpt(JSONObject resJson) throws JBOException, DocumentException {
saveUpdateScoreResult("score", resJson);
}
@ -70,88 +65,214 @@ public class WriteScoreResultThread extends Thread{
/**
* 保存数据到实体
* @param type 处理类型评分结果 score, 反欺诈 fraud
* @param resJson 结果
* @param resStrJson 结果
*/
private void saveUpdateScoreResult(String type, JSONObject resJson) throws JBOException {
String projectNo = resJson.getString("APPLICATION_NUMBER");//申请号
// TODO: 2023-8-24 解析结果
BizObjectManager rcScoreResult = JBOFactory.getBizObjectManager(RC_SCORE_RESULT.CLASS_NAME);
BizObject rcScoreResultBizObject = rcScoreResult.createQuery("project_no=:project_no").setParameter("project_no", projectNo).getSingleResult(true);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); //日期格式
String date = sdf.format(new Date()); //将系统时间转换成上方指定类型
String resultId = UUIDUtil.getUUID();
if(null == rcScoreResultBizObject){
rcScoreResultBizObject = rcScoreResult.newObject();
rcScoreResultBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultBizObject.setAttributeValue("input_time", date);
}else {
resultId = rcScoreResultBizObject.getAttribute("score_result_id").toString();
}
JSONObject blazeResultJson = resJson.getJSONObject("BLAZERESULT");//评分结果项
String resultCode = blazeResultJson.getString("RESULT_CODE");// 评分结果状态 1000为成功其他失败
String result = blazeResultJson.getString("RESULT");//评分结果 AA RR RD DD
private void saveUpdateScoreResult(String type, JSONObject resStrJson) throws JBOException {
JBOTransaction tx = null;
try{
tx = JBOFactory.createJBOTransaction();
JSONObject resJson = resStrJson.getJSONObject("APPLICATION");//申请号
JSONObject baseInfoJson = resJson.getJSONObject("BASE_INFO");//申请号
String projectNo = baseInfoJson.getString("APPLICATION_NUMBER");//申请号
String flowNo = queryProjectTemp(projectNo);
ARE.getLog().info("WriteScoreResultThread#saveUpdateScoreResultflowNo=" + flowNo);
// : 2023-8-24 解析结果
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); //日期格式
String date = sdf.format(new Date()); //将系统时间转换成上方指定类型
String resultId = UUIDUtil.getUUID();
JSONObject blazeResultJson = resJson.getJSONObject("BLAZERESULT");//评分结果项
String resultCode = blazeResultJson.getString("RESULT_CODE");// 评分结果状态 1000为成功其他失败
String result = blazeResultJson.getString("RESULT");//评分结果 AA RR RD DD
JSONObject fraudResultJson = resJson.getJSONObject("FRAUD_RESULT");// 反欺诈结果
String fraudAlert = fraudResultJson.getString("FRAUD_ALERT");// 反欺诈预警结果HSC
String actionTaken = fraudResultJson.getString("ACTION_TAKEN");// 反欺诈判定结果FKS
rcScoreResultBizObject.setAttributeValue("score_result_code", result);// 评分结果 AA RR RD DD
rcScoreResultBizObject.setAttributeValue("fraud_alert_code", fraudAlert);// 反欺诈预警结果HSC
rcScoreResultBizObject.setAttributeValue("fraud_taken_code", actionTaken);// 反欺诈判定结果FKS
rcScoreResultBizObject.setAttributeValue("update_time", date);
if("score".equals(type)){
rcScoreResultBizObject.setAttributeValue("score_result_data", resJson.toJSONString());
rcScoreResultBizObject.setAttributeValue("score_result_status", resultCode);
rcScoreResultBizObject.setAttributeValue("score_result_status_value", "失败");
if("1000".equals(resultCode)){
rcScoreResultBizObject.setAttributeValue("score_result_status_value", "成功");
JSONObject fraudResultJson = resJson.getJSONObject("FRAUD_RESULT");// 反欺诈结果
String fraudAlert = fraudResultJson.getString("FRAUD_ALERT");// 反欺诈预警结果HSC
String actionTaken = fraudResultJson.getString("ACTION_TAKEN");// 反欺诈判定结果FKS
//评分结果
BizObjectManager rcScoreResult = JBOFactory.getBizObjectManager(RC_SCORE_RESULT.CLASS_NAME, tx);
BizObject rcScoreResultBizObject = rcScoreResult.createQuery("project_no=:project_no").setParameter("project_no", projectNo).getSingleResult(true);
if(null == rcScoreResultBizObject){
rcScoreResultBizObject = rcScoreResult.newObject();
rcScoreResultBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultBizObject.setAttributeValue("flow_no", flowNo);
rcScoreResultBizObject.setAttributeValue("input_time", date);
}else {
resultId = rcScoreResultBizObject.getAttribute("score_result_id").toString();
}
}else {
rcScoreResultBizObject.setAttributeValue("fraud_result_data", resJson.toJSONString());
rcScoreResultBizObject.setAttributeValue("fraud_result_status", resultCode);
rcScoreResultBizObject.setAttributeValue("fraud_result_status_value", "失败");
if("1000".equals(resultCode)){
rcScoreResultBizObject.setAttributeValue("fraud_result_status_value", "成功");
}
rcScoreResultBizObject.setAttributeValue("fraud_result_status", resultCode);
}
rcScoreResult.saveObject(rcScoreResultBizObject);
if("score".equals(type)){
BizObjectManager rcScoreResultDetail = JBOFactory.getBizObjectManager(RC_SCORE_RESULT_DETAIL.CLASS_NAME);
BizObjectManager lbProjectInfo = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME);// 项目信息
BizObjectManager customerPerson = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME);// 承租人
BizObjectManager customerFamily = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME);// 共同申请人
BizObjectManager lbGuaranteeUnit = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME);// 担保人
List<BizObject> rcScoreResultDetailBizObjectList = rcScoreResultDetail.createQuery("project_no=:project_no").setParameter("project_no", projectNo).getResultList(true);
if(CollectionUtils.isEmpty(rcScoreResultDetailBizObjectList)){
rcScoreResultDetailBizObjectList = new ArrayList<>();
JSONArray personList = resJson.getJSONArray("NCIICS");//实名认证列表
JSONArray scoreResults = resJson.getJSONArray("SCORERESULTS");//评分列表
if(personList.size() >= scoreResults.size()){
rcScoreResultBizObject.setAttributeValue("score_result_code", result);// 评分结果 AA RR RD DD
rcScoreResultBizObject.setAttributeValue("fraud_alert_code", fraudAlert);// 反欺诈预警结果HSC
rcScoreResultBizObject.setAttributeValue("fraud_taken_code", actionTaken);// 反欺诈判定结果FKS
rcScoreResultBizObject.setAttributeValue("update_time", date);
rcScoreResult.saveObject(rcScoreResultBizObject);
// 评分结果明细
if("score".equals(type)){
BizObjectManager rcScoreResultDetail = JBOFactory.getBizObjectManager(RC_SCORE_RESULT_DETAIL.CLASS_NAME, tx);
List<BizObject> rcScoreResultDetailBizObjectList = rcScoreResultDetail.createQuery("project_no=:project_no").setParameter("project_no", projectNo).getResultList(true);
if(CollectionUtils.isEmpty(rcScoreResultDetailBizObjectList)){
rcScoreResultDetailBizObjectList = initScoreResultDetailBizObjectList(rcScoreResultDetail, flowNo, projectNo, resultId, date);
}
JSONObject personListObj = resJson.getJSONObject("NCIICS");//实名认证列表
JSONArray personList = personListObj.getJSONArray("NCIIC");//实名认证列表
for(int i = 0; i < personList.size(); i++){
for(BizObject scoreResBiz : rcScoreResultDetailBizObjectList){
if(personList.getJSONObject(i).getString("APPLICANTIDNUMBER").equals(scoreResBiz.getAttribute("person_card_no").toString())){
scoreResBiz.setAttributeValue("third_state_code", personList.getJSONObject(i).getString("THIRDSTATECODE"));
scoreResBiz.setAttributeValue("name_result", personList.getJSONObject(i).getString("NAMERESULT"));
scoreResBiz.setAttributeValue("cert_id_result", personList.getJSONObject(i).getString("CERTINORESULT"));
scoreResBiz.setAttributeValue("error_message", personList.getJSONObject(i).getString("ERRORMESSAGE"));
}
}
}
JSONObject scoreResultsObj = resJson.getJSONObject("BLAZERESULT");//评分列表
JSONObject scoreResultsObjRes = scoreResultsObj.getJSONObject("SCORERESULTS");//评分列表
JSONArray scoreResults = scoreResultsObjRes.getJSONArray("SCORERESULT");//评分列表
for(int i = 0; i < scoreResults.size(); i++){
for(BizObject scoreResBiz : rcScoreResultDetailBizObjectList){
if(scoreResults.getJSONObject(i).getString("ID_CARD_NBR").equals(scoreResBiz.getAttribute("person_card_no").toString())){
scoreResBiz.setAttributeValue("score_level", scoreResults.getJSONObject(i).getString("SCORE_LEVEL"));
}
}
}
for(BizObject scoreResBiz : rcScoreResultDetailBizObjectList){//保存评分明细
scoreResBiz.setAttributeValue("update_time", date);
scoreResBiz.setAttributeValue("third_result_url", "www.baidu.com");
scoreResBiz.setAttributeValue("pboc_result_url", "www.baidu.com");
rcScoreResultDetail.saveObject(scoreResBiz);
}
BizObject bizObject = rcScoreResultDetail.newObject();
}
// 日志保存
BizObjectManager rcScoreResultLog = JBOFactory.getBizObjectManager(RC_SCORE_RESULT_LOG.CLASS_NAME, tx);
BizObject rcScoreResultLogBizObject = rcScoreResultLog.newObject();
rcScoreResultLogBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultLogBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultLogBizObject.setAttributeValue("flow_no", flowNo);
rcScoreResultLogBizObject.setAttributeValue("score_result_code", result);// 评分结果 AA RR RD DD
rcScoreResultLogBizObject.setAttributeValue("fraud_alert_code", fraudAlert);// 反欺诈预警结果HSC
rcScoreResultLogBizObject.setAttributeValue("fraud_taken_code", actionTaken);// 反欺诈判定结果FKS
rcScoreResultLogBizObject.setAttributeValue("input_time", date);
rcScoreResultLog.saveObject(rcScoreResultLogBizObject);
// 更新回调接口执行状态
String callBackLogId = resStrJson.getString("callBackLogId");//处理日志logID
BizObjectManager rcCallbackLog = JBOFactory.getBizObjectManager(RC_CALLBACK_LOG.CLASS_NAME, tx);
BizObject rcCallbackLogBizObject = rcCallbackLog.createQuery("callback_id=:callback_id").setParameter("callback_id", callBackLogId).getSingleResult(true);
rcCallbackLogBizObject.setAttributeValue("handle_sts", "1");
rcCallbackLogBizObject.setAttributeValue("handle_value", "已处理");
rcCallbackLogBizObject.setAttributeValue("update_time", date);
rcCallbackLog.saveObject(rcCallbackLogBizObject);
} catch (Exception e) {
tx.rollback();
e.printStackTrace();
} finally {
try {
if (tx != null) {
tx.commit();
}
} catch (JBOException e) {
e.printStackTrace();
}
}
BizObjectManager rcScoreResultLog = JBOFactory.getBizObjectManager(RC_SCORE_RESULT_LOG.CLASS_NAME);
BizObject rcScoreResultLogBizObject = rcScoreResultLog.newObject();
rcScoreResultLogBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultLogBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultLogBizObject.setAttributeValue("score_result_data", resJson.toJSONString());
rcScoreResultLogBizObject.setAttributeValue("result_status", resultCode);
rcScoreResultLogBizObject.setAttributeValue("result_status_value", "失败");
if("1000".equals(resultCode)){
rcScoreResultLogBizObject.setAttributeValue("result_status_value", "成功");
}
private String queryProjectTemp(String projectNo) throws JBOException {
String flowNo = null;
ARE.getLog().info("WriteScoreResultThread#saveUpdateScoreResultflowNo=" + flowNo);
BizObjectManager lbProjectInfo = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME);// 项目信息
List<BizObject> lbProjectInfoBizObjectList = lbProjectInfo.createQuery("PROJECT_NO=:PROJECT_NO").setParameter("PROJECT_NO", projectNo).getResultList(false);
if(CollectionUtils.isNotEmpty(lbProjectInfoBizObjectList)){
for(BizObject lbProject : lbProjectInfoBizObjectList){
if(null == flowNo){
flowNo = lbProject.getAttribute("FLOWUNID").toString();
ARE.getLog().info("WriteScoreResultThread#saveUpdateScoreResultflowNoTempLong=" + flowNo.substring(3));
}else {
String flowNoTemp = lbProject.getAttribute("FLOWUNID").toString();
ARE.getLog().info("WriteScoreResultThread#saveUpdateScoreResultflowNoTemp=" + flowNo);
if(Long.parseLong(flowNo.substring(3)) < Long.parseLong(flowNoTemp.substring(3))){
flowNo = flowNoTemp;
}
}
}
}
rcScoreResultLogBizObject.setAttributeValue("input_time", date);
rcScoreResultLog.saveObject(rcScoreResultLogBizObject);
return flowNo;
}
// bo.setAttributeValue(key,rptJsn.getString(key));
/**
* 保存详细数据
* @param rcScoreResultDetail
* @param flowNo
* @param projectNo
* @param resultId
* @return
* @throws JBOException
*/
private List<BizObject> initScoreResultDetailBizObjectList(BizObjectManager rcScoreResultDetail, String flowNo, String projectNo, String resultId, String date) throws JBOException {
List<BizObject> rcScoreResultDetailBizObjectList = new ArrayList<>();
// 承租人
BizObjectManager customerPerson = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME);
BizObject customerPersonBizObject = customerPerson.createQuery("flowunid=:flowunid").setParameter("flowunid", flowNo).getSingleResult(false);
BizObject rcScoreResultDetailCustomerPersonBizObject = rcScoreResultDetail.newObject();
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("score_result_detail_id", UUIDUtil.getUUID());
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("flow_no", flowNo);
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("person_type", "01");//承租人
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("person_name",
customerPersonBizObject.getAttribute("FULLNAME").toString());// 承租人姓名
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("person_card_type",
customerPersonBizObject.getAttribute("CERTTYPE").toString());// 承租人
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("person_card_no",
customerPersonBizObject.getAttribute("CERTID").toString());// 承租人
rcScoreResultDetailCustomerPersonBizObject.setAttributeValue("input_time", date);
rcScoreResultDetailBizObjectList.add(rcScoreResultDetailCustomerPersonBizObject);
// 共同申请人
BizObjectManager customerFamily = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME);
BizObject customerFamilyBizObject = customerFamily.createQuery("flowunid=:flowunid and Partner_='Y'")
.setParameter("flowunid", flowNo).getSingleResult(false);
if(null != customerFamilyBizObject){
BizObject rcScoreResultDetailCustomerFamilyBizObject = rcScoreResultDetail.newObject();
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("score_result_detail_id", UUIDUtil.getUUID());
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("flow_no", flowNo);
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("person_type", "02");//共同申请人
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("person_name",
customerFamilyBizObject.getAttribute("name").toString());//共同申请人姓名
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("person_card_type",
customerFamilyBizObject.getAttribute("certtype").toString());//共同申请人
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("person_card_no",
customerFamilyBizObject.getAttribute("certid").toString());//共同申请人
rcScoreResultDetailCustomerFamilyBizObject.setAttributeValue("input_time", date);
rcScoreResultDetailBizObjectList.add(rcScoreResultDetailCustomerFamilyBizObject);
}
// 担保人
BizObjectManager guaranteeUnit = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME);
List<BizObject> guaranteeUnitBizObjectList = guaranteeUnit.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", flowNo).getResultList(false);
if(CollectionUtils.isNotEmpty(guaranteeUnitBizObjectList)){
for(BizObject guarantee : guaranteeUnitBizObjectList){
BizObject rcScoreResultDetailGuaranteeUnitBizObject = rcScoreResultDetail.newObject();
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("score_result_detail_id", UUIDUtil.getUUID());
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("score_result_id", resultId);
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("project_no", projectNo);
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("flow_no", flowNo);
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("person_type", "03");//担保人
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("person_name",
guarantee.getAttribute("FULLNAME").toString());//担保人姓名
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("person_card_type",
guarantee.getAttribute("CERTTYPE").toString());//担保人
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("person_card_no",
guarantee.getAttribute("CERTID").toString());//担保人
rcScoreResultDetailGuaranteeUnitBizObject.setAttributeValue("input_time", date);
rcScoreResultDetailBizObjectList.add(rcScoreResultDetailGuaranteeUnitBizObject);
}
}
return rcScoreResultDetailBizObjectList;
}
}

View File

@ -0,0 +1,46 @@
package jbo.oti;
/**
* 北财风控中台评分反欺诈结果推送日志表 rc_score_result_log
*/
public interface RC_CALLBACK_LOG {
/**
* 业务类型<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.RC_CALLBACK_LOG";
/**
* id`
* STRING(20)<br>
*/
public static final String id = "id";
public static final String callback_id = "callback_id";
/**
* 业务申请编号
*/
public static final String project_no = "project_no";
/**
* 推送结果类型评分结果 score, 反欺诈 fraud
*/
public static final String callback_type = "callback_type";
public static final String callback_data = "callback_data";
/**
* 处理状态0 返回结果待处理1 返回结果已处理
*/
public static final String handle_sts = "handle_sts";
public static final String handle_value = "handle_value";
public static final String input_time = "input_time";
public static final String update_time = "update_time";
}

View File

@ -32,42 +32,6 @@ public interface RC_SCORE_RESULT {
*/
public static final String flow_no = "flow_no";
/**
* 反欺诈结果
*/
public static final String fraud_result_data = "fraud_result_data";
/**
* 评分结果
*/
public static final String score_result_data = "score_result_data";
/**
* 反欺诈结果状态
*/
public static final String fraud_result_status = "fraud_result_status";
/**
* 反欺诈结果状态描述
*/
public static final String fraud_result_status_value = "fraud_result_status_value";
/**
* 评分结果状态
*/
public static final String score_result_status = "score_result_status";
/**
* 评分结果状态描述
*/
public static final String score_result_status_value = "score_result_status_value";
/**
* 反欺诈预警结果HSC
*/

View File

@ -71,6 +71,7 @@ public interface RC_SCORE_RESULT_DETAIL {
*/
public static final String pboc_result_url = "pboc_result_url";
/**
* 登记时间
*/
@ -82,6 +83,15 @@ public interface RC_SCORE_RESULT_DETAIL {
*/
public static final String update_time = "update_time";
public static final String score_level = "score_level";
public static final String third_state_code = "third_state_code";
public static final String error_message = "error_message";
public static final String name_result = "name_result";
public static final String cert_id_result = "cert_id_result";
}

View File

@ -10,6 +10,7 @@ public interface RC_SCORE_RESULT_LOG {
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.RC_SCORE_RESULT_LOG";
/**
* id`
* STRING(20)<br>
@ -32,23 +33,22 @@ public interface RC_SCORE_RESULT_LOG {
*/
public static final String flow_no = "flow_no";
/**
* 结果
* 反欺诈预警结果HSC
*/
public static final String result_data = "result_data";
public static final String fraud_alert_code = "fraud_alert_code";
/**
* 结果状态
* 反欺诈判定结果FKS
*/
public static final String result_status = "result_status";
public static final String fraud_taken_code = "fraud_taken_code";
/**
* 反结果状态描述
* 评分结果 AA RR RD DD
*/
public static final String result_status_value = "result_status_value";
public static final String score_result_code = "score_result_code";
/**
@ -57,11 +57,6 @@ public interface RC_SCORE_RESULT_LOG {
public static final String input_time = "input_time";
/**
* 更新时间
*/
public static final String update_time = "update_time";
}