This commit is contained in:
xx572959496 2024-12-05 19:40:38 +08:00
parent f01ecb5e24
commit b29a6cb646
2 changed files with 15 additions and 5 deletions

View File

@ -93,7 +93,6 @@ public class CheckLogin {
log.info("{}分钟后 执行下个人的打卡任务", randomMinute);
ThreadUtil.safeSleep(NumberUtil.mul(randomMinute, 60, 1000));
}));
CsvWriter writer = CsvUtil.getWriter(new File(filePath), StandardCharsets.UTF_8);
writer.writeBeans(userList);
} catch (Exception e) {
@ -118,7 +117,6 @@ public class CheckLogin {
.form("loginType", "normal")
.form("code", "")
.execute().body();
log.info("认证系统返回报文 {}", body);
JSONObject data = JSONUtil.parseObj(body).getJSONObject("data");
if (data != null) {
String token = data.getStr("token");
@ -127,19 +125,24 @@ public class CheckLogin {
.get("http://oms.oa.unionpay.com/prod-api/checkTokenThenLogin?personType=0&token=" + token)
.execute().body();
JSONObject thirdBodyJson = JSONUtil.parseObj(thirdBody);
log.info("签到系统返回报文 {}", thirdBodyJson);
if (!"200".equals(thirdBodyJson.getStr("code"))) {
log.error("签到系统返回报文出错 {}", thirdBodyJson);
return false;
}
String thirdToken = thirdBodyJson.getStr("localToken");
log.info("签到系统返回token {}", thirdToken);
String resultBody = HttpRequest.post("http://oms.oa.unionpay.com/prod-api/atds/ds/" + signMark)
.header("Authorization", "Bearer " + thirdToken)
.execute().body();
log.info("签到接口返回报文 {}", resultBody);
JSONObject signJson = JSONUtil.parseObj(resultBody);
if ("200".equals(signJson.getStr("code"))) {
String signDateTime = DateUtil.formatDateTime(signJson.getDate("data"));
result = true;
log.info("{} 打卡时间 {}", user.getUsername(), signDateTime);
} else {
log.error("签到接口出错 {}", resultBody);
}
} else {
log.error("认证系统返回报文出错 {}", body);
}
} catch (Exception e) {
log.error("sign error", e);

View File

@ -4,6 +4,7 @@ package com.dx.union;
import cn.hutool.core.annotation.Alias;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
public class User {
@Alias("用户名")
@ -50,9 +51,15 @@ public class User {
public boolean isTodaySign(int signMark) {
if (signMark == 0) {
// 校验上班的打卡逻辑
if (StrUtil.isEmpty(this.getIsStartWorkSign())) {
return false;
}
DateTime dateTime = DateUtil.parse(this.getIsStartWorkSign(), "yyyy-MM-dd");
return DateUtil.isSameDay(dateTime, DateUtil.date());
} else if (signMark == 1) {
if (StrUtil.isEmpty(this.getIsEndWorkSign())) {
return false;
}
DateTime dateTime = DateUtil.parse(this.getIsEndWorkSign(), "yyyy-MM-dd");
return DateUtil.isSameDay(dateTime, DateUtil.date());
}