| | |
| | | import com.dingtalk.api.DingTalkClient; |
| | | import com.dingtalk.api.request.OapiGettokenRequest; |
| | | import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; |
| | | import com.dingtalk.api.request.OapiUserGetByMobileRequest; |
| | | import com.dingtalk.api.request.OapiUserListidRequest; |
| | | import com.dingtalk.api.response.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.taobao.api.ApiException; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class DingTalkService { |
| | | |
| | |
| | | * @throws ApiException |
| | | */ |
| | | private static String getAccessToken() throws ApiException { |
| | | DefaultDingTalkClient client = |
| | | new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken"); |
| | | DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken"); |
| | | OapiGettokenRequest request = new OapiGettokenRequest(); |
| | | //Appkey |
| | | request.setAppkey("dingn8iip5ubj7clrrsv"); |
| | |
| | | JSONArray jsonArray = new JSONArray(jsonObject.getJSONObject("result").getJSONArray("userid_list")); |
| | | // 将JSONArray转为List列表 |
| | | String str = JSONObject.toJSONString(jsonArray); |
| | | List<String> list = JSONObject.parseObject(str,List.class); |
| | | List<String> list = JSONObject.parseObject(str, List.class); |
| | | |
| | | //电话号码数组 |
| | | // String[] split = mobile.split(","); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) throws ApiException { |
| | | public static void main(String[] args) throws ApiException, IOException { |
| | | // String appId = "wx1c5243d2337753f4"; |
| | | // String appSecret = "84a2186a0d175e88345267c716516cd3"; |
| | | // WeChatService weChatService = new WeChatService(appId, appSecret); |
| | | // weChatService.sendMessageToFollowers("你在说啥呢????"); |
| | | // // new com.smartor.controller.BaseSmsaccountController().sendMessageToFollowers("AIJSl-IF6M05NzaXofPYbT5wgSP3bWH7I9OBmvJqsaU","www.baidu.com"); |
| | | |
| | | sendNotification("17607179857", "1", "2", "3"); |
| | | // sendNotification("17607179857", "1", "2", "3"); |
| | | Workbook workbook = new XSSFWorkbook(); |
| | | Sheet sheet = workbook.createSheet("Sheet1"); |
| | | // 创建行和单元格,并设置单元格的值 |
| | | Row row = sheet.createRow(0); |
| | | row.createCell(0).setCellValue("姓名"); |
| | | row.createCell(1).setCellValue("性别"); |
| | | row.createCell(2).setCellValue("证件类型"); |
| | | row.createCell(3).setCellValue("出生日期"); |
| | | row.createCell(4).setCellValue("本人联系方式"); |
| | | row.createCell(5).setCellValue("亲属联系方式"); |
| | | row.createCell(6).setCellValue("患者标签"); |
| | | row.createCell(7).setCellValue("错误原因"); |
| | | |
| | | // 保存工作簿到文件 |
| | | FileOutputStream outputStream = new FileOutputStream("example.xlsx"); |
| | | workbook.write(outputStream); |
| | | outputStream.close(); |
| | | workbook.close(); |
| | | } |
| | | } |