提交 ceb465de authored 作者: inroi's avatar inroi

微调

上级 002d1e19
......@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.text.ParseException;
@Slf4j
@Component
@EnableScheduling
......@@ -27,47 +28,45 @@ public class SynTimed implements Job {
ISynService synService;
@Autowired
CategoryDao categoryDao;
/*金蝶云自动登录定时任务20分钟执行一次*/
@Scheduled(fixedRate = 1000*60*20)
@Scheduled(fixedRate = 1000 * 60 * 15)
public void timed() throws IOException, ParseException {
KingdeeK3CloudApiClient client2 = categoryDao.getClient();
KingdeeK3CloudApiClient client3 = categoryDao.getClient();
Boolean result=categoryDao.getResult();
Boolean result2=categoryDao.getResult();
Boolean result = categoryDao.getResult();
Boolean result2 = categoryDao.getResult();
String dbId = categoryDao.getDbId();
String uid = categoryDao.getUid();
String pwd = categoryDao.getPwd();
int lang = categoryDao.getLang();
String loginResult=new String();
String loginResult = new String();
Object[] loginInfo = new Object[]{dbId, uid, pwd, lang};
try {
loginResult = client2.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo, String.class);
} catch (Exception e) {
log.error(KingDeeConstant.URL);
result=false;
result = false;
categoryDao.setLoginResult(KingDeeConstant.URL);
}
com.alibaba.fastjson.JSONObject jsonObject=new JSONObject();
com.alibaba.fastjson.JSONObject jsonObject = new JSONObject();
try {
jsonObject = JSON.parseObject(loginResult);
} catch (Exception e)
{
jsonObject = JSON.parseObject(loginResult);
} catch (Exception e) {
log.error(KingDeeConstant.PORT);
result=false;
result = false;
categoryDao.setLoginResult(KingDeeConstant.PORT);
}
if(!ObjectUtils.isEmpty(jsonObject)) {
if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.LoginValue);
result = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue);
}
else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) {
} else if (KingDeeConstant.DBID.equals(jsonObject.get("Message"))) {
log.error(KingDeeConstant.DBID);
result = false;
categoryDao.setLoginResult(KingDeeConstant.DBID);
}
else {
} else {
result = true;
log.info("金蝶云登录成功");
}
......@@ -81,40 +80,37 @@ public class SynTimed implements Job {
categoryDao.setClient(client2);
categoryDao.setResult(result);
try {
Thread.sleep(1000*60*15);
Thread.sleep(1000 * 60 * 15);
} catch (InterruptedException e) {
e.printStackTrace();
}
Object[] loginInfo2 = new Object[]{dbId, uid, pwd, lang};
String loginResult2=new String();
String loginResult2 = new String();
try {
loginResult2 = client3.execute("Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser", loginInfo2, String.class);
} catch (Exception e) {
log.error(KingDeeConstant.URL);
result2=false;
result2 = false;
categoryDao.setLoginResult(KingDeeConstant.URL);
}
com.alibaba.fastjson.JSONObject jsonObject2=new JSONObject();
com.alibaba.fastjson.JSONObject jsonObject2 = new JSONObject();
try {
jsonObject2 = JSON.parseObject(loginResult2);
} catch (Exception e)
{
} catch (Exception e) {
log.error(KingDeeConstant.PORT);
result2=false;
result2 = false;
categoryDao.setLoginResult(KingDeeConstant.PORT);
}
if(!ObjectUtils.isEmpty(jsonObject)) {
if (!ObjectUtils.isEmpty(jsonObject)) {
if (KingDeeConstant.LoginValue.equals(jsonObject2.get("Message"))) {
log.error(KingDeeConstant.LoginValue);
result2 = false;
categoryDao.setLoginResult(KingDeeConstant.LoginValue);
}
else if (KingDeeConstant.DBID.equals(jsonObject2.get("Message"))) {
} else if (KingDeeConstant.DBID.equals(jsonObject2.get("Message"))) {
log.error(KingDeeConstant.DBID);
result2 = false;
categoryDao.setLoginResult(KingDeeConstant.DBID);
}
else {
} else {
result2 = true;
log.info("金蝶云登录成功");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论