pboc个人单笔查询代码初始化
This commit is contained in:
parent
f54916c975
commit
f264a1c47b
@ -1,10 +1,3 @@
|
||||
<%@page import="com.itextpdf.text.log.SysoCounter"%>
|
||||
<%@page import="java.util.Map.Entry"%>
|
||||
<%@page import="com.alibaba.fastjson.JSONArray"%>
|
||||
<%@page import="com.alibaba.fastjson.JSON"%>
|
||||
<%@page import="com.alibaba.fastjson.JSONObject"%>
|
||||
<%@page import="com.tenwa.httpclient.controller.BigDataController"%>
|
||||
<%@page import="java.util.Date"%>
|
||||
<%@page import="com.tenwa.util.SerialNumberUtil"%>
|
||||
<%@ page import="com.tenwa.httpclient.controller.PbocDataController" %>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
@ -24,13 +17,13 @@
|
||||
if("GET".equals(getType)) {
|
||||
if("false".equals(result)) {
|
||||
%>
|
||||
<%--<script type="text/javascript" src="<%=sWebRootPath %>/Frame/page/js/as_debug_message.js"></script>--%>
|
||||
<%--<script type="text/javascript">--%>
|
||||
<%--alert("该用户没有对应的详情信息!");--%>
|
||||
<%--$(document).ready(function (){--%>
|
||||
<%--AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>","_self","");--%>
|
||||
<%--})--%>
|
||||
<%--</script>--%>
|
||||
<script type="text/javascript" src="<%=sWebRootPath %>/Frame/page/js/as_debug_message.js"></script>
|
||||
<script type="text/javascript">
|
||||
alert("该用户没有对应的详情信息!");
|
||||
$(document).ready(function (){
|
||||
AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>","_self","");
|
||||
})
|
||||
</script>
|
||||
<%
|
||||
// return ;
|
||||
} else {
|
||||
@ -52,15 +45,14 @@
|
||||
type = "GET";
|
||||
}
|
||||
}
|
||||
// TODO: 2023/1/31 征信参数整理
|
||||
|
||||
Map<String,String> params = new HashMap<String,String>(); //初始化参数
|
||||
params.put("queryType","25136");
|
||||
params.put("name",CurPage.getParameter("fullName"));
|
||||
params.put("documentNo",CurPage.getParameter("fullcertId"));
|
||||
params.put("phone",CurPage.getParameter("fullphone"));
|
||||
params.put("queryReasonID","101");
|
||||
params.put("subreportIDs","96100");
|
||||
params.put("refID","");
|
||||
// TODO: 2023/1/31 上线需修改
|
||||
//params.put("fullcertId",CurPage.getParameter("fullcertId"));
|
||||
//params.put("fullName",CurPage.getParameter("fullphone"));
|
||||
|
||||
params.put("fullcertId", "622926198501293785");
|
||||
params.put("fullName", "王小二");
|
||||
FileInputStream fr = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
@ -74,40 +66,12 @@
|
||||
if(html.indexOf("viewReport_data") != -1) {
|
||||
html = html.replaceAll("viewReport_data", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
// if(html.indexOf(".png") != -1 || html.indexOf(".jpg") != -1) {
|
||||
// html = html.replaceAll("image/image_\\d+[.]", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/image/image.");
|
||||
// }
|
||||
// if(html.indexOf(".png") != -1 || html.indexOf(".jpg") != -1) {
|
||||
// html = html.replaceAll("image/image_", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/image/image_");
|
||||
// }
|
||||
// if(html.indexOf("width=\"95%\"") != -1) {
|
||||
// html = html.replaceAll("width=\"95%\"", "");
|
||||
// }
|
||||
// if(html.indexOf("height=\"70\"") != -1) {
|
||||
// html = html.replaceAll("height=\"70\"", "");
|
||||
// }
|
||||
// if(html.indexOf("width=\"103\"") != -1) {
|
||||
// html = html.replaceAll("width=\"103\"", "");
|
||||
// }
|
||||
// if(html.indexOf("<td>个人反欺诈分析报告</td>") != -1) {
|
||||
// html = html.replaceAll("<td>个人反欺诈分析报告</td>", "<td><a style=\"position:absolute;left:0;top:8%\" title=\"拉取鹏元数据\" onClick=\"returnList();\" class=\"inline_button \" hidefocus=\"\" href=\"#\"><span style=\"display:none;\"></span><span class=\"left\"> </span><span class=\"center\"><span class=\"btn_icon btn_icon_edit\"> </span><span class=\"btn_text\">返回</span></span><span class=\"right\"> </span></a>个人信用报告</td>");
|
||||
// }
|
||||
if(html.indexOf("<body>") != -1) {
|
||||
if(html.indexOf("<body") != -1) {
|
||||
html = html.replaceAll("<body", "<body style=\"overflow:scroll;height:95%\" ");
|
||||
}
|
||||
// if(html.indexOf("<table class=\"report\" align=\"center\">") != -1) {
|
||||
// html = html.replaceAll("<table class=\"report\" align=\"center\">", "<table class=\"report\" align=\"center\" style=\"width:99%\">");
|
||||
// }
|
||||
%>
|
||||
<%=html%>
|
||||
<%}
|
||||
System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------");
|
||||
System.out.println("");
|
||||
System.out.println("");
|
||||
System.out.println("------------------"+StringFunction.getTodayNow()+"----------------------");
|
||||
System.out.println("");
|
||||
System.out.println("");
|
||||
System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------");
|
||||
|
||||
//查询获取数据次数
|
||||
if("SAVE".equals(type)) {
|
||||
|
||||
@ -25,7 +25,15 @@ t_password = {MD5}i3rx5Ta+2VL5Dj5T866giQ==
|
||||
t_methodType = queryReport
|
||||
|
||||
|
||||
|
||||
#pboc canshu
|
||||
pboc_url = http://9.35.68.228:9090/pbcrs/api/msgDispatchController/postProcess
|
||||
pboc_txCode = ZXCXA01
|
||||
pboc_reqSysCode = LOCAL
|
||||
pboc_loginUserCode = system
|
||||
pboc_loginPwd = 123456
|
||||
pboc_finDept = a5adabc8ae00417bbe1b4f54423f4d03
|
||||
pboc_authArchUrl = www.baidu.com
|
||||
pboc_certSrcUrl = www.sino.com
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.tenwa.httpclient.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
@ -14,19 +13,11 @@ import com.tenwa.httpclient.pboc.FileUtils;
|
||||
import com.tenwa.httpclient.pboc.HttpUtils;
|
||||
import com.tenwa.httpclient.pboc.PbocXmlUtils;
|
||||
import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import com.tenwa.reckon.util.UUIDUtil;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.tree.DefaultAttribute;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class PbocDataController {
|
||||
/**
|
||||
@ -81,42 +72,47 @@ public class PbocDataController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pboc查询,或者查询缓存
|
||||
* @param params
|
||||
* @param table
|
||||
* @param Sqlca
|
||||
* @param actionType
|
||||
* @param applyId
|
||||
* @param CurPage
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String findAndSavePbocData(Map<String, String> params, String table, Transaction Sqlca, String actionType, String applyId, Page CurPage) throws Exception {
|
||||
return this.getAndSavePengyuanData(params, table, Sqlca, actionType, applyId, CurPage, null);
|
||||
}
|
||||
public String getAndSavePengyuanData(Map<String, String> params, String table, Transaction Sqlca, String actionType, String applyId, Page CurPage, Map<String, String> id) throws Exception {
|
||||
String type = "html";
|
||||
ARE.getLog().info("------------------鹏元("+table+")拉取时间----------------------");
|
||||
String htmlFilePath = null;
|
||||
ARE.getLog().info("------------------pboc("+table+")拉取时间----------------------");
|
||||
ARE.getLog().info("");
|
||||
ARE.getLog().info("");
|
||||
ARE.getLog().info("------------------"+ StringFunction.getTodayNow()+"----------------------");
|
||||
ARE.getLog().info("");
|
||||
ARE.getLog().info("");
|
||||
ARE.getLog().info("------------------鹏元("+table+")拉取时间----------------------");
|
||||
// if("GET".equals(actionType)) {
|
||||
// if(id != null) {
|
||||
// id.put("applyId", applyId);
|
||||
// }
|
||||
// htmlFile = Sqlca.getString(new SqlObject("select html_data from bigdata_" + table + " where id = '" + applyId + "'"));
|
||||
// return htmlFile == null ? "" : htmlFile;
|
||||
// }
|
||||
ARE.getLog().info("------------------pboc("+table+")拉取时间----------------------");
|
||||
if("GET".equals(actionType)) {
|
||||
htmlFilePath = Sqlca.getString(new SqlObject("select html_data from bigdata_" + table + " where id = '" + applyId + "'"));
|
||||
return htmlFilePath == null ? "" : htmlFilePath;
|
||||
}
|
||||
Connection conn = Sqlca.getConnection(Sqlca);
|
||||
// TODO: 2023/2/1 本地测试暂用
|
||||
// : 2023/2/1 本地测试暂用
|
||||
@SuppressWarnings("deprecation")
|
||||
Configure configure = Configure.getInstance();
|
||||
String fileSavePath = configure.getParameter("FileSavePath") + "/" + "pengyuan" + "/";
|
||||
String fileSavePath = configure.getParameter("FileSavePath") + "/" + "pboc";
|
||||
// String fileSavePath = "E:\\data";
|
||||
String FlowNo = CurPage.getParameter("FlowNo");
|
||||
String fullcardNo = CurPage.getParameter("fullcardNo");
|
||||
if(fullcardNo==null||"".equals(fullcardNo)){fullcardNo="default";}
|
||||
// TODO: 2023/2/1 生成pboc个人单笔查询请求参数
|
||||
// TODO: 2023/2/1 生成pboc个人单笔查询请求参数 主体id
|
||||
String personQueryParamStr = PbocXmlUtils.createPersonQueryParamStr(params, CurPage.getAttribute("SubjectId").toString());
|
||||
type = "xml";
|
||||
PreparedStatement ps = null;
|
||||
try {
|
||||
ps = conn.prepareStatement("update bigdata_" + table + "_log set " + type + "_url = ?, " + type + "_param = ? where apply_id = ?");
|
||||
ps.setString(1, BigDataPropertiesUtil.get("pengyuanUrl"));
|
||||
ps.setString(1, BigDataPropertiesUtil.get("pboc_url"));
|
||||
ps.setString(2, personQueryParamStr + "," + BigDataPropertiesUtil.get("user") + "," + BigDataPropertiesUtil.get("password") + "," + type);
|
||||
ps.setString(3, applyId);
|
||||
ps.execute();
|
||||
@ -134,11 +130,12 @@ public class PbocDataController {
|
||||
JSONObject resJson = PbocXmlUtils.toJson(resXMLReport);
|
||||
JSONObject serviceDataJson = resJson.getJSONObject("service");
|
||||
JSONObject msgHeadData = serviceDataJson.getJSONObject("msgHead");
|
||||
ARE.getLog().info("==================" + table + "@" + type + "获取数据 msgHead====================" + msgHeadData.toJSONString());
|
||||
JSONObject msgBodyData = serviceDataJson.getJSONObject("msgBody");
|
||||
String reportId = msgHeadData.getString("resJnlId");
|
||||
String htmlRptDataStr = msgBodyData.getString("htmlRpt");
|
||||
String xmlFilePath = FileUtils.createXMLFile(fileSavePath, reportId, resXMLReport);
|
||||
String htmlFilePath = FileUtils.createHtmlFile(fileSavePath,reportId, htmlRptDataStr);
|
||||
htmlFilePath = FileUtils.createHtmlFile(fileSavePath, reportId, htmlRptDataStr);
|
||||
ARE.getLog().info(htmlFilePath);
|
||||
ARE.getLog().info(xmlFilePath);
|
||||
|
||||
@ -163,8 +160,8 @@ public class PbocDataController {
|
||||
keywordValue.append(",'"+FlowNo+"'");
|
||||
}
|
||||
|
||||
SqlObject sql = new SqlObject(("insert into bigdata_" + table + " (id," + keyword.toString() + ",xml_data,html_data,"
|
||||
+ "inputuserid,inputorgid,inputtime,fullName,fullcertId,fullphone,fullcardNo) values('" + applyId + "'," + keywordValue.toString() + ",'"
|
||||
SqlObject sql = new SqlObject(("insert into bigdata_" + table + " (id," + keyword.toString() + ",pboc_report_id,xml_data,html_data,"
|
||||
+ "inputuserid,inputorgid,inputtime,fullName,fullcertId,fullphone,fullcardNo) values('" + applyId + "'," + keywordValue.toString() + ",'" + reportId + "','"
|
||||
+ xmlFilePath + "','" + htmlFilePath + "','" + CurPage.getUserId() + "','" + CurPage.getUser().getOrgID() + "','" + StringFunction.getTodayNow() +"','"
|
||||
+CurPage.getParameter("fullName")+"','"+CurPage.getParameter("fullcertId")+"','"+CurPage.getParameter("fullphone")+"','"+fullcardNo+"')").replaceAll(":", "¡÷"));
|
||||
sql.setDebugSql(sql.getDebugSql().replaceAll("¡÷", ":"));
|
||||
@ -172,22 +169,28 @@ public class PbocDataController {
|
||||
sql.setRunSql(sql.getRunSql().replaceAll("¡÷", ":"));
|
||||
|
||||
|
||||
ARE.getLog().error("****************************鹏元大数据************************");
|
||||
ARE.getLog().error("****************************pboc大数据************************");
|
||||
String insertsql =sql.getOriginalSql();
|
||||
ARE.getLog().error(insertsql);
|
||||
ARE.getLog().error("****************************鹏元大数据************************");
|
||||
ARE.getLog().error("****************************pboc大数据************************");
|
||||
Sqlca.executeSQL(sql);
|
||||
return htmlFilePath;
|
||||
}
|
||||
|
||||
public String findQueryReport(String params, String type, String SubjectId) throws Exception {
|
||||
ARE.getLog().info("========================鹏元请求参数==================");
|
||||
ARE.getLog().info("========================pboc请求参数==================");
|
||||
ARE.getLog().info(params);
|
||||
ARE.getLog().info("========================鹏元请求参数==================");
|
||||
ARE.getLog().info("========================pboc请求参数==================");
|
||||
String result = "";
|
||||
try{
|
||||
String url = "http://9.35.68.228:9090/pbcrs/api/msgDispatchController/postProcess";
|
||||
String url = BigDataPropertiesUtil.get("pboc_url");
|
||||
result = HttpUtils.sendPost(url, params);
|
||||
if(StringUtils.isEmpty(result)){
|
||||
ARE.getLog().info("==================返回值为空====================" );
|
||||
throw new RuntimeException("获取大数据失败");
|
||||
}else if(result.length() < 2000){
|
||||
ARE.getLog().info("==================result====================" + result);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("»ñÈ¡´óÊý¾Ýʧ°Ü");
|
||||
@ -196,263 +199,5 @@ public class PbocDataController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void savePengyuanResultData(JSONObject dataType, Element parentElement, String elementName, Statement stat, Map<String, String> otherFields, Map<String, String> dateFields, List<String> stringFields) throws Exception {
|
||||
Element element = parentElement.element(elementName);
|
||||
if(element == null ){
|
||||
return ;
|
||||
}
|
||||
JSONObject obj = new JSONObject();
|
||||
List<DefaultAttribute> praAttributes = element.attributes();
|
||||
for(DefaultAttribute praAttribute : praAttributes) {
|
||||
obj.put(praAttribute.getName(), praAttribute.getStringValue().trim());
|
||||
}
|
||||
if(!obj.isEmpty()) {
|
||||
stat.execute(getInsertSql(obj, "bigdata_py_result", null, otherFields, true, dateFields, stringFields));
|
||||
otherFields.put("RESULT_ID", otherFields.remove("ID"));
|
||||
}
|
||||
savePengyuanResultSubTable(dataType, element, stat, otherFields, dateFields, stringFields);
|
||||
otherFields.remove("RESULT_ID");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void savePengyuanResultSubTable(JSONObject dataType, Element parentElement, Statement stat, Map<String, String> otherFields, Map<String, String> dateFields, List<String> stringFields) throws SQLException {
|
||||
if(dataType != null) {
|
||||
JSONObject obj = null;
|
||||
if("table".equals(dataType.get("type"))) {
|
||||
List<String> fieldList = (List<String>)dataType.get("field");
|
||||
obj = new JSONObject();
|
||||
for(String field : fieldList) {
|
||||
Element fieldElement = parentElement.element(field);
|
||||
if(fieldElement != null) {
|
||||
obj.put(fieldElement.getName(), fieldElement.getStringValue().trim());
|
||||
}
|
||||
}
|
||||
if(!obj.isEmpty()) {
|
||||
stat.execute(getInsertSql(obj, dataType.getString("tableName"), null, otherFields, true, dateFields, stringFields));
|
||||
otherFields.remove("ID");
|
||||
}
|
||||
} else if("arrayTable".equals(dataType.get("type"))) {
|
||||
List<String> fieldList = (List<String>)dataType.get("field");
|
||||
List<Element> items = parentElement.elements("item");
|
||||
if(items != null) {
|
||||
for(Element el : items) {
|
||||
obj = new JSONObject();
|
||||
for(String field : fieldList) {
|
||||
Element fieldElement = el.element(field);
|
||||
if(fieldElement != null) {
|
||||
obj.put(fieldElement.getName(), fieldElement.getStringValue().trim());
|
||||
}
|
||||
}
|
||||
if(!obj.isEmpty()) {
|
||||
stat.execute(getInsertSql(obj, dataType.getString("tableName"), null, otherFields, true, dateFields, stringFields));
|
||||
otherFields.remove("ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JSONArray subTable = dataType.getJSONArray("subTable");
|
||||
if(subTable != null) {
|
||||
for(int i = 0; i < subTable.size(); i ++) {
|
||||
JSONObject subObject = subTable.getJSONObject(i);
|
||||
Element subElement = parentElement.element(subObject.getString("name"));
|
||||
if(subElement != null) {
|
||||
savePengyuanResultSubTable(subObject, subElement, stat, otherFields, dateFields, stringFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveDetail(JSONObject obj, String dataName, String tableName, String tableListName,
|
||||
List<String> excludeFields, Map<String, String> detailOtherFields, Map<String, String> arrayOtherFields, Statement stat) throws SQLException {
|
||||
excludeFields.clear();
|
||||
excludeFields.add(dataName.toUpperCase());
|
||||
stat.execute(getInsertSql(obj, tableName, excludeFields, detailOtherFields));
|
||||
arrayOtherFields.put("PID", detailOtherFields.remove("ID"));
|
||||
JSONArray array = obj.getJSONArray(dataName);
|
||||
if(array != null) {
|
||||
for(int k = 0; k < array.size(); k ++) {
|
||||
stat.execute(getInsertSql(array.getJSONObject(k), tableListName, excludeFields, arrayOtherFields));
|
||||
arrayOtherFields.remove("ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveDetailData(JSONObject obj, String dataName, String tableName, String tableListName,
|
||||
List<String> excludeFields, Map<String, String> detailOtherFields, Map<String, String> arrayOtherFields, Statement stat) throws SQLException {
|
||||
excludeFields.clear();
|
||||
excludeFields.add(dataName.toUpperCase());
|
||||
excludeFields.add("DATA");
|
||||
stat.execute(getInsertSql(obj, tableName, excludeFields, detailOtherFields));
|
||||
String pid = detailOtherFields.remove("ID");
|
||||
JSONArray array = obj.getJSONArray(dataName);
|
||||
List<String> dataExcludeField = new ArrayList<String>();
|
||||
if(array != null) {
|
||||
for(int k = 0; k < array.size(); k ++) {
|
||||
arrayOtherFields.put("PID", pid);
|
||||
JSONObject data = array.getJSONObject(k);
|
||||
stat.execute(getInsertSql(data, tableListName, excludeFields, arrayOtherFields));
|
||||
arrayOtherFields.put("PID", arrayOtherFields.remove("ID"));
|
||||
JSONArray dataArray = data.getJSONArray("data");
|
||||
if(dataArray == null) {
|
||||
continue;
|
||||
}
|
||||
for(int i = 0; i < dataArray.size(); i ++) {
|
||||
JSONObject daObj = new JSONObject();
|
||||
daObj.put("data", dataArray.get(i));
|
||||
stat.execute(getInsertSql(daObj, "bigdata_td_data", dataExcludeField, arrayOtherFields));
|
||||
arrayOtherFields.remove("ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getInsertSql(JSONObject obj, String tableName, List<String> excludeFields, Map<String, String> otherFields) {
|
||||
return getInsertSql(obj, tableName, excludeFields, otherFields, true, null, null);
|
||||
}
|
||||
|
||||
public static String getInsertSql(JSONObject obj, String tableName, List<String> excludeFields,
|
||||
Map<String, String> otherFields, boolean isCheckNumber, Map<String, String> dateFields, List<String> stringFields) {
|
||||
String sql = "INSERT INTO " + tableName.toUpperCase() + "({keys}) VALUES({values})";
|
||||
String keys = "";
|
||||
String values = "";
|
||||
Set<Map.Entry<String, Object>> fields = obj.entrySet();
|
||||
if(fields.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
boolean flag = false;
|
||||
String id = "";
|
||||
for(Map.Entry<String, Object> field : fields) {
|
||||
String key = field.getKey();
|
||||
if("ID".equals(key.toUpperCase())) {
|
||||
id = (String)field.getValue();
|
||||
flag = true;
|
||||
}
|
||||
Object value = field.getValue();
|
||||
if(excludeFields != null && excludeFields.contains(key.toUpperCase())) {
|
||||
continue;
|
||||
}
|
||||
if(keys.length() > 0) {
|
||||
keys += ",";
|
||||
values += ",";
|
||||
}
|
||||
keys += changeKey(key, true);;
|
||||
if(value != null) {
|
||||
String valueString = value + "";
|
||||
if(isCheckNumber && isNumber(valueString)) {
|
||||
if(stringFields != null && stringFields.contains(key)) {
|
||||
values += changeStringToDate(key, valueString, dateFields);
|
||||
} else {
|
||||
values += valueString;
|
||||
}
|
||||
} else {
|
||||
values += changeStringToDate(key, valueString, dateFields);
|
||||
}
|
||||
} else {
|
||||
values += "''";
|
||||
}
|
||||
}
|
||||
if(!otherFields.isEmpty()) {
|
||||
for(Map.Entry<String, String> otherField : otherFields.entrySet()) {
|
||||
if(keys.length() > 0) {
|
||||
keys += ",";
|
||||
values += ",";
|
||||
}
|
||||
keys += otherField.getKey().toUpperCase();
|
||||
values += "'" + otherField.getValue() + "'";
|
||||
}
|
||||
}
|
||||
if(!flag) {
|
||||
id = UUIDUtil.getUUID();
|
||||
keys += ",ID";
|
||||
values += ",'" + id + "'";
|
||||
}
|
||||
otherFields.put("ID", id);
|
||||
sql = sql.replaceAll("\\{keys\\}", keys).replaceAll("\\{values\\}", values);
|
||||
ARE.getLog().info("[执行]" + sql);
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static boolean isNumber(String value) {
|
||||
try {
|
||||
new BigDecimal(value);
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String changeStringToDate(String key, String value, Map<String, String> dateFields) {
|
||||
if(dateFields != null) {
|
||||
for(Map.Entry<String, String> dateField : dateFields.entrySet()) {
|
||||
if(dateField.getKey().equals(key)) {
|
||||
// return "DATE_FORMAT('" + value + "', '" + dateField.getValue() + "')";
|
||||
return "'" + value + "'";
|
||||
}
|
||||
}
|
||||
return "'" + value + "'";
|
||||
}
|
||||
return "'" + value + "'";
|
||||
}
|
||||
|
||||
public static String changeKey(String key) {
|
||||
return PbocDataController.changeKey(key, false);
|
||||
}
|
||||
|
||||
public static String changeKey(String key, boolean toUpperCase) {
|
||||
String[] keys = key.split("");
|
||||
boolean flag = false;
|
||||
if(flag) {
|
||||
if(toUpperCase) {
|
||||
return key.toUpperCase();
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
key = "";
|
||||
int lockField = -1;
|
||||
ot : for(int k = 0; k < keys.length; k ++) {
|
||||
if("".equals(keys[k]) || keys[k] == null) {
|
||||
continue;
|
||||
}
|
||||
if(lockField == k) {
|
||||
key += keys[k].toLowerCase();
|
||||
lockField = -1;
|
||||
continue;
|
||||
}
|
||||
if(keys[k].matches("[0-9]") && lockField == -1) {
|
||||
int i = k + 1;;
|
||||
for(; i < keys.length; i ++) {
|
||||
if("p".equals(keys[i])) {
|
||||
break;
|
||||
}
|
||||
if(Character.isUpperCase(keys[i].charAt(0))) {
|
||||
lockField = i;
|
||||
key += "_" + keys[k];
|
||||
continue ot;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(k == keys.length -2 && "I".equals(keys[k]) && ("I".equals(keys[k + 1]) || "D".equals(keys[k + 1]))) {
|
||||
key += keys[k].toLowerCase() + keys[k + 1].toLowerCase();
|
||||
break;
|
||||
} else if(Character.isUpperCase(keys[k].charAt(0))) {
|
||||
key += "_" + keys[k].toLowerCase();
|
||||
} else {
|
||||
key += keys[k];
|
||||
}
|
||||
}
|
||||
return toUpperCase ? key.toUpperCase() : key;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.*;
|
||||
|
||||
@ -11,65 +12,46 @@ import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class PbocXmlUtils {
|
||||
|
||||
/**
|
||||
* 个人单笔查询的参数组装
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public static String createPersonQueryParamStr(Map<String,String> params, String subjectId) {
|
||||
/**
|
||||
* String xmlParam = "<msgHead>" +
|
||||
* "????<txCode>ZXCXA01</txCode>" +
|
||||
* "????<reqSysCode>LOCAL</reqSysCode>" +
|
||||
* "????<loginUserCode>system</loginUserCode>" +
|
||||
* "????<loginPwd>123456</loginPwd>" +
|
||||
* "????<finDept>a5adabc8ae00417bbe1b4f54423f4d03</finDept>" +
|
||||
* "</msgHead>" +
|
||||
* "<msgBody>" +
|
||||
* "????<appType>01</appType>" +
|
||||
* "????<rptUser>system</rptUser>" +
|
||||
* "????<rptUserdept>777</rptUserdept>" +
|
||||
* "????<custName>ÍõС¶þ</custName>" +
|
||||
* "????<custCertype>10</custCertype>" +
|
||||
* "????<custCertno>622926198501293785</custCertno>" +
|
||||
* "????<qryReason>23</qryReason>" +
|
||||
* "????<qryType>0</qryType>" +
|
||||
* "????<qryFormat>01</qryFormat>" +
|
||||
* "????<authStartDt>2021-03-25</authStartDt>" +
|
||||
* "????<authEndDt>2023-03-24</authEndDt>" +
|
||||
* "????<authArchFileNameList>°®É¶É¶</authArchFileNameList>" +
|
||||
* "????<authArchUrl>www.baidu.com</authArchUrl>" +
|
||||
* "????<certSrcUrl>www.sino.com</certSrcUrl>" +
|
||||
* "????<certFileNameList>Ïëɶɶ</certFileNameList>" +
|
||||
* "</msgBody>";
|
||||
*/
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject msgHead = new JSONObject();
|
||||
JSONObject msgBody = new JSONObject();
|
||||
msgHead.put("txCode", "ZXCXA01");
|
||||
msgHead.put("reqSysCode", "LOCAL");
|
||||
msgHead.put("loginUserCode", "system");
|
||||
msgHead.put("loginPwd", "123456");
|
||||
msgHead.put("finDept", "a5adabc8ae00417bbe1b4f54423f4d03");
|
||||
msgHead.put("txCode", BigDataPropertiesUtil.get("pboc_txCode"));
|
||||
msgHead.put("reqSysCode", BigDataPropertiesUtil.get("pboc_reqSysCode"));
|
||||
msgHead.put("loginUserCode", BigDataPropertiesUtil.get("pboc_loginUserCode"));
|
||||
msgHead.put("loginPwd", BigDataPropertiesUtil.get("pboc_loginPwd"));
|
||||
msgHead.put("finDept", BigDataPropertiesUtil.get("pboc_finDept"));
|
||||
param.put("msgHead", msgHead);
|
||||
|
||||
//查询申请类型 01-人工申请(通过前置系统发起的申请)
|
||||
msgBody.put("appType", "01");
|
||||
msgBody.put("rptUser", "system");
|
||||
msgBody.put("rptUserdept", "777");
|
||||
msgBody.put("custName", "ÍõС¶þ");
|
||||
msgBody.put("custCertype", "10");
|
||||
msgBody.put("custCertno", "622926198501293785");
|
||||
msgBody.put("rptUser", "system");//报告使用人 登录征信查询前置系统的用户账号
|
||||
msgBody.put("rptUserdept", "777");//填写部门机构代码
|
||||
|
||||
// msgBody.put("reqId", applyId);
|
||||
msgBody.put("custName", params.get("fullName"));
|
||||
msgBody.put("custCertype", "10");//证件类型 10-身份证
|
||||
msgBody.put("custCertno", params.get("fullcertId"));
|
||||
//查询原因 23-客户准入资格审查
|
||||
msgBody.put("qryReason", "23");
|
||||
msgBody.put("qryType", "0");
|
||||
msgBody.put("qryFormat", "01");
|
||||
msgBody.put("qryType", "0");//查询类型
|
||||
//"01-银行版
|
||||
//02-自助查询版
|
||||
//03-政府版
|
||||
//04-社会版"
|
||||
msgBody.put("qryFormat", "01");//查询版本
|
||||
msgBody.put("authStartDt", "2021-03-25");
|
||||
msgBody.put("authEndDt", "2023-03-24");
|
||||
msgBody.put("authArchFileNameList", "°®É¶É¶");
|
||||
msgBody.put("authArchUrl", "www.baidu.com");
|
||||
msgBody.put("certSrcUrl", "www.sino.com");
|
||||
msgBody.put("certFileNameList", "Ïëɶɶ");
|
||||
|
||||
msgBody.put("authArchUrl", BigDataPropertiesUtil.get("pboc_authArchUrl"));//授权档案来源URL
|
||||
msgBody.put("certSrcUrl", BigDataPropertiesUtil.get("pboc_certSrcUrl"));//证照来源URL
|
||||
// msgBody.put("certFileNameList", "证照文件名称");
|
||||
// msgBody.put("authArchFileNameList", "授权档案文件名称");
|
||||
param.put("msgBody", msgBody);
|
||||
ARE.getLog().info("xmlParamStr : " + param.toJSONString());
|
||||
String xmlParamStr = toXml(param);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user