作者 钟来

飞书提交数据

@@ -7,6 +7,7 @@ import okhttp3.Request; @@ -7,6 +7,7 @@ import okhttp3.Request;
7 import okhttp3.Response; 7 import okhttp3.Response;
8 import org.slf4j.Logger; 8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
  10 +import org.springframework.web.bind.annotation.PathVariable;
10 11
11 import java.io.IOException; 12 import java.io.IOException;
12 import java.util.HashMap; 13 import java.util.HashMap;
@@ -84,4 +85,20 @@ public class FeishuUtil { @@ -84,4 +85,20 @@ public class FeishuUtil {
84 logger.error("提交飞书表数据异常",e); 85 logger.error("提交飞书表数据异常",e);
85 } 86 }
86 } 87 }
  88 +
  89 + public static String getFeishuTable( String tenant_access_token,String app_token, String table_id)
  90 + {
  91 + String url = "https://open.feishu.cn/open-apis/bitable/v1/apps/"+app_token+"/tables/"+table_id+"/records/search";
  92 + try {
  93 + Response response = HttpUtils.postJsonBody(url, builder -> {
  94 + builder.addHeader("Content-Type", "application/json");
  95 + builder.addHeader("Authorization", "Bearer "+tenant_access_token);
  96 + }, null);
  97 + String str = response.body().string();
  98 + return str;
  99 + } catch (IOException e) {
  100 + logger.error("查询飞书表数据异常",e);
  101 + }
  102 + return null;
  103 + }
87 } 104 }
@@ -9,10 +9,7 @@ import com.zhonglai.luhui.api.controller.test.dto.ClueData; @@ -9,10 +9,7 @@ import com.zhonglai.luhui.api.controller.test.dto.ClueData;
9 import io.swagger.annotations.Api; 9 import io.swagger.annotations.Api;
10 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
11 import org.springframework.util.StreamUtils; 11 import org.springframework.util.StreamUtils;
12 -import org.springframework.web.bind.annotation.GetMapping;  
13 -import org.springframework.web.bind.annotation.RequestBody;  
14 -import org.springframework.web.bind.annotation.RequestMapping;  
15 -import org.springframework.web.bind.annotation.RestController; 12 +import org.springframework.web.bind.annotation.*;
16 13
17 import javax.servlet.http.HttpServletRequest; 14 import javax.servlet.http.HttpServletRequest;
18 import java.io.IOException; 15 import java.io.IOException;
@@ -77,6 +74,20 @@ public class TestController { @@ -77,6 +74,20 @@ public class TestController {
77 "}"; 74 "}";
78 } 75 }
79 76
  77 + @ApiOperation("获取飞书多维表格数据")
  78 + @RequestMapping(value = "getFeishuTable/{app_token}/{table_id}")
  79 + public String getFeishuTable(@PathVariable String app_token, @PathVariable String table_id) throws IOException {
  80 + String str = FeishuUtil.getFeishuTable(FeishuUtil.gettenant_access_token("cli_a88a14d3b279d01c","Z3hpYKHeR1yR2aiv6Rp0mcnwKvehkzmT"),app_token,table_id);
  81 + if(null != str)
  82 + {
  83 + return str;
  84 + }
  85 + return "{\n" +
  86 + " \"code\": \"500\",\n" +
  87 + " \"message\": \"数据查询失败\"\n" +
  88 + "}";
  89 + }
  90 +
80 public static void main(String[] args) { 91 public static void main(String[] args) {
81 String jsr= "{\"store_id\":0,\"create_time\":\"1746668144\",\"gender\":\"未知\",\"action_type\":3,\"telephone\":\"18061271693\",\"promotion_id\":0,\"clue_source\":5,\"store_pack_id\":0,\"refer_dy_id\":\"2046931013\",\"app_name\":\"暂未获取到\",\"ad_id\":\"0\",\"module_id\":\"1805421364269097\",\"flow_type\":1,\"name\":\"未命名\",\"site_id\":\"0\",\"remark_dict\":{},\"adv_id\":\"0\",\"clue_type\":2,\"location\":\"山东+泰安\",\"id\":\"7501883876034215974\",\"module_name\":\"官方电话\",\"clue_convert_status\":\"外部流量\",\"refer_dy_name\":\"鱼儿乐>智慧渔业系统\"}"; 92 String jsr= "{\"store_id\":0,\"create_time\":\"1746668144\",\"gender\":\"未知\",\"action_type\":3,\"telephone\":\"18061271693\",\"promotion_id\":0,\"clue_source\":5,\"store_pack_id\":0,\"refer_dy_id\":\"2046931013\",\"app_name\":\"暂未获取到\",\"ad_id\":\"0\",\"module_id\":\"1805421364269097\",\"flow_type\":1,\"name\":\"未命名\",\"site_id\":\"0\",\"remark_dict\":{},\"adv_id\":\"0\",\"clue_type\":2,\"location\":\"山东+泰安\",\"id\":\"7501883876034215974\",\"module_name\":\"官方电话\",\"clue_convert_status\":\"外部流量\",\"refer_dy_name\":\"鱼儿乐>智慧渔业系统\"}";
82 ClueData clueData = GsonConstructor.get().fromJson(jsr, ClueData.class); 93 ClueData clueData = GsonConstructor.get().fromJson(jsr, ClueData.class);
@@ -96,7 +107,7 @@ public class TestController { @@ -96,7 +107,7 @@ public class TestController {
96 field.put("线索时间",Integer.parseInt(clueData.getCreate_time())*1000l); 107 field.put("线索时间",Integer.parseInt(clueData.getCreate_time())*1000l);
97 field.put("账号",clueData.getRefer_dy_name()); 108 field.put("账号",clueData.getRefer_dy_name());
98 field.put("联系方式",clueData.getTelephone()); 109 field.put("联系方式",clueData.getTelephone());
99 - field.put("渠道","测试数据看到请删除"); 110 + field.put("渠道","抖音平台");
100 // field.addProperty("地区",clueData.getLocation()); 111 // field.addProperty("地区",clueData.getLocation());
101 FeishuUtil.subFeishuTables(FeishuUtil.gettenant_access_token("cli_a88a14d3b279d01c","Z3hpYKHeR1yR2aiv6Rp0mcnwKvehkzmT"),"VLGDbZTtPaJIrgsAzzJcyb8Vnve","tblgzxv9TNwKjUFv",field); 112 FeishuUtil.subFeishuTables(FeishuUtil.gettenant_access_token("cli_a88a14d3b279d01c","Z3hpYKHeR1yR2aiv6Rp0mcnwKvehkzmT"),"VLGDbZTtPaJIrgsAzzJcyb8Vnve","tblgzxv9TNwKjUFv",field);
102 } 113 }
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 <div style="float: right; width: 70%"> 42 <div style="float: right; width: 70%">
43 <p> 43 <p>
44 <label for="streamUrl">url:</label> 44 <label for="streamUrl">url:</label>
45 - <input type="text" style="co; width:70%" id='streamUrl' value="https://192.168.0.100/index/api/webrtc?app=yuerle&stream=BA8609485&type=play"> 45 + <input type="text" style="co; width:70%" id='streamUrl' value="https://192.168.0.102/index/api/webrtc?app=yuerle&stream=BA8609485&type=play">
46 </p> 46 </p>
47 47
48 <p> 48 <p>