|
|
|
|
package com.kingdee.eas.custom.risheng;
|
|
|
|
|
|
|
|
|
|
import java.io.OutputStreamWriter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.axis.client.Call;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
public class FWOASyncHrData implements SyncHRDataInterface {
|
|
|
|
|
|
|
|
|
|
private static Logger logger =
|
|
|
|
|
Logger.getLogger("com.kingdee.eas.custom.risheng.FWOASyncHrData");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* OAͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String syncAdminOrg(String data,String surl) {
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>֯ͬ<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>֯ͬ<EFBFBD><EFBFBD>");
|
|
|
|
|
OutputStreamWriter out = null;
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
JSONArray res = JSONArray.parseArray(data);
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:"+res.toString());
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪXML<EFBFBD><EFBFBD>ʽ
|
|
|
|
|
StringBuffer xmlBuffer = new StringBuffer();
|
|
|
|
|
xmlBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
|
|
xmlBuffer.append("<root>");
|
|
|
|
|
xmlBuffer.append(" <orglist>");
|
|
|
|
|
for (int i = 0; i < res.size(); i++) {
|
|
|
|
|
JSONObject obj = res.getJSONObject(i);
|
|
|
|
|
logger.error("action="+obj.getString("action"));
|
|
|
|
|
xmlBuffer.append(" <org action=\""+obj.getString("action")+"\">");
|
|
|
|
|
xmlBuffer.append(" <code>"+obj.getString("code")+"</code>");
|
|
|
|
|
xmlBuffer.append(" <shortname>"+obj.getString("shortname")+"</shortname>");
|
|
|
|
|
xmlBuffer.append(" <fullname>"+obj.getString("fullname")+"</fullname>");
|
|
|
|
|
xmlBuffer.append(" <org_code>"+obj.getString("org_code")+"</org_code>");
|
|
|
|
|
xmlBuffer.append(" <parent_code>"+obj.getString("parent_code")+"</parent_code>");
|
|
|
|
|
xmlBuffer.append(" <canceled>"+obj.getString("canceled")+"</canceled>");
|
|
|
|
|
xmlBuffer.append(" <order>0</order>");
|
|
|
|
|
xmlBuffer.append(" </org>");
|
|
|
|
|
}
|
|
|
|
|
xmlBuffer.append(" </orglist>");
|
|
|
|
|
xmlBuffer.append("</root>");
|
|
|
|
|
//XML<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
String xmlStr = xmlBuffer.toString();
|
|
|
|
|
String ipStr = "121.37.207.73";
|
|
|
|
|
// http://120.46.132.160:8080
|
|
|
|
|
String urlStr = surl;
|
|
|
|
|
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
|
|
Call call = (Call) service.createCall();
|
|
|
|
|
call.setOperationName("SynDepartment");
|
|
|
|
|
call.setTargetEndpointAddress(urlStr);
|
|
|
|
|
String[] param1 = new String[2];
|
|
|
|
|
param1[0] = ipStr;
|
|
|
|
|
param1[1] = xmlStr;
|
|
|
|
|
// logger.error("<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
result = (String)call.invoke(param1);
|
|
|
|
|
// logger.error("<EFBFBD>ӿڷ<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>"+result.toString());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}finally {
|
|
|
|
|
try {
|
|
|
|
|
if (out != null) {
|
|
|
|
|
out.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>Աͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String syncPerson(String data,String surl) {
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>֯ͬ<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|
|
|
|
// logger.error("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>Աͬ<EFBFBD><EFBFBD>");
|
|
|
|
|
OutputStreamWriter out = null;
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
JSONArray res = JSONArray.parseArray(data);
|
|
|
|
|
// logger.error("<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:"+res.toString());
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪXML<EFBFBD><EFBFBD>ʽ
|
|
|
|
|
StringBuffer xmlBuffer = new StringBuffer();
|
|
|
|
|
xmlBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
|
|
xmlBuffer.append("<root>");
|
|
|
|
|
xmlBuffer.append(" <hrmlist>");
|
|
|
|
|
for (int i = 0; i < res.size(); i++) {
|
|
|
|
|
JSONObject obj = res.getJSONObject(i);
|
|
|
|
|
logger.error("action="+obj.getString("action"));
|
|
|
|
|
xmlBuffer.append(" <hrm action=\""+obj.getString("action")+"\">");
|
|
|
|
|
xmlBuffer.append(" <workcode>"+obj.getString("workcode")+"</workcode>");
|
|
|
|
|
xmlBuffer.append(" <subcompany>"+obj.getString("subcompany")+"</subcompany>");
|
|
|
|
|
xmlBuffer.append(" <department>"+obj.getString("department")+"</department>");
|
|
|
|
|
xmlBuffer.append(" <lastname>"+obj.getString("lastname")+"</lastname>");
|
|
|
|
|
xmlBuffer.append(" <loginid>"+obj.getString("loginid")+"</loginid>");
|
|
|
|
|
if(obj.getString("password")=="null"||obj.getString("password")==null||obj.getString("password")==""){
|
|
|
|
|
//xmlBuffer.append(" <password>"+obj.getString("password")+"</password>");
|
|
|
|
|
}else{
|
|
|
|
|
xmlBuffer.append(" <password>"+obj.getString("password")+"</password>");
|
|
|
|
|
}
|
|
|
|
|
xmlBuffer.append(" <seclevel>"+obj.getString("seclevel")+"</seclevel>");
|
|
|
|
|
xmlBuffer.append(" <sex>"+obj.getString("sex")+"</sex>");
|
|
|
|
|
xmlBuffer.append(" <jobtitle>"+obj.getString("jobtitle")+"</jobtitle>");
|
|
|
|
|
xmlBuffer.append(" <jobactivityid>"+obj.getString("jobactivityid")+"</jobactivityid>");
|
|
|
|
|
xmlBuffer.append(" <jobgroupid>"+obj.getString("jobgroupid")+"</jobgroupid>");
|
|
|
|
|
xmlBuffer.append(" <jobcall>"+obj.getString("jobcall")+"</jobcall>");
|
|
|
|
|
xmlBuffer.append(" <joblevel>"+obj.getString("joblevel")+"</joblevel>");
|
|
|
|
|
xmlBuffer.append(" <jobactivitydesc>"+obj.getString("jobactivitydesc")+"</jobactivitydesc>");
|
|
|
|
|
xmlBuffer.append(" <managerid>"+obj.getString("managerid")+"</managerid>");
|
|
|
|
|
xmlBuffer.append(" <assistantid>"+obj.getString("assistantid")+"</assistantid>");
|
|
|
|
|
xmlBuffer.append(" <status>"+obj.getString("status")+"</status>");
|
|
|
|
|
xmlBuffer.append(" <locationid>"+obj.getString("locationid")+"</locationid>");
|
|
|
|
|
xmlBuffer.append(" <workroom>"+obj.getString("workroom")+"</workroom>");
|
|
|
|
|
xmlBuffer.append(" <telephone>"+obj.getString("telephone")+"</telephone>");
|
|
|
|
|
xmlBuffer.append(" <mobile>"+obj.getString("mobile")+"</mobile>");
|
|
|
|
|
xmlBuffer.append(" <mobilecall>"+obj.getString("mobilecall")+"</mobilecall>");
|
|
|
|
|
xmlBuffer.append(" <fax>"+obj.getString("fax")+"</fax>");
|
|
|
|
|
xmlBuffer.append(" <email>"+obj.getString("email")+"</email>");
|
|
|
|
|
xmlBuffer.append(" <systemlanguage>"+obj.getString("systemlanguage")+"</systemlanguage>");
|
|
|
|
|
xmlBuffer.append(" <birthday>"+obj.getString("birthday")+"</birthday>");
|
|
|
|
|
xmlBuffer.append(" <folk>"+obj.getString("folk")+"</folk>");
|
|
|
|
|
xmlBuffer.append(" <nativeplace>"+obj.getString("nativeplace")+"</nativeplace>");
|
|
|
|
|
xmlBuffer.append(" <regresidentplace>"+obj.getString("regresidentplace")+"</regresidentplace>");
|
|
|
|
|
xmlBuffer.append(" <certificatenum>"+obj.getString("certificatenum")+"</certificatenum>");
|
|
|
|
|
xmlBuffer.append(" <maritalstatus>"+obj.getString("maritalstatus")+"</maritalstatus>");
|
|
|
|
|
xmlBuffer.append(" <policy>"+obj.getString("policy")+"</policy>");
|
|
|
|
|
xmlBuffer.append(" <bememberdate>"+obj.getString("bememberdate")+"</bememberdate>");
|
|
|
|
|
xmlBuffer.append(" <bepartydate>"+obj.getString("bepartydate")+"</bepartydate>");
|
|
|
|
|
xmlBuffer.append(" <islabouunion>"+obj.getString("islabouunion")+"</islabouunion>");
|
|
|
|
|
xmlBuffer.append(" <educationlevel>"+obj.getString("educationlevel")+"</educationlevel>");
|
|
|
|
|
xmlBuffer.append(" <degree>"+obj.getString("degree")+"</degree>");
|
|
|
|
|
xmlBuffer.append(" <healthinfo>"+obj.getString("healthinfo")+"</healthinfo>");
|
|
|
|
|
xmlBuffer.append(" <height>"+obj.getString("height")+"</height>");
|
|
|
|
|
xmlBuffer.append(" <weight>"+obj.getString("weight")+"</weight>");
|
|
|
|
|
xmlBuffer.append(" <residentplace>"+obj.getString("residentplace")+"</residentplace>");
|
|
|
|
|
xmlBuffer.append(" <homeaddress>"+obj.getString("homeaddress")+"</homeaddress>");
|
|
|
|
|
xmlBuffer.append(" <tempresidentnumber>"+obj.getString("tempresidentnumber")+"</tempresidentnumber>");
|
|
|
|
|
xmlBuffer.append(" </hrm>");
|
|
|
|
|
}
|
|
|
|
|
xmlBuffer.append(" </hrmlist>");
|
|
|
|
|
xmlBuffer.append("</root>");
|
|
|
|
|
//XML<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
String xmlStr = xmlBuffer.toString();
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD>Աxml<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ"+xmlStr);
|
|
|
|
|
String ipStr = "121.37.207.73";
|
|
|
|
|
String urlStr = surl;
|
|
|
|
|
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
|
|
Call call = (Call) service.createCall();
|
|
|
|
|
call.setOperationName("SynHrmResource");
|
|
|
|
|
call.setTargetEndpointAddress(urlStr);
|
|
|
|
|
String[] param1 = new String[2];
|
|
|
|
|
param1[0] = ipStr;
|
|
|
|
|
param1[1] = xmlStr;
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
result = (String)call.invoke(param1);
|
|
|
|
|
logger.error("<EFBFBD>ӿڷ<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>"+result.toString());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}finally {
|
|
|
|
|
try {
|
|
|
|
|
if (out != null) {
|
|
|
|
|
out.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result.toString();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>λͬ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String syncPosition(String data,String surl) {
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>֯ͬ<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OA<EFBFBD><EFBFBD>λͬ<EFBFBD><EFBFBD>");
|
|
|
|
|
OutputStreamWriter out = null;
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
JSONArray res = JSONArray.parseArray(data);
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:"+res.toString());
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪXML<EFBFBD><EFBFBD>ʽ
|
|
|
|
|
StringBuffer xmlBuffer = new StringBuffer();
|
|
|
|
|
xmlBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
|
|
xmlBuffer.append("<root>");
|
|
|
|
|
xmlBuffer.append(" <jobtitlelist>");
|
|
|
|
|
for (int i = 0; i < res.size(); i++) {
|
|
|
|
|
JSONObject obj = res.getJSONObject(i);
|
|
|
|
|
logger.error("action="+obj.getString("action"));
|
|
|
|
|
xmlBuffer.append(" <jobtitle action=\""+obj.getString("action")+"\">");
|
|
|
|
|
xmlBuffer.append(" <jobtitlecode>"+obj.getString("jobtitlecode")+"</jobtitlecode>");
|
|
|
|
|
xmlBuffer.append(" <jobtitlename>"+obj.getString("jobtitlename")+"</jobtitlename>");
|
|
|
|
|
xmlBuffer.append(" <jobtitleremark>"+obj.getString("jobtitleremark")+"</jobtitleremark>");
|
|
|
|
|
xmlBuffer.append(" <jobtitledept>"+obj.getString("jobtitledept")+"</jobtitledept>");
|
|
|
|
|
// jobgroupid <EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
xmlBuffer.append(" <jobgroupid>"+obj.getString("jobgroupid")+"</jobgroupid>");
|
|
|
|
|
xmlBuffer.append(" </jobtitle>");
|
|
|
|
|
}
|
|
|
|
|
xmlBuffer.append(" </jobtitlelist>");
|
|
|
|
|
xmlBuffer.append("</root>");
|
|
|
|
|
//XML<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
String xmlStr = xmlBuffer.toString();
|
|
|
|
|
String ipStr = "121.37.207.73";
|
|
|
|
|
// http://120.46.132.160:8080
|
|
|
|
|
String urlStr = surl;
|
|
|
|
|
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
|
|
Call call = (Call) service.createCall();
|
|
|
|
|
call.setOperationName("SynJobtitle");
|
|
|
|
|
call.setTargetEndpointAddress(urlStr);
|
|
|
|
|
String[] param1 = new String[2];
|
|
|
|
|
param1[0] = ipStr;
|
|
|
|
|
param1[1] = xmlStr;
|
|
|
|
|
logger.error("<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
result = (String)call.invoke(param1);
|
|
|
|
|
logger.error("<EFBFBD>ӿڷ<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>"+result.toString());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}finally {
|
|
|
|
|
try {
|
|
|
|
|
if (out != null) {
|
|
|
|
|
out.close();
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|