Merge branch 'dailyfix_230203' into dailyfix
This commit is contained in:
commit
2ac3740d1c
@ -204,7 +204,8 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S
|
||||
<%
|
||||
String sPWDState = new UserMarkInfo(Sqlca,CurUser.getUserID()).getPasswordState();
|
||||
// 开发模式不做首次登录/密码过期校验
|
||||
if(sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_USER_FIRST_LOGON)) || sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_PWD_OVERDUE))){
|
||||
// if(sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_USER_FIRST_LOGON)) || sPWDState.equals(String.valueOf(SecurityAuditConstants.CODE_PWD_OVERDUE))){
|
||||
if(false){
|
||||
%>
|
||||
window.open("<%=CurConfig.getContextPath() %>/Redirector?ComponentURL=/AppMain/ModifyPassword.jsp", "_top");
|
||||
<%
|
||||
|
||||
@ -0,0 +1,179 @@
|
||||
<%@ page import="java.util.Date" %>
|
||||
<%@ page import="com.tenwa.httpclient.pboc.PbocNewDataController" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@include file="/IncludeBegin.jsp"%><%
|
||||
String flowId = CurPage.getParameter("flowId");//流程编号
|
||||
String projectId = CurPage.getParameter("projectId");//业务Id
|
||||
String projectNo = CurPage.getParameter("projectNo");//业务编号
|
||||
String subjectId = CurPage.getParameter("subjectId");//主体编号
|
||||
String flowunid = CurPage.getParameter("ObjectNo");
|
||||
String ReadyApprove = CurPage.getParameter("ReadyApprove");
|
||||
String applyId = CurPage.getParameter("applyId");
|
||||
String userName = CurUser.getUserName();
|
||||
SimpleDateFormat dateFormart = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String date = dateFormart.format(new Date());
|
||||
String watermark = userName + " " + date;
|
||||
String getType = CurPage.getParameter("GetType");
|
||||
String type = "";
|
||||
String count = "";
|
||||
String reasonDesc = "";
|
||||
PbocNewDataController bdc = new PbocNewDataController();
|
||||
boolean flag = true;
|
||||
|
||||
Map<String,String> params = new HashMap<String,String>(); //初始化参数
|
||||
// TODO: 2023/1/31 上线需修改
|
||||
params.put("fullCertId",CurPage.getParameter("fullcertId"));
|
||||
params.put("fullName",CurPage.getParameter("fullName"));
|
||||
|
||||
FileInputStream fr = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
String htmlURL = bdc.findAndSavePbocData(params, "pboc_af", Sqlca, type, applyId, CurPage);
|
||||
if(htmlURL.startsWith("false")){
|
||||
String resMsg = htmlURL.split("@")[1];
|
||||
%>
|
||||
<script type="text/javascript" src="<%=sWebRootPath %>/Frame/page/js/as_debug_message.js"></script>
|
||||
<script type="text/javascript">
|
||||
alert("<%=resMsg%>");
|
||||
$(document).ready(function (){
|
||||
AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>&ProjectNo=<%=projectNo%>&SubjectId=<%=subjectId%>","_self","");
|
||||
})
|
||||
</script>
|
||||
<%
|
||||
return;
|
||||
}
|
||||
String poRes = bdc.queryPbocData(params, Sqlca, applyId);
|
||||
System.out.println("20230802666--------poRes="+poRes);
|
||||
String poName = null;
|
||||
String poNameNew = null;
|
||||
String poCertId = null;
|
||||
String poCertIdNew = null;
|
||||
if(null != poRes){
|
||||
String[] poResArr = poRes.split("@");
|
||||
poName = poResArr[0];
|
||||
String namePre = StringUtils.left(poName, 1);
|
||||
if(poName.length() > 2){
|
||||
String nameFix = StringUtils.right(poName, 1);
|
||||
String nameCenter = "";
|
||||
for(int i=0; i < poName.length()-2; i++){
|
||||
nameCenter += "*";
|
||||
}
|
||||
poNameNew = namePre+nameCenter+nameFix;
|
||||
}else {
|
||||
poNameNew = namePre + "*";
|
||||
}
|
||||
if(StringUtils.isNotEmpty(poResArr[1]) && !"0".equals(poResArr[1])){
|
||||
poCertId = poResArr[1];
|
||||
int certIdLength = poCertId.length() - 4;
|
||||
String certIdPre = StringUtils.left(poCertId, certIdLength);
|
||||
String certIdFix = "****";
|
||||
poCertIdNew = certIdPre+certIdFix;
|
||||
}
|
||||
}
|
||||
String fullCertId = params.get("fullCertId");
|
||||
int certIdLength = fullCertId.length() - 4;
|
||||
String certIdPre = StringUtils.left(fullCertId, certIdLength);
|
||||
String certIdFix = "****";
|
||||
String newFullCertId = certIdPre+certIdFix;
|
||||
String fullName = params.get("fullName");
|
||||
String namePre = StringUtils.left(fullName, 1);
|
||||
String newFullName = null;
|
||||
if(fullName.length() > 2){
|
||||
String nameFix = StringUtils.right(fullName, 1);
|
||||
String nameCenter = "";
|
||||
for(int i=0; i < fullName.length()-2; i++){
|
||||
nameCenter += "*";
|
||||
}
|
||||
newFullName = namePre+nameCenter+nameFix;
|
||||
}else {
|
||||
newFullName = namePre + "*";
|
||||
}
|
||||
File file = new File(htmlURL);
|
||||
fr = new FileInputStream(file);
|
||||
br = new BufferedReader(new InputStreamReader(fr, "UTF-8"));
|
||||
String str;
|
||||
int index = 0;
|
||||
while((str = br.readLine()) != null) {
|
||||
index++;
|
||||
String html = str;
|
||||
if(html.indexOf(fullName) != -1){
|
||||
html = html.replaceAll(fullName, newFullName);
|
||||
}
|
||||
if(html.indexOf(fullCertId) != -1){
|
||||
html = html.replaceAll(fullCertId, newFullCertId);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(poName) && html.indexOf(poName) != -1){
|
||||
html = html.replaceAll(poName, poNameNew);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(poCertId) && html.indexOf(poCertId) != -1){
|
||||
html = html.replaceAll(poCertId, poCertIdNew);
|
||||
}
|
||||
if(html.indexOf("<script src=\"../resources/product/p/js/jquery.min.js\"></script>") != -1) {
|
||||
html = html.replaceAll("<script src=\"../resources/product/p/js/jquery.min.js\"></script>", "<script src=\"viewReport_files/jquery.js\"></script><script src=\"viewReport_files/shuiyin.js\"></script>");
|
||||
}
|
||||
if(html.indexOf("viewReport_files") != -1) {
|
||||
html = html.replaceAll("viewReport_files", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
if(html.indexOf("../resources/product/p/js") != -1) {
|
||||
html = html.replaceAll("../resources/product/p/js", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
if(html.indexOf("../resources/product/p/css") != -1) {
|
||||
html = html.replaceAll("../resources/product/p/css", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
if(html.indexOf("../resources/product/p/images") != -1) {
|
||||
html = html.replaceAll("../resources/product/p/images", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
if(html.indexOf("<body") != -1) {
|
||||
html = html.replaceAll("<body", "<body style=\"overflow:scroll;height:95%\" ");
|
||||
}
|
||||
if(html.indexOf("<h1 class=\"u-repname\">个人信用报告</h1>") != -1) {
|
||||
html = html.replaceAll("<h1 class=\"u-repname\">个人信用报告</h1>", "<a style=\"position:absolute;left:0;top:8%\" title=\"PBOC-人行征信\" 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><h1 class=\"u-repname\">个人信用报告</h1>");
|
||||
}
|
||||
if(html.indexOf("document.oncopy") != -1) {
|
||||
html = html.replaceAll("document.oncopy", "watermark({ \"watermark_txt\": \""+watermark+"\"});\n document.oncopy");
|
||||
}
|
||||
// TODO: 2023-5-16 根据实际需求来,测试环境这一行解析异常,单独处理,生产可删
|
||||
if(index ==4){
|
||||
continue;
|
||||
}
|
||||
// TODO: 2023-5-16 根据实际需求来,测试环境这一行解析异常,单独处理,生产可删
|
||||
%>
|
||||
<%=html%>
|
||||
<%}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
flag = false;
|
||||
reasonDesc = e.getMessage();
|
||||
Sqlca.rollback();
|
||||
%>
|
||||
<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%>&ProjectNo=<%=projectNo%>&SubjectId=<%=subjectId%>","_self","");
|
||||
})
|
||||
</script>
|
||||
<%
|
||||
} finally {
|
||||
if(br != null) br.close();
|
||||
if(fr != null) fr.close();
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
function getData() {
|
||||
if('<%=ReadyApprove%>'=='ReadOnly'){
|
||||
alert("查询页面不允许获取大数据");
|
||||
return;
|
||||
}
|
||||
if("<%=count%>" == "done") {
|
||||
alert("已达到获取数据次数上限");
|
||||
} else {
|
||||
location.href = location.href.indexOf("&GetType=GET") == -1 ? location.href + "&GetType=GET&Count=<%=count%>" : location.href.substring(0, location.href.indexOf("&GetType=GET")) + "&GetType=GET&Count=<%=count%>";
|
||||
}
|
||||
}
|
||||
function returnList(){
|
||||
AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>&ProjectNo=<%=projectNo%>&SubjectId=<%=subjectId%>","_self","");
|
||||
}
|
||||
</script>
|
||||
<%@include file="/IncludeEnd.jsp"%>
|
||||
@ -0,0 +1,143 @@
|
||||
<%@page import="com.tenwa.util.SerialNumberUtil"%>
|
||||
<%@ page import="com.tenwa.httpclient.controller.PbocDataController" %>
|
||||
<%@ page import="java.util.Date" %>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@include file="/IncludeBegin.jsp"%><%
|
||||
String flowId = CurPage.getParameter("flowId");//流程编号
|
||||
String projectId = CurPage.getParameter("projectId");//业务Id
|
||||
String projectNo = CurPage.getParameter("projectNo");//业务编号
|
||||
String subjectId = CurPage.getParameter("subjectId");//主体编号
|
||||
String flowunid = CurPage.getParameter("ObjectNo");
|
||||
String ReadyApprove = CurPage.getParameter("ReadyApprove");
|
||||
System.out.println("ReadyApprove="+ReadyApprove);
|
||||
String applyId = "";
|
||||
String userName = CurUser.getUserName();
|
||||
SimpleDateFormat dateFormart = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String date = dateFormart.format(new Date());
|
||||
String watermark = userName + " " + date;
|
||||
String getType = CurPage.getParameter("GetType");
|
||||
System.out.println("getType="+getType);
|
||||
String type = "";
|
||||
String count = "";
|
||||
String reasonDesc = "";
|
||||
PbocDataController bdc = new PbocDataController();
|
||||
boolean flag = true;
|
||||
String result = bdc.findDataApplyId(CurPage, "pboc_af", Sqlca);
|
||||
|
||||
if(result.startsWith("false")){
|
||||
String resMsg = result.split("@")[1];
|
||||
%>
|
||||
<script type="text/javascript" src="<%=sWebRootPath %>/Frame/page/js/as_debug_message.js"></script>
|
||||
<script type="text/javascript">
|
||||
alert("<%=resMsg%>");
|
||||
$(document).ready(function (){
|
||||
AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>","_self","");
|
||||
})
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
if("GET".equals(getType)) {
|
||||
if("false".equals(result)) {
|
||||
|
||||
// return ;
|
||||
} else {
|
||||
String[] res = result.split("@");
|
||||
applyId = res[1];
|
||||
count = res[2];
|
||||
type = "GET";
|
||||
}
|
||||
} else {
|
||||
if("false".equals(result)) {
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
applyId = SerialNumberUtil.getPengyuanNumber(tx);
|
||||
tx.commit();
|
||||
type = "SAVE";
|
||||
} else {
|
||||
String[] res = result.split("@");
|
||||
applyId = res[1];
|
||||
count = res[2];
|
||||
type = "GET";
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> params = new HashMap<String,String>(); //初始化参数
|
||||
// TODO: 2023/1/31 上线需修改
|
||||
//params.put("fullcertId",CurPage.getParameter("fullcertId"));
|
||||
//params.put("fullName",CurPage.getParameter("fullName"));
|
||||
|
||||
params.put("fullcertId", "622926198501293785");
|
||||
params.put("fullName", "王小二");
|
||||
FileInputStream fr = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
String htmlURL = bdc.findAndSavePbocData(params, "pboc_af", Sqlca, type, applyId, CurPage);
|
||||
File file = new File(htmlURL);
|
||||
fr = new FileInputStream(file);
|
||||
br = new BufferedReader(new InputStreamReader(fr, "UTF-8"));
|
||||
String str;
|
||||
while((str = br.readLine()) != null) {
|
||||
String html = str;
|
||||
if(html.indexOf("<script src=\"viewReport_files/report.js\"></script>") != -1) {
|
||||
html = html.replaceAll("<script src=\"viewReport_files/report.js\"></script>", "<script src=\"viewReport_files/report.js\"></script><script src=\"viewReport_files/shuiyin.js\"></script>");
|
||||
}
|
||||
if(html.indexOf("viewReport_files") != -1) {
|
||||
html = html.replaceAll("viewReport_files", "Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data");
|
||||
}
|
||||
if(html.indexOf("<body") != -1) {
|
||||
html = html.replaceAll("<body", "<body style=\"overflow:scroll;height:95%\" ");
|
||||
}
|
||||
if(html.indexOf("<h1 class=\"u-repname\">个人信用报告</h1>") != -1) {
|
||||
html = html.replaceAll("<h1 class=\"u-repname\">个人信用报告</h1>", "<a style=\"position:absolute;left:0;top:8%\" title=\"PBOC-人行征信\" 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><h1 class=\"u-repname\">个人信用报告</h1>");
|
||||
}
|
||||
if(html.indexOf("document.oncopy") != -1) {
|
||||
html = html.replaceAll("document.oncopy", "watermark({ \"watermark_txt\": \""+watermark+"\"});\n document.oncopy");
|
||||
}
|
||||
%>
|
||||
<%=html%>
|
||||
<%}
|
||||
|
||||
//查询获取数据次数
|
||||
if("SAVE".equals(type)) {
|
||||
String res = bdc.findDataApplyId(CurPage, "pengyuan_af", Sqlca);
|
||||
if("false".equals(res)) {
|
||||
count = "0";
|
||||
} else {
|
||||
count = res.split("@")[2];
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
flag = false;
|
||||
reasonDesc = e.getMessage();
|
||||
Sqlca.rollback();
|
||||
%>
|
||||
<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>
|
||||
<%
|
||||
} finally {
|
||||
if(br != null) br.close();
|
||||
if(fr != null) fr.close();
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
function getData() {
|
||||
if('<%=ReadyApprove%>'=='ReadOnly'){
|
||||
alert("查询页面不允许获取大数据");
|
||||
return;
|
||||
}
|
||||
if("<%=count%>" == "done") {
|
||||
alert("已达到获取数据次数上限");
|
||||
} else {
|
||||
location.href = location.href.indexOf("&GetType=GET") == -1 ? location.href + "&GetType=GET&Count=<%=count%>" : location.href.substring(0, location.href.indexOf("&GetType=GET")) + "&GetType=GET&Count=<%=count%>";
|
||||
}
|
||||
}
|
||||
function returnList(){
|
||||
AsControl.OpenView("/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdataList.jsp", "FlowUnid=<%=flowunid%>&ProjectId=<%=projectId%>","_self","");
|
||||
}
|
||||
</script>
|
||||
<%@include file="/IncludeEnd.jsp"%>
|
||||
@ -0,0 +1,85 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2019-06-14
|
||||
Content:
|
||||
History Log:
|
||||
*/
|
||||
String flowId = CurPage.getParameter("FlowUnid");//流程编号
|
||||
String projectId = CurPage.getParameter("ProjectId");//流程编号
|
||||
String projectNo = CurPage.getParameter("ProjectNo");//流程编号
|
||||
String subjectId = CurPage.getParameter("SubjectId");//主体编号
|
||||
|
||||
String flag = "true";
|
||||
/* String flowunid = CurPage.getParameter("ObjectNo");
|
||||
String projectNo = CurPage.getParameter("ProjectNo");
|
||||
String ReadyApprove = CurPage.getParameter("ReadyApprove");
|
||||
String getType = CurPage.getParameter("GetType"); */
|
||||
|
||||
ASObjectModel doTemp = new ASObjectModel("VI_LB_IDENTITY_CHECK");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--设置为Grid风格--
|
||||
dwTemp.ReadOnly = "1"; //只读模式
|
||||
dwTemp.setPageSize(10);
|
||||
dwTemp.genHTMLObjectWindow(flowId);
|
||||
|
||||
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
||||
String sButtons[][] = {
|
||||
{"true","All","Button","拉取征信数据","拉取征信数据","newRecord()","","","","btn_icon_add",""},
|
||||
{flag,"","Button","详情","查看详情","detail()","","","","btn_icon_detail",""},
|
||||
// {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
|
||||
// {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
|
||||
};
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var projectId = "<%=projectId%>";
|
||||
/* if(null == projectId || "" == projectId || "null" == projectId){
|
||||
location.reload();
|
||||
} */
|
||||
})
|
||||
|
||||
function request(actionType,applyId){
|
||||
var sUrl = "/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/pbocdata.jsp";
|
||||
var fullName = getItemValue(0,getRow(0),'fullName');
|
||||
var fullCertId = getItemValue(0,getRow(0),'certId');
|
||||
var fullRelation = getItemValue(0,getRow(0),'relation');
|
||||
var fullPhone = getItemValue(0,getRow(0),'phone');
|
||||
var params = 'flowId='+'<%=flowId%>'+'&projectId='+'<%=projectId%>'+'&projectNo='+'<%=projectNo%>'+'&fullName='+fullName+'&applyId='+applyId
|
||||
+'&fullCertId='+fullCertId+'&fullRelation='+fullRelation+'&fullPhone='+fullPhone+'&GetType='+actionType+'&subjectId='+'<%=subjectId%>';
|
||||
AsControl.OpenView(sUrl,params,'_self','');
|
||||
}
|
||||
function newRecord(){
|
||||
var actionType = "SAVE";
|
||||
if(confirm("查询人行征信,请先确认客户是否上传身份证正反面,以及签署征信查询授权书(重点核查签署日期)。\n您确定上述客户信息完整,要继续操作吗?")){
|
||||
var checkReqData = checkData(actionType);
|
||||
if(checkReqData.split("@")[0]!="true"){
|
||||
var res = checkReqData.split("@")[1];
|
||||
AsDebug.alert("警告",res);
|
||||
return;
|
||||
}
|
||||
var applyId = checkReqData.split("@")[1];
|
||||
request(actionType,applyId);
|
||||
}
|
||||
}
|
||||
function detail(){
|
||||
var actionType = "GET";
|
||||
if(confirm("查询人行征信,请先确认客户是否上传身份证正反面,以及签署征信查询授权书(重点核查签署日期)。\n您确定上述客户信息完整,要继续操作吗?")){
|
||||
var checkReqData = checkData(actionType);
|
||||
if(checkReqData.split("@")[0]!="true"){
|
||||
var res = checkReqData.split("@")[1];
|
||||
AsDebug.alert("警告",res);
|
||||
return;
|
||||
}
|
||||
var applyId = checkReqData.split("@")[1];
|
||||
request(actionType,applyId);
|
||||
}
|
||||
}
|
||||
|
||||
function checkData(actionType){
|
||||
var sParams="fullName="+getItemValue(0,getRow(0),'fullName')+",flowId=<%=flowId%>,projectNo=<%=projectNo%>,actionType="+actionType
|
||||
+",fullCertId="+getItemValue(0,getRow(0),'certId')+",fullPhone="+getItemValue(0,getRow(0),'phone');
|
||||
return RunJavaMethod("com.tenwa.httpclient.pboc.PbocAction","checkReqData",sParams);
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
6
WebContent/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data/jquery.js
vendored
Normal file
6
WebContent/Tenwa/Lease/Flow/Comm/BigdataPboc/query_report/viewReport_data/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@
|
||||
$(function(){
|
||||
//pageInit();
|
||||
});
|
||||
function pageInit(){
|
||||
|
||||
var pPageWidth = 794; //打印时的A4完整宽度(96dpi)
|
||||
var pPageHeight = $(document).height();
|
||||
var pContentwidth = 720; //打印时的内容宽度(96dpi),同步css
|
||||
var A4Heigth = 1123; //A4纸的高度(px,96dip)。固定值
|
||||
|
||||
var markBox = $('<div class="u-wmarkbox"/>').css("cssText","width:auto!important;width:".concat(pPageWidth,"px;min-width:",pPageWidth,"px")).css({
|
||||
"display":"none",
|
||||
"position": "absolute",
|
||||
"top": 0,
|
||||
"left": 0,
|
||||
"height": pPageHeight.toString(10).concat("px"), //pPageHeight, 100%
|
||||
"backgroundColor": "#FFF",
|
||||
"overflow": "hidden",
|
||||
"zIndex": 1
|
||||
});
|
||||
var wmimg = new Image();
|
||||
wmimg.onload = function(){repeatwmimg(this);}
|
||||
wmimg.src = '../../images/pbccrc_watermark2.gif';
|
||||
|
||||
function repeatwmimg(oimg){
|
||||
var imgwidth = oimg.width;
|
||||
var imgheight = oimg.height;
|
||||
|
||||
//获得水印图片高度后重置
|
||||
|
||||
//这里应该还要加上打印时每一页的上下边距4cm(同步css)≈72px(96dpi)
|
||||
//var wmHeight = Math.ceil(pPageHeight / A4Heigth) * A4Heigth;
|
||||
//var wmHeight = Math.ceil(pPageHeight / A4Heigth) * (A4Heigth + 145);
|
||||
var wmHeight = Math.ceil(pPageHeight / A4Heigth) * A4Heigth;
|
||||
markBox.css("height", wmHeight.toString(10).concat("px"));
|
||||
|
||||
var hi = Math.ceil(pPageWidth / imgwidth);
|
||||
var vi = Math.ceil(wmHeight / imgheight);
|
||||
for(var i = 0; i < vi; i++){
|
||||
var vidiv = $('<div class="u-row"/>').css({
|
||||
"width": (imgwidth * hi).toString(10).concat("px"),
|
||||
"height": imgheight.toString(10).concat("px")
|
||||
});
|
||||
for(var j = 0; j < hi; j++){
|
||||
vidiv.append($(oimg).clone(false).css({"display":"block","float":"left","border":"none"}));
|
||||
}
|
||||
vidiv.appendTo(markBox);
|
||||
}
|
||||
markBox.prependTo("body");
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
function watermark(settings) {
|
||||
//默认设置
|
||||
var defaultSettings = {
|
||||
watermark_txt: "text",
|
||||
watermark_x: 20, //水印起始位置x轴坐标
|
||||
watermark_y: 20, //水印起始位置Y轴坐标
|
||||
watermark_rows: 2000, //水印行数
|
||||
watermark_cols: 20, //水印列数
|
||||
watermark_x_space: 100, //水印x轴间隔
|
||||
watermark_y_space: 50, //水印y轴间隔
|
||||
watermark_color: '#aaa', //水印字体颜色
|
||||
watermark_alpha: 0.4, //水印透明度
|
||||
watermark_fontsize: '15px', //水印字体大小
|
||||
watermark_font: '微软雅黑', //水印字体
|
||||
watermark_width: 210, //水印宽度
|
||||
watermark_height: 80, //水印长度
|
||||
watermark_angle: 20 //水印倾斜度数
|
||||
};
|
||||
if (arguments.length === 1 && typeof arguments[0] === "object") {
|
||||
var src = arguments[0] || {};
|
||||
for (key in src) {
|
||||
if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key]) continue;
|
||||
else if (src[key]) defaultSettings[key] = src[key];
|
||||
}
|
||||
}
|
||||
var oTemp = document.createDocumentFragment();
|
||||
//获取页面最大宽度
|
||||
var page_width = Math.max(document.body.scrollWidth, document.body.clientWidth);
|
||||
var cutWidth = page_width * 0.0150;
|
||||
var page_width = page_width - cutWidth;
|
||||
//获取页面最大高度
|
||||
var page_height = Math.max(document.body.scrollHeight, document.body.clientHeight) + 450;
|
||||
page_height = Math.max(page_height, window.innerHeight - 30);
|
||||
//如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
|
||||
if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > page_width)) {
|
||||
defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space));
|
||||
defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
|
||||
}
|
||||
//如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
|
||||
if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > page_height)) {
|
||||
defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
|
||||
defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
|
||||
}
|
||||
var x;
|
||||
var y;
|
||||
for (var i = 0; i < defaultSettings.watermark_rows; i++) {
|
||||
y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
|
||||
for (var j = 0; j < defaultSettings.watermark_cols; j++) {
|
||||
x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
|
||||
var mask_div = document.createElement('div');
|
||||
mask_div.id = 'mask_div' + i + j;
|
||||
mask_div.className = 'mask_div';
|
||||
mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
|
||||
//设置水印div倾斜显示
|
||||
mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
||||
mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
||||
mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
||||
mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
||||
mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
||||
mask_div.style.visibility = "";
|
||||
mask_div.style.position = "absolute";
|
||||
mask_div.style.left = x + 'px';
|
||||
mask_div.style.top = y + 'px';
|
||||
mask_div.style.overflow = "hidden";
|
||||
mask_div.style.zIndex = "9999";
|
||||
//让水印不遮挡页面的点击事件
|
||||
mask_div.style.pointerEvents = 'none';
|
||||
mask_div.style.opacity = defaultSettings.watermark_alpha;
|
||||
mask_div.style.fontSize = defaultSettings.watermark_fontsize;
|
||||
mask_div.style.fontFamily = defaultSettings.watermark_font;
|
||||
mask_div.style.color = defaultSettings.watermark_color;
|
||||
mask_div.style.textAlign = "center";
|
||||
mask_div.style.width = defaultSettings.watermark_width + 'px';
|
||||
mask_div.style.height = defaultSettings.watermark_height + 'px';
|
||||
mask_div.style.display = "block";
|
||||
oTemp.appendChild(mask_div);
|
||||
};
|
||||
};
|
||||
document.body.appendChild(oTemp);
|
||||
}
|
||||
|
||||
function getNow() {
|
||||
var d = new Date();
|
||||
var year = d.getFullYear();
|
||||
var month = change(d.getMonth() + 1);
|
||||
var day = change(d.getDate());
|
||||
var hour = change(d.getHours());
|
||||
var minute = change(d.getMinutes());
|
||||
var second = change(d.getSeconds());
|
||||
|
||||
function change(t) {
|
||||
if (t < 10) {
|
||||
return "0" + t;
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
var time = year + '年' + month + '月' + day + '日 ' + hour + '时' + minute + '分' + second + '秒';
|
||||
return time;
|
||||
}
|
||||
@ -512,7 +512,9 @@
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<listener>
|
||||
<listener-class>com.tenwa.httpclient.pboc.PbocThreadPool</listener-class>
|
||||
</listener>
|
||||
<!--- ================================== -->
|
||||
<!-- webApi配置 -->
|
||||
<!--- ================================== -->
|
||||
|
||||
121
calc/com/tenwa/reckon/executor/RentCalculateExecutor.java
Normal file
121
calc/com/tenwa/reckon/executor/RentCalculateExecutor.java
Normal file
@ -0,0 +1,121 @@
|
||||
package com.tenwa.reckon.executor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignVtwoUtils;
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
||||
import jbo.app.tenwa.calc.LC_RENT_INCOME;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.com.tenwa.lease.comm.LC_CAR_DISPOSE;
|
||||
import jbo.com.tenwa.lease.comm.LC_OCCUPY_RENT_LIST;
|
||||
|
||||
import com.amarsoft.app.awe.config.InitDBType;
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.BizObjectQuery;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.util.json.JSONEncoder;
|
||||
import com.amarsoft.are.util.json.JSONObject;
|
||||
import com.tenwa.reckon.util.Conn;
|
||||
import com.tenwa.reckon.util.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 合同测算校验
|
||||
* @author tenwapc
|
||||
*
|
||||
*/
|
||||
public class RentCalculateExecutor {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RentCalculateExecutor.class);
|
||||
private String contractId;
|
||||
private String startList;
|
||||
private String paydayAdjust;
|
||||
private String paymentnumber;
|
||||
private String planId;
|
||||
|
||||
/**
|
||||
* 校验中止日期是否合法
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String checkPaydayAdjust() throws Exception {
|
||||
JSONObject jsonObject = JSONObject.createObject();
|
||||
JBOTransaction tx=null;
|
||||
try{
|
||||
tx=JBOFactory.createJBOTransaction();
|
||||
String checkSql = " select min(plan_date) mindate from LC_RENT_PLAN where contract_id = ? and payment_number=?";
|
||||
Conn conn = new Conn(tx);
|
||||
List<Map<String, String>> results = conn.executeQuery(checkSql, this.contractId,this.getPaymentnumber());
|
||||
String mindate = results.get(0).get("mindate");
|
||||
logger.info("20211104 校验中止日期是否合法 mindate= " + mindate);
|
||||
logger.info("20211104 校验中止日期是否合法 paydayAdjust= " + this.paydayAdjust);
|
||||
//截取最后两位 字符串
|
||||
String minDateStr = mindate.substring(mindate.lastIndexOf("/") + 1);
|
||||
String paydayAdjustStr = this.paydayAdjust.substring(this.paydayAdjust.lastIndexOf("/") + 1);
|
||||
logger.info("20211104 校验中止日期是否合法 minDateStr= " + minDateStr);
|
||||
logger.info("20211104 校验中止日期是否合法 paydayAdjustStr= " + paydayAdjustStr);
|
||||
if(minDateStr.equals(paydayAdjustStr)){
|
||||
jsonObject.appendElement("result", "false");
|
||||
jsonObject.appendElement("msg","约定终止日不能落在已汇款的租金计划的区间段!!!");
|
||||
}else {
|
||||
jsonObject.appendElement("result", "true");
|
||||
}
|
||||
}catch(Exception e){
|
||||
tx.rollback();
|
||||
e.printStackTrace();
|
||||
jsonObject.appendElement("result", "false");
|
||||
jsonObject.appendElement("msg","服务器正忙,请稍后再试!!!");
|
||||
}finally{
|
||||
tx.commit();
|
||||
}
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
|
||||
|
||||
public String getStartList() {
|
||||
return startList;
|
||||
}
|
||||
|
||||
public void setStartList(String startList) {
|
||||
this.startList = startList;
|
||||
}
|
||||
|
||||
public String getPaydayAdjust() {
|
||||
return paydayAdjust;
|
||||
}
|
||||
|
||||
public void setPaydayAdjust(String paydayAdjust) {
|
||||
this.paydayAdjust = paydayAdjust;
|
||||
}
|
||||
|
||||
public String getPaymentnumber() {
|
||||
return paymentnumber;
|
||||
}
|
||||
|
||||
public void setPaymentnumber(String paymentnumber) {
|
||||
this.paymentnumber = paymentnumber;
|
||||
}
|
||||
|
||||
public String getPlanId() {
|
||||
return planId;
|
||||
}
|
||||
|
||||
public void setPlanId(String planId) {
|
||||
this.planId = planId;
|
||||
}
|
||||
|
||||
}
|
||||
@ -25,7 +25,15 @@ t_password = {MD5}i3rx5Ta+2VL5Dj5T866giQ==
|
||||
t_methodType = queryReport
|
||||
|
||||
|
||||
|
||||
#pboc canshu
|
||||
pboc_url = http://9.35.68.227:9090/pbcrs/api/msgDispatchController/postProcess
|
||||
pboc_txCode = ZXCXA01
|
||||
pboc_reqSysCode = CX
|
||||
pboc_loginUserCode = zxcx
|
||||
pboc_loginPwd = 123456
|
||||
pboc_finDept = a5adabc8ae00417bbe1b4f54423f4d03
|
||||
pboc_authArchUrl = www.baidu.com
|
||||
pboc_certSrcUrl = www.sino.com
|
||||
|
||||
|
||||
|
||||
|
||||
64
src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java
Normal file
64
src_tenwa/com/tenwa/httpclient/pboc/FileUtils.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
import com.tenwa.reckon.util.DateUtils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
/**
|
||||
* xml信息读取并生成xml文件
|
||||
* @param filePath
|
||||
* @param reportId
|
||||
* @param resXMLReportStr
|
||||
* @return
|
||||
*/
|
||||
public static String createXMLFile(String filePath, String reportId, String resXMLReportStr) throws Exception {
|
||||
// TODO: 2023/1/31 文件地址修改
|
||||
// String xmlFilePath = filePath + "\\xmlHtml\\"+ reportId +".xml";
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMM");
|
||||
filePath = filePath + "/report/"+timeFormat.format(new Date())+ "/";
|
||||
File targetFolder = new File(filePath);
|
||||
if (!targetFolder.exists()) {
|
||||
targetFolder.mkdirs();
|
||||
}
|
||||
String xmlFilePath = filePath + reportId +".xml";
|
||||
// TODO: 2023/1/31 写入xml文件
|
||||
File xmlFile = new File(xmlFilePath);
|
||||
xmlFile.createNewFile();
|
||||
PrintStream printStream = new PrintStream(new FileOutputStream(xmlFile));
|
||||
printStream.println(resXMLReportStr);//将字符串写入文件
|
||||
return xmlFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* xml信息读取并生成html文件
|
||||
* @param filePath
|
||||
* @param reportId
|
||||
* @param htmlRptDataStr
|
||||
* @return
|
||||
*/
|
||||
public static String createHtmlFile(String filePath, String reportId, String htmlRptDataStr) throws Exception {
|
||||
byte[] byteData = new Base64().decode(htmlRptDataStr);
|
||||
// TODO: 2023/1/31 文件地址修改
|
||||
// String htmlFilePath = filePath + "\\xmlHtml\\"+ reportId +".html";
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMM");
|
||||
filePath = filePath + "/report/"+timeFormat.format(new Date())+ "/";
|
||||
File targetFolder = new File(filePath);
|
||||
if (!targetFolder.exists()) {
|
||||
targetFolder.mkdirs();
|
||||
}
|
||||
String htmlFilePath = filePath + reportId +".html";
|
||||
// TODO: 2023/1/31 html内容写入html文件
|
||||
File htmlFile = new File(htmlFilePath);
|
||||
htmlFile.createNewFile();
|
||||
PrintStream printStreamHtml = new PrintStream(new FileOutputStream(htmlFile));
|
||||
printStreamHtml.println(new String(byteData));//将字符串写入文件
|
||||
return htmlFilePath;
|
||||
}
|
||||
}
|
||||
180
src_tenwa/com/tenwa/httpclient/pboc/HttpUtils.java
Normal file
180
src_tenwa/com/tenwa/httpclient/pboc/HttpUtils.java
Normal file
@ -0,0 +1,180 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
*
|
||||
* @author zhanglei
|
||||
*/
|
||||
public class HttpUtils
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, String param)
|
||||
{
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
try
|
||||
{
|
||||
String urlNameString = url;
|
||||
// log.info("sendPost - {}", urlNameString);
|
||||
URL realUrl = new URL(urlNameString);
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("Content-Type", "application/xml;charset=utf-8");
|
||||
conn.setRequestProperty("Content-Length", Integer.toString(param.length()));
|
||||
conn.setConnectTimeout(3*60*1000);
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(param);
|
||||
out.flush();
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
result.append(line);
|
||||
}
|
||||
// log.info("recv - {}", result);
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
String urlNameString = url + "?" + param;
|
||||
try
|
||||
{
|
||||
log.info("sendSSLPost - {}", urlNameString);
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom());
|
||||
URL console = new URL(urlNameString);
|
||||
HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("contentType", "utf-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
conn.setSSLSocketFactory(sc.getSocketFactory());
|
||||
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
|
||||
conn.connect();
|
||||
InputStream is = conn.getInputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
String ret = "";
|
||||
while ((ret = br.readLine()) != null)
|
||||
{
|
||||
if (ret != null && !ret.trim().equals(""))
|
||||
{
|
||||
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
|
||||
}
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
conn.disconnect();
|
||||
br.close();
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static class TrustAnyTrustManager implements X509TrustManager
|
||||
{
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return new X509Certificate[] {};
|
||||
}
|
||||
}
|
||||
|
||||
private static class TrustAnyHostnameVerifier implements HostnameVerifier
|
||||
{
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
203
src_tenwa/com/tenwa/httpclient/pboc/PbocAction.java
Normal file
203
src_tenwa/com/tenwa/httpclient/pboc/PbocAction.java
Normal file
@ -0,0 +1,203 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.ASResultSet;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
|
||||
import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import com.tenwa.lease.app.quartzmession.CreditAuditHolidayBatch;
|
||||
import com.tenwa.util.SerialNumberUtil;
|
||||
import jbo.com.tenwa.entity.comm.message.BT_BUSSINESS_MESSAGE;
|
||||
import jbo.oti.FC_REQUEST;
|
||||
import jbo.oti.FC_REQUEST_FILE;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PbocAction {
|
||||
|
||||
private String fullName;
|
||||
private String fullCertId;
|
||||
private String fullPhone;
|
||||
private String flowId;
|
||||
private String projectNo;
|
||||
private String actionType;
|
||||
|
||||
|
||||
public PbocAction() {
|
||||
}
|
||||
|
||||
public String getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public void setActionType(String actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public String getFlowId() {
|
||||
return flowId;
|
||||
}
|
||||
|
||||
public void setFlowId(String flowId) {
|
||||
this.flowId = flowId;
|
||||
}
|
||||
|
||||
public String getProjectNo() {
|
||||
return projectNo;
|
||||
}
|
||||
|
||||
public void setProjectNo(String projectNo) {
|
||||
this.projectNo = projectNo;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
|
||||
public String getFullCertId() {
|
||||
return fullCertId;
|
||||
}
|
||||
|
||||
public void setFullCertId(String fullCertId) {
|
||||
this.fullCertId = fullCertId;
|
||||
}
|
||||
|
||||
public String getFullPhone() {
|
||||
return fullPhone;
|
||||
}
|
||||
|
||||
public void setFullPhone(String fullPhone) {
|
||||
this.fullPhone = fullPhone;
|
||||
}
|
||||
|
||||
public PbocAction(String fullName, String fullCertId , String fullPhone) {
|
||||
this.fullName = fullName;
|
||||
this.fullCertId = fullCertId;
|
||||
this.fullPhone = fullPhone;
|
||||
}
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(PbocAction.class);// 引入logger日志
|
||||
|
||||
/**
|
||||
* actionType : get:
|
||||
* 1、无结果,返回异常:未进行拉取过。
|
||||
* 2、有结果,则需要判断状态:
|
||||
* 2.1、结果失败:查询失败,请重新拉取。
|
||||
* 2.2、结果正常:返回true,执行拉取。
|
||||
* 2.3、结果正在进行中:征信结果正在处理中,请稍后再试!
|
||||
* actionType : save:
|
||||
* 1、无结果,返回true,执行拉取。
|
||||
* 2、有结果,则需要判断状态:
|
||||
* 2.1、结果失败:返回true,执行拉取。
|
||||
* 2.2、结果正常:返回true,执行拉取。
|
||||
* 2.3、结果正在进行中:征信结果正在处理中,请稍后再试!
|
||||
* @return
|
||||
*/
|
||||
public String checkReqData(){
|
||||
Transaction Sqlca=null;
|
||||
String result = "false@系统异常,请稍后再试!";
|
||||
try{
|
||||
// if(true){
|
||||
// JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
// String applyId = SerialNumberUtil.getPengyuanNumber(tx);
|
||||
// tx.commit();
|
||||
// logger.info("PbocAction.checkReqData====测试事物问题。");
|
||||
// return "true@"+applyId;
|
||||
// }
|
||||
logger.info("【PbocAction】【checkReqData】 start<<<<<<<<<<<<<");
|
||||
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
|
||||
//根据审批时间初始化信审考核表
|
||||
String sql = "select max(id) applyid from bigdata_pboc_af where project_no='"+projectNo+"' and fullname='"+fullName
|
||||
+"' and fullcertId='"+fullCertId+"' and fullphone='"+fullPhone+"' ";
|
||||
|
||||
logger.info("sql======================"+sql+"========================================================");
|
||||
ASResultSet rs = Sqlca.getASResultSet(new SqlObject(sql));
|
||||
|
||||
if(rs.next()) {
|
||||
String applyId = rs.getString("applyid");
|
||||
if(null == applyId || "null".equals(applyId.toLowerCase())){
|
||||
//无结果
|
||||
if("GET".equals(actionType)){
|
||||
return "false@当前用户征信数据未进行拉取过,请先执行拉取征信数据!";
|
||||
}else {
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
applyId = SerialNumberUtil.getPengyuanNumber(tx);
|
||||
tx.commit();
|
||||
logger.info("PbocAction.checkReqData====1无结果,生成applyid");
|
||||
return "true@"+applyId;
|
||||
}
|
||||
}
|
||||
String sql2 = "select req_sts from bigdata_pboc_af where id='" + applyId+ "' ";
|
||||
logger.info("sql2======================"+sql2+"========================================================");
|
||||
ASResultSet rs2 = Sqlca.getASResultSet(new SqlObject(sql2));
|
||||
// req_sts : 0,进行中,-1 失败,-2 成功
|
||||
if(rs2.next()) {//进行中
|
||||
String reqSts = rs2.getString("req_sts");
|
||||
if(null == reqSts || "null".equals(reqSts.toLowerCase())){
|
||||
return "false@征信查询状态异常!";
|
||||
}
|
||||
if("0".equals(reqSts)){
|
||||
return "false@征信结果正在处理中,请稍后再试!";
|
||||
}else if("-1".equals(reqSts)){//查询失败
|
||||
if("GET".equals(actionType)){
|
||||
return "false@查询结果失败,请重新拉取拉取征信数据或者联系技术人员!";
|
||||
}else {
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
applyId = SerialNumberUtil.getPengyuanNumber(tx);
|
||||
tx.commit();
|
||||
logger.info("PbocAction.checkReqData====2无结果,生成applyid");
|
||||
return "true@"+applyId;
|
||||
}
|
||||
}else if("1".equals(reqSts)){//成功
|
||||
logger.info("PbocAction.checkReqData====3有结果,返回结果===applyId="+applyId);
|
||||
return "true@" + applyId;
|
||||
}else {//状态异常
|
||||
return "false@查询结果失败,请重新拉取拉取征信数据或者联系技术人员!";
|
||||
}
|
||||
}else {
|
||||
return "false@查询结果失败,请重新拉取拉取征信数据或者联系技术人员!";
|
||||
}
|
||||
}else {
|
||||
//无结果
|
||||
if("GET".equals(actionType)){
|
||||
return "false@当前用户征信数据未进行拉取过,请先执行拉取征信数据!";
|
||||
}else {
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
String applyId = SerialNumberUtil.getPengyuanNumber(tx);
|
||||
tx.commit();
|
||||
logger.info("PbocAction.checkReqData====4无结果,生成applyid");
|
||||
return "true@"+applyId;
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error("<<<<<<<<<<<<<<<<<<<<<<【PbocAction】【checkReqData】error>>>>>>1>>>>>>>>>>>>>>>>>", e);
|
||||
try {
|
||||
Sqlca.rollback();
|
||||
} catch (JBOException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("<<<<<<<<<<<<<<<<<<<<<<【PbocAction】【checkReqData】error>>>>>>2>>>>>>>>>>>>>>>>>", e1);
|
||||
}
|
||||
}finally {
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("<<<<<<<<<<<<<<<<<<<<<<【PbocAction】【checkReqData】error>>>>>>3>>>>>>>>>>>>>>>>>", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
234
src_tenwa/com/tenwa/httpclient/pboc/PbocNewDataController.java
Normal file
234
src_tenwa/com/tenwa/httpclient/pboc/PbocNewDataController.java
Normal file
@ -0,0 +1,234 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.Configure;
|
||||
import com.amarsoft.awe.control.model.Page;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.tenwa.comm.exception.BusinessException;
|
||||
import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import java.util.Map;
|
||||
|
||||
public class PbocNewDataController {
|
||||
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
String type = "html";
|
||||
ARE.getLog().info("PbocNewDataController.findAndSavePbocData====applyid="+applyId);
|
||||
String htmlFilePath = Sqlca.getString(new SqlObject("select html_data from bigdata_pboc_af where id = '" + applyId + "'"));
|
||||
if(null != htmlFilePath && !"null".equals(htmlFilePath.toLowerCase())){
|
||||
return htmlFilePath;
|
||||
}
|
||||
// TODO: 2023-5-5 新增记录,状态为进行中。 新增访问日志。
|
||||
// TODO: 2023/2/1 生成pboc个人单笔查询请求参数 主体id
|
||||
String flowId = CurPage.getParameter("flowId");//流程编号
|
||||
String projectNo = CurPage.getParameter("projectNo");//业务编号
|
||||
String personQueryParamStr = PbocXmlUtils.createPersonQueryParamStr(params, CurPage.getAttribute("subjectId").toString());
|
||||
ARE.getLog().info("pboc请求参数===============fullName==="+CurPage.getParameter("fullName"));
|
||||
ARE.getLog().info("pboc请求参数===============fullCertId==="+CurPage.getParameter("fullCertId"));
|
||||
ARE.getLog().info("pboc请求参数===============fullPhone==="+CurPage.getParameter("fullPhone"));
|
||||
SqlObject sql = new SqlObject(("insert into bigdata_pboc_af (id,req_sts,begin_time,inputuserid,inputorgid,inputtime,flow_id,project_no,fullName,fullcertId,fullphone) values('" +
|
||||
applyId+ "','0','" + System.currentTimeMillis() + "','" + CurPage.getUserId() + "','" + CurPage.getUser().getOrgID() + "','" + StringFunction.getTodayNow() +"','"
|
||||
+ flowId +"','" + projectNo +"','"
|
||||
+CurPage.getParameter("fullName")+"','"+CurPage.getParameter("fullCertId")+"','"+CurPage.getParameter("fullPhone")+"')").replaceAll(":", "△"));
|
||||
sql.setDebugSql(sql.getDebugSql().replaceAll("△", ":"));
|
||||
sql.setOriginalSql(sql.getOriginalSql().replaceAll("△", ":"));
|
||||
sql.setRunSql(sql.getRunSql().replaceAll("△", ":"));
|
||||
Sqlca.executeSQL(sql);
|
||||
//新增log
|
||||
SqlObject sqlLog = new SqlObject(("insert into bigdata_pboc_af_log (pboc_id,req_sts,req_time,http_url,http_param,inputuserid,inputorgid,inputtime,flow_id,project_no,fullName,fullcertId,fullphone) values('" +
|
||||
applyId+ "','0','" + System.currentTimeMillis()+ "','" + BigDataPropertiesUtil.get("pboc_url") + "','" + personQueryParamStr
|
||||
+ "','" + CurPage.getUserId() + "','" + CurPage.getUser().getOrgID() + "','" + StringFunction.getTodayNow()
|
||||
+"','"+ flowId +"','" + projectNo
|
||||
+"','" +CurPage.getParameter("fullName")+"','"+CurPage.getParameter("fullCertId")
|
||||
+"','"+CurPage.getParameter("fullPhone")+"')").replaceAll(":", "△"));
|
||||
sqlLog.setDebugSql(sqlLog.getDebugSql().replaceAll("△", ":"));
|
||||
sqlLog.setOriginalSql(sqlLog.getOriginalSql().replaceAll("△", ":"));
|
||||
sqlLog.setRunSql(sqlLog.getRunSql().replaceAll("△", ":"));
|
||||
Sqlca.executeSQL(sqlLog);
|
||||
// TODO: 2023-5-5 异步调用接口请求,更改记录 。新增访问日志。
|
||||
asyncReqHttp(applyId,personQueryParamStr,CurPage);
|
||||
return "false@征信数据拉取中,请稍后再进行查询!";
|
||||
}
|
||||
|
||||
private void asyncReqHttp(String applyId, String personQueryParamStr, Page curPage) {
|
||||
ThreadPoolTaskExecutor threadPool = PbocThreadPool.getInstance();
|
||||
threadPool.execute(()->{
|
||||
try {
|
||||
asyncReqHttpAndSave(applyId, personQueryParamStr, curPage);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* pboc查询配偶信息
|
||||
* @param params
|
||||
* @param applyId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String queryPbocData(Map<String, String> params, Transaction Sqlca, String applyId) throws Exception {
|
||||
String type = "html";
|
||||
ARE.getLog().info("PbocNewDataController.findAndSavePbocData====applyid=" + applyId);
|
||||
String xmlDataContent = Sqlca.getString(new SqlObject("select xml_data_content from bigdata_pboc_af where id = '" + applyId + "'"));
|
||||
if(null != xmlDataContent){
|
||||
JSONObject resJson = PbocXmlUtils.toJson(xmlDataContent);
|
||||
JSONObject serviceDataJson = resJson.getJSONObject("service");
|
||||
JSONObject msgBodyData = serviceDataJson.getJSONObject("msgBody");
|
||||
JSONObject xmlRptData = msgBodyData.getJSONObject("xmlRpt");
|
||||
JSONObject DocumentData = xmlRptData.getJSONObject("Document");
|
||||
JSONObject PMMData = DocumentData.getJSONObject("PMM");
|
||||
JSONObject PB02Data = PMMData.getJSONObject("PB02");
|
||||
String poName = PB02Data.getString("PB020Q01");
|
||||
if(null == poName){
|
||||
return null;
|
||||
}
|
||||
String poCertId = PB02Data.getString("PB020I01") == null ? "0" : PB02Data.getString("PB020I01");
|
||||
return poName+"@"+poCertId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步执行访问pboc查询并保存
|
||||
*/
|
||||
private void asyncReqHttpAndSave(String applyId, String personQueryParamStr, Page CurPage) throws Exception {
|
||||
String type = "html";
|
||||
String xmlFilePath = null;
|
||||
String htmlFilePath = null;
|
||||
String resXMLReport = null;
|
||||
String reportId = null;
|
||||
JSONObject resJson = null;
|
||||
String resSts = "1";//req_sts : 0,进行中,-1 失败,1 成功
|
||||
try{
|
||||
// : 2023/2/1 本地测试暂用
|
||||
@SuppressWarnings("deprecation")
|
||||
Configure configure = Configure.getInstance();
|
||||
String fileSavePath = configure.getParameter("FileSavePath") + "/" + "pboc";
|
||||
resXMLReport = this.findQueryReport(personQueryParamStr, type, CurPage.getAttribute("subjectId").toString());
|
||||
resJson = PbocXmlUtils.toJson(resXMLReport);
|
||||
JSONObject serviceDataJson = resJson.getJSONObject("service");
|
||||
JSONObject msgHeadData = serviceDataJson.getJSONObject("msgHead");
|
||||
ARE.getLog().info("========================pboc返回==================");
|
||||
ARE.getLog().info("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】info>>>>>>20230816 querypbocressuccess >>>>>>>>>>>>>>>>>"+ msgHeadData.toJSONString());
|
||||
ARE.getLog().info("========================pboc返回==================");
|
||||
String resCode = msgHeadData.getString("resCode");
|
||||
if("000".equals(resCode)){
|
||||
reportId = msgHeadData.getString("resJnlId");
|
||||
JSONObject msgBodyData = serviceDataJson.getJSONObject("msgBody");
|
||||
ARE.getLog().info("========================pboc返回成功==================");
|
||||
ARE.getLog().info("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】success>>>>>>20230816 querypbocressuccess >>>>>>>>>>>>>>>>>"+ resCode);
|
||||
ARE.getLog().info("========================pboc返回成功==================");
|
||||
String htmlRptDataStr = msgBodyData.getString("htmlRpt");
|
||||
// : 2023-5-24 删除html内容存储
|
||||
//msgBodyData.remove("htmlRpt");
|
||||
// : 2023-5-24 删除html内容存储
|
||||
xmlFilePath = FileUtils.createXMLFile(fileSavePath, reportId, resXMLReport);
|
||||
htmlFilePath = FileUtils.createHtmlFile(fileSavePath, reportId, htmlRptDataStr);
|
||||
ARE.getLog().info(htmlFilePath);
|
||||
ARE.getLog().info(xmlFilePath);
|
||||
}else {//返回状态异常
|
||||
resSts = "-1";//req_sts : 0,进行中,-1 失败,1 成功
|
||||
ARE.getLog().info("========================pboc返回异常==================");
|
||||
ARE.getLog().error("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】error>>>>>>20230816 querypbocreserror >>>>>>>>>>>>>>>>>"+ resCode);
|
||||
ARE.getLog().info("========================pboc返回异常==================");
|
||||
}
|
||||
}catch (Exception e){
|
||||
ARE.getLog().info("========================pboc返回异常==================");
|
||||
ARE.getLog().error("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】error>>>>>>01>>>>>>>>>>>>>>>>>", e);
|
||||
ARE.getLog().info("========================pboc返回异常==================");
|
||||
resSts = "-1";//req_sts : 0,进行中,-1 失败,1 成功
|
||||
}
|
||||
Transaction Sqlca=null;
|
||||
try{
|
||||
Sqlca = Transaction.createTransaction("als");
|
||||
// TODO: 2023-5-5 异步调用接口请求,更改记录 。新增访问日志。
|
||||
SqlObject sql = new SqlObject(("update bigdata_pboc_af set pboc_report_id='"+reportId+"',"
|
||||
+"xml_data='"+xmlFilePath+"',"
|
||||
// +"xml_data_content='"+resXMLReport+"',"
|
||||
// TODO: 2023-5-24 删除html内容存储
|
||||
// +"xml_data_content='"+PbocXmlUtils.jsonStr2Xml(resJson.toJSONString())+"',"
|
||||
+"xml_data_content='"+resXMLReport+"',"
|
||||
// TODO: 2023-5-24 删除html内容存储
|
||||
+"html_data='"+htmlFilePath+"',"
|
||||
+"req_sts='"+resSts+"',"
|
||||
+"end_time='"+ System.currentTimeMillis() +"'"
|
||||
+" where id='"+ applyId +"'").replaceAll(":", "△"));
|
||||
sql.setDebugSql(sql.getDebugSql().replaceAll("△", ":"));
|
||||
sql.setOriginalSql(sql.getOriginalSql().replaceAll("△", ":"));
|
||||
sql.setRunSql(sql.getRunSql().replaceAll("△", ":"));
|
||||
Sqlca.executeSQL(sql);
|
||||
//新增log
|
||||
SqlObject sqlLog = new SqlObject(("insert into bigdata_pboc_af_log (pboc_id,req_sts,req_time,http_url,http_param,http_res,inputuserid,inputorgid,inputtime,fullName,fullcertId,fullphone) values('" +
|
||||
applyId+ "','"+resSts+"','" + System.currentTimeMillis()+ "','" + BigDataPropertiesUtil.get("pboc_url") + "','" + personQueryParamStr
|
||||
+ "','" + reportId
|
||||
+ "','" + CurPage.getUserId() + "','" + CurPage.getUser().getOrgID() + "','" + StringFunction.getTodayNow()
|
||||
+"','" +CurPage.getParameter("fullName")+"','"+CurPage.getParameter("fullCertId")
|
||||
+"','"+CurPage.getParameter("fullPhone")+"')").replaceAll(":", "△"));
|
||||
sqlLog.setDebugSql(sqlLog.getDebugSql().replaceAll("△", ":"));
|
||||
sqlLog.setOriginalSql(sqlLog.getOriginalSql().replaceAll("△", ":"));
|
||||
sqlLog.setRunSql(sqlLog.getRunSql().replaceAll("△", ":"));
|
||||
Sqlca.executeSQL(sqlLog);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
ARE.getLog().error("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】error>>>>>>1>>>>>>>>>>>>>>>>>", e);
|
||||
try {
|
||||
Sqlca.rollback();
|
||||
} catch (JBOException e1) {
|
||||
e1.printStackTrace();
|
||||
ARE.getLog().error("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】error>>>>>>2>>>>>>>>>>>>>>>>>", e1);
|
||||
}
|
||||
}finally {
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
ARE.getLog().error("<<<<<<<<<<<<<<<<<<<<<<【PbocNewDataController】【asyncReqHttpAndSave】error>>>>>>3>>>>>>>>>>>>>>>>>", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String findQueryReport(String params, String type, String SubjectId) throws Exception {
|
||||
ARE.getLog().info("========================pboc请求参数==================");
|
||||
ARE.getLog().info(params);
|
||||
ARE.getLog().info("========================pboc请求参数==================");
|
||||
String result = "";
|
||||
try{
|
||||
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("获取大数据失败");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
65
src_tenwa/com/tenwa/httpclient/pboc/PbocThreadPool.java
Normal file
65
src_tenwa/com/tenwa/httpclient/pboc/PbocThreadPool.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
public class PbocThreadPool implements ServletContextListener {
|
||||
private static final Logger logger = LogManager.getLogger(PbocThreadPool.class);// 引入logger日志
|
||||
private static volatile ThreadPoolTaskExecutor threadPool;
|
||||
private static boolean flag = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
||||
logger.info("==================================PbocThreadPool.contextInitialized.start===============================");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent servletContextEvent) {
|
||||
try {
|
||||
logger.info("==================================PbocThreadPool.contextDestroyed.start===============================");
|
||||
if(threadPool != null){
|
||||
threadPool.shutdown();
|
||||
logger.info("==================================PbocThreadPool.contextDestroyed.end============shutdown===================");
|
||||
}else {
|
||||
logger.info("==================================PbocThreadPool.contextDestroyed.end===============================");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("==================================PbocThreadPool.contextDestroyed.error===============================");
|
||||
}
|
||||
}
|
||||
|
||||
public PbocThreadPool(){
|
||||
}
|
||||
|
||||
public static ThreadPoolTaskExecutor getInstance(){
|
||||
logger.info("==================================PbocThreadPool.getInstance.start===============================");
|
||||
if(!flag){
|
||||
synchronized (ThreadPoolTaskExecutor.class){
|
||||
if(threadPool == null){
|
||||
// 设置线程池线程数量
|
||||
threadPool = new ThreadPoolTaskExecutor();
|
||||
// 线程池维护线程的最少数量
|
||||
threadPool.setCorePoolSize(3);
|
||||
// 线程池维护线程的最大数量
|
||||
threadPool.setMaxPoolSize(6);
|
||||
//设置线程名称前缀
|
||||
threadPool.setThreadNamePrefix("bigdata_http_pboc_");
|
||||
//设置队列长度
|
||||
threadPool.setQueueCapacity(10);
|
||||
// threadPool.setKeepAliveSeconds(300);
|
||||
// 当调度器shutdown被调用时等待当前被调度的任务完成
|
||||
threadPool.setWaitForTasksToCompleteOnShutdown(true);
|
||||
threadPool.initialize();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return threadPool;
|
||||
}
|
||||
}
|
||||
268
src_tenwa/com/tenwa/httpclient/pboc/PbocXmlUtils.java
Normal file
268
src_tenwa/com/tenwa/httpclient/pboc/PbocXmlUtils.java
Normal file
@ -0,0 +1,268 @@
|
||||
package com.tenwa.httpclient.pboc;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.tenwa.flow.util.CalculateUtil;
|
||||
import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class PbocXmlUtils {
|
||||
/**
|
||||
* 个人单笔查询的参数组装
|
||||
* @return
|
||||
*/
|
||||
public static String createPersonQueryParamStr(Map<String,String> params, String subjectId) {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject msgHead = new JSONObject();
|
||||
JSONObject msgBody = new JSONObject();
|
||||
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", BigDataPropertiesUtil.get("pboc_loginUserCode"));//报告使用人 登录征信查询前置系统的用户账号
|
||||
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"));
|
||||
//查询原因 24-融资审批
|
||||
msgBody.put("qryReason", "24");
|
||||
msgBody.put("qryType", "0");//查询类型
|
||||
msgBody.put("rptQryType", "1");//信用报告查询方式:1本地优先,2仅查询本地,3仅查询征信系统。
|
||||
//"01-银行版
|
||||
//02-自助查询版
|
||||
//03-政府版
|
||||
//04-社会版"
|
||||
msgBody.put("qryFormat", "01");//查询版本
|
||||
/**
|
||||
* a-基本信息
|
||||
* b-信息概要
|
||||
* e-公共信息明细
|
||||
*/
|
||||
// msgBody.put("rptRstSegment", "a|b|e");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String startTime = sdf.format(date);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.YEAR, 1);
|
||||
String endTime = sdf.format(cal.getTime());
|
||||
msgBody.put("authStartDt", startTime);
|
||||
msgBody.put("authEndDt", endTime);
|
||||
|
||||
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);
|
||||
ARE.getLog().info("xmlParamStr : " + xmlParamStr);
|
||||
return xmlParamStr;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 解决 CDATA 问题
|
||||
private static Pattern pattern = Pattern.compile("[<>&\"',]");
|
||||
|
||||
|
||||
public static String toXml(JSONObject obj) {
|
||||
return jsonStr2Xml(obj.toJSONString());
|
||||
}
|
||||
|
||||
private static String escape(String string) {
|
||||
return pattern.matcher(string).find() ? "<![CDATA[" + string + "]]>" : string;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateXml
|
||||
* @param xmlStr
|
||||
*/
|
||||
private static String updateXml(String xmlStr) {
|
||||
xmlStr = xmlStr.trim();
|
||||
if (StringUtils.isBlank(xmlStr)) {
|
||||
return xmlStr;
|
||||
}
|
||||
|
||||
// 过滤非法字符
|
||||
xmlStr = xmlStr.replaceAll("[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]", "");
|
||||
|
||||
StringBuilder xmlSb = new StringBuilder(xmlStr);
|
||||
if (!xmlStr.startsWith("<?")) {
|
||||
xmlSb.insert(0, "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||
}
|
||||
|
||||
int idx = xmlSb.indexOf("?>") + 2;
|
||||
xmlSb.insert(idx, "<root_luxsun>").append("</root_luxsun>");
|
||||
|
||||
return xmlSb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* xml2Json
|
||||
* @param xmlStr
|
||||
* @return
|
||||
* @throws DocumentException
|
||||
*/
|
||||
public static JSONObject toJson(String xmlStr) throws DocumentException {
|
||||
xmlStr = updateXml(xmlStr);
|
||||
Document doc = DocumentHelper.parseText(xmlStr);
|
||||
JSONObject json = new JSONObject();
|
||||
dom4j2Json(doc.getRootElement(), json);
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* toJsonString
|
||||
* @param xmlStr
|
||||
*/
|
||||
public static String toJsonString(String xmlStr) throws DocumentException {
|
||||
JSONObject jsonObject = toJson(xmlStr);
|
||||
String json = JSON.toJSONString(jsonObject);
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* toMap
|
||||
* @param xmlStr
|
||||
*/
|
||||
public static Map<String, Object> toMap(String xmlStr) throws DocumentException {
|
||||
String jsonStr = toJsonString(xmlStr);
|
||||
Map<String, Object> xmlMap = JSON.parseObject(jsonStr, LinkedHashMap.class);
|
||||
return xmlMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* xml转json
|
||||
* @param element
|
||||
* @param json
|
||||
*/
|
||||
private static void dom4j2Json(Element element, JSONObject json){
|
||||
// 如果是属性
|
||||
for(Object o:element.attributes()){
|
||||
Attribute attr=(Attribute)o;
|
||||
if(!isEmpty(attr.getValue())){
|
||||
json.put("@"+attr.getName(), attr.getValue());
|
||||
}
|
||||
}
|
||||
List<Element> chdEl=element.elements();
|
||||
if(chdEl.isEmpty()&&!isEmpty(element.getText())){ // 如果没有子元素,只有一个值
|
||||
json.put(element.getName(), element.getText());
|
||||
}
|
||||
|
||||
for(Element e:chdEl){ // 有子元素
|
||||
if(!e.elements().isEmpty()){ // 子元素也有子元素
|
||||
JSONObject chdjson=new JSONObject();
|
||||
dom4j2Json(e,chdjson);
|
||||
Object o=json.get(e.getName());
|
||||
if(o!=null){
|
||||
JSONArray jsona=null;
|
||||
if(o instanceof JSONObject){ // 如果此元素已存在,则转为jsonArray
|
||||
JSONObject jsono=(JSONObject)o;
|
||||
json.remove(e.getName());
|
||||
jsona=new JSONArray();
|
||||
jsona.add(jsono);
|
||||
jsona.add(chdjson);
|
||||
}
|
||||
if(o instanceof JSONArray){
|
||||
jsona=(JSONArray)o;
|
||||
jsona.add(chdjson);
|
||||
}
|
||||
json.put(e.getName(), jsona);
|
||||
}else{
|
||||
if(!chdjson.isEmpty()){
|
||||
json.put(e.getName(), chdjson);
|
||||
}
|
||||
}
|
||||
}else{ // 子元素没有子元素
|
||||
for(Object o:element.attributes()){
|
||||
Attribute attr=(Attribute)o;
|
||||
if(!isEmpty(attr.getValue())){
|
||||
json.put("@"+attr.getName(), attr.getValue());
|
||||
}
|
||||
}
|
||||
if(!e.getText().isEmpty()){
|
||||
json.put(e.getName(), e.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEmpty(String str) {
|
||||
|
||||
if (str == null || str.trim().isEmpty() || "null".equals(str)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* jsonStr2Xml
|
||||
* @param json
|
||||
* @return java.lang.String
|
||||
*/
|
||||
public static String jsonStr2Xml(String json){
|
||||
try {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||
JSONObject jObj = JSON.parseObject(json);
|
||||
json2Xmlstr(jObj,buffer);
|
||||
return buffer.toString();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Json to xmlstr string
|
||||
*
|
||||
* @param jObj the j obj
|
||||
* @param buffer the buffer
|
||||
* @return the string
|
||||
*/
|
||||
public static String json2Xmlstr(JSONObject jObj,StringBuffer buffer){
|
||||
Set<Map.Entry<String, Object>> se = jObj.entrySet();
|
||||
for(Iterator<Map.Entry<String, Object>> it = se.iterator(); it.hasNext(); )
|
||||
{
|
||||
Map.Entry<String, Object> en = it.next();
|
||||
if(en.getValue().getClass().getName().equals("com.alibaba.fastjson.JSONObject")){
|
||||
buffer.append("<"+en.getKey()+">");
|
||||
JSONObject jo = jObj.getJSONObject(en.getKey());
|
||||
json2Xmlstr(jo,buffer);
|
||||
buffer.append("</"+en.getKey()+">");
|
||||
}else if(en.getValue().getClass().getName().equals("com.alibaba.fastjson.JSONArray")){
|
||||
JSONArray jarray = jObj.getJSONArray(en.getKey());
|
||||
for (int i = 0; i < jarray.size(); i++) {
|
||||
buffer.append("<"+en.getKey()+">");
|
||||
JSONObject jsonobject = jarray.getJSONObject(i);
|
||||
json2Xmlstr(jsonobject,buffer);
|
||||
buffer.append("</"+en.getKey()+">");
|
||||
}
|
||||
}else if(en.getValue().getClass().getName().equals("java.lang.String")){
|
||||
buffer.append("<"+en.getKey()+">" + escape((String) en.getValue()));
|
||||
buffer.append("</"+en.getKey()+">");
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -469,7 +469,6 @@ public void contextDestroyed(ServletContextEvent arg0) {
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user