From 43fe4866496f4a60420f71d72204902f47c7dd7c Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Fri, 8 Sep 2023 19:39:21 +0800 Subject: [PATCH] updates --- .../example/zxweb/controller/KafkaController.java | 12 ++++++++++++ src/main/java/com/example/zxweb/utils/RestUtil.java | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/zxweb/controller/KafkaController.java b/src/main/java/com/example/zxweb/controller/KafkaController.java index 2033968..7768e4e 100644 --- a/src/main/java/com/example/zxweb/controller/KafkaController.java +++ b/src/main/java/com/example/zxweb/controller/KafkaController.java @@ -7,6 +7,7 @@ import com.example.zxweb.dto.GuangZhaoChuanGanQiDTO; import com.example.zxweb.dto.HuanJingJianCeDTO; import com.example.zxweb.dto.KafkaConsumerDTO; import com.example.zxweb.dto.KongQiZhiLiangChuanGanQiDTO; +import com.example.zxweb.utils.CacheManager; import com.example.zxweb.utils.KafkaUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -35,6 +36,17 @@ import java.util.*; public class KafkaController { @Resource private KafkaUtil kafkaUtil; + + + @GetMapping("/test") + public Result test(){ + String test = (String) CacheManager.get("test"); + if (StringUtils.isEmpty(test)) { + CacheManager.put("test","张三"+new Date().getTime()); + } + return Result.OK(test); + } + @GetMapping("/consumer/{topic}") @ApiOperation(value = "consumer") public Result getConsumerData(@PathVariable String topic) { diff --git a/src/main/java/com/example/zxweb/utils/RestUtil.java b/src/main/java/com/example/zxweb/utils/RestUtil.java index 6c9f1d2..8e4cf91 100644 --- a/src/main/java/com/example/zxweb/utils/RestUtil.java +++ b/src/main/java/com/example/zxweb/utils/RestUtil.java @@ -184,7 +184,7 @@ public class RestUtil { }else{ headers= new HttpHeaders(); for (String s : header.keySet()) { - /*if ("Authorization".equals(s)) { + /*if ("Authorization".equals(s)) {+ JSONObject jsonObject = header.getJSONObject(s); String username = jsonObject.getString("username"); String password = jsonObject.getString("password"); @@ -200,7 +200,6 @@ public class RestUtil { if (StringUtils.isNotBlank(cookie)) { headers.add("Cookie",cookie); } - return request(url, method, headers, variables, params, JSONObject.class); }