From e460e434fe3975a4ae33466710d8292245ad8e07 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期四, 19 六月 2025 18:09:33 +0800 Subject: [PATCH] 2025-06-19 --- src/main/java/com/example/controller/TestController.java | 142 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 122 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/example/controller/TestController.java b/src/main/java/com/example/controller/TestController.java index 54e00ae..3c379d7 100644 --- a/src/main/java/com/example/controller/TestController.java +++ b/src/main/java/com/example/controller/TestController.java @@ -1,20 +1,122 @@ -package com.example.controller; - -import com.example.utils.DictionaryUtil; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 - * @Author: zhaowenxuan - * @Date: 2024/6/3 15:25 - */ -@RestController -public class TestController { - @GetMapping("test") - public String test(){ - DictionaryUtil util = new DictionaryUtil(); - util.exec1(); - return "123"; - } -} +//package com.example.controller; +// +//import cn.hutool.json.JSONObject; +//import cn.hutool.json.JSONUtil; +//import com.example.domain.HisSyncDict; +//import com.example.service.HisSyncDictService; +//import com.example.utils.DictionaryUtil; +//import com.example.utils.DictionaryUtilNew; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.*; +// +//import java.io.*; +//import java.util.List; +// +///** +// * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃 +// * @Author: zhaowenxuan +// * @Date: 2024/6/3 15:25 +// */ +//@Slf4j +//@RestController +//public class TestController { +// private static final String LOG_PATH = "src/main/resources/log.log"; +// @Autowired +// private DictionaryUtil dictionaryUtil; +// @Autowired +// private DictionaryUtilNew dictionaryUtilNew; +// @Autowired +// private HisSyncDictService hisSyncDictService; +// +// /** +// * 鍏ㄩ儴瀛楀吀鍚屾 +// * @return +// */ +// @GetMapping("exec") +// public String exce(){ +// // 灏嗘枃浠跺唴瀹硅缃负绌� +// FileWriter fileWriter = null; +// try { +// fileWriter = new FileWriter(LOG_PATH); +// fileWriter.write(""); +// fileWriter.close(); +// } catch (IOException ignored) {} +// new Thread(()->{ +// // dictionaryUtil.exec1(); +// dictionaryUtilNew.exec1(); +// }).start(); +// return "宸叉彁浜ゆ墽琛�"; +// } +// +// /** +// * 鏄剧ず鏃ュ織 +// * @return +// */ +// @GetMapping("/show") +// public String showLog() { +// StringBuilder logContent = new StringBuilder(); +// try (BufferedReader reader = new BufferedReader(new FileReader(LOG_PATH))) { +// String line; +// while ((line = reader.readLine()) != null) { +// logContent.append(line).append("<br>"); +// } +// return logContent.toString(); +// } catch (IOException e) { +// log.error("Error reading log file", e); +// return e.getMessage(); +// } +// } +// +// /** +// * 娓呴櫎鏃ュ織 +// * @return +// */ +// @GetMapping("/clear") +// public String cleanLog() { +// try { +// // 灏嗘枃浠跺唴瀹硅缃负绌� +// FileWriter fileWriter = new FileWriter(LOG_PATH); +// fileWriter.write(""); +// fileWriter.close(); +// return "Log content cleared successfully."; +// } catch (IOException e) { +// e.printStackTrace(); +// return "Failed to clear log content."; +// } +// } +// +// /** +// * 鎵嬪姩鍚屾 +// * @param data json鏍煎紡 methods涓篠tring闆嗗悎 瀛樺偍瀛楀吀鍚� type涓哄竷灏旂被鍨� 鏄惁娓呯悊鏃ュ織 +// * @return +// */ +// @PostMapping("exec") +// public String execPost(@RequestBody String data){ +// JSONObject entries = JSONUtil.parseObj(data); +// List<String> methods = entries.getBeanList("methods", String.class); +// Boolean type = entries.getBool("type"); +// if (type){ +// FileWriter fileWriter = null; +// try { +// fileWriter = new FileWriter(LOG_PATH); +// fileWriter.write(""); +// fileWriter.close(); +// } catch (IOException ignored) {} +// } +// new Thread(()->{ +// // dictionaryUtil.exec1(); +// dictionaryUtilNew.execMethods(methods); +// }).start(); +// return "宸叉彁浜ゆ墽琛� 鎻愪氦瀛楀吀涓� ->"+methods+",鏄惁娓呯悊鏃ュ織 ->"+type; +// } +// +// @GetMapping("list") +// public String listDict(){ +// List<HisSyncDict> list = hisSyncDictService.list(); +// JSONObject obj = JSONUtil.createObj(); +// obj.putOpt("code",200); +// obj.putOpt("data",list); +// return obj.toString(); +// } +//} -- Gitblit v1.8.0