路泰机电科技体检——数据平台后端
zhaowenxuan
2024-07-16 e3f3f2f2763ec63a1034ce4d12d6bf4923333547
修改参数类型
1个文件已修改
15 ■■■■ 已修改文件
src/main/java/com/example/controller/TestController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/controller/TestController.java
@@ -8,10 +8,7 @@
import com.example.utils.DictionaryUtilNew;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.io.*;
import java.util.List;
@@ -91,12 +88,14 @@
    /**
     * 手动同步
     * @param methods 同步的字典名
     * @param type 是否在同步前清除日志 默认否
     * @param data json格式 methods为String集合 存储字典名 type为布尔类型 是否清理日志
     * @return
     */
    @PostMapping("exec")
    public String execPost(@RequestParam("methods")List<String > methods,@RequestParam(value = "type",required = false,defaultValue = "false")Boolean type){
    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 {
@@ -109,7 +108,7 @@
            //                dictionaryUtil.exec1();
            dictionaryUtilNew.execMethods(methods);
        }).start();
        return "已提交执行";
        return "已提交执行 提交字典为 ->"+methods+",是否清理日志 ->"+type;
    }
    @GetMapping("list")