|
@@ -0,0 +1,46 @@
|
|
|
+package com.fjhx.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 目录 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author zlj
|
|
|
+ * @since 2023-08-09
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/open")
|
|
|
+public class SystemMenuController {
|
|
|
+
|
|
|
+ private static final RestTemplate restTemplate = new RestTemplate();
|
|
|
+
|
|
|
+ @Value("${byteSailing.dingding.url}")
|
|
|
+ private String url;
|
|
|
+
|
|
|
+ @PostMapping(value = "/dingCallback")
|
|
|
+ public Object dingCallback(
|
|
|
+ @RequestParam(value = "signature") String signature,
|
|
|
+ @RequestParam(value = "timestamp") Long timestamp,
|
|
|
+ @RequestParam(value = "nonce") String nonce,
|
|
|
+ @RequestBody(required = false) JSONObject body) {
|
|
|
+
|
|
|
+ String param = "?signature=" + signature + "×tamp=" + timestamp + "&nonce=" + nonce;
|
|
|
+
|
|
|
+ try {
|
|
|
+ String result = restTemplate.postForObject(url + param, body, String.class);
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("钉钉回调转发失败", e);
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|