@Test public void testGetCheckinData() throws ParseException, WxErrorException { Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-04-11"); Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-05-10"); List<WxCpCheckinData> results = wxService.getOAService() .getCheckinData(1, startTime, endTime, Lists.newArrayList("binary")); assertThat(results).isNotNull(); }
@Override public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList) throws WxErrorException { if (starttime == null || endtime == null) { throw new RuntimeException("starttime and endtime can't be null"); } if (userIdList == null || userIdList.size() > 100) { throw new RuntimeException("用户列表不能为空，不超过100个，若用户超过100个，请分批获取"); } long endtimestamp = endtime.getTime() / 1000L; long starttimestamp = starttime.getTime() / 1000L; if (endtimestamp - starttimestamp < 0 || endtimestamp - starttimestamp >= 30 * 24 * 60 * 60) { throw new RuntimeException("获取记录时间跨度不超过一个月"); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); jsonObject.addProperty("opencheckindatatype", openCheckinDataType); jsonObject.addProperty("starttime", starttimestamp); jsonObject.addProperty("endtime", endtimestamp); for (String userid : userIdList) { jsonArray.add(userid); } jsonObject.add("useridlist", jsonArray); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.create() .fromJson( tmpJsonElement.getAsJsonObject().get("checkindata"), new TypeToken<List<WxCpCheckinData>>() { }.getType() ); }
WxCpOAServiceImpl implements WxCpOAService { @Override public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList) throws WxErrorException { if (starttime == null || endtime == null) { throw new RuntimeException("starttime and endtime can't be null"); } if (userIdList == null || userIdList.size() > 100) { throw new RuntimeException("用户列表不能为空，不超过100个，若用户超过100个，请分批获取"); } long endtimestamp = endtime.getTime() / 1000L; long starttimestamp = starttime.getTime() / 1000L; if (endtimestamp - starttimestamp < 0 || endtimestamp - starttimestamp >= 30 * 24 * 60 * 60) { throw new RuntimeException("获取记录时间跨度不超过一个月"); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); jsonObject.addProperty("opencheckindatatype", openCheckinDataType); jsonObject.addProperty("starttime", starttimestamp); jsonObject.addProperty("endtime", endtimestamp); for (String userid : userIdList) { jsonArray.add(userid); } jsonObject.add("useridlist", jsonArray); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.create() .fromJson( tmpJsonElement.getAsJsonObject().get("checkindata"), new TypeToken<List<WxCpCheckinData>>() { }.getType() ); } }
WxCpOAServiceImpl implements WxCpOAService { @Override public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList) throws WxErrorException { if (starttime == null || endtime == null) { throw new RuntimeException("starttime and endtime can't be null"); } if (userIdList == null || userIdList.size() > 100) { throw new RuntimeException("用户列表不能为空，不超过100个，若用户超过100个，请分批获取"); } long endtimestamp = endtime.getTime() / 1000L; long starttimestamp = starttime.getTime() / 1000L; if (endtimestamp - starttimestamp < 0 || endtimestamp - starttimestamp >= 30 * 24 * 60 * 60) { throw new RuntimeException("获取记录时间跨度不超过一个月"); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); jsonObject.addProperty("opencheckindatatype", openCheckinDataType); jsonObject.addProperty("starttime", starttimestamp); jsonObject.addProperty("endtime", endtimestamp); for (String userid : userIdList) { jsonArray.add(userid); } jsonObject.add("useridlist", jsonArray); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.create() .fromJson( tmpJsonElement.getAsJsonObject().get("checkindata"), new TypeToken<List<WxCpCheckinData>>() { }.getType() ); } WxCpOAServiceImpl(WxCpService mainService); }
WxCpOAServiceImpl implements WxCpOAService { @Override public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList) throws WxErrorException { if (starttime == null || endtime == null) { throw new RuntimeException("starttime and endtime can't be null"); } if (userIdList == null || userIdList.size() > 100) { throw new RuntimeException("用户列表不能为空，不超过100个，若用户超过100个，请分批获取"); } long endtimestamp = endtime.getTime() / 1000L; long starttimestamp = starttime.getTime() / 1000L; if (endtimestamp - starttimestamp < 0 || endtimestamp - starttimestamp >= 30 * 24 * 60 * 60) { throw new RuntimeException("获取记录时间跨度不超过一个月"); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); jsonObject.addProperty("opencheckindatatype", openCheckinDataType); jsonObject.addProperty("starttime", starttimestamp); jsonObject.addProperty("endtime", endtimestamp); for (String userid : userIdList) { jsonArray.add(userid); } jsonObject.add("useridlist", jsonArray); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.create() .fromJson( tmpJsonElement.getAsJsonObject().get("checkindata"), new TypeToken<List<WxCpCheckinData>>() { }.getType() ); } WxCpOAServiceImpl(WxCpService mainService); @Override List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList); @Override List<WxCpCheckinOption> getCheckinOption(Date datetime, List<String> userIdList); @Override WxCpApprovalDataResult getApprovalData(Date starttime, Date endtime, Long nextSpnum); @Override List<WxCpDialRecord> getDialRecord(Date starttime, Date endtime, Integer offset, Integer limit); }
WxCpOAServiceImpl implements WxCpOAService { @Override public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList) throws WxErrorException { if (starttime == null || endtime == null) { throw new RuntimeException("starttime and endtime can't be null"); } if (userIdList == null || userIdList.size() > 100) { throw new RuntimeException("用户列表不能为空，不超过100个，若用户超过100个，请分批获取"); } long endtimestamp = endtime.getTime() / 1000L; long starttimestamp = starttime.getTime() / 1000L; if (endtimestamp - starttimestamp < 0 || endtimestamp - starttimestamp >= 30 * 24 * 60 * 60) { throw new RuntimeException("获取记录时间跨度不超过一个月"); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); jsonObject.addProperty("opencheckindatatype", openCheckinDataType); jsonObject.addProperty("starttime", starttimestamp); jsonObject.addProperty("endtime", endtimestamp); for (String userid : userIdList) { jsonArray.add(userid); } jsonObject.add("useridlist", jsonArray); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.create() .fromJson( tmpJsonElement.getAsJsonObject().get("checkindata"), new TypeToken<List<WxCpCheckinData>>() { }.getType() ); } WxCpOAServiceImpl(WxCpService mainService); @Override List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date starttime, Date endtime, List<String> userIdList); @Override List<WxCpCheckinOption> getCheckinOption(Date datetime, List<String> userIdList); @Override WxCpApprovalDataResult getApprovalData(Date starttime, Date endtime, Long nextSpnum); @Override List<WxCpDialRecord> getDialRecord(Date starttime, Date endtime, Integer offset, Integer limit);  }