代码更新
This commit is contained in:
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @Description: 日志监控
|
||||
* @Date: 2022-08-15
|
||||
*/
|
||||
//@RestController
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "日志监控")
|
||||
@RequestMapping("/api/loki")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.modules.loki.service.impl;
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -14,7 +15,7 @@ import org.springframework.stereotype.Service;
|
||||
* @Description: 实现类
|
||||
* @Date: 2022-08-15
|
||||
*/
|
||||
//@Service
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LokiServiceImpl implements LokiService {
|
||||
|
||||
@@ -72,21 +73,12 @@ public class LokiServiceImpl implements LokiService {
|
||||
*/
|
||||
@Override
|
||||
public JSONArray getLabelsValues() {
|
||||
/**
|
||||
* [{
|
||||
* label:
|
||||
* value:
|
||||
* children:[{
|
||||
* label
|
||||
* value
|
||||
* }]
|
||||
* }]
|
||||
*/
|
||||
JSONArray result = new JSONArray();
|
||||
// 获取所有标签
|
||||
String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8);
|
||||
JSONObject parse = (JSONObject) JSONObject.parse(labelString);
|
||||
JSONArray labels = parse.getJSONArray("data");
|
||||
if (ObjectUtil.isEmpty(labels)) return null;
|
||||
for (int i=0; i<labels.size(); i++) {
|
||||
// 获取标签下的所有值
|
||||
String valueString = HttpUtil.get(lokiUrl + "/label/" + labels.getString(i) + "/values", CharsetUtil.CHARSET_UTF_8);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class UserRelateServiceImpl implements UserRelateService {
|
||||
if (!CollectionUtils.isEmpty(userIds)){
|
||||
String collect = userIds.stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','"));
|
||||
String sql="user_id in ('"+collect+"')";
|
||||
WQLObject.getWQLObject("sys_users_roles").delete(sql);
|
||||
WQLObject.getWQLObject("sys_user_dept").delete(sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user