This commit is contained in:
zhangbb 2018-08-11 15:35:51 +08:00
commit 8f681c65ed
13 changed files with 507 additions and 95 deletions

View File

@ -8,6 +8,7 @@
//初始话手机在线时长查询
String ProjectId = CurPage.getParameter("ProjectId");
String flowunid = CurPage.getParameter("ObjectNo");
ASObjectModel doTemp = new ASObjectModel("LbTelOnlinList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
@ -17,24 +18,29 @@
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
// {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
// {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
// {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
{"true","","Button","校验手机号在线时长","调用查询接口","checkPhoneNumberOnLine()","","","","btn_icon_detail",""},
{"true","All","Button","重发","选择需要重新查询的某条数据","retry()","","","","btn_icon_detail",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
var sUrl = "";
AsControl.OpenView(sUrl,'','_self','');
function checkPhoneNumberOnLine(){
var result = RunJavaMethodTrans("com.tenwa.lease.flow.project.validate.OnlineClient","getTelOnLine","flowunid=<%=flowunid%>,projectId=<%=ProjectId%>");
if(result=="true"){
window.location.reload();
}else{
AsDebug.showMessage('提示',result,'','',true);
}
}
function viewAndEdit(){
var sUrl = "";
var sPara = getItemValue(0,getRow(0),'SerialNo');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("参数不能为空!");
return ;
}
AsControl.OpenView(sUrl,'SerialNo=' +sPara ,'_self','');
function retry(){
var onLineId = getItemValue(0,getRow(0),'online_id');
var result = RunJavaMethodTrans("com.tenwa.lease.flow.project.validate.OnlineClient","getTelOnLineReTry","onLineId="+onLineId);
if(result=="true"){
window.location.reload();
}else{
AsDebug.showMessage('提示',result,'','',true);
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -4227,6 +4227,7 @@
<class name="LB_TELONLINE" label="手机号在线时长" keyAttributes="ID">
<attributes>
<attribute name="ID" label="ID" type="STRING" length="40"/>
<attribute name="online_id" label="调用返回id" type="STRING" length="40"/>
<attribute name="success" label="是否调用成功" type="STRING" length="10"/>
<attribute name="reason_code" label="调用失败时的错误码" type="STRING" length="20"/>
<attribute name="reason_desc" label="错误详情描述" type="STRING" length="500"/>

View File

@ -0,0 +1,11 @@
#测试请求地址
com.tenwa.jianghd.url1=https
com.tenwa.jianghd.url2=apitest.tongdun.cn
com.tenwa.jianghd.url3=/bodyguard/apply/v4.3
com.tenwa.jianghd.partner_code=apgj
com.tenwa.jianghd.partner_key=3a7be6a6d73c48b18f083ddf8d399538
com.tenwa.jianghd.app_name=apgj_web
com.tenwa.jianghd.biz_code=OnLine
com.tenwa.jianghd.encode=UTF-8

View File

@ -0,0 +1,39 @@
package apx.com.amarsoft.als.apzl.apply.business.doc.detail.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.PayDocListService;
import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.impl.PayDocListServiceImpl;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.base.util.ReturnMapUtil;
@Path("/file")
public class PayDocListController {
@Path("/comm/doc/list")
@POST
public Map<String, Object> docList(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca) throws Exception {
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
ARE.getLog()
.info("[CONTROLLER] PayDocListController run .................");
ARE.getLog().info(
"[Path] /file/comm/doc/list" + " run .................");
PayDocListService service = new PayDocListServiceImpl();
try {
return service.docList(request, response, tx, sqlca, ReturnMapUtil);
} catch (Exception e) {
return ReturnMapUtil.rollback(e);
}
}
}

View File

@ -0,0 +1,18 @@
package apx.com.amarsoft.als.apzl.apply.business.doc.detail.service;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Context;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.base.util.ReturnMapUtil;
public interface PayDocListService {
Map<String, Object> docList(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
throws Exception;
}

View File

@ -0,0 +1,74 @@
package apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.amarsoft.app.lc.workflow.action.GetFlowAction;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.lang.StringX;
import com.amarsoft.awe.util.Transaction;
import com.base.util.MultipartDataUtil;
import com.base.util.ReturnMapUtil;
import com.tenwa.doc.action.DocListInitAction;
import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.PayDocListService;
import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools;
import apx.com.amarsoft.als.doc.manage.PayDocListDoManage;
public class PayDocListServiceImpl implements PayDocListService {
private Map<String, Object> fieldMap;
@SuppressWarnings("unchecked")
@Override
public Map<String, Object> docList(HttpServletRequest request,
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
ReturnMapUtil ReturnMapUtil) throws Exception {
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
fieldMap = (Map<String, Object>) testMap.get("fieldMap");
String objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap
.get("OBJECTNO").toString();
fieldMap.put("OBJECTNO", objectNo);
fieldMap.put("OBJECTNO".toLowerCase(), objectNo);
fieldMap.put("FLOWUNID", objectNo);
fieldMap.put("FLOWUNID".toLowerCase(), objectNo);
fieldMap.put("FLOW_UNID", objectNo);
fieldMap.put("FLOW_UNID".toLowerCase(), objectNo);
String otherWhere = "";
BizObject flow=GetFlowAction.getFlowBussinessObject(objectNo);//Á÷³ÌÔÏó
String productId = flow.getAttribute("productId").getString();
List<Object> list = new ArrayList<Object>();
try {
list = ProductParamUtil.getProductDocInfo(productId, "PRD0412");
} catch (Exception e) {
ARE.getLog().error(e);
}
String s = "";
try {
s = InitDocListTools.getdocClassItemno(list);
if (!StringX.isSpace(s)) {
s = s.split("@")[0];
}
} catch (Exception e) {
ARE.getLog().error(e);
}
otherWhere = DocListInitAction.getFlowWhere(flow,"","rela");
otherWhere += " and O.doc_Class_Itemno in (" + s + ")";
PayDocListDoManage manage = new PayDocListDoManage();
manage.setDono("FlowPayDocList");
manage.setFieldMap(fieldMap);
manage.setsAddWhere(otherWhere);
return manage.queryDefaultDo(request, sqlca, tx, ReturnMapUtil);
}
}

View File

@ -19,7 +19,41 @@ import com.amarsoft.context.ASUser;
import com.tenwa.doc.action.DocListInitAction;
public class InitDocListTools {
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "unchecked", "rawtypes" })
public static String getdocClassItemno (List<Object> list) {
String s="";
String type = "";
String docList = "";
try {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = (Map<String, Object>) list.get(i);
if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) {
type = map.get("TYPE").toString();
if ("SingleRow".equals(type)) {
docList = map.get("DOCLIST").toString();
} else {
List l = (List) map.get("DOCCONFIG");
docList = l.toString();
}
}
}
String docClassItemno = docList;// CurPage.getParameter("docList");
String[] itemnos=docClassItemno.split(",");
for(int i=0;i<itemnos.length;i++){
s+="'"+itemnos[i]+"',";
}
if(s.length()>0){
s=s.substring(0, s.length()-1);
}
return s+"@"+docClassItemno;
} catch (Exception e) {
ARE.getLog().error(e);
}
return "";
}
public static boolean initDocList(String flowUnid, String userId, String carAttributes) throws Exception {
try {
BizObjectManager objectManage = JBOFactory
@ -51,30 +85,35 @@ public class InitDocListTools {
ARE.getLog().error(e);
return false;
}
String type = "";
String docList = "";
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = (Map<String, Object>) list.get(i);
if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) {
type = map.get("TYPE").toString();
if ("SingleRow".equals(type)) {
docList = map.get("DOCLIST").toString();
} else {
List l = (List) map.get("DOCCONFIG");
docList = l.toString();
}
}
// String type = "";
// String docList = "";
// for (int i = 0; i < list.size(); i++) {
// Map<String, Object> map = (Map<String, Object>) list.get(i);
// if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) {
// type = map.get("TYPE").toString();
// if ("SingleRow".equals(type)) {
// docList = map.get("DOCLIST").toString();
// } else {
// List l = (List) map.get("DOCCONFIG");
// docList = l.toString();
// }
// }
// }
// String docClassItemno = docList;// CurPage.getParameter("docList");
// String[] itemnos=docClassItemno.split(",");
// String s="";
// for(int i=0;i<itemnos.length;i++){
// s+="'"+itemnos[i]+"',";
// }
// if(s.length()>0){
// s=s.substring(0, s.length()-1);
// }
String s = getdocClassItemno(list);
String docClassItemno = "";
if (s.length() > 0) {
s = s.split("@")[0];
docClassItemno = s.split("@")[1];
}
String docClassItemno = docList;// CurPage.getParameter("docList");
String[] itemnos=docClassItemno.split(",");
String s="";
for(int i=0;i<itemnos.length;i++){
s+="'"+itemnos[i]+"',";
}
if(s.length()>0){
s=s.substring(0, s.length()-1);
}
try {
ASUser CurUser = new ASUser(userId);
Map<String,String> docParam=new HashMap<String,String>();

View File

@ -1,11 +1,15 @@
package apx.com.amarsoft.als.base.awe.execute.method;
import net.sf.json.JSONObject;
import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.base.util.JsonUtil;
public class BusinessCustomerMethod {
@ -28,6 +32,28 @@ public class BusinessCustomerMethod {
}
return bo.getAttribute("customerid").toString();
}
public String getCustomerIdByFlowUnid(String flowUnid) throws JBOException {
String certId = "";
BizObjectManager fboM = JBOFactory
.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME);
BizObject fbo = fboM.createQuery("flow_unid=:flow_unid")
.setParameter("flow_unid", flowUnid).getSingleResult(false);
if (null == fbo) return "";
String jsonStr = fbo.getAttribute("FixedFlowParam") == null ? "" : fbo.getAttribute("FixedFlowParam").toString();
if ("".equals(jsonStr)) return "";
try {
JSONObject jo = JsonUtil.str2JSONObject(jsonStr);
certId = jo.get("certid") == null ? "" : jo.getString("certid");
} catch (Exception e) {
ARE.getLog().error(e);
return "";
}
if ("".equals(certId)) return "";
return getCustomerIdByCertId(certId);
}
/**
* 根据流程编号获取客户IDCUSTOMER_PERSON_TEMP表中ID流程编号均不唯一

View File

@ -0,0 +1,46 @@
package apx.com.amarsoft.als.doc.manage;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.lang.StringX;
import com.amarsoft.awe.util.Transaction;
import com.base.util.ReturnMapUtil;
public class PayDocListDoManage extends AbstractAweDoQueryManage {
private String sAddWhere;
private String dono;
private Map<String, Object> fieldMap;
public void setFieldMap(Map<String, Object> fieldMap) {
this.fieldMap = fieldMap;
}
public void setDono(String dono) {
this.dono = dono;
}
public void getGroupId() {
sGroupId = this.dono;
}
public void getOtherWhere() {
super.sOtherWhere = StringX.isSpace(sAddWhere) ? ""
: this.sAddWhere;
}
public void setsAddWhere(String sAddWhere) {
this.sAddWhere = sAddWhere;
}
public Map<String, Object> queryDefaultDo(HttpServletRequest request,
Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil)
throws Exception {
setParamMap(fieldMap);
return getData(request, sqlca, tx, ReturnMapUtil);
}
}

View File

@ -105,6 +105,7 @@ public class SecurityUtil {
}
public static void main(String[] args) throws Exception {
// String message = "apzl@2018", key = "";
String message = "apzl", key = "";
String entryptedMsg = encrypt(message, key);
System.out.println("encrypted message is below :");

View File

@ -5,25 +5,12 @@ import com.tenwa.flow.treeview.action.BaseInitTreeView;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
BaseInitTreeView TreeView=new BaseInitTreeView();
String sql = "select se.seriesid,se.seriesname from ("
+ "SELECT seriesid,max(seriesname) seriesname,max(brandid) brandid FROM vi_car_data where 1=1 group by seriesid"
+ ") se WHERE se.seriesname IS NOT NULL AND se.brandid='#brandid' ORDER BY se.seriesname DESC";
//:itemName为前台左树图中节点中文名,codeno为产品节点配置中节点名
/*Map<String,String>fixedParam;//固定参数用来取前台参数
TreeView.addBeforeNodeByCode(itemName, codeno);//在节点之胶增加节点
TreeView.addChildrenNodeByCode(itemName, codeno);//在节点下面增加子节点
TreeView.addFirstNodeByCode(codeno);//在开始位置增加子节点
TreeView.addLastNodeByCode(codeno);//在结束位置增加子节点
TreeView.moveTreeItem(itemName, afterItem);//将节点A移到节点B之前
TreeView.moveTreeItemToFirst(itemName);//将节点移到最开始
TreeView.moveTreeItemToLast(itemName);//将节点移到最后
TreeView.AddNodeUrlParam(itemName, param);//更新节点参数param为Map
TreeView.updateNodeUrl(itemName, URL);//更新节点的URL
TreeView.updateNodeTemplateNo(itemName, templateNo);//更新节点的模板编号
TreeView.updateNodeSetReadOnly(itemName, readType);//设置节只读
*/
System.out.println(sql.substring(sql.toUpperCase().lastIndexOf("WHERE"), sql.length()));
System.out.println(sql.substring(0, sql.toLowerCase().lastIndexOf("where")));
}

View File

@ -8,6 +8,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import jbo.com.tenwa.lease.comm.LB_TELONLINE;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
@ -20,6 +22,10 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.alibaba.fastjson.JSON;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
@ -27,49 +33,70 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil;
public class OnlineClient {
private static String partner_code = "apgj";
private static String URI_SEND_SMS = "https://apitest.tongdun.cn/bodyguard/apply/v4.3";
private static String ENCODING = "UTF-8";
private static String partner_key = "3a7be6a6d73c48b18f083ddf8d399538";
private static String app_name = "apgj_web";
private static String biz_code = "OnLine";
private static String partner_code = TelOnLineConfigure.get("com.tenwa.jianghd.partner_code");
private static String url1 = TelOnLineConfigure.get("com.tenwa.jianghd.url1");
private static String url2 = TelOnLineConfigure.get("com.tenwa.jianghd.url2");
private static String url3 = TelOnLineConfigure.get("com.tenwa.jianghd.url3");
// private static String URI_SEND_SMS = "https://apitest.tongdun.cn/bodyguard/apply/v4.3";
private static String ENCODING =TelOnLineConfigure.get("com.tenwa.jianghd.encode");
private static String partner_key = TelOnLineConfigure.get("com.tenwa.jianghd.partner_key");
private static String app_name =TelOnLineConfigure.get("com.tenwa.jianghd.app_name");
private static String biz_code = TelOnLineConfigure.get("com.tenwa.jianghd.biz_code");
private String flowunid;
private String projectId;
private String onLineId;
public static void main(String[] org0) throws ClientProtocolException, IOException, URISyntaxException{
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(getUri());
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("account_mobile", "18721658364"));
nvps.add(new BasicNameValuePair("biz_code", biz_code));
httpPost.setEntity(new UrlEncodedFormEntity(nvps));
CloseableHttpResponse response2 = httpclient.execute(httpPost);
try {
System.out.println(response2.getStatusLine().getStatusCode());
HttpEntity entity2 = response2.getEntity();
String ss = EntityUtils.toString(entity2);
System.out.println(ss);
EntityUtils.consume(entity2);
} finally {
response2.close();
}
System.out.println(partner_code+","+url1);
//
// CloseableHttpClient httpclient = HttpClients.createDefault();
//
// HttpPost httpPost = new HttpPost(getUri());
// List <NameValuePair> nvps = new ArrayList <NameValuePair>();
// //WF2018081112414717786099
// nvps.add(new BasicNameValuePair("account_mobile", "13000000000"));
// nvps.add(new BasicNameValuePair("biz_code", biz_code));
//// nvps.add(new BasicNameValuePair("id", "WF2018081112414717786099"));
//// nvps.add(new BasicNameValuePair("invoke_type", "RETRY"));
// httpPost.setEntity(new UrlEncodedFormEntity(nvps));
//
// CloseableHttpResponse response2 = httpclient.execute(httpPost);
//
// try {
// System.out.println(response2.getStatusLine().getStatusCode());
// HttpEntity entity2 = response2.getEntity();
// String ss = EntityUtils.toString(entity2);
// Map mapTypes = JSON.parseObject(ss);
// System.out.println(mapTypes);
// EntityUtils.consume(entity2);
// } finally {
// response2.close();
// }
}
public static URI getUri() throws URISyntaxException{
URI uri = URIUtils.createURI("https", "apitest.tongdun.cn", -1, "/bodyguard/apply/v4.3",
"partner_code=apgj&partner_key=3a7be6a6d73c48b18f083ddf8d399538&app_name=apgj_web", null);
URI uri = URIUtils.createURI(url1, url2, -1, url3,
"partner_code="+partner_code+"&partner_key="+partner_key+"&app_name="+app_name, null);
return uri;
}
public String postOnLine(String phone) throws URISyntaxException, ClientProtocolException, IOException{
public String postOnLine(String phone,String nextService,String onLineId) throws Exception{
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(getUri());
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("account_mobile", phone));
nvps.add(new BasicNameValuePair("biz_code", biz_code));
httpPost.setEntity(new UrlEncodedFormEntity(nvps));
//重试
if("RETRY".equals(nextService)){
nvps.add(new BasicNameValuePair("invoke_type", nextService));
nvps.add(new BasicNameValuePair("id", onLineId));//进件id
}else{
//首发
nvps.add(new BasicNameValuePair("account_mobile", phone));
}
httpPost.setEntity(new UrlEncodedFormEntity(nvps,ENCODING));
CloseableHttpResponse response2 = httpclient.execute(httpPost);
try {
@ -77,17 +104,63 @@ public class OnlineClient {
System.out.println(statusCode);
if(statusCode==200){
HttpEntity entity2 = response2.getEntity();
String ss = EntityUtils.toString(entity2);
System.out.println(ss);
return ss;
String str = EntityUtils.toString(entity2);
System.out.println(str);
return str;
}else{
return "ÇëÇóÊý¾Ýʧ°Ü¡£";
throw new Exception("请求数据失败");
}
// EntityUtils.consume(entity2);
} finally {
response2.close();
}
}
//单条重发
public String getTelOnLineReTry(JBOTransaction tx){
try {
String jsonStr = postOnLine("","RETRY",onLineId);
Map mapTypes = JSON.parseObject(jsonStr);
boolean success = (boolean)(mapTypes.get("success"));
if(success){
String onLineId = mapTypes.get("id").toString();
String result_desc = mapTypes.get("result_desc").toString();
Map MobileDuration = JSON.parseObject(JSON.parseObject(JSON.parseObject(result_desc).get("AUTHENTICATION_INFOQUERY").toString()).get("MobileDuration").toString());
Object mobile_online_time_info = "";
Object mobile_online_time_consistence = "";
if(MobileDuration.get("error_info")==null){
mobile_online_time_info = MobileDuration.get("mobile_online_time_info");
mobile_online_time_consistence = MobileDuration.get("mobile_online_time_consistence");
}
//失败特有的参数
Object nextService = mapTypes.get("nextService");
Object reason_code = mapTypes.get("reason_code");
Object reason_desc = mapTypes.get("reason_desc");
//更新需要重发的数据
JBOFactory.getBizObjectManager(LB_TELONLINE.CLASS_NAME, tx).createQuery("update O set success='"+success+"',result_desc='"+result_desc+"',"
+ "mobile_online_time_info='"+mobile_online_time_info+"',mobile_online_time_consistence='"+mobile_online_time_consistence+"',"
+ "nextService='"+nextService+"',reason_code='"+reason_code+"',reason_desc='"+reason_desc+"' where online_id=:id")
.setParameter("id", onLineId).executeUpdate();
}else{
Object reason_code = mapTypes.get("reason_code");
Object reason_desc = mapTypes.get("reason_desc");
//更新需要重发的数据
JBOFactory.getBizObjectManager(LB_TELONLINE.CLASS_NAME, tx).createQuery("update O set success='"+success+"'"
+ ",reason_code='"+reason_code+"',reason_desc='"+reason_desc+"' where online_id=:id")
.setParameter("id", onLineId).executeUpdate();
}
tx.commit();
} catch (Exception e) {
e.printStackTrace();
try {
tx.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
return "调用数据失败";
}
return "true";
}
//业务申请流程中获取包括 承租人共同申请人担保人的手机号
public String getTelOnLine(JBOTransaction tx){
String sql = "select certid,FULLNAME as name,MOBILE as phone,'assuror' as custtype,'担保人' as typename from LB_GUARANTEE_UNIT_TEMP where flowunid='"+flowunid+"' and CERTTYPE='Ind01' "
@ -97,15 +170,54 @@ public class OnlineClient {
List<Map<String,String>> ds = DataOperatorUtil.getDataBySql(tx, sql, null);
if(ds.size()>0){
for (int i = 0; i < ds.size(); i++) {
String name = ds.get(i).get("NAME");
String phone = ds.get(i).get("PHONE");
String jsonStr = postOnLine(phone);
String certid = ds.get(i).get("certid");
String name = ds.get(i).get("name");
String phone = ds.get(i).get("phone");
BizObjectManager ltbom = JBOFactory.getBizObjectManager(LB_TELONLINE.CLASS_NAME, tx);
BizObject lton = ltbom.createQuery("PERSON_ID=:PERSON_ID").setParameter(LB_TELONLINE.PERSON_ID, certid).getSingleResult(true);
Map mapTypes =null;
//1.不存在则新增
if(lton==null){
String jsonStr = postOnLine(phone,"","");
mapTypes = JSON.parseObject(jsonStr);
lton = ltbom.newObject();
lton.setAttributeValue(LB_TELONLINE.PROJECT_ID, projectId);
lton.setAttributeValue(LB_TELONLINE.PERSON_ID, certid);
lton.setAttributeValue(LB_TELONLINE.USER_NAME, name);
lton.setAttributeValue(LB_TELONLINE.TELEPHONE, phone);
}else{
//2.存在则重发
String jsonStr = postOnLine(phone,lton.getAttribute(LB_TELONLINE.nextService).getString(),lton.getAttribute(LB_TELONLINE.online_id).getString());
mapTypes = JSON.parseObject(jsonStr);
}
//2.1并根据响应回来的结果更新数据
lton.setAttributeValue(LB_TELONLINE.success, mapTypes.get("success"));
if("true".equals(mapTypes.get("success").toString())){
lton.setAttributeValue(LB_TELONLINE.online_id, mapTypes.get("id"));
lton.setAttributeValue(LB_TELONLINE.result_desc, mapTypes.get("result_desc"));
String result_desc = mapTypes.get("result_desc").toString();
Map MobileDuration = JSON.parseObject(JSON.parseObject(JSON.parseObject(result_desc).get("AUTHENTICATION_INFOQUERY").toString()).get("MobileDuration").toString());
if(MobileDuration.get("error_info")==null){
lton.setAttributeValue(LB_TELONLINE.mobile_online_time_info, MobileDuration.get("mobile_online_time_info"));
lton.setAttributeValue(LB_TELONLINE.mobile_online_time_consistence, MobileDuration.get("mobile_online_time_consistence"));
}
//失败特有的参数
lton.setAttributeValue(LB_TELONLINE.nextService, mapTypes.get("nextService"));
}
lton.setAttributeValue(LB_TELONLINE.reason_code, mapTypes.get("reason_code"));
lton.setAttributeValue(LB_TELONLINE.reason_desc, mapTypes.get("reason_desc"));
ltbom.saveObject(lton);
}
tx.commit();
}
} catch (Exception e) {
try {
tx.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
return e.getMessage();
}
return "true";
}
@ -118,6 +230,18 @@ public class OnlineClient {
public void setFlowunid(String flowunid) {
this.flowunid = flowunid;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getOnLineId() {
return onLineId;
}
public void setOnLineId(String onLineId) {
this.onLineId = onLineId;
}

View File

@ -0,0 +1,40 @@
package com.tenwa.lease.flow.project.validate;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import com.amarsoft.are.ARE;
public class TelOnLineConfigure {
private static Map<String, String> attributes;
public static void load() {
attributes = new ConcurrentHashMap<String, String>();
Properties prop = new Properties();
try {
prop.load(TelOnLineConfigure.class.getResourceAsStream("/telonline.properties"));
for(Entry<Object, Object> entry : prop.entrySet()) {
if(entry.getKey() == null || entry.getValue() == null) {
continue;
}
attributes.put(entry.getKey().toString(), entry.getValue().toString());
}
} catch (IOException e) {
e.printStackTrace();
ARE.getLog().error("init GPSConfigure info failed");
}
ARE.getLog().info("init GPSConfigure info success");
}
public static void destroy() {
if(attributes != null) attributes.clear();
}
public static String get(String propName) {
if(attributes == null) load();
return attributes.get(propName);
}
}