|
@@ -59,7 +59,7 @@ public class BeiSenUtils {
|
|
|
// dockWithMLD.getResult("http://"+port+"/api/cube/restful/interface/getModeDataPageList/getTravelRecord",jsonString);
|
|
|
}
|
|
|
|
|
|
- public static String getToken(){
|
|
|
+ public static String getToken(String appkey,String appSecret){
|
|
|
String result="";
|
|
|
String url = "https://openapi.italent.cn/token";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
@@ -68,8 +68,8 @@ public class BeiSenUtils {
|
|
|
headers.setContentType(type);
|
|
|
JSONObject requestMap = new JSONObject();
|
|
|
requestMap.put("grant_type","client_credentials");
|
|
|
- requestMap.put("app_key","0AE887ADF87148EABF38B64BBE5B6BA6");
|
|
|
- requestMap.put("app_secret","23054CE7CBAF4B1A8BA5FC878077A35A5BF7FF3AAC4D4A828CC7043E8017FF5A");
|
|
|
+ requestMap.put("app_key",appkey);
|
|
|
+ requestMap.put("app_secret",appSecret);
|
|
|
HttpEntity<JSONObject> entity = new HttpEntity<>(requestMap, headers);
|
|
|
ResponseEntity<String> ResponseEntity = restTemplate.postForEntity(url, entity, String.class);
|
|
|
if (ResponseEntity.getStatusCode() == HttpStatus.OK) {
|
|
@@ -80,14 +80,14 @@ public class BeiSenUtils {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static List<JSONArray> getByTimeWindow(String scrollId,String startTime,String stopTime){
|
|
|
+ public static List<JSONArray> getByTimeWindow(String scrollId,String startTime,String stopTime,String appkey,String appSecret){
|
|
|
List<JSONArray> resultList=new ArrayList<>();
|
|
|
String url = "https://openapi.italent.cn/TenantBaseExternal/api/v5/Employee/GetByTimeWindow";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
headers.setContentType(type);
|
|
|
- String accessToken = getToken();
|
|
|
+ String accessToken = getToken(appkey,appSecret);
|
|
|
System.out.println("--------Bearer TOKEN--------"+accessToken);
|
|
|
headers.add("Authorization","Bearer "+accessToken);
|
|
|
JSONObject requestMap = new JSONObject();
|
|
@@ -108,7 +108,7 @@ public class BeiSenUtils {
|
|
|
resultList.add(respJson.getJSONArray("data"));
|
|
|
String nextScrollId = respJson.getString("scrollId");
|
|
|
if(!StringUtils.isEmpty(nextScrollId)&&respJson.getJSONArray("data").size()>0){
|
|
|
- List<JSONArray> byTimeWindow = getByTimeWindow(nextScrollId,startTime,stopTime);
|
|
|
+ List<JSONArray> byTimeWindow = getByTimeWindow(nextScrollId,startTime,stopTime,appkey,appSecret);
|
|
|
resultList.addAll(byTimeWindow);
|
|
|
}
|
|
|
return resultList;
|
|
@@ -117,13 +117,13 @@ public class BeiSenUtils {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
- public static JSONArray getSwipingCards(String createDate){
|
|
|
+ public static JSONArray getSwipingCards(String createDate,String appkey,String appSecret){
|
|
|
String url = "https://openapi.italent.cn/AttendanceOpen/api/v1/SwipingCardData/GetSwipingCards";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
headers.setContentType(type);
|
|
|
- String accessToken = getToken();
|
|
|
+ String accessToken = getToken(appkey,appSecret);
|
|
|
System.out.println("--------Bearer TOKEN--------"+accessToken);
|
|
|
headers.add("Authorization","Bearer "+accessToken);
|
|
|
JSONObject requestMap = new JSONObject();
|
|
@@ -143,6 +143,9 @@ public class BeiSenUtils {
|
|
|
return resultData;
|
|
|
}
|
|
|
}
|
|
|
+ //todo:景昱 计算工作时长 默认工作日 8小时+当天人员加班(审核状态:通过)时长 非工作日考勤数据以加班数据为准
|
|
|
+
|
|
|
+ //todo:如何分页 循环调用接口 当天接口返回数据为空 取消调用
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|