贷前征信配置

This commit is contained in:
zhanglei 2018-07-02 21:11:32 +08:00
parent 16c86d496e
commit 0392ca1d2a
6 changed files with 852 additions and 341 deletions

View File

@ -1,20 +1,19 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-24
Author: undefined 2018-07-02
Content:
History Log:
*/
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
String entryId=CurPage.getParameter("entryId");
ASObjectModel doTemp = new ASObjectModel("LbCarCreditRiskShow");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(entryId);
dwTemp.genHTMLObjectWindow(sFlowUnid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","返回","返回","goBack()","","","","btn_icon_back",""}
};

View File

@ -15,22 +15,28 @@
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","信贷校验","信贷校验","creditVerification()","","","","btn_icon_detail",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
var sUrl = "";
AsControl.OpenView(sUrl,'','_self','');
function creditVerification(){
var pUrl = "/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditRiskShow.jsp";
var sFlowUnid = "<%=sFlowUnid%>";
alert(sFlowUnid);
var result = RunJavaMethodTrans("com.tenwa.comm.credit.CreditBodyGuardAction","doCreditVerification","flowunid="+sFlowUnid);
if(result == 'ERROR'){
alert("调用数据失败");
}else if(result == 'SUCCESS'){
reloadSelf();
}else{
alert(result);
}
}
function viewAndEdit(){
var sUrl = "";
var sPara = getItemValue(0,getRow(0),'SerialNo');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("参数不能为空!");
return ;
}
AsControl.OpenView(sUrl,'SerialNo=' +sPara ,'_self','');
var sUrl = "/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditRiskShow.jsp";
var sparam="FlowUnid="+'<%=sFlowUnid%>';
AsControl.OpenView(sUrl,sparam,"_self","");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -17,59 +17,66 @@ import com.alibaba.fastjson.JSON;
public class BodyGuardApiInvoker {
private static final Log log = LogFactory.getLog(BodyGuardApiInvoker.class);
private static final String apiUrl = "https://apitest.tongdun.cn/bodyguard/apply/v4.2";
/*private static final String apiUrl = "https://apitest.tongdun.cn/bodyguard/apply/v4.2";
private static final String PARTNER_CODE = "apgj";// ºÏ×÷·½±êÊ
private static final String PARTNER_KEY = "3a7be6a6d73c48b18f083ddf8d399538";//ºÏ×÷·½ÃÜÔ¿
private static final String PARTNER_APP = "apgj_web";//应用名
private static final String PARTNER_APP = "apgj_web";//应用名
*/
private static final String apiUrl = CreditPropertiesUtil.get("apiUrl");//请求url
private static final String PARTNER_CODE = CreditPropertiesUtil.get("PARTNER_CODE");// 合作方标识
private static final String PARTNER_KEY = CreditPropertiesUtil.get("PARTNER_KEY");//合作方密钥
private static final String PARTNER_APP = CreditPropertiesUtil.get("PARTNER_APP");//应用名
private HttpURLConnection conn;
public BodyGuardApiResponse invoke(Map<String, Object> params) {
try {
String urlString = new StringBuilder().append(apiUrl).append("?partner_code=").append(PARTNER_CODE).append("&partner_key=").append(PARTNER_KEY).append("&app_name=").append(PARTNER_APP).toString();
URL url = new URL(urlString);
// 组织请求参数
StringBuilder postBody = new StringBuilder();
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (entry.getValue() == null) continue;
postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
"utf-8")).append("&");
}
//删除最后一个字符,目的在于拼接好请求url后删除最后的&符号
if (!params.isEmpty()) {
postBody.deleteCharAt(postBody.length() - 1);
}
conn = (HttpURLConnection) url.openConnection();
// 设置长链接
conn.setRequestProperty("Connection", "Keep-Alive");
// 设置连接超时
conn.setConnectTimeout(1000);
// 设置读取超时
conn.setReadTimeout(3000);
// 提交参数
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.getOutputStream().write(postBody.toString().getBytes());
conn.getOutputStream().flush();
int responseCode = conn.getResponseCode();
if (responseCode != 200) {
log.warn("[BodyGuardApiInvoker] invoke failed, response status:" + responseCode);
return null;
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder result = new StringBuilder();
String line = null;
while ((line = bufferedReader.readLine()) != null) {
result.append(line).append("\n");
}
return JSON.parseObject(result.toString().trim(),BodyGuardApiResponse.class);
} catch (Exception e) {
log.error("[BodyGuardApiInvoker] invoke throw exception, details: " + e);
}
return null;
}
try {
String urlString = new StringBuilder().append(apiUrl).append("?partner_code=").append(PARTNER_CODE).append("&partner_key=").append(PARTNER_KEY).append("&app_name=").append(PARTNER_APP).toString();
URL url = new URL(urlString);
// 组织请求参数
StringBuilder postBody = new StringBuilder();
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (entry.getValue() == null) continue;
postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
"utf-8")).append("&");
}
if (!params.isEmpty()) {
postBody.deleteCharAt(postBody.length() - 1);
}
conn = (HttpURLConnection) url.openConnection();
// 设置长链接
conn.setRequestProperty("Connection", "Keep-Alive");
// 设置连接超时
conn.setConnectTimeout(1000);
// 设置读取超时
conn.setReadTimeout(3000);
// 提交参数
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.getOutputStream().write(postBody.toString().getBytes("UTF-8"));
conn.getOutputStream().flush();
int responseCode = conn.getResponseCode();
if (responseCode != 200) {
log.warn("[BodyGuardApiInvoker] invoke failed, response status:" + responseCode);
return null;
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder result = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
result.append(line).append("\n");
}
return JSON.parseObject(result.toString().trim(), BodyGuardApiResponse.class);
} catch (Exception e) {
log.error("[BodyGuardApiInvoker] invoke throw exception, details: " + e);
}
return null;
}
public static void main(String[] args) {
Map<String, Object> params = new HashMap<String, Object>();

View File

@ -16,47 +16,47 @@ public class BodyGuardApiResponse implements Serializable {
private String result_desc;
private String reason_desc;
private String reason_code;
public String getReason_code() {
return reason_code;
}
public void setReason_code(String reason_code) {
this.reason_code = reason_code;
}
public String getResult_desc() {
return result_desc;
}
public void setResult_desc(String result_desc) {
this.result_desc = result_desc;
}
public String getReason_desc() {
return reason_desc;
}
public void setReason_desc(String reason_desc) {
this.reason_desc = reason_desc;
}
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public String toString() {
if (success && StringUtils.isBlank(reason_code)) {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
package com.tenwa.comm.credit;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import com.amarsoft.are.ARE;
/**
* 信贷校验配置文件读取类
* @author 张磊
* 2018年6月25日 下午5:15:34
*/
public class CreditPropertiesUtil {
private static final Map<String,String> attributes ;
static{
attributes = new ConcurrentHashMap<String,String>();
Properties prop = new Properties();
try {
prop.load(CreditPropertiesUtil.class.getResourceAsStream("/credit.properties"));
for(Entry<Object, Object> entry : prop.entrySet()){
if(entry.getKey()==null || entry.getValue() == null){
continue;
}
attributes.put(entry.getKey().toString(),entry.getValue().toString());
}
} catch (IOException e) {
e.printStackTrace();
ARE.getLog().error("init CreditPropertiesUtil info failed");
}
ARE.getLog().info("init CreditPropertiesUtil info success");
}
public static String get(String propName){
return attributes.get(propName);
}
}