bug fix
This commit is contained in:
parent
1ba009cf9e
commit
987c7524f2
2
.gitignore
vendored
2
.gitignore
vendored
@ -19,6 +19,7 @@ buildNumber.properties
|
|||||||
.idea/jarRepositories.xml
|
.idea/jarRepositories.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
.idea/libraries/
|
.idea/libraries/
|
||||||
|
.idea/*
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
@ -42,6 +43,7 @@ buildNumber.properties
|
|||||||
|
|
||||||
# Log file
|
# Log file
|
||||||
*.log
|
*.log
|
||||||
|
*.log.gz
|
||||||
|
|
||||||
# BlueJ files
|
# BlueJ files
|
||||||
*.ctxt
|
*.ctxt
|
||||||
|
@ -80,9 +80,6 @@ public class CheckLogin {
|
|||||||
boolean isSignSuccess = sign(user, singMark);
|
boolean isSignSuccess = sign(user, singMark);
|
||||||
if (isSignSuccess) {
|
if (isSignSuccess) {
|
||||||
log.info("{} 账号打卡成功", user.getUsername());
|
log.info("{} 账号打卡成功", user.getUsername());
|
||||||
} else {
|
|
||||||
log.error("{} 账号打卡失败", user.getUsername());
|
|
||||||
}
|
|
||||||
String sign_time = DateUtil.date().toString();
|
String sign_time = DateUtil.date().toString();
|
||||||
if (isMorning) {
|
if (isMorning) {
|
||||||
user.setIsStartWorkSign(sign_time);
|
user.setIsStartWorkSign(sign_time);
|
||||||
@ -92,6 +89,9 @@ public class CheckLogin {
|
|||||||
}
|
}
|
||||||
user.setIsEndWorkSign(sign_time);
|
user.setIsEndWorkSign(sign_time);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.error("{} 账号打卡失败", user.getUsername());
|
||||||
|
}
|
||||||
if (index + 1 == size) {
|
if (index + 1 == size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -116,9 +116,11 @@ public class CheckLogin {
|
|||||||
public static boolean sign(User user, Integer signMark) {
|
public static boolean sign(User user, Integer signMark) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
try {
|
try {
|
||||||
log.info("开始{}打卡 {} 的账号,密码为:{}", signMark == 0 ? "上班" : "下班", user.getUsername(), user.getPassword());
|
HttpRequest.getCookieManager().getCookieStore().removeAll();
|
||||||
String password = encrypt2ToMD5(user.getPassword());
|
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
|
String password = user.getPassword();
|
||||||
|
log.info("开始{}打卡 {} 的账号,密码为:{}", signMark == 0 ? "上班" : "下班", username, password);
|
||||||
|
password = encrypt2ToMD5(password);
|
||||||
log.info("加密密码为:{}", password);
|
log.info("加密密码为:{}", password);
|
||||||
String body = HttpRequest.post("https://login.oa.unionpay.com/idsapi/portal/Login")
|
String body = HttpRequest.post("https://login.oa.unionpay.com/idsapi/portal/Login")
|
||||||
.form("username", username)
|
.form("username", username)
|
||||||
@ -141,14 +143,24 @@ public class CheckLogin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String thirdToken = thirdBodyJson.getStr("localToken");
|
String thirdToken = thirdBodyJson.getStr("localToken");
|
||||||
String resultBody = HttpRequest.post("http://oms.oa.unionpay.com/prod-api/atds/ds/" + signMark)
|
String ssoToken = thirdBodyJson.getStr("ssoToken");
|
||||||
|
// http://oms.oa.unionpay.com/prod-api/atds/gcp/1
|
||||||
|
// String userInfoRes = HttpRequest.get("http://oms.oa.unionpay.com/prod-api/system/user/getUser")
|
||||||
|
// .header("Authorization", "Bearer " + thirdToken)
|
||||||
|
// .header("ssoToken", ssoToken)
|
||||||
|
// .execute().body();
|
||||||
|
// JSONObject userInfoJson = JSONUtil.parseObj(userInfoRes);
|
||||||
|
// log.info("nikename: {}", userInfoJson.getJSONObject("user").getJSONObject("user").getStr("nickName"));
|
||||||
|
String signUrl = "http://oms.oa.unionpay.com/prod-api/atds/ds/" + signMark;
|
||||||
|
String resultBody = HttpRequest.post(signUrl)
|
||||||
.header("Authorization", "Bearer " + thirdToken)
|
.header("Authorization", "Bearer " + thirdToken)
|
||||||
|
.header("ssoToken", ssoToken)
|
||||||
.execute().body();
|
.execute().body();
|
||||||
JSONObject signJson = JSONUtil.parseObj(resultBody);
|
JSONObject signJson = JSONUtil.parseObj(resultBody);
|
||||||
if ("200".equals(signJson.getStr("code"))) {
|
if ("200".equals(signJson.getStr("code"))) {
|
||||||
String signDateTime = DateUtil.formatDateTime(signJson.getDate("data"));
|
String signDateTime = DateUtil.formatDateTime(signJson.getDate("data"));
|
||||||
result = true;
|
result = true;
|
||||||
log.info("{} 打卡时间 {}", user.getUsername(), signDateTime);
|
log.info("{} 打卡时间 {}", username, signDateTime);
|
||||||
} else {
|
} else {
|
||||||
log.error("签到接口出错 {}", resultBody);
|
log.error("签到接口出错 {}", resultBody);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user