提交 fb2fcd17 authored 作者: 李炎's avatar 李炎

微调

上级 5895a13d
...@@ -40,43 +40,45 @@ public class SynTimed implements Job { ...@@ -40,43 +40,45 @@ public class SynTimed implements Job {
String uid = categoryDao.getUid(); String uid = categoryDao.getUid();
String pwd = categoryDao.getPwd(); String pwd = categoryDao.getPwd();
int lang = categoryDao.getLang(); int lang = categoryDao.getLang();
String loginResult = new String(); // String loginResult = new String();
Object[] loginInfo = new Object[]{dbId, uid, pwd, lang}; // Object[] loginInfo = new Object[]{dbId, uid, pwd, lang};
try { // try {
loginResult = client2.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class); // loginResult = client2.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.URL); // log.error(KingDeeConstant.URL);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.URL); // categoryDao.setLoginResult(KingDeeConstant.URL);
} // }
com.alibaba.fastjson.JSONObject jsonObject = new JSONObject(); // com.alibaba.fastjson.JSONObject jsonObject = new JSONObject();
try { // try {
jsonObject = JSON.parseObject(loginResult); // jsonObject = JSON.parseObject(loginResult);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.PORT); // log.error(KingDeeConstant.PORT);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.PORT); // categoryDao.setLoginResult(KingDeeConstant.PORT);
} // }
if (!ObjectUtils.isEmpty(jsonObject)) { // if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) { // if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.LoginValue); // log.error(KingDeeConstant.LoginValue);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue); // categoryDao.setLoginResult(KingDeeConstant.LoginValue);
} else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) { // } else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.DBID); // log.error(KingDeeConstant.DBID);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.DBID); // categoryDao.setLoginResult(KingDeeConstant.DBID);
} else { // } else {
result = true; // result = true;
log.info("金蝶云登录成功"); // log.info("金蝶云登录成功");
} // }
//
} // }
try { try {
result = client2.login(dbId, uid, pwd, lang); result = client2.login(dbId, uid, pwd, lang);
} catch (Exception e) { } catch (Exception e) {
categoryDao.setLoginResult(KingDeeConstant.URL + "" + client2.checkAuthInfo());
e.printStackTrace(); e.printStackTrace();
} }
log.info("<==========任务设置result: " + result);
categoryDao.setClient(client2); categoryDao.setClient(client2);
categoryDao.setResult(result); categoryDao.setResult(result);
try { try {
...@@ -84,44 +86,45 @@ public class SynTimed implements Job { ...@@ -84,44 +86,45 @@ public class SynTimed implements Job {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
Object[] loginInfo2 = new Object[]{dbId, uid, pwd, lang}; // Object[] loginInfo2 = new Object[]{dbId, uid, pwd, lang};
String loginResult2 = new String(); // String loginResult2 = new String();
try { // try {
loginResult2 = client3.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo2, String.class); // loginResult2 = client3.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo2, String.class);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.URL); // log.error(KingDeeConstant.URL);
result2 = false; // result2 = false;
categoryDao.setLoginResult(KingDeeConstant.URL); // categoryDao.setLoginResult(KingDeeConstant.URL);
} // }
com.alibaba.fastjson.JSONObject jsonObject2 = new JSONObject(); // com.alibaba.fastjson.JSONObject jsonObject2 = new JSONObject();
try { // try {
jsonObject2 = JSON.parseObject(loginResult2); // jsonObject2 = JSON.parseObject(loginResult2);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.PORT); // log.error(KingDeeConstant.PORT);
result2 = false; // result2 = false;
categoryDao.setLoginResult(KingDeeConstant.PORT); // categoryDao.setLoginResult(KingDeeConstant.PORT);
} // }
if (!ObjectUtils.isEmpty(jsonObject)) { // if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject2.get("Message"))) { // if (KingDeeConstant.LoginValue.equals(jsonObject2.get("Message"))) {
log.error(KingDeeConstant.LoginValue); // log.error(KingDeeConstant.LoginValue);
result2 = false; // result2 = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue); // categoryDao.setLoginResult(KingDeeConstant.LoginValue);
} else if (KingDeeConstant.DBID.equals(jsonObject2.get("Message"))) { // } else if (KingDeeConstant.DBID.equals(jsonObject2.get("Message"))) {
log.error(KingDeeConstant.DBID); // log.error(KingDeeConstant.DBID);
result2 = false; // result2 = false;
categoryDao.setLoginResult(KingDeeConstant.DBID); // categoryDao.setLoginResult(KingDeeConstant.DBID);
} else { // } else {
result2 = true; // result2 = true;
log.info("金蝶云登录成功"); // log.info("金蝶云登录成功");
} // }
} // }
try { try {
result2 = client3.login(dbId, uid, pwd, lang); result2 = client3.login(dbId, uid, pwd, lang);
} catch (Exception e) { } catch (Exception e) {
categoryDao.setLoginResult(KingDeeConstant.URL + "" + client2.checkAuthInfo());
e.printStackTrace(); e.printStackTrace();
} }
log.info("<==========任务设置result2: " + result2);
categoryDao.setClient(client3); categoryDao.setClient(client3);
categoryDao.setResult(result2); categoryDao.setResult(result2);
} }
......
...@@ -33,7 +33,7 @@ public class KingdeeApiClient { ...@@ -33,7 +33,7 @@ public class KingdeeApiClient {
return api.execute(servicename, parameters, returnType); return api.execute(servicename, parameters, returnType);
} }
private String checkAuthInfo() { public String checkAuthInfo() {
try { try {
return api.CheckAuthInfo().getResult().toString(); return api.CheckAuthInfo().getResult().toString();
} catch (Exception e) { } catch (Exception e) {
...@@ -70,9 +70,9 @@ public class KingdeeApiClient { ...@@ -70,9 +70,9 @@ public class KingdeeApiClient {
iden.setlCID(2052); iden.setlCID(2052);
iden.setServerUrl(_serverUrl); iden.setServerUrl(_serverUrl);
api = new K3CloudApi(iden); api = new K3CloudApi(iden);
// String data = "{\"CreateOrgId\": 0,\"Number\": \"111\",\"Id\": \"\",\"IsSortBySeq\": \"false\"}"; String data = "{\"CreateOrgId\": 0,\"Number\": \"111\",\"Id\": \"\",\"IsSortBySeq\": \"false\"}";
// String result = api.view("BD_Material", data); String result = api.view("BD_Material", data);
// System.out.println("<=====test:" + result); System.out.println("<=====test:" + result);
RepoResult repoResult = api.CheckAuthInfo(); RepoResult repoResult = api.CheckAuthInfo();
RepoStatus responseStatus = repoResult.getResponseStatus(); RepoStatus responseStatus = repoResult.getResponseStatus();
boolean isSuccess = responseStatus.isIsSuccess(); boolean isSuccess = responseStatus.isIsSuccess();
......
...@@ -563,44 +563,45 @@ public class WebApi { ...@@ -563,44 +563,45 @@ public class WebApi {
String uid = categoryDao.getUid(); String uid = categoryDao.getUid();
String pwd = categoryDao.getPwd(); String pwd = categoryDao.getPwd();
int lang = categoryDao.getLang(); int lang = categoryDao.getLang();
String loginResult = new String(); // String loginResult = new String();
Object[] loginInfo = new Object[]{dbId, uid, pwd, lang}; // Object[] loginInfo = new Object[]{dbId, uid, pwd, lang};
try { // try {
loginResult = client.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class); // loginResult = client.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class);
} catch (Exception e) { // } catch (Exception e) {
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.URL); // categoryDao.setLoginResult(KingDeeConstant.URL);
throw new KingdeeConnectException(KingDeeConstant.URL); // throw new KingdeeConnectException(KingDeeConstant.URL);
} // }
com.alibaba.fastjson.JSONObject jsonObject = new JSONObject(); // com.alibaba.fastjson.JSONObject jsonObject = new JSONObject();
try { // try {
jsonObject = JSON.parseObject(loginResult); // jsonObject = JSON.parseObject(loginResult);
} catch (Exception e) { // } catch (Exception e) {
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.PORT); // categoryDao.setLoginResult(KingDeeConstant.PORT);
throw new KingdeeConnectException(KingDeeConstant.PORT); // throw new KingdeeConnectException(KingDeeConstant.PORT);
} // }
if (!ObjectUtils.isEmpty(jsonObject)) { // if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) { // if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) {
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue); // categoryDao.setLoginResult(KingDeeConstant.LoginValue);
throw new KingdeeConnectException(KingDeeConstant.LoginValue); // throw new KingdeeConnectException(KingDeeConstant.LoginValue);
} else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) { // } else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) {
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.DBID); // categoryDao.setLoginResult(KingDeeConstant.DBID);
//throw new KingdeeConnectException(KingDeeConstant.DBID); // //throw new KingdeeConnectException(KingDeeConstant.DBID);
} else { // } else {
result = true; // result = true;
} // }
//
} // }
try { try {
result = client.login(dbId, uid, pwd, lang); result = client.login(dbId, uid, pwd, lang);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
categoryDao.setClient(client); categoryDao.setClient(client);
log.info("<==========登录公用方法result: " + result);
categoryDao.setResult(result); categoryDao.setResult(result);
} }
...@@ -612,43 +613,44 @@ public class WebApi { ...@@ -612,43 +613,44 @@ public class WebApi {
String uid = categoryDao.getUid(); String uid = categoryDao.getUid();
String pwd = categoryDao.getPwd(); String pwd = categoryDao.getPwd();
int lang = categoryDao.getLang(); int lang = categoryDao.getLang();
String loginResult = new String(); // String loginResult = new String();
Object[] loginInfo = new Object[]{dbId, uid, pwd, lang}; // Object[] loginInfo = new Object[]{dbId, uid, pwd, lang};
try { // try {
loginResult = client.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class); // loginResult = client.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.URL); // log.error(KingDeeConstant.URL);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.URL); // categoryDao.setLoginResult(KingDeeConstant.URL);
} // }
//
com.alibaba.fastjson.JSONObject jsonObject = new JSONObject(); // com.alibaba.fastjson.JSONObject jsonObject = new JSONObject();
try { // try {
jsonObject = JSON.parseObject(loginResult); // jsonObject = JSON.parseObject(loginResult);
} catch (Exception e) { // } catch (Exception e) {
log.error(KingDeeConstant.PORT); // log.error(KingDeeConstant.PORT);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.PORT); // categoryDao.setLoginResult(KingDeeConstant.PORT);
} // }
if (!ObjectUtils.isEmpty(jsonObject)) { // if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) { // if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.LoginValue); // log.error(KingDeeConstant.LoginValue);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue); // categoryDao.setLoginResult(KingDeeConstant.LoginValue);
} else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) { // } else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.DBID); // log.error(KingDeeConstant.DBID);
result = false; // result = false;
categoryDao.setLoginResult(KingDeeConstant.DBID); // categoryDao.setLoginResult(KingDeeConstant.DBID);
} else { // } else {
result = true; // result = true;
} // }
//
} // }
try { try {
result = client.login(dbId, uid, pwd, lang); result = client.login(dbId, uid, pwd, lang);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
log.info("<==========检验登录参数result: " + result);
categoryDao.setClient(client); categoryDao.setClient(client);
categoryDao.setResult(result); categoryDao.setResult(result);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论