|
@@ -50,6 +50,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
|
|
|
public static final String URL_SEARCH_CONTACT = "https://qyapi.weixin.qq.com/cgi-bin/service/contact/search?provider_access_token=ACCESS_TOKEN";
|
|
|
|
|
|
+ public static final String URL_GET_USER_ID_LIST = "https://qyapi.weixin.qq.com/cgi-bin/user/list_id?access_token=ACCESS_TOKEN";
|
|
|
public static String URL_SEND_WXCORP_MSG = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN";
|
|
|
//获取临时素材url
|
|
|
public static String URL_GET_MEDIA = "https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID";
|
|
@@ -581,42 +582,41 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
return msg;
|
|
|
}
|
|
|
String url = null;
|
|
|
- try {
|
|
|
- startDateTime = startDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
- long startTime = startDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
- endDateTime = endDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
- long endTime = endDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
- System.out.println("startTime=" + startTime + ",endTime=" + endTime);
|
|
|
-
|
|
|
- int batchCount = 1;
|
|
|
- int batchSize = 100;
|
|
|
- int totalLength = 1;
|
|
|
- List<String> corpwxUserIds = new ArrayList<>();
|
|
|
- if (userId == null) {
|
|
|
- //获取企业下的全部员工
|
|
|
- List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).isNotNull("corpwx_userid").eq("is_active", 1));
|
|
|
- System.out.println("获取考勤记录users size==" + users.size()+", companyId="+companyId+", "+corpInfo.getCorpName());
|
|
|
- corpwxUserIds = users.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
- totalLength = corpwxUserIds.size();
|
|
|
- batchCount = totalLength / batchSize + (totalLength % batchSize == 0 ? 0 : 1);
|
|
|
- } else {
|
|
|
- //指定获取员工
|
|
|
- User user = userMapper.selectById(userId);
|
|
|
- corpwxUserIds.add(user.getCorpwxUserid());
|
|
|
- System.out.println("获取corpwxuserid==" + user.getCorpwxUserid() + "的考勤记录");
|
|
|
- }
|
|
|
- //按批调用
|
|
|
- for (int i = 0; i < batchCount; i++) {
|
|
|
- int fromIndex = i * batchSize;
|
|
|
- int toIndex = (i + 1) * batchSize;
|
|
|
- if (toIndex > totalLength) toIndex = totalLength;
|
|
|
- Object[] objects = corpwxUserIds.subList(fromIndex, toIndex).toArray(new String[0]);
|
|
|
+ startDateTime = startDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ long startTime = startDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
+ endDateTime = endDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ long endTime = endDateTime.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
+ System.out.println("startTime=" + startTime + ",endTime=" + endTime);
|
|
|
+
|
|
|
+ int batchCount = 1;
|
|
|
+ int batchSize = 1;
|
|
|
+ int totalLength = 1;
|
|
|
+ List<String> corpwxUserIds = new ArrayList<>();
|
|
|
+ if (userId == null) {
|
|
|
+ //获取企业下的全部员工
|
|
|
+ List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).isNotNull("corpwx_userid").eq("is_active", 1).eq("report_status", 0));
|
|
|
+ System.out.println("获取考勤记录users size==" + users.size()+", companyId="+companyId+", "+corpInfo.getCorpName());
|
|
|
+ corpwxUserIds = users.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
+ totalLength = corpwxUserIds.size();
|
|
|
+ batchCount = totalLength / batchSize + (totalLength % batchSize == 0 ? 0 : 1);
|
|
|
+ } else {
|
|
|
+ //指定获取员工
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ corpwxUserIds.add(user.getCorpwxUserid());
|
|
|
+ System.out.println("获取corpwxuserid==" + user.getCorpwxUserid() + "的考勤记录");
|
|
|
+ }
|
|
|
+ //按批调用
|
|
|
+ for (int i = 0; i < batchCount; i++) {
|
|
|
+ int fromIndex = i * batchSize;
|
|
|
+ int toIndex = (i + 1) * batchSize;
|
|
|
+ if (toIndex > totalLength) toIndex = totalLength;
|
|
|
+ Object[] objects = corpwxUserIds.subList(fromIndex, toIndex).toArray(new String[0]);
|
|
|
+ try {
|
|
|
reqOnceCardTime(corpInfo, startTime, endTime, objects, showLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- } catch (Exception exception) {
|
|
|
- exception.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
@@ -1138,7 +1138,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
String url = GET_CHECKIN_DAYDATA.replace("ACCESS_TOKEN", getCorpAccessToken(corpInfo));
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
- System.out.println("" + objects.toString());
|
|
|
+ //检查openIds是否都是有效的
|
|
|
JSONObject reqParam = new JSONObject();
|
|
|
reqParam.put("starttime", startTime);
|
|
|
reqParam.put("endtime", endTime);
|