|
@@ -39,29 +39,21 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
|
|
public void getCheckinData() {
|
|
public void getCheckinData() {
|
|
try {
|
|
try {
|
|
Map<String, Object> qywxAccessToken = tokenService.getOAAccessToken();
|
|
Map<String, Object> qywxAccessToken = tokenService.getOAAccessToken();
|
|
- System.err.println(qywxAccessToken);
|
|
|
|
if ((Integer) qywxAccessToken.get("code") != 0) {
|
|
if ((Integer) qywxAccessToken.get("code") != 0) {
|
|
log.error("企业微信获取token失败,返回信息:{}", qywxAccessToken.get("message"));
|
|
log.error("企业微信获取token失败,返回信息:{}", qywxAccessToken.get("message"));
|
|
throw new Exception("企业微信获取token失败");
|
|
throw new Exception("企业微信获取token失败");
|
|
}
|
|
}
|
|
-
|
|
|
|
List<WechatUserList> list = userListService.list();
|
|
List<WechatUserList> list = userListService.list();
|
|
if (Check.isNull(list)) {
|
|
if (Check.isNull(list)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- // params.put("access_token", (String) qywxAccessToken.get("accessToken"));
|
|
|
|
for (WechatUserList userList : list) {
|
|
for (WechatUserList userList : list) {
|
|
- // params.remove("useridlist");
|
|
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
-
|
|
|
|
String userId = userList.getUserId();
|
|
String userId = userList.getUserId();
|
|
String departId = userList.getDepartId();
|
|
String departId = userList.getDepartId();
|
|
params.put("opencheckindatatype", 3);
|
|
params.put("opencheckindatatype", 3);
|
|
-
|
|
|
|
JSONArray userArr = new JSONArray();
|
|
JSONArray userArr = new JSONArray();
|
|
-
|
|
|
|
userArr.add(userId);
|
|
userArr.add(userId);
|
|
params.put("useridlist", userArr);
|
|
params.put("useridlist", userArr);
|
|
params.put("starttime", 1598889600);
|
|
params.put("starttime", 1598889600);
|
|
@@ -79,8 +71,6 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
|
|
checkinData.setDepartId(departId);
|
|
checkinData.setDepartId(departId);
|
|
checkinData.setUserId(userId);
|
|
checkinData.setUserId(userId);
|
|
checkinData.setCheckinType(jsonObject.getString("checkin_type"));
|
|
checkinData.setCheckinType(jsonObject.getString("checkin_type"));
|
|
-
|
|
|
|
-
|
|
|
|
Long checkinTimeStamp = jsonObject.getLong("checkin_time"); //下班打卡时间
|
|
Long checkinTimeStamp = jsonObject.getLong("checkin_time"); //下班打卡时间
|
|
java.util.Date checkDate = DateUtils.stampToTime(checkinTimeStamp);
|
|
java.util.Date checkDate = DateUtils.stampToTime(checkinTimeStamp);
|
|
checkinData.setCheckinTime(checkDate);
|
|
checkinData.setCheckinTime(checkDate);
|
|
@@ -105,16 +95,12 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
|
|
checkinData.setMediaids(jsonObject.getJSONArray("mediaids").toJSONString());
|
|
checkinData.setMediaids(jsonObject.getJSONArray("mediaids").toJSONString());
|
|
checkinData.setLat(jsonObject.getString("lat"));
|
|
checkinData.setLat(jsonObject.getString("lat"));
|
|
this.save(checkinData);
|
|
this.save(checkinData);
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
- // throw new Exception("企业微信获取部门列表");
|
|
|
|
-
|
|
|
|
|
|
+ log.error("获取打卡数据异常");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|