main
周文涛 2 years ago
parent 33a014825f
commit 43fe486649

@ -7,6 +7,7 @@ import com.example.zxweb.dto.GuangZhaoChuanGanQiDTO;
import com.example.zxweb.dto.HuanJingJianCeDTO; import com.example.zxweb.dto.HuanJingJianCeDTO;
import com.example.zxweb.dto.KafkaConsumerDTO; import com.example.zxweb.dto.KafkaConsumerDTO;
import com.example.zxweb.dto.KongQiZhiLiangChuanGanQiDTO; import com.example.zxweb.dto.KongQiZhiLiangChuanGanQiDTO;
import com.example.zxweb.utils.CacheManager;
import com.example.zxweb.utils.KafkaUtil; import com.example.zxweb.utils.KafkaUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -35,6 +36,17 @@ import java.util.*;
public class KafkaController { public class KafkaController {
@Resource @Resource
private KafkaUtil kafkaUtil; 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}") @GetMapping("/consumer/{topic}")
@ApiOperation(value = "consumer") @ApiOperation(value = "consumer")
public Result<?> getConsumerData(@PathVariable String topic) { public Result<?> getConsumerData(@PathVariable String topic) {

@ -184,7 +184,7 @@ public class RestUtil {
}else{ }else{
headers= new HttpHeaders(); headers= new HttpHeaders();
for (String s : header.keySet()) { for (String s : header.keySet()) {
/*if ("Authorization".equals(s)) { /*if ("Authorization".equals(s)) {+
JSONObject jsonObject = header.getJSONObject(s); JSONObject jsonObject = header.getJSONObject(s);
String username = jsonObject.getString("username"); String username = jsonObject.getString("username");
String password = jsonObject.getString("password"); String password = jsonObject.getString("password");
@ -200,7 +200,6 @@ public class RestUtil {
if (StringUtils.isNotBlank(cookie)) { if (StringUtils.isNotBlank(cookie)) {
headers.add("Cookie",cookie); headers.add("Cookie",cookie);
} }
return request(url, method, headers, variables, params, JSONObject.class); return request(url, method, headers, variables, params, JSONObject.class);
} }

Loading…
Cancel
Save