Changes
parent
c6c5807250
commit
14db9cb390
|
@ -20,7 +20,10 @@
|
|||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -27,7 +27,7 @@ public class Rule {
|
|||
* 规则ID
|
||||
*/
|
||||
@Excel(name = "规则ID")
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 规则名称
|
||||
|
@ -42,7 +42,7 @@ public class Rule {
|
|||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
@Excel(name ="是否激活")
|
||||
@Excel(name = "是否激活")
|
||||
private String isActivate;
|
||||
/**
|
||||
* 规则描述
|
||||
|
|
|
@ -19,6 +19,31 @@
|
|||
|
||||
|
||||
<dependencies>
|
||||
<!-- //创建测试工程,引入依赖-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.17.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<!-- no more than 2.3.3-->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,27 +1,85 @@
|
|||
package com.muyu.rule.compile;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.ToolProvider;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import com.muyu.rule.scan.JavaCodeScan;
|
||||
import io.jsonwebtoken.io.IOException;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
import javax.tools.ToolProvider;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* java源码编译工具
|
||||
*/
|
||||
public class SourceCodeCompiler {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
int result = compiler.run(null, null, null, "D:\\ll\\Test.java");
|
||||
System.out.println(result == 0 ? "编译成功" : "编译失败");
|
||||
|
||||
//执行java 命令 , 空参数, 所在文件夹
|
||||
Process process = Runtime.getRuntime().exec("java Test", null, new File("D:\\ll\\"));
|
||||
/**
|
||||
* 1.获取系统java编译器
|
||||
*/
|
||||
private static JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
/**
|
||||
* 获取JAVA文件管理器
|
||||
*/
|
||||
private static StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
|
||||
|
||||
/**
|
||||
* 输入编译的文件夹路径
|
||||
*
|
||||
* @param path 文件夹路径
|
||||
*/
|
||||
public static void javaCompilerPath(String path) {
|
||||
File[] files = JavaCodeScan.javaSourceScanByPath(path);
|
||||
//进行编译
|
||||
javaCompiler(files);
|
||||
}
|
||||
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String str;
|
||||
while ((str = bufferedReader.readLine()) != null) {
|
||||
System.out.println(str);
|
||||
/**
|
||||
* 输入编译的文件夹路径
|
||||
*
|
||||
* @param filePath
|
||||
*/
|
||||
public static void javaCompilerFile(String... filePath) {
|
||||
int filesPathLength = filePath.length;
|
||||
File[] files = new File[filesPathLength];
|
||||
//定义要编译的源文件
|
||||
for (int i = 0; i < filesPathLength; i++) {
|
||||
files[i] = new File(filePath[i]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*可同时编译多个java源文件
|
||||
* @param file
|
||||
*/
|
||||
public static void javaCompiler(File... file) {
|
||||
//通过源文件获取到要编译的java类源码迭代器,包括所有内部类,其中每个类都是一个 javaFileObject,也被称为一个汇编单元
|
||||
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(file);
|
||||
//生成编译任务
|
||||
JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, null, null, null, compilationUnits);
|
||||
//执行编译任务
|
||||
task.call();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package com.muyu.rule.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.dtflys.forest.annotation.Get;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.rule.service.RuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
|
|
@ -115,6 +115,7 @@ public class RuleEditionController {
|
|||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -23,8 +23,10 @@ public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements Ru
|
|||
@Override
|
||||
public List<Rule> select(Rule rule) {
|
||||
LambdaQueryWrapper<Rule> ruleLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//获取到数据
|
||||
ruleLambdaQueryWrapper.select(Rule::getRuleType, Rule::getId, Rule::getRuleDesc, Rule::getIsActivate, Rule::getName);
|
||||
List<Rule> list = this.list(ruleLambdaQueryWrapper);
|
||||
//遍历
|
||||
list.forEach(rule1 -> {
|
||||
//给手机号脱敏
|
||||
rule1.setRuleDesc(Desensitization.mobilePhoneDesensitization(rule1.getRuleDesc()));
|
||||
|
|
Loading…
Reference in New Issue