package nc.bs.gl.ds;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.bs.pub.pa.PreAlertObject;
import nc.bs.pub.taskcenter.BgWorkingContext;
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.ArrayListProcessor;
import nc.vo.pub.BusinessException;
public class PersonInfo implements IBackgroundWorkPlugin {
private BaseDAO dao;
private BaseDAO getDao() {
if (dao == null) {
dao = new BaseDAO();
}
return dao;
}
public PreAlertObject executeTask(BgWorkingContext bgwc)
throws BusinessException {
System.out.println("");
String isSuccess="0";
try {
String sqlQueryUrl = "select * from GL_URLCOM where code='Person'";
String apiUrl = "";
IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
List<Object> listUU = (List<Object>) bs.executeQuery(
sqlQueryUrl.toString(), new ArrayListProcessor());
if (listUU != null && listUU.size() > 0) {
Object[] objs1 = (Object[]) listUU.get(0);
apiUrl = (String) objs1[2];
}
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("Content-Type","application/json; charset=utf-8;");
connection.connect();
SimpleDateFormat formatter = new SimpleDateFormat(
"yyyyMMddHHmmssSSS");
// 得到系统当前时间,转换对应的格式并返回
String time = formatter.format(new Date());
//接收数据并且相应信息返回
PrintWriter outprint = new PrintWriter(
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.bs.pub.pa.PreAlertObject;
import nc.bs.pub.taskcenter.BgWorkingContext;
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.ArrayListProcessor;
import nc.vo.pub.BusinessException;
public class PersonInfo implements IBackgroundWorkPlugin {
private BaseDAO dao;
private BaseDAO getDao() {
if (dao == null) {
dao = new BaseDAO();
}
return dao;
}
public PreAlertObject executeTask(BgWorkingContext bgwc)
throws BusinessException {
System.out.println("");
String isSuccess="0";
try {
String sqlQueryUrl = "select * from GL_URLCOM where code='Person'";
String apiUrl = "";
IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
List<Object> listUU = (List<Object>) bs.executeQuery(
sqlQueryUrl.toString(), new ArrayListProcessor());
if (listUU != null && listUU.size() > 0) {
Object[] objs1 = (Object[]) listUU.get(0);
apiUrl = (String) objs1[2];
}
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("Content-Type","application/json; charset=utf-8;");
connection.connect();
SimpleDateFormat formatter = new SimpleDateFormat(
"yyyyMMddHHmmssSSS");
// 得到系统当前时间,转换对应的格式并返回
String time = formatter.format(new Date());
//接收数据并且相应信息返回
PrintWriter outprint = new PrintWriter(