代码更新

This commit is contained in:
2022-12-08 14:41:24 +08:00
parent 7902ae10f6
commit 7e30b906d1
4 changed files with 11 additions and 21 deletions

View File

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
* @Description: 日志监控
* @Date: 2022-08-15
*/
//@RestController
@RestController
@RequiredArgsConstructor
@Api(tags = "日志监控")
@RequestMapping("/api/loki")

View File

@@ -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);

View File

@@ -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);
}
}