mirror of
https://gitee.com/huoyo/ko-time.git
synced 2025-12-06 16:58:26 +08:00
update:some interfaces
This commit is contained in:
parent
59dab8a26a
commit
a9e0f8b6dc
@ -36,48 +36,34 @@ public class KoClassController {
|
||||
@PutMapping("/{className}/replace")
|
||||
@ResponseBody
|
||||
@Auth
|
||||
public Map updateClass(@RequestParam("classFile") MultipartFile classFile, @PathVariable("className") String className) {
|
||||
Map map = new HashMap();
|
||||
public KoResult updateClass(@RequestParam("classFile") MultipartFile classFile, @PathVariable("className") String className) {
|
||||
if (classFile == null || classFile.isEmpty()) {
|
||||
map.put("state", 0);
|
||||
map.put("message", "文件不能为空");
|
||||
return map;
|
||||
return KoResult.failed("文件不能为空");
|
||||
}
|
||||
if (!StringUtils.hasText(className)) {
|
||||
map.put("state", 0);
|
||||
map.put("message", "类名不能为空");
|
||||
return map;
|
||||
return KoResult.failed("类名不能为空");
|
||||
}
|
||||
className = className.trim();
|
||||
File file = null;
|
||||
try {
|
||||
String originalFilename = classFile.getOriginalFilename();
|
||||
if (!originalFilename.endsWith(".class")) {
|
||||
map.put("state", 0);
|
||||
map.put("message", "仅支持.class文件");
|
||||
return map;
|
||||
return KoResult.failed("仅支持.class文件");
|
||||
}
|
||||
String[] filename = originalFilename.split("\\.");
|
||||
String substring = className.substring(className.lastIndexOf(".") + 1);
|
||||
if (!substring.equals(filename[0])) {
|
||||
map.put("state", 0);
|
||||
map.put("message", "请确认类名是否正确");
|
||||
return map;
|
||||
return KoResult.failed("请确认类名是否正确");
|
||||
}
|
||||
file = uploadFile(classFile.getBytes(), filename[0]);
|
||||
} catch (IOException e) {
|
||||
log.severe("Error class file!");
|
||||
map.put("state", 0);
|
||||
map.put("message", "无法解析文件");
|
||||
return map;
|
||||
return KoResult.failed("无法解析文件");
|
||||
}
|
||||
final ClassInfoService classService = SystemService.getInstance(ClassInfoService.class);
|
||||
classService.updateClass(className, file.getAbsolutePath());
|
||||
file.deleteOnExit();
|
||||
|
||||
map.put("state", 1);
|
||||
map.put("message", "更新成功");
|
||||
return map;
|
||||
return KoResult.success("更新成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,9 +24,9 @@ public class KoDynamicPropertyController {
|
||||
@PutMapping
|
||||
@ResponseBody
|
||||
@Auth
|
||||
public boolean updateDynamicProperties(@RequestBody TextParam textParam) {
|
||||
public KoResult updateDynamicProperties(@RequestBody TextParam textParam) {
|
||||
if (!StringUtils.hasText(textParam.getText())) {
|
||||
return false;
|
||||
return KoResult.failed("更新失败");
|
||||
}
|
||||
String[] textSplit = textParam.getText().trim().split("\n");
|
||||
Properties dynamicProperties = Context.getDynamicProperties();
|
||||
@ -45,16 +45,13 @@ public class KoDynamicPropertyController {
|
||||
dynamicProperties.setProperty(propertyStr,valueStr);
|
||||
}
|
||||
|
||||
return true;
|
||||
return KoResult.success();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ResponseBody
|
||||
@Auth
|
||||
public Map getDynamicProperties() {
|
||||
Map map = new HashMap();
|
||||
map.put("state", 0);
|
||||
map.put("message", "文件不能为空");
|
||||
public KoResult getDynamicProperties() {
|
||||
Properties dynamicProperties = Context.getDynamicProperties();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String key : dynamicProperties.stringPropertyNames()) {
|
||||
@ -63,7 +60,6 @@ public class KoDynamicPropertyController {
|
||||
stringBuilder.append(key+"="+value+"\n");
|
||||
}
|
||||
}
|
||||
map.put("data", stringBuilder.toString());
|
||||
return map;
|
||||
return KoResult.success(stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,10 +35,10 @@ public class KoExceptionController {
|
||||
@GetMapping("/{exceptionId}/details")
|
||||
@ResponseBody
|
||||
@Auth
|
||||
public List<ExceptionInfo> getMethodsByExceptionId(@PathVariable("exceptionId") String exceptionId, String message) {
|
||||
public KoResult getMethodsByExceptionId(@PathVariable("exceptionId") String exceptionId, String message) {
|
||||
GraphService graphService = GraphService.getInstance();
|
||||
List<ExceptionInfo> exceptionInfos = graphService.getExceptionInfos(exceptionId, message);
|
||||
return exceptionInfos;
|
||||
return KoResult.success(exceptionInfos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -526,8 +526,8 @@
|
||||
}
|
||||
|
||||
function loadDynamicProperties() {
|
||||
get(concatToken('contextPath/koTime/dynamicProperties'), function (data) {
|
||||
let text = data['data'];
|
||||
get(concatToken('contextPath/koTime/dynamicProperties'), function (res) {
|
||||
let text = res['content'];
|
||||
document.querySelector("#dynamicText").value = text;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user